汇编:从键盘输入2个十进制个位数(0-9),进行加法运算,并将结果以十六进制形式显示输出,要求显示部分在子程序中实现。
DATAS SEGMENT
NUM1 DB 0
NUM2 DB 0
SUM DB 0
;此处输入数据段代码
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
DISP PROC FAR
MOV AL, SUM
MOV AH, 00H
MOV BL, 16
DIV BL
MOV DX, AX
MOV AH, 2
CMP DL, 10
JB LP1
ADD DL, 7
LP1:
ADD DL, 30H
INT 21H
MOV DL, DH
CMP DL, 10
JB LP2
ADD DL, 7
LP2:
ADD DL, 30H
INT 21H
MOV DL, 'H'
INT 21H
RET
DISP ENDP
START:
MOV AX,DATAS
MOV DS,AX
;此处输入代码段代码
MOV AH, 01
INT 21H
SUB AL, 30H
MOV NUM1, AL
INT 21H
SUB AL, 30H
MOV NUM2, AL
MOV AL, NUM1
MOV SUM,AL
MOV AL, NUM2
ADD SUM, AL
MOV DL, SUM
ADD DL, 30H
MOV AH, 02
INT 21H
CALL DISP
MOV AH,4CH
INT 21H
CODES ENDS
END START