wichtounet/thor-os

Incorrect jump in /bootloader/intel_16.asm

AtieP opened this issue · 1 comments

AtieP commented

Doing

test al, al
je .done

is incorrect because you really want to check if AL is 0, not if they're equal.
You should put jz .donebecause this will jump to .done if AL is 0. I recommend you also to use cmp al, 0 instead of test al, al.

Hope this helps :D

Actually, it's not incorrect but I agree that it's not as clear as it could be :)

je and jz are exactly the same instruction. And test will correctly set the flags as cmp. So, in that case, either test and cmp will do the same thing and cmp 0, al and test al,al will do the same thing too.

Thanks for sharing :)