主题:[讨论]汇编小问题(高手门请帮忙啊)
message db 'quite by q$'
DATAS ENDS
CODES SEGMENT
main proc far
ASSUME CS:CODES,DS:DATAS
START:
push ds
sub ax,ax
push ax
MOV AX,DATAS
MOV DS,AX
more:
call inhex
call hexdec
mov dx,offset message
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,'q'
jnz more
ret
main endp
inhex proc near
mov bx,0
again:
mov ah,1
int 21h
cmp al,30h
jl exit
cmp al,39h
jle doit
cmp al,41h
jl exit
cmp al,46h
jg exit
sub al,37h
jmp makedata
doit:
sub al,30h
makedata:
mov ah,0
xchg bx,ax
mov cl,10h
mul cl
add bx,ax
jmp again
exit:
ret
inhex endp
hexdec proc near
mov ax,bx
mov cl,0ah
mov ch,0
mov bx,0
again1:
div cx
push dx
mov dx,0
inc bx
cmp ax,0
jnz again1
again2:
pop dx
add dx,30h
mov ah,2
int 21h
dec bx
cmp bx,0
jnz again2
ret
hexdec endp
CODES ENDS
END START
这个程序是输入十六进制数然后转化为十进制输出!
但是为什么这个程序无法运行 啊!!我在debug中调试了,发现数据的传输什么的都正常,但为什么不能运行呢?