print_string:
lodsb ; grab a byte from SI
cmp al, 0
;or al, al ; logical or AL by itself
jz .done ; if the result is zero, get out
mov ah, 0x0E
int 0x10h
I'm wondering how or al, al works. I know that it tests to see if all of the characters in the string have been printed out? But I don't understand the logic.
If al is 0 (or rather, the result of or al, al is 0, which only happens when al is 0), then it sets the zero flag. The jump (jz), tests the zero flag and jumps if it is set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With