8086彙編程序,鍵盤輸入選擇菜單執行相應的功能

assume ds:datasg,ss:stacksg,cs:codesg

datasg segment
    db '1.Display       '
    db '2.Brows         '
    db '3.Replace       '
    db '4.Modify        '
    db 'Input C OR L OR U:','$'
datasg ends

stacksg segment
    dw 0,0,0,0,0,0,0,0
stacksg ends

codesg  segment
  start:
        mov ax, datasg
        mov ds,ax
        mov bx,0
        mov di,0

        mov ax,stacksg
        mov ss,ax
        mov sp,16

        mov ax,0b800h
        mov es,ax
     s1:call clear
        call case
     s2:call cursor
       
     s3:mov dx, 64
       mov ah, 9
       int 21h  
          
       mov ah, 01h
  show:int 21h 
       cmp al,0dh
       jz disp0
       mov dl,al
       jmp show        
  disp0:   
       cmp dl,'q'
       je exit
       cmp dl,'l'
       je disp1
       cmp dl,'u'
       je disp2
       cmp dl,'c'
       je disp3
       cmp dl,'h'
       je disp4
       jmp s1
       
    disp1:
        mov dl,1
        call case
        jmp s1
    disp2:
        mov dl,2
        call case
        jmp s1
    disp3:
        call clear
        jmp s2
    disp4:call clear
        jmp s3

   exit: mov ax, 4c00h   
         int 21h
  
     cursor proc near
             push ax
             push bx
             push dx

             mov ah, 2h
             mov bh, 0
             mov dh, 05h
             mov dl, 06h
             int 10h

             pop dx 
             pop bx
             pop ax
          ret
      cursor endp

     clear proc near
           push ax    
           mov ah,15
           int 10h
           mov ah,0
           int 10h
           pop ax
       ret
     clear endp 
        case proc near
             push si
             push cx
             push ax
             push es 
             push bx
			
              mov ax,2
              mov di,ax 
              mov si,1800
              mov cx,4
              for1: push cx
                  push si
                  mov cx,00eh
                  for2:
                      mov ah,00000010b
                      mov al,ds:[di] 
					  					  
                      mov bl, 65
                      mov bh, 90
					 
                      cmp al, bl
                      jl unchange 
                      cmp al,bh
                      jle upperCase 
                      mov bl, 97
                      mov bh, 122
                      cmp al,bl
                      jl unchange
                      cmp al,bh
                      jle lowerCase
                      jmp unchange                                    
		  upperCase: 
                      cmp dl,2
                      je unchange
                      cmp dl,1
                      jne unchange
                      add al, 32
                      jmp unchange
		  lowerCase:
                      cmp dl,1
                      je unchange
                      cmp dl,2
                      jne unchange
                      sub al,32
                      jmp unchange
					  
             unchange : mov es:[si],ax
                        mov ds:[di],al
                      inc di
                      add si,2
                  loop for2
                  add di,2
              pop si
              add si,160
              pop cx 
              loop for1
               
              pop bx
              pop es
              pop ax
              pop cx
              pop si
          ret 
          case endp
codesg  ends
end start
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章