我有以下 asm 代码(x86)。
.input:
mov ah, 00h ; get key from keyboard buffer
int 16h ; interrupt 16h
mov dl, al ; move ASCII code into dl
mov ah, 02h ; function 02
int 21h ; interrupt 21h
mov ah, 0Eh ; tell the BIOS to print the character in the AL register
mov al, dl ; copy dl into al
int 10h ; print al
sub al,0Dh ; check if it's carriage return
jz 01h ; jump relative 1 (to skip newLine)
call newLine ; add CR LF
jmp .input ; loop
但是,如果零指令没有按预期(希望)工作,即 jz 01h,则跳转。
我想跳过相对的 1 条指令(或向 IP 加一条),以跳过 call newLine 子程序。
目前,当我按下回车键并调用 jz 指令时,我相信程序在程序运行的早期就绝对跳跃,因为一段代码。
有任何想法吗?
谢谢,史蒂夫