*
* Centipede
*
* (c) 1982, Atari
* (s) 2020, Antoine Vignau
*
* Made from LoGo's crack
*

	mx	%11
	org	$9000
	lst	off

*----------------------------

L02FC	=	$02FC
L05F0	=	$05F0
L0600	=	L05F0+$10
L0610	=	L0600+$10
L0800	=	$0800
L1020	=	$1020
L1560	=	$1560
HGR1	=	$2000
HGR2	=	$4000
L6000	=	$6000
L7800	=	$7800
L8000	=	$8000
L8080	=	L8000+$80
L8B00	=	$8B00
L8F00	=	$8F00

SOFTEV	EQU	$03F2
PWREDUP	EQU	$03F4
KBD	EQU	$C000
KBDSTROBE EQU	$C010
SPKR	EQU	$C030
TXTCLR	EQU	$C050
MIXCLR	EQU	$C052
TXTPAGE1 EQU	$C054
TXTPAGE2 EQU	$C055
HIRES	EQU	$C057
BUTN0	EQU	$C061
BUTN1	EQU	$C062
ROMIN2	EQU	$C081
RDROM2	EQU	$C082
LCBANK2	EQU	$C083
PREAD	EQU	$FB1E
INIT	EQU	$FB2F
VTAB	EQU	$FC22
CRLEOP	EQU	$FC42
HOME	EQU	$FC58
WAIT	EQU	$FCA8
RDKEY	EQU	$FD0C
PRBYTE	EQU	$FDDA
COUT	EQU	$FDED
SETKBD	EQU	$FE89
SETVID	EQU	$FE93
RESETV	EQU	$FFFC

*----------------------------
* KEYS
*
* Up	: A
* Down	: Z
* Left	: left arrow
* Right	: right arrow
* J	: joystick
* K	: keyboard
* Butns	: shoot
*
*----------------------------

*----------------------------
* ZERO PAGE
*
* $A0..$A1	: pointer
* $A2..$A3	: pointer
* $A4		: length
* $A5..$A5	: offset within buffer area $0800

*----------------------------

fgINPUT	=	$f8	; 0: joystick, 1: keyboard
whichDIR =	$fc	; 0: none, 1: up, 2: down, 4: left, 8: right

*----------------------------

*--- Font and friends

L9000	hex	0000000000000000
	hex	02BB5A305FEE3DA8
	hex	0A0A0A0000000000
	hex	0A0A1F0A1F0A0A00
	hex	041E050E140F0400
	hex	00130B041A190000
	hex	02050502150F1600
	hex	0404040000000000
	hex	0402010101020400
	hex	0408101010080400
	hex	04150E040E150400
	hex	0004041F04040000
	hex	0000000006040200
	hex	0000001F00000000
	hex	0000000000060600
	hex	1010080402010100
	hex	040A11110A040000
	hex	04060404040E0000
	hex	0E11100C061F0000
	hex	0E11100C110E0000
	hex	0109091F08080000
	hex	1F010F10100F0000
	hex	0E01010F110E0000
	hex	1F10080402010000
	hex	0E110E11110E0000
	hex	1E111E10100E0000
	hex	0006060006060000
	hex	0006060006040200
	hex	0804020102040800
	hex	00001F001F000000
	hex	0204081008040200
	hex	0E11100C04000400
	hex	0E111D0D05011E00
	hex	040A111F11110000
	hex	0F110F11110F0000
	hex	0E110101110E0000
	hex	0F111111110F0000
	hex	1F010701011F0000
	hex	1F01070101010000
	hex	0F11011D111E0000
	hex	11111F1F11110000
	hex	1F040404041F0000
	hex	10101010110E0000
	hex	1109070509110000
	hex	01010101011F0000
	hex	111B151111110000
	hex	1113151911110000
	hex	0E111111110E0000
	hex	0F11110F01010000
	hex	0E11111509160000
	hex	0F11110F09110000
	hex	1F011F10101F0000
	hex	1F04040404040000
	hex	11111111110E0000
	hex	111111111A040000
	hex	111111151B110000
	hex	110A040A11110000
	hex	11110A0404040000
	hex	1F080402011F0000
	hex	0000000000000000
	hex	0000000000000000
	hex	0000000000000000
	hex	0000000000000000
	hex	0000000000000000
	hex	082A2A2A08080800
	hex	082A2A2A08000000
	hex	082A2A2200000000
	hex	082A280000000000
	hex	0000000000000000
	hex	1054545410101000
	hex	1054545410000000
	hex	1054544400000000
	hex	1054500000000000
	hex	0000000000000000
	hex	8184A8AAAAA88481
	hex	838C9EBFBF9E8C83
	hex	90848AAAAA8A8490
	hex	E098BAFEFEBA98E0
	hex	9084A9AAAAA88490
	hex	B08C9EBFBF9E8CB0
	hex	81848AAAAA8A8481
	hex	8698BAFEFEBA9886
	hex	7E66666666667E00
	hex	1818181818181800
	hex	7E60607E06067E00
	hex	7E60607E60607E00
	hex	6666667E60606000
	hex	7E06067E60607E00
	hex	0606067E66667E00
	hex	7E60606060606000
	hex	7E66667E66667E00
	hex	7E66667E60606000
	hex	888888AAAAAAAAAA
	hex	888888AAAAAAAAAA
	hex	888888AAAAAAAAAA
	hex	0000000000000000

	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0001020304050607
	hex	08090A0B0C0D0E0F
	hex	1011121314151617
	hex	18191A1B1C1D1E1F
	hex	2021222324252627
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF

	hex	0000000000000000
	hex	0000000000000000
	hex	0000000000000000
	hex	0000000000000000
	hex	0000000000000000
	hex	0808080808080808
	hex	0808080808080808
	hex	0808080808080808
	hex	0808080808080808
	hex	0808080808080808
	hex	1010101010101010
	hex	1010101010101010
	hex	1010101010101010
	hex	1010101010101010
	hex	1010101010101010
	hex	1818181818181818
	hex	1818181818181818
	hex	1818181818181818
	hex	1818181818181818
	hex	1818181818181818
	hex	2020202020202020
	hex	2020202020202020
	hex	2020202020202020
	hex	2020202020202020
	hex	2020202020202020
	hex	2828282828282828
	hex	2828282828282828
	hex	2828282828282828
	hex	2828282828282828
	hex	2828282828282828
	hex	3030303030303030
	hex	3030303030303030
	hex	3030303030303030
	hex	3030303030303030
	hex	3030303030303030
	hex	3838383838383838
	hex	3838383838383838
	hex	3838383838383838
	hex	3838383838383838
	hex	3838383838383838
	hex	4040404040404040
	hex	4040404040404040
	hex	4040404040404040
	hex	4040404040404040
	hex	4040404040404040
	hex	4848484848484848
	hex	4848484848484848
	hex	4848484848484848
	hex	4848484848484848
	hex	4848484848484848
	hex	5050505050505050
	hex	5050505050505050
	hex	5050505050505050
	hex	5050505050505050
	hex	5050505050505050
	hex	5858585858585858
	hex	5858585858585858
	hex	5858585858585858
	hex	5858585858585858
	hex	5858585858585858
	hex	6060606060606060
	hex	6060606060606060
	hex	6060606060606060
	hex	6060606060606060
	hex	6060606060606060
	hex	6868686868686868
	hex	6868686868686868
	hex	6868686868686868
	hex	6868686868686868
	hex	6868686868686868
	hex	7070707070707070
	hex	7070707070707070
	hex	7070707070707070
	hex	7070707070707070
	hex	7070707070707070
	hex	7878787878787878
	hex	7878787878787878
	hex	7878787878787878
	hex	7878787878787878
	hex	7878787878787878
	hex	8080808080808080
	hex	8080808080808080
	hex	8080808080808080
	hex	8080808080808080
	hex	8080808080808080
	hex	8888888888888888
	hex	8888888888888888
	hex	8888888888888888
	hex	8888888888888888
	hex	8888888888888888
	hex	9090909090909090
	hex	9090909090909090
	hex	9090909090909090
	hex	9090909090909090
	hex	9090909090909090
	hex	9898989898989898
	hex	9898989898989898
	hex	9898989898989898
	hex	9898989898989898
	hex	9898989898989898
	hex	A0A0A0A0A0A0A0A0
	hex	A0A0A0A0A0A0A0A0
	hex	A0A0A0A0A0A0A0A0
	hex	A0A0A0A0A0A0A0A0
	hex	A0A0A0A0A0A0A0A0
	hex	A8A8A8A8A8A8A8A8
	hex	A8A8A8A8A8A8A8A8
	hex	A8A8A8A8A8A8A8A8
	hex	A8A8A8A8A8A8A8A8
	hex	A8A8A8A8A8A8A8A8
	hex	B0B0B0B0B0B0B0B0
	hex	B0B0B0B0B0B0B0B0
	hex	B0B0B0B0B0B0B0B0
	hex	B0B0B0B0B0B0B0B0
	hex	B0B0B0B0B0B0B0B0
	hex	B8B8B8B8B8B8B8B8
	hex	B8B8B8B8B8B8B8B8
	hex	B8B8B8B8B8B8B8B8
	hex	B8B8B8B8B8B8B8B8
	hex	B8B8B8B8B8B8B8B8
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF
	hex	0000FFFF0000FFFF

L9B00	hex	00000000000000008080808080808080
	hex	00000000000000008080808080808080
	hex	00000000000000008080808080808080
	hex	00000000000000008080808080808080
	hex	2828282828282828A8A8A8A8A8A8A8A8
	hex	2828282828282828A8A8A8A8A8A8A8A8
	hex	2828282828282828A8A8A8A8A8A8A8A8
	hex	2828282828282828A8A8A8A8A8A8A8A8
	hex	5050505050505050D0D0D0D0D0D0D0D0
	hex	5050505050505050D0D0D0D0D0D0D0D0
	hex	5050505050505050D0D0D0D0D0D0D0D0
	hex	5050505050505050D0D0D0D0D0D0D0D0
L9BC0	hex	2024282C3034383C2024282C3034383C
	hex	2125292D3135393D2125292D3135393D
	hex	22262A2E32363A3E22262A2E32363A3E
	hex	23272B2F33373B3F23272B2F33373B3F
	hex	2024282C3034383C2024282C3034383C
	hex	2125292D3135393D2125292D3135393D
	hex	22262A2E32363A3E22262A2E32363A3E
	hex	23272B2F33373B3F23272B2F33373B3F
	hex	2024282C3034383C2024282C3034383C
	hex	2125292D3135393D2125292D3135393D
	hex	22262A2E32363A3E22262A2E32363A3E
	hex	23272B2F33373B3F23272B2F33373B3F
