* THIS IS D:TANK.SRC
* SET UP SCREEN & PMG
TITLE
; SET UP COLORS
	LDX	#$09
AA0
	LDA	COLORS,X
	STA	PCOLR0,X
	DEX
	BPL	AA0
	LDA	#TDLIST		;PUT UP TITLE
	STA	SDLSTL
	LDA	#<TDLIST
	STA	SDLSTH
	LDX	#$00
	LDY	#$02
AA1
	LDA	RTCLOC
AA2
	CMP	RTCLOC
	BEQ	AA2
	DEX
	BNE	AA1
	DEY
	BNE	AA1
SETUP
	LDA	#$00
	STA	AUDCTL		;INSURE CLEAN SOUND
	LDA	#$03
	STA	SKCTL		;CLEAR ANY GARBAGE SOUND
	LDA	#$3E		;SINGLE LINE RES. PLAYERS
	STA	SDMCTL
	LDA	#$03
	STA	GRACTL
	LDA	#<PDATA
	STA	PMBASE
	LDA	#$11		;MISSILE COLOR-COLPF3,PLAYER PRIORITY
	STA	GPRIOR
	LDA	#>NDLIST
	STA	SDLSTL
	LDA	#<NDLIST
	STA	SDLSTH
	LDA	#$00
	STA	GAME		;GAME IN PROGRESS FLAG
	STA	ENABLE		;PAUSE FLAG FOR OUR VERTICAL BLANK
	LDA	#$07		;DEFFERED VBI
	LDX	#<VBI
	LDY	#VBI
	JSR	SETVBV		;INIT OUR VERTICAL BLANK.
* SET CHR BASE	;IT WILL INIT DLI
	LDX	#$00
AB2
	LDA	NEWSET,X
	STA	CHRSET,X
	DEX
	BNE	AB2
	JSR	DOSCREEN
	LDA	#<CHRSET
	STA	CHBAS
START
	LDA	#$00
	STA	ENABLE
	STA	GAME
	LDA	#$06
	CMP	CONSOL		;START PRESSED?
	BNE	START
	LDA	#$07
AC1
	CMP	CONSOL		;RELEASED?
	BNE	AC1
	JSR	RESTART		;WAIT TILL START BUTTON RELEASED
FOREVER
	LDA	GAME
	BEQ	ENDGAME
	LDA	CONSOL
	CMP	#$06
	BEQ	START
	BNE	FOREVER
	JMP	FOREVER
ENDGAME
	LDA	#$00
	LDX	#$08
AD1
	STA	AUDF1,X		;TURN OFF ANY SOUNDS
	DEX
	BPL	AD1
	LDX	#$13
AD2
	LDA	EMSG,X
	STA	LINE3,X		;MOVE GAME OVER MESSAGE TO SCREEN
	DEX
	BPL	AD2
	LDA	#$06
AD3
	CMP	CONSOL		;START PRESSED?
	BNE	AD3		;WAIT TILL IT IS
	JMP	START
