微机原理课后习题
试编程序将内存从40000H到4BFFFH的每个单元中均写入55H,并再逐个单元读出比较,看写入的与读出的是否一致。若全对,则将AL置7EH;只要有错,则将AL置81H。...
试编程序将内存从40000H到4BFFFH的每个单元中均写入55H,并再逐个单元读出比较,看写入的与读出的是否一致。若全对,则将AL置7EH;只要有错,则将AL置81H。
展开
展开全部
CODE SEGMENT
ASSUME CS:CODE
START:
MOV AX,4000H
MOV DS,AX
MOV ES,AX
MOV CX,0C000H
CLD
MOV SI,0
MOV DI,0
MOV AL,55H
REP STOSB
MOV CX,0C000H
MOV AL,55H
MOV DI,0
REPE SCASB
JCXZ @1
MOV AL,81H
JMP @2
@1:
MOV AL,7EH
@2:
CBW
CALL DSPAXS
MOV AH,4CH
INT 21H
;==================================
; 输出有符号数,输出的数应放 ax中
DSPAXS PROC NEAR
PUSH AX
OR AX,AX
JNS @DSPAXS
NEG AX
PUSH AX
PUSH DX
MOV AH,2
MOV DL,'-'
INT 21H
POP DX
POP AX
@DSPAXS:
CALL DSPAX
POP AX
RET
DSPAXS ENDP
;==================================
; 输出无符号数,输出的数应放 ax中
DSPAX PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSHF
XOR CX,CX
MOV BX,10
@DSPAX1:
XOR DX,DX
DIV BX
INC CX
OR DX,30H
PUSH DX
CMP AX,0
JNE @DSPAX1
MOV AH,2
@DSPAX2:
POP DX
INT 21H
LOOP @DSPAX2
POPF
POP DX
POP CX
POP BX
POP AX
RET
DSPAX ENDP
;===========================
CODE ENDS
END START
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询