;  ROCKS! VERTICAL BLANK
; ROUTINE AND DATA TABLES
;    By: Douglas Engel
;
; OS EQUATES
;
ATRACT	= $4D
AUDC1	= $D201
AUDC2	= $D203
AUDC3	= $D205
AUDC4	= $D207
AUDCTL	= $D208
AUDF1	= $D200
AUDF2	= $D202
AUDF3	= $D204
AUDF4	= $D206
CH	= $02FC
HITCLR	= $D01E
HPOSP0	= $D000
HPOSP1	= $D001
HPOSP2	= $D002
HPOSP3	= $D003
HPOSM0	= $D004
M2PF	= $D002
M2PL	= $D00A
P0PF	= $D004
P0PL	= $D00C
P1PF	= $D005
P1PL	= $D00D
P3PL	= $D00F
PCOLR0	= $02C0
PRIOR	= $D01B
RANDOM	= $D20A
RUNAD	= $02E0
SIZEP0	= $D008
STICK0	= $0278
STRIG0	= $0284
XITVBV	= $E462
;
;COMMON LABELS AND VARIABLES
;SEE PART 1 FOR DESCRIPTIONS
;
ACCOUNT	= $5000
ALT	= $5001
ANIMATE	= $5002
ANIPTR	= $5003
BEAMDLAY	= $5004
BEAMFLG	= $5005
BEAMOFF	= $2555
BEAMPOS	= $5006
BLEEP	= $5007
BLINK	= $5008
BLINK1	= $5009
BURN	= $2485
BURN1	= $249F
CLRME	= $241F
COMPLETED	= $500A
COWNTER	= $500B
CSAT	= $2506
DIGIT	= $500C
DLPRINT	= $24F7
DOOM	= $500D
EMPTY	= $500E
ENDCNTR	= $500F
ETC.	= $5010
EXPLOSION	= $5011
FD	= $5012
FLAGS	= $258F
FLASHME	= $5013
FLIP	= $5014
FUEL	= $5015
FUELMTR	= $5016
FUELUSE	= $5017
GETLEV	= $254F
GRAVITY	= $5018
G.O	= $5019
HOLDA	= $501A
HOLDX	= $501B
HPOSME	= $501C
HPOSSAT	= $501D
INITP	= $242B
KONSOL	= $501E
LANDFLAG	= $501F
LINENO	= $CA
LOADED	= $5020
MATH	= $23F6
MIRROR	= $252E
MIXUP	= $2434
MISS	= $5021
MISSLES	= PMTABL+768
MULTIPLY	= $5022
MYRNA	= $2523
NEWLEV	= $5023
NEWSC	= $5024
OLDC	= $2439
PAUSED	= $5025
PLAYER0	= PMTABL+1024
PLAYER1	= PMTABL+1280
PMSATS	= PMTABL+1918
PMTABL	= $5000
PMZAP	= PMSATS-180
POWNTER	= $5026
PUT	= $248A
R01	= $257D
R07	= $2583
R16	= $2589
RADCOUNT	= $5027
RADS	= $5028
RADSMTR	= $5029
RAND1	= $502A
RESETFLAG	= $502B
ROAR	= $502C
SAT?	= $502D
SATCNT	= $502E
SATCNT1	= $502F
SATCOLR	= $5030
SATDIR	= $5031
SATEXP	= $5032
SATFRAME	= $5033
SATSPD	= $5034
SHAPEA	= $E0
SHAPEB	= $E2
SHOW	= $24B3
SILENT	= $2544
SKY	= $5035
STARCNT	= $5036
START	= $2000
STROBE	= $5037
SUPER	= $5038
UNPRESS	= $210F
VELOCITY	= $503B
VOL	= $503C
VOL4	= $503D
VPOSME	= $503E
WAITCNTR	= $503F
WAITING	= $5040
ZAPCNT	= $5041
ZAPFLAG	= $5042
;
	*= $261E 	;Byte after Part 1
;
; VERTICAL BLANK ROUTINE
;
VBLANK	LDA RESETFLAG 	;Skip most during reset
	BEQ READY
	JMP TESTCH
READY	LDA #$00
	STA LINENO 	;Point to !st line
	STA FD 	;Clear
	LDA PAUSED 	;Skip most if paused
	BEQ FIN?
	JMP TESTCH
FIN?	LDA G.O 	;Skip ahead if not over
	BEQ DOOMSDAY
	LDA STRIG0 	;Trigger restarts
	BNE BUSY
	PLA  	;This breaks out of routine,
	PLA  	; so, pull ret. addr.
	JMP UNPRESS 	; and jump back
BUSY	JMP CLRCH
;
; Planet destruction routine
;
DOOMSDAY	LDA DOOM 	;Test for doom
	BNE QW
	JMP MOVEMENT 	;No, skip this
QW	INC ENDCNTR 	;Count
	LDA ENDCNTR 	;Test and branch to
	CMP #$38 	; appropriate part of explosion
	BCC PY0
	CMP #$E0 	;Maximum val?
	BCC PY1 	;No, skip
	LDX #$12 	;Set game over flags
	STX G.O
	JSR DLPRINT 	;Print message
	JSR SILENT 	;Sound off
	JMP TESTCH 	;Skip rest
PY0	LDX #$03 	;0 all HPOS regs.
	JSR INITP
	LDX #$0C 	;Increment sky colors
G	LDA ACOLTAB+96,X
	CLC 
	ADC #$01
	AND #$0F 	;Make them only blue
	ORA #$70
	STA ACOLTAB+96,X
	STA DCOLTAB+96,X
	STA AUDF1 	;Use val for sounds
	ADC #$20
	STA AUDF2
	LDA #$CF 	;Set audio control
	STA AUDC1
	STA AUDC2
	INX 
	CPX #$13 	;Do all sky lines
	BNE G
	JMP TESTCH
PY1	LDX #$77 	;Flash all colors
G1	LDA RAND1 	;Random mask
	AND #$0F 	;Only intensity bits
	EOR ACOLTAB,X
	STA ACOLTAB,X
	STA DCOLTAB,X
	LDA #$0F 	;Audio controls
	STA AUDC1
	STA AUDC2
	LDA #$8F
	STA AUDC3
	STA AUDC4
	LDA ENDCNTR 	;Use counter for freq.
	STA AUDF1
	ASL A 	;Freq *2
	STA AUDF2
	ASL A 	;Freq *2
	STA AUDF3
	EOR #$FF 	;Inverse
	STA AUDF4 	;Use as freq.
	DEX 
	BPL G1 	;Do all colors
	JMP TESTCH 	;Skip ahead
;
; Scrolling routine
;
MOVEMENT	LDX #$17 	;Scrolling 24 lines
SCROLL	LDA SCRLST,X 	;Direction
	BEQ NXTLIN 	;0?, don't
	LDA COUNT,X 	;Speed counter
	CMP LIMIT,X 	;Is it max?
	BCC INCCNT 	;No, skip
	LDA #$00
	STA COUNT,X 	;0 count
	LDA SCRLST,X 	;Check dir.
	CMP #$02
	BEQ RIGHT
LEFT	LDA #$03 	;Find #of color clocks
	SEC 
	SBC COLCKS,X
	STA CURR,X 	;Put in table
	INC COLCKS,X
	LDA COLCKS,X 	;See if too many
	CMP #$04
	BNE NXTLIN
	STA CURR,X 	;Reset table
	LDA #$00
	STA COLCKS,X
	STX HOLDX
	LDA POINTR,X 	;Find DL byte to change
	TAX 
	INC DLIST,X 	;Change
	LDX HOLDX
	JMP NXTLIN 	;Next line
RIGHT	INC COLCKS,X 	;Next color clock
	LDA COLCKS,X 	;Update table
	STA CURR,X
	CMP #$04 	;See if too many
	BNE NXTLIN
	LDA #$00 	;Reset table
	STA CURR,X
	STA COLCKS,X
	STX HOLDX
	LDA POINTR,X 	;DL byte to alter
	TAX 
	DEC DLIST,X 	;Alter
	LDX HOLDX
	JMP NXTLIN 	;Next
INCCNT	INC COUNT,X 	;Inc. counter
NXTLIN	DEX  	;Do rest of lines
	BPL SCROLL
SKYLON	INC STARCNT 	;Star counter
	LDA STARCNT 	;Test max.
	CMP #$80
	BNE FLASH 	;Not yet, skip
	LDX #$0A
TIME	DEC MPOS,X 	;Change star pos.
	DEX 
	BPL TIME 	;Do all lines
	INX 
	STX STARCNT
;
; Light flashing routines
;
FLASH	INC STROBE 	;Light counter
	LDA STROBE
	CMP #$1C 	;Branch at each of these
	BEQ YES1
	CMP #$1E
	BEQ NO1
	CMP #$3A
	BEQ YES
	CMP #$3C
	BEQ NO
	BNE RUNING 	;None of them, skip
YES1	LDA #$0D 	;On, alter char
	STA CHARS+641
	BNE MOVEME
NO1	LDA #$05 	;Off alter char
	STA CHARS+641
	BNE MOVEME
YES	LDA #$0D 	;On, alter these
	STA CHARS+646
	LDA #$B8
	STA CHARS+677
	BNE MOVEME
NO	LDA #$05 	;Off, alter these
	STA CHARS+646
	LDA #$A8
	STA CHARS+677
	LDA #$00
	STA STROBE
RUNING	INC BLINK 	;Other light counter
	LDA BLINK 	;Branch at right vals.
	CMP #$28
	BEQ OFF
	CMP #$3C
	BEQ ON
	BNE BASE
OFF	LDA #$02 	;Off, dark color
	STA DCOLTAB+49
	STA DCOLTAB+50
	BNE MOVEME
ON	LDA #$28 	;On, light color
	STA DCOLTAB+49
	STA DCOLTAB+50
	LDA #$00
	STA BLINK 	;Clear count
BASE	INC BLINK1 	;Base light counter
	LDA BLINK1 	;Branch at these
	CMP #$38
	BEQ DARK
	CMP #$48
	BEQ LIGHT
	BNE MOVEME
DARK	LDA #$7F 	;Off, alter chars
	STA CHARS+1012
	LDA #$F7
	STA CHARS+970
	STA CHARS+974
	BNE MOVEME
LIGHT	LDA #$3F 	;On, alter chars
	STA CHARS+1012
	LDA #$F3
	STA CHARS+970
	STA CHARS+974
	LDA #$00
	STA BLINK1
;
; Movement within atmosphere routine
;
MOVEME	LDA EXPLOSION 	;Skip if exploding
	BEQ LUKE
	JMP SPOCK
LUKE	LDA LANDFLAG 	;Skip if landed
	BNE LANDED
	LDA VPOSME 	;Ground level?
	CMP #$C0
	BNE ABOVE
	JMP GROUND
ABOVE	CMP SKY 	;In space?
	BCS RISING
	JMP SPACE
RISING	INC GRAVITY 	;Inc. count
	LDA GRAVITY
	CMP #$0A 	;Max val?
	BNE FALL
	LDA #$00 	;Yes, clear
	STA GRAVITY
	LDA EMPTY 	;No fuel, no stick
	BEQ JOY1
	LDA #$FF
	BNE NOJOY1 	;Always
JOY1	LDA STICK0
NOJOY1	EOR FLIP 	;Change stick for
	AND #$01 	;Up or down accel.
	BNE DECEL
ACCEL	DEC VELOCITY 	;Move faster
	BNE FALL 	;Can't be <1
	LDA #$01
	STA VELOCITY
	BNE FALL 	;Always
DECEL	INC VELOCITY 	;Move slower
	LDA VELOCITY
	CMP #$10
	BNE FALL 	;At this slow we are
	LDA #$0F 	; reversing direction
	STA VELOCITY
	LDA FLIP
	EOR #$01 	;Flip to reverse dir.
	STA FLIP
FALL	LDA VELOCITY 	;Counter
	INC ACCOUNT
	CMP ACCOUNT
	BEQ OOOOOH
	BCS JUMPIT
OOOOOH	LDA #$00 	;Clear them
	STA ACCOUNT
	LDA FLIP 	;See if going up or down
	BEQ DECRE
INCRE	INC VPOSME 	;Move down and jump
JUMPIT	JMP SLEFT
DECRE	DEC VPOSME 	;Move up and jump
	JMP SLEFT
;
; Landing routines
;
LANDED	LDA LOADED 	;Landed? Then skip
	BNE BLASTOFF
	INC ANIMATE 	;Count
	BNE NOSTK 	;Not max
	LDA #$FF 	;Reset count
	STA ANIMATE
	LDA STICK0 	;Wait for stick
	AND #$01
	BEQ BLASTOFF
	JMP PRINT
BLASTOFF	LDA #$0E 	;Set vel.
	STA VELOCITY
	STA LOADED 	;All loaded
	JSR FLAGS 	;Clear land flags
	STA FLIP
NOSTK	LDX ANIPTR 	;Find frame val
	LDA ANITAB,X 	;There yet?
	CMP ANIMATE
	BEQ NEWFRAME 	;Yes
	JMP PRINT
NEWFRAME	LDA NOIZE,X 	;Get sound vals
	STA AUDC1
	LDA FREQ,X
	STA AUDF1
	CLC 
	LDA SHAPEA 	;Point to next frame
	ADC #$18
	STA SHAPEA 	;Player0
	LDA #$00 	;+ carry
	ADC SHAPEA+1
	STA SHAPEA+1
	CLC 
	LDA SHAPEB 	;Same, player1
	ADC #$18
	STA SHAPEB
	LDA #$00
	ADC SHAPEB+1
	STA SHAPEB+1
	INC ANIPTR 	;Counter
	JMP PRINT
GROUND	LDA FLIP 	;Up, or down motion?
	BNE FALLING
	JMP RISING
FALLING	LDA VELOCITY 	;Too fast, we crash
	CMP #$0B
	BCC CRASHED
	LDA LOADED 	;Crash if loaded
	BNE CRASHED
	LDA HPOSME 	;Not on pad, crash
	CMP #$81
	BCS CRASHED
	LDA #$7C
	CMP HPOSME
	BCS CRASHED
	LDA #$06 	;Landed! set flags
	STA DIGIT
	STA LANDFLAG
	JSR GETLEV 	;Give score
	STA MULTIPLY
	INC MULTIPLY
	JSR MATH
	JMP PRINT
CRASHED	INC EXPLOSION 	;Flag <> 0
	JMP PRINT
;
; Movement in space routine
;
SPACE	LDA #$01 	;In space? reset Vars.
	STA FLIP
	LDA #$08
	STA VELOCITY
;
;Test joystick for movement in space
;
SUP	LDA EMPTY 	;No fuel, no stick
	BNE CCC
	LDA STICK0 	;Up?
	AND #$01
	BEQ MUP
SDOWN	LDA STICK0 	;Down?
	AND #$02
	BEQ MDOWN
SLEFT	LDA EMPTY 	;Out of fuel?
	BNE CCC
	LDA STICK0 	;Left?
	AND #$04
	BEQ MLEFT
SRIGHT	LDA STICK0 	;Right
	AND #$08
	BEQ MRIGHT
CCC	JMP PRINT 	;No stick, skip
MUP	DEC VPOSME 	;Up.
	JMP SLEFT 	;Test for sideways
MDOWN	INC VPOSME 	;Down
	JMP SLEFT 	;Test for sideways
MLEFT	DEC HPOSME 	;Left
	LDA #$01 	;Flame direction flag
	STA FD
	BNE PRINT
MRIGHT	INC HPOSME 	;Right.
	LDA #$02
	STA FD
	BNE PRINT
PRINT	LDA VPOSME 	;Test screen bounds
	CMP #$25
	BCS TESTL
	LDA #$25
	STA VPOSME
TESTL	LDA HPOSME
	CMP #$26
	BCS TESTR
	LDA #$26
	STA HPOSME
TESTR	LDA #$D1
	CMP HPOSME
	BCS DISPLAY
	LDA #$D1
	STA HPOSME
DISPLAY	JSR SHOW 	;Now we can show ship
;
; Sattelite creation routine
;
SPOCK	LDA SAT? 	;Move sat?
	BNE SATMOV
	INC SATCNT 	;Delay between sats
	BEQ T1
	JMP NODIFF
T1	JSR R01 	;Random #
	BEQ T2 	;No sat this time
	JMP NODIFF
T2	JSR R01 	;Dir to move
	BEQ MINMAY
	LDA #$01 	;Right
	STA SATDIR
	BNE SDF1
MINMAY	LDA #$FE 	;Left
	STA SATDIR
SDF1	JSR R07 	;Speed
	BEQ SDF1 	;<> 0
	STA SATSPD
	LDA RANDOM 	;Color
	ORA #$08
	STA SATCOLR
	JSR R16 	;Random sat
	CMP TOTAL 	;Based on complete levels
	BCS THAT
	BCC THIS
THAT	LDA TOTAL 	;Use this for sat
THIS	ASL A 	;Otherwise Random
	ASL A
	ASL A
	TAX 
	LDY #$00
SATLP	LDA ASATS,X 	;Move shape to PM
	STA PMSATS,Y
	INX 
	INY 
	CPY #$08
	BNE SATLP
	LDA #$00 	;Set flags and counters
	STA SATCNT1
	STA BLEEP
	STA VOL
	LDA #$FF
	STA SAT?
	JSR R07 	;Is sat super
	BNE WIMPY 	;No, skip
	LDA #$FF
	STA SUPER
	BNE SATMOV 	;Always
WIMPY	LDA #$00 	;Not super
	STA SUPER
;
; Sattelite movement
;
SATMOV	INC SATCNT1 	;Count to speed
	LDA SATCNT1
	CMP SATSPD
	BNE NODIFF
	LDA SATEXP 	;Exploding? skip
	BNE NSO
	LDA HPOSSAT 	;Sound for sat
	SEC 
	SBC #$80 	;Louder at mid screen
	BPL DIV
	EOR #$FF
	CLC 
	ADC #$01
DIV	STA VOL 	;save
	LDA #$FF 	;Sub, since higher # is louder
	SEC 
	SBC VOL
	LSR A 	;Div to get ony vol bits
	LSR A
	LSR A
	LSR A
	LSR A
	STA VOL
	INC BLEEP 	;Beep count
	LDA BLEEP
	CMP #$0B 	;Beep between $0B & $0C
	BCC NBL
	CMP #$0C
	BCC YBL
	LDA #$00
	STA BLEEP 	;Clear
	BEQ NSO 	; Always
YBL	LDA #$A0 	;Beep sound
	ORA VOL
	STA AUDC2
	LDA #$10
	STA AUDF2
	BNE NSO 	;Always
NBL	LDA VOL 	;Rocket sound
	LSR A
	ORA #$80
	STA AUDC2
	LDA #$10
	STA AUDF2
NSO	LDA #$00
	STA SATCNT1 	;Clear
	LDA HPOSSAT
	CLC 
	ADC SATDIR 	;Move
	STA HPOSSAT
	STA HPOSP3
	BNE NODIFF 	;All the way across?
	LDA #$00
	STA SAT? 	;Reset
	STA AUDC2
NODIFF	LDA SUPER 	;Super?
	BEQ WIERD 	;No skip
	INC SATCOLR 	;Flash color
;
; Fuel and radiation routines
;
WIERD	INC RADCOUNT 	;Counter
	LDA RADCOUNT
	CMP #$38 	;Max?
	BNE THESAME
	LDA #$00
	STA RADCOUNT 	;Clear
	INC RADS 	;More rads
	LDA RADS
	CMP #$FF 	;Too many?
	BNE THESAME
	STA DOOM 	;End of planet?
THESAME	LDA RADS 	;Enough rads to zap?
	CMP #$80
	BCC TWOMUCH
	LDA ZAPFLAG 	;Zap in progress?
	BNE TWOMUCH
	JSR R01 	;Randomly zap
	ORA RAND1
	BNE TWOMUCH
RPO	LDA RANDOM 	;Get random spot
	CMP #$26 	;Within bounds?
	BCS R.T
	BCC RPO
R.T	CMP #$D1
	BCC BATMAN
	BCS RPO
BATMAN	STA HPOSP2 	;Use this pos.
	LDA #$FF
	STA ZAPFLAG 	;Do zap
TWOMUCH	LDA LANDFLAG 	;Landed? skip
	BNE GUAGES
	INC FUELUSE 	;Use fuel
	LDA FUELUSE
	CMP #$71 	;Limit?
	BCC GUAGES
	LDA #$00
	STA FUELUSE 	;Clear
	DEC FUEL 	;Move needle
	BNE GUAGES 	;Fuel left? skip
	STA AUDC1 	;No sound
	LDA #$FF
	STA EMPTY 	;Flag empty
;
; Display guages routine
;
GUAGES	LDA DOOM 	;Test doom
	BEQ R
	LDA RADSMTR 	;Pin the needle
	CLC 
	ADC #$20
	STA HPOSM0 	;Show needle
	JMP BANGTEST
R	LDA RADS 	;Divide to get needle val
	LSR A
	LSR A
	LSR A
	CLC 
	ADC RADSMTR 	;+ offset
	STA HPOSM0
TANK	LDA EMPTY 	;Empty?
	BEQ F
	LDX FUELMTR 	;Zero needle
	DEX 
	STX HPOSM0+1 	;Show needle
	LDA #$00 	;Raise sky so ship falls
	STA SKY
	BEQ N
F	LDA FUEL 	;Div. to get needle val
	LSR A
	LSR A
	LSR A
	CLC 
	ADC FUELMTR 	;Add offset
	STA HPOSM0+1
;
; Transporter routine
;
N	LDA LANDFLAG 	;Landed? skip
	BNE XPORTER
BUTTON	LDA LOADED 	;Not loaded? skip
	BEQ XPORTER
	LDA EXPLOSION 	;Exploding? skip
	BNE XPORTER
	LDA STRIG0 	;No button? skip
	BNE XPORTER
	LDA #$FF
	STA BEAMFLG 	;Flag beam
XPORTER	LDA BEAMFLG 	;Beaming in progress?
	BNE ALREADY
	JMP HITME
ALREADY	INC BEAMDLAY 	;Delay
	LDA BEAMDLAY
	CMP #$01 	;Only 1/60 sec
	BEQ PSPS
	JMP NOACTION
PSPS	LDA #$00
	STA BEAMDLAY 	;Clear
	LDA M2PL 	;Hit a sat?
	AND #$08
	BEQ SORRY 	;No, skip
	INC SATEXP 	;Flag <>0
	LDA #$05 	;Give points
	STA DIGIT
	LDA SUPER
	BEQ ASDFG
	DEC DIGIT
ASDFG	JSR GETLEV 	;Based on level
	STA MULTIPLY
	INC MULTIPLY
	JSR MATH
	JMP NOTSHIP
JMPTAB	JMP EXTEND 	;Jump table
SORRY	LDA VPOSME
	CMP #$88 	;If this low, it hit a mountain
	BCS JMPTAB
	LDA M2PF 	;Hit anything?
	BEQ JMPTAB
	LDA MISS 	;Was a hit on line 2?
	BEQ NOTSHIP
	LDA #$05 	;If it gets here it hit fleet
	STA DIGIT 	; so give score
	LDA #$01
	STA ETC.
	LDA #$36
	STA VOL4
	JSR GETLEV 	;Based on level
	STA MULTIPLY
	INC MULTIPLY
	JSR MATH
	LDA RADS 	;And decrease rads
	CLC 
	ADC #$E0
	STA RADS
	BCS MISFITS 	;Can't be <0
	LDA #$00
	STA RADS 	;So, make it 0
MISFITS	DEC CANISTERS 	;1 less can.
	LDA CANISTERS 	;All gone?
	CMP #$10
	BNE NOTSHIP
	LDA SHIPS 	;Level done, so give ship
	CMP #$19 	;But no more than 9
	BEQ ENUF
	INC SHIPS
ENUF	LDA LEVEL 	;Next level
	CMP #$19 	;No more than 9
	BEQ CMPL
	INC LEVEL
CMPL	LDA TOTAL 	;Inc total levels
	CMP #$0F 	;Not more than 15
	BEQ ZYX
	INC TOTAL
ZYX	LDX PAINT 	;Next planet color
	INX 
	CPX #$1A 	;Wrap at 10
	BNE XYZ
	LDX #$10
XYZ	STX PAINT
	JSR SILENT 	;No sound
	STA WAITING 	;Message delay on
	LDA #$78
	STA COMPLETED 	;Flag done
	STA WAITCNTR 	; & wait
	STA PAUSED 	; & pause
	LDX #$0C
	JSR DLPRINT 	;Print message
	JMP TESTCH
NOTSHIP	JSR BEAMOFF 	;No valid hit
	JMP LUMINATE 	;Skip
EXTEND	INC BEAMPOS 	;Extend beam
	LDA #$2A 	;Beam sound
	STA AUDC4
	LDA BEAMPOS
	STA AUDF4
	CMP #$20 	;Beam limit?
	BNE NOACTION
	JSR BEAMOFF 	;Yes, off
	JMP LUMINATE
NOACTION	LDX VPOSME 	;Draw beam at top+2
	INX 
	INX 
	LDA #$CF
	AND MISSLES,X 	;clear end
	STA MISSLES,X
	DEX 
	LDY BEAMPOS
	INY 
BEAMLOOP	LDA #$CF 	;Beam mask
	CPX #$23 	;Hit top of screen
	BNE NOT2HIGH
	JSR BEAMOFF 	;Yes, off
	JMP LUMINATE
NOT2HIGH	AND MISSLES,X 	;Clear
	STA HOLDA 	;Save
NOTZERO	LDA #$30 	;Ok, random beam
	AND RANDOM
	BEQ NOTZERO
	ORA HOLDA
	STA MISSLES,X 	;Draw it
	DEX 
	DEY 
	BNE BEAMLOOP 	;Do all of it
	LDA #$CF
	AND MISSLES,X 	;Clear end
;
; Ship collision detection
;
HITME	LDA P0PL 	;My collision detection
	ORA P1PL 	;Sats and zaps detect
	AND #$0C
	BNE KAPOW 	;Yes, explode
	LDA VPOSME 	;If this low, I hit mountain
	CMP #$80
	BCS LUMINATE
	LDA P1PF 	;Rocks and ships detect
	ORA P0PF
	BEQ LUMINATE 	;No, skip
KAPOW	INC EXPLOSION 	;Flag <>0
LUMINATE	JSR R16 	;Random blue Zap & beam
	ORA #$AB
	STA PCOLR0+2
;
; Rocket flames routine
;
JETS	LDA EXPLOSION 	;No jets if exploded
	BEQ DARTH
	JMP BANGTEST
DARTH	LDA LANDFLAG 	;No jets if landed
	BNE NOFL
	LDA EMPTY 	;No fuel, no jets
	BEQ XVXV
	JMP BANGTEST
XVXV	LDA STICK0 	;Stick determines dir.
	AND #$0F
	CMP #$0F
	BEQ NOFL 	;No sticks? skip
	AND #$03
	CMP #$02 	;Test for up
	BEQ UF
	CMP #$01 	;Test for down
	BEQ DF
	BNE SIDES 	;Neither, try sides
UF	LDA VPOSME 	;Loc. to put flame
	CLC 
	ADC #$09
	TAX 
	JSR BURN 	;Show flame
	INX 
	JSR BURN
	JMP SIDES
DF	LDX VPOSME 	;Loc. to put flame
	INX 
	JSR BURN 	;Show flame
	DEX 
	JSR BURN
SIDES	LDA FD 	;Side flame dir. flag
	BEQ EFX 	;No dir? skip
	LDA VPOSME 	;Location to put flame
	CLC 
	ADC #$05
	TAX 
	JSR BURN1 	;Show it
EFX	LDA ALT 	;Flip 1/30 sec counter
	EOR #$FF
	STA ALT
	BNE MYLT 	;Skip every other VBLANK
	LDA ROAR 	;Test rocket sound
	CMP #$08 	;Not too loud
	BEQ SO
	INC ROAR 	;Update and sound on
SO	STA AUDC1
	LDA #$18
	STA AUDF1
	BNE MYLT 	;Always
NOFL	LDA ROAR 	;No flames? Quiet sound
	BEQ MYLT 	; until silent
	DEC ROAR
	LDA ROAR
	STA AUDC1
MYLT	INC FLASHME 	;Light counter
	LDA FLASHME 	;Branch at right time
	CMP #$40
	BNE TBIRD
	LDA #$00
	STA FLASHME 	;Reset count
	BEQ BANGTEST
TBIRD	CMP #$30 	;Turn off time
	BCS BANGTEST 	;Yes, skip
	LDY VPOSME 	;Pos. of lights
	INY 
	INY 
	LDA ANIMATE 	;Less if landing
	CMP ANITAB+1
	BCS TALL
	CMP ANITAB
	BCC TALL
	INY 
TALL	LDA #$42 	;Light Bit pattern
	STA PLAYER1,Y 	;Turn on
;
; Satellite explosion routines
;
BANGTEST	LDA SATEXP 	;Sat exploding
	BNE YESSAT
	JMP NOTASAT 	;No, skip
YESSAT	LDA #$00
	STA SUPER 	;Turn off supersat
	LDA #$1F
	STA SATCOLR 	;Yellow explosion
	JSR CSAT 	;Clear sat
	INC SATFRAME 	;Explosion count
	LDA SATFRAME
	CMP #$38 	;Branch if less than
	BCC P1
	JSR CSAT 	;Explosion done. Clear it
	LDA #$00 	;Set pos to 0
	STA HPOSP3
	STA HPOSSAT
	STA SATEXP 	;Clear flags
	STA SATFRAME
	STA SAT?
	STA AUDC2 	;Sound off
	BEQ NOTASAT 	;Always
P1	LDA RANDOM 	;Make random explosion
	AND #$18 	;Mask wrong bits
	TAY 
	LDX #$07 	;8 bytes of data
EXPLP1	LDA SATFRAME 	;Test counter
	CMP #$10
	BCC SMALLER 	;If less do small shape
	CMP #$28
	BCS SMALLER 	;If greater, do small
	LDA #$01 	;If between, make larger
	STA SIZEP0+3 	;Double width
	BNE BIGGER 	;Branch always
SMALLER	LDA #$40 	;Get sound in range
	SBC SATFRAME 	; by subtracting from 64
	STA AUDF2 	;Set audio
	LDA #$08
	STA AUDC2
	LDA #$00
	STA SIZEP0+3 	;Make it narrow
TINY	LDA EXPL1,Y 	;Get byte
	JSR MYRNA 	;Random mirror
	STA PMSATS,X 	;Place it
	INY 
	DEX 
	BPL TINY 	;Do 8
	BMI NOTASAT 	;Always
BIGGER	LDA #$50 	;Get sound in range
	SEC  	; by subtracting from 80
	SBC SATFRAME
	STA AUDF2 	;Set audio
	LDA #$0F
	STA AUDC2
	TXA  	;Multiply X*2
	ASL A
	TAX  	; and put it back
LARGER	LDA EXPL1,Y 	;Get byte
	JSR MYRNA 	;Randomly mirror
	STA PMSATS-8,X 	;Put on 2 lines
	STA PMSATS-7,X 	; for double height
	INY 
	DEX  	;Update twice for double lines
	DEX 
	BPL LARGER 	;Do 16 lines
;
; Zap routine
;
NOTASAT	LDA ZAPFLAG 	;Do a zap?
	BNE ZZZZT
	JMP NOZAP 	;No, skip
ZZZZT	INC ZAPCNT 	;Counter
	LDA ZAPCNT 	;Test max val.
	CMP #$6C
	BNE HUNTER 	;No, skip
	LDA #$00 	;Zap is done, clear
	STA AUDC3 	; sound
	STA ZAPCNT 	; & flags
	STA ZAPFLAG
	STA HPOSP2 	; & pos.
	TAX  	; & clear PM zap area
PILL	STA PMZAP-$50,X
	INX 
	CPX #$60
	BNE PILL
	BEQ NOZAP 	;Always
HUNTER	CMP #$36 	;Test branches
	BCS STRIKE 	;>$36, skip
	LDA #$2A 	;Set for noise
	STA AUDC3
	LDA #$50 	;Find freq.
	SEC 
	SBC ZAPCNT
	STA HOLDA
	JSR R16 	;Randomize it
	EOR HOLDA
	STA AUDF3 	;Sound it
	LDA RANDOM 	;Make random sparks
	AND #$0C 	;Set pointer
	TAY 
	LDX #$04 	;4 lines of them
SPKLP	LDA SPARKS,Y
	JSR MYRNA 	;Randomly mirror
	STA PMZAP,X
	INY 
	DEX 
	BNE SPKLP 	;Do all 4
	BEQ NOZAP 	;Always
STRIKE	LDA ZAPCNT 	;Now make bolt
	SEC 
	SBC #$20 	;Find sound freq.
	STA AUDF3
	LDA #$00 	;Clear remaining sparks
	STA PMZAP+3
	STA PMZAP+4
	LDA #$4F
	STA AUDC3 	;Set audio
	TAX  	;Save X for later routine
	LDA RANDOM 	;Random starting pt.
	AND #$1F 	;Mask bits
	TAY 
STRILP	LDA BOLTS,Y
	STA PMZAP-79,X 	;Make 4 same lines
	STA PMZAP-78,X
	STA PMZAP-77,X
	STA PMZAP-76,X
	INY 
	TYA 
	AND #$1F 	;Make y wrap at 32
	TAY 
	DEX 
	DEX 
	DEX 
	DEX 
	BPL STRILP 	;Do 78 lines
NOZAP	LDA SATEXP 	;Sat exploding?
	BNE SATOK 	;Yes, skip
	LDA P3PL 	;Sat zapped?
	BEQ SATOK
	INC SATEXP 	;Yes, Flag it
;
; Misc. sound routine
;
SATOK	LDA ETC. 	;Test misc sound flag
	BEQ TE 	;0?, skip
	CMP #$01 	;Branch to right place
	BNE UE
	DEC VOL4 	;This is Boing sound decay
	LDA VOL4
	BEQ UE 	;Until 0
	LSR A
	LSR A
	ORA #$40 	;Set distortion
	STA AUDC4 	;Use it
	LDA #$20
	STA AUDF4 	;This freq.
	BNE TE 	;Always
UE	LDA #$00
	STA ETC. 	;Clear flag
	STA AUDC4 	;Off sound
;
; Ship explosion routine
;
TE	LDA EXPLOSION 	;Test my exp. flag
	BNE SHABOOM
	JMP NOATR 	;No, Skip
SHABOOM	INC POWNTER 	;Counter
	LDA #$30 	;Get freq. range
	CLC 
	ADC POWNTER 	; by adding $30
	STA AUDF1
	LDA POWNTER 	;Test branches
	CMP #$18
	BCC OVERLAP
	CMP #$30
	BCS TA
	JMP ENGULF
TA	CMP #$50
	BCC CATCHUP
	CMP #$78 	;No branches?
	BCC SLNT
	LDA #$FF
	STA RESETFLAG 	;Done? reset me
SLNT	LDA #$00 	;My sound off
	STA AUDC1
	JMP NOATR
OVERLAP	JSR SHOW 	;Show me
	LDA #$0A 	;Set audio
	STA AUDC1
	LDA RANDOM 	;Find rand. expl. data
	AND #$18
	TAY 
	LDX VPOSME 	;My position
	INX 
	LDA #$07
	STA COWNTER
HINKLEY	LDA EXPL1,Y 	;Get byte
	JSR MYRNA 	;Random mirror
	JSR PUT 	;"OR" it on me
	INX 
	INY 
	DEC COWNTER
	BPL HINKLEY 	;Do 8
	JMP NOATR
CATCHUP	JSR CLRME 	;Erase
	LDY #$03
