汇编 输入单词,按字典顺序输出结果(有效果图)

data segment
int1 db 30,31 dup(0),’$’
int2 db 30,31 dup(0),’$’
space db 13,10,’$’
data ends
code segment
assume   cs:code,ds:data
main:mov dx,data
     mov ds,dx    
     lea dx,[int1]
     mov ah,10
     int 21h
     mov ah,9
     lea dx,space
     int 21h

     lea dx,[int2]
     mov ah,10
     int 21h
     mov ah,9
     lea dx,space
     int 21h
     lea si,[int1+2]  ;取一个数的偏移地址
     mov bh,0
     mov bl,[int1+1]
     mov [int1+2+bx],’$’
     mov dl,bl
     lea di,[int2+2]
     mov bh,0
     mov bl,[int2+1]
     mov [int2+2+bx],’$’
      mov ah,bl
      cmp dl,bl
      ja lab
      mov bl,dl
  lab:mov cx,bx
again:mov al,[si]
      mov bl,[di]    
      cmp al,bl
      jl lab1
      ja lab2
      inc si
      inc di
      loop again
      cmp dl,ah
      ja lab2
      jmp lab1
lab2: lea dx,[int2+2]
      mov ah,9
      int 21h
      lea dx,space
      int 21h
      lea dx,[int1+2]
      int 21h
      jmp abcd

lab1:lea dx,[int1+2]
     mov ah,9
     int 21h
     lea dx,space
     int 21h
     lea dx,[int2+2]
     int 21h    
abcd:mov ax,4c00h
     int 21h
     code ends
            end  main

20080501171853[1]

- THE END -
版权声明:
转载原创文章请注明,文章出处:http://kinggoo.com
原文地址:http://kinggoo.com/chengxu-huibian-zidianjieguo.htm
发表评论?

2 条评论。

  1. Your answer was just what I neeedd. It’s made my day!

发表评论