Space Invaders RAM Use

General Vars

AddressNameDescription
2000waitOnDrawCleared by alien-draw and set by next-alien. This ensures no alien gets missed while drawing.
2001
2002alienIsExplodingNot-0 if an alien is exploding, 0 if not exploting
2003expAlienTimerTime (ISR ticks) left in alien-explosion
2004alienRowRow number of current alien (cursor)
2005alienFrameAnimation frame number (0 or 1) for current alien (cursor)
2006alienCurIndexAlien cursor index (from 0 to 54)
2007refAlienDYrReference alien delta Yr
2008refAlienDXrReference alien deltaXr
2009refAlienYrReference alien Yr coordinate
200ArefAlienXrReference alien Xr coordinate
200BalienPosLSBAlien cursor bit pos (LSB)
200CalienPosMSBAlien cursor bit pos (MSB)
200DrackDirectionValue 0 if rack is moving right or 1 if rack is moving left
200ErackDownDeltaConstant value of alien rack dropping after bumping screen edge
200F
'''GameObject0 (Move/draw the player)'''
2010obj0TimerMSB
2011obj0TimerLSBWait 128 interrupts (about 2 secs) before player task starts
2012obj0TimerExtra
2013obj0HanlderLSB
2014oBJ0HanlderMSBPlayer handler code at 028E
2015playerAlivePlayer is alive (FF=alive). Toggles between 0 and 1 for blow-up images.
2016expAnimateTimerTime till next blow-up sprite change (reloaded to 5)
2017expAnimateCntNumber of changes left in blow-up sequence
2018plyrSprPicLPlayer sprite descriptor ... picture LSB
2019plyrSprPicMPlayer sprite descriptor ... picture MSB
201AplayerYrPlayer sprite descriptor ... location LSB
201BplayerXrPlayer sprite descriptor ... location MSB
201CplyrSprSizPlayer sprite descriptor ... size of sprite
201DnextDemoCmdNext movement command for demo
201EhidMessSeqSet to 1 after 1st of 2 sequences are entered for hidden-message display
201FAppears to be unused
2020obj1TimerMSB
'''GameObject1 (Move/draw the player shot)'''
2021obj1TimerLSB
2022obj1TimerExtraAll 0's ... run immediately
2023obj1HandlerLSB
2024obj1HandlerMSBShot handler code at 03BB
2025plyrShotStatus0 if available, 1 if just initiated, 2 moving normally, 3 hit something besides alien, 5 if alien explosion is in progress, 4 if alien has exploded (remove from active duty)
2026blowUpTimerSprite blow-up timer
2027obj1ImageLSB
2028obj1ImageMSBSprite image at 1C90 (just one byte)
2029obj1CoorYrPlayer shot Y coordinate
202Aobj1CoorXrPlayer shot X coordinate
202Bobj1ImageSizeSize of shot image (just one byte)
202CshotDeltaXShot's delta X
202DfireBounce1 if button has been handled but remains down
202E
202F
'''GameObject2 (Alien rolling-shot)'''
2030obj2TimerMSB
2031obj2TimerLSB
2032obj2TimerExtraGO-3 runs when this is 1. GO-4 runs when this is 2. (copied to 2080 in game loop)
2033obj2HandlerLSB
2034obj2HandlerMSBHandler code at 0476
2035rolShotStatus
2036rolShotStepCnt
2037rolShotTrackA 0 means this shot tracks the player
2038rolShotCFirLSBPointer to column-firing table LSB (not used for targeting)
2039rolShotCFirMSBPointer to column-firing table MSB (not used for MSB counter
203ArolShotBlowCnt
203BrolShotImageLSB
203CrolShotImageMSB
203DrolShotYr
203ErolShotXr
203FrolShotSize
'''GameObject3 (Alien plunger-shot)'''
2040obj3TimerMSB
2041obj3TimerLSB
2042obj3TimerExtra
2043obj3HandlerLSB
2044obj3HandlerMSBHandler code at 04B6
2045pluShotStatus
2046pluShotStepCnt
2047pluShotTrackA 1 means this shot does not track the player
2048pluShotCFirLSBPointer to column-firing table LSB
2049pluShotCFirMSBPointer to column-firing table MSB
204ApluShotBlowCnt
204BpluShotImageLSB
204CpluShotImageMSB
204DpluShotYr
204EpluSHotXr
204FpluShotSize
'''GameObject4 (Flying saucer OR alien squiggly shot)'''
2050obj4TimerMSB
2051obj4TimerLSB
2052obj4TimerExtra
2053obj4HandlerLSB
2054obj4HandlerMSBHandler code at 0682
2055squShotStatus
2056squShotStepCnt
2057squShotTrackA 1 means this shot does not track the player
2058squShotCFirLSBPointer to column-firing table LSB
2059squShotCFirMSBPointer to column-firing table MSB
205AsquSHotBlowCnt
205BsquShotImageLSB
205CsquShotImageMSB
205DsquShotYr
205EsquShotXr
205FsquShotSize
2060endOfTasksFF marks the end of the tasks list
2061collisionSet to 1 if sprite-draw detects collision
2062expAlienLSB
2063expAlienMSBExploding alien picture 1CC0
2064expAlienYrY coordinate of exploding alien
2065expAlienXrX coordinate of exploding alien
2066expAlienSizeSize of exploding alien sprite (16 bytes)
2067playerDataMSBCurrent player's data-pointer MSB (21xx or 22xx)
2068playerOK1 means OK, 0 means blowing up
2069enableAlienFire1 means aliens can fire, 0 means not
206AalienFireDelayCount down till aliens can fire (2069 flag is then set)
206BoneAlien1 when only one alien is on screen
206Ctemp206CHolds the value ten ... number of characters in each "=xx POINTS" string but gets set to 18 in mem copy before game.
206DinvadedSet to 1 when player blows up because rack has reached bottom
206EskipPlungerWhen there is only one alien left this goes to 1 to disable the plunger-shot when it ends
206F
2070otherShot1When processing a shot, this holds one of the other shot's info
2071otherShot2When processing a shot, this holds one of the other shot's info
2072vblankStatus80=screen is being drawn (don't touch), 0=blanking in progress (ok to change)
'''Alien shot information (copied from the 3 actual structures when processed)'''
2073aShotStatusBit 0 set if shot is blowing up, bit 7 set if active
2074aShotStepCntCount of steps made by shot (used for fire reload rate)
2075aShotTrack0 if shot tracks player or 1 if it uses the column-fire table
2076aShotCFirLSBPointer to column-firing table LSB
2077aShotCFirMSBPointer to column-firing table MSB
2078aShotBlowCntAlen shot blow up counter. At 3 the explosion is drawn. At 0 it is done.
2079aShotImageLSBAlien shot image LSB
207AaShotImageMSBAlien shot image MSB
207BalienShotYrAlien shot delta Y
207CalienShotXrAlien shot delta X
207DalienShotSizeAlien shot size
207EalienShotDeltaAlien shot speed. Normally -1 but set to -4 with less than 9 aliens
207FshotPicEndthe last picture in the current alien shot animation
2080shotSyncAll 3 shots are synchronized to the GO-2 timer. This is copied from timer in the game loop
2081tmp2081Used to hold the remember/restore flag in shield-copy routine
2082numAliensNumber of aliens on screen
2083saucerStartFlag to start saucer (set to 1 when 2091:2092 counts down to 0)
2084saucerActiveSaucer is on screen (1 means yes)
2085saucerHitSaucer has been hit (1 means draw it but don't move it)
2086saucerHitTimeHit-sequence timer (explosion drawn at 1F, score drawn at 18)
2087saucerPriLocLSBMystery ship print descriptor ... coordinate LSB
2088saucerPriLocMSBMystery ship print descriptor ... coordinate MSB
2089saucerPriPicLSBMystery ship print descriptor ... message LSB
208AsaucerPriPicMSBMystery ship print descriptor ... message MSB
208BsaucerPriSizeMystery ship print descriptor ... number of characters
208CsaucerDeltaYMystery ship delta Y
208DsauScoreLSBPointer into mystery-ship score table (MSB)
208EsauScoreMSBPointer into mystery-ship score table (LSB)
208FshotCountLSBBumped every shot-removal. Saucer's direction is bit 0. (0=2/29, 1=-2/E0)
2090shotCountMSBRead as two-bytes with 208F, but never used as such.
2091tillSaucerLSB
2092tillSaucerMSBCount down every game loop. When it reaches 0 saucer is triggerd. Reset to 600.
2093waitStartLoop1=in wait-for-start loop, 0=in splash screens
2094soundPort3Current status of sound port (out $03)
2095changeFleetSndSet to 1 in ISR if time to change the fleet sound
2096fleetSndCntDelay until next fleet movement tone
2097fleetSndReloadReload value for fleet sound counter
2098soundPort5Current status of sound port (out $05)
2099extraHoldDuration counter for extra-ship sound
209Atilt1 if tilt handling is in progress
209BfleetSndHoldTime to hold fleet-sound at each change
209C
209D
209E
209F
20A0
'''In the ROM mirror copied to RAM this is the image of the alien sprite pulling the upside down Y. The code expects it to be 0030 below the second animation picture at 1BD0. This RAM area must be unused. The copy is wasted. '''
20A1
20A2
20A3
20A4
20A5
20A6
20A7
20A8
20A9
20AA
20AB
20AC
20AD
20AE
20AF
20B0
20B1
20B2
20B3
20B4
20B5
20B6
20B7
20B8
20B9
20BA
20BB
20BC
20BD
20BE
20BF
''' End of inialization copy from ROM mirror'''
''' These are copied once from ROM at startup (01E6)'''
''' Splash screen animation structure '''
20C0isrDelayDelay counter decremented in ISR
20C1isrSplashTask1=In demo, 2=Little-alien and Y, 4=shooting extra 'C'
20C2splashAnFormImage form (increments each draw)
20C3splashDeltaXDelta X
20C4splashDeltaYDelta Y
20C5splashYrY coordinate
20C6splashXrX coordinate
20C7splashImageLSB
20C8splashImageMSBBase image 1BA0 (small alien with upside down Y)
20C9splashImageSizeSize of image (16 bytes)
20CAsplashTargetYTarget Y coordinate
20CBsplashReachedReached target Y flag (1 when reached)
20CCsplashImRestLSBBase image for restore 1BA0 is small alien with upside down Y
20CDsplashImRestMSB
20CEtwoPlayers1 for yes, 0 means 1 player
20CFaShotReloadRateBased on the MSB of the player's score ... how fast the aliens reload their shots
20D0; This is where the alien-sprite-carying-the-Y ...
20D1; ... lives in ROM
20D2
20D3
20D4
20D5
20D6
20D7
20D8
20D9
20DA
20DB
20DC
20DD
20DE
20DF
20E0
20E1
20E2
20E3
20E4
20E5player1ExExtra ship has been awarded = 0
20E6player2ExExtra ship has been awarded = 0
20E7player1Alive1 if player is alive, 0 if dead (after last man)
20E8player2Alive1 if player is alive, 0 if dead (after last man)
20E9suspendPlay1=game things are moving, 0=game things are suspended
20EAcoinSwitch1=switch down, 0=switch up (used to debounce coin switch)
20EBnumCoinsnumber of coin credits in BCD format (99 max)
20ECsplashAnimate0 for animation during splash and 1 for not. This alternates after every cycle.
20EDdemoCmdPtrLSBpointer to demo commands LSB 1663
20EEdemoCmdPtrMSBpointer to demo commands MSB
20EFgameMode1=game running, 0=demo or splash screens
20F0
20F1adjustScoreSet to 1 if score needs adjusting
20F2scoreDeltaLSBScore adjustment (LSB)
20F3scoreDeltaMSBScore adjustment (MSB)
20F4HiScorLHi-score descriptor ... value LSB
20F5HiScorMHi-score descriptor ... value MSB
20F6HiScorLoLHi-score descriptor ... location LSB
20F7HiScorLoMHi-score descriptor ... location MSB
20F8P1ScorLHi-score descriptor ... value LSB
20F9P1ScorMHi-score descriptor ... value MSB
20FAP1ScorLoLHi-score descriptor ... location LSB
20FBP1ScorLoMHi-score descriptor ... location MSB
20FCP2ScorLHi-score descriptor ... value LSB
20FDP2ScorMHi-score descriptor ... value MSB
20FEP2ScorLoLHi-score descriptor ... location LSB
20FFP2ScorLoMHi-score descriptor ... location MSB

Player 1 specific data

2100:2136 Player 1 alien ship indicators (0=dead) 11*5 = 55
2137:2141Unused 11 bytes (room for another row of aliens?)
2142:21F1Player 1 shields remembered between rounds 44 bytes * 4 shields ($B0 bytes)
21F2:21FAUnused 9 bytes
21FBp1RefAlienDXPlayer 1 reference-alien delta X
21FCp1RefAlienYPlayer 1 reference-alien Y coordinate
21FDp1RefAlienXPlayer 1 reference-alien X coordiante
21FEp1RackCntPlayer 1 rack-count (starts at 0 but get incremented to 1-8)
21FFp1ShipsRemShips remaining after current dies

Player 2 specific data

2200:2236 Player 2 alien ship indicators (0=dead) 11*5 = 55
2237:2241Unused 11 bytes (room for another row of aliens?)
2242:22F1Player 2 shields remembered between rounds 44 bytes * 4 shields ($B0 bytes)
22F2:22FAUnused 9 bytes
22FBp2RefAlienDXPlayer 2 reference-alien delta X
22FCp2RefAlienYrPlayer 2 reference-alien Y coordinate
22FDp2RefAlienXrPlayer 2 reference-alien X coordinate
22FEp2RackCntPlayer 2 rack-count (starts at 0 but get incremented to 1-8)
22FFp2ShipsRemShips remaining after current dies

Stack

2300:23DD Unused (stack space)
23DE:23FFIn the emulator the stack consumes this area (roughly 16 levels)