DragonVM/extra/dss/newTest.dss

48 lines
No EOL
1.9 KiB
Text

##=================================================================================================================================
## This is the test2 program for the Dragon Virtual Machine. This example simply demonstrates the Virtual Display in Text-Single-Color
## mode, by printing an increasing counter followed by whatever is in the $string variable. The program also clears the screen
## every 10 lines.
##=================================================================================================================================
.load 0x1740
.data
$string "Hello World!!"
.code
mov R1, 0x7FF0 ## Zero the counter
infinite_loop:
inc R1 ## Increment the counter
div R1, 10 ## Divide the counter by 10
mov ACC, RV
jne $no_clear_screen, 0 ## If reminder not zero, keep going
mov R10, 0xE0 ## Else clear the screen (0x0E is for 'Clear Screen' functionality in int 0x30)
int 0x30 ## BIOS Video Interrupt
no_clear_screen:
## Print counter
mov R9, R1 ## Pass the counter as parameter to int 0x30
mov R10, 0x05 ## 0x05 is for 'Store Integer in buffer' functionality in int 0x30
int 0x30 ## BIOS Video Interrupt
## Print a space
mov R9, 32 ## Pass 32 (space character in ASCII) as parameter to int 0x30
mov R10, 0x06 ## 0x06 is for 'Store Character in buffer' functionality in int 0x30
int 0x30 ## BIOS Video Interrupt
## Print the string
mov R9, $string ## Pass the address of the string as parameter to int 0x30
mov R10, 0x0A ## 0x0A is for 'Store String in buffer' functionality in int 0x30
int 0x30 ## BIOS Video Interrupt
## Print a new-line character
mov R10, 0x02 ## 0x02 is for 'Print New-Line' functionality in int 0x30
## Printing a new line when in Text-Single-Color Mode also
## prints and flushes the buffer
int 0x30 ## BIOS Video Interrupt
jmp $infinite_loop ## jump to the beginning of infinite loop
hlt
.fixed 512, 0x00