L9C80	hex	00000000000000010101010101010202
	hex	02020202020303030303030304040404
	hex	04040405050505050505060606060606
	hex	06070707070707070808080808080809
	hex	0909090909090A0A0A0A0A0A0A0B0B0B
	hex	0B0B0B0B0C0C0C0C0C0C0C0D0D0D0D0D
	hex	0D0D0E0E0E0E0E0E0E0F0F0F0F0F0F0F
	hex	10101010101010111111111111111212
	hex	12121212121313131313131314141414
	hex	14141415151515151515161616161616
	hex	16171717171717171818181818181819
	hex	1919191919191A1A1A1A1A1A1A1B1B1B
	hex	1B1B1B1B1C1C1C1C1C1C1C1D1D1D1D1D
	hex	1D1D1E1E1E1E1E1E1E1F1F1F1F1F1F1F
	hex	20202020202020212121212121212222
	hex	22222222222323232323232324242424
L9D80	hex	24242425252525252525262626262626
	hex	26272727272727270000000000000000
L9DA0	hex	8182848890A0C08182848890A0C08182
	hex	848890A0C08182848890A0C081828488
	hex	90A0C08182848890A0C08182848890A0
	hex	C08182848890A0C08182848890A0C081
	hex	82848890A0C08182848890A0C0818284
	hex	8890A0C08182848890A0C08182848890
	hex	A0C08182848890A0C08182848890A0C0
	hex	8182848890A0C08182848890A0C08182
	hex	848890A0C08182848890A0C081828488
	hex	90A0C08182848890A0C08182848890A0
	hex	C08182848890A0C08182848890A0C081
	hex	82848890A0C08182848890A0C0818284
	hex	8890A0C08182848890A0C08182848890
	hex	A0C08182848890A0C08182848890A0C0
	hex	8182848890A0C08182848890A0C08182
	hex	848890A0C08182848890A0C081828488
L9EA0	hex	90A0C08182848890A0C08182848890A0
	hex	C08182848890A0C00000000000000000
L9EC0	hex	00010203040506000102030405060001
	hex	02030405060001020304050600010203
	hex	04050600010203040506000102030405
	hex	06000102030405060001020304050600
	hex	01020304050600010203040506000102
	hex	03040506000102030405060001020304
	hex	05060001020304050600010203040506
	hex	00010203040506000102030405060001
	hex	02030405060001020304050600010203
	hex	04050600010203040506000102030405
	hex	06000102030405060001020304050600
	hex	01020304050600010203040506000102
	hex	03040506000102030405060001020304
	hex	05060001020304050600010203040506
	hex	00010203040506000102030405060001
	hex	02030405060001020304050600010203
L9FC0	hex	04050600010203040506000102030405
	hex	06000102030405060000000000000000

	DS	\

*--- Entry point

LA000	LDA	#$00	;	A000
	STA	fgINPUT
	STA	$60
	STA	$61
	STA	$62
	STA	$63
	JSR	LBF37
	JSR	LADE1
	JSR	LBF61
	LDA	#<HGR1
	STA	$58
	LDA	#>HGR1
	STA	$58+1
	LDX	#$40
	LDY	#$00
	TYA
LA022	STA	($58),Y
	INY
	BNE	LA022
	INC	$58+1
	DEX
	BNE	LA022
	LDA	TXTCLR
	LDA	HIRES
	LDA	MIXCLR
	LDA	TXTPAGE1
	LDA	#$00
	STA	$B7
	STA	$0A
	STA	$0C
	LDA	#$A0
	STA	$0B
	STA	$0D
	LDA	#$C0
	STA	$10
	LDA	#$10
	STA	$6A
	JSR	LB3C0

	LDX	#$F8	; Copy sprites
LA053	LDA	LA65F,X
*	STA	L91FF,X
	lda	$91FF,X	; patch patch
	DEX
	BNE	LA053

	LDA	#$00
	STA	$D6
	LDA	#$38	; LOGO?
	STA	$D7
	LDY	#$20
LA066	LDA	LA769,Y
	STA	L7800-1,Y
	DEY
	BNE	LA066
	LSR	LA76E
	LDA	LA76E
	NOP
	NOP
	LDY	#$AB
	STY	$FF
	LDY	#$D8
	STY	$FE
	NOP
	NOP
	LDY	#$B6
	STY	$FF
	LDY	#$41
	STY	$FE
	NOP
	NOP
LA08B	JSR	LA447
	LDA	#$00
	STA	$86
	STA	$80
	STA	$90
	STA	$91
	STA	$92
	STA	$93
	STA	$94
	STA	$95
	STA	$96
	STA	$8C
	STA	$81
	STA	$85
	STA	$83
	STA	$84
	STA	$D201	; souvenir
	STA	$D203	; from
	STA	$D205	; another
	STA	$D207	; 8-bit
	STA	$D208	; computer... POKEY
	LDA	#$07
	STA	$99
	LDY	#$04
	LDA	L7800,Y
	STA	$58
	STA	$64
	INY
	LDA	L7800,Y
	STA	$58+1
	STA	$64+1
	JSR	LB3C0
	LDA	$60
	STA	$E0
	LDA	$61
	STA	$E1
	LDA	$62
	STA	$E2
	LDA	$63
	STA	$E3
	JSR	LA536
	JSR	LA4A1
	JSR	LAEC9
	JSR	LBC22
	LDX	#$0C
	LDY	#$00
LA0F3	DEY
	BNE	LA0F3
	DEX
	BNE	LA0F3
	JSR	LAEC9
	LDA	#$06
	STA	$99
	JSR	LA198
	LDA	#$00
	STA	$8F
	STA	$BC
	STA	$BD
	STA	$BE
	STA	$BF

LA10F	JSR	LAEC9
	JSR	LBC22
	LDX	#$06
	LDY	#$00
LA119	DEY
	BNE	LA119
	DEX
	BNE	LA119
	JSR	LAEC9
	LDA	KBD
	BIT	KBDSTROBE
	CMP	#$8D	; RET = play
	BEQ	LA13E
	LDX	$BC
	BEQ	LA137
	CMP	#"1"	; 1 player mode
	BEQ	LA145
*	JMP	(L0408)
	jmp	LA10F

LA137	CMP	#"2"	; 2 player mode
	BEQ	LA145
*	JMP	(L040A)
	jmp	LA10F
	
LA13E	LDA	#$06
	STA	$99
*	JMP	(L040C)
	jmp	LA1D3

LA145	LDA	#$05	; Switch player mode
	STA	$99
	LDA	$8F
	EOR	#$01
	STA	$BD
	STA	$8F
	STA	$BC
	JSR	LA159
*	JMP	(L040E)
	jmp	LA10F
	
LA159	LDA	$BC
	BEQ	LA198
	LDY	#$24
	STY	$A4
	LDA	#>LAC50
	STA	$A0+1
	LDA	#<LAC50
	STA	$A0
	BNE	LA16D
	DEC	$A0+1
LA16D	DEC	$A0
	LDA	#$29
	STA	$A5
	LDA	#$00
	STA	$A6
	JSR	LAE51
	LDY	#$52
	STY	$A4
	LDA	#>LAAD0
	STA	$A0+1
	LDA	#<LAAD0
	STA	$A0
	BNE	LA18A
	DEC	$A0+1
LA18A	DEC	$A0
	LDA	#$6B
	STA	$A5
	LDA	#$03
	STA	$A6
	JSR	LAE51
	RTS

LA198	LDY	#$24
	STY	$A4
	LDA	#>LAC20
	STA	$A0+1
	LDA	#<LAC20
	STA	$A0
	BNE	LA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	jmp	LA279
	
LA277	LDA	$D7,X
LA279	STA	$DF,X
	DEX
LA27C	BNE	LA26F
LA27E	DEY
	BEQ	LA253

	JSR	LB9AB	; GAME OVER
	LDY	#$0B
	STY	$A4
	LDA	#>LAC80
	STA	$A0+1
	LDA	#<LAC80
	STA	$A0
	LDA	#$C6
	STA	$A5
	LDA	#$01
	STA	$A6
	JSR	LAE51
	LDY	#$18
LA29D	LDA	#$FF
	JSR	WAIT
LA2A2	DEY
	BNE	LA29D
	LDA	$E0
	STA	$60
	LDA	$E1
	STA	$61
	LDA	$E2
	STA	$62
	LDA	$E3
	STA	$63
	JSR	LAC90
*	JMP	(L0418)
	jmp	LA08B
	
LA2BB	JSR	LA58B
*	JMP	(L041A)
	jmp	LA1D3
	
LA2C1	LDA	#$00
	STA	$83
	STA	$84
	JSR	LB3C0
	JSR	LA447
	JSR	LA536
*	JMP	(L041C)
	jmp	LA145

LA2D3	JSR	LA5A3
	LDA	$BC
	BNE	LA2DD
*	JMP	(L041E)
	jmp	LA368
	
LA2DD	JSR	LA5DE
	LDA	$BD
	BEQ	LA304
	LDY	#$0F
	STY	$A4
	LDA	#>LA8EA	; PLAYER TWO UP
	STA	$A0+1
	LDA	#<LA8EA
	STA	$A0
	BNE	LA2F4
	DEC	$A0+1
LA2F4	DEC	$A0
	LDA	#$A6
	STA	$A5
	LDA	#$03
	STA	$A6
	JSR	LAE51
*	JMP	(L0420)
	jmp	LA321

LA304	LDY	#$0F
	STY	$A4
	LDA	#>LA8F9	; PLAYER ONE UP
	STA	$A0+1
	LDA	#<LA8F9
	STA	$A0
	BNE	LA314
	DEC	$A0+1
LA314	DEC	$A0
	LDA	#$A6
	STA	$A5
	LDA	#$03
	STA	$A6
	JSR	LAE51
LA321	JSR	LB98B
	JSR	LB98B
	JSR	LB98B
	JSR	LB98B
	JSR	LB98B
	JSR	LB98B
	JSR	LB98B
	JSR	LB98B
	JSR	LB98B
	JSR	LB98B
	JSR	LB98B
	JSR	LB98B
	JSR	LB98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	DEX
	BNE	LA42C
	DEY
	BNE	LA429
*	JMP	(L0424)
	jmp	LA38C
	
	LDA	#$00
	STA	$A7
	STA	$96
*	JMP	(L0426)
	jmp	LA2BB
	
	LDA	#$00
	STA	$A7
	STA	$96
*	JMP	(L0428)
	jmp	LA2C1

LA447	LDA	#$00
	STA	$C7
	STA	$C1
	LDX	#$80
	STX	$C0
	STX	$B2
	INX
	INX
	STX	$C5
	LDX	#$84
	STX	$C4
	LDA	#$05
	STA	L6000+$3DA
	STA	L6000+$3DB
	LDA	#$D8
	STA	$B3
	LDX	#$08
LA469	LDA	LA758-1,X
	STA	L6000+$4D7,X
	DEX
	BNE	LA469
	LDA	#$80
	STA	$06
	LDA	#$D8
	STA	$08
	LDA	#$FF
	STA	$15
	LDA	#$00
	STA	$13
	JSR	LBF61
	JSR	LBC16
LA488	LDA	#$B0
	STA	$B6
	LDA	#$01
	STA	$BA
	LDX	$BD
	LDA	$83,X
	AND	#$07
	TAX
	LDA	LA654,X
	LDA	LA655,X
	LDA	#$00
	STA	$F5
LA4A1	JSR	LBF1A
	CMP	#$18
	BCS	LA4A1
	STA	$B0
	TAX
	LDY	#$02
	JSR	LB795
	BNE	LA4A1
	LDY	$B0
	LDX	#$C0
LA4B6	LDA	#$00
	STA	$95
	STA	L05F0,X
	STA	L05F0+$1,X
	STA	L05F0+$2,X
	STA	L05F0+$4,X
	STA	L05F0+$5,X
	STA	L05F0+$6,X
	STA	L05F0+$7,X
	STA	L05F0+$8,X
	STA	L05F0+$9,X
	STA	L05F0+$A,X
	STA	L05F0+$B,X
	STA	L05F0+$C,X
	STA	L05F0+$D,X
	STA	L05F0+$E,X
	STA	L05F0+$F,X
	TYA
	STA	L05F0+$3,X
	INC	L05F0+$5,X
	INC	L05F0+$6,X
	INC	L05F0+$4,X
	INC	L05F0+$4,X
	INY
	TXA
	SEC
	SBC	#$10
	TAX
	BNE	LA4B6
	INX
	STX	L0600+$2
	LDA	L0600+$3
	STA	$AA
	LDA	#$02
	STA	$A8
	LDA	L0600+$4
	STA	$AB
	LDA	#$01
	STA	$AC
	LDA	#$00
	STA	$AD
	LDX	$BD
	LDA	$83,X
	BEQ	LA535
	CMP	#$0C
	BNE	LA525
	LDA	#$0B
LA525	STA	$01
	LDA	#$02
	STA	L0600+$4
	LDA	#$03
	STA	L0600+$3
	STA	$A8
	DEC	$01
LA535	RTS

LA536	LDA	#$00
	STA	$86
	JSR	LA58B
	LDY	#$19
	STY	$A4
	LDA	#>LA78A	; CENTIPEDE
	STA	$A0+1
	LDA	#<LA78A	; LA545
	STA	$A0
	BNE	LA54D
	DEC	$A0+1
LA54D	DEC	$A0
	LDA	#$00
	STA	$A5
	LDA	#$00
	STA	$A6
	JSR	LAE51
	LDY	#$3E
	STY	$A4
	LDA	#>LA7D3
	STA	$A0+1
	LDA	#<LA7D3
	STA	$A0
	BNE	LA56A
	DEC	$A0+1
LA56A	DEC	$A0
	LDA	#$4C
	STA	$A5
	LDA	#$03
	STA	$A6
	LDA	#$02
	STA	$87
	LDA	#$16
	STA	$88
	LDA	#$80
	STA	$89
	LDA	#$C8
	STA	$8A
	JSR	LAE97
	JSR	LAE72
	RTS

LA58B	LDA	L7800+$3
	EOR	#$06
	STA	L7800+$3
	LDA	L7800+$6
	EOR	#$06
	STA	L7800+$6
	LDA	L7800+$1B
	EOR	#$06
	STA	L7800+$1B
LA5A3	LDA	L7800+$1C
	EOR	#$06
	STA	L7800+$1C
	RTS

LA5AC	LDA	#<L0800
	STA	$A0
	LDA	#>L0800
	STA	$A0+1
	LDA	#<L1020
	STA	$A2
	LDA	#>L1020
	STA	$A2+1
	LDX	#$03
LA5BE	INC	$A0+1	; 8_9_A_B
	INC	$A2+1	; 10_11_12_13
	DEX
	BNE	LA5BE
	LDX	#$03
	LDY	#$C0
LA5C9	LDA	($A0),Y	; BC0
	PHA
	LDA	($A2),Y	; 13E0
	STA	($A0),Y
	PLA
	STA	($A2),Y
	DEY
	BNE	LA5C9
	DEC	$A2+1
	DEC	$A0+1
	DEX
	BNE	LA5C9
	RTS

LA5DE	LDY	#$00
	STY	$CB
LA5E2	LDX	#$00
LA5E4	STX	$CA
	LDY	$CB
	JSR	LB3D8
	LDY	$CA
	LDA	($64),Y
	LDX	#$64
	JSR	LBE71
	LDX	$CA
	INX
	CPX	#$28
	BNE	LA5E4
	LDY	$CB
	INY
	STY	$CB
	CPY	#$18
	BNE	LA5E2
	RTS

LA605	LDA	L02FC
	CMP	#$21
	BNE	LA635
	INC	$8C
	LDA	#$00
	STA	$D207
	STA	$D205
	STA	$D203
	STA	$D201
	STA	$96
	LDA	#$FF
	STA	L02FC
	STA	$81
LA625	LDA	L02FC
	CMP	#$21
	BNE	LA625
	LDA	#$FF
	STA	L02FC
	INC	$81
	DEC	$8C
LA635	RTS

	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB      $00
	DB	$00
	DB	$00
	DB	$00
	DB	$26
	DB	$84
	DB	$3A
	DB	$A6
LA654	DB	$44	; A bug
LA655	DB	$D4	; The real address
	DB	$64
	DB	$E8
	DB	$26
	DB	$84
	DB	$3A
	DB	$A6
	DB	$44
	DB	$D4
	DB	$64
LA65F	DB	$E8

*--- Sprites

	DB	$08
	DB	$2A
	DB	$2A
	DB	$2A
	DB	$08
	DB	$08
	DB	$08
	DB	$00
	DB	$08
	DB	$2A
	DB	$2A
	DB	$2A
	DB	$08
	DB	$00
	DB	$00
	DB	$00
	DB	$08
	DB	$2A
	DB	$2A
	DB	$22
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$08
	DB	$2A
	DB	$28
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$10
	DB	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
	DB	$60
	DB	$60
	DB	$00
	DB	$7E
	DB	$06
	DB	$06
	DB	$7E
	DB	$60
	DB	$60
	DB	$7E
	DB	$00
	DB	$06
	DB	$06
	DB	$06
	DB	$7E
	DB	$66
	DB	$66
	DB	$7E
	DB	$00
	DB	$7E
	DB	$60
	DB	$60
	DB	$60
	DB	$60
	DB	$60
	DB	$60
	DB	$00
	DB	$7E
	DB	$66
	DB	$66
	DB	$7E
	DB	$66
	DB	$66
	DB	$7E
	DB	$00
	DB	$7E
	DB	$66
	DB	$66
	DB	$7E
	DB	$60
	DB	$60
	DB	$60
	DB	$00
	DB	$88
	DB	$88
	DB	$88
	DB	$AA
	DB	$AA
	DB	$AA
	DB	$AA
	DB	$AA
	DB	$88
	DB	$88
	DB	$88
	DB	$AA
	DB	$AA
	DB	$AA
	DB	$AA
	DB	$AA
	DB	$88
	DB	$88
	DB	$88
	DB	$AA
	DB	$AA
	DB	$AA
	DB	$AA
	DB	$AA

*--- From $A660 to $A200 until $A2F7

LA758	DB	$10
	DB	$10
	DB	$10
	DB	$10
	DB	$7C
	DB	$7C
	DB	$38
	DB	$38
LA760	DB	$52
	DB	$53
	DB	$54
	DB	$55
LA764	DB	$56
	DB	$57
	DB	$58
	DB	$59
	DB	$5A
LA769	DB	$5B
	DB	$70
	DB	$70
	DB	$70
	DB	$44
LA76E	DB	$00
	DB	$08
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$04
	DB	$41
	DB	$00
	DB	$38

LA78A	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$23	; CENTIPEDE
	DB	$25
	DB	$2E
	DB	$34
	DB	$29
	DB	$30
	DB	$25
	DB	$24
	DB	$25
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$82
	DB	$88
	DB	$D4
	DB	$D5
	DB	$D5
	DB	$D4
	DB	$88
	DB	$82
	DB	$83
	DB	$8C
	DB	$9E
	DB	$BF
	DB	$BF
	DB	$9E
	DB	$8C
	DB	$83
	DB	$A0
	DB	$88
	DB	$95
	DB	$D5
	DB	$D5
	DB	$95
	DB	$88
	DB	$A0
	DB	$E0
	DB	$98
	DB	$BA
	DB	$FE
	DB	$FE
	DB	$BA
	DB	$98
	DB	$E0
	DB	$A0
	DB	$88
	DB	$D4
LA7D3	DB	$D5
	DB	$D5
	DB	$D4
	DB	$88
	DB	$A0
	DB	$B0
	DB	$8C
	DB	$9E
	DB	$BF
	DB	$BF
	DB	$9E
	DB	$8C
	DB	$B0
	DB	$82
	DB	$88
	DB	$95
	DB	$D5
	DB	$D5
	DB	$95
	DB	$88
	DB	$82
	DB	$86
	DB	$98
	DB	$BA
	DB	$FE
	DB	$FE
	DB	$BA
	DB	$98
	DB	$86
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

	DB	$30	; PRESS
	DB	$32
	DB	$25
	DB	$33
	DB	$33
	DB	$00
	DB	$33	; SPACE
	DB	$30
	DB	$21
	DB	$23
	DB	$25
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

	DB	$2F	; ONE
	DB	$2E
	DB	$25
	DB	$00
	DB	$30	; PLAYER
	DB	$2C
	DB	$21
	DB	$39
	DB	$25
	DB	$32
	DB	$00
	DB	$27	; GAME
	DB	$21
	DB	$2D
	DB	$25
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

	DB	$30	; PRESS
	DB	$32
	DB	$25
	DB	$33
	DB	$33
	DB	$00
	DB	$02	; "2"
	DB	$12
	DB	$02
	DB	$00
	DB	$00
	DB	$26	; FOR
	DB	$2F
	DB	$32
	DB	$00
	DB	$34	; TWO
	DB	$37
	DB	$2F
	DB	$00
	DB	$30	; PLAYERS
	DB	$2C
	DB	$21
	DB	$39
	DB	$25
	DB	$32
	DB	$33
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$30	; PRESS
	DB	$32
	DB	$25
	DB	$33
	DB	$33
	DB	$00
	DB	$32	; RETURN
	DB	$25
	DB	$34
	DB	$35
	DB	$32
	DB	$2E
	DB	$00
	DB	$34	; TO
	DB	$2F
	DB	$00
	DB	$30	; PLAY
	DB	$2C
	DB	$21
	DB	$39
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

	DB	$34	; TWO
	DB	$37
	DB	$2F
	DB	$00
	DB	$30	; PLAYER
	DB	$2C
	DB	$21
	DB	$39
	DB	$25
	DB	$32
	DB	$00
	DB	$27	; GAME
	DB	$21
	DB	$2D
	DB	$25
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

	DB	$30	; PRESS
	DB	$32
	DB	$25
	DB	$33
	DB	$33
	DB	$00
	DB	$02	; "1"
	DB	$11
	DB	$02
	DB	$00
	DB	$00
	DB	$26	; FOR
	DB	$2F
	DB	$32
	DB	$00
	DB	$2F	; ONE
	DB	$2E
	DB	$25
	DB	$00
	DB	$30	; PLAYER
	DB	$2C
	DB	$21
	DB	$39
	DB	$25
	DB	$32
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

	DB	$30	; PRESS
	DB	$32
	DB	$25
	DB	$33
	DB	$33
	DB	$00
	DB	$32	; RETURN
	DB	$25
	DB	$34
	DB	$35
	DB	$32
	DB	$2E
	DB	$00
	DB	$34	; TO
	DB	$2F
	DB	$00
	DB	$30	; PLAY
	DB	$2C
	DB	$21
	DB	$39

