标签:
程序
assume cs:code,ds:data
data segment
db ‘unix‘
db ‘fork‘
data ends
code segment
start: mov al,‘a‘
mov bl ,‘b‘
mov ax,4c00h
int 21h
code ends
end start
————————————————————————————————————————————————
debug结果
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Administrator>e:
E:\>cd compilation
E:\compilation>debug 71.exe
-r
AX=0000 BX=0000 CX=0019 DX=0000 SP=0000 BP=0000 SI=0000 DI=0000
DS=140F ES=140F SS=141F CS=1420 IP=0000 NV UP EI PL NZ NA PO NC
1420:0000 B061 MOV AL,61
-
那么如果要查看data中定义的unix和fork怎么看呢?
可以执行debug命令 d 141f:0
结果
141F:0000 75 6E 69 78 66 6F 72 6B-00 00 00 00 00 00 00 00 unixfork........
141F:0010 B0 61 B3 62 B8 00 4C CD-21 00 00 00 00 00 00 00 .a.b..L.!.......
141F:0020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
141F:0030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
141F:0040 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
141F:0050 00 00 00 00 00 00 00 00-00 00 00 01 25 04 00 00 ............%...
141F:0060 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
141F:0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
这里就出现问题了ds=140f cs等于1420 好像无论如何都不会出现unix和fork的地址在
141F:0000(开头)吧。
此处的解释是 ds存放着程序所有内存区的段地址
而在每个代码段的开头都有256了字节即0010h的的psp(段前说明程序)
其中代码段和psp在所有内存区中
故程序的起始处应该是所有内存区的短地址即ds的内容加上0010h(跳过psp)
依然存在的疑问 可以看出ds+0010h后和ss的值相同 而不是和想象中的cs想头 cs还要比ss大1 原因至今没懂 未完待解决
标签:
原文地址:http://www.cnblogs.com/aloney/p/4482964.html