DISBEG EQU 30H
CALB EQU P1.7
tiMCON EQU 2FH
ORG 0000H
LJMP MAIN
ORG 0003H
RETI
ORG 000BH
LJMP INTT0
ORG 0013H
RETI
ORG 001BH
LJMP INTT1
ORG 0023H
RETI
TAB: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH
I_TAB: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH
DLY1M: MOV R6,#14H
DL_LOOP: MOV R7,#19H
DL_LOOP1:DJNZ R7,DL_LOOP1
DJNZ R6,DL_LOOP
RET
DLY20M:CLR CALB
LCALL D_II_PLAY
LCALL D_II_PLAY
LCALL D_II_PLAY
SETB CALB
RET
DL_LOOPS:LCALL DL05S
LCALL DL05S
RET
DL05S: MOV R3,#20H
DL05S1: LCALL D_II_PLAY
DJNZ R3,DL05S1
RET
CTIME: MOV A,#10H
MOV B,79H
MUL AB
ADD A,78H
MOV TIMCON,A
CLOOP: LCALL DLY20M
LCALL DL_LOOPS
LCALL DL_LOOPS
LCALL DL_LOOPS
DJNZ TIMCON,CLOOP
CLR 08H
MAIN: MOV R0,#00H
MOV R7,#80H
MLOOP: MOV @R0,#00H
INC R0
DJNZ R7,MLOOP
MOV 20H,#00H
MOV 7AH,#0AH
MOV TMOD,#11H
MOV TL0,#0B0H
MOV TH0,#3CH
MOV TL1,#0B0H
MOV TH1,#3CH
SETB EA
SETB ET0
SETB TR0
MOV R4,#14H
MOV DISBEG,#70H
MLOOP1:LCALL D_II_PLAY
JNB P1.0,T_SETSC
JNB P1.1,DLY5
JNB P1.2,FUNBT
JNB P1.3,TSET
JB 08H,CTIME
AJMP MLOOP1
FUNBT: LJMP DLY6
TSET: LCALL DLY20M
JB P1.3,MLOOP1
TS_LOOP:JNB P1.3,TS_LOOP
JB 05H,CLRBELL
MOV DISBEG,#50H
MOV 50H,#0CH
MOV 51H,#0AH
MINCHG:SETB EA
LCALL D_II_PLAY
JNB P1.2,DLY1
JNB P1.0,DLY3
JNB P1.3,DLY
AJMP MINCHG
CLRBELL:CLR 05H
CLR CALB
AJMP MLOOP1
DLY:LCALL DLY20M
JB P1.3,MINCHG
LJMP DLY8
T_SETSC:LJMP R_SETTIM
DLY1:LCALL DLY20M
JB P1.2,MINCHG
DLY2: LCALL D_II_PLAY
JNB P1.2,DLY2
CLR EA
MOV R0,#53H
LCALL ADD_1
MOV A,R3
CLR C
CJNE A,#60H,ADD_M
ADD_M:JC MINCHG
ACALL CLR_H
AJMP MINCHG
DLY3:LCALL DLY20M
JB P1.0,MINCHG
DLY4:LCALL D_II_PLAY
JNB P1.0,DLY4
CLR EA
MOV R0,#53H
LCALL SUB_M
LJMP MINCHG
DLY5:LCALL DLY20M
JB P1.1,T_MLOOP1
JNB P1.1,$
CPL 03H
JNB 03H,DIS_SET
MOV DISBEG,#60H
MOV 60H,#00H
MOV 61H,#00H
MOV 62H,#00H
MOV 63H,#00H
MOV 64H,#00H
MOV 65H,#00H
MOV TL1,#0F0H
MOV TH1,#0D8H
SETB TR1
SETB ET1
T_MLOOP1:LJMP MLOOP1
DIS_SET:MOV DISBEG,#70H
CLR ET1
CLR TR1
T_MLOOP11:LJMP MLOOP1
DLY6:LCALL DLY20M
JB P1.2,T_MLOOP11
T_EST11:JNB P1.2,T_EST11
CLR ET1
CLR TR1
T_EST22:JNB P1.1,DLY5
JB P1.2,T_EST21
LCALL DLY20M
JB P1.2,T_EST22
T_EST55:JNB P1.2,T_EST51
MOV 60H,#00H
MOV 61H,#00H
MOV 62H,#00H
MOV 63H,#00H
MOV 64H,#00H
MOV 65H,#00H
T_EST33:JNB P1.1,DLY5
JB P1.2,T_EST31
LCALL DLY20M
JB P1.2,T_EST33
T_EST44:JNB P1.2,T_EST41
SETB ET1
SETB TR1
AJMP MLOOP1
T_EST411:LCALL D_II_PLAY
AJMP T_EST11
T_EST21:LCALL D_II_PLAY
AJMP T_EST22
T_EST31:LCALL D_II_PLAY
AJMP T_EST33
T_EST41:LCALL D_II_PLAY
AJMP T_EST44
T_EST51:LCALL D_II_PLAY
AJMP T_EST55
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,I_INT0
A_DDS:MOV R4,#14H
CPL 07H
MOV R0,#71H
ACALL ADD_1
MOV A,R3
CLR C
CJNE A,#60H,A_DDM
A_DDM:JC I_INT0
ACALL CLR_H
MOV R0,#77H
ACALL ADD_1
MOV A,R3
CLR C
CJNE A,#60H,A_DDH
A_DDH:JC I_INT0
ACALL CLR_H
LCALL DLY20M
SETB 08H
MOV R0,#79H
ACALL ADD_1
MOV A,R3
CLR C
CJNE A,#24H,RSTART
RSTART:JC I_INT0
ACALL CLR_H
I_INT0:MOV 72H,76H
MOV 73H,77H
MOV 74H,78H
MOV 75H,79H
LCALL BELL
POP PSW
POP ACC
SETB ET0
RETI
INTT1:PUSH ACC
PUSH PSW
JB 03H,R_ADDS
MOV TL1,#0B0H
MOV TH1,#3CH
DJNZ R2,I_INT1
MOV R2,#06H
CPL 02H
JB 02H,FLASH0
MOV 72H,76H
MOV 73H,77H
MOV 74H,78H
MOV 75H,79H
I_INT1:POP PSW
POP ACC
RETI
FLASH0:JB 01H,FLASH1
MOV 72H,7AH
MOV 73H,7AH
MOV 74H,78H
MOV 75H,79H
AJMP I_INT1
FLASH1:MOV 72H,76H
MOV 73H,77H
MOV 74H,7AH
MOV 75H,7AH
AJMP I_INT1
R_ADDS:CLR TR1
MOV A,#0F7H
ADD A,TL1
MOV TL1,A
MOV A,#0D8H
ADDC A,TH1
MOV TH1,A
SETB TR1
MOV R0,#61H
ACALL ADD_1
CLR C
MOV A,R3
JZ R_ADDM
AJMP I_INT01
R_ADDM:ACALL CLR_H
MOV R0,#63H
ACALL ADD_1
MOV A,R3
CLR C
CJNE A,#60H,R_ADDH
R_ADDH:JC I_INT01
LCALL CLR_H
MOV R0,#65H
ACALL ADD_1
I_INT01:POP PSW
POP ACC
RETI
ADD_1: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
SUB_M:MOV A,@R0
DEC R0
SWAP A
ORL A,@R0
JZ SUB_M1
DEC A
SUB_M11:MOV R3,A
ANL A,#0FH
CLR C
SUBB A,#0AH
SUB_M111:JC SUB_M110
MOV @R0,#09H
SUB_M10:MOV A,R3
INC R0
SWAP A
ANL A,#0FH
MOV @R0,A
RET
SUB_M1:MOV A,#59H
AJMP SUB_M11
SUB_M110:MOV A,R3
SUB_H:MOV A,@R0
DEC R0
SWAP A
ORL A,@R0
JZ SUB_H1
DEC A
SUB_H11:MOV R3,A
ANL A,#0FH
CLR C
SUBB A,#0AH
SUB_H111:JC SUB_H110
MOV @R0,#09H
SUB_H10:MOV A,R3
INC R0
SWAP A
ANL A,#0FH
MOV @R0,A
RET
SUB_H1:MOV A,#23H
AJMP SUB_H11
SUB_H110:MOV A,R3
CLR_H:CLR A
MOV @R0,A
DEC R0
MOV @R0,A
RET
R_SETTIM:CLR ET0
CLR TR0
LCALL DL_LOOPS
LCALL DLY20M
JB P1.0,SLEEP
MOV R2,#06H
MOV 70H,#00H
MOV 71H,#00H
SETB ET1
SETB TR1
SET_2:JNB P1.0,SET_1
SETB 00H
SET_4:JB P1.0,SET_3
LCALL DL05S
LCALL DLY20M
JNB P1.0,R_SETHH
MOV R0,#77H
LCALL ADD_1
MOV A,R3
CLR C
CJNE A,#60H,SET_LOOP
SET_LOOP:JC SET_4
LCALL CLR_H
CLR C
AJMP SET_4
SLEEP:SETB ET0
SETB TR0
SET_LOOP1:JB P1.0,SET_LOOP1
LCALL DLY20M
JB P1.0,SET_LOOP1
SET_LOOP2:JNB P1.0,SET_LOOP2
LJMP MLOOP1
R_SETHH:CLR 00H
SETB 01H
SET_LOOP3:JNB P1.0,SET_5
SET_6:JB P1.0,SET_7
LCALL DL05S
LCALL DLY20M
JNB P1.0,STOP
MOV R0,#79H
LCALL ADD_1
MOV A,R3
CLR C
CJNE A,#24H,C_YHH
C_YHH:JC SET_6
LCALL CLR_H
AJMP SET_6
STOP:JNB P1.0,STOP1
LCALL DLY20M
JNB P1.0,STOP
CLR 01H
CLR 00H
CLR 02H
CLR TR1
CLR ET1
SETB TR0
SETB ET0
LJMP MLOOP1
SET_1:LCALL D_II_PLAY
AJMP SET_2
SET_3:LCALL D_II_PLAY
JNB P1.1,DLY7
AJMP SET_4
SET_5:LCALL D_II_PLAY
AJMP SET_LOOP3
SET_7:LCALL D_II_PLAY
JNB P1.1,DLY7B
AJMP SET_6
STOP1:LCALL D_II_PLAY
AJMP STOP
DLY7:LCALL DLY20M
JB P1.1,SET_41
DLY7_M:JNB P1.1,DLY7_M
MOV R0,#77H
LCALL SUB_M
LJMP SET_4
SET_41:LJMP SET_4
DLY7B:LCALL DLY20M
JB P1.1,SET_61
DLY7_H:JNB P1.1,DLY7_H
MOV R0,#79H
LCALL SUB_H
LJMP SET_6
SET_61:LJMP SET_6
D_II_PLAY:MOV R1,DISBEG
MOV R5,#0FEH
PLAY:MOV A,R5
MOV P2,A
MOV A,@R1
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P0,A
MOV A,R5
JB ACC.2,D_LOOP
CLR P0.7
D_LOOP:JB ACC.4,D_LOOP1
CLR P0.7
D_LOOP1:LCALL DLY1M
INC R1
MOV A,R5
JNB ACC.5,CLOSE
RL A
MOV R5,A
MOV P0,#0FFH
AJMP PLAY
CLOSE:MOV P2,#0FFH
MOV P0,#0FFH
RET
SD_II_PLAY:MOV R1,DISBEG
MOV R5,#0FEH
I_PLAY:MOV A,R5
MOV P2,A
MOV A,@R1
MOV DPTR,#I_TAB
MOVC A,@A+DPTR
MOV P0,A
MOV A,R5
LCALL DLY1M
INC R1
MOV A,R5
JNB ACC.5,CLOSES
RL A
MOV R5,A
AJMP I_PLAY
CLOSES:MOV P2,#0FFH
MOV P0,#0FFH
RET
DLY8:LCALL D_II_PLAY
JNB P1.3,DLY8
MOV 50H,#0AH
MOV 51H,#0CH
R_BTIM:SETB EA
LCALL D_II_PLAY
JNB P1.2,DLY12
JNB P1.0,DLY14
JNB P1.3,DLY9
JNB P1.1,DLY10
AJMP R_BTIM
DLY9:LCALL DLY20M
JB P1.3,R_BTIM
DLY8M:LCALL D_II_PLAY
JNB P1.3,DLY8M
MOV DISBEG,#70H
LJMP MLOOP1
DLY10:LCALL DLY20M
JB P1.1,R_BTIM
DLY11:LCALL D_II_PLAY
JNB P1.1,DLY11
CPL 05H
JNB 05H,R_BTIM11
MOV 50H,#00H
AJMP R_BTIM
R_BTIM11:MOV 50H,#0AH
AJMP R_BTIM
DLY12:LCALL DLY20M
JB P1.2,R_BTIM
DLY13:LCALL D_II_PLAY
JNB P1.2,DLY13
CLR EA
MOV R0,#55H
LCALL ADD_1
MOV A,R3
CLR C
CJNE A,#24H,A_DDH33N
A_DDH33N:JC R_BTIM
ACALL CLR_H
AJMP R_BTIM
DLY14:LCALL DLY20M
JB P1.0,R_BTIM
DLY15:LCALL D_II_PLAY
JNB P1.0,DLY15
CLR EA
MOV R0,#55H
LCALL SUB_H
LJMP R_BTIM
BELL:JNB 05H,BBELL
MOV A,79H
CJNE A,55H,BBELL
MOV A,78H
CLR C
BELL_1:CJNE A,54H,BBELL
MOV A,77H
CLR C
CJNE A,53H,BBELL
MOV A,76H
CLR C
BELL_2:CJNE A,52H,BBELL
JNB 07H,BBELL
CLR CALB
RET
BBELL:SETB CALB
RET
END
|