微机原理及应用(第3版) - 吴宁 - 马旭东 - 部分习题 - 解答 下载本文

3-32解: X DW ? Y DW ? Z DW ? S DW ? MOV CMP JNZ CMP JNZ MOV JMP XNEY: CMP JZ MOV JMP SEQ1: MOV EXIT:

3-37解: MOV MOV MOV MOV MOV MOV AGAIN: ADD ADC INC INC LOOP

AX, X AX, Y XNEY AX, Z SEQ1 S,2 EXIT AL,Z SEQ1 S,0 EXIT S,1

AX, 0B800H DS, AX BX, 0 CX,100 DX,0 AX,0 AX, [BX] DX, 0 BX BX AGAIN

5

4-4解:

VAR1 41H 42H 43H 0AH 10H 45H 46H FFH ?

4

4

4

FFH

?

4

4

4 VAR2 10H 00H FBH FFH 46H 45H ? ? ?

?

? VAR3

?

15H VAR4

00H

11H 00H (SEG VAR2)L (SEG VAR2)H

6

4-7解:

(1)VAR1的偏移地址是 30H VAR2的偏移地址是 3AH VAR3的偏移地址是 40H (2) DATA1=50H, CNT= 16 (3) [VAR2+2] =02H

4-10解:

DATA SEGMENT ORG 100H VARW DW 1234H,5678H VARD DD 12345678H BUFF DB 10 DUP(?) MESS DB ’HELLO’

BEGIN: MOV AX, OFFSET MESS MOV AX, TYPE BUFF+TYPE MESS+TYPE VARD MOV AX, SIZE VARW+SIZE BUFF +SIZE MESS MOV AX, LENGTH VARW+LENGTH VARD MOV AX, LENGTH BUFF+SIZE VARW MOV AX, TYPE BEGIN MOV AX, OFFSET BEGIN

4-12解:

DATA SEGMENT WORD DABUF DB 100 DUP(?) DATA ENDS

STACK SEGMENT PARA STACK DB 100 DUP(?) STACK ENDS

CODE SEGMENT ‘CODE’ ASSUME CS:CODE,DS:DATA,ES:DATA,SS:STACK START: MOV AX, DATA MOV DS,AX MOV ES,AX MOV AX,STACK MOV SS,AX MOV CX,100 CLD

7

;AX=112H

;AX=1+1+4=6 ;AX=2+10+1=13 ;AX=1+1=2 ;AX=10+2=12

;AX=FFFFH (-1);AX=0

MOV BX,OFFSET DABUF MOV AL,64H REP SCASB MOV AH,4CH INT 21H

CODE ENDS END START

4-16解:

DATA SEGMENT X DB 4 DUP(?) Y DB 4 DUP(?) Z DB 4 DUP(?) DATA ENDS

CODE SEGMENT START: MOV AX,DATA MOV DS,AX MOV SI, OFFSET X MOV DI, OFFSET Y MOV BX, OFFSET Z MOV CX,4 CLC AGAIN: MOV AL,[SI] ADC AL,[DI] MOV [BX],AL INC SI INC DI INC BX LOOP AGAIN

4-20解:

DATA SEGMENT

FIRST DB 99 DUP(?),’$’ DATA ENDS

CODE SEGMENT START: MOV AX,DATA MOV DS,AX

8

MOV BX,OFFSET FIRST MOV CX,100 MOV DX,0 AGAIN: MOV AL,[BX] CMP AL.’$’ JZ EXIT CMP AL,’A’ JNZ NEXT INC DX NEXT: INC BX LOOP AGAIN EXIT: MOV AH,4CH INT 21H CODE ENDS END START

9