📄 month.asm
字号:
.model small
.data
input db 'please input a month number',0dh,0ah,'$'
show1 db 0dh,0ah,'input error!please input again!',0dh,0ah,'$'
tabel DW MONTH1
DW MONTH2
DW MONTH3
DW MONTH4
DW MONTH5
DW MONTH6
DW MONTH7
DW MONTH8
DW MONTH9
DW MONTH10
DW MONTH11
DW MONTH12
JAN DB '=JAN',0DH,0AH,'$'
FEB DB '=FEB',0DH,0AH,'$'
MAR DB '=MAR',0DH,0AH,'$'
APR DB '=APR',0DH,0AH,'$'
MAY DB '=MAY',0DH,0AH,'$'
JUN DB '=JUN',0DH,0AH,'$'
JUL DB '=JUL',0DH,0AH,'$'
AUG DB '=AUG',0DH,0AH,'$'
SEP DB '=SEP',0DH,0AH,'$'
OCT DB '=OCT',0DH,0AH,'$'
NOV DB '=NOV',0DH,0AH,'$'
DECE DB '=DEC',0DH,0AH,'$'
.code
.startup
;
Mov ax,@data
Mov ds,ax
;
start:
Mov Dx,offset input
Mov Ah,09h
Int 21h
input1:
Mov Ah,01h ;输入第一个字符,存在al
Int 21h
Mov bl,al ;bl保存十位
cmp al,'0'
jl wrong
cmp al,'1'
ja wrong
;
input2:
Mov Ah,01h ;输入第二个字符,al保存个位
Int 21h
Cmp bl,'0'
je compare0;
cmp al,'0' ;十位为1
jb wrong
cmp al,'2'
ja wrong
Jmp show ;输入正确的处理
compare0: ;十位为0
cmp al,'1'
jb wrong
cmp al,'9'
ja wrong
show: ;输入正确的处理
SUB AL,30H ;asc转换为数字
CMP BL,'0'
JE LAB0
ADD AL,10
LAB0:
DEC AL
MOV AH,0
SHL AL,1
MOV BX,AX
JMP tabel[BX]
month1:
mov dx,offset jan
jmp start2
month2:
mov dx,offset feb
jmp start2
month3:
mov dx,offset mar
jmp start2
month4:
mov dx,offset apr
jmp start2
month5:
mov dx,offset may
jmp start2
month6:
mov dx,offset jun
jmp start2
month7:
mov dx,offset jul
jmp start2
month8:
mov dx,offset aug
jmp start2
month9:
mov dx,offset sep
jmp start2
month10:
mov dx,offset oct
jmp start2
month11:
mov dx,offset nov
jmp start2
month12:
mov dx,offset dece
jmp start2
START2: ;输出缩写
Mov Ah,09h
Int 21h
jmp start
wrong: ;输入错误
Mov dx,offset show1
Mov ah,09h
Int 21h
jmp input1
;
last:
.exit 0
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -