赞
踩
assume cs:codeseg
codeseg segment
start: mov ax,offset start ;相当于mov ax,0
s: mov ax,offset s ;相当于mov ax,3
codeseg ends
end start
IP
,也可以同时修改CS
和IP
076A:0000 B80000 MOV AX,0000
076A:0003 EB05 JMP 000A ;EB05 + 0005 = ...A
076A:0005 050100 ADD AX,0001
076A:0008 90 NOP
076A:0009 90 NOP
076A:000A 40 INC AX
jmp short 标号
-128~127
= "标号"处的地址 - jmp指令后的第一个字节的地址
assume cs:codesg
codesg segment
start: mov ax,0
jmp short s
add ax,1
s: inc ax
codesg ends
end start
jmp near ptr 标号
-32769~32767
= "标号"处的地址 - jmp指令后的第一个字节的地址
near ptr
指明了相对于当前IP的转移位移,而不是转移的目的地址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 far ptr
标号far ptr
指明了跳转到的目的地址,即包含了标号的段地址CS和偏移地址IPassume 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 16位寄存器
assume cs:codesg
codesg segment
start: mov ax,0
mov bx,ax
jmp bx
mov ax,0123H
codesg ends
end start
jmp word ptr
内存单元地址jmp dword ptr
内存单元地址assume cs:codesg
codesg segment
start: mov ax,2000H
mov ds, ax
mov bx,0
s: mov cx, [bx]
jczx ok
inc bx
inc bx
jmp short s
ok: mov dx,bx
mov ax,4c00H
int 21H
codesg ends
end start
标号处的地址
- call指令后的第一个字节的地址
call标号
类似jmp near ptr 标号
,对应机器指令中为相对于当前IP的转移位移,而不是转移的目的地址,实现段内转移 mov ax,0
call s
mov ax,4c00h
int 21h
s:add ax,1
ret
"call far ptr"
相当于 mov ax,0
call far ptr s
...
mov ax,4c00h
int 21h
s:add ax,1
ret
push IP
jmp 16位寄存器
mov ax,0
call ax
...
mov ax,4c00h
int 21h
call word ptr
内存单元地址mov sp,10h ;栈顶指针寄存器,当放入转移地址后,栈顶指针会向下偏移一个字
mov ax,0123h
mov ds:[0],ax
call word ptr ds:[0]
执行后,(IP)=0123H,(sp)=0EH
mov sp,10h
mov ax,0123h
mov ds:[0],ax ;低地址放偏移地址
mov word ptr ds:[2],0 ;高地址放段地址
call dword ptr ds:[0]
执行后,(CS)=0,(IP)=0123H,(sp)=0CH
assume cs:code
code segment
main: ...
call sub1
...
mov ax,4c00h
int 21h
sub1: ...
call sub2
...
assume cs:code ss:stack stack segment db 8 dup (0) db 8 dup (0) stack ends code segment start: mov ax,stack mov ss,ax mov sp,16 mov ax,1000 call s mov ax,4c00h int 21h s: add ax,ax ret code ends end start
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。