📄 leapyear.asm
字号:
DATAS SEGMENT
w db 'the year you input is not allowed!$'
x db 'this is a leap year!$'
y db 'this is not a leap year!$'
z db 'please input the year you wanna test:$' ;此处输入数据段代码
DATAS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS
START:
MOV AX,DATAS
MOV DS,AX
lea dx,z
mov ah,09h
int 21h
mov bx,0
newchar:
mov ah,1
int 21h
cmp al,0dh
jz check
sub al,30h
cbw
xchg ax,bx
mov cx,10d
mul cx
xchg ax,bx
add bx,ax
jmp newchar
check: cmp bx,1900d
jl print
cmp bx,2100
jg print
mov ax,bx
cwd
mov cx,4
div cx
cmp dx,0
jnz no
mov ax,bx
cwd
mov cx,100
div cx
cmp dx,0
jnz yes
mov ax,bx
cwd
mov cx,400
div cx
jnz no
yes:
mov dl,0Dh
mov ah,2
int 21h
mov dl,0Ah
mov ah,02h
int 21h
lea dx,x
mov ah,09h
int 21h
jmp exit
no:
mov dl,0Dh
mov ah,2
int 21h
mov dl,0Ah
mov ah,02h
int 21h
lea dx,y
mov ah,09h
int 21h
jmp exit
print:
mov dl,0Dh
mov ah,2
int 21h
mov dl,0Ah
mov ah,02h
int 21h
lea dx,w
mov ah,09h
int 21h
exit: MOV AH,4CH
INT 21H
CODES ENDS
END START
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -