Defender
Williams' 1981 scrolling arcade shooter, read through Eugene Jarvis and Sam Dicker's original 6809 source for the Red Label release.
On this page
The atlas reads Defender through its original 6809 source by Eugene Jarvis and Sam Dicker, the Red Label release, as Robert Hargreaves made it assemble1. Labels and comments cited here are the programmers’.
The ship has inertia only from side to side. Its horizontal speed loses 1/64 of itself every frame and thrust adds a fixed amount, so thrust alone levels off at damped 1/64 a frame; thrust levels off at 6 pixels a frame, under an 8-pixel cap1. Up and down start at once and stop at once2. The world is a loop 2,048 pixels around3, and the scanner shows all of it, centered on the view4.
A smart bomb destroys the objects on screen of types 0 and 1, normal enemies and landers picking up a humanoid; humanoids and other types are spared. Players start with one bomb per ship5. Hyperspace drops the ship somewhere random and kills it on 63 of 256 values6. Each replay, every 10,000 points by default, adds a ship and a smart bomb7.
Landers carry humanoids to the top of the screen, where each humanoid dies and its lander becomes a mutant8. A humanoid dropped by a shot lander can be caught and set down: 500 to catch, 500 to set down, 250 for a safe fall9. When the last humanoid dies the planet’s terrain blows up, and the landers become mutants; by default every fifth wave brings 10 humanoids back10. Waves 1 to 4 read their enemy counts from a table, and later waves keep the fourth’s: landers 15, 20, 20, 20; bombers 0, 3, 4, 5; pods 0, 1, 3, 411.
Mechanics
| Mechanic | Kind | How |
|---|---|---|
| Inertia | Drag always | horizontal speed damped by 1/64 every frame, so thrust levels off at 6 pixels a frame; up and down stop at once |
| Screen wrap | Looping world | a world 2,048 pixels around, joined through 16-bit coordinates |
| Minimap | Whole world | the scanner shows every object on the planet, with the view at its center |
| Smart bomb | On screen | destroys on-screen objects of types 0 and 1, so humanoids and other types are spared; one per ship to start |
| Hyperspace | Flat risk | a random place in the world, and death on 63 of 256 values |
| Rescue | Catch and return | 500 for catching a falling humanoid and 500 for setting it down; landers that carry one off become mutants |
| Difficulty ramp | Level table | enemy counts for waves 1 to 4 from a table, the fourth repeated after |
| Extra life | Repeating | a ship and a smart bomb every 10,000 points by default |
Every claim about this game, by concept (11)
References
- ^ abDefender moves its ship once per video frame: the interrupt calls the player routine once each time the beam passes line 128. Each call damps the horizontal velocity by 1/64 of itself, then a held thrust button adds 3/256 of a velocity unit in the facing direction (reverse negates it), and the velocity is held to ±1 unit. A unit is 256 world units, 8 pixels, a frame (the world has 32 units to a pixel). Since the damping runs every frame, thrust alone levels off at 3 × 64 = 192/256 of a unit, 6 pixels a frame, below the cap (computed). The source is the Red Label release.Codemwenge/defender
How we know
75The game source code for Defender in [src](src) was originally retrieved from 76https://github.com/historicalsource/defender. It is the Motorola 6809 assembly language 77source code for the 'Red Label' version of the game.
README.md lines 75–77 at e740063 · upstream ↗ 1937 LDA VERTCT ;PAST 128 1938 CMPA #128 1939 BLO I0 ;NO 1940 LDA IFLG ;ALREADY DONE ? 1941 BNE IRQX ;NO 1942 INC IFLG ⋮ 1944 JSR PLAYER
src/defa7.src lines 1931–1944 at e740063 · upstream ↗ 1960I0 LDB IFLG 1961 BEQ IRQX 1962 CLR IFLG
src/defa7.src lines 1960–1962 at e740063 · upstream ↗ 2336*PLAYER PROCESS 2337*CALLED FORM IRQ ⋮ 2342*X DAMPING 2343 CLR ITEMP 2344 LDD PLAXV 2345 COMA 2346 COMB 2347 ADDD #1 ;NEGD 2348 BPL PL00 2349 COM ITEMP ;SIGN EXTEND 2350PL00 ASLB ; SHIFT 2351 ROLA ⋮
src/defa7.src lines 2336–2371 at e740063 · upstream ↗ 2421 LDD PLAXV 2422 CMPD #$0100 ;MAX VEL 2423 BLT PV11 2424 LDD #$0100 2425PV11 CMPD #-$0100 2426 BGT PV12 2427 LDD #-$0100 2428PV12 STD PLAXV 2429 ADDD BGL 2430 SUBD BGDELT 2431 STD BGL
src/defa7.src lines 2420–2431 at e740063 · upstream ↗ 1249 LDD #$0300 1250 STD PLADIR ;THRUST+DIRECTION
src/defa7.src lines 1249–1250 at e740063 · upstream ↗ 3155*REVERSE ⋮ 3160 LDD PLADIR 3161 COMB 3162 COMA 3163 ADDD #1 3164 STD NPLAD
src/defa7.src lines 3155–3164 at e740063 · upstream ↗ 3333ISCAN LDD BGL 3334 SUBD #100*32 ;100 PIXEL LEFT BUFFER
src/defa7.src lines 3333–3334 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^Up and down have no inertia in Defender: a held direction moves the ship 1 pixel a frame at once, rising by 8/256 of a pixel each frame to 2 pixels a frame (after 32 frames, computed), and letting go stops it. The ship stops climbing once at row 43 or higher, and descending at row 238 or lower.Codemwenge/defender
How we know
2441*VERTICAL MOTION 2442 LDB PLAY16 ;GET ADDR FOR LIMIT CHK 2443 LDA PIA31 ;UP? 2444 LSRA 2445 BCS PLAUP ;YES 2446 LDA PIA21 2447 BMI PLADN ;DOWN 2448 LDD #0 2449 BRA PYV1 2450PLAUP CMPB #YMIN+1 2451 BLS PLAYX 2452 LDD PLAYV ⋮
src/defa7.src lines 2441–2476 at e740063 · upstream ↗ 20YMAX EQU 240 21YMIN EQU 42 ;MIN Y COORD
src/phr6.src lines 20–21 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^Defender's world is a loop: objects keep 16-bit X world coordinates, 32 units to a pixel, so the world is 65,536 units, 2,048 pixels, around and joins itself through 16-bit overflow (computed). Objects off the screen also wrap from the bottom (row 240) to the top (row 42) and back.Codemwenge/defender
How we know
480OX16 EQU $A ;16 BIT X WORLD COORD 481OY16 EQU $C ;16 BIT Y WORLD COORD
src/phr6.src lines 480–481 at e740063 · upstream ↗ 3333ISCAN LDD BGL 3334 SUBD #100*32 ;100 PIXEL LEFT BUFFER ⋮ 3345 ADDD OY16,X 3346 CMPA #YMIN ;WRAP AROUND 3347 BHS SCYV3 3348 LDA #YMAX 3349SCYV3 CMPA #YMAX 3350 BLS SCYV4 3351 LDA #YMIN 3352SCYV4 STD OY16,X ;ADD 8 TIMES VELOCITY 3353 LDD OXV,X ;UPDATE X POSITION ⋮ 3360 ADDD OX16,X ⋮
src/defa7.src lines 3333–3363 at e740063 · upstream ↗ 20YMAX EQU 240 21YMIN EQU 42 ;MIN Y COORD
src/phr6.src lines 20–21 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^Defender's scanner draws every object, on the active and the inactive list alike, as a blip. Its left edge sits half the world (less 150 pixels) behind the screen's left edge, so the view stays at the scanner's middle. An object's offset from that edge, cut to its top 6 bits, and its row divided by 8 give the blip's screen address: 64 places across the whole world (computed).Codemwenge/defender
How we know
1199MT1 LDD BGL ;CALC SCANL 1200 SUBD #$8000-(150*32)
src/amode1.src lines 1199–1200 at e740063 · upstream ↗ 1236*OUTPUT BOZOS 1237 LDX #OPTR ⋮ 1240 LDX #IPTR
src/amode1.src lines 1236–1242 at e740063 · upstream ↗ 1262SCNR10 LDD OX16,X ;FIND OFFSET 1263 SUBD XTEMP ;SUBTRACT SCANNER LEFT 1264SCNR2 LSRA ;SHIFT DOWN TO 6 BITS 1265 LSRA 1266 LDB OY16,X 1267 LSRB 1268 LSRB 1269 LSRB 1270 ADDD #SCANER-1 1271 STD ,U 1272 LDD OBJCOL,X ;STORE BLIP
src/amode1.src lines 1262–1275 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^A smart bomb works when none is already going off and the player has one left: it takes one and runs the collision routine of every active object that is on the screen and of type 0 or 1 (normal objects and landers picking someone up), destroying them. Objects of type 2 and up are skipped, among them the humanoids, type $10, "NON SMART BOMB". Players start with as many smart bombs as ships.Codemwenge/defenderrevised
How we know
3173*SMART BOMB ⋮ 3175SBOMB LDA SBFLG 3176 BNE SBMBX2 3177 LDX PLRX 3178 LDA PSBC,X 3179 BEQ SBMBX2 3180 INC SBFLG 3181 DEC PSBC,X ⋮ 3185SBMB00 LDX OPTR 3186SBMB0 BEQ SBMBX 3187 LDD OBJX,X 3188 BEQ SBMB2 ⋮
src/defa7.src lines 3173–3209 at e740063 · upstream ↗ 476OBJX EQU 4 ;UPPER LEFT SCREEN X ⋮ 479OCVECT EQU 8 ;COLLISION ROUTINE ADDR ⋮ 491*USER DEFINED OBJECT TYPES 492*0=NORMAL,HYPERABLE 493*1=LANDER PICKING UP NON-HYP 494*2(BIT 1)= APPEAR NON-HYP 495*$10=EARTHLING NON-HYP,NON SMART BOMB
src/phr6.src lines 476–496 at e740063 · upstream ↗ 302 LDD OBJX,X ;ON SCREEN?src/defb6.src line 302 at e740063 · upstream ↗ 1142 LDX #NSHIP 1143 JSR RCMOSA 1144 ANDA #$F 1145 STA P1LAS 1146 LDB #10 1147 STD P1SBC ;10-->P1TRG ALSO PATCH 2
src/defa7.src lines 1142–1147 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Revised after a check by a second AI model, 2026-10-22.
- ^Hyperspace works only in normal play (status bits other than the no-terrain bit clear). It clears the screen, removes the bullets, moves the view to a random place in the world, faces the ship a random way, sets a random height, and zeroes the ship's velocity. After the ship reappears and a pause, it dies if a random byte is above 192: 63 of 256 values, about 1 jump in 4 (computed).Codemwenge/defender
How we know
3211*HYPERSPACE ⋮ 3213HYPER LDA STATUS 3214 BITA #$FD 3215 LBNE HYPX ;NO GO ⋮ 3218 JSR SCLR1 ⋮ 3220HYP02 LDX SPTR ;KILL BULLETS ⋮ 3225 LDD SEED 3226 STD BGL ⋮ 3228*RANDOM HYPER DIRECTION 3229 LSRB ⋮ 3238 LDB HSEED 3239 LSRB ⋮
src/defa7.src lines 3211–3278 at e740063 · upstream ↗ 1319STCHK CLRB ; CHECK TERRAIN ACTIVE 1320STCHK0 LDA ASTCNT 1321STCHKA BNE STCHK1 1322 ORB #2
src/defa7.src lines 1319–1323 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^Defender gives an extra ship and an extra smart bomb at each replay level: the level starts at the replay setting and rises by it each time it is passed. The operator default is 10,000 points, with 3 ships to a game.Codemwenge/defender
How we know
510*CHECK REPLAY 511SCRX LDD REPLA ;REPLAYS AVAILABLE 512 BEQ SCRXX ;NO ⋮ 515 BSR RCHK 516 BLO SCRXX ;NO 517 LDA 1,Y ;GET NEXT LEVEL 518 ADDA REPLA+1 ⋮ 525 INC PLAS-1,X 526 INC PSBC-1,X
src/defa7.src lines 510–526 at e740063 · upstream ↗ 1152 LDX #REPLAY 1153 JSR RCMOSD 1154 STD REPLA 1155 STD P1RP
src/defa7.src lines 1152–1156 at e740063 · upstream ↗ 801 FCB $01,$00 ;REPLAY @10,000 802 FCB $03 ;NSHIP
src/romc8.src lines 801–802 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^A Defender lander picks a humanoid from the target list and heads for it. Over it, the lander descends, grabs it, and climbs with it; at the top of the play area it pulls the humanoid inside, which kills the humanoid, and the lander becomes a mutant ("SCHITZO" in the source). Shooting a lander that carries a humanoid starts the humanoid falling.Codemwenge/defender
How we know
688*LANDER KIDNAP ⋮ 693 LDD [PD4,U] ;TARGET ALIVE? ⋮ 703 CMPA XTEMP ;CLOSE? 704 BEQ LANDG0 ;GET IM ⋮ 709 JSR GTARG ;RE:TARGET 710 LBEQ SCZ00 ;NO, FREAK
src/defb6.src lines 688–710 at e740063 · upstream ↗ 737*LETS GET HIM ⋮ 741 STD OYV,X ⋮ 743 STD OPICT,X ⋮ 777*ARE WE ON HIM? ⋮ 788 STD OYV,X ;SPLIT ⋮ 794*FLEE ⋮ 798 CMPA #YMIN+8 799 BLS LANDFX ;ALL DONE ⋮ 802*PULL HIM INSIDE ⋮ 810 DEC LNDCNT ⋮ 814 STD OYV,X ⋮ 823LNDFX1 LEAX ,Y ;KILL ASTRO ⋮
src/defb6.src lines 737–841 at e740063 · upstream ↗ 903*KILL KIDNAPPING LANDER ⋮ 905LKIL1 LDU OBJID,X ;GOT A PASSENGER? ⋮ 911 NEWP AFALL,STYPE ;START HIM FALLING
src/defb6.src lines 903–911 at e740063 · upstream ↗ 1145 FDB LANDV 1146 FDB MUTV ⋮ 1161PICTS FDB LNDP1 1162 FDB SCZP1
src/amode1.src lines 1144–1166 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^A dropped humanoid falls faster each step, up to a limit. Touching it with the ship scores 500 and carries it under the ship, and setting it down on the ground scores 500 more. Left alone, it lands for 250 if its fall speed is $E0 or less, and dies if faster. At the end of each wave, each humanoid left scores 100 times the wave number, at most 500 (computed from the score calls).Codemwenge/defender
How we know
925*ASTRONAUT FALL ⋮ 927AFALL LDX PD,U 928 LDD #8 ;ACCEL DOWNWARD 929 ADDD OYV,X 930 CMPD #$300 ⋮ 934 CMPA OY16,X ;HIT GROUND? 935 BHI AFALL1 ;NO 936 LDD OYV,X 937 CMPD #$E0 ;FATAL? 938 BLS ALAND ;NO ⋮ 942 JSR ASTK1 ⋮ 945AFALL2 LDX PD,U ⋮
src/defb6.src lines 925–962 at e740063 · upstream ↗ 398AKIL1 LDU OBJID,X 399 BEQ ASTKIL ;NOT FALLING 400 LDA PCFLG 401 BEQ AKIL10 ;SHOT 402 LDD PADDR,U ;1ST TIME 403 CMPD #AFALL2 ⋮ 408 NEWP P500,STYPE ⋮ 412AKIL2 LDD #AFALL2
src/defb6.src lines 398–415 at e740063 · upstream ↗ 499P250 OBI C25P1,NOKILL,$0000 500 LDD #$0125 ⋮ 503*500 POINT PROCESS ⋮ 507 LDD #$0150 508P5000 JSR SCORE
src/defb6.src lines 499–508 at e740063 · upstream ↗ 1826 LDA #$01 1827 LDY PLRX 1828 LDB PWAV,Y ;MULTIPLIER 1829 CMPB #5 1830 BLO BCLPA 1831 LDB #5 1832BCLPA ASLB 1833 ASLB 1834 ASLB 1835 ASLB 1836 JSR SCORE
src/defa7.src lines 1822–1836 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^When the last humanoid dies, Defender blows up the planet's terrain. With no humanoids left, a lander that looks for a new target becomes a mutant, and new landers start as mutants. By the operator default, every fifth wave restores the humanoids to 10, the number each player starts with.Codemwenge/defender
How we know
421ASTCLR LEAY ,X ⋮ 432 DEC ASTCNT 433 BNE ASTCX 434 NEWP TERBLO,STYPE ;BLOW UP TERRAIN
src/defb6.src lines 421–434 at e740063 · upstream ↗ 628*GET TARGET FROM LIST 629*RET EQ IF NONE,D=TRG OBJECT ⋮ 632 LDA ASTCNT 633 BEQ GTX ;NOBODY LEFT ⋮ 654LNDST0 TST ASTCNT ;NO MORE TARGETS 655 BNE LNDST1 656 JMP SCZS0
src/defb6.src lines 626–656 at e740063 · upstream ↗ 709 JSR GTARG ;RE:TARGET 710 LBEQ SCZ00 ;NO, FREAK
src/defb6.src lines 706–710 at e740063 · upstream ↗ 1851 LDX #GA1+6 ;GET GA4=RESTORE WAVE ⋮ 1859GTWV00 SUBA XTEMP ;NEW GUYS EVERY NTH WAVE 1860 BLO GTWV01 1861 BNE GTWV00 1862 LDA #10 1863 STA PTARG,X
src/defa7.src lines 1849–1863 at e740063 · upstream ↗ 814 FCB $05 ;GA4 RESTORE WAVE #src/romc8.src line 814 at e740063 · upstream ↗ 1146 LDB #10 1147 STD P1SBC ;10-->P1TRG ALSO PATCH 2
src/defa7.src lines 1146–1147 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^Defender reads each wave's enemies from a table with a column for each of waves 1 to 4: landers 15, 20, 20, 20; bombers 0, 3, 4, 5; pods 0, 1, 3, 4; no mutants or swarmers at the start; landers come in groups of 5. Later waves take the fourth column plus per-wave increments, which are 0 for these counts, so they keep the fourth wave's numbers (computed).Codemwenge/defender
How we know
674*WAVE DATA 675*MAX,MIN,INTRADELT,INTERDELT 676*W1,W2,W3,W4 677WVTAB FCB 20,0,0,0 678 FCB 15,20,20,20 ;LANDERS 679 FCB 3,0,0,0 680 FCB 0,3,4,5 ;TIES 681 FCB 6,0,0,0 682 FCB 0,1,3,4 ;PROBES 683 FCB 10,0,0,0 684 FCB 0,0,0,0 ;SCHITZOS 685 FCB 10,0,0,0 ⋮
src/blk71.src lines 674–690 at e740063 · upstream ↗ 1865 LDA PWAV,X 1866 PSHS A 1867 CMPA #4 1868 BLS GETWV1 1869 LDA #4 1870GETWV1 LDU WVTAB 1871 ADDA #3 ;OFFSET ADJUST ⋮ 1878GETWV3 PULS A ;HIGHER THAN 4? ⋮ 1895GETWV4 LDB #3 ⋮ 1898 BSR WDELT ;GET YUR DELTAS
src/defa7.src lines 1864–1900 at e740063 · upstream ↗ 1145 FDB LANDV 1146 FDB MUTV 1147 FDB BAITV 1148 FDB BOMBV 1149 FDB SWRMPV 1150 FDB SWARMV ⋮ 1161PICTS FDB LNDP1 1162 FDB SCZP1 1163 FDB UFOP1 1164 FDB TIEP1 1165 FDB PRBP1 1166 FDB SWPIC1
src/amode1.src lines 1144–1166 at e740063 · upstream ↗ 271SWRMP FDB POD ⋮ 274BOMBR FDB BOMBER
src/mess0.src lines 271–274 at e740063 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
Sources
Code
- Jarvis, Eugene, Sam Dicker, and Robert Hargreaves. 2023. “Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source.” Commit e740063. mwenge/defender @ e740063 · licence, all uses