📄 wnl.asm.bak
字号:
extrn display:far
extrn outface:far
Esccode equ 01h
Up equ 048h
Down equ 050h
Left equ 04bh
Right equ 04dh
dseg segment
Year dw 0
Month db 0
temp db 10 dup(0)
count dw ?
ErrMsg db 0dh,0ah,"对不起你输入的不是数字! $"
inputYM db 0dh,0ah,'请分别输入年份和月份:','$'
dseg ends
cseg segment
assume cs:cseg,ds:dseg
start:
mov ax,dseg
mov ds,ax
call GetYearMonth
Ws:
mov bx,Year
mov dl,Month
call far ptr display
again:
mov ah,0
int 16h
cmp ah,Esccode
je Exit
cmp ah,Up
je NextY
cmp ah,Down
je PreY
cmp ah,Left
je PreM
cmp ah,Right
je NextM
jmp again
NextY:
inc Year
jmp Ws
PreY:
dec Year
jmp Ws
NextM:
inc Month
cmp Month,12
jbe skip0
mov Month,1
inc Year
skip0:
jmp Ws
PreM:
dec Month
cmp Month,1
jae skip1
mov Month,12
dec Year
skip1:
jmp Ws
clear proc near
push ax
push bx
push cx
push dx
mov ah,6
mov al,0
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
pop dx
pop cx
pop bx
pop ax
ret
clear endp
Exit:
call clear
CALL outface
mov ah,4ch
int 21h
;**************************************************
GetYearMonth proc near
mov dx,offset inputYM
mov ah,09h
int 21h
push ax
push cx
push si
push di
inputagain:
mov Year,0
mov Month,0
mov si,0
repeatY:
mov ah,1
int 21h
cmp al,0dh
je EndY
cmp al,20h
je EndY
cmp al,1bh
je ExitDos0
cmp al,30h
jb Err
cmp al,39h
ja Err
sub al,30h
mov temp[si],al
inc si
jmp repeatY
Err:
mov ah,9
lea dx,ErrMsg
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
jmp inputagain
EndY:
mov bx,10
mov di,si
mov si,0
NextYBit:
mov ah,0
mov al,temp[si]
mov count,di
sub count,si
dec count
mov cx,count
jcxz skipY
lopmul: mul bx
loop lopmul
skipY: add Year,ax
inc si
cmp si,di
jne NextYBit
push dx
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
pop dx
jmp skiplap
ExitDos0:
jmp ExitDos
skiplap:
mov si,0
repeatM:
mov ah,1
int 21h
cmp al,0dh
je EndMon
cmp al,20h
je EndMon
cmp al,1bh
je ExitDos
cmp al,30h
jb Err
cmp al,39h
ja Err
sub al,30h
mov temp[si],al
inc si
jmp repeatM
EndMon:
mov di,si
mov si,0
mov bl,10
NextMBit:
mov al,temp[si]
mov count,di
sub count,si
dec count
mov cx,count
jcxz skipM
lpmul: mul bl
loop lpmul
skipM: add Month,al
inc si
cmp si,di
jne NextMBit
push dx
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
pop dx
pop di
pop si
pop cx
pop ax
ret
ExitDos:
mov ah,4ch
int 21h
GetYearMonth endp
cseg ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -