Comment your code so that people can understand the purpose of the 544.
Code: Select all
cli
mov ss, ax
mov sp, 0x4096
sti
You could probably think of a better place to put your stack, though it may not matter.
Code: Select all
mov ax, 0x7C00
mov ds, ax
mov byte [bootdev], dl
jmp ajust
ajust:
mov eax, 0
jmp do
Saving dl is sensible, but you should comment your code to say why. Don't know why you're putting in the unnecessary jumps, or why you feel the need to load eax at this stage.
It looks as all the above code should work though, assuming the assembler expects ds to contain 7c00 when it calculates the address for the string - I don't know enough about assembler to tell you if there's a problem there.
Code: Select all
print:
pusha
mov ah, 0x0E
.print_1:
lodsb
cmp al, 0
je .print_done
int 0x10
jmp .print_1
.print_done:
popa
ret
The int 0x10 may corrupt si, so try pushing si before int 0x10 and popping it afterwards. It isn't beyond possibility that the BIOS could corrupt ds as well, so you might want to reload that each time too. I've never used the BIOS to do printing so I don't know if you're doing it the right way, but you probably are as you say it works when you load al directly with a char value. If you want to try printing direct to the screen without going through the BIOS, load es with b800 and use stosw to send char vals to even addressses (starting at 0) and colour values to the odd addresses following them.