data/claims/defender.yamlDefender (Eugene Jarvis and Sam Dicker's 6809 source)
Game: Defender.
Defender 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. defender/thrust
Value
{
"damping": 0.015625,
"thrust": 3,
"cap": 256,
"thrustTop": 192
}README.md#L75-L77The game source code for Defender in [src](src) was originally retrieved from
https://github.com/historicalsource/defender. It is the Motorola 6809 assembly language
source code for the 'Red Label' version of the game.Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L1931-L1944LDA VERTCT ;PAST 128
CMPA #128
BLO I0 ;NO
LDA IFLG ;ALREADY DONE ?
BNE IRQX ;NO
INC IFLG
…
JSR PLAYERDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L1960-L1962I0 LDB IFLG
BEQ IRQX
CLR IFLGDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L2336-L2371*PLAYER PROCESS
*CALLED FORM IRQ
…
*X DAMPING
CLR ITEMP
LDD PLAXV
COMA
COMB
ADDD #1 ;NEGD
BPL PL00
COM ITEMP ;SIGN EXTEND
PL00 ASLB ; SHIFT
…Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L2420-L2431LDD PLAXV
CMPD #$0100 ;MAX VEL
BLT PV11
LDD #$0100
PV11 CMPD #-$0100
BGT PV12
LDD #-$0100
PV12 STD PLAXV
ADDD BGL
SUBD BGDELT
STD BGLDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L1249-L1250LDD #$0300
STD PLADIR ;THRUST+DIRECTIONDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L3155-L3164*REVERSE
…
LDD PLADIR
COMB
COMA
ADDD #1
STD NPLADDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L3333-L3334ISCAN LDD BGL
SUBD #100*32 ;100 PIXEL LEFT BUFFERChecked by claude, 2026-10-22 — read the IRQ (PLAYER runs once per pass of VERTCT through 128, IFLG cleared below it) and PLAYER to PLAYX. PLAXV is 3 bytes; the damping adds −4 × (its top 16 bits) to its low 16 bits, so −1/64 of the whole; thrust adds PLADIR ($0300, or its negative after REV through NPLAD) to the low 16 bits, 3 in units of the top 16. The clamped top 16 bits are added to BGL, the scroll position, in the same units as the 100*32 buffer. W − W/64 + 3 = W gives W = 192The ship's place on the screen also slides toward a point set by its direction and speed (PLAY1-PV10), with the scroll making up the difference; this claim doesn't cover that.
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. defender/vertical
Value
{
"start": 256,
"step": 8,
"max": 512
}src/defa7.src#L2441-L2476*VERTICAL MOTION
LDB PLAY16 ;GET ADDR FOR LIMIT CHK
LDA PIA31 ;UP?
LSRA
BCS PLAUP ;YES
LDA PIA21
BMI PLADN ;DOWN
LDD #0
BRA PYV1
PLAUP CMPB #YMIN+1
BLS PLAYX
LDD PLAYV
…Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/phr6.src#L20-L21YMAX EQU 240
YMIN EQU 42 ;MIN Y COORDChecked by claude, 2026-10-22 — read VERTICAL MOTION to PLAYX: no input stores 0; a direction starts at $100 when the old speed is the other way or zero and otherwise adds 8 up to $200; PLAY16's high byte is the row, so $100 is a pixel. The top test stops at YMIN + 1 = 43, the bottom at 238Down is the mirror of up (PLADN-PLADN1).
Cited by: Defender
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. defender/world
About: Defender Screen wrap
Value: 2048 pixels around (computed)
CodeDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source ·src/phr6.src#L480-L481OX16 EQU $A ;16 BIT X WORLD COORD
OY16 EQU $C ;16 BIT Y WORLD COORDDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L3333-L3363ISCAN LDD BGL
SUBD #100*32 ;100 PIXEL LEFT BUFFER
…
ADDD OY16,X
CMPA #YMIN ;WRAP AROUND
BHS SCYV3
LDA #YMAX
SCYV3 CMPA #YMAX
BLS SCYV4
LDA #YMIN
SCYV4 STD OY16,X ;ADD 8 TIMES VELOCITY
LDD OXV,X ;UPDATE X POSITION
…Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/phr6.src#L20-L21YMAX EQU 240
YMIN EQU 42 ;MIN Y COORDChecked by claude, 2026-10-22 — read ISCAN, which moves the objects outside the active window: X advances by 8 × OXV with a plain 16-bit ADDD and no bound, and the window test subtracts and compares unsigned, so it works modulo 65,536; Y is clamped round from below YMIN to YMAX and above YMAX to YMIN. The scanner (defender/scanner) maps the full 16-bit rangeThe vertical wrap read here is the off-screen update's; on-screen objects move elsewhere (VELO), not read for this claim.
Cited by: Defender, Screen wrap
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). defender/scanner
Value: 64 places across the world (computed)
CodeDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source ·src/amode1.src#L1199-L1200MT1 LDD BGL ;CALC SCANL
SUBD #$8000-(150*32)Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/amode1.src#L1236-L1242*OUTPUT BOZOS
LDX #OPTR
…
LDX #IPTRDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/amode1.src#L1262-L1275SCNR10 LDD OX16,X ;FIND OFFSET
SUBD XTEMP ;SUBTRACT SCANNER LEFT
SCNR2 LSRA ;SHIFT DOWN TO 6 BITS
LSRA
LDB OY16,X
LSRB
LSRB
LSRB
ADDD #SCANER-1
STD ,U
LDD OBJCOL,X ;STORE BLIPChecked by claude, 2026-10-22 — read SCNR: XTEMP = BGL − ($8000 − 150 × 32); each object's X − XTEMP has its high byte shifted right twice (6 bits) and its Y high byte shifted right three times, and the pair is added to the scanner's base address. Both object lists are walked, then the player's blipThe source's OPTR list holds objects near the screen and IPTR the rest (OSCAN, ISCAN).
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. defender/smart-bomb
About: Defender Smart bomb
CodeDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source ·src/defa7.src#L3173-L3209*SMART BOMB
SBOMB LDA SBFLG
BNE SBMBX2
LDX PLRX
LDA PSBC,X
BEQ SBMBX2
INC SBFLG
DEC PSBC,X
…
SBMB00 LDX OPTR
SBMB0 BEQ SBMBX
LDD OBJX,X
…Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/phr6.src#L476-L496OBJX EQU 4 ;UPPER LEFT SCREEN X
…
OCVECT EQU 8 ;COLLISION ROUTINE ADDR
…
*USER DEFINED OBJECT TYPES
*0=NORMAL,HYPERABLE
*1=LANDER PICKING UP NON-HYP
*2(BIT 1)= APPEAR NON-HYP
*$10=EARTHLING NON-HYP,NON SMART BOMBDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defb6.src#L302LDD OBJX,X ;ON SCREEN?Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L1142-L1147LDX #NSHIP
JSR RCMOSA
ANDA #$F
STA P1LAS
LDB #10
STD P1SBC ;10-->P1TRG ALSO PATCH 2Checked by claude, 2026-10-22 — read SBOMB to SBMBX2 and the type list in phr6; OBJX = 0 means off screen (the astronaut process tests it so). At game start STD P1SBC writes the ship count (A) to P1SBC and 10 to P1TRG, the next byteThe screen then flashes (SBMBX) and the bomb button must be let go before another.
Cited by: Defender, Smart bomb
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). defender/hyperspace
About: Defender Hyperspace
Value
{
"deadly": 63,
"of": 256
}src/defa7.src#L3211-L3278*HYPERSPACE
HYPER LDA STATUS
BITA #$FD
LBNE HYPX ;NO GO
…
JSR SCLR1
…
HYP02 LDX SPTR ;KILL BULLETS
…
LDD SEED
STD BGL
…
…Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L1319-L1323STCHK CLRB ; CHECK TERRAIN ACTIVE
STCHK0 LDA ASTCNT
STCHKA BNE STCHK1
ORB #2Checked by claude, 2026-10-22 — read HYPER to HYPX: the low bit of SEED picks the facing and screen side ($2000 with $0300, or $7000 with −$0300), HSEED / 2 + YMIN the row; STCHK shows bit 1 of STATUS is the no-terrain flag, which HYPER's mask $FD lets through. LBHI is unsigned, so 193-255 killThe count assumes LSEED's values are evenly spread; the random routine isn't read here.
Cited by: Defender, Hyperspace
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. defender/kidnap
src/defb6.src#L688-L710*LANDER KIDNAP
…
LDD [PD4,U] ;TARGET ALIVE?
…
CMPA XTEMP ;CLOSE?
BEQ LANDG0 ;GET IM
…
JSR GTARG ;RE:TARGET
LBEQ SCZ00 ;NO, FREAKDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defb6.src#L737-L841*LETS GET HIM
…
*ARE WE ON HIM?
…
STD OYV,X ;SPLIT
…
*FLEE
…
CMPA #YMIN+8
BLS LANDFX ;ALL DONE
…
*PULL HIM INSIDE
…Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defb6.src#L903-L911*KILL KIDNAPPING LANDER
LKIL1 LDU OBJID,X ;GOT A PASSENGER?
…
NEWP AFALL,STYPE ;START HIM FALLINGDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/amode1.src#L1144-L1166FDB LANDV
FDB MUTV
…
PICTS FDB LNDP1
FDB SCZP1Checked by claude, 2026-10-22 — read LANDS0 through SCZ0 and LKIL1: LANDS0 compares X coordinates (top 6 bits) to go to LANDG0, LANDG walks onto the target, LANDG3 swaps the collision vectors and sends both up, LANDF climbs until row YMIN + 8, LANDFX draws the humanoid up and kills it through ASTK1, and SCZ00 recounts the lander as a schitzo with the SCZP1 picture. The attract mode's text and picture tables pair LANDV with LNDP1 and MUTV with SCZP1A falling humanoid's outcomes are defender/rescue.
Cited by: Defender
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. defender/planet
Value
{
"humanoids": 10,
"restoreEvery": 5
}src/defb6.src#L421-L434ASTCLR LEAY ,X
…
DEC ASTCNT
BNE ASTCX
NEWP TERBLO,STYPE ;BLOW UP TERRAINDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defb6.src#L626-L656*GET TARGET FROM LIST
*RET EQ IF NONE,D=TRG OBJECT
…
LDA ASTCNT
BEQ GTX ;NOBODY LEFT
…
LNDST0 TST ASTCNT ;NO MORE TARGETS
BNE LNDST1
JMP SCZS0Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defb6.src#L706-L710JSR GTARG ;RE:TARGET
LBEQ SCZ00 ;NO, FREAKDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L1849-L1863LDX #GA1+6 ;GET GA4=RESTORE WAVE
…
GTWV00 SUBA XTEMP ;NEW GUYS EVERY NTH WAVE
BLO GTWV01
BNE GTWV00
LDA #10
STA PTARG,XDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/romc8.src#L814FCB $05 ;GA4 RESTORE WAVE #Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L1146-L1147LDB #10
STD P1SBC ;10-->P1TRG ALSO PATCH 2Checked by claude, 2026-10-22 — read ASTCLR (the humanoid count drops and TERBLO starts at 0), GTARG (returns EQ when ASTCNT is 0), LANDST (no targets jumps to the schitzo starter), LNDSAA's retarget, and GETWV, which subtracts GA4 from the new wave number until it reaches 0 exactly to set PTARG to 10STCHK keeps the no-terrain status bit set while the humanoid count is 0.
Cited by: Defender
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). defender/rescue
Value
{
"catch": 500,
"setDown": 500,
"landAlone": 250,
"waveBonusMax": 500
}src/defb6.src#L925-L962*ASTRONAUT FALL
AFALL LDX PD,U
LDD #8 ;ACCEL DOWNWARD
ADDD OYV,X
CMPD #$300
…
CMPA OY16,X ;HIT GROUND?
BHI AFALL1 ;NO
LDD OYV,X
CMPD #$E0 ;FATAL?
BLS ALAND ;NO
…
…Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defb6.src#L398-L415AKIL1 LDU OBJID,X
BEQ ASTKIL ;NOT FALLING
LDA PCFLG
BEQ AKIL10 ;SHOT
LDD PADDR,U ;1ST TIME
CMPD #AFALL2
…
NEWP P500,STYPE
…
AKIL2 LDD #AFALL2Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defb6.src#L499-L508P250 OBI C25P1,NOKILL,$0000
LDD #$0125
…
*500 POINT PROCESS
…
LDD #$0150
P5000 JSR SCOREDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L1822-L1836LDA #$01
LDY PLRX
LDB PWAV,Y ;MULTIPLIER
CMPB #5
BLO BCLPA
LDB #5
BCLPA ASLB
ASLB
ASLB
ASLB
JSR SCOREChecked by claude, 2026-10-22 — read AFALL through ALAND0, AKIL1 (PCFLG set means the player touched it; the first touch starts P500 and switches the fall process to AFALL2, which holds the humanoid under the ship until GETALT finds ground), P250/P500, and the bonus loop BCLP, which calls SCORE with A = $01 and B = min(wave, 5) × $10, the form of P500's $0150AFALL caps the fall speed at $300 by not storing larger values. A shot humanoid dies (AKIL10).
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). defender/waves
About: Defender Difficulty ramp
Value
{
"landers": [
15,
20,
20,
20
],
"bombers": [
0,
3,
4,
5
],
"pods": [
0,
1,
3,
4
],
"group": 5
}src/blk71.src#L674-L690*WAVE DATA
*MAX,MIN,INTRADELT,INTERDELT
*W1,W2,W3,W4
WVTAB FCB 20,0,0,0
FCB 15,20,20,20 ;LANDERS
FCB 3,0,0,0
FCB 0,3,4,5 ;TIES
FCB 6,0,0,0
FCB 0,1,3,4 ;PROBES
FCB 10,0,0,0
FCB 0,0,0,0 ;SCHITZOS
FCB 10,0,0,0
…Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L1864-L1900LDA PWAV,X
PSHS A
CMPA #4
BLS GETWV1
LDA #4
GETWV1 LDU WVTAB
ADDA #3 ;OFFSET ADJUST
…
GETWV3 PULS A ;HIGHER THAN 4?
…
GETWV4 LDB #3
…
…Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/amode1.src#L1144-L1166FDB LANDV
FDB MUTV
FDB BAITV
FDB BOMBV
FDB SWRMPV
FDB SWARMV
…
PICTS FDB LNDP1
FDB SCZP1
FDB UFOP1
FDB TIEP1
FDB PRBP1
…Defender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/mess0.src#L271-L274SWRMP FDB POD
…
BOMBR FDB BOMBERChecked by claude, 2026-10-22 — read WVTAB's layout comment and rows, GETWV (wave numbers above 4 read column 4, offset wave + 3), and WDELT (adds the inter-wave delta, offset 3, which is 0 in the lander, tie, probe, schitzo, and swarmer rows). Names: the attract mode lists texts LANDV, MUTV, BAITV, BOMBV, SWRMPV (the "POD" text), SWARMV beside pictures LNDP1, SCZP1, UFOP1, TIEP1, PRBP1, SWPIC1 in that order, so ties are bombers and probes podsThe bomber count is above its row's maximum of 3 from wave 2; WDELT skips the store when a sum passes the maximum, so it stays as read from the column. Speeds and timers in the same table do rise with the deltas.
Cited by: Defender, Difficulty ramp
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. defender/replay
About: Defender Extra life
Value: 10000 points per replay (operator default)
CodeDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source ·src/defa7.src#L510-L526*CHECK REPLAY
SCRX LDD REPLA ;REPLAYS AVAILABLE
BEQ SCRXX ;NO
…
BSR RCHK
BLO SCRXX ;NO
LDA 1,Y ;GET NEXT LEVEL
ADDA REPLA+1
…
INC PLAS-1,X
INC PSBC-1,XDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/defa7.src#L1152-L1156LDX #REPLAY
JSR RCMOSD
STD REPLA
STD P1RPDefender (1981) by Eugene Jarvis and Sam Dicker: the 6809 source · src/romc8.src#L801-L802FCB $01,$00 ;REPLAY @10,000
FCB $03 ;NSHIPChecked by claude, 2026-10-22 — read SCRX to SCRXX (after each score, compare with the player's next replay level P1RP, add REPLA to it, and add one to the ship and smart-bomb counts), the game start that copies the REPLAY setting into REPLA and P1RP, and the CMOS defaults in romc8A replay setting of 0 turns replays off (the BEQ at SCRX).
Cited by: Defender, Extra life