0
点赞
收藏
分享

微信扫一扫

实训汇编语言设计——输入1-12 ,显示月份缩写


输入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 endpdisplay proc near
push dx
lea dx,alfmon
mov ah,09
int 21h
pop dx
ret
display endp

codesg ends

end main

举报

相关推荐

0 条评论