我的汇编代码有问题。我想在交换数字后添加用户输入的两个数字,但是当我添加这些数字时,添加功能无法正常工作。谢谢
这是代码
.model small
.stack 100h
.data
msg1 db 'Enter the number1:$'
msg2 db 'Enter the number2:$'
msg3 db 'After swap numbers are:$'
msg4 db 'Sum is:$'
num1 db ?
num2 db ?
sum db ?
diff db ?
.code
MAIN PROC
mov ax,@data
mov ds,ax
mov ah,09h ;display first msg
mov dx,offset msg1
mov ah,01h ;taking input
int 21h
mov num1,al
mov ah,09h ;display second msg
mov dx,offset msg2
int 21h
mov ah,01h ;taking input
int 21h
mov num2,al
mov bl,num1
mov cl,num2
mov num1,cl
mov num2,bl
mov ah,09h ;display third msg
mov dx,offset msg3
int 21h
mov ah,02h
mov dl,num1
int 21h
mov ah,02h
mov dl,num2
int 21h
mov bl,num1
add bl,num2
mov sum,bl
mov ah,09h ;display fourth msg
mov dx,offset msg4
int 21h
mov ah,02h
mov dl,sum
int 21h
mov ah,4ch
int 21h
MAIN ENDP
END MAIN