$crystal = 12000000
$regfile = "89c51cc.dat"
Dim A As Byte
Dim D As Byte
Dim C As Byte
P1 = 255
P3 = 0
P2 = 0
Main:
Control:
If P1 = &B11111110 Then
Waitms 100
P2 = &B01111001
A = &B00000001
D = P3
C = A Xor D
P3 = C
Wait 1
Goto Control
Else
If P1 = &B11111101 Then
Waitms 100
P2 = &B00010010
A = &B00000010
D = P3
C = A Xor D
P3 = C
Wait 1
Goto Control
Else
If P1 = &B11111100 Then
Waitms 100
P2 = &B00000110
A = &B00000100
D = P3
C = A Xor D
P3 = C
Wait 1
Goto Control
Else
If P1 = &B11111011 Then
Waitms 100
P2 = &B01001100
A = &B00001000
D = P3
C = A Xor D
P3 = C
Wait 1
Goto Control
Else
If P1 = &B11111010 Then
Waitms 100
P2 = &B00100100
A = &B00010000
D = P3
C = A Xor D
P3 = C
Wait 1
Goto Control
Else
If P1 = &B11111001 Then
Waitms 100
P2 = &B00100000
A = &B00100000
D = P3
C = A Xor D
P3 = C
Wait 1
Goto Control
Else
If P1 = &B11111000 Then
Waitms 100
P2 = &B00001111
A = &B01000000
D = P3
C = A Xor D
P3 = C
Wait 1
Goto Control
Else
If P1 = &B11110111 Then
Waitms 100
P2 = &B00000000
A = &B10000000
D = P3
C = A Xor D
P3 = C
wait 1
Goto Control
Else
Goto Control
End If
End If
End If
End If
End If
End If
End If
End If
End