usecond equ 50h
msecond equ 51h
second1 equ 52h
second2 equ 53h
second3 equ 54h
second4 equ 55h
org 00h
ljmp start
org 03h
ljmp int_ex0
org 0bh
ljmp int_t0
org 013h
ljmp int_ex1
org 01bh
ljmp int_t1
org 0100h
start: mov tmod,#12h
mov th0,#6
mov tl0,#6
mov th1,#0d8h
mov tl1,#0f0h
mov usecond,#40
mov msecond,#10
mov second1,#0
mov second2,#0
mov second3,#0
mov second4,#0
setb it0
setb it1
setb ex0
setb ex1
setb et0
setb et1
setb tr1
setb ea
mov r0,#second1
mov r7,#0feh
sjmp $
int_ex0:cpl tr0
reti
int_ex1:clr tr0
mov usecond,#40
mov msecond,#100
mov second1,#0
mov second2,#0
mov second3,#0
mov second4,#0
reti
int_t0: djnz usecond,t0_end
mov usecond,#40
djnz msecond,t0_end
mov msecond,#100
inc second1
mov a,second1
cjne a,#10,t0_end
mov second1,#0
inc second2
mov a,second2
cjne a,#10,t0_end
mov second2,#0
inc second3
mov a,second3
cjne a,#10,t0_end
mov second3,#0
inc second4
mov a,second4
cjne a,#10,t0_end
mov second4,#0
t0_end: reti
int_t1: mov th1,#0d8h
mov tl1,#0f0h
cpl p1.0
mov p0,#0
mov p2,#0ffh
mov a,@r0
mov dptr,#tab
movc a,@a+dptr
mov p0,a
mov p2,r7
inc r0
mov a,r7
rl a
mov r7,a
jb acc.4,t1_end
mov r0,#second1
mov r7,#0feh
t1_end: reti
tab :db 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH