Software Projects
BC's Quest for Tires, Learning with Leeper

PILOT standard 3223x[P 2168]
SYNC standard P 667, P 735
SPEED DETECTION 4x[P 780, P 1170]
  bit 0 = P 780, P 780
  bit 1 = P 780, P 1560
  FLAG BYTE none
  PARITY BYTE present, ADD instead of XOR

The loading routine:
 FF03 180D       JR   FF12
 FF05 CD08FF     CALL FF08
 FF0B 85         ADD  A,L
 FF0C 6F         LD   L,A
 FF0D 7C         LD   A,H
 FF0E CE00       ADC  A,+00
 FF10 67         LD   H,A
 FF11 C9         RET
 FF12 F3         DI
 FF13 3101FF     LD   SP,+FF01
 FF16 60         LD   H,B
 FF17 69         LD   L,C
 FF18 1103FF     LD   DE,+FF03
 FF1B 01F800     LD   BC,+00F8
 FF1E EDB0       LDIR
 FF20 C323FF     JP   FF23
 FF23 11FBBF     LD   DE,+BFFB
 FF26 DD210040   LD   IX,+4000
 FF2A ED5F       LD   A,R
 FF2C F5         PUSH AF
 FF2D FDE1       POP  IY
 FF2F 21FBFF     LD   HL,+FFFB
 FF32 74         LD   (HL),H
 FF33 D9         EXX
 FF34 DBFE       IN   A,(+FE)
 FF36 1F         RRA
 FF37 E620       AND  +20
 FF39 F601       OR   +01
 FF3B 4F         LD   C,A
 FF3C CDE705     CALL 05E7,LD_EDGE_1
 FF3F 30FB       JR   NC,FF3C
 FF41 211504     LD   HL,+0415
 FF44 10FE       DJNZ FF44
 FF46 2B         DEC  HL
 FF47 7C         LD   A,H
 FF48 B5         OR   L
 FF49 20F9       JR   NZ,FF44
 FF4B CDE305     CALL 05E3,LD_EDGE_2
 FF4E 30EC       JR   NC,FF3C
 FF50 069C       LD   B,+9C
 FF52 CDE305     CALL 05E3,LD_EDGE_2
 FF55 30E5       JR   NC,FF3C
 FF57 3EC6       LD   A,+C6
 FF59 B8         CP   B
 FF5A 30E0       JR   NC,FF3C
 FF5C 24         INC  H
 FF5D 20F1       JR   NZ,FF50
 FF5F 06C9       LD   B,+C9
 FF61 CDE705     CALL 05E7,LD_EDGE_1
 FF64 30D6       JR   NC,FF3C
 FF66 78         LD   A,B
 FF67 FED4       CP   +D4
 FF69 30F4       JR   NC,FF5F
 FF6B CDE705     CALL 05E7,LD_EDGE_1
 FF71 79         LD   A,C
 FF72 E627       AND  +27
 FF74 C620       ADD  A,+20
 FF76 EE0A       XOR  +0A
 FF78 4F         LD   C,A
 FF79 CD05FF     CALL FF05
 FF7C 210000     LD   HL,+0000
 FF7F 214000     LD   HL,+0040
 FF82 CD05FF     CALL FF05
 FF85 CD05FF     CALL FF05
 FF88 CB1C       RR   H
 FF8A CB1D       RR   L
 FF8C 7D         LD   A,L
 FF8D 32FBFF     LD   (FFFB),A
 FF90 CD05FF     CALL FF05
 FF93 210000     LD   HL,+0000
 FF96 21001F     LD   HL,+1F00
 FF99 D9         EXX
 FF9A 2E01       LD   L,+01
 FF9C D9         EXX
 FF9D 79         LD   A,C
 FF9E EE06       XOR  +06
 FFA0 4F         LD   C,A
 FFA1 23         INC  HL
 FFA5 84         ADD  A,H
 FFA6 67         LD   H,A
 FFAA 84         ADD  A,H
 FFAE BE         CP   (HL)
 FFAF 3F         CCF
 FFB0 D9         EXX
 FFB1 CB15       RL   L
 FFB3 D9         EXX
 FFB4 21001D     LD   HL,+1D00
 FFB7 30E9       JR   NC,FFA2
 FFB9 D9         EXX
 FFBA 7A         LD   A,D
 FFBB B3         OR   E
 FFBC 2811       JR   Z,FFCF
 FFBE 7D         LD   A,L
 FFBF 84         ADD  A,H
 FFC0 67         LD   H,A
 FFC1 DD7500     LD   (IX+00),L
 FFC4 1B         DEC  DE
 FFC5 DD23       INC  IX
 FFC7 D9         EXX
 FFC8 210000     LD   HL,+0000
 FFCB 2627       LD   H,+27
 FFCD 18CA       JR   FF99
 FFCF 00         NOP			ld a,h		;overwritten during load
 FFD0 00         NOP			sub l
 FFD1 00         NOP			jr nz,ffed
 FFD2 00         NOP
 FFD3 00         NOP			out (fe),a
 FFD4 00         NOP
 FFD5 C3EDFF     JP   FFED		jp fee7
 FFD8 3AFBFF     LD   A,(FFFB)
 FFDB 0F         RRCA
 FFDC 0F         RRCA
 FFDD E63F       AND  +3F
 FFDF 47         LD   B,A
 FFE0 08         EX   AF,AF'
 FFE1 3E7F       LD   A,+7F
 FFE3 DBFE       IN   A,(+FE)
 FFE5 A9         XOR  C
 FFE6 E640       AND  +40
 FFE8 2004       JR   NZ,FFEE
 FFEA 05         DEC  B
 FFEB 20F4       JR   NZ,FFE1
 FFED C7         RST  0000,START
 FFEE 79         LD   A,C
 FFEF EE47       XOR  +47
 FFF1 4F         LD   C,A
 FFF2 E60F       AND  +0F
 FFF4 D3FE       OUT  (+FE),A
 FFF6 08         EX   AF,AF'
 FFF7 90         SUB  B
 FFF8 87         ADD  A,A
 FFF9 87         ADD  A,A
 FFFA C9         RET

