Nobody Understands It
Ehrm. Let's see my train of thought. You see 0x1ppp, you already know it's hexadecimal and that it's a 16-bit value, so each "p" must represent a 4-bit value (a nibble). Reading them as a whole, you get [ppp], which is a 12-bit value. But then I mention that it's actually a 10-bit value which means its highest two bits are ignored. I also mention that the X component of the cursor position make up the low 5 bits and the Y component the high 5 bits. There's literally nothing more to do than shifting the Y component to the left by 5 bits, ORing it with the X component and ORing the result with 0x1000.
I mean, come on, we're talking assembler here.
Well Your Train Of THought Is What I Spent 3 Hours Yesterday Trying To Figure Out... I Mean It's A Really Good Idea However For People Like Me Who Have Littile To No Knowlage With Asm It's Slightly Confusing. I Started Codeing With C++ (On The Arduino Microcontroller Platform) About 3 Years Ago But I Rarely Ever Had To Use Hex Values :P
@cmk20, so, in order to convert your screen coordinates: e.g. (5, 5) to the format for the screen:
Take the Y (5), convert it to binary, shift it to the left by 5 bits, OR it with the X (5), and OR this result with 0x1000, or 0001000000000000. So, the coordinates (5, 5) become 0x10A5.
I wrote a very useful function to print a newline (top to bottom). It automatically calculates the cursor position in order to do its job, and requires the DX register to count lines:
;printNl: Advances cursor to the next line, requires DX register as a line counter
printNl:
add dx, 0x0002 ;Adds 2 lines to the counter (configure)
cmp dx, 0x0016 ;If there are more than 16 lines, jump to
jge scrollUp ;the scroll up function (configure)
printNlEntryPoint:
push dx ;Save the data held in DX
shl dx, 0x0005 ;Generate/send exact cursor location by shifting
or dx, 0x0001 ;the Y (stored in DX) to the left by 5 bits and
or dx, 0x1000 ;performing a bitwise OR on it and the X
send 0, dx ;(configure), before ORing it with 0x1000
pop dx ;Restore value of DX
ret
scrollUp:
push ex ;Save the data held in EX
mov ex, 0 ;Configure EX for serial port 0 of the RTERM
send ex, 0x3000 ;Send the RTERM two downward line scroll commands
send ex, 0x3000
mov dx, 0x0015 ;Change value of DX to 15 lines (configure)
pop ex ;Restore value of EX
jmp printNlEntryPoint ;Jump the entry point in the main part of function