; STELLAR ARENA
; COPYRIGHT 1988
; BY ANALOG COMPUTING
	.OPT	NOLIST
;CAS=$71F
	*=	$4120
;CAS=$7FF
CH	=	$41FF
S	=	$C5
;CAS=$8E7
PCH	=	$42AF
HPO	=	$0600
VPO	=	$0602
APO	=	$0604
HMO	=	$0606
VMO	=	$0608
AMO	=	$060A
HSP	=	$060C
VSP	=	$060E
ASP	=	$0610
XLA	=	$0612
XPL	=	$0616
BPL	=	$0618
XPO	=	$0619
BIT	=	$062B
XSH	=	$063D
BSH	=	$0641
DIR	=	$0645
;BOOT
	.BYTE	0,9,$1F,7,$2C,7
	LDA	#60
	STA	$D302
	CLC
	RTS
	LDA	#<RUN
	STA	10
	LDA	#>RUN
	STA	11
	RTS
;WORD DATA
	.DBYTE	0,$B3,$B4A5,$ACAC,$A1B2,0,$A1B2,$A5AE,$A100,0
	.DBYTE	0,$23,$2F30,$3932,$2927,$2834,$D1,$D9D8,$D300,0
	.DBYTE	0,0,$6A,$6F68,$6E00,$6F72,$7469,$7A00,0,0
TS1	.DBYTE	$68,$6967,$6800,$73,$636F,$7265,$5A10,$1010,$1010,$1000
	.DBYTE	$F0,$ECE1,$F9E5,$F200,$1100,$F0,$ECE1,$F9E5,$F200,$1200
TS2	.DBYTE	$73,$5A10,$1010,$1010,$1000,$73,$5A10,$1010,$1010,$1000
	.DBYTE	$EC,$DA10,$EC,$2100,$F4DA,$1919,$F0,$1200,$ECDA,$1000
;DL#1 C*
	.BYTE	112,112,112,112,112,112,71,$36,$41,112,112,112
	.BYTE	112,70,$4A,$41,112,112,70,$5E,$41,65,$C2,$41
;DL#2 C*
	.BYTE	112,112,112,70,200,$39,6,70,200,$3A,134
	.BYTE	70,0,$39,6,6,6,6,6,6,6,6,6,70,0
	.BYTE	$3A,6,6,6,6,6,6,6,6,6,65,$DA,$41
;CHSET
	.DBYTE	0,0,0,0,0,0,0,0
	.BYTE	255,255,255,255,255,255,255,255
	.BYTE	240,240,240,240,240,240,240,240
	.BYTE	15,15,15,15,15,15,15,15
	.BYTE	3,7,14,28,56,112,224,192
	.BYTE	192,224,112,56,28,14,7,3
	.BYTE	3,12,28,60,124,124,128,128
	.BYTE	192,48,56,60,62,62,1,1
	.BYTE	1,1,62,62,60,56,48,192
	.BYTE	128,128,124,124,60,28,12,3
	.BYTE	128,64,0,0,0,0,0,0
	.BYTE	0,0,32,16,0,0,0,0
	.BYTE	0,0,0,0,8,4,0,0
	.BYTE	0,0,0,0,0,0,2,1
	.BYTE	1,2,0,0,0,0,0,0
	.BYTE	0,0,4,8,0,0,0,0
	.BYTE	0,0,0,0,16,32,0,0
	.BYTE	0,0,0,0,0,0,64,128
	.BYTE	0,85,170,0,85,170,0,0
	.BYTE	66,165,90,60,60,90,165,66
	.BYTE	0,0,24,60,60,24,0,0
	.BYTE	0,0,34,20,0,20,34,0
	.BYTE	0,0,8,8,62,8,8,0
	.BYTE	0,16,36,26,88,36,8,0
	.BYTE	240,96,126,240,240,126,96,240
	.BYTE	15,6,126,15,15,126,6,15
;VC1
VC1	.BYTE	0,0,0,255,1,255,1,0,1,1
	.BYTE	0,1,255,1,255,0,255,255
;VC2
VC2	.BYTE	0,235,236,237,1,21,20,19,255
;DLI#1
DLI1	SEI
	PHA
	TXA
	PHA
	LDA	#$42	;C*
	LDX	#0
	EOR	$4F
	AND	$4E
	STA	$D40A
	STA	$D409
	STX	$D01A
	PLA
	TAX
	PLA
	CLI
	RTI
;VBI
VBI	INC	$B2
	INC	$E5
	INC	$CE
	INC	$CF
	INC	$D4
	INC	$DB
	INC	$E0
	LDX	#7
A1	LDA	705,X
	STA	53267,X
	DEX
	BNE	A1
	LDA	756
	STA	$D409
	LDA	#192
	STA	54286
	LDA	#0
	LDX	#4
E5	CMP	$D6,X
	BEQ	E5+6
	DEC	$D6,X
	DEX
	BNE	E5
	TXA
	LDY	VPO
	DEY
	STA	$3C00,Y
	LDY	VPO+1
	DEY
	STA	$3D00,Y
	LDX	VMO
	LDA	$3B00,X
	AND	#252
	STA	$3B00,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Q	Q5
	LDX	$E4
	CPX	#70
	BCS	Q5
	INX
	INX
	STX	$E4
	STX	$D206
	LDA	#164
	STA	$D207
	LDA	#0
	STA	$E1
	JMP	Q3
Q5	LDA	#1
	STA	$E1
	LDX	$E4
	CPX	#10
	BCC	J3+22
	DEX
	DEX
	STX	$E4
	STX	$D206
	LDA	#164
	STA	$D207
	JMP	Q3
	LDA	#0
	STA	$D207
Q3	LDX	$BE
	CPX	#252
	BCS	J4+5
	CPX	#251
	BEQ	J4
	INX
	STX	$BE
	STX	$D204
	LDA	#168
	STA	$D205
	JMP	J4+5
J4	LDA	#0
	STA	$D205
	LDX	$BF
	CPX	#51
	BEQ	J5+5
	BCS	J5
	INX
	STX	$BF
	STX	$D206
	LDA	#138
	STA	$D207
	JMP	J5+5
J5	LDA	#0
	STA	$D207
	PLA
	TAX
	PLA
	RTI
;JOY
JOY	LDX	#0
	LDY	#9
	CMP	JOD-1,Y
	BEQ	JOY+14
	INX
	INX
	DEY
	BNE	JOY+4
	RTS
;SP CHEC
FA	LDA	53770
	AND	#6
	CMP	#0
	BNE	FA+11
	ORA	#2
	RTS
;LEVEL CHANGE
LEVC	LDX	$B0
	DEX
	LDA	LCT,X
	STA	710
	LDA	ATD,X
	STA	$B7
	LDA	MTD,X
	STA	$B6
	LDA	LPD,X
	STA	$B4
	LDA	XMO,X
	STA	$B5
	TXA
	CLC
	ADC	#33
	STA	$3AE2
	JSR	PUT
	RTS
;CHECK BIT
H3	CPX	#2
	BEQ	H3+10
	LDX	#2
	SEC
	SBC	#200
	RTS
	LDX	#0
	CLC
	ADC	#200
	RTS
;COLORS
CTB	.BYTE	$8C,$5C,$88,$0E,$30
LCT	.BYTE	$88,$8A,$8C,$D8,$DA,$DC,$68,$6A,$6C
	.BYTE	$F8,$FA,$FC,$48,$4A,$4C
;LEVEL DATA
ATD	.DBYTE	$0404,$0405,$0505,$0606,$0607,$0707,$0808,$0800
MTD	.DBYTE	$0A0C,$0E10,$1214,$1618,$1A1C,$1E20,$2224,$2600
LPD	.DBYTE	$2624,$2220,$1E1C,$1A18,$1614,$1210,$0E0C,$0A00
XMO	.DBYTE	$2A28,$2624,$2220,$1E1C,$1A18,$1614,$1210,$0E00
XAL	.BYTE	42,57,157,142
;JOY DATA
JOD	.BYTE	10,11,9,13,5,7,6,14,15
;LAS VECS
LVC	.BYTE	19,237,21,235
LMN	.BYTE	71,72,73,74,133,134,133,134
LSV	.BYTE	21,19,235,237,203,207,206,210
CLS	.BYTE	207,211,207,211,203,207,203,207,206,210,203,207
;SOUND DATA
STB	.BYTE	60,201,252,51
;RUN
RUN	LDA	#$C2
	STA	560
	LDA	#$41	;C*
	STA	561
	LDA	#0
	TAX
	STA	$0600,X
	DEX
	BNE	RUN+13
	STA	20
	STA	19
	LDA	#1
	STA	$B0
	STA	$B1
	STA	$E2
	LDA	#17
	STA	623
	LDA	#56
	STA	54279
	LDA	#3
	STA	53277
	LDA	#62
	STA	559
	LDA	#<DLI1
	STA	512
	LDA	#>DLI1
	STA	513
	LDA	#192
	STA	54286
	LDA	#6
	LDX	#>VBI
	LDY	#<VBI
	JSR	$E45C
	JSR	$E465
	LDA	#38
	STA	$B4
