1

我找到了编写引导加载程序的教程。除了 1 行之外,这对我来说都很清楚。这是一些代码。

Print:
    lodsb
    or al, al ;I don't get this line
    jz PrintDone
    mov ah, 0x0e
    int 0x10
    jmp Print

它还有一些其他代码可以清除 int 0x10 使用的寄存器。我唯一不明白的是 or al, al 行。如果你用它自己做一些事情,你会得到你开始的东西吗?

如果有人能回答这个问题,我会永远爱他们:)

4

1 回答 1

4

JZ 指令是 JMP 指令的一种形式,只是跳转仅在设置零标志时发生。如果 al 为零,则“OR AL, AL”设置零标志。这比使用 CMP 比较更有效。

CMP AX,0        ;see if the number in ax is zero (zero flag set if so)
OR AX,AX        ;this does exactly the same but uses 2 bytes instead of 3
TEST AX,AX      ;again this is the same and uses only 2 bytes
于 2012-10-20T07:47:29.370 回答