Chapter 4 first program
Experiment 3 programming, compilation, connection, and tracking
1. Save the following program as a t1.asm file and generate the executable file t1.exe.
Assume Cs: codesg
Codesg segment
MoV ax, 2000 h
MoV SS, ax
MoV sp, 0
Add SP, 10
Pop ax
Pop BX
PUSH AX
Push BX
Pop ax
Pop BX
MoV ax, 4c00h
Int 21 h
Codesg ends
End
2. Use debugto track the execution process of t1.exe and write the internal
Content on the content and stack top
Debug t1.exe
-R
Ax = 0000 BX = 0000 Cx = 0016 dx = 0000 sp = 0000 BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 0b8d cs = 0b8d IP address = 0000
-T
Ax = 2000 BX = 0000 Cx = 0016 dx = 0000 sp = 0000 BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 0b8d cs = 0b8d IP address = 0003
-T
Ax = 2000 BX = 0000 Cx = 0016 dx = 0000 sp = 0000 BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 2000 cs = 0b8d IP = 0008
-T
Ax = 2000 BX = 0000 Cx = 0016 dx = 0000 sp = 000a BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 2000 cs = 0b8d IP = 000b
-T
Ax = 0000 BX = 0000 Cx = 0016 dx = 0000 sp = 000a BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 2000 cs = 0b8d IP = 000c
-T
Ax = 0000 BX = 0000 Cx = 0016 dx = 0000 sp = 000e BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 2000 cs = 0b8d IP = 000d
-T
Ax = 0000 BX = 0000 Cx = 0016 dx = 0000 sp = 000c BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 2000 cs = 0b8d IP = 000e
-T
Ax = 0000 BX = 0000 Cx = 0016 dx = 0000 sp = 000c BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 2000 cs = 0b8d IP = 0010
-T
Ax = 0000 BX = 0000 Cx = 0016 dx = 0000 sp = 000e BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 2000 cs = 0b8d IP = 0011
-T
Ax = 4c00 BX = 0000 Cx = 0016 dx = 0000 sp = 000e BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 2000 cs = 0b8d IP = 0014
-P
Program terminated normally
3. Use debug‑t1.exe to view the PSP content.
0b7d: 0 // PSP address
0b8d: 0 // program address
PSP = 0b7d * 16 + 0 = fcbe // physical PSP address
0b7d + 10 h: 0 // CIDR block address and offset address
-D 0b7d: 0 can be viewed