Wang Shuang compiles Chapter 5 job [BX] and loop commands

Source: Internet
Author: User

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

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.