Hi,
Antti wrote:
OK, I try to contribute something more meaningful to this thread. Take this code as an example where I made some additions:
Code:
; Prints a message on the screen using the BIOS.
; SI -> the address of the null terminated string.
Print:
pushad
cld ; Added by Antti
.PrintLoop:
lodsb ; Load the value at [@es:@si] in @al.
test al, al ; If AL is the terminator character, stop printing.
je .PrintDone
mov ah, 0x0E
mov bx, 0x0007 ; Added by Antti
push si ; Added by Antti
int 0x10
pop si ; Added by Antti
jmp .PrintLoop ; Loop till the null character not found.
.PrintDone:
popad ; Pop all general purpose registers to save them.
ret
The main idea is to make this more robust by making minimum amounts of assumptions. I do not claim you should change it this way.
First of all, thanks for the suggestions! I'd like to apologize, since I don't have the specs ready (this thread was mostly a creation due to my self-confidence being low). The direction flag should be guaranteed clear, over here. As for bx, Ralf Brown's
list says that BL only needs to be set for graphics mode. Afair,
this is used for setting the color.
As far as the push/pop of si is concerned -- I get your point, and I'll fix that for all BIOS interrupts I use (not presume it doesn't disturb needed registers).
dozniak wrote:
Purely stylistic: I think you're making too nested directory trees.
That issue (more of an issue, since it disturbs normal navigation) has been noted, and I'll be fixing it soon. You don't want to get lost in directories anyway.
As for the general purpose of the thread, it's going well. Most of the things pointed out were little things, while I was expecting something like, "
You idiot, you don't even know how to code -- go learn C first." If anyone has to say something similar to that, I'm more than happy for the criticism.
Regards,
Shikhin