D	DEC ROAR 	;Fade sound
	BEQ OW 	;Unless 0
	DEY 
	BPL D
	LDA ROAR
	LSR A
	LSR A
	LSR A
	LSR A
	STA AUDC1
OW	JMP NOATR
ENGULF	LDA #$0F 	;Big explosion sound
	STA AUDC1
	LDA #$00
	STA ROAR 	;Clear sound fade
	LDA #$0F 	;Bright white expl.
	STA PCOLR0
	STA PCOLR0+1
	LDA HPOSME 	;Center Plyrs on my horiz.
	SEC 
	SBC #$04
	STA HPOSP0
	CLC 
	ADC #$08
	STA HPOSP1
	LDA #$00
	STA COWNTER 	;Clear count
LSIDE	LDA VPOSME 	;Draw random left exp.
	SEC 
	SBC #$04
	TAX 
	LDA RANDOM 	;Rand byte
	AND #$30 	;Point to data
	TAY 
AUTOMAN	LDA EXPME,Y 	;Xfer data
	STA PLAYER0,X
	INX 
	INY 
	INC COWNTER
	LDA COWNTER
	CMP #$10
	BNE AUTOMAN 	;Do 16 lines
RSIDE	LDA RANDOM 	;Draw right side
	AND #$30 	;Point to data
	TAY 
ORBOTS	STX HOLDX 	;Save count
	LDA EXPME,Y 	;Get Left side data
	STA HOLDA
	JSR MIRROR 	;Mirror for right
	LDX HOLDX 	;Get count
	LDA HOLDA
	STA PLAYER1,X 	;Place byte
	DEX 
	INY 
	DEC COWNTER
	LDA COWNTER
	BNE ORBOTS 	;Do 16 lines
;
; Pause routine and cleanup
;
NOATR	LDA #$00
	STA ATRACT 	;Attract mode off
TESTCH	STA HITCLR 	;Clr collisions
	LDA WAITING 	;Are we waiting?
	BNE INCH 	;No, skip
	DEC WAITCNTR 	;Count down
	BNE CLRCH 	;Not 0 yet? skip
	LDA #$B4 	;Reset count to 3 sec
	STA WAITCNTR
	STA WAITING 	;Flag not waiting
	LDX #$00
	JSR DLPRINT 	;Erase messages
	LDA COMPLETED 	;Level done?
	BEQ NNLEV 	;No, skip
	LDA #$00 	;Flag wait
	STA WAITING
	LDA #$FF
	STA NEWLEV 	;Flag new level
	BNE INCH 	;Always
NNLEV	LDA #$00
	STA PAUSED 	;Pause off
INCH	LDA CH 	;Test KB for space bar
	CMP #$21
	BNE CLRCH 	;No? skip
	JSR SILENT 	;Sound off
	LDA PAUSED 	;Toggle pause
	EOR #$FF
	STA PAUSED
	BNE CLRCH 	;Pause on? skip
	LDX #$77
	JSR OLDC 	; restore colors
CLRCH	LDA #$FF
	STA CH 	;Reset KB shadow
	LDA RANDOM
	STA RAND1 	;Set constant random #
ATR	LDA PAUSED 	;If paused...
	ORA G.O 	; or game over...
	BEQ EXIT
	LDX #$77 	; do attracting
AC	LDA ACOLTAB,X
	JSR MIXUP
	STA DCOLTAB,X
	DEX 
	BPL AC
EXIT	JMP XITVBV 	;End or routine
;
; PROGRAM DATA TABLES
;
;
; Mountain range data
;
	*= $3A00
	.SBYTE +$40,"_______________5:<9___________________7;<8______"
	.SBYTE +$40,"________5;<8_7;>@BB<879____5;<9_____6:>@BD<86;<9"
	.SBYTE +$40,"<95:<86;?@BAEF=>@DAIJ?C<96:>@DC<8_5:?>?@ACIJ=@BB"
	.SBYTE +$40,"IJ=@IJ>?=@ADCBGH@IJ>=>BIJ=?@@ACBAEF==?@@IJ>?>@AC"
	.SBYTE +$40,"KKLKKLLLKLMNONOMLLKLKLNKLLKKLMONOOMKLLKLKLLKKLMO"
	.SBYTE +$40,"PRQRPQRPRRQRPRPRPRQRPQRPQRPRQPQPRPRPQRPRQRPRPRRP"
	.SBYTE +$40,"STUST]STSTUTSUS]SUSTUSTS^^SUTU]TTSUTUTTTUS]SSTU]"
	.SBYTE +$40,"]WX]V]]V]]]WX]]]XV]X]]YZ[\Y]]]X]]]]]]V]]]]W]]]]]"
	.SBYTE +$40,"]]]]]]]]]]]]]]]]]]]]]]]]^^]]]]]]]]]]]]]]]]]]]]]]"
BOT	.SBYTE "     C:0 RADS'!#$#%#$#&  FUEL'!#$#%#$#& P:0     "
CANISTERS	= *-$29 	;# canisters left
SHIPS	= *-$06 	;# ships left
;
; Title screen text
;
TITLE	*= *+$C8
	.SBYTE +$C0,"  BY DOUGLAS ENGEL  "
	.SBYTE "      LEVEL: 0      "
LEVEL	= *-$07
;
; Message text
;
LEVLLINE	.SBYTE +$C0,"        LEVEL: 0        "
PLEVEL	= *-$09
MULTLINE	.SBYTE +$C0,"     MULTIPLIER: 00     "
PMULT	= *-$07
MESSLINE	.SBYTE +$C0,"       GAME  OVER       "
COMPLINE	.SBYTE +$C0,"    LEVEL COMPLETED     "
;
; Game display list
;
DLIST	.BYTE $B0,$70,$70,$D6,$00,$30,$10,$D4,$00,$31
	.BYTE $D4,$80,$30,$D4,$80,$30,$D4,$40,$37,$D4
	.BYTE $C0,$35,$D4,$40,$33,$D4,$C0,$35,$D4,$40
	.BYTE $33,$D4,$C0,$37,$D4,$00,$35,$D4,$80,$30
	.BYTE $D4,$80,$30,$D4,$80,$30,$D4,$00,$3A
	.BYTE $84,$84,$84,$84,$84,$84,$84,$84
	.BYTE $20,$52, <BOT, >BOT,$41, <DLIST, >DLIST
;
; Alternate DL lines for messages
;
DLTABL
	.BYTE $D4,$80,$80,$D4,$80,$80
	.BYTE $D6, <LEVLLINE, >LEVLLINE,$D6, <MULTLINE, >MULTLINE
	.BYTE $D6, <COMPLINE, >COMPLINE,$D4,$80,$30
	.BYTE $D6, <MESSLINE, >MESSLINE,$D4,$80,$30
;
; Title screen display list
;
DLIST1	.BYTE $70,$70,$70,$70,$70,$44, <TITLE, >TITLE,$04,$04,$04,$04,$70,$86
	.BYTE $70,$70,$70,$70,$70,$06,$70,$70,$70,$70,$70,$70,$70,$70,$70
	.BYTE $41, <DLIST1, >DLIST1
