📄 clock.asm
字号:
mov cl,2
mul cl
mov si,ax
cmp di,15
jz tt
jmp table1[si]
check2:
mov ah,7
int 21h
cmp al,'b'
jnz tt
jmp main_menu
Draw_V macro s_h_pos,s_v_pos,i
local repeat1
mov cx,s_h_pos
mov ax,i
mov dl,space
mul dl
add cx,ax
mov dx,s_v_pos
repeat1:
mov ah,0ch
mov al,01
mov bh,0
int 10h
inc dx
cmp dx,s_v_pos+step
jnz repeat1
endm
;------------------------------
Draw_H macro s_h_pos,s_v_pos,i
local repeat2
mov cx,s_h_pos
mov ax,i
mov dl,space
mul dl
add cx,ax
mov bx,cx
add bx,step
mov temp1[0],bx
mov dx,s_v_pos
repeat2:
mov ah,0ch
mov al,01
mov bh,0
int 10h
inc cx
cmp cx,temp1[0]
jnz repeat2
endm
;--------------------------------
pr0:
Draw_H 100,100,i
Draw_H 100,122,i
Draw_V 100,100,i
Draw_V 110,100,i
Draw_V 100,112,i
Draw_V 110,112,i
jmp ll
pr1:
Draw_V 110,100,i
Draw_V 110,112,i
jmp ll
pr2:
Draw_H 100,100,i
Draw_H 100,111,i
Draw_H 100,122,i
Draw_V 110,100,i
Draw_V 100,112,i
jmp ll
pr3:
Draw_H 100,100,i
Draw_H 100,111,i
Draw_H 100,122,i
Draw_V 110,100,i
Draw_V 110,112,i
jmp ll
pr4:
Draw_H 100,111,i
Draw_V 100,100,i
Draw_V 110,100,i
Draw_V 110,112,i
jmp ll
pr5:
Draw_H 100,100,i
Draw_H 100,111,i
Draw_H 100,122,i
Draw_V 100,100,i
Draw_V 110,112,i
jmp ll
pr6:
Draw_H 100,100,i
Draw_H 100,111,i
Draw_H 100,122,i
Draw_V 100,100,i
Draw_V 100,112,i
Draw_V 110,112,i
jmp ll
pr7:
Draw_H 100,100,i
Draw_V 110,100,i
Draw_V 110,112,i
jmp ll
pr8:
Draw_H 100,100,i
Draw_H 100,111,i
Draw_H 100,122,i
Draw_V 100,100,i
Draw_V 110,100,i
Draw_V 100,112,i
Draw_V 110,112,i
jmp ll
pr9:
Draw_H 100,100,i
Draw_H 100,111,i
Draw_H 100,122,i
Draw_V 100,100,i
Draw_V 110,100,i
Draw_V 110,112,i
jmp ll
;-------------------------------
ret
display endp
;--------------------------------------------------------------------------------------
alarm proc near
back_alarm:
mov ah,00h
mov al,03h
int 10h
mov dl,25
mov dh,5
mov bh,0
mov ah,2
int 10h
mov ah,9
mov dx,offset notice
int 21h
mov dl,10
mov dh,8
mov ah,2
int 10h
mov ah,9
mov dx,offset msg1
int 21h
mov dl,10
mov dh,10
mov ah,2
int 10h
mov ah,9
mov dx,offset msg2
int 21h
refresh: mov si,0
re_str: mov ah,01h
int 21h
cmp al,0dh
jz confirm
cmp al,'0'
jb cp_key
cmp al,'9'
ja cp_key
mov temp2[si],al
inc si
mov con_flag[0],si
jmp re_str
cp_key: cmp al,key_r1
jz back_alarm
cmp al,key_R
jz back_alarm
cmp al,key_b1
jz main_back
cmp al,key_B
jz main_back
jnz confirm
main_back:jmp main_menu
confirm: mov cx,con_flag[0]
cmp cx,6
jz back_alarm
mov dl,10
mov dh,20
mov ah,2
int 10h
mov ah,9
mov dx,offset in_err
int 21h
check_back: mov ah,7
int 21h
cmp al,key_r1
jz refresh
cmp al,key_R
jz refresh
jmp check_back
call test_alarm
check_b:
mov ah,7
int 21h
cmp al,key_B
jnz check_b
ret
alarm endp
;--------------------------------------------------------------------------------------
test_alarm proc near
call readtime
mov al,temp2[0]
sub al,30h
cmp al,test_table[8]
ja not_yet
call readtime
mov al,temp2[1]
sub al,30h
cmp al,test_table[9]
ja not_yet
call readtime
mov al,temp2[2]
sub al,30h
cmp al,test_table[10]
ja not_yet
call readtime
mov al,temp2[3]
sub al,30h
cmp al,test_table[11]
ja not_yet
call music
not_yet: ret
test_alarm endp
;------------------------------------------------------------------------------------------
music proc near
lea si,mus_freq
lea bp,ds:mus_time
freq: mov di,[si]
cmp di,-1
je end_mus
mov bx,ds:[bp]
call gensound
add si,2
add bp,2
jmp freq
end_mus: ret
music endp
;--------------------------------------------------------------------------------------
waitf proc near
push ax
waitf1:
in al,61h
and al,10h
cmp al,ah
je waitf1
mov ah,al
loop waitf1
pop ax
ret
waitf endp
;--------------------------------------------------------------------------------------
readtime proc near
mov ah,2ch
int 21h
;-----------------
mov temp[0],cx
mov ax,dx
mov cl,8
ror ax,cl
and ax,0ffh
mov bl,10 ;second
div bl
mov cl,ah
and cx,0ffh
push cx
and ax,0ffh
push ax
;------------------
mov ax,temp[0]
and ax,0ffh
mov bl,10
div bl
mov cl,ah ;minute
and cx,0ffh
push cx
and ax,0ffh
push ax
mov ax,temp[0]
and ax,0ff00h
mov cl,8
ror ax,cl
mov bl,10
div bl ;hour
mov cl,ah
and cx,0ffh
push cx
and ax,0ffh
push ax
;-----------------------
mov ah,2ah
int 21h
mov temp[0],cx
mov temp[2],dx
mov ax,temp[2]
and ax,0ffh
mov bl,10
div bl
mov cl,ah ;day
and cx,0ffh
push cx
and ax,0ffh
push ax
mov ax,temp[2]
and ax,0ff00h
mov cl,8
ror ax,cl
mov bl,10
div bl ;month
mov cl,ah
and cx,0ffh
push cx
and ax,0ffh
push ax
mov ax,temp[0]
mov bl,10
div bl
mov cl,ah ;year
and cx,0ffh
push cx
and ax,0ffh
div bl
mov cl,ah
and cx,0ffh
push cx
and ax,0ffh
div bl
mov cl,ah
and cx,0ffh
push cx
and ax,0ffh
push ax
mov cx,14
mov si,0
loop1:
pop ax
and ax,0ffh
mov test_table[si],al
inc si
loop loop1
ret
readtime endp
;------------------------------------------------------------------------------------
code ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -