为啥call s == call offset s?
Plain Text code1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
assume cs:codesg, ds:datasg, ss:stacksg
datasg segment
dw 0
datasg ends
stacksg segment
dw 16 dup(0)
stacksg ends
codesg segment
start:
mov ax, datasg
mov ds, ax
mov bx, 0
call s
s:
mov ax, 2
mov ax, 4c00h
int 21h
codesg ends
end start
它的机器指令是
Plain Text code
1
2
3
4
5
6
7
8
-u
14A0:0000 B89D14 MOV AX,149D
14A0:0003 8ED8 MOV DS,AX
14A0:0005 BB0000 MOV BX,0000
14A0:0008 E80000 CALL 000B
14A0:000B B80200 MOV AX,0002
14A0:000E B8004C MOV AX,4C00
14A0:0011 CD21 INT 21
而Plain Text code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
assume cs:codesg, ds:datasg, ss:stacksg
datasg segment
dw 0
datasg ends
stacksg segment
dw 16 dup(0)
stacksg ends
codesg segment
start:
mov ax, datasg
mov ds, ax
mov bx, 0
call offset s
s:
mov ax, 2
mov ax, 4c00h
int 21h
codesg ends
end start
编译结果
D:\asm\prj>ml 35.asm
Microsoft (R) Macro Assembler Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000.All rights reserved.
Assembling: 35.asm
Microsoft (R) Segmented Executable LinkerVersion 5.60.339 Dec5 1994
Copyright (C) Microsoft Corp 1984-1993.All rights reserved.
Object Modules [.obj]: 35.obj
Run File : "35.exe"
List File : NUL
Libraries [.lib]:
Definitions File :
LINK : warning L4021: no stack segment
它的机器指令是
Plain Text code
1
2
3
4
5
6
7
14A0:0000 B89D14 MOV AX,149D
14A0:0003 8ED8 MOV DS,AX
14A0:0005 BB0000 MOV BX,0000
14A0:0008 E80000 CALL 000B
14A0:000B B80200 MOV AX,0002
14A0:000E B8004C MOV AX,4C00
14A0:0011 CD21 INT 21
本以为call offset s会跳到此指令下一条的IP+offset s(s到ip=0的编移)去,但是从结果看是跳到此指令下一条+到s的编移地址
同时还发现jmp s与jmp offset s的机器指令一样~.
完了 变乱码了~~~~~~~~~~~~~~~~
问题就是为啥call s与call offset s的机器指令一样~~~~~~~~~~~~
页:
[1]