My print string function
Posted: Sat Mar 20, 2004 5:47 am
Hello.
I have got a couple of cursor functions and a print_char (bl = char, bh = attrib) function.
I then wrote a print function that uses print_char.
It looks like this:
it may be a bit messy right now, becasue i have modified it alot.
as i said, the print_char function works just fine and it does also takes care about the cursor and scrolling up.
whats worng with this d*mn code?
/ Christoffer
I have got a couple of cursor functions and a print_char (bl = char, bh = attrib) function.
I then wrote a print function that uses print_char.
It looks like this:
Code: Select all
; Display a asciiz message on the screen.
; Input: ESI = Message, AL = COLOR.
;--------------------------------------------
print:
pusha ; save all registers (just in case)
mov bh, al ; move attrib. to bh
.DisplayChar:
lodsb ; load next character
or al, al ; test for NULL character
jz .Done
cmp al, 0x0D ; Check for ENTER
je .Enter
cmp al, 0x0A ; ignore the sec. enter char
je .DisplayChar
mov bl, al ; BL = char. Bh = attrib.
call print_char ; print it.
jmp .DisplayChar
.Enter:
call getcursorxy ; DH = X . DL = Y.
mov dh, 0x00
inc dl
call setcursorxy
jmp .DisplayChar
.Done:
popa ; restore all registers.
ret
as i said, the print_char function works just fine and it does also takes care about the cursor and scrolling up.
whats worng with this d*mn code?
/ Christoffer