LA8DC	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

LA8EA	DB	$30	; PLAYER TWO UP
	DB	$2C
	DB	$21
	DB	$39
	DB	$25
	DB	$32
	DB	$00
	DB	$34
	DB	$37
	DB	$2F
	DB	$00
	DB	$35
	DB	$30
	DB	$00
	DB	$00

LA8F9	DB	$30	; PLAYER UP ONE
	DB	$2C
	DB	$21
	DB	$39
	DB	$25
	DB	$32
	DB	$00
	DB	$2F
	DB	$2E
	DB	$25
	DB	$00
	DB	$35
	DB	$30
	DB	$00
	DB	$00
	DB	$3C
	DB	$7E
	DB	$7E
	DB	$FF
	DB	$FF
	DB	$7E
	DB	$7E

LA90F	DB	$3C
	DB	$0A
	DB	$05
	DB	$0F
	DB	$0F
	DB	$0E
	DB	$0E
	DB	$06
LA917	DB	$00
	DB	$42
	DB	$DB
	DB	$66
	DB	$3C
	DB	$D8
	DB	$58
	DB	$78
LA91F	DB	$30
	DB	$21
	DB	$DB
	DB	$66
	DB	$3C
	DB	$1B
	DB	$1A
	DB	$1E
LA927	DB	$0C
	DB	$22
	DB	$5D
	DB	$1C
	DB	$08
	DB	$1C
	DB	$36
	DB	$5D
	DB	$00
LA930	DB	$E0
	DB	$A0
	DB	$A0
	DB	$A0
	DB	$E0
	DB	$00
	DB	$7F
	DB	$54
	DB	$57
	DB	$54
	DB	$7F
	DB	$00
	DB	$7D
	DB	$55
	DB	$57
	DB	$55
	DB	$7F
	DB	$00
	DB	$7F
	DB	$55
	DB	$57
	DB	$54
	DB	$7C
	DB	$00
	DB	$02
	DB	$BB
	DB	$5A
	DB	$30
	DB	$5F
	DB	$EE
	DB	$3D
	DB	$A8

	ASC	'COPYRIGHT 1982 ATARI, INC.'

	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
LA970	DB	$20
	DB	$00
	DB	$20
	DB	$00
	DB	$20
	DB	$00
	DB	$20
	DB	$00
	DB	$20
	DB	$00
	DB	$20
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

LA980	LDA	fgINPUT
	BEQ	LA987
	JMP	LAA09

LA987	LDA	KBD
	CMP	#"K"
	BNE	LA991
	JMP	LAA09

LA991	LDX	$FA
	BNE	LA9CF
	LDA	$FB
	EOR	whichDIR
	STA	$FB
	JSR	PREAD
	LDA	$FB
	CPY	#$A0
	BCS	LA9B4
	CPY	#$40
	BCC	LA9BE
	LDA	$FB
	AND	#$F3
	STA	$FB
	LDA	#$00
	STA	whichDIR
	BEQ	LA9C6
LA9B4	ORA	#$08
	STA	$FB
	LDA	#$08
	STA	whichDIR
	BNE	LA9C6
LA9BE	ORA	#$04
	STA	$FB
	LDA	#$04
	STA	whichDIR
LA9C6	LDA	$FA
	EOR	#$01
	STA	$FA
	LDA	$FB
	RTS

LA9CF	LDA	$FB
	EOR	$FD
	STA	$FB
	JSR	PREAD
	LDA	$FB
	CPY	#$A0
	BCS	LA9F8
	CPY	#$40
	BCC	LA9EE
	LDA	$FB
	AND	#$FC
	STA	$FB
	LDA	#$00
	STA	$FD
	BEQ	LAA00
LA9EE	ORA	#$01
	STA	$FB
	LDA	#$01
	STA	$FD
	BNE	LAA00
LA9F8	ORA	#$02
	STA	$FB
	LDA	#$02
	STA	$FD
LAA00	LDA	$FA
	EOR	#$01
	STA	$FA
	LDA	$FB
	RTS

LAA09	LDA	KBD
	CMP	#"K"	; K
	BEQ	LAA3D
	CMP	#"J"	; J
	BEQ	LAA44
	CMP	#"A"
	BEQ	LAA33
	CMP	#"Z"
	BEQ	LAA38
	CMP	#$88	; LEFT ARROW
	BEQ	LAA2E
	CMP	#$95	; RIGHT ARROW
	BEQ	LAA29
	LDA	#$00
	STA	whichDIR
	RTS

LAA29	LDA	#$08	; go right
	STA	whichDIR
	RTS

LAA2E	LDA	#$04	; go left
	STA	whichDIR
	RTS

LAA33	LDA	#$01	; go up
	STA	whichDIR
	RTS

LAA38	LDA	#$02	; go down
	STA	whichDIR
	RTS

LAA3D	LDA	#$01
	STA	fgINPUT
	LDA	#$00
	RTS

LAA44	LDA	#$00
	STA	fgINPUT
	RTS

	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$01
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

LAA70	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$30	; PRESS
	DB	$32
	DB	$25
	DB	$33
	DB	$33
	DB	$00
	DB	$02	; "2"
	DB	$12
	DB	$02
	DB	$00
	DB	$26	; FOR
	DB	$2F
	DB	$32
	DB	$00
	DB	$34	; TWO
	DB	$37
	DB	$2F
	DB	$00
	DB	$30	; PLAYER
	DB	$2C
	DB	$21
	DB	$39
	DB	$25
	DB	$32
	DB	$00
	DB	$27	; GAME
	DB	$21
	DB	$2D
	DB	$25
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$08	; (C)
	DB	$23
	DB	$09
	DB	$11	; 1983
	DB	$19
	DB	$18
	DB	$13
	DB	$00
	DB	$21	; ATARI
	DB	$34
	DB	$21
	DB	$32
	DB	$29
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$21	; ALL
	DB	$2C
	DB	$2C
	DB	$00
	DB	$32	; RIGHTS
	DB	$29
	DB	$27
	DB	$28
	DB	$34
	DB	$33
	DB	$00
	DB	$32	; RESERVED
	DB	$25
	DB	$33
	DB	$25
	DB	$32
	DB	$36
	DB	$25
	DB	$24
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

LAAD0	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$30	; PRESS
	DB	$32
	DB	$25
	DB	$33
	DB	$33
	DB	$00
	DB	$02	; "1"
	DB	$11
	DB	$02
	DB	$00
	DB	$26	; FOR
	DB	$2F
	DB	$32
	DB	$00
	DB	$2F	; ONE
	DB	$2E
	DB	$25
	DB	$00
	DB	$30	; PLAYER
	DB	$2C
	DB	$21
	DB	$39
	DB	$25
	DB	$32
	DB	$00
	DB	$27	; GAME
	DB	$21
	DB	$2D
	DB	$25
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$08	; (C)
	DB	$23
	DB	$09
	DB	$11	; 1983
	DB	$19
	DB	$18
	DB	$13
	DB	$00
	DB	$21	; ATARI
	DB	$34
	DB	$21
	DB	$32
	DB	$29
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$21	 ; ALL
	DB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$07
	DB	$60
	DB	$71
	DB	$60
	DB	$19
	DB	$40
	DB	$0F
	DB	$00
	DB	$07
LABA0	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$02
	DB	$20
	DB	$45
	DB	$51
	DB	$68
	DB	$0B
	DB	$70
	DB	$07
	DB	$56
	DB	$35
	DB	$68
	DB	$4B
LABB0	DB	$46
	DB	$31
	DB	$29
	DB	$4A
	DB	$28
	DB	$4A
	DB	$24
	DB	$4A
	DB	$28
	DB	$4A
	DB	$29
	DB	$4A
	DB	$46
	DB	$31
	DB	$00
	DB	$00
LABC0	DB	$46
	DB	$31
	DB	$29
	DB	$4A
	DB	$21
	DB	$4A
	DB	$27
	DB	$4A
	DB	$29
	DB	$4A
	DB	$29
	DB	$4A
	DB	$46
	DB	$31
	DB	$00
	DB	$00
LABD0	DB	$46
	DB	$31
	DB	$29
	DB	$4A
	DB	$29
	DB	$4A
	DB	$2E
	DB	$4A
	DB	$28
	DB	$4A
	DB	$24
	DB	$4A
	DB	$43
	DB	$31
	DB	$00
	DB	$00
LABE0	DB	$20
	DB	$00
	DB	$70
	DB	$00
	DB	$2C
	DB	$03
	DB	$7E
	DB	$07
	DB	$04
	DB	$02
	DB	$78
	DB	$01
	DB	$78
	DB	$01
	DB	$20
	DB	$00
LABF0	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
LAC00	DB	$06
	DB	$30
	DB	$09
	DB	$48
	DB	$10
	DB	$04
	DB	$52
	DB	$25
	DB	$65
	DB	$53
	DB	$74
	DB	$17
	DB	$58
	DB	$0D
	DB	$60
	DB	$03
LAC10	DB	$7C
	DB	$00
	DB	$7E
	DB	$01
	DB	$7B
	DB	$03
	DB	$5F
	DB	$03
	DB	$22
	DB	$01
	DB	$24
	DB	$01
	DB	$48
	DB	$02
	DB	$00
	DB	$00
LAC20	DB	$2F
	DB	$2E
	DB	$25
	DB	$00
	DB	$30
	DB	$2C
	DB	$21
	DB	$39
	DB	$25
	DB	$32
	DB	$00
	DB	$27
	DB	$21
	DB	$2D
	DB	$25
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$32
	DB	$25
	DB	$34
	DB	$35
	DB	$32
	DB	$2E
	DB	$00
	DB	$34
	DB	$2F
	DB	$00
	DB	$30
	DB	$2C
	DB	$21
	DB	$39
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

LAC50	DB	$34	; TWO
	DB	$37
	DB	$2F
	DB	$00
	DB	$30	; PLAYER
	DB	$2C
	DB	$21
	DB	$39
	DB	$25
	DB	$32
	DB	$00
	DB	$27	; GAME
	DB	$21
	DB	$2D
	DB	$25
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$32	; RETURN
	DB	$25
	DB	$34
	DB	$35
	DB	$32
	DB	$2E
	DB	$00
	DB	$34	; TO
	DB	$2F
	DB	$00
	DB	$30	; PLAYER
	DB	$2C
	DB	$21
	DB	$39
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

