Chapter 5 [BX] and loop commands
Lab 4
1. Programming: 0-to memory ~ 0: 23f transfers data in sequence 0 ~ 63 (3fh)
Assume Cs: Code
Code segment
MoV ax, 0
MoV ds, ax
MoV BX, 200 h
MoV dx, 0
MoV CX, 3fh
S: mov DS: [BX], DX
INC DX
INC BX
Loop s
MoV ax, 4c00h
Int 21 h
Code ends
End
2. Programming: 0-to memory ~ 0: 23f upload data in sequence 0 ~ 63 (3fh), the program can only use 9 commands
The nine Commands include mov ax, 4c00h, and INT 21 h ".
Assume Cs: Code
Code segment
MoV ax, 20 h
MoV ds, ax
MoV BL, 0
MoV CX, 64
S: mov DS: [BX], BL
INC BL
Loop s
MoV ax, 4c00h
Int 21 h
Code ends
End
3. The function of the following program is to copy the commands before "mov ax, 4c00h" to the memory,
Complete the program. Debug the machine and track the running results.
Assume Cs: Code
Code segment
MoV ax, CS
MoV ds, ax
MoV ax, 0020 H
MoV es, ax
MoV BX, 0
MoV CX, 17 h
S: mov Al, [BX]
MoV ES: [BX], Al
INC BX
Loop s
MoV ax, 4c00h
Int 21 h
Code ends
End
// The initial value of Cx is the total length of code, CS-5
D:/MASM/src> debug test4.exe
-R
Ax = 0000 BX = 0000 Cx = 001c dx = 0000 sp = 0000 BP = 0000 Si = 0000 di = 0000
DS = 0b7d es = 0b7d Ss = 0b8d cs = 0b8d IP = 0000 NV up ei pl nz Na Po NC
0b8d: 0000 8cc8 mov ax, CS
-G
5 bytes: mov ax, 4c00h, int 21h length, calculate the number of machine code bytes in this use U View
0b8d: 0017 b8004c mov ax, 4c00
0b8d: 001a cd21 int 21