汽油切割机使用说明:汇编语言2 10 16 进制转换 代码!那里错了?

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/30 02:40:36
date segment
number1 db 10 dup(?)
number2 db 40 dup(?)
number3 db 20 dup(?)
aa db 2 dup(?)
str1 db "Please input a number:$"
str2 db 0ah,0dh,'The number is worng!$'
date ends
code segment
main proc far
assume cs:code,ds:date
start:push ds
xor ax,ax
mov ax,date
mov ds,ax
mov dx,offset str1
mov ah,09h
int 21h
mov dx,offset number1
mov ah,0Ah
int 21h
mov bx,offset number1+1
mov ch,[bx]
mov cl,'0'
loop1:inc bx
cmp byte ptr [bx],'0'
jl st2
cmp byte ptr [bx],'9'
jle a
cmp byte ptr [bx],'A'
jl st2
cmp byte ptr [bx],'E'
jle a
cmp byte ptr [bx],'a'
jl st2
cmp byte ptr [bx],'e'
jle a
st2: mov dx,offset str2
mov ah,09h
int 21h
jmp m
a: cmp [bx],cl
jl a4
mov cl,[bx]
a4: loop loop1
cmp cl,'2'
jl a1
cmp cl,'9'
jl a2
mov dx,10h
mov byte ptr [aa],2
mov byte ptr [aa+1],0ah
jmp a3
a1: mov dx,2
mov byte ptr [aa],0ah
mov byte ptr [aa+1],10h
jmp a3
a2: mov dx,0ah
mov byte ptr [aa],2
mov byte ptr [aa+1],10h
a3: call sub2
call sub2
m: ret
main endp

sub2 proc near
mov bx,offset number1+1
mov ch,[bx]
mov ax,0
inc bx
cmp dx,10h
jz b1
again:mul dx
and byte ptr [bx],0fh
add al,[bx]
adc ah,0
inc bx
loop again
b1: mul dx
cmp byte ptr [bx],'a'
jl b2
sub byte ptr [bx],87
jmp b4
b2: cmp byte ptr [bx],'A'
jl b3
sub byte ptr [bx],55
jmp b4
b3: and byte ptr [bx],0fh
b4: add al,[bx]
adc ah,0
inc bx
ret
sub2 endp

sub3 proc near
mov ch,0
mov cl,byte ptr [aa]
mov bx,offset number2+39
mov byte ptr [bx],'$'
loop2:mov dx,0
div cx
add dl,30h
dec bx
mov [bx],dl
or ax,ax
jnz loop2
mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
mov dx,bx
mov ah,09h
int 21h
mov ch,0
mov cl,byte ptr [aa+1]
mov bx,offset number3+19
mov byte ptr [bx],'$'
loop3:mov dx,0
div cx
add dl,30h
cmp dl,39h
jle c1
add dl,7
c1: mov [bx],dl
dec bx
or ax,ax
jnz loop3
mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
mov dx,bx
mov ah,09h
int 21h
ret
sub3 endp
code ends
end start
还有没有其他的从错误???

date是data吧

data.....

date是data吧