本文为《汇编语言程序设计》0903小节例程。点击链接…进课程主页。
jmp指令:依据位移进行转移
程序1:
assume cs:codesg
codesg segment
start: mov ax,0
jmp short s
add ax,1
s: inc ax
codesg ends
end start
程序2:
assume cs:codesg
codesg segment
start: mov ax,0
jmp short s
add ax,1
nop
nop
s: inc ax
codesg ends
end start
远转移:jmp far ptr 标号
assume cs:codesg
codesg segment
start: mov ax,0
mov bx,0
jmp far ptr s
db 256 dup (0)
s: add ax,1
inc ax
codesg ends
end start
近转移:jmp near ptr 标号
assume cs:codesg
codesg segment
start: mov ax,0
mov bx,0
jmp near ptr s
db 256 dup (0)
s: add ax,1
inc ax
codesg ends
end start
转移地址在寄存器中的jmp指令
assume cs:codesg
codesg segment
start: mov ax,0
mov bx,ax
jmp bx
mov ax,0123H
codesg ends
end start