IBM-PC assembly language programming (second edition) after-school exercises answer (Tsinghua University Press) (Shen meiming, Wen dongchan) Chapter 4

Source: Internet
Author: User

. An error occurred while executing the following commands:

(1) mov ah, the source operand of BX is different from the destination operand.

(2) mov [BX], [Si]: Two memory units are transmitting data, which is not allowed in assembly languages.

(3) mov ax, [Si] [di] cannot be used with two address changes, one of which should be the base address

(4) mov mydat [BX] [Si], ES: Same as ax (2)

(5) mov byte PTR [BX], 1000 must have a register

(6) mov BX, offset mydat [Si] offset cannot be connected to complex operands

(7) mov CS and ax cannot assign values to CS

(8) mov ECx and ax operations have different types.

2. (1) Illegal (2) Illegal (3) Illegal (4) Illegal

3. (1) the operand type is invalid.

(2) Valid

(3) Illegal. Two memory units are not allowed to transmit data directly. Where did you put the CPU?

(4) Valid

(5) Valid

(6) Legal

(7) An invalid register must exist ~~ Where did I put the CPU?

(8) invalid. Adding two memory unit addresses makes no sense.

(9) Valid

(10) Illegal, same as (3)

4. (1) Two memory units transmit data

(2) Different operand types

(3) The jump command can only jump to the symbolic address

(4) The transfer instruction cannot be a variable but a label.

(5) The format is incorrect. It should be near PTR.

5. No more images

6. (1) DW 5150 H

(2) mov ax, 5150 H

MoV address, ax

And write a few.

7. Datasg segment

Fld1b dB 'Personal' computer'

Fld2b dB 10 DUP (32)

Fld3b dB 20 h

Fld4b dB 01011001b

Fld5b dB '123'

Fld6b dB 10 DUP (0)

Fld7b dB 'part1', DUP 20 (?), 'Part2', DUP 50 (?), 'Part3', DUP 14 (?)

Fld1w DW 0fff0h

Fld2w DW 01011001b

Fld3w DW fld7b

Fld4w DW 5, 6, 7, 8, 9

Fld5w DW 5 DUP (0)

Fld6w DW (FLD6W-FLD1W)-(FLD7B-FLD1B)

8. The plenth value is 22, and GE indicates the length of the Data Segment.

9. The value of L is 6.

10. (1) mov ax, offset lname

(2) mov Si, word PTR code_list

(3) code_lenght equ $-code_list

11. The Code is as follows:

Data_seg segment

DB 5

Data_list DW 0 ffffh, 5 DUP (?)

Data_seg ends

Code_seg segment

Assume Cs: code_seg, DS: data_seg

MoV ax, 5

MoV Max, ax

MoV ax, 0 ffffh

MoV min, ax

Code_seg ends

12. (1) 10025

(2) 19

(3) 2548

(4) 3

(5) 103

(6) 0 ffffh

(7) 1

(8) 3

13. Compiled:

MoV ax, 0ah

MoV BL, 0ah

MoV Cl, 1

14. (1) (ax) = 1 (2) (ax) = 2 (3) (CX) = 14 h (4) (dx) = 32 h (5) (CX) = 1]

15. (1) operator error changed to: data_seg segment

(2) A section name is missing.

(3) The reference should start from; and change the "/" to ";"

(4) The structure is changed:

Main_proc proc far

....

Main_proc endp

End

16. The program framework is as follows:

Data_seg segment

Org 0e000h

First_type equ this word

Data_group dB 100 DUP (?)

Data_seg ends

Stack_seg segment

Align 16

Stack dB 100 DUP (?)

Stack_seg ends

Code_seg segment

Assume Cs: code_seg, DS: data_seg, SS: stack_seg

Org 1000 h

Start: mov ax, data_seg

MoV ds, ax

MoV ax, stack_seg

MoV SS, ax

.......

Code_seg ends

End start

17. The procedure is as follows:

D_seg segment

Augend dd 99251

D_seg ends

E_seg segment

Added DD-15926

E_seg ends

C_seg segment

Assume Cs: c_seg, DS: d_seg, ES: e_seg

Start: mov ax, d_seg

MoV ds, ax

MoV ax, e_seg

MoV es, ax

MoV eax, DS: augend

Add eax, ES: addend

MoV DS: Sum, eax

C_seg ends

End start

18.

19. PTR pseudo operations must be added: (2) (3) (4)

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.