- 在线时间
- 0 小时
- 最后登录
- 2008-2-13
- 注册时间
- 2007-11-29
- 听众数
- 0
- 收听数
- 0
- 能力
- 0 分
- 体力
- 7 点
- 威望
- 0 点
- 阅读权限
- 10
- 积分
- 3
- 相册
- 0
- 日志
- 0
- 记录
- 0
- 帖子
- 2
- 主题
- 1
- 精华
- 0
- 分享
- 0
- 好友
- 0
升级   60% 该用户从未签到
|
..
<p>都那么久了,竟然没人回答,</p><p>还是靠自己把他给弄出来了</p><p>代码如下,希望大虾们能多给点宝贵意见:</p><p>DATAS SEGMENT<br/>count db 4 <br/>buf db 'ji ','54698765 ',<br/> 'liu ','69856456 ',<br/> 'guo ','56566898 ',<br/> 'zhang ','569874123 ',<br/> 20 dup(10 dup (0),10 dup (0)) <br/>_name db 10,<br/> ?,<br/> 10 dup(?)<br/>num db 10,<br/> ?,<br/> 10 dup(?)<br/>, X. K- O( y: k; v4 ~6 A' x
<br/>temp db 23 dup(?),0dh,0ah,'$'<br/>menuitem db ' people phonenumber management system',0ah,0dh<br/> db ' *********************************************************',0ah,0dh<br/> db ' * this is main menu *',0ah,0dh <br/> db ' * 1. query (q) *',0ah,0dh<br/> db ' * 2. insert (i) *',0ah,0dh<br/> db ' * 3. exit (e) *',0ah,0dh<br/> db ' *********************************************************',0ah,0dh<br/> db 'please select(q,i or e):',0ah,0dh,'$'<br/>mess1 db 'name',10 dup(' '),'tel',0ah,0dh,'$'<br/>mess2 db 'please Input the name '<br/>mess3 db 'please Input the telephone number '<br/>mess4 db 0ah,0dh,'$'<br/>mess5 db 'Insert succed!$'<br/>err1 db 'there is not exsit the people!',0ah,0dh,'$'<br/>DATAS ENDS</p><p>STACKS SEGMENT<br/> db 2000 dup(?)<br/>STACKS ENDS</p><p>CODES SEGMENT<br/> ASSUME CS:CODES,DS ATAS,SS:STACKS</p><p>main proc far<br/> mov ax,datas<br/> mov ds,ax<br/> mov es,ax <br/>n1: lea dx,menuitem <br/> mov ah,9<br/> int 21h <br/> mov ah,1<br/> int 21h<br/> cmp al,'q'<br/> jnz n2 <br/> call query<br/> jmp n1<br/>n2: cmp al,'i'<br/> jnz n3<br/> call insert<br/> jmp n1 <br/>n3: cmp al,'e'<br/> jz exit<br/> jmp n1<br/>exit:<br/> mov ah,7<br/> int 21h<br/> mov ah,4ch<br/> int 21h<br/> ret<br/>main endp</p><p>query proc near ;查找总菜单<br/> push ds<br/> xor ax,ax<br/> push ax<br/> mov ax,datas<br/> mov ds,ax<br/> mov es,ax<br/> cld<br/> lea dx,mess4<br/> mov ah,9<br/> int 21h<br/> lea dx,mess2 <br/> mov ah,9<br/> int 21h <br/> call ipname<br/> lea dx,mess4<br/> mov ah,9<br/> int 21h<br/> call search<br/> mov ah,7<br/> int 21h<br/> ret <br/>query endp</p><p>ipname proc near ;从键盘输入名字<br/> lea dx,_name<br/> mov ah,10<br/> int 21h<br/> mov bh,0<br/> mov bl,_name+1<br/> mov cx,9<br/> sub cx,bx<br/>r: <br/> mov _name[bx+2],20h ;补空格<br/> inc bx<br/> loop r<br/> ret<br/>ipname endp</p><p>search proc near <br/> lea di,buf<br/> push di<br/> mov bl,count<br/> mov bh,0<br/>l: <br/> lea si,_name+2<br/> mov cx,9<br/> repe cmpsb<br/> jz n4<br/> pop di<br/> add di,20<br/> push di<br/> dec bx<br/> jnz l<br/> lea dx,err1<br/> mov ah,9<br/> int 21h<br/> jmp n1<br/>n4:<br/> pop di<br/> mov si,di<br/> lea di,temp <br/> mov cx,20<br/> rep movsb ;将内容传给 temp<br/> lea dx,mess1<br/> mov ah,9<br/> int 21h <br/> lea dx,temp<br/> mov ah,9<br/> int 21h<br/> ret<br/>search endp</p><p>insert proc near<br/> lea dx,mess4<br/> mov ah,9<br/> int 21h<br/> lea dx,mess2<br/> mov ah,9<br/> int 21h<br/> lea dx,mess4<br/> mov ah,9<br/> int 21h<br/> call ipname<br/> lea dx,mess4<br/> mov ah,9<br/> int 21h<br/> lea dx,mess3<br/> mov ah,9<br/> int 21h<br/> call ipnumber <br/> cld<br/> mov al,20<br/> mov cl,count<br/> mul cl<br/> lea di,buf<br/> add di,ax<br/> lea si,_name+2<br/> mov cx,10<br/> rep movsb<br/> lea si,num+2<br/> mov cx,10<br/> rep movsb<br/> inc count<br/> lea dx,mess5<br/> mov ah,9<br/> int 21h<br/> lea dx,mess4<br/> mov ah,9<br/> int 21h<br/> mov ah,7<br/> int 21h<br/> ret<br/>insert endp</p><p>ipnumber proc near<br/> lea dx,num<br/> mov ah,10<br/> int 21h<br/> lea dx,mess4<br/> mov ah,9<br/> int 21h<br/> mov bh,0<br/> mov bl,num+1<br/> mov cx,10<br/> sub cx,bx<br/>c1: mov num[bx+2],20h<br/> inc bx<br/> loop c1<br/> ret<br/>ipnumber endp<br/>
& D" v' \5 ^& M s: ] <br/>codes ends<br/> end main </p><br/> |
|