Space Invaders moves its rack of aliens one alien per frame. The interrupt at scanline 96 calls CursorNextAlien, which skips dead aliens to the next live one and waits until the end-of-screen interrupt's DrawAlien has drawn it. Only when the cursor passes the last of the 55 slots does MoveRefAlien step the reference alien, from which every other alien is drawn. A step of the rack therefore takes one 60 Hz frame per live alien: 55 frames at the start, 1 for the last alien. The listing reads MAME's invaders set, Midway's release. | content/Arcade/SpaceInvaders/Code.md L7content/Arcade/SpaceInvaders/Hardware.md L28–33content/Arcade/SpaceInvaders/Code.md L120–124content/Arcade/SpaceInvaders/Code.md L138–155content/Arcade/SpaceInvaders/Code.md L248–273content/Arcade/SpaceInvaders/Code.md L319–331content/Arcade/SpaceInvaders/Code.md L3909–3911 | Code |
When the rack bumps an edge, RackBump reverses it and drops it 8 px: it sets the next step's drop from $200E, which the game's RAM copy fills with $F8 (-8), and MoveRefAlien clears the drop after one step. Its step to the right is 2 px, or 3 px when one alien is left; its step to the left is always 2 px. | content/Arcade/SpaceInvaders/Code.md L3163–3185content/Arcade/SpaceInvaders/Code.md L3684–3689content/Arcade/SpaceInvaders/Code.md L393–396content/Arcade/SpaceInvaders/Code.md L4072content/Arcade/SpaceInvaders/Code.md L326–331 | Code |
Each pass of the game loop, SpeedShots checks the number of aliens left; below 9 it sets the alien shots' step ($207E, added to a shot's Y each move) to $FB, -5 px, in place of the $FC (-4 px) that the game's RAM copy puts there, so the aliens' shots fall faster. | content/Arcade/SpaceInvaders/Code.md L1503–1507content/Arcade/SpaceInvaders/Code.md L1404–1412content/Arcade/SpaceInvaders/Code.md L1093–1097content/Arcade/SpaceInvaders/Code.md L393–396content/Arcade/SpaceInvaders/Code.md L4083 | Code |
| Space Invaders awards one extra ship per player when the upper two digits of the score reach 15, or 10 with DIP switch bit 3 set: at 1,500 or 1,000 points. It then clears the player's award flag, so no second ship follows. | content/Arcade/SpaceInvaders/Code.md L1574–1592content/Arcade/SpaceInvaders/Code.md L1606–1609 | Code |
Each new rack starts lower on the screen. The first rack's bottom row starts at Y $78. When a rack is cleared, the count of racks beaten (taken mod 8, plus 1) picks the next start from an 8-entry table, $60, $50, $48, $48, $48, $40, $40, $40, so the 10th rack starts where the 2nd did. | content/Arcade/SpaceInvaders/Code.md L1717–1731content/Arcade/SpaceInvaders/Code.md L4685–4696content/Arcade/SpaceInvaders/Code.md L1378–1379 | Code |
Space Invaders keeps one high score, four BCD digits at $20F4–$20F5. When a player's game ends, it compares that player's score with it, upper digits first, and copies the score over it if the score is higher. | content/Arcade/SpaceInvaders/Code.md L3303–3327 | Code |
| Computer Archeology credits Mikael Agren with patching the original Space Invaders ROMs to add a high-score table. | content/Arcade/SpaceInvaders/README.md L31–35 | Code notes |
The shields are pixels in the 1-bit screen bitmap, not objects. Each player has a RAM buffer of four copies of the 44-byte ShieldImage, 22 rows of 2 bytes, a 22 × 16 px shape of 294 lit pixels (computed); RestoreShields ORs the buffer onto the screen, the four shields with 23 rows between them (45 from start to start), and in a two-player game RememberShields copies them from the screen back into the player's buffer, so each player keeps their own damage. The buffers are redrawn from the image at the start of a game and with each new rack. | content/Arcade/SpaceInvaders/Code.md L413–420content/Arcade/SpaceInvaders/Code.md L448–455content/Arcade/SpaceInvaders/Code.md L3977–3986content/Arcade/SpaceInvaders/Code.md L2906–2907content/Arcade/SpaceInvaders/Code.md L4563–4590content/Arcade/SpaceInvaders/Code.md L1737–1742content/Arcade/SpaceInvaders/Code.md L1367–1368content/Arcade/SpaceInvaders/Hardware.md L33–35 | Code |
Nothing tests for shields as such. Every shot is drawn with DrawSprCollision, which ANDs each byte of the shifted sprite with the screen before ORing it in and sets the collision flag if any pixel was already lit, so a shot hits a shield when its newly drawn sprite overlaps a lit shield pixel. The player's shot is 1 px wide and 4 px long and moves 4 px a step, so it is tested against every pixel row on its path (computed). A player's shot that collides below the rack takes status 3, the code for a hit on something other than an alien. | content/Arcade/SpaceInvaders/Code.md L2928–2954content/Arcade/SpaceInvaders/Code.md L805–826content/Arcade/SpaceInvaders/Code.md L4319–4320content/Arcade/SpaceInvaders/Code.md L4074content/Arcade/SpaceInvaders/Code.md L3008–3009content/Arcade/SpaceInvaders/Code.md L3057–3060 | Code |
A player's shot that hits a shield erases itself, then ORs the 8 × 8 px ShotExploding pattern onto the screen around the point of impact; after the blow-up timer counts down from 16, EndOfBlowup erases that pattern with an inverted AND. The erase clears every pixel under the pattern's 38 set bits (computed), shield pixels included, and the first erase had already cleared the shield pixels under the shot itself, so the hole is the explosion's shape plus the shot's last 4 px. | content/Arcade/SpaceInvaders/Code.md L770–794content/Arcade/SpaceInvaders/Code.md L836–839content/Arcade/SpaceInvaders/Code.md L2870–2879content/Arcade/SpaceInvaders/Code.md L4336–4345 | Code |
An alien shot ends when its newly drawn sprite collides with any lit pixel, or when it falls below the playfield; a collision at the player's height kills the player instead. Its blow-up timer starts at 4: on the first tick ShotBlowingUp erases the shot and draws the 6 × 8 px AShotExplo pattern, and on the tick that reaches 0 it erases that pattern with an inverted AND, so a shield loses the pattern's 26 pixels (computed) plus those under the shot itself. | content/Arcade/SpaceInvaders/Code.md L1098–1116content/Arcade/SpaceInvaders/Code.md L1149–1179content/Arcade/SpaceInvaders/Code.md L4454–4461content/Arcade/SpaceInvaders/Code.md L4075 | Code |
Aliens that reach the shields erase them. DrawSprite, which draws each alien, stores the shifted sprite bytes over the screen instead of ORing them in, both bytes of each of its 16 rows, so wherever an alien is drawn the shield pixels in those bytes are replaced by the alien's image and its blank pixels. The disassembly's comment on CodeBug1 describes a lone alien that "enters the players shields on the lower left where it begins to eat them". | content/Arcade/SpaceInvaders/Code.md L3198–3215content/Arcade/SpaceInvaders/Code.md L235–237content/Arcade/SpaceInvaders/Code.md L3023–3026 | Code |