关于子程序的
程序代码:
;编写一个子程序嵌套结构的程序模块,分别从键盘输入姓名及8个字符的电话号码,并以一定的格式显示出来。 DATAS SEGMENT inbuffer db 20 dup(' ') outname db 20 dup(' '), 0DH,0AH, '$' outphone db 8 dup(' '), 0DH,0AH, '$' str1 db 'please input name:','$' str2 db 'please input telephone numeber:','$' str3 db '***************************',0DH,0AH,'NAME:','$' str4 db '***************************',0DH,0AH,'TELEPHONE:','$' CRLF DB 0DH, 0AH, '$' DATAS ENDS ;定义数据段 STACKS SEGMENT dw 100 dup(?) tos label word STACKS ENDS ;定义堆栈段 CODES SEGMENT main proc far ASSUME CS:CODES,DS:DATAS,ES:DATAS,SS:STACKS START: MOV AX,STACKS MOV SS,AX mov sp,offset tos push ds sub ax,ax push ax mov ax,DATAS mov DS,ax mov es,ax mov cx,100 push cx begin: lea dx,offset str1 mov ah,09h int 21h call input_name lea dx,offset str2 mov ah,09h int 21h call input_phone call display ret pop cx loop begin main endp ;主程序 input_name proc near call input_ lea si,inbuffer lea di,input_name mov cx,20 cld rep movsb ret input_name endp ;姓名输入子程序 input_phone proc near call input_ lea si,inbuffer lea di,input_phone mov cx,8 cld rep movsb ret input_phone endp ;电话输入子程序 input_ proc near lea dx,inbuffer mov ah,0ah int 21h call cld_ ret input_ endp ;字符输入子程序 display proc near lea dx,str3 mov ah,09h int 21h lea dx,outname mov ah,09h int 21h lea dx,str4 mov ah,09h int 21h lea dx,outphone mov ah,09h int 21h ret display endp ;显示姓名、电话子程序 cld_ proc near mov dl,0ah mov ah,02h int 21h mov dl,0dh int 21h ret cld_ endp ;回车、换行子程序 CODES ENDS END main显示有问题,为毛?速救
[ 本帖最后由 xiaoxun_1122 于 2010-12-8 20:05 编辑 ]