*         1544    030784
** * ** * ** * ** * ** * ** * ** * ** * **
**                                      **
**     Asteroids for the Atari 3600     **
**                                      **
** * ** * ** * ** * ** * ** * ** * ** * **

*
*
** RASTDEF.S **
** ASTEROIDS FOR THE ATARI 3600 **
** THIS FILE CONTAINS MEMORY STORAGE **
**  AND GENERAL EQUATES. **
**
** MODIFIED FOR MARIA 2 **
*
	.include	"maria.s"
*
*
** HSC INTERFACE
HSCRAM    EQU     $1E00
HSCSETRS  EQU     $3FEB
HSCSTAT   EQU     $3FF7
HSCATRCT  EQU     $3FFA
HSCENTER  EQU     $3FFD

** IMMEDIATES
ICON      EQU     $07
SMALL     EQU     $10
MEDIUM    EQU     $21
LARGE     EQU     $32
SHIP      EQU     $23
SMALLUFO  EQU     $14
LARGEUFO  EQU     $25
SHOT      EQU     $06
OPENSHIP  EQU     $FF

XPOSMIN   EQU       0
XPOSMAX   EQU     159
YPOSMIN   EQU       0
YPOSMAX   EQU     191

NOVICED   EQU      60
TOUGHD    EQU      90
EXPERTD   EQU     110

MAXVEL    EQU     $20

MINDIFF   EQU     $00
MAXDIFF   EQU     $03
MINMODE   EQU     $FF
MAXMODE   EQU     $02

SELDLY    EQU     $10
RACKDLYC  EQU     $25

* EQUATES FOR DRIVER STATE MACHINE.
TITLEST   EQU     1
MENUST    EQU     2
AUTOST    EQU     3
HSCST     EQU     4
PLAYST    EQU     5
PAUZST    EQU     6

TITLEONT  EQU     0
TITLEOFT  EQU     TITLEONT+$02		;2 * 8.3 = 17 SECONDS

AUTOOFFT  EQU     $04

MENUOFFT  EQU     $07

* EQUATES FOR FINITE STATE MACHINE - FSM
DEAD      EQU     $FF
OK        EQU     0
BIRTH     EQU     1
HYPER     EQU     2
DEATH     EQU     3
COMPOVER  EQU     4

ENTERT    EQU     1
RESINT    EQU     ENTERT+$28
PMSGOFFT  EQU     RESINT+$28
PMSGT     EQU     PMSGOFFT+$28

HYPENDT   EQU     1
HYPERT    EQU     HYPENDT+$28

NEWGAMET  EQU     1
GOVERT    EQU     NEWGAMET+$60
POMSGOFT  EQU     GOVERT+$10
POMSGT    EQU     POMSGOFT+$30
SWITCHT   EQU     POMSGT+$5
DIET      EQU     SWITCHT+$10

* 6116 RAM WHICH IS >ON< ZERO PAGE:
	.ORG     $40
RANDPTR0:
	.DS.B		1
RANDPTR1:
	.DS.B		1

HISCORE:
	.DS.B		4		;HIGH SCORE

SCORE:
	.DS.B		4		;PLAYER ONE SCORE DEC. MODE
SCORE2:
	.DS.B		4		;PLAYER TWO SCORE DEC. MODE
COMBSCOR:
	.DS.B		4		;COMBINED SCORE DEC. MODE

MENLEFT:
	.DS.B		1		;PLAYER1 NUMBER OF MEN LEFT
MENLEFT2:
	.DS.B		1		;PLAYER2 NUMBER OF MEN LEFT
MENLEFTC:
	.DS.B		1		;POOL OF LIVES FOR TEAM PLAY

TEMP:
	.DS.B		16		;GAMEPLAY TEMP
TEMPI:
	.DS.B		5		;LOADER TEMP

FREE:
	.DS.B		12		;FREE POINTERS, NOT FREE SPACE


FRMCNT:
	.DS.B		1
LASTFRMC:
	.DS.B		1

NMICTRL:
	.DS.B		1		;VALUE OF CTRL FOR HSC SPECIAL NMIHNDL

PLAYER:
	.DS.B		1		;WHICH PLAYER
SCORER:
	.DS.B		1		;WHICH PLAYER IS CURRENTLY SCORING
GAMSTATE:
	.DS.B		1		;STATE FOR DRIVER.
DTIMER:
	.DS.B		2		;TIMER FOR DRIVER - TWO BYTES ACCURACY
STATE:
	.DS.B		2		;STATE FOR FSM, ONE FOR EACH PLAYER
TIMER:
	.DS.B		2		;TIMER FOR FSM, ONE FOR EACH PLAYER
MODE:
	.DS.B		1		;GAME MODE: FF = 1PL, 0=2PL, 1=TP, 2=CP
