|
|
#4
可见光2007-06-19 22:57
date segment org 0 string db 20,?,20 dup(?),'$' str1 db 'please input a string:',0ah,0dh,'$' str2 db '------------------Main menu-------------------',0ah,0dh db 's or S------------------Sort the string',0ah,0dh db 'i or I------------------Insert a string',0ah,0dh db 'd or D------------------Delet a part',0ah,0dh db 'f or F------------------Find a string',0ah,0dh db 'e or E------------------Exit',0ah,0dh db 'Enter your choice:',0ah,0dh,'$' str3 db '------------------sort string-------------------',0ah,0dh db '1--------Sort the string in up order-----',0ah,0dh db '2--------Sort the string in down order-----',0ah,0dh db 'r or R---Return to the main menu',0ah,0dh db 'Enter your choice:',0ah,0dh,'$' tishi1 db 'the former date is:',0ah,0dh,'$' tishi2 db 'please input the place of the number you want to insert(1-9):',0ah,0dh,'$' tishi3 db 0ah,0dh,'please input the number you want to insert:$' tishi4 db 0ah,0dh,'the result after insert is:$' err db 'the number you input is wrong,please input again:',0ah,0dh,'$' tishi6 db 0ah,0dh,'the result of shengxu is:',0ah,0dh,'$' tishi7 db 0ah,0dh,'the result of jiangxu is:',0ah,0dh,'$' tishi8 db 0ah,0dh,'please input the date you want to search:$' tishi9 db 0ah,0dh,'find$' tishi0 db 0ah,0dh,'not found$' dat1 db 13 dup(?),'$' date ends code segment assume cs:code,ds:date start:mov ax,date mov ds,ax lea dx,str1 mov ah,9h int 21h lea dx,string mov ah,0ah int 21h main1:lea dx,str2 mov ah,9h int 21h mov ah,1h int 21h cmp al,'s' jz sort cmp al,'S' jz sort cmp al,'i' jz insert cmp al,'I' jz insert cmp al,'f' jz search cmp al,'F' jz search cmp al,'e' jz exit cmp al,'E' jz exit sort:lea dx,str3 mov ah,09h int 21h mov ah,1h int 21h cmp al,'1' jz shengxu cmp al,'2' jz jiangxu cmp al,'r' jz main1 cmp al,'R' jz main1 lea dx,err mov ah,9h int 21h jmp sort shengxu:lea dx,tishi1 mov ah,9h int 21h lea dx,string mov ah,9h int 21h lea si,string add si,2 go5:mov di,si inc di cmp si,9 jnbe ok mov al,[si] go3:cmp di,10 jnbe go4 cmp [di],al jb go7 inc di jmp go3 go7:xchg al,[di] mov [si],al inc di jmp go3 go4:inc si jmp go5 ok:lea dx,tishi6 mov ah,9h int 21h lea dx,string mov ah,9h int 21h jmp sort jiangxu:lea dx,tishi1 mov ah,9h int 21h lea dx,string mov ah,9h int 21h lea si,string add si,2 g5:mov di,si inc di cmp si,9 jnbe k mov al,[si] g3:cmp di,10 jnbe g4 cmp [di],al ja g7 inc di jmp g3 g7:xchg al,[di] mov [si],al inc di jmp g3 g4:inc si jmp g5 k:lea dx,tishi7 mov ah,9h int 21h lea dx,string mov ah,9h int 21h jmp sort search:lea dx,tishi8 mov ah,9h int 21h mov ah,1h int 21h lea si,string add si,2 d:cmp si,10 ja cc cmp [si],al jz find inc si jmp d find:lea dx,tishi9 mov ah,9h int 21h jmp exit cc:lea dx,tishi0 mov ah,9h int 21h jmp main1 insert:lea dx,tishi2 mov ah,9h int 21h mov ah,1h int 21h mov cl,al and cl,0fh lea dx,tishi3 mov ah,9h int 21h mov ah,1 int 21h inc cl mov ch,0 mov si,10 next:cmp si,cx jb finish mov bl,[si] mov [si+1],bl dec si jmp next finish:inc si mov [si],al lea dx,tishi4 mov ah,9h int 21h lea dx,string mov ah,9h int 21h jmp main1 exit: mov ah,4ch int 21h code ends end start 还没通过而且功能还没加全!帮忙啊!大伙
|