;
; Scroll tables
;
SCRLST	*= *+24 	;Direction
COUNT	*= *+24 	;Speed counter
LIMIT	*= *+24 	;Maximum count
CURR	*= *+24 	;Current HSCROL value
COLCKS	*= *+24 	;Scrolled color clocks
MPOS	*= *+24 	;Star missile positions
OFFSET	*= *+24 	;Offset between stars
;
; COLOR TABLES
;
;
;Actual colors
;
COLTAB	.BYTE $CA,$A4,$A4,$02,$02,$02,$02,$02,$02,$02,$02,$02
	.BYTE $32,$32,$32,$32,$32,$32,$32,$32,$32,$32,$32,$02
	.BYTE $24,$A2,$A2,$04,$04,$04,$04,$04,$04,$04,$04,$04
	.BYTE $04,$34,$34,$34,$34,$34,$34,$34,$34,$34,$34,$0A
	.BYTE $06,$06,$06,$06,$06,$06,$06,$06,$06,$06,$06,$06
	.BYTE $06,$36,$36,$36,$36,$36,$36,$36,$36,$36,$36,$50
	.BYTE $40,$8E,$8E,$40,$40,$40,$40,$40,$40,$40,$40,$40
	.BYTE $48,$48,$40,$40,$40,$40,$40,$40,$40,$40,$8F,$8F
	.BYTE $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
	.BYTE $80,$82,$84,$86,$88,$8A,$8C,$8E,$1E,$1E,$1E,$50
;
ACOLTAB	*= *+120 	;Attracted table
;
DCOLTAB	*= *+120 	;Displayed table
;
; Character set data
;
	*= $4000 	;First 8 chars
CHARS	.BYTE $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$C0,$C0,$C0,$C0,$CC,$FF
	.BYTE $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$C0,$CC,$FF
	.BYTE $00,$00,$00,$00,$C0,$C0,$CC,$FF,$00,$00,$00,$C0,$C0,$C0,$CC,$FF
	.BYTE $00,$0C,$DE,$CC,$C0,$C0,$C0,$C0,$00,$00,$1E,$00,$00,$00,$00,$00
	*= CHARS+$0200 	;Last 64 chars
	.BYTE $00,$03,$0F,$2F,$3B,$3B,$2F,$05,$00,$40,$90,$A4,$E4,$E4,$90,$40
	.BYTE $00,$0F,$3B,$1F,$3E,$3B,$3D,$0F,$00,$54,$E5,$79,$F9,$F9,$E5,$54
	.BYTE $00,$0C,$3F,$BE,$EE,$FE,$3E,$0A,$00,$00,$40,$50,$50,$90,$50,$40
	.BYTE $00,$14,$E9,$F9,$F9,$E9,$14,$00,$00,$10,$E4,$E4,$E4,$10,$00,$00
	.BYTE $00,$00,$20,$E4,$E4,$E4,$20,$00,$00,$28,$F9,$79,$F9,$F9,$B9,$25
	.BYTE $00,$F4,$F9,$F9,$A4,$10,$00,$00,$00,$00,$00,$00,$0D,$09,$05,$00
	.BYTE $00,$00,$00,$35,$39,$2D,$29,$05,$00,$00,$38,$39,$29,$24,$10,$00
	.BYTE $00,$38,$38,$24,$00,$00,$00,$00,$00,$00,$08,$39,$39,$29,$25,$05
	.BYTE $00,$05,$05,$00,$00,$05,$05,$00,$C0,$54,$5A,$AA,$AA,$54,$54,$C0
	.BYTE $0C,$2A,$AA,$95,$95,$AA,$2A,$0C,$03,$0A,$A9,$A9,$AA,$AA,$0A,$03
	.BYTE $00,$80,$60,$58,$A8,$A8,$80,$00,$00,$00,$00,$00,$00,$03,$0E,$3E
	.BYTE $00,$00,$00,$00,$00,$03,$0F,$3B,$00,$00,$00,$00,$00,$03,$0F,$3D
	.BYTE $00,$00,$00,$00,$40,$50,$94,$59,$00,$00,$00,$00,$40,$50,$94,$55
	.BYTE $00,$03,$0E,$3F,$FE,$FE,$BB,$EE,$00,$03,$0F,$3D,$FF,$F7,$BF,$FE
	.BYTE $40,$50,$94,$55,$55,$59,$95,$56,$BE,$EB,$BE,$EA,$BE,$BB,$EE,$BB
	.BYTE $FE,$FF,$FE,$EE,$BB,$EA,$EE,$AA,$FE,$FB,$DE,$EE,$BB,$FA,$EE,$BA
	.BYTE $BA,$FA,$BE,$FA,$EB,$EE,$FB,$AE,$99,$A5,$A5,$A6,$A6,$6A,$99,$9A
	.BYTE $A6,$99,$A9,$96,$69,$A5,$99,$55,$59,$96,$65,$59,$96,$69,$56,$65
	.BYTE $59,$96,$59,$65,$55,$59,$99,$66,$40,$53,$9B,$55,$55,$59,$55,$56
	.BYTE $FB,$BA,$FF,$EA,$7E,$5A,$56,$65,$7E,$5F,$97,$59,$55,$59,$95,$65
	.BYTE $FA,$EE,$FF,$FE,$7B,$5E,$96,$65,$99,$A9,$95,$65,$95,$97,$5F,$BD
	.BYTE $59,$97,$5F,$7E,$EF,$FF,$BE,$FF,$FF,$BE,$EF,$FF,$BB,$FF,$BE,$FF
	.BYTE $FE,$BF,$FB,$BF,$EE,$FF,$FB,$BF,$AA,$BA,$FF,$EE,$FF,$FB,$BF,$FF
	.BYTE $AA,$AA,$EE,$FF,$FB,$BF,$EF,$FE,$AA,$AA,$FB,$FF,$BF,$FE,$EF,$BB
	.BYTE $FF,$BB,$FF,$FF,$EE,$FF,$FF,$EF,$FF,$BF,$FF,$FB,$BF,$FF,$FE,$EF
	.BYTE $BF,$FE,$FF,$FF,$FB,$FF,$EF,$FE,$FF,$FF,$EB,$FF,$FF,$FF,$FA,$FF
	.BYTE $AF,$FF,$FF,$FF,$FA,$FF,$FF,$FF,$FF,$FF,$FF,$EB,$FF,$FF,$FF,$AF
	.BYTE $FF,$FF,$EF,$BB,$EF,$FF,$FF,$FF,$FF,$AF,$FF,$FF,$FF,$FB,$EE,$FB
	.BYTE $FF,$FF,$FB,$FF,$FF,$FF,$EF,$FF,$FF,$FF,$F3,$FF,$FF,$FF,$F3,$FF
	.BYTE $FF,$FF,$FD,$D5,$D6,$D5,$F5,$FF,$FF,$D5,$59,$59,$AA,$59,$59,$55
	.BYTE $FF,$FF,$5F,$55,$A5,$55,$57,$7F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
	.BYTE $FF,$FB,$FF,$FF,$3F,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00
;
; PLAYER MISSILE BIT MAPS
;
;
;Data for my ship
;
SHAPE1A
	.BYTE $00,$24,$7E,$7E,$24,$24,$00,$00,$18,$00,$00,$00
SHAPE1B
	.BYTE $00,$00,$00,$00,$00,$00,$3C,$7E,$42,$42,$E7,$00
	.BYTE $00,$00,$24,$7E,$7E,$24,$24,$00,$00,$18,$00,$00
	.BYTE $00,$00,$00,$00,$00,$00,$00,$3C,$7E,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$24,$24,$00,$00,$18,$00,$00,$00
	.BYTE $00,$00,$00,$00,$00,$00,$3C,$7E,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$24,$24,$00,$00,$00,$00,$00,$00
	.BYTE $00,$00,$00,$00,$00,$00,$24,$66,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$24,$24,$00,$00,$00,$00,$00,$00
	.BYTE $00,$00,$00,$00,$00,$00,$24,$42,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$24,$24,$00,$00,$00,$00,$18,$00
	.BYTE $00,$00,$00,$00,$00,$00,$24,$42,$42,$42,$FF,$00
	.BYTE $00,$24,$7E,$7E,$24,$24,$00,$00,$00,$18,$18,$00
	.BYTE $00,$00,$00,$00,$00,$00,$24,$42,$42,$5A,$FF,$00
	.BYTE $00,$24,$7E,$7E,$24,$24,$00,$00,$18,$18,$08,$00
	.BYTE $00,$00,$00,$00,$00,$00,$24,$42,$5A,$5A,$E7,$00
	.BYTE $00,$24,$7E,$7E,$24,$24,$00,$18,$18,$08,$10,$00
	.BYTE $00,$00,$00,$00,$00,$00,$24,$5A,$5A,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$24,$24,$18,$18,$08,$10,$08,$00
	.BYTE $00,$00,$00,$00,$00,$00,$3C,$5A,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$24,$3C,$18,$08,$10,$08,$10,$00
	.BYTE $00,$00,$00,$00,$00,$18,$3C,$42,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$3C,$3C,$08,$10,$08,$10,$08,$00
	.BYTE $00,$00,$00,$00,$18,$18,$24,$42,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$3C,$3C,$00,$08,$10,$08,$10,$00
	.BYTE $00,$00,$00,$00,$18,$18,$24,$42,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$3C,$3C,$00,$00,$08,$10,$08,$00
	.BYTE $00,$00,$00,$00,$18,$18,$24,$42,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$3C,$3C,$00,$00,$00,$08,$10,$00
	.BYTE $00,$00,$00,$00,$18,$18,$24,$42,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$3C,$3C,$00,$00,$00,$00,$08,$00
	.BYTE $00,$00,$00,$00,$18,$18,$24,$42,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$3C,$3C,$00,$00,$00,$00,$00,$00
	.BYTE $00,$00,$00,$00,$18,$18,$24,$42,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$3C,$3C,$00,$00,$00,$00,$00,$00
	.BYTE $00,$00,$00,$00,$18,$18,$24,$66,$42,$42,$E7,$00
	.BYTE $00,$24,$7E,$7E,$3C,$3C,$00,$00,$18,$00,$00,$00
	.BYTE $00,$00,$00,$00,$18,$18,$3C,$7E,$42,$42,$E7,$00
;
;Sattelite data
;
ASATS	.BYTE $00,$44,$28,$10,$38,$38,$38,$10,$0E,$CE,$64,$3F,$3F,$64,$CE,$0E
	.BYTE $36,$49,$1C,$3E,$3E,$1C,$2A,$49,$22,$1C,$1C,$7F,$7F,$08,$08,$14
	.BYTE $08,$1C,$1C,$1C,$08,$3E,$08,$14,$00,$FF,$18,$FF,$18,$18,$24,$00
	.BYTE $07,$07,$A4,$7F,$A4,$07,$07,$00,$28,$10,$10,$38,$38,$10,$10,$28
	.BYTE $00,$00,$3C,$99,$7E,$99,$3C,$00,$10,$54,$38,$7C,$38,$54,$10,$28
	.BYTE $00,$00,$1A,$BC,$7F,$BC,$1A,$00,$10,$38,$12,$3C,$3C,$12,$38,$10
	.BYTE $10,$10,$7C,$38,$10,$54,$38,$54,$81,$5A,$3C,$66,$66,$3C,$5A,$81
	.BYTE $00,$1C,$3E,$55,$3E,$1C,$00,$00,$00,$00,$00,$DB,$7E,$18,$00,$00
;
;Sattelite explosion data
;
EXPL1	.BYTE $00,$24,$08,$18,$48,$02,$10,$00,$00,$42,$28,$34,$10,$44,$00,$10
	.BYTE $04,$40,$28,$14,$39,$3C,$50,$02,$80,$25,$1E,$2C,$9A,$21,$48,$02
;
;Spark data
;
SPARKS	.BYTE $40,$31,$84,$00,$83,$5A,$00,$04,$44,$84,$41,$12,$82,$2C,$11,$40
;
;Bolt data
;
BOLTS	.BYTE $04,$08,$10,$10,$10,$20,$40,$80,$40,$40,$20,$10,$08,$08,$04,$02
	.BYTE $02,$04,$08,$10,$10,$08,$04,$04,$02,$01,$01,$02,$04,$08,$08,$04
;
;My explosion data
;
EXPME	.BYTE $01,$00,$28,$02,$04,$1F,$26,$0F,$15,$0F,$4B,$05,$13,$00,$42,$00
	.BYTE $20,$00,$44,$01,$12,$05,$8B,$1B,$4E,$0B,$06,$23,$00,$00,$01,$00
	.BYTE $80,$00,$11,$00,$0A,$05,$1B,$07,$2B,$0D,$27,$0B,$06,$40,$00,$02
	.BYTE $00,$0A,$10,$00,$55,$00,$05,$02,$8B,$05,$03,$23,$01,$80,$08,$00
;
; MISCELLANEOUS DATA TABLES
;
;
;Title screen bitmap
;
BITS	.BYTE $07,$8E,$39,$27,$A0,$04,$51,$45,$48,$20,$07,$91,$41,$87,$20
	.BYTE $04,$51,$45,$40,$80,$04,$4E,$39,$2F,$20
;
;DL modification pointers
;
POINTR	.BYTE $04,$08,$0B,$0E,$11,$14,$17,$1A,$1D,$20,$23,$26
	.BYTE $29,$2C,$2F,$32,$35,$38,$3B,$3E,$41,$44,$47,$4B
;
;Priority table
;
PRITAB	.BYTE $22,$22,$22,$22,$22,$22,$22,$22,$22,$22,$22,$22
	.BYTE $22,$21,$21,$21,$21,$21,$21,$21,$21,$21,$31,$31
;
;Animation frame pointers
;
ANITAB	.BYTE $0A,$14,$38,$40,$50,$58,$60,$68,$70
	.BYTE $78,$80,$88,$90,$98,$A0,$A8,$C8,$D0
;
;Frequency table
;
FREQ	.BYTE $20,$20,$00,$38,$30,$5F,$5D,$5B,$59
	.BYTE $58,$58,$59,$5B,$5D,$5F,$30,$38,$00
;
;Distortion table
;
NOIZE	.BYTE $88,$80,$00,$48,$48,$28,$28,$28,$28
	.BYTE $28,$28,$28,$28,$28,$28,$48,$48,$00
;
; Other locations
;
SCORE	.SBYTE "00000000" 	;Score in memory
SLEVEL	.SBYTE "0" 	;Starting level
TOTAL	.BYTE $00 	;Total # levels done
PAINT	.BYTE $00 	;Planet color mask
;
;
	*= RUNAD
	.WORD START
	.END 
