DS CS When the program is running

Source: Internet
Author: User

Program

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 results

Microsoft Windows [Version 6.1.7601]
Copyright (c) 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
-

So what if you want to see the UNIX and fork defined in data?

Can execute debug command d 141f:0

Results

141f:0000 6E, 6F 6b-00, xx, xx, xx, xx unixfork ...
141f:0010 B0 B3 B8 4C CD-21 xx xx xx xx. 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 .......

There's a problem here. ds=140f CS equals 1420 It doesn't seem to happen that UNIX and fork addresses are in

141f:0000 (Start).

The explanation here is that DS holds the segment address of all memory areas of the program

And at the beginning of each code snippet there is a 256-byte PSP (pre-paragraph description program) of 0010h

Where the code snippet and PSP are in all memory areas

Therefore, the beginning of the program should be all memory area of the short address that DS content plus 0010h (skip PSP)

There are still doubts can be seen ds+0010h and SS after the same value and not the same as the imagined CS Sai Tou CS is more than the SS 1 reasons have not understood yet to be resolved

DS CS When the program is running

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.