DIFF:
	.DS.B		1		;GAME DIFFICULTY LEVEL
MAXLVL:
	.DS.B		1		;MAXIMIUM LEVEL AT THIS DIFF SETTING
LVLINC:
	.DS.B		4		;INCREMENTS TO LEVEL
LEVEL:
	.DS.B		2
OFFPLAY2:
	.DS.B		1		;OFFSET FOR PLAYER2 DATA SET

STATUS:
	.DS.B		32		;OBJECT STATUS FOR PLAYER1 GAME
SH2STAT:
	.DS.B		1		;SHIP STATUS FOR 2 PLAYER GAME
MSGICONS:
	.DS.B		3		;STATUS FOR MESSAGE ICONS
PARTSTAT:
	.DS.B		8		;STATUS FOR SHIP'S PARTS FOR COLLISIONS

FIREBUT1:
	.DS.B		1		;SOFT REGISTERS
FIREBUT2:
	.DS.B		1
HYPBUT1:
	.DS.B		1
HYPBUT2:
	.DS.B		1
STARTBUT:
	.DS.B		1		;FIREBUT1 EXCEPT DURING AUTOST
SWCHAVAL:
	.DS.B		1
SWCHBVAL:
	.DS.B		1
SWCHBITS:
	.DS.B		1
ONEBUT:
	.DS.B		1		;PLAYER HAS 1 BUTTON JOYSTICK:
					; BIT 4 = P0, BIT 3 = P1

SHIPDIR:
	.DS.B		1		;PLAYER1 SHIP DIRECTION
SHIPDIR2:
	.DS.B		1		;PLAYER2 SHIP DIRECTION
RACKNUM:
	.DS.B		1		;PLAYER1 RACK NUMBER
RACKNUM2:
	.DS.B		1		;PLAYER2 RACK NUMBER
ROCKTOT:
	.DS.B		1		;PLAYER1 ROCK TOTAL
ROCKTOT2:
	.DS.B		1		;PLAYER2 ROCK TOTAL
STARTNUM:
	.DS.B		2		;STARTING NUMBER OF ROCKS FOR EACH

BCOUNTER:
	.DS.B		1		;BEAT COUNTER FOR BACKGROUND TUNE
BEATVAL:
	.DS.B		1		;BEAT VALUE FOR COUNTER, DECREASES
BEATRATE:
	.DS.B		1		;BEAT RATE, FOR CHANGE OF BEATVAL
WHICHBT:
	.DS.B		1		;BEAT NUMBER, TOGGLES BETWEEN 0 AND 1
TUNNUM:
	.DS.B		2		;NUMBER OF TUNE IN EACH CHANNEL
TINDEX:
	.DS.B		6		;INDEX INTO TUNE TABLE
TDURCNT:
	.DS.B		6		;TUNE DURATION COUNTERS
TTEMP     EQU     TEMPI		;THIS IS PROBABLY SAFE, SINCE TUNER
				; AND LOADER NEVER INTERRUPT EACH OTHER

FIRESTAT:
	.DS.B		2
SHOTCNT:
	.DS.B		6		;TIMER FOR ALL SHOTS
USHOTCNT:
	.DS.B		1		;COUNTDOWN TIMER FOR UFO SHOTS
RTIMER:
	.DS.B		1		;TIMER FOR UFO ENTRY
SDELAY:
	.DS.B		1		;PERCENTAGE OF LARGE
EDELAY:
	.DS.B		1		;COUNTDOWN TIL NEXT
UFOACC:
	.DS.B		1		;THRESHOLD OF UFO ACCURACY
SOFTCOLR:
	.DS.B		16		;SOFT COPY OF FIRST 4 PALETTES.

CLAMP:
	.DS.B		1		;CLAMP, USED BY DAMPING SYSTEM TO
					; STOP DRIFT
LOADFLAG:
	.DS.B		1		;FLAG CLEARED AT END OF LOADER.

SELCNT:
	.DS.B		1		;DEBOUNCER/COUNTER FOR MENU SELECT
RACKDLY:
	.DS.B		1		;TIMER FOR NEW RACK START
COMPFLAG:
	.DS.B		1		;FLAG FOR COMP PLAY TERMINATION
RUBFLAG:
	.DS.B		1		;RUBBER SHIP BOUNCE FLAG.
TURKEY:
	.DS.B		1
CHICKEN:
	.DS.B		1


* 6116 RAM WHICH IS >NOT< ON ZERO PAGE:
	.ORG     $1800
STATUS2:
	.DS.B		32		;OBJECT STATUS FOR TWOPLAYER GAME
**			;$20 LONG ARRAYS FOR STATE VARIABLES
**			;OF EACH OBJECT

XVELL:
	.DS.B		$20		;LOW BYTE X VELOCITY
