您的位置:首页 > 其它

寻找汇编大神帮我看一下这个程序

2016-01-15 09:16 211 查看
功能菜单的编制:小写字母向大写字母的转换;大写字母向小写字母的转换;二进制数向十六进制数的转换;十六进制数向二进制数的转换;十六进制数向十进制数的转换。

public info1,info2,bufa,bufb,buf,main,info0,info3

extrn change1:far,change2:far,change3:far,change4:far

                                     

data segment                                

info0 db 0ah,0dh,'this is the change of letter to leter:$'

info1 db 0ah,0dh,'please input string:$'

info2 db 0ah,0dh,'output string:$'

bufa  db  81

      db ?

      db 80 dup (?)

bufb  db 80 dup (?)

info3  db 0ah,0dh,'this is the change of digital to

digital:',0ah,0dh,'$'

buf   db 0dh,0ah,'the numberis:0100101010001111b',0ah,0dh,'the result is:$'

data ends

stack segment stack

    db 200 dup (?)

stack ends

code segment

main proc far

     assume ds:data,cs:code,ss:stack

     mov ax,data

     mov ds,ax

     

disp macro m

     lea dx,m

     mov ah,9

     int 21h

     endm

     call change1

     call change2

     disp info3

     

disp buf

     call change3

     call change4

     ret

main endp

code ends

    end 

 

 

extrninfo1:byte,info2:byte,bufa:byte,bufb:byte,info0:byte

publicchange1

code segment

  assume cs:code

lowtohighproc near

   cmp al,'a'

   jb stop

   cmp al,'z'

   ja stop

   sub al,20h

stop :ret

lowtohighendp

change1 procfar

   lea dx,info0

   mov ah,9

   int 21h

 

   lea dx,info1

   mov ah,9

   int 21h

   lea dx,bufa

   mov ah,10

   int 21h

   lea si,bufa+1

   lea di,bufb

   mov ch,0

   mov cl,[si]

   add si,1

next:moval,[si]

     calllowtohigh

     mov [di],al

     inc si

     inc di

     loop next

     mov byte ptr [di],'$'

     lea dx,info2

     mov ah,9

     int 21h

     lea dx,bufb

     mov ah,9

     int 21h

     ret

change1 endp

  code ends

  end 

 

extrninfo1:byte,info2:byte,bufa:byte,bufb:byte

publicchange2

code segment

  assume cs:code

hightolowproc near

     cmp al,'A'

     jb stop

     cmp al,'Z'

     ja stop

     add al,20h

stop:ret

hightolowendp

change2 procfar

     lea dx,info1

     mov ah,9

     int 21h

     leadx,bufa

     mov ah,10

     int 21h

     lea si,bufa+1

     lea di,bufb

     mov ch,0

     mov cl,[si]

     inc si

next:moval,[si]

     call hightolow

     mov [di],al

     inc si

     inc di

     loop next

     mov byte ptr [di] ,'$'

     lea dx,info2

     mov ah,9

     int 21h

     lea dx,bufb

     mov ah,9

     int 21h

  
96a6
   ret

change2 endp

  code ends

  end

 

 

extrnbuf:byte,info3:byte

publicchange3

code segment

change3 procfar

       assume cs:code

       sub ax,ax

       mov ch,4

       mov cl,4

       mov bx,4a8fh

rotate: rolbx,cl

        mov al,bl

        and al,0fh

        add al,30h

        cmp al,3ah1

        jl printit

        add al,7h

printit: movdl,al

         mov ah,2

         int 21h

         dec ch

         jnz rotate

         mov dl,'H'

         mov ah,2

         int 21h

         ret

change3  endp

code     ends

         end

 

 

publicchange4

data segment

buf db0ah,0dh,'please input the four hexnumber:$'

data ends

code segment

     assume cs:code,ds:data

change4 proc far

       mov ax,data

       mov ds,ax

       lea dx,buf

       mov ah,9

       int 21h

       mov bx,0

       mov ch,4

input: movcl,4

       sal bx,cl

       mov ah,1

       int 21h

       cmp al,39h

       ja af

       and al,0fh

       jmp binary

af:    and al,0fh

       add al,9

binary: orbl,al

        dec ch

        cmp ch,0

        jne input

        mov dl,'H'

        mov ah,2

        int 21h

        mov dl,0ah

        mov ah,2

        int 21h

        mov dl,0dh

        mov ah,02

        int 21h

       mov cx,16

disp:  mov dl,0

       rol bx,1

       rcl dl,1

       or dl,30h

       mov ah,02h

       int 21h

       loop disp

       mov dl,'B'

       mov ah,2

       int 21h

       ret

change4 endp

code  ends

      end

 

 

publicchange5

data segment

binary dw7fffh,50h

       n=($-binary)/2

buf  db 7 dup(0)

info1 db0ah,0dh,'this is the change from hexnumber to decimal:$'

info2 db0ah,0dh,'the number is:7fffh,50h$',0ah,0dh

info3 db0ah,0dh,'the result is:$'

data ends

stack segmentstack

      db 200 dup(0)

stack ends

code segment

     assume cs:code,ds:data,ss:stack

f2to10 procnear

      push bx

      push dx

      push si

      push cx

disp  macro m

      lea dx,m

      mov ah,9

      int 21h

      endm

      lea si,buf

      or ax,ax

      jnsplus

      neg ax

      mov [si],byte ptr '-'

      inc si

plus: movbx,10

      mov cx,0

lop1: movdx,0

      div bx

      push dx

      inc cx

      or ax,ax

      jne lop1

lop2: pop ax

      cmp al,10

      jb l1

      add al,7

l1:   add al,30h

      mov [si],al

      inc si

      dec cx

      jne lop2

      mov [si],byte ptr 'D'

      inc si

      mov [si],byte ptr '$'

      disp info3

      disp buf

      pop cx

      pop si

      pop dx

      pop bx

      ret

f2to10 endp

change5 procfar

start: movax,data

       mov ds,ax

       disp info1

       disp info2

       mov cx,n

       lea di,binary

lopa:  mov ax,[di]

       call f2to10

       add di,2

       loop lopa

       ret

change5 endp

code ends

      end

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  汇编 二进制