程序出现无限循环,那位高手帮帮忙,帮我修改一下,只要循环3次就让它中断帮帮忙,发到我 的邮箱fanping2008100@sina.com 下面是我的代码:
data segment
mess1 db 13,10,"Input name :$"
mess2 db 13,10,"Input phone number :$"
outline db 13,10,10,"NAME TEL.",13,10,'$'
inbuf db 30 dup(20h)
outname db 20 dup(20h)
outphone db 20 dup(20h)
data ends
code segment
main proc far
assume cs:code,ds:data,es:data
start:
mov ax,data
mov ds,ax
mov es,ax
lop3:
mov dx,offset mess1
mov ah,09h
int 21h
call input_name
mov dx,offset mess2
mov ah,09h
int 21h
call inphone
call printline
jmp lop3
mov ax,4ch
int 21h
main endp
input_name proc near
mov bx,0
lop1:
call getchar
cmp al,13
je out1
mov inbuf[bx],al
inc bx
cmp bx,14
jl lop1
out1:
mov cx,bx
mov si,offset inbuf
mov di,offset outname
rep movsb
mov outname[14],'$'
ret
input_name endp
inphone proc near
mov bx,0
lop2:
call getchar
cmp al,13
je out2
mov inbuf[bx],al
inc bx
jmp lop2
out2:
mov cx,bx
mov si,offset inbuf
mov di,offset outphone
rep movsb
mov outphone[bx],'$'
ret
inphone endp
getchar proc near
mov ah,01h
int 21h
ret
getchar endp
printline proc near
mov dx,offset outline
mov ah,09h
int 21h
mov dx,offset outname
mov ah,09h
int 21h
mov dx,offset outphone
mov ah,09h
int 21h
ret
printline endp
code ends
end start
各位谢了!!!!!!!!!!!!!!!!!!!!!!!1