主要有immediate mode illegal
symbol not defined
错误
本人是菜鸟实在不知道怎么修改了!
data segment
buf1 db 3,?,3 dup(?)
buf2 db 3,?,3 dup(?)
num1 dw 0
num2 dw 0
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov dx,offset buf1
mov ah,0ah
int 21h
mov ax,bx
mov num1,ax
call convert
call display
mov dx,offset buf2
mov ah,0ah
int 21h
mov ax,bx
mov num2,ax
call convert
call display
sub bl,bl
add bx,num1
add bx,num2 ;bx is the temporarily result
mov ax,bx ;bx is sended to ax
call shift
mov ah,4ch
int 21h
code ends
end start
convert proc ;convert the data of buffer to the number
mov cx,0
mov ax,0
mov bx,0
mov cl,3
return:
dec cl
mov al,[dx]
sub al,30h
jcxz adding
mul 10 ;the sum send into ax
adding:
add bx,ax ;result send into bx
jcxz end
inc dx
jmp return
end:
ret
convert endp
display proc
mov dl,13
mov ah,2
int 21h
mov dl,10
mov ah,2
int 21h
ret
display endp
shift proc ;convert the result and output
mov bx,10
push bx
dis:
cmp ax,0
jz dis0
div bx ;al is quotient,ah is residue
add ah,30h
push ah
cbw
jmp dis
dis0:
pop ah
cmp ah,10
je stop
mov ah,dl
mov ah,2
int 21h
jmp dis0
stop:
ret
shift endp
[此贴子已经被作者于2007-6-16 23:52:52编辑过]