小弟刚学汇编,写了一个实现两个一位数相加并显示结果的程序,可是总有问题,哪位大侠帮忙看一哈
datasegmentt1db'pleaseinputanumberA:$'t2db0dh,0ah,'pleaseinputanumberB:$'bufdb2db?db2...
data segment
t1 db 'please input a number A:$'
t2 db 0dh,0ah, 'please input a number B:$'
buf db 2
db ?
db 2 dup(?)
duf db 2
db ?
db 2 dup(?)
data ends
code segment
assume ds:data,cs:code
start: mov ax,data
mov ds,ax
lea dx,t1
mov ah,9
int 21h
lea dx,buf
mov ah,10
int 21h
mov bl,[buf+2]
lea dx,t2
mov ah,9
int 21h
lea dx,duf
mov ah,10
int 21h
mov al,[duf+2]
mov dl,0ah
mov ah,2
int 21h
jmp jj
jj proc near
add al,bl
daa
mov dl,al
and dl,0f0h
mov cl,4
shr dl,cl
add dl,30h
mov ah,2
int 21h
mov dl,al
and dl,0fh
add dl,30h
int 21h
ret
jj endp
mov ah,4ch
int 21h
code ends
end start
希望就在原来的基础上改~ 展开
t1 db 'please input a number A:$'
t2 db 0dh,0ah, 'please input a number B:$'
buf db 2
db ?
db 2 dup(?)
duf db 2
db ?
db 2 dup(?)
data ends
code segment
assume ds:data,cs:code
start: mov ax,data
mov ds,ax
lea dx,t1
mov ah,9
int 21h
lea dx,buf
mov ah,10
int 21h
mov bl,[buf+2]
lea dx,t2
mov ah,9
int 21h
lea dx,duf
mov ah,10
int 21h
mov al,[duf+2]
mov dl,0ah
mov ah,2
int 21h
jmp jj
jj proc near
add al,bl
daa
mov dl,al
and dl,0f0h
mov cl,4
shr dl,cl
add dl,30h
mov ah,2
int 21h
mov dl,al
and dl,0fh
add dl,30h
int 21h
ret
jj endp
mov ah,4ch
int 21h
code ends
end start
希望就在原来的基础上改~ 展开
展开全部
data segment
t1 db 'please input a number A:$'
t2 db 0dh,0ah, 'please input a number B:$'
buf db 2
db ?
db 2 dup(?)
duf db 2
db ?
db 2 dup(?)
data ends
code segment
assume ds:data,cs:code
start: mov ax,data
mov ds,ax
lea dx,t1
mov ah,9
int 21h
lea dx,buf
mov ah,10
int 21h
mov ch,[buf+2]
sub ch,30h
lea dx,t2
mov ah,9
int 21h
lea dx,duf
mov ah,10
int 21h
mov cl,[duf+2]
sub cl,30h
push cx
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
mov ah,2
int 21h
pop ax
add al,ah
daa
push ax
mov dl,al
and dl,0f0h
mov cl,4
shr dl,cl
add dl,30h
mov ah,2
int 21h
pop ax
mov dl,al
and dl,0fh
add dl,30h
mov ah,2
int 21h
mov ah,1
int 21h
mov ah,4ch
int 21h
code ends
end start
t1 db 'please input a number A:$'
t2 db 0dh,0ah, 'please input a number B:$'
buf db 2
db ?
db 2 dup(?)
duf db 2
db ?
db 2 dup(?)
data ends
code segment
assume ds:data,cs:code
start: mov ax,data
mov ds,ax
lea dx,t1
mov ah,9
int 21h
lea dx,buf
mov ah,10
int 21h
mov ch,[buf+2]
sub ch,30h
lea dx,t2
mov ah,9
int 21h
lea dx,duf
mov ah,10
int 21h
mov cl,[duf+2]
sub cl,30h
push cx
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
mov ah,2
int 21h
pop ax
add al,ah
daa
push ax
mov dl,al
and dl,0f0h
mov cl,4
shr dl,cl
add dl,30h
mov ah,2
int 21h
pop ax
mov dl,al
and dl,0fh
add dl,30h
mov ah,2
int 21h
mov ah,1
int 21h
mov ah,4ch
int 21h
code ends
end start
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询