;SET IRQ
	LDA	#0
	STA	$D208
	STA	$D201
	LDA	#200
	STA	$D200
	LDA	#<IRQ
	STA	$0210
	LDA	#>IRQ
	STA	$0211
	LDA	16
	ORA	#1
	STA	16
	STA	$D20E
	LDA	#2
	STA	$DC
	LDX	#4
J6	LDA	STB-1,X
	STA	$BB,X
	DEX
	BNE	J6
A7	LDA	19
	CMP	#1
	BCC	A7
	LDA	#$DA
	STA	560
	LDA	#$41	;C*
	STA	561
;CLEAR
	LDA	#0
	TAX
A6	STA	$0600,X
	STA	$3B00,X
	STA	$3C00,X
	STA	$3D00,X
	STA	$3E00,X
	STA	$3F00,X
	DEX
	BNE	A6
	LDY	54283
	CPY	#$70
	BCC	A6+21
	STA	$3900,X
	STA	$3A00,X
	DEX
	BNE	A6+28
	LDA	#0
	STA	$D205
	STA	$BA
	STA	$BB
	LDA	#3
	STA	$B9
;UPLOAD
	LDX	#40
A8	LDA	TS1-1,X
	STA	$39C7,X
	LDA	TS2-1,X
	STA	$3AC7,X
	DEX
	BNE	A8
	LDA	#16
	STA	$3ADF
	STA	$3AEE
	LDA	$B1
	CLC
	ADC	#16
	STA	$3AEA
;WALLS
	LDX	#10
	LDA	#130
	STA	$3904,X
	STA	$3AB8,X
	DEX
	BNE	A8+35
	LDX	#119
	LDY	#5
	LDA	#132
	STA	$3900,X
	STA	$399C,X
	TXA
	SEC
	SBC	#19
	TAX
	LDA	#131
	STA	$3900,X
	STA	$399C,X
	TXA
	CLC
	ADC	#39
	TAX
	DEY
	BNE	A8+48
	LDY	#5
	LDX	#4
A9	LDA	#133
	STA	$3900,X
	STA	$3A73,X
	LDA	#64
	INX
	STA	$3A73,X
	DEX
	DEX
	STA	$3900,X
	INX
	TXA
	CLC
	ADC	#19
	TAX
	DEY
	BNE	A9
	LDY	#5
	LDX	#15
	LDA	#134
	STA	$3900,X
	STA	$3A55,X
	LDA	#64
	INX
	STA	$3900,X
	DEX
	DEX
	STA	$3A55,X
	INX
	TXA
	CLC
	ADC	#21
	TAX
	DEY
	BNE	A9+32
	LDX	#131
	STX	$3964
	INX
	STX	$3A63
	LDA	#0
	LDX	#16
	STA	CH,X
	DEX
	BNE	A9+73
;COLORS
	LDX	#5
	LDA	CTB-1,X
	STA	707,X
	DEX
	BNE	A9+81
	LDA	#$1E
	STA	706
	STA	707
	LDA	$E2
	STA	$B0
	JSR	LEVC
	LDX	#$39
	STX	S+1
	INX
	STX	S+3
	LDA	$B3
	CMP	#1
	BEQ	START+11
;LOOP
B1	LDA	53279
	STA	53250
	STA	53251
	CMP	#6
	BEQ	START
	CMP	#3
	BEQ	OPT
	CMP	#5
	BEQ	SEL
	JMP	B1
SEL	LDX	$B0
	INX
	CPX	#10
	BCC	C3
	LDX	#1
C3	STX	$B0
	STX	$E2
	STX	77
	JSR	LEVC
	JMP	B2
OPT	LDX	$B1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