XVELLP2:
	.DS.B		1		;SECOND PLAYER FOR TEAM PLAY

XVELH:
	.DS.B		$20		;HIGH BYTE X VELOCITY
XVELHP2:
	.DS.B		1

YVELL:
	.DS.B		$20		;LOW BYTE Y VELOCITY
YVELLP2:
	.DS.B		1

YVELH:
	.DS.B		$20		;HIGH BYTE Y VELOCITY
YVELHP2:
	.DS.B		1

XPOSH:
	.DS.B		$20		;HIGH BYTE X POSITION
XPOSHP2:
	.DS.B		1
	.DS.B		3

YPOSH:
	.DS.B		$20		;HIGH BYTE Y POSITION
YPOSHP2:
	.DS.B		1
	.DS.B		3

XPOSL:
	.DS.B		$20		;LOW BYTE X POSITION
XPOSLP2:
	.DS.B		1

YPOSL:
	.DS.B		$20		;LOW BYTE Y POSITION
YPOSLP2:
	.DS.B		1

ACYC:
	.DS.B		$20		;LOW BYTE STAMP ADDR
ACYCP2:
	.DS.B		1
	.DS.B		3
ANIMAT	EQU		ACYC+24
ACYC2:
	.DS.B		$20
COLXPOSH:
	.DS.B		$20
COLXP2:
	.DS.B		1
	.DS.B		3
PARTPOSX:
	.DS.B		8
COLYPOSH:
	.DS.B		$20
COLYP2:
	.DS.B		1
	.DS.B		3
PARTPOSY:
	.DS.B		8

XVELH2:
	.DS.B		$20
YVELH2:
	.DS.B		$20
XPOSH2:
	.DS.B		$20
YPOSH2:
	.DS.B		$20
XVELL2:
	.DS.B		$20
YVELL2:
	.DS.B		$20

TDURTAB:
	.DS.B		6		;TUNE DURATIONS

MINXVEL:
	.DS.B		1		;MINIMUM ROCK VELOCITIES
MINYVEL:
	.DS.B		1		; INCREASE AS DIFFICULTY
XVELLL:
	.DS.B		1		;LOW,LOW BYTE OF VELOCITY
XVELLL2:
	.DS.B		1		; USED BY DAMPING SYSTEM TO
YVELLL:
	.DS.B		1		; MAINTAIN SMOOTH, EXPONENTIAL
YVELLL2:
	.DS.B		1		; DECELLERATION AT LOW VELOCITIES.

BLANKDL:
	.DS.B		2		;DUMMY DISPLAY LIST: GETS ZEROED
DLL:
	.DS.B		$33		;DISPLAY LIST LIST: COPY OF DLLTAB
PALS:
	.DS.B		33		;SOFTWARE COPY OF PALETTE/WIDTH INFO
	.DS.B		3
PALS2:
	.DS.B		23		;TEMP COPY

FLASH:
	.DS.B		1		;KLUDGE FLAG FOR OUT REZZING
GOATMILK:
	.DS.B		1		;WHAT ELSE A FLAG

CHARMAPS:
	.DS.B		0
SCORMAP1:
	.DS.B		16		;CHARACTER MAP FOR PLAYER1 SCORE
SCORMAP2:
	.DS.B		16		;CHARACTER MAP FOR PLAYER2 SCORE
SCORECMC:
	.DS.B		16		;CHARACTER MAP FOR COMBO SCORE
SCORCMHS:
	.DS.B		8		;CHARACTER MAP FOR HIGH SCORE

* RANDOM NUMBER ARRAY (NOT CLEARED EVER)
	.ORG     $2100
RAND:
	.DS.B		55

* DISPLAY LISTS:
	.ORG     $2200
DISPLIST:
	.DS.B		0
GAMEDL12:
	.DS.B		$80		;START OF DISPLAY LISTS, 12 TOTAL
GAMEDL11:
	.DS.B		$80
GAMEDL10:
	.DS.B		$80
GAMEDL09:
	.DS.B		$80
GAMEDL08:
	.DS.B		$80
GAMEDL07:
	.DS.B		$80
GAMEDL06:
	.DS.B		$80
GAMEDL05:
	.DS.B		$80
GAMEDL04:
	.DS.B		$80
GAMEDL03:
	.DS.B		$80
GAMEDL02:
	.DS.B		$80
GAMEDL01:
	.DS.B		$80
ENDLIST:
	.DS.B		$0

YVELH24   EQU     YVELH+24
YVELL24   EQU     YVELL+24
XVELH24   EQU     XVELH+24
XVELL24   EQU     XVELL+24
YPOSH24   EQU     YPOSH+24
YPOSL24   EQU     YPOSL+24
XPOSH24   EQU     XPOSH+24
XPOSL24   EQU     XPOSL+24