LAC80	DB	$00
	DB	$00
	DB	$27	; GAME
	DB	$21
	DB	$2D
	DB	$25
	DB	$00
	DB	$2F	; OVER
	DB	$35
	DB	$25
	DB	$32
	DB	$00
	DB	$00
	DB	$00
	DB	$00
	DB	$00

LAC90	LDA	$58
	PHA
	LDA	$58+1
	PHA
	LDA	#<HGR1	; LOGO
	STA	$58
	LDA	#>HGR1	; LOGO
	STA	$58+1
	LDX	#$40
	LDY	#$00
	TYA
LACA3	STA	($58),Y
	INY
	BNE	LACA3
	INC	$58+1
	DEX
	BNE	LACA3
	PLA
	STA	$58+1
	PLA
	STA	$58
	RTS

LACB4	LDA	TXTPAGE2
	LDA	#<HGR1	; LOGO
	STA	$02
	STA	$04
	LDA	#>HGR1	; LOGO
	STA	$02+1
	LDA	#>HGR2	; LOGO
	STA	$04+1
	LDX	#$20
	LDY	#$00
LACC9	LDA	($04),Y
	STA	($02),Y
	INY
	BNE	LACC9
	INC	$02+1
	INC	$04+1
	DEX
	BNE	LACC9
	LDA	TXTPAGE1
	RTS
	RTS

LACDC	LDA	$08
	PHA
	TXA
	PHA
	TYA
	PHA
	LDA	#$00
	STA	$07
	LDX	$06
	LDA	L8F00,X
	SEC
	SBC	#$26
	ASL
	STA	$06
	ROL	$07
	LDA	$08
	SEC
	SBC	#$20
	STA	$08
	LDA	$07
	BEQ	LAD0B
	LDY	$06
	LDA	L9D80,Y
	STA	$14
	LDA	L9FC0,Y
	BPL	LAD15
LAD0B	LDY	$06
	LDA	L9C80,Y
	STA	$14
	LDA	L9EC0,Y
LAD15	CLC
	ADC	#>L8000	; LOGO
	STA	LAD58+2
	STA	LAD5F+2
	LDA	$13
	ASL
	TAY
	LDA	LADB5,Y
	STA	LAD52+1
	LDA	LADB5+1,Y
	STA	LAD52+2
	LDA	#$08
	STA	$17
	LDA	$15
	BEQ	LAD89
	LDA	#$00
	STA	$16
LAD3A	LDY	$08
	LDA	L9B00,Y
	STA	$02
	LDA	L9BC0,Y
	STA	$02+1
	LDA	#$02
	STA	$1A
	LDA	#$00
	STA	$18
	LDX	$16
	LDY	$14
LAD52	LDA	L6000,X
LAD55	AND	#$7F
	TAX
LAD58	LDA	L6000,X
	ORA	$18
	STA	$19
LAD5F	LDA	L6000+$80,X
	STA	$18
	LDA	($02),Y
	ORA	$19
	STA	($02),Y
	INY
	INC	$16
	LDX	$16
	DEC	$1A
	BMI	LAD7B
	BNE	LAD52
	DEC	$16
	LDA	#$00
	BEQ	LAD55
LAD7B	INC	$08
	DEC	$17
	BNE	LAD3A
	PLA
	TAY
	PLA
	TAX
	PLA
	STA	$08
	RTS

LAD89	LDX	#$03
	LDY	$08
	LDA	L9B00,Y
	STA	$02
	STA	$04
	LDA	L9BC0,Y
	STA	$02+1
	EOR	#$60
	STA	$04+1
	LDY	$14
LAD9F	LDA	($04),Y
	STA	($02),Y
	INY
	DEX
	BNE	LAD9F
	INC	$08
	DEC	$17
	BNE	LAD89
	PLA
	TAY
	PLA
	TAX
	PLA
	STA	$08
	RTS

LADB5	DA	LABE0
	DA	LAB70
	DA	LABA0
	DA	LAB80
	DA	LA970
	DA	LAB90
	DA	LABB0
	DA	LABF0
	DA	LABB0
	DA	LABB0
	DA	LABB0
	DA	LABB0
	DA	LABC0
	DA	LABC0
	DA	LABC0
	DA	LABC0
	DA	LABC0
	DA	LABC0
	DA	LABD0
	DA	LABD0
	DA	LAC00
	DA	LAC10

LADE1	LDA	#<L8000
	STA	$02
	LDA	#<L8080
	STA	$04
	LDA	#>L8000
	STA	$02+1
	STA	$04+1
	LDA	#$01
	STA	$09
LADF3	LDY	#$00
LADF5	TYA
	STA	$06
	LDA	#$00
	STA	$07
	LDX	$09
LADFE	ASL	$06
	ROL	$07
	DEX
	BNE	LADFE
	LSR	$06
	LDA	$06
	STA	($02),Y
	LDA	$07
	STA	($04),Y
	INY
	CPY	#$80
	BNE	LADF5
	INC	$02+1
	INC	$04+1
	INC	$09
	LDA	$09
	CMP	#$09
	BNE	LADF3

	LDA	#<L8F00
	STA	$02
	LDA	#>L8F00	; LOGO
	STA	$02+1
	LDY	#$00
	STY	$09
LAE2C	LDX	#$00
LAE2E	LDA	$09
	STA	($02),Y
	INY
	BEQ	LAE3E
	INX
	CPX	#$07
	BEQ	LAE2C
	INC	$09
	BNE	LAE2E
LAE3E	RTS

	LDA	$BB
	SEC
	SBC	#$10
	STA	$BB
	BCC	LAE4C
	CMP	#$04
	BCS	LAE50
LAE4C	LDA	#$04
	STA	$BB
LAE50	RTS

*-------------------------------
*
* $A0: source pointer
* $A2: dest pointer (storage area)
* $A4: length
* $A5..$A6: offset
*

LAE51	LDA	#>L0800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DA	L0600+$4,X
	STA	$B9
	LDA	L0600,X
	BEQ	LAF58
	JSR	LB335
	LDA	L0600+$9,X
	BEQ	LAF57
	DEC	L0600+$8,X
	BNE	LAF57
	LDA	#$00
	STA	L0600+$D,X
	STA	L0600+$A,X
	STA	L0600+$9,X
	STA	L0600+$7,X
	STA	L0600+$1,X
	STA	L0600,X
	LDA	#$01
	STA	L0600+$2,X
	JMP	LAF58
LAF57	RTS

LAF58	LDA	#$01
	STA	$BA
	STA	$A7
	LDA	L0600+$7,X
	BEQ	LAF66
	JMP	LB24B

LAF66	LDA	L0600+$4,X
	AND	#$01
	BNE	LAF80
	JSR	LB0A0
	INX
	LDA	#$01
	JSR	LB0AB
	BNE	LAF93
	LDX	$B6
	INC	L0600+$3,X
	JMP	LAFF6

LAF80	JSR	LB0A0
	DEX
	LDA	#$02
	JSR	LB0AB
	BNE	LAF93
	LDX	$B6
	DEC	L0600+$3,X
	JMP	LAFF6

LAF93	LDX	$B6
	LDA	L0600+$1,X
	BEQ	LAF9D
	JMP	LAFCE

LAF9D	JSR	LB0A0
	INY
	CPY	$88
	BNE	LAFB5
	LDA	#$01
	LDX	$B6
	STA	L0600+$C,X
	STA	L0600+$B,X
	STA	L0600+$1,X
	JMP	LAFCE

LAFB5	LDA	#$04
	STA	$B1
	JSR	LB795
	BEQ	LAFC6
	LDX	$B6
	INC	L0600+$4,X
	JMP	LB04B

LAFC6	LDX	$B6
	INC	L0600+$4,X
	JMP	LAFF6

LAFCE	JSR	LB0A0
	DEY
	CPY	$87
	BNE	LAFE0
	LDA	#$00
	LDX	$B6
	STA	L0600+$1,X
	JMP	LAF9D

LAFE0	LDA	#$08
	STA	$B1
	JSR	LB795
	BEQ	LAFF1
	LDX	$B6
	DEC	L0600+$4,X
	JMP	LB04B

LAFF1	LDX	$B6
	DEC	L0600+$4,X
LAFF6	JSR	LB335
	LDA	#$00
	STA	$8B
	LDA	$B1
	LDX	$B6
	CPX	#$00
	BEQ	LB008
	CMP	L0600+$6,X
LB008	STA	L0610+$5,X
	BEQ	LB012
	LDA	#$01
	STA	L0600+$2,X
LB012	LDA	L0600+$5,X
	STA	L0600+$6,X
	LDA	L0600+$D,X
	BEQ	LB025
	LDA	#$00
	STA	L0600+$D,X
	JMP	LB027

LB025	LDA	#$20
LB027	LDX	$B8
	LDY	$B9
	JSR	LB3F4
	LDX	$B6
	LDA	L0600+$2,X
	STA	$B0
	LDA	L0600+$4,X
	AND	#$01
	ASL
	ADC	$B0
	ADC	#$6A
	ADC	$B7
	STA	$B0
	JSR	LB0A0
	LDA	$B0
	JMP	LB3F4

LB04B	INC	$8B
	LDA	$8B
	CMP	#$10
	BCS	LB056
	JMP	LAF58

LB056	LDX	$B6
	LDA	$B8
	STA	L0600+$3,X
	LDA	$B9
	STA	L0600+$4,X
	AND	#$01
	BNE	LB083
	JSR	LB0A0
	INX
	JSR	LB795
	LDA	$2F
	CMP	#$40
	BCC	LB080
	CMP	#$44
	BCS	LB080
	LDA	#$01
	STA	$B1
	LDX	$B6
	INC	L0600+$3,X
LB080	JMP	LAFF6

LB083	JSR	LB0A0
	DEX
	JSR	LB795
	LDA	$2F
	CMP	#$40
	BCC	LB09D
	CMP	#$44
	BCS	LB09D
	LDA	#$02
	STA	$B1
	LDX	$B6
	DEC	L0600+$3,X
LB09D	JMP	LAFF6

LB0A0	LDX	$B6
LB0A2	LDA	L0600+$4,X
	TAY
	LDA	L0600+$3,X
	TAX
	RTS

LB0AB	STA	$B1
	SEC
	CPX	#$03
	BCC	LB0DD
	CLC
	CPX	#$26
	BCS	LB0DD
	JSR	LB795
	BEQ	LB0FE
	LDA	$2F
	CMP	#$40
	BCC	LB0FE
	CMP	#$44
	BEQ	LB0FE
	CMP	#$45
	BCC	LB0FB
	CMP	#$49
	BCS	LB0FB
	LDX	$B6
	LDA	#$01
	STA	L0600+$7,X
	STA	L0600+$A,X
	PLA
	PLA
	JMP	LB24B

