📄 li8.asm
字号:
data segment
mess1 db 'Input year:$'
mess2 db 'is a leap year!$'
data ends
code segment
main proc far
assume cs:code,ds:data
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov ah,9
lea dx,mess1
int 21h
call decibin
call crlf
;------------------
mov ax,bx
mov dx,0
mov cx,4
div cx
cmp dx,0
jne exit
mov ax,bx
mov dx,0
mov cx,100
div cx
cmp dx,0
jne disp
mov cx,4
div cx
cmp dx,0
jne exit
disp:
mov ah,9
lea dx,mess2
int 21h
exit:
ret
main endp
;------------------
decibin proc near
mov bx,0
newchar:
mov ah,1
int 21h
sub al,30h
cmp al,0
jb exit1
cmp al,9
jnbe exit1
cbw
xchg ax,bx
mov cx,10d
mul cx
xchg ax,bx
add bx,ax
jmp newchar
exit1:
ret
decibin endp
;---------------
crlf proc near
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
int 21h
ret
crlf endp
;---------------
code ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -