微机原理课后习题答案 - 百度文库 ر

NEXT1: MOV AL,[SI]; INC SI; CMP DL,AL; JNC NEXT2; MOV DL,AL;

DLʼմĿǰֵ

NEXT2: DEC CL;

JNZ NEXT1; MOV [DI],DL; ֵ洢

HLT

BUFFER DB ж100

KVFF DB ?

3.9 ݰС˳,Աд..

:˴ ðݷԴ:

ORG 100h LEA MOV

DI,BUFFER; BL,99; ѭ

NEXT0:

NEXT3:

NEXT5:

MOV SI,DI; MOV CL,BL; ѭ MOV AL,[SI]; INC SI; ƶָ CMP AL,[SI]; Ƚ JNC NEXT5; תNEXT5 MOV DL,[SI]; MOV [SI-1],DL; MOV [SI],AL; ڻ DEC CL; ѭһ

JNZ DEC JNZ HLT

NEXT3; BL; ѭһ NEXT0

BUFFER DB ж100ֽ

3.10 BVFFԪһBCDA,Ըйϵд,DES.

A<20,Y=3*A; A<60,Y=A-20; A>=60,Y=80.

ORG 100h MOV AL,BVFF CMP AL,20 JL EX1 CMP AL,60 JL EX2 MOV AL,80 JMP STOP EX1: MOV BL,3 MUL BL JMP STOP EX2: SUB AL,20 STOP: MOV DES,AL HLT BVFF DB 8 DES DB ?

3.11ַΪDATABʼ80Ԫ,ij80ѧijγ̳ɼ,Ҫ:

ͳ>=90֡80~89֡70~79֡60~69֡60µBTRXʼ5Ԫ

ƽɼLEVELС

⣺Ĵʹ÷䣺90DH80DL70BH60BL60AHֶܷ֡[DI]

ORG 100h XOR AH,AH XOR DX,DX XOR BX,BX

;ͳƽ ;ͳƽ

LEA SI,DATA LEA DI,LEVEL

MOV CL,CONT; ѭ CX goon: MOV AL,[SI] ;ԭʼ

ADC [DI], AL;ۼܷ ADC [DI+1],0 ;λ

CMP AL,90

JL PP8 ; 90תPP8 INC DH ; 90--100ֵһ JMP STOR

PP8:

PP7:

PP6:

CMP AL,80 JL PP7 ;80תPP7 INC DL ;80----89ֵһ JMP STOR CMP AL,70 JL PP6 ;70תPP6 INC BH ;70---79ֵһ JMP STOR CMP AL,60 JL PP5 ;60תPP5 INC BL ;60---69ֵһ

JMP STOR

PP5: INC AH ;60ֵһ STOR:INC SI ;һ

GOON

;CX=CX-1,CXΪתGOON,ͳ LEA SI,BUFFER ;شͳƽ

MOV INC SI MOV INC SI MOV INC SI MOV INC SI MOV MOV

[SI],DH [SI],DL [SI],BH [SI],BL

[SI],AH

AX,WORD PTR [DI] ;ƽɼ

LOOP

MOV CL,CONT DIV CL

MOV LEVEL,AL ;شƽɼ

HLT

CONT DB 10

DATA DB 30,65,99,80,75, 89,100,45,60,70 BUFFER DB ?,?,?,?,? LEVEL DB ? ,?

3.12 з(DATA1,DATA2)ľֵ,DATA3.

ORG 100h

MOV AL,DATA1뱻 SUB AL,DATA2ȥ JC CHANGE

JMP STOR CHANGE: NEG AL STOR: MOV DATA3,AL HLT DATA1 DB 3 DATA2 DB 5 DATA3 DB ?

3.13 40000H4BFFHĸԪд55H,,֤Ƿһ,һ,ALΪ7EH,ALΪ81H.

ORG 100h MOV AX,4000H; MOV DS,AX; MOV SI,0 START: MOV CX,0BFFFH BEGIN: MOV [SI],55H MOV AL,[SI] INC SI CMP AL,55H JNZ ERR LOOPBEGIN MOV AL,7EH JMP STOP ERR: MOV AL,81H STOP: HLT

3.14~3.15 ˿03FBHBIT5Ϊ״̬־,λΪ1ʱ,ʾæ,ܽ;Ϊ0ʱ,ʾ,Խ;CPU˿03F8Hдһֽڵʱ,03FBHBIT51,Ϊ0״̬ʱ,ֿдһݡݴ˱дʼַΪSEDAT5003F8H˿ڵij

WAIT

MOV DX03FBH IN ALDX

TEST AL0010 0000B20H

JZ SEND JMP WAIT SENDMOV DX3F8H MOV AL[SI] CMP AL0AHִ־

JZ STOP OUT DXAL

WAIT

JMP

STOPHLT