Model křižovatky
ORG 0
MOV R2,#0FFH
MOV R5,#0FFH
SJMP MIMO
FAZE1: MOV P1,#09BH
MOV P3,#076H
CALL ZPOZ
PRECH1: MOV P1,#0A9H
MOV P3,#0A5H
CALL ZPOZ2
FAZE2: MOV P1,#076H
MOV P3,#09BH
CALL ZPOZ
PRECH2: MOV P1,#0A5H
MOV P3,#0A9H
CALL ZPOZ2
DJNZ R6,FAZE1
SJMP MIMO
ZPOZ: DJNZ R2,C1
MOV R2,#0FFH
RET
C1: MOV R1,#0FFH
C2: DJNZ R1,C3
SJMP ZPOZ
C3: MOV R0,#01FH
C4: DJNZ R0,C4
SJMP C2
ZPOZ2: DJNZ R5,C11
MOV R5,#0FFH
RET
C11: MOV R4,#01FH
C22: DJNZ R4,C33
SJMP ZPOZ2
C33: MOV R3,#07FH
C44: DJNZ R3,C44
SJMP C22
MIMO: MOV R6,#4D
O: MOV P1,#0FFH
MOV P3,#0FFH
CALL ZPOZM
MOV P1,#0EDH
MOV P3,#0EDH
CALL ZPOZM
DJNZ R6,O
MOV R6,#4D
SJMP FAZE1
ZPOZM: MOV R4,#00FH
MOV R3,#07FH
CZZ: DJNZ R5,C1Z
MOV R5,#0FFH
MOV R4,#01FH
RET
C1Z: MOV R4,#00FH
C2Z: DJNZ R4,C3Z
SJMP CZZ
C3Z: MOV R3,#07FH
C4Z: DJNZ R3,C4Z
SJMP C2Z
END