Claim set · data/claims/galaxian.yaml

Galaxian (Scott Tunstall's annotated disassembly)

Game: Galaxian.

Galaxian counts the aliens still in the swarm, leaving out those in flight, and sets HAVE_AGGRESSIVE_ALIENS when 3 or fewer remain. With the flag set, an attacking alien other than a flagship that reaches the bottom of the screen reappears at the top and attacks again instead of rejoining the swarm, once the player has spawned; before that, it rejoins. Flagships take a separate routine. The disassembly reads the Namco ROM, MAME's galaxian set. galaxian/aggression

About: Galaxian Remaining-enemy speed-up

Value: 3 aliens left in the swarm (threshold)

CodeGalaxian: annotated reverse engineering · galaxian.asm#L5058-L5059INIT_INFLIGHT_ALIEN: 145C: 36 00 ld (hl),$00 ; clear flag in ALIEN_SWARM_FLAGS - effectively removing it from swarmGalaxian: annotated reverse engineering · galaxian.asm#L5615-L5658HANDLE_ALIEN_AGGRESSIVENESS: … 16BD: 21 23 41 ld hl,$4123 ; load HL with address of first alien (bottom rightmost) in ALIEN_SWARM_FLAGS 16C0: 11 06 00 ld de,$0006 ; DE is an offset to add to HL after processing a row of aliens 16C3: 4B ld c,e ; Conveniently, E is also number of rows of aliens in swarm! (6) 16C4: 3E 01 ld a,$01 ; A is going to be used to total the number of aliens in the swarm 16C6: 06 0A ld b,$0A ; 10 aliens maximum per row 16C8: 86 add a,(hl) … 16D4: 06 03 ld b,$03 ; number of ports to write to maximum 16D6: 3D dec a ; decrement total by 1 16D7: 28 14 jr z,$16ED ; if total is zero, goto $16ED …Galaxian: annotated reverse engineering · galaxian.asm#L3747-L3772INFLIGHT_ALIEN_REACHED_BOTTOM_OF_SCREEN: … ; is this alien a flagship? ; yes, goto INFLIGHT_ALIEN_FLAGSHIP_REACHED_BOTTOM_OF_SCREEN … ;if the player has not spawned, the alien will return to the swarm. … ; read HAVE_AGGRESSIVE_ALIENS flag … ; if aliens are aggressive, make alien reappear at top of screen, keep … ; alien reappears at top of screen and will keep attacking - it will not return to swarm.Galaxian: annotated reverse engineering · galaxian.asm#L167-L168the manual above is not correct with the Namco Galaxian ROMChecked by claude, 2026-10-25 — read HANDLE_ALIEN_AGGRESSIVENESS (16B8-16F2): A starts at 1 and adds the 60 swarm flags, then is decremented up to three times; a swarm of 3 or fewer leaves A below 2 (or 0 by the branch at 16ED), which sets $4224. INIT_INFLIGHT_ALIEN (145C) and the escort routine (14A5) clear an alien's swarm flag when it takes flight, so fliers aren't counted. Read the bottom-of-screen branch (0E99-0EBD): a flagship goes to its own routine; before the player spawns, and when neither $4224 nor $4221 is set, the alien returns to the swarm

The same branch also keeps attackers in play when no blue or purple aliens remain (HAVE_NO_BLUE_OR_PURPLE_ALIENS).

Cited by: Galaxian, Remaining-enemy speed-up

Galaxian'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 min⁡(⌊(b+e)/2⌋,3)+1 of the last four slots, where b and e are the two difficulty values, so 1 to 4 single attackers can fly at once. galaxian/attackers

About: Galaxian Enemy formation

Value
{
 "maxInFlight": 7,
 "flagshipEscorts": 2,
 "singleAttackers": [
  1,
  4
 ]
}
CodeGalaxian: annotated reverse engineering · galaxian.asm#L5079-L51001472: DD 21 D0 42 ld ix,$42D0 ; pointer to INFLIGHT_ALIENS_START+sizeof(INFLIGHT_ALIEN) 1476: CD 5C 14 call $145C ; call INIT_INFLIGHT_ALIEN to make flagship take flight and leave the swarm … 147D: FD 21 F0 42 ld iy,$42F0 ; pointer to INFLIGHT_ALIENS_START+(sizeof(INFLIGHT_ALIEN) * 2) 1481: 06 03 ld b,$03 ; we're scanning 3 entries in red aliens row max 1483: 0E 02 ld c,$02 ; But we only want 2 red aliens as an escort. … 148E: CD 9B 14 call $149B ; call TRY_INIT_ESCORT_INFLIGHT_ALIEN 1491: 11 20 00 ld de,$0020 ; sizeof(INFLIGHT_ALIEN) 1494: FD 19 add iy,de ; bump IY to point to next member of INFLIGHT_ALIENS array 1496: 0D dec c ; reduce count of red aliens left to check for use as escort 1497: C0 ret nz ; return if we have all the escort we need …Galaxian: annotated reverse engineering · galaxian.asm#L517FLAGSHIP_ESCORT_COUNT EQU $422A ; Number of red aliens escorting the flagship. Max value of 2.Galaxian: annotated reverse engineering · galaxian.asm#L4784-L48001352: 2A 1A 42 ld hl,($421A) ; load H with DIFFICULTY_BASE_VALUE and L with DIFFICULTY_EXTRA_VALUE 1355: 7C ld a,h ; 1356: 85 add a,l ; add DIFFICULTY_EXTRA_VALUE to DIFFICULTY_BASE_VALUE 1357: 1F rra ; divide by 2. 1358: FE 04 cp $04 ; is result < 4? 135A: 38 02 jr c,$135E ; yes, goto $135E. 135C: 3E 03 ld a,$03 ; Clamp maximum number of INFLIGHT_ALIEN slots to scan to 3. 135E: 3C inc a ; ensure that slots to scan is in range of 1..4 … 135F: 47 ld b,a ; save number of slots to scan in B 1360: 21 91 43 ld hl,$4391 ; point HL to last INFLIGHT_ALIEN.IsDying flag in INFLIGHT_ALIENS array 1363: 11 E1 FF ld de,$FFE1 ; load DE with -31, which is sizeof(INFLIGHT_ALIEN)-1Checked by claude, 2026-10-25 — read the slot scan at 1352-1367 (min((base + extra) / 2, 3) + 1 slots, from the last slot back, 32 bytes each from $42B0) and the flagship attack at 1472-149A (the flagship in slot 1, $42D0; escorts from slot 2, $42F0, stepping 32 bytes, at most 2). The use of slot 0 for explosions is the disassembly's comment (L576-L577); no attack routine cited takes slot 0

Cited by: Enemy formation, Galaxian

Galaxian's difficulty has two parts. A base value rises by 1 with each level cleared, up to 7. An extra value starts each level at 0 and rises by 1 each time two nested counters run out, up to 7. The counters reload to 60 and 20, so once running they step it every 1,200 passes of the game logic, but the cited code doesn't reset them when a level starts, so a level's first step can come sooner. They hold while the player is not in play or after a flagship in flight is shot. The two values set how many single attackers may fly at once and how many attack counters tick. galaxian/difficulty

About: Galaxian Difficulty ramp

Value
{
 "baseMax": 7,
 "extraMax": 7,
 "extraStep": 1200
}
CodeGalaxian: annotated reverse engineering · galaxian.asm#L493-L499; These 2 counters are used to gradually increase the DIFFICULTY_EXTRA_VALUE over time. See $14F3 for algorithm details. … ; These values determine how often aliens attack (see $1524 and $1583), and how many can attack at one time (see $1352). DIFFICULTY_EXTRA_VALUE EQU $421A ; DIFFICULTY_EXTRA_VALUE is incremented during the level. Maximum value of 7. See $1509. DIFFICULTY_BASE_VALUE EQU $421B ; DIFFICULTY_BASE_VALUE is incremented when you complete a level. Maximum value of 7. See $1656.Galaxian: annotated reverse engineering · galaxian.asm#L5183-L5214HANDLE_LEVEL_DIFFICULTY: 14F3: 3A 00 42 ld a,($4200) ; read HAS_PLAYER_SPAWNED 14F6: 0F rrca ; move flag into carry 14F7: D0 ret nc ; return if player has not spawned 14F8: 3A 2B 42 ld a,($422B) ; read IS_FLAGSHIP_HIT 14FB: 0F rrca ; move flag into carry 14FC: D8 ret c ; return if flagship has been hit … 14FD: 21 18 42 ld hl,$4218 ; load HL with address of DIFFICULTY_COUNTER_1 1500: 35 dec (hl) ; decrement counter 1501: C0 ret nz 1502: 36 3C ld (hl),$3C ; reset counter …Galaxian: annotated reverse engineering · galaxian.asm#L5504-L55191649: AF xor a 164A: 32 1A 42 ld ($421A),a ; reset DIFFICULTY_EXTRA_VALUE … 1656: 2A 1B 42 ld hl,($421B) ; load H with PLAYER_LEVEL and L with DIFFICULTY_BASE_VALUE 1659: 24 inc h ; increment player level 165A: 7D ld a,l ; load A with DIFFICULTY_BASE_VALUE 165B: FE 07 cp $07 ; are we at max difficulty? 165D: 28 03 jr z,$1662 ; yes, goto $1662 … 1661: 3C inc a ; otherwise, increment DIFFICULTY_BASE_VALUE 1662: 6F ld l,a 1663: 22 1B 42 ld ($421B),hl ; update PLAYER_LEVEL and DIFFICULTY_BASE_VALUEGalaxian: annotated reverse engineering · galaxian.asm#L2040-L2055HANDLE_MAIN_GAME_LOGIC: … ; call HANDLE_LEVEL_DIFFICULTYChecked by claude, 2026-10-25 — read HANDLE_LEVEL_DIFFICULTY (14F3-1514): it returns unless the player has spawned and no flagship hit is pending, counts $4218 down from 60 and $4219 from 20, and raises $421A to at most 7; the level-start code (1649-1663) zeroes $421A and raises $421B to at most 7, and touches neither counter

How often HANDLE_MAIN_GAME_LOGIC runs, once per frame or otherwise, isn't read here, so the step is given in passes, not seconds.

Cited by: Difficulty ramp, Galaxian

Galaxian awards one extra ship, a "bonus galixip", when the score's top digits reach the DIP setting: 7,000, 10,000, 12,000, or 20,000 points. A per-player flag then blocks any further award. galaxian/bonus-galixip

About: Galaxian Extra life

Value
[
 7000,
 10000,
 12000,
 20000
]
CodeGalaxian: annotated reverse engineering · galaxian.asm#L907-L9110128: 3A 00 70 ld a,($7000) ; read state of dip switch 3,4,5,6 012B: E6 03 and $03 ; mask in state of dip switches 3 & 4 012D: 21 52 01 ld hl,$0152 0130: E7 rst $20 ; call routine to fetch value @ HL + A 0131: 32 AC 40 ld ($40AC),a ; write BONUS GALIXIP @ valueGalaxian: annotated reverse engineering · galaxian.asm#L9270152: 07 10 12 20Galaxian: annotated reverse engineering · galaxian.asm#L7586-L759721C2: 1B dec de ; point to 3rd and 4th digits of player score 21C3: 67 ld h,a ; load H with first two digits of player score 21C4: 1A ld a,(de) 21C5: 6F ld l,a ; load L with 3rd and 4th digits of player score 21C6: 29 add hl,hl 21C7: 29 add hl,hl 21C8: 29 add hl,hl 21C9: 29 add hl,hl ; multiply HL * 16, which shifts all bits left 4 places. 21CA: 7C ld a,h 21CB: 21 AC 40 ld hl,$40AC ; read BONUS_GALIXIP_FOR value 21CE: BE cp (hl) 21CF: D4 9C 22 call nc,$229C ; call AWARD_EXTRA_LIFE if our score is higherGalaxian: annotated reverse engineering · galaxian.asm#L7809-L7822AWARD_EXTRA_LIFE: … ; if flag is set, then return. Player gets no more extra lives. … ; Set "Player has had his extra life" flag … ; increment number of livesChecked by claude, 2026-10-25 — read 0128-0131 with the BCD table at 0152 ($07, $10, $12, $20), the compare at 21C2-21CF (the score's ten-thousands and thousands digits shifted into H, an award when H is not below the table value), and AWARD_EXTRA_LIFE at 229C-22B1 (a flag per player at $40AD + CURRENT_PLAYER)

Cited by: Extra life