Enemy formation
Enemies held in a fixed arrangement that moves as one, from which some may break off to attack.
On this page
An enemy formation keeps enemies in a fixed arrangement that moves as a whole. Space Invaders draws all 55 aliens from one reference alien, so the rack moves as one block1. Galaxian holds its swarm in place while aliens leave it to attack, a flagship with up to two escorts or single aliens, at most 7 in flight2.
- Marching rackSpace Invaders (1978). 55 aliens drawn from one reference alien move as a single block.1,3
- Break-offGalaxian (1979). The swarm holds formation while single aliens and escorted flagships dive out of it.2
Games
| Game | Year | How | Note |
|---|---|---|---|
| Space Invaders | 1978 | Marching rack | 55 aliens drawn from one reference alien move as a single block |
| Galaxian | 1979 | Break-off | the swarm holds formation while single aliens and escorted flagships dive out of it |
Every claim about this mechanic, by game (1)
References
- ^ abSpace 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'sDrawAlienhas drawn it. Only when the cursor passes the last of the 55 slots doesMoveRefAlienstep 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'sinvadersset, Midway's release.CodeComputer Archeology, Space InvadersHow we know
7>>> binary 0000:roms/invaders.h + roms/invaders.g + roms/invaders.f.diag + roms/invaders.econtent/Arcade/SpaceInvaders/Code.md line 7 at 1adc2a7 · upstream ↗ 28If I understand this right then the system gets RST 8 when the beam is *near* the middle of the screen and RST 10content/Arcade/SpaceInvaders/Hardware.md lines 28–33 at 1adc2a7 · upstream ↗ 120; Main game-play timing loop ⋮ 1240078: CD 00 01 CALL $0100 ; {code.DrawAlien} Draw the current alien (or exploding alien)
content/Arcade/SpaceInvaders/Code.md lines 120–124 at 1adc2a7 · upstream ↗ 138; Continues here at scanline 96 ⋮ 15400AB: CD 41 01 CALL $0141 ; {code.CursorNextAlien} Advance cursor to next alien (move the alien if it is last one)
content/Arcade/SpaceInvaders/Code.md lines 138–155 at 1adc2a7 · upstream ↗ 248CursorNextAlien: ⋮ 2600146: 3A 00 20 LD A,($2000) ; {ram.waitOnDraw} Still waiting on ... 2610149: A7 AND A ; ... this alien to be drawn? 262014A: C0 RET NZ ; Yes ... leave cursor in place ⋮ 2670154: 3C INC A ; Have we drawn all aliens ... 2680155: FE 37 CP $37 ; ... at last position? 2690157: CC A1 01 CALL Z,$01A1 ; {code.MoveRefAlien} Yes ... move the bottom/right alien and reset index to 0 270015A: 6F LD L,A ; HL now points to alien flag 271015B: 46 LD B,(HL) ; Is alien ... 272015C: 05 DEC B ; ... alive? 273015D: C2 54 01 JP NZ,$0154 ; {} No ... skip to next alien
content/Arcade/SpaceInvaders/Code.md lines 248–273 at 1adc2a7 · upstream ↗ 319MoveRefAlien: 320; The "reference alien" is the bottom left. All other aliens are drawn relative to this 321; reference. This routine moves the reference alien (the delta is set elsewhere) and toggles ⋮ 32601A5: 21 06 20 LD HL,$2006 ; Set current alien ... 32701A8: 36 00 LD (HL),$00 ; ... index to 0 ⋮ 33101AE: CD D9 01 CALL $01D9 ; {code.AddDelta} Move alien
content/Arcade/SpaceInvaders/Code.md lines 319–331 at 1adc2a7 · upstream ↗ 3910; The game starts with 55 aliens. The aliens are move/drawn one per interrupt which means itcontent/Arcade/SpaceInvaders/Code.md lines 3909–3911 at 1adc2a7 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-25.
Checked by a second AI model, 2026-10-21.
Checked by a second AI model, 2026-10-25.
- ^ abGalaxian's swarm holds its formation while aliens break off from it to attack. An array of 8 in-flight slots holds them: slot 1 for a flagship, slots 2 and 3 for its escorts, of which there are at most 2, and slots 4 to 7 for single attackers, so at most 7 aliens fly at once. No attack uses slot 0, which the disassembly's comment says is kept for other uses such as explosions. A single attack scans only of the last four slots, where and are the two difficulty values, so 1 to 4 single attackers can fly at once.CodeScottTunstall/Galaxianrevised
How we know
50791472: DD 21 D0 42 ld ix,$42D0 ; pointer to INFLIGHT_ALIENS_START+sizeof(INFLIGHT_ALIEN) 50801476: CD 5C 14 call $145C ; call INIT_INFLIGHT_ALIEN to make flagship take flight and leave the swarm ⋮ 5084147D: FD 21 F0 42 ld iy,$42F0 ; pointer to INFLIGHT_ALIENS_START+(sizeof(INFLIGHT_ALIEN) * 2) 50851481: 06 03 ld b,$03 ; we're scanning 3 entries in red aliens row max 50861483: 0E 02 ld c,$02 ; But we only want 2 red aliens as an escort. ⋮ 5094148E: CD 9B 14 call $149B ; call TRY_INIT_ESCORT_INFLIGHT_ALIEN 50951491: 11 20 00 ld de,$0020 ; sizeof(INFLIGHT_ALIEN) 50961494: FD 19 add iy,de ; bump IY to point to next member of INFLIGHT_ALIENS array 50971496: 0D dec c ; reduce count of red aliens left to check for use as escort 50981497: C0 ret nz ; return if we have all the escort we need 50991498: 06 01 ld b,$01
galaxian.asm lines 5079–5100 at a16b402 · upstream ↗ FLAGSHIP_ESCORT_COUNT EQU $422A ; Number of red aliens escorting the flagship. Max value of 2.
galaxian.asm#L517 · upstream ↗ 47841352: 2A 1A 42 ld hl,($421A) ; load H with DIFFICULTY_BASE_VALUE and L with DIFFICULTY_EXTRA_VALUE 47851355: 7C ld a,h ; 47861356: 85 add a,l ; add DIFFICULTY_EXTRA_VALUE to DIFFICULTY_BASE_VALUE 47871357: 1F rra ; divide by 2. 47881358: FE 04 cp $04 ; is result < 4? 4789135A: 38 02 jr c,$135E ; yes, goto $135E. 4790135C: 3E 03 ld a,$03 ; Clamp maximum number of INFLIGHT_ALIEN slots to scan to 3. 4791135E: 3C inc a ; ensure that slots to scan is in range of 1..4 ⋮ 4796135F: 47 ld b,a ; save number of slots to scan in B 47971360: 21 91 43 ld hl,$4391 ; point HL to last INFLIGHT_ALIEN.IsDying flag in INFLIGHT_ALIENS array 47981363: 11 E1 FF ld de,$FFE1 ; load DE with -31, which is sizeof(INFLIGHT_ALIEN)-1
galaxian.asm lines 4784–4800 at a16b402 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-25.
Revised after a check by a second AI model, 2026-10-21.
Checked by a second AI model, 2026-10-25.
- ^When the rack bumps an edge,
RackBumpreverses 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), andMoveRefAlienclears 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.CodeComputer Archeology, Space InvadersHow we know
31631597: 3A 0D 20 LD A,($200D) ; {ram.rackDirection} Get rack direction 3164159A: A7 AND A ; Moving right? 3165159B: C2 B7 15 JP NZ,$15B7 ; {} No ... handle moving left ⋮ 317015A5: 06 FE LD B,$FE ; Delta X of -2 317115A7: 3E 01 LD A,$01 ; Rack now moving right ⋮ 317315A9: 32 0D 20 LD ($200D),A ; {ram.rackDirection} Set new rack direction 317415AC: 78 LD A,B ; B has delta X 317515AD: 32 08 20 LD ($2008),A ; {ram.refAlienDXr} Set new delta X 317615B0: 3A 0E 20 LD A,($200E) ; {ram.rackDownDelta} Set delta Y ... 317715B3: 32 07 20 LD ($2007),A ; {ram.refAlienDYr} ... to drop rack by 8 ⋮ 318315BE: CD F1 18 CALL $18F1 ; {} Get moving-right delta X value of 2 (3 if just one alien left) 318415C1: AF XOR A ; Rack now moving left ⋮
content/Arcade/SpaceInvaders/Code.md lines 3163–3185 at 1adc2a7 · upstream ↗ 368418F1: 06 02 LD B,$02 ; Rack moving right delta X 368518F3: 3A 82 20 LD A,($2082) ; {ram.numAliens} Number of aliens on screen 368618F6: 3D DEC A ; Just one left? 368718F7: C0 RET NZ ; No ... use right delta X of 2 368818F8: 04 INC B ; Just one alien ... move right at 3 instead of 2
content/Arcade/SpaceInvaders/Code.md lines 3684–3689 at 1adc2a7 · upstream ↗ 39301E4: 06 C0 LD B,$C0 ; Number of bytes 39401E6: 11 00 1B LD DE,$1B00 ; RAM mirror in ROM 39501E9: 21 00 20 LD HL,$2000 ; Start of RAM 39601EC: C3 32 1A JP $1A32 ; {code.BlockCopy} Copy [DE]->[HL] and return
content/Arcade/SpaceInvaders/Code.md lines 393–396 at 1adc2a7 · upstream ↗ 40721B00: 01 00 00 10 00 00 00 00 02 78 38 78 38 00 F8 00content/Arcade/SpaceInvaders/Code.md line 4072 at 1adc2a7 · upstream ↗ 32601A5: 21 06 20 LD HL,$2006 ; Set current alien ... ⋮ 32801AA: 23 INC HL ; Point to DeltaX 32901AB: 4E LD C,(HL) ; Load DX into C 33001AC: 36 00 LD (HL),$00 ; Set DX to 0 33101AE: CD D9 01 CALL $01D9 ; {code.AddDelta} Move alien
content/Arcade/SpaceInvaders/Code.md lines 326–331 at 1adc2a7 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-25.
Checked by a second AI model, 2026-10-21.
Checked by a second AI model, 2026-10-25.
Sources
Code
- Cantrell, Christopher. 2026. “Computer Archeology: Space Invaders.” Commit 1adc2a7. topherCantrell/computerarcheology @ 1adc2a7 · licence, all uses
- Tunstall, Scott. 2025. “Galaxian: annotated reverse engineering.” Commit a16b402. ScottTunstall/Galaxian @ a16b402 · licence, all uses