2.从键盘输入两个1位十进制数,计算这两个数之和,并将结果在屏幕上显示出来。
来源:百度知道 编辑:UC知道 时间:2024/06/15 05:05:23
提示:必须要在数据段内定义下列字符串:
INFOR1 DB “Please Input the First Data(<10):$”
INFOR2 DB 0AH,0DH, “Please Input the Second Data(<10):$”
INFOR3 DB 0AH,0DH, “The Result is:$”
用汇编语言编写,2. 从键盘输入两个1位十进制数,计算这两个数之和,并将结果在屏幕上显示出来。
提示:必须要在数据段内定义下列字符串:
INFOR1 DB “Please Input the First Data(<10):$”
INFOR2 DB 0AH,0DH, “Please Input the Second Data(<10):$”
INFOR3 DB 0AH,0DH, “The Result is:$”
INFOR1 DB “Please Input the First Data(<10):$”
INFOR2 DB 0AH,0DH, “Please Input the Second Data(<10):$”
INFOR3 DB 0AH,0DH, “The Result is:$”
用汇编语言编写,2. 从键盘输入两个1位十进制数,计算这两个数之和,并将结果在屏幕上显示出来。
提示:必须要在数据段内定义下列字符串:
INFOR1 DB “Please Input the First Data(<10):$”
INFOR2 DB 0AH,0DH, “Please Input the Second Data(<10):$”
INFOR3 DB 0AH,0DH, “The Result is:$”
code segment
assume cs:code
start:
mov cx,2
mov bl,0
next:
mov ah,1
int 21h
sub al,30h
jc next
cmp al,9h
ja next
add al,bl
daa
mov bl,al
mov dl,13
mov ah,2
int 21h
mov dl,10
int 21h
loop next
mov cl,4
mov dh,2
next1:
rol bl,cl
mov dl,bl
and dl,0fh
add dl,30h
mov ah,2
int 21h
dec dh
jnz next1
mov ah,1
int 21h
mov ah,4ch
int 21h
code ends
end start