汇编语言(沈美明,温冬婵)课后答案

38、答: (1)(AX)= 5 (BX)= 16 (CX)= 0 (DX)= 0 (2)(AX)= 2 (BX)= 4 (CX)= 3 (DX)= 1 (3)(AX)= 3 (BX)= 7 (CX)= 2 (DX)= 0

39、答:

第四章

1、 答:

(2) 源*作数和目的*作数同为存储器寻址方式。 (3) SI、DI同为变址寄存器。

(7) 目的*作数不能是代码段段寄存器CS。 (5) 缺少 PTR

5、答:

BYTE_VAR 42 59 54 45 0C EE 00 ?? - 01 02 01 02 ?? 00 ?? 01 02 01 02 ?? 00 ?? 01 02 - 01 02 ??

WORD_VAR 00 00 01 00 02 00 00 00 - 01 00 02 00 00 00 01 00 02 00 00 00 01 00 02 00 - 00 00 01 00 02 00 ?? ?? FB FF 59 42 45 54 56 02 -

8、答: PLENTH的值为22(16H)。

12、答: (1) 10025 (2) 25 (3) 2548 (4) 3 (5) 103 (6) 0FFFFH (7) 1 (8) 3

5假设数据段中数据定义如下:

VAR DW '34'

VAR1 DB 100, 'ABCD' VAR2 DD 1

COUNT EQU $-VAR1

X DW 5 DUP (COUNT DUP (0)) Y LABEL WORD Z DB '123456' V DW 2, $-VAR

执行下面程序段并回答问题。 MOV AX, COUNT ; (AX) = ? MOV BX, Z-X ; (BX) = ? MOV CX, V+2 ; (CX) = ? MOV DX, VAR ; (DX) = ? MOV Y+3, 2

MOV SI, Y+4 ; (SI) = ? ADD Z+5, 1

MOV DI, WORD PTR Z+4 ; (DI) = ? 、答: (AX)= 9 (BX)= 90 (CX)= 109 (DX)= 3334H (SI)= 3600H (DI)= 3700H

14、答:

(1) (AX)= 1 (2) (AX)= 2 (3) (CX)= 20 (4) (DX)= 40 (5) (CX)= 1

17、答:

D_SEG SEGMENT

D_WORD LABEL WORD AUGEND DD 99251 S_WORD LABEL WORD SUM DD ? D_SEG ENDS

E_SEG SEGMENT

E_WORD LABEL WORD ADDEND DD -15962 E_SEG ENDS

C_SEG SEGMENT

ASSUME CS:C_SEG, DS:D_SEG, ES:E_SEG MAIN PROC FAR START: PUSH DS MOV AX, 0 PUSH AX

MOV AX, D_SEG MOV DS, AX MOV AX, E_SEG MOV ES, AX

MOV AX, D_WORD MOV BX, D_WORD+2 ADD AX, ES:E_WORD ADC BX, ES:E_WORD+2 MOV S_WORD, AX MOV S_WORD+2, BX RET

MAIN ENDP C_SEG ENDS END START

16、答:

DATASG SEGMENT AT 0E000H WORD_ARRAY LABEL WORD BYTE_ARRAY DB 100 DUP (?) DATASG ENDS

STACKSG SEGMENT PARA STACK 'STACK' DW 32 DUP (?) TOS LABEL WORD STACKSG ENDS

CODESG SEGMENT ORG 1000H

MAIN PROC FAR

ASSUME CS:CODESG, DS:DATASG, ES:DATASG, SS:STACKSG START:

MOV AX, STACKSG MOV SS, AX

MOV SP, OFFSET TOS

PUSH DS SUB AX, AX

PUSH AX

MOV AX, DATASG MOV DS, AX MOV ES, AX

……

RET

MAIN ENDP CODESG ENDS END START

9编写一个完整的程序,要求把含有23H,24H,25H,26H四个字符数据的数据区复制20次。 、答:

DSEG SEGMENT

VAR1 DB 23H,24H,25H,26H DSEG ENDS

ESEG SEGMENT

VAR2 DB 80 DUP ('?') ESEG ENDS

CSEG SEGMENT

ASSUME CS:CSEG, DS:DSEG, ES:ESEG MAIN PROC FAR START: PUSH DS MOV AX, 0 PUSH AX

MOV AX, DSEG MOV DS, AX MOV AX, ESEG MOV ES, AX

MOV DX, 20 CLD

LEA DI, VAR2 AGAIN:

LEA SI, VAR1 MOV CX, 4 REP MOVSB DEC DX JNZ AGAIN

RET

MAIN ENDP CSEG ENDS END START

1、答: ……

mov cx, count lea si, string1 lea di, string2 again:

mov al, [si] mov [di], al inc si inc di

第五章

loop again

2、答:

code segment assume cs: code main proc far start: push ds mov ax, 0 push ax

mov ah, 1 int 21h

sub al, 30h cmp al, 0 jz exit mov cl, al mov ch, 0 again: mov ah, 2 mov dl, 7 int 21h loop again exit: ret

main endp code ends end start

……

8、答: MOV CX,8 MOV DL,0

NEXT3: ROR AX,1 JNC NEXT1 ROR AX,1 JNC NEXT2 INC DL

NEXT2: LOOP NEXT3 ADD DL, 30H MOV AH, 2 INT 21H

MOV AH, 4CH INT 21H

NEXT1: ROR AX, 1 JMP NEXT2

12、答: ……

mov cx, 100 lea di, mem mov ax, 0 cld comp:

repne scasw jcxz exit

push cx mov si, di sub di, 2 mov bx, di rep movsw

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4