;This is the structure of a main module using simplified segment directives
.8086
.MODEL SMALL,C
.STACK 100
.DATA
;......Place data declarations here
db "$$$$$$"
num db 0
c1 db 0
c2 db 0
db "$$$$$$"
;......
.CODE
.STARTUP
;......Place instructions here
mov ah,01h//输入第一个值
int 21h
mov dh,al
int 21h
mov dl,al
mov c2,al
.if dh>='0' && dh<='9'
sub dh,'0'
.else
sub dh,'a'
add dh,10
.endif
.if dl>='0' && dl<='9'
sub dl,'0'//因为输入的默认是字符
.else
sub dl,'a'
add dl,10
.endif
mov cl,4
shl dh,cl//因为第一个输入的数为高位,所以我们要左移4位,那么该值就变为高位了
add dh,dl
mov num,dh
;......
.EXIT
END
.8086
.MODEL SMALL,C
.STACK 100
.DATA
;......Place data declarations here
db "$$$$$$"
num db 0
c1 db 0
c2 db 0
db "$$$$$$"
;......
.CODE
.STARTUP
;......Place instructions here
mov ah,01h//输入第一个值
int 21h
mov dh,al
mov c1,al
int 21h
mov dl,al
mov c2,al
.if dh>='0' && dh<='9'
sub dh,'0'
.else
sub dh,'a'
add dh,10
.endif
.if dl>='0' && dl<='9'
sub dl,'0'//因为输入的默认是字符
.else
sub dl,'a'
add dl,10
.endif
mov cl,4
shl dh,cl//因为第一个输入的数为高位,所以我们要左移4位,那么该值就变为高位了
add dh,dl
mov num,dh
;......
.EXIT
END