Compile assembly language Experiment 5 and Debug Programs with multiple segments

Source: Internet
Author: User

1.ProgramCompile the connection, load, track, and answer questions.

(1)

Data from 0 to F is 23 01 56 04 89 07 BC 0a EF 0d ed 0f Ba 0C 87 09

(2)

Different scenarios: CS is 13c7 DS and 13c5 SS is 13c6

(3)

The segment address of the data segment is the segment address of the X-2 stack segment is the X-1

2. Compile and connect the following program, load, track, and answer questions.

Data in the data segment from 0 to F is 23 01 56 04 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Different situations: CS is 13c7 DS and 13c5 SS is 13c6

The segment address of the data segment is the segment address of the X-2 stack segment is the X-1

(N/16) + 1) * 16 bytes

3. Compile and connect the following program, load, track, and answer questions.

(1)

Data in the data segment from 0 to F is 23 01 56 04 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

(2)

Different situations: CS 13c5 DS 13c8 SS 13c9

(3)

The data segment address is x + 3 the SS segment address is x + 4

(4)

The third question can run normally. If there is no start command, it starts to run from the first command.

That is, the compiler executes commands sequentially.

5. WriteCodeTo add the data in segment A and segment B in sequence and save the result to segment 2.

Assume Cs: Code

A segment

DB 1, 2, 3, 4, 5, 6, 7, 8

A ends

B segment

DB 1, 2, 3, 4, 5, 6, 7, 8

B ends

C segment

Db 0, 0, 0, 0, 0, 0

C ends

Code segment

Start:

MoV BX, 0

MoV CX, 8

S:

MoV ax,

MoV ds, ax

MoV DL, [BX]

MoV ax, B

MoV ds, ax

Add DL, [BX]

MoV ax, c

MoV ds, ax

MoV [BX], DL

INC BX

Loop s

MoV ax, 4c00h

Int 21 h

Code ends

End start

6. Write the code in the code segment as follows, and use the push command to store the first eight types of data in segment A in reverse order to segment B.

Assume Cs: Code

A segment

DW 1, 2, 3, 4, 5, 6, 7, 8

A ends

B segment

DW 0, 0, 0, 0, 0, 0

B ends

Code segment

Start:

MoV ax, B

MoV SS, ax

MoV sp, 16

MoV ax,

MoV ds, ax

MoV CX, 8

MoV BX, 0

S:

Push [BX]

Add Bx, 2

Loop s

MoV ax, 4c00h

Int 21 h

Code ends

End start

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.