實訓組合語言設計——輸入1-12 ,顯示月份縮寫

來源:互聯網
上載者:User

輸入1-12 ,顯示月份縮寫

title home
datasg segment
 three db 3
 monin db 3,4 dup(?)
 alfmon db '???','$'
 montab db 'JNA','FEB','MAR','APR','MAY','JUN'
        db 'JUL','AUG','SEP','OCT','NOV','DEC'
datasg ends
codesg segment para'code'
 assume cs:codesg,ds:datasg,es:datasg
main proc far
    push ds
    sub ax,ax
    push ax
    mov ax,datasg
    mov ds,ax
    mov es,ax
 l1:mov ah,0aH
    int 21h
    cmp dl,3
    jz  exit
  
    call input
    call locate
    call display
    mov ah,2
    mov dl,0ah          ;實現斷行符號換行
    int 21h
    mov dl,0dh
    int 21h
    jmp l1
exit:ret
main endp

 input proc near
    push dx
    mov ah,0ah
    lea dx,monin
    int 21h
    mov ah,monin+2
    mov al,monin+3
    xor ax,3030h
    cmp ah,00
    jz return
    sub ah,ah
    add al,10
 return: pop dx
    ret
 input endp
 
 locate proc near
    push si
    push di
    push cx
    lea si,montab
    dec al
    mul three
    add si,ax
    mov cx,03
    cld
    lea di,alfmon
    rep movsb
    pop cx
    pop di
    pop si
    ret
locate endp

display proc near
    push dx
    lea dx,alfmon
    mov ah,09
    int 21h
    pop dx
    ret
 display  endp
 
 codesg ends
     
       end main  
                   

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.