2014-10-05 10:54:46 +00:00
|
|
|
print:
|
|
|
|
pusha
|
|
|
|
|
|
|
|
; keep this in mind:
|
|
|
|
; while (string[i] != 0) { print string[i]; i++ }
|
|
|
|
|
|
|
|
; the comparison for string end (null byte)
|
|
|
|
start:
|
|
|
|
mov al, [bx] ; 'bx' is the base address for the string
|
|
|
|
cmp al, 0
|
|
|
|
je done
|
|
|
|
|
|
|
|
; the part where we print with the BIOS help
|
|
|
|
mov ah, 0x0e
|
|
|
|
int 0x10 ; 'al' already contains the char
|
|
|
|
|
2014-10-05 11:05:37 +00:00
|
|
|
; increment pointer and do next loop
|
2014-10-05 10:54:46 +00:00
|
|
|
add bx, 1
|
|
|
|
jmp start
|
|
|
|
|
|
|
|
done:
|
|
|
|
popa
|
|
|
|
ret
|
2014-10-05 18:12:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print_nl:
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov ah, 0x0e
|
|
|
|
mov al, 0x0a ; newline char
|
|
|
|
int 0x10
|
|
|
|
mov al, 0x0d ; carriage return
|
|
|
|
int 0x10
|
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|