org 0000h
ljmp start
org 0003h
reti
org 000bh
ljmp intt0
org 0013h
reti
org 001bh
ljmp intt1
org 0023h
reti
start: mov r0,#70h
mov r7,#0bh
cleardisp: mov @r0,#00h
inc r0
djnz r7,cleardisp
mov 20h,#00h
mov 7ah,#0ah
mov tmod,#11h
mov tl0,#0b0h
mov th0,#3ch
mov th1,#0b0h
mov th1,#3ch
setb ea
setb et0
setb tr0
mov r4,#14h
start1: lcall display
jnb p3.7,setmm1
sjmp start1
setmm1: ljmp setmm
intt0: push acc
push psw
clr et0
clr tr0
mov a,#0b7h
add a,tl0
mov tl0,a
mov a,#3ch
addc a,th0
mov th0,a
setb tr0
djnz r4,outt0
addss: mov r4,#14h
mov r0,#71h
acall add1
mov a,r3
clr c
cjne a,#60h,addmm
addmm: jc outt0
acall clr0
mov r0,#77h
acall add1
mov a,r3
clr c
cjne a,#60h,addhh
addhh: jc outt0
acall clr0
mov r0,#79h
acall add1
mov a,r3
clr c
cjne a,#24h,hour
hour: jc outt0
acall clr0
outt0: mov 72h,76h
mov 73h,77h
mov 74h,78h
mov 75h,79h
pop psw
pop acc
setb et0
reti
intt1: push acc
push psw
mov tl1,#0b0h
mov th1,#3ch
djnz r2,intt1out
mov r2,#06h
cpl 02h
jb 02h,flash1
mov 72h,76h
mov 73h,77h
mov 74h,78h
mov 75h,79h
intt1out: pop psw
pop acc
reti
flash1: jb 01h,flash2
mov 72h,7ah
mov 73h,7ah
mov 74h,78h
mov 75h,79h
ajmp intt1out
flash2: mov 72h,76h
mov 73h,77h
mov 74h,7ah
mov 74h,7ah
ajmp intt1out
add1: mov a,@r0
dec r0
swap a
orl a,@r0
add a,#01h
da a
mov r3,a
anl a,#0fh
mov @r0,a
mov a,r3
inc r0
swap a
anl a,#0fh
mov @r0,a
ret
clr0: clr a
mov @r0,a
dec r0
mov @r0,a
ret
setmm: clr et0
clr tr0
lcall dl1s
jb p3.7,closedis
mov r2,#06h
setb et1
setb tr1
set2: jnb p3.7,set1
setb 00h
set4: jb p3.7,set3
lcall dl05s
jnb p3.7,sethh
mov r0,#77h
lcall add1
mov a,r3
clr c
cjne a,#60h,hhh
hhh: jc set4
lcall clr0
clr c
ajmp set4
closedis: setb et0
setb tr0
close: jb p3.7,close
lcall display
jb p3.7,close
waith: jnb p3.7,waith
ljmp start1
sethh: clr 00h
sethh1: jnb p3.7,set5
setb 01h
set6: jb p3.7,set7
lcall dl05s
jnb p3.7,setout
mov r0,#79h
lcall add1
mov a,r3
clr c
cjne a,#24h,houu
houu: jc set6
lcall clr0
ajmp set6
setout: jnb p3.7,setout1
lcall display
jnb p3.7,setout
clr 01h
clr 00h
clr 02h
clr tr1
clr et1
setb tr0
setb et0
ljmp start1
set1: lcall display
ajmp set2
set3: lcall display
ajmp set4
set5: lcall display
ajmp sethh1
set7: lcall display
ajmp set6
setout1: lcall display
ajmp setout
display: mov r1,#70h
mov r5,#0feh
play: mov a,r5
mov p3,a
mov a,@r1
mov dptr,#tab
movc a,@a+dptr
mov p1,a
lcall dl1ms
inc r1
mov a,r5
jnb acc.5,endout
rl a
mov r5,a
ajmp play
endout: setb p3.5
mov p1,#0ffh
ret
tab:db 0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h,0ffh
dl1ms: mov r6,#14h
dl1: mov r7,#19h
dl2: djnz r7,dl2
djnz r6,dl1
ret
ds20ms: acall display
acall display
acall display
ret
dl1s: lcall dl05s
lcall dl05s
ret
dl05s: mov r3,#20h
dl05s1: lcall display
djnz r3,dl05s1
ret
end