The saving routine:
 FF01 3E07       LD   A,+07
 FF03 D3FE       OUT  (+FE),A
 FF05 AF         XOR  A
 FF06 DBFE       IN   A,(+FE)
 FF08 0F         RRCA
 FF09 38FA       JR   C,FF05
 FF0B DD210040   LD   IX,+4000
 FF0F 11FBBF     LD   DE,+BFFB
 FF12 21980C     LD   HL,+0C98
 FF15 3E01       LD   A,+01
 FF17 47         LD   B,A
 FF18 10FE       DJNZ FF18
 FF1A D3FE       OUT  (+FE),A
 FF1C EE0F       XOR  +0F
 FF1E 06A4       LD   B,+A4
 FF20 2D         DEC  L
 FF21 20F5       JR   NZ,FF18
 FF23 05         DEC  B
 FF24 25         DEC  H
 FF25 F218FF     JP   P,FF18
 FF28 062F       LD   B,+2F
 FF2A 10FE       DJNZ FF2A
 FF2C D3FE       OUT  (+FE),A
 FF2E 3E0C       LD   A,+0C
 FF30 0637       LD   B,+37
 FF32 10FE       DJNZ FF32
 FF34 D3FE       OUT  (+FE),A
 FF36 0603       LD   B,+03
 FF38 0E04       LD   C,+04
 FF3A 3E3C       LD   A,+3C
 FF3C 90         SUB  B
 FF3D 47         LD   B,A
 FF3E 10FE       DJNZ FF3E
 FF40 AF         XOR  A
 FF41 D3FE       OUT  (+FE),A
 FF43 0658       LD   B,+58
 FF45 10FE       DJNZ FF45
 FF47 3E0F       LD   A,+0F
 FF49 23         INC  HL
 FF4A D3FE       OUT  (+FE),A
 FF4C 0604       LD   B,+04
 FF4E 00         NOP
 FF4F 0D         DEC  C
 FF50 20E8       JR   NZ,FF3A
 FF52 2EFF       LD   L,+FF
 FF54 0608       LD   B,+08
 FF56 00         NOP
 FF57 DD6600     LD   H,(IX+00)
 FF5A 7D         LD   A,L
 FF5B 84         ADD  A,H
 FF5C 6F         LD   L,A
 FF5D 37         SCF
 FF5E 08         EX   AF,AF'
 FF5F 3E3C       LD   A,+3C
 FF61 90         SUB  B
 FF62 47         LD   B,A
 FF63 10FE       DJNZ FF63
 FF65 AF         XOR  A
 FF66 D3FE       OUT  (+FE),A
 FF68 D8         RET  C
 FF69 08         EX   AF,AF'
 FF6A CB14       RL   H
 FF6C 9F         SBC  A,A
 FF6D E63C       AND  +3C
 FF6F C638       ADD  A,+38
 FF71 47         LD   B,A
 FF72 10FE       DJNZ FF72
 FF74 3E0F       LD   A,+0F
 FF76 D3FE       OUT  (+FE),A
 FF78 03         INC  BC
 FF79 0605       LD   B,+05
 FF7B 7C         LD   A,H
 FF7C E67F       AND  +7F
 FF7E 20DE       JR   NZ,FF5E
 FF80 060C       LD   B,+0C
 FF82 1B         DEC  DE
 FF83 DD23       INC  IX
 FF85 7A         LD   A,D
 FF86 B3         OR   E
 FF87 C28FFF     JP   NZ,FF8F
 FF8A 65         LD   H,L
 FF8B 03         INC  BC
 FF8C 05         DEC  B
 FF8D 18CB       JR   FF5A
 FF8F 7A         LD   A,D
 FF90 3C         INC  A
 FF91 20C4       JR   NZ,FF57
 FF93 0630       LD   B,+30
 FF95 10FE       DJNZ FF95
 FF97 03         INC  BC
 FF98 C7         RST  0000,START