汇编源程序
ORG 0000H
LJMP MAIN
ORG 002DH
MAIN:MOV SP,#40H
MOV 34H,#0FFH
MOV P1,0FFH
M1: CPL P1.2
LCALL YS
JB P1.3,M1
LCALL YS
JB P1.3,M1
M2: JNB P1.3,M2
CLR P1.2
MOV R7,#04H
MOV R6,#10H
MOV 30H,#0A0H
M14: MOV 32H,#00H
M13: MOV 31H,#40H
MOV R1,#20H
MA: DJNZ 31H,M4
MOV 34H,#88H
LJMP M1
M4: LCALL QD
MOV A,30H
LCALL FA
JNB F0,M3
SJMP MA
M3: MOV A,32H
LCALL FA
JB F0,MA
LCALL QD
MOV A,30H
ADD A,#01H
LCALL FA
JB F0,MA
M7: LCALL DU
MOV @R1,A
CJNE R1,#2FH,M5
LCALL FYD
LCALL TZ
SJMP M6
M5: LCALL YD
INC R1
SJMP M7
M6: MOV 31H,#0FFh
MOV R1,#20H
M9: DJNZ 31H,M8
MOV 34H,#30H
LJMP M1
M8: LCALL QD
MOV A,30H
ADD A,#08h
LCALL FA
JB F0,M9
MOV A,32H
LCALL FA
JB F0,M9
M15: MOV A,@R1
LCALL FA
JB F0,M9
CJNE R1,#2FH,M10
LCALL TZ
MOV 34H,#0AH
LCALL YS
DJNZ R6,M11
DJNZ R7,M12
NOP
NOP
NOP
LJMP MAIN
M10: INC R1
SJMP M15
M11: MOV A,32H
ADD A,#10H
MOV 32H,A
LJMP M13
M12: MOV A,30H
ADD A,#02H
MOV 30H,A
LJMP M14
ORG 0200H
YS: MOV R5,34H
LOOP1:MOV R4,#0FFH
LOOP2:DJNZ R4,LOOP2
DJNZ R5,LOOP1
RET
ORG 0100H
QD: SETB P1.7
SETB P1.6
NOP
NOP
CLR P1.7
NOP
NOP
CLR P1.6
RET