LB0DD	LDX	$B6
	LDA	L0600+$2,X
	BEQ	LB0FB
	LDA	L0600+$B,X
	BEQ	LB0FB
	LDA	L0600+$C,X
	BEQ	LB0F4
	JSR	LB101
	JMP	LB0FB

LB0F4	LDX	$B6
	LDA	#$01
	STA	L0600+$C,X
LB0FB	LDA	#$01
	RTS

LB0FE	LDA	#$00
	RTS

LB101	LDX	#$00
LB103	LDA	L0600,X
	BEQ	LB110
	LDA	L0600+$9,X
	BNE	LB110
	JMP	LB11F

LB110	TXA
	CLC
	ADC	#$10
	TAX
	CPX	#$C0
	BEQ	LB11C
	JMP	LB103

LB11C	LDX	$B6
	RTS

LB11F	TXA
	LDX	$B6
	LDY	L0600+$4,X
	TAX
	TYA
	STA	L0600+$4,X
	DEC	L0600+$4,X
	AND	#$01
	BEQ	LB13E
	LDA	#$02
	STA	L0600+$3,X
	LDA	#$11
	STA	L0600+$8,X
	JMP	LB148

LB13E	LDA	#$25
	STA	L0600+$3,X
	LDA	#$12
	STA	L0600+$8,X
LB148	LDA	#$01
	STA	L0600+$9,X
	LDA	#$00
	STA	L0600+$C,X
	RTS

LB153	LDX	#$00
LB155	LDA	L0600,X
	BNE	LB168
	LDA	L0600+$3,X
	CMP	$55
	BNE	LB168
	LDA	L0600+$4,X
	CMP	$54
	BEQ	LB176
LB168	TXA
	CLC
	ADC	#$10
	TAX
	CPX	#$C0
	BNE	LB155
	LDA	#$20
	JMP	LB5E8

LB176	STX	$E4
	LDA	L0600+$2,X
	BEQ	LB183
	LDX	#$01
	LDY	#$00
	BEQ	LB187
LB183	LDX	#$00
	LDY	#$10
LB187	LDA	#$13
	STA	$91
	JSR	LBA50
	LDA	#$02
	LDY	#$00
	LDX	#$80
	JSR	LBF80
	LDX	$E4
	LDA	L0600+$3,X
	STA	$9E
	LDA	L0600+$4,X
	STA	$9F
LB1A3	LDA	$9E
	STA	L0600+$E,X
	LDA	$9F
	STA	L0600+$F,X
LB1AD	CPX	#$C0
	BEQ	LB1CE
	TXA
	CLC
	ADC	#$10
	TAX
	LDA	L0600+$3,X
	LDY	$E4
	SEC
	SBC	L0600+$3,Y
	BEQ	LB1A3
	CLC
	ADC	#$01
	BEQ	LB1A3
	SEC
	SBC	#$02
	BEQ	LB1A3
	JMP	LB1AD

LB1CE	LDX	$E4
	LDA	#$01
	STA	L0600,X
	STA	L0600+$2,X
	STA	L0600+$1,X
	STA	L0610+$2,X
	LDA	#$00
	STA	L0600+$D,X
	STA	L0600+$7,X
	LDA	#$20
	JSR	LB5E8
	LDX	$E4
	LDA	L0610+$5,X
	CMP	#$04
	BEQ	LB24A
	LDA	L0600+$3,X
	PHA
	LDA	L0600+$4,X
	TAY
	PLA
	TAX
	TYA
	AND	#$01
	BEQ	LB20D
	DEX
	CPX	#$03
	BCS	LB214
	LDX	#$03
	JMP	LB214

LB20D	INX
	CPX	#$25
	BCC	LB214
	LDX	#$25
LB214	STY	$9B
	STX	$9A
	JSR	LB795
	BEQ	LB241
	LDX	#$00
LB21F	LDA	L0600+$3,X
	CMP	$9A
	BNE	LB235
	LDA	L0600+$4,X
	CMP	$9B
	BNE	LB235
	LDA	#$01
	STA	L0600+$D,X
	JMP	LB24A

LB235	TXA
	CLC
	ADC	#$10
	TAX
	CMP	#$C0
	BCS	LB24A
	JMP	LB21F

LB241	LDY	$9B
	LDX	$9A
	LDA	#$00
	JSR	LB3F4
LB24A	RTS

LB24B	LDX	$B6
	LDA	L0600+$3,X
	CMP	L0600+$E,X
	BNE	LB262
	LDA	L0600+$4,X
	CMP	L0600+$F,X
	BNE	LB262
	LDA	#$00
	STA	L0600+$7,X
LB262	JSR	LB0A0
	INY
	CPY	$88
	BCC	LB27C
LB26A	LDX	$B6
	LDA	#$01
	STA	L0600+$1,X
	LDA	#$00
	STA	L0600+$7,X
	STA	L0600+$A,X
	JMP	LAFCE

LB27C	LDX	$B6
	LDA	L0600+$A,X
	BNE	LB2BA
	LDA	L0600+$4,X
	AND	#$01
	BNE	LB2A2
	JSR	LB0A0
	INX
	LDA	#$01
	JSR	LB0AB
	BNE	LB2BA
	LDX	$B6
	INC	L0600+$3,X
	LDA	#$01
	STA	L0600+$A,X
	JMP	LAFF6

LB2A2	JSR	LB0A0
	DEX
	LDA	#$02
	JSR	LB0AB
	BNE	LB2BA
	LDX	$B6
	DEC	L0600+$3,X
	LDA	#$01
	STA	L0600+$A,X
	JMP	LAFF6

LB2BA	LDA	#$04
	STA	$B1
	JSR	LB0A0
	INY
	CPY	$88
	BCC	LB2C9
	JMP	LB26A

LB2C9	JSR	LB795
	BEQ	LB328
	LDX	$B6
	INC	L0600+$4,X
	INC	$8B
	LDA	$8B
	CMP	#$10
	BCS	LB2DE
	JMP	LB262

LB2DE	LDX	$B6
	LDA	$B8
	STA	L0600+$3,X
	LDA	$B9
	STA	L0600+$4,X
	AND	#$01
	BNE	LB30B
	JSR	LB0A0
	INX
	JSR	LB795
	LDA	$2F
	CMP	#$40
	BCC	LB308
	CMP	#$48
	BCS	LB308
	LDA	#$01
	STA	$B1
	LDX	$B6
	INC	L0600+$3,X
LB308	JMP	LAFF6

LB30B	JSR	LB0A0
	DEX
	JSR	LB795
	LDA	$2F
	CMP	#$40
	BCC	LB325
	CMP	#$44
	BCS	LB325
	LDA	#$02
	STA	$B1
	LDX	$B6
	DEC	L0600+$3,X
LB325	JMP	LAFF6

LB328	LDX	$B6
	INC	L0600+$4,X
	LDA	#$00
	STA	L0600+$A,X
	JMP	LAFF6

LB335	LDX	$B6
	CPX	$AD
	BEQ	LB33E
	JMP	LB3BF

LB33E	DEC	$A8
	BEQ	LB34A
	LDA	$B1
	STA	L0600+$6,X
	JMP	LB3BF

LB34A	LDA	$AD
	CLC
	ADC	#$10
	STA	$AD
	CMP	#$C0
	BNE	LB35C
	LDA	#$00
	STA	$AC
	JMP	LB3BF

LB35C	LDX	$BD
	LDA	$83,X
	BEQ	LB398
	LDA	$01
	BEQ	LB398
	LDX	$B6
	TXA
	LSR
	LSR
	LSR
	LSR
	ADC	#$01
	AND	#$01
	BEQ	LB382
	LDA	#$03
	STA	$A8
	STA	L0610+$4,X
	LDA	#$26
	STA	L0610+$3,X
LB37F	JMP	LB38E

LB382	LDA	#$02
	STA	L0610+$4,X
	LDA	#$03
	STA	$A8
	STA	L0610+$3,X
LB38E	LDA	#$01
	STA	L0610+$2,X
	DEC	$01
	JMP	LB3BF

LB398	LDX	$B6
	LDA	#$02
	STA	$A8
	LDA	$AA
	STA	L0610+$3,X
	LDA	$AB
	STA	L0610+$4,X
	LDA	$B1
	STA	L0600+$6,X
	LDA	$F5
	BNE	LB3BF
	LDY	$BD
	LDA	|$0083,Y
	BEQ	LB3BF
	LDA	#$01
	STA	$F5
	STA	L0610+$2,X
LB3BF	RTS

LB3C0	LDX	#$00
	LDY	#$00
	JSR	LB3D8
	LDA	#$00
	TAY
LB3CA	STA	($64),Y
	INY
	BNE	LB3CA
	INC	$64+1
	LDX	$64+1
	CPX	$6A
	BCC	LB3CA
	RTS

LB3D8	LDA	$58
	STA	$64
	LDA	$58+1
	STA	$64+1
	INY
LB3E1	DEY
	BEQ	LB3F1
	LDA	$64
	CLC
	ADC	#$28
	STA	$64
	BCC	LB3E1
	INC	$64+1
	BCS	LB3E1
LB3F1	TXA
	TAY
	RTS

LB3F4	STA	$2F
	JSR	LB3D8
	LDA	$2F
	BPL	LB400
	SEC
	SBC	#$80
LB400	SEC
	SBC	#$20
	BPL	LB408
	CLC
	ADC	#$60
LB408	STA	($64),Y
	LDX	#$64
	JSR	LBE71
	LDA	$2F
	BPL	LB41F
	CLC
	LDA	($64),Y
	ADC	#$80
	STA	($64),Y
	LDX	#$64
	JSR	LBE71
LB41F	RTS

LB420	LDX	$BD
	JSR	LA980
	LDX	$B2
	CPX	#$3A
	BCS	LB42D
	AND	#$FB
LB42D	CPX	#$C2
	BCC	LB433
	AND	#$F7
LB433	LDX	$B3
	CPX	#$B0
	BCS	LB43B
	AND	#$FE
LB43B	CPX	#$D8
	BCC	LB441
	AND	#$FD
LB441	STA	$B0
	JSR	LB7D1
	JSR	LB7E2
	LDA	#$F7
	JSR	LB7C4
	JSR	LB7E2
	JSR	LB7E8
	LDA	#$F7
	JSR	LB7C4
	INX
	INX
	INX
	LDA	#$FB
	JSR	LB7C4
	INX
	INX
	INX
	JSR	LB7E8
	LDA	#$FB
	JSR	LB7C4
	JSR	LB7E2
	JSR	LB7E8
	LDA	#$FD
	JSR	LB7C4
	INX
	INX
	INX
	INX
	DEY
	LDA	#$FE
	JSR	LB7C4
	JSR	LB7E2
	INX
	DEY
	LDA	#$FE
	JSR	LB7C4
	LDA	$B0
	PHA
	PLA
	STA	$B0
	LDA	$C0
	STA	$06
	LDA	$B3
	STA	$08
	LDA	#$00
	STA	$13
	STA	$15
	JSR	LACDC
	LDA	$B0
	AND	#$01
	BEQ	LB4C4
	DEC	$B3
	DEC	$B3
	LDX	$B3
	LDY	#$09
LB4B0	LDA	L6000+$401,X
	STA	L6000+$400,X
	INX
	DEY
	BNE	LB4B0
	LDA	#$00
	STA	L6000+$2FB,X
	LDA	#$05
	STA	L6000+$2F9,X
LB4C4	LDA	$B0
	AND	#$02
	BEQ	LB4EC
	LDA	$B3
	CMP	#$D8
	BCS	LB4EC
	INC	$B3
	INC	$B3
	LDX	$B3
	LDY	#$09
LB4D8	LDA	L6000+$406,X
	STA	L6000+$407,X
	DEX
	DEY
	BNE	LB4D8
	LDA	#$00
	STA	L6000+$30A,X
	LDA	#$05
	STA	L6000+$30C,X
LB4EC	LDA	$B0
	AND	#$04
	BEQ	LB4F8
	DEC	$B2
	DEC	$B2
	BNE	LB502
LB4F8	LDA	$B0
	AND	#$08
	BEQ	LB512
	INC	$B2
	INC	$B2
LB502	LDX	$B2
	STX	$C0
	INX
	INX
	STX	$C5
	INX
	INX
	STX	$C4
	CMP	#$04
	BEQ	LB4F8
LB512	LDA	$B2
	STA	$06
	LDA	$B3
	STA	$08
	LDA	#$00
	STA	$13
	LDA	#$FF
	STA	$15
	JSR	LACDC
	JSR	LB7EE
	RTS

LB529	LDA	fgINPUT
	BEQ	LB536
	LDA	KBD
	CMP	#$A0
	BEQ	LB542
	BNE	LB591
LB536	LDX	$BD
	LDA	BUTN0
	BMI	LB542
	LDA	BUTN1
	BPL	LB591
LB542	LDX	$B4
	BNE	LB591
	LDA	#$00
	LDX	#$80
	LDY	#$00
	JSR	LBF80
	LDA	#$0B
	STA	$92
	LDX	$B2
	INX
	INX
	INX
	INX
	STX	$C6
	STX	$B5
	LDX	$B3
	DEX
	DEX
	DEX
	DEX
	STX	$F0
LB565	LDA	#$20
	STA	L6000+$300,X
	STA	L6000+$301,X
	STA	L6000+$302,X
	STA	L6000+$303,X
	STA	L6000+$304,X
	STA	L6000+$305,X
	STX	$B4
	STX	$08
	LDY	$C6
	DEY
	DEY
	DEY
	DEY
	STY	$06
	LDA	#$FF
	STA	$15
	LDA	#$04
	STA	$13
	JSR	LACDC
	RTS

LB591	LDY	$B4
	BEQ	LB59E
	JSR	LB59F
	JSR	LB738
	JSR	LB59F
LB59E	RTS

LB59F	LDX	$B5
	LDY	$B4
LB5A3	JSR	LB792
	BEQ	LB5FC
	BCC	LB5BA
	LDX	$B5
	LDY	$B4
	JSR	LB99B
	STX	$55
	STY	$54
	PLA
	PLA
	JMP	LB153

LB5BA	ADC	#$01
LB5BC	CMP	#$04
LB5BE	BEQ	LB5CD
	CMP	#$09
	BEQ	LB5CD
LB5C4	STA	$B0
	PLA
	PLA
	LDA	$B0
	JMP	LB5E8

LB5CD	PLA
	PLA
	LDA	#$20
	JSR	LB5E8
	LDA	#$13
	STA	$91
	LDA	#$05
	LDY	#$00
	LDX	#$80
	JSR	LBF80
	LDX	#$00
	LDY	#$01
	JMP	LBA50

LB5E8	LDX	$B5
	LDY	$B4
	STA	$2F
	JSR	LB99B
	LDA	$2F
	JSR	LB3F4
LB5F6	LDX	$B4
	DEX
	JMP	LB764

LB5FC	LDX	$B5
	LDY	$B4
	JSR	LB99B
	STX	$55
	STY	$54
	LDX	$E5
	LDY	$E6
	JSR	LB7DC
	JSR	LB99B
	CPX	$55
	BNE	LB64E
	CPY	$54
	BNE	LB64E
	PLA
	PLA
	DEC	$82
	B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
	CPX	$F2
	BCC	LB737
	LDX	$F2
	JSR	LB7D6
	CPX	$B5
	BCC	LB737
	PLA
	PLA
	LDA	#$00
	STA	$85
	STA	$95
	LDA	#$13
	STA	$91
	JSR	LBE42
	LDA	#$03
	LDY	#$00
	LDX	#$80
	JSR	LBF80
	LDX	#$10
	LDY	#$00
	JSR	LBA50
	JMP	LB5F6
LB737	RTS

LB738	LDX	$B4
	STX	$08
	LDY	$C6
	DEY
	DEY
	DEY
	DEY
	DEY
	STY	$06
	LDA	#$00
	STA	$15
	LDA	#$04
	STA	$13
	JSR	LACDC
	LDX	$B4
	DEX
	DEX
	DEX
	DEX
	DEX
	DEX
	CPX	#$30
	BCC	LB764
	JSR	LB764
	STX	$B4
	JMP	LB565

LB764	LDA	#$00
	STA	L6000+$301,X
	STA	L6000+$302,X
	STA	L6000+$303,X
	STA	L6000+$304,X
	STA	L6000+$305,X
	STA	L6000+$306,X
	STX	$08
	LDY	$C6
	DEY
	DEY
	DEY
	DEY
	STY	$06
	LDA	#$00
	STA	$15
	LDA	#$04
	STA	$13
	JSR	LACDC
	LDY	#$00
	STY	$B4
	RTS

LB792	JSR	LB99B
LB795	JSR	LB3D8
	LDA	($64),Y
	STA	$2F
	BPL	LB7A1
	SEC
	SBC	#$80
LB7A1	CLC
	ADC	#$20
	CMP	#$60
	BCC	LB7AB
	SEC
	SBC	#$60
LB7AB	PHA
	LDA	$2F
	BPL	LB7B7
	PLA
	CLC
	ADC	#$80
	JMP	LB7B8

LB7B7	PLA
LB7B8	CMP	#$09
	BCC	LB7C0
	CMP	#$20
	SEC
	RTS

LB7C0	CMP	#$20
	CLC
	RTS

LB7C4	STA	$B1
	JSR	LB792
	BCS	LB7D1
	LDA	$B0
	AND	$B1
	STA	$B0
LB7D1	LDX	$B2
	LDY	$B3
	RTS

LB7D6	TXA
	CLC
	ADC	#$07
	TAX
	RTS

LB7DC	TYA
	CLC
	ADC	#$08
	TAY
	RTS

LB7E2	TXA
	CLC
	ADC	#$04
	TAX
	RTS

LB7E8	TYA
	CLC
	ADC	#$05
	TAY
	RTS

LB7EE	JSR	LB7D1
	JSR	LB99B
	STX	$55
	STY	$54
	LDA	#$00
LB7FA	TAX
	LDA	L0600,X
	BNE	LB814
	LDA	L0600+$3,X
	SEC
	SBC	#$01
	CMP	$55
	BNE	LB814
	LDA	L0600+$4,X
	CMP	$54
	BNE	LB814
	JMP	LB888

LB814	TXA
	CLC
	ADC	#$10
	CMP	#$C0
	BCC	LB7FA
	JSR	LB7D1
	JSR	LB99B
	JSR	LB875
	INX
	JSR	LB875
	INY
	JSR	LB875
	INX
	INY
	JSR	LB875
	LDA	$B2
	SEC
	SBC	$EA
	BCS	LB83D
	EOR	#$FF
	ADC	#$01
LB83D	CMP	#$07
	BCS	LB850
	LDA	$B3
	SEC
	SBC	$EB
	BCS	LB84C
	EOR	#$FF
	ADC	#$01
LB84C	CMP	#$08
	BCC	LB888
LB850	LDA	$B2
	SEC
	SBC	$C8
	BCS	LB85B
	EOR	#$FF
	ADC	#$01
LB85B	CMP	#$07
	BCS	LB86E
	LDA	$B3
	SEC
	SBC	$C9
	BCS	LB86A
	EOR	#$FF
	ADC	#$01
LB86A	CMP	#$08
	BCC	LB888
LB86E	LDA	#$00
	STA	$C8
	STA	$C9
	RTS

LB875	CPY	#$18
	BNE	LB87A
	DEY
LB87A	JSR	LB795
	CMP	#$8A
	BCS	LB888
	JSR	LB7D1
	JSR	LB99B
	RTS

LB888	LDA	#$00
	STA	$C8
	STA	$C9
	STA	$EF
	LDA	#$01
	STA	$8C
	PLA
	PLA
	LDA	#$13
	STA	$91
	LDA	#$00
	STA	$A7
	STA	$96
	STA	$95
	STA	$E6
	STA	$D205
	TAX
LB8A8	STA	L6000+$300,X
	STA	L6000+$400,X
	STA	L6000+$500,X
	STA	L6000+$600,X
	STA	L6000+$700,X
	DEX
	BNE	LB8A8
	JSR	LACB4
	LDA	$B2
	LDX	#$04
LB8C1	LDA	$B2
	STA	$CFFF,X
	JSR	LBF1A
	DEX
	BNE	LB8C1
	LDA	#$06
	STA	$B0
	LDA	#$05
	LDX	#$02
	LDY	#$05
	JSR	LBF80
LB8D9	LDY	#$A0
LB8DB	LDX	#$0F
LB8DD	JSR	LBAED
	STA	LABF0,X
	DEX
	BPL	LB8DD
	BIT	KBDSTROBE
	LDA	#$07
	STA	$13
	LDA	$B2
	STA	$06
	LDA	$B3
	STA	$08
	LDA	#$FF
	STA	$15
	JSR	LACDC
	LDA	#$00
	STA	$15
	LDA	$B2
	STA	$06
	LDA	$B3
	STA	$08
	JSR	LACDC
	DEY
	BNE	LB8DB
	DEC	$B0
	BNE	LB8D9
	LDA	#$00
	LDX	#$08
LB916	STA	$CFFF,X
	DEX
	BNE	LB916
LB91C	STX	$B0
	LDA	L0600,X
	BNE	LB92B
	JSR	LB0A2
	LDA	#$20
	JSR	LB3F4
LB92B	LDA	$B0
	CLC
	ADC	#$10
	TAX
	CPX	#$C0
	BNE	LB91C
	LDA	#$06
LB937	JSR	LB98B
	SEC
	SBC	#$01
	BNE	LB937
	LDA	#$00
	LDX	#$03
	LDY	#$16
LB945	STX	$55
	STY	$54
	JSR	LB996
	JSR	LB795
	BCS	LB974
	CMP	#$00
	BEQ	LB974
	JSR	LB996
	LDA	#$00
	JSR	LB3F4
	LDA	#$05
	LDX	#$02
	LDY	#$02
	JSR	LBF80
	LDX	#$00
	LDY	#$05
	LDA	#$13
	STA	$91
	JSR	LBA50
	JSR	LB98B
LB974	JSR	LB996
	DEY
	BNE	LB945
	LDY	#$16
	INX
	CPX	#$26
	BNE	LB945
	LDA	#$00
	STA	$8C
	JSR	LBE42
	JMP	LA21A

LB98B	LDX	#$30
LB98D	LDY	#$00
LB98F	DEY
	BNE	LB98F
	DEX
	BNE	LB98D
	RTS

LB996	LDX	$55
	LDY	$54
	RTS

LB99B	TXA
	SEC
	SBC	#$30
	LSR
	LSR
	TAX
	TYA
	SEC
	SBC	#$20
	LSR
	LSR
	LSR
	TAY
	RTS

LB9AB	LDX	#$00
	LD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LBB54
	JSR	LBB54
	LDA	$E8
	BEQ	LBB51
	JSR	LBB54
	JSR	LBB54
LBB51	JMP	LBBC0

LBB54	INC	$E6
	LDY	#$08
	LDX	$E6
	CPX	#$DA
	BNE	LBB63
	PLA
	PLA
	JMP	LBBE1

LBB63	LDA	L6000+$505,X
	STA	L6000+$506,X
	DEX
	DEY
	BNE	LBB63
	LDX	$E6
	DEX
	STX	$08
	STX	$C9
	LDA	$C1
	SEC
	SBC	#$04
	STA	$06
	STA	$C8
	LDA	#$00
	STA	$15
	LDA	$D1
	EOR	#$01
	STA	$D1
	BNE	LBB8C
	LDA	#$01
	hex     2C
LBB8C	LDA     #$15
	STA	$13
	JSR	LACDC
	LDA	$C1
	SEC
	SBC	#$04
	STA	$06
	LDX	$E6
	STX	$08
	LDA	#$FF
	STA	$15
	JSR	LACDC
	LDX	$E6
	LDA	L6000+$307,X
	AND	#$7F
	STA	L6000+$307,X
	LDA	L6000+$308,X
	ORA	#$80
	STA	L6000+$308,X
	LDA	L6000+$309,X
	ORA	#$80
	STA	L6000+$309,X
	RTS

LBBC0	JSR	LBF1A
	CMP	#$10
	BCC	LBBC8
LBBC7	RTS

LBBC8	LDX	$E5
	LDY	$E6
	JSR	LB792
	BNE	LBBC7
	LDX	$E5
	LDY	$E6
	JSR	LB99B
	CPY	#$15
	BCS	LBBC7
	LDA	#$00
	JMP	LB3F4

LBBE1	LDX	#$00
LBBE3	LDA	L6000+$300,X
	AND	#$7F
	STA	L6000+$300,X
	LDA	#$00
	STA	L6000+$500,X
	DEX
	BNE	LBBE3
	LDA	$C1
	SEC
	SBC	#$04
	STA	$06
	STA	$C8
	LDX	$E6
	DEX
	STX	$C9
	STX	$08
	LDA	#$01
	STA	$13
	LDA	#$00
	STA	$15
	JSR	LACDC
	LDA	#$00
	STA	$C1
	STA	$E6
	STA	$C7
LBC16	LDX	#$08
LBC18	LDA	LA90F,X
	STA	L6000+$52F,X
	DEX
	BNE	LBC18
	RTS

LBC22	LDA	$EF
	B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	RTS

LBD00	LDA	$ED
	EOR	#$01
	STA	$ED
	JMP	LBD55

LBD09	LDX	$EB
	LDY	#$0E
	LDA	#$00
LBD0F	STA	L6000+$600,X
	INX
	DEY
	BNE	LBD0F
	LDA	$EB
	STA	$08
	LDA	$C2
	STA	$06
	LDA	#$02
	STA	$13
	LDA	#$00
	STA	$15
	JSR	LACDC
	RTS

LBD2A	STX	$08
	LDY	#$08
LBD2E	LDA	LA927,Y
	STA	L6000+$600,X
	INX
	DEY
	BNE	LBD2E
	LDX	$EA
	STX	$C2
	STX	$06
	LDA	#$FF
	STA	$15
	LDA	$D0
	EOR	#$01
	STA	$D0
	BNE	LBD4D
	LDA	#$02
	hex     2C
LBD4D   LDA	#$14
	STA	$13
	JSR	LACDC
	RTS

LBD55	JSR	LBF1A
	LDX	#$01
	CMP	#$40
	BCC	LBD5F
	DEX
LBD5F	STX	$EC
	JSR	LBF1A
	AND	#$3F
	TAX
	INX
	INX
	STX	$E9
	RTS

LBD6C	LDX	$EA
	LDY	$EB
	INX
	INX
	JMP	LB99B

LBD75	LDA	$85
	BNE	LBDDD
	LDX	$BD
	LDA	$9C,X
	BEQ	LBD8A
	JSR	LBF1A
	CMP	#$42
	BCC	LBD8A
	CMP	#$44
	BCC	LBD8B
LBD8A	RTS

LBD8B	LDA	#$01
	STA	$85
	JSR	LBF1A
	CLC
	ADC	#$18
	CMP	#$48
	BCC	LBD8B
	CMP	#$79
	BCS	LBD8B
	AND	#$F8
	STA	$F3
	JSR	LBF1A
	BPL	LBDC3
	LDA	#$00
	STA	$F4
	LDA	#$C5
	STA	$F2
	LDX	$F3
	LDY	#$08
LBDB2	LDA	LA91F,Y
	STA	L6000+$700,X
	INX
	DEY
	BNE	LBDB2
	LDA	#$05
	STA	$CF
	JMP	LBDDD

LBDC3	LDA	#$01
	STA	$F4
	LDA	#$34
	STA	$F2
	LDX	$F3
	LDY	#$08
LBDCF	LDA	LA917,Y
	STA	L6000+$700,X
	INX
	DEY
	BNE	LBDCF
	LDA	#$03
	STA	$CF
LBDDD	LDA	$95
	BNE	LBDE5
	LDA	#$14
	STA	$95
LBDE5	LDA	$C3
	STA	$06
	LDA	$F3
	STA	$08
	LDA	#$00
	STA	$15
	JSR	LACDC
	LDA	$F4
	BEQ	LBDFD
	INC	$F2
	JMP	LBDFF

LBDFD	DEC	$F2
LBDFF	LDA	$F2
	CMP	#$34
	BCC	LBE42
	CMP	#$C5
	BCS	LBE42
	STA	$F2
	STA	$C3
	STA	$06
	LDA	$F3
	STA	$08
	LDA	$CF
	STA	$13
	LDA	#$FF
	STA	$15
	JSR	LACDC
	LDY	$F3
	LDX	$F2
	JSR	LB792
	BEQ	LBE41
	LDA	$2F
	CMP	#$40
	BCC	LBE41
	CMP	#$44
	BCS	LBE41
	LDX	$F2
	LDY	$F3
	JSR	LB99B
	LDA	$2F
	ADC	#$C0
	ADC	#$04
	JSR	LB3F4
LBE41	RTS

LBE42	LDX	$F3
	LDY	#$08
LBE46	LDA	#$00
	STA	L6000+$700,X
	INX
	DEY
	BNE	LBE46
	LDX	$F3
	STX	$08
	LDA	$C3
	STA	$06
	LDA	#$03
	STA	$13
	LDA	#$00
	STA	$15
	JSR	LACDC
	LDA	#$00
	STA	$85
	STA	$F4
	STA	$F3
	STA	$F2
	STA	$95
	STA	$C3
	RTS

LBE71	STY	$0F	; save Y
	PHA
	STX	LBE7B+1	; zero page offset
	INX		; +1
	STX	LBE7F+1	; zero page offset +1
LBE7B	LDA	$64
	STA	$11
LBE7F	LDA	$64+1
	CLC
	ADC	#>L8B00	; LOGO
	STA	$11+1
	LDA	#$00
	STA	$09
	LDA	($11),Y
	STA	$06
	LDA	$11+1
	PHA
	CLC
	ADC	#$04	; 8B+4 = 8F
	STA	$11+1
	LDA	($11),Y
	STA	$08
	PLA
	STA	$11+1
	PLA
	PHA
	ASL
	ROL	$09
	ASL
	ROL	$09
	ASL
	ROL	$09
	STA	LBF08+1
	LDA	$09
	CLC
	ADC	#>L9000	; LOGO
	STA	LBF08+2
	PLA
	CMP	#$40	; ALL CHARS
	BCC	LBEED
	CMP	#$45	; GREEN CACTUS
	BCC	LBEE5
	CMP	#$4A	; PINK CACTUS
	BCC	LBEDC
	CMP	#$52	; CENTIPEDE SPRITES
	BCS	LBEED

	LDA	$06
	LSR
	BCC	LBEED
	LDA	LBF08+1
	CLC
	ADC	#<L1560	; LOGO
	STA	LBF08+1
	LDA	LBF08+2
	ADC	#>L1560	; LOGO
	STA	LBF08+2
	BNE	LBEED

LBEDC	LDA	$06
	LSR
	BCC	LBEED
	LDA	#$4A	; LSR
	BNE	LBEEF
LBEE5	LDA	$06
	LSR
	BCC	LBEED
	LDA	#$0A	; ASL
	DB	$2C
LBEED	LDA	#$EA	; NOP
LBEEF	STA	LBF0B
	LDX	#$00
LBEF4	LDY	$08
	LDA	L9B00,Y
	STA	$02
	STA	$04
	LDA	L9BC0,Y
	STA	$02+1
	EOR	#$60
	STA	$04+1
	LDY	$06
LBF08	LDA	$1000,X
LBF0B	LSR
	STA	($02),Y
	STA	($04),Y
	INC	$08
	INX
	CPX	#$08
	BNE	LBEF4
	LDY	$0F	; RESTORE Y
	RTS

LBF1A	INC	$F6
	DEC	$F7
	LDA	$F6
	ROL
	ROL
	ROL
	ROL
	STA	$00
	LDA	$F7
	ROR
	ROR
	ROR
	ROR
	EOR	$00
	ADC	$F7
	ADC	$00
	BCC	LBF36
	DEC	$F7
LBF36	RTS

LBF37	LDA	#$00
	STA	$C8
	STA	$C9
	LDX	#$60
	LDA	#$00
LBF41	STA	$00,X
	INX
	BNE	LBF41
	LDX	#$0F
LBF48	LDA	LBF51,X
	STA	$70,X
	DEX
	BPL	LBF48
	RTS

LBF51	DA	L9B00
	DA	L9BC0
	DA	L9C80
	DA	L9DA0
	DA	L9EC0
	DA	L9D80
	DA	L9EA0
	DA	L9FC0

LBF61	LDA	#$00
	STA	$FA
	STA	$FB
	STA	whichDIR
	STA	$FD
	STA	$D0
	STA	$D1
	RTS

	DB	$58
	DB	$0D
	DB	$03
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