data/claims/pop.yamlPrince of Persia (Apple II), read in Jordan Mechner's released 6502 source
Game: Prince of Persia.
Jordan Mechner's released Apple II source names its build in VERSION.S, "Prince of Persia 1.0 9/7/89", and its MASTER.S is headed as the 3.5-inch disk version; the game code the other claims here read is shared with the 5.25-inch build. pop/source-version
Value: 1.0
CodePrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) ·01 POP Source/Source/VERSION.S#L9TextLine asc "Prince of Persia 1.0 9/7/89"Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/MASTER.S#L9-L11* M A S T E R
*
* (3.5" version)Checked by claude, 2026-10-22 — read VERSION.S and MASTER.S's header at the pinned commitThe 5.25-inch disk routines are in the repository's "02 POP Disk Routines" folder, which the atlas doesn't fetch; they load the same game code. The atlas hasn't built the source or compared it with a shipped disk.
Cited by: Prince of Persia
The kid's horizontal position, CharX, counts in units of 14 to a block: the left edges of the blocks (BlockEdge) step by 14, and the screen is 140 units wide, so it holds 10 blocks (computed). A floor is 63 px tall (BlockHeight). pop/block-grid
About: Prince of Persia Jump
Value: 14 units/block
CodePrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) ·01 POP Source/Source/TABLES.S#L143-L154* BlockEdge
…
* Yields: Screen X-coord of left edge of block
…
]byte = -12
lup 20
db ]byte
]byte = ]byte+14Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/EQ.S#L476ScrnWidth = 140Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/TABLES.S#L36BlockHeight = 63Checked by claude, 2026-10-22 — read the BlockEdge table, ScrnWidth, and BlockHeight at the pinned commitThe 140-unit screen is the Apple II's 280-pixel hi-res width at half resolution (CTRLSUBS.S calls it "140-res").
Cited by: Prince of Persia
Both of the kid's jumps are fixed sequences in SEQTABLE.S, with no speed or gravity: each cycle ANIMCHAR reads the sequence up to the next frame number, adding each chx byte to CharX in the direction he faces and each chy byte to his height. The frames of both jumps add no horizontal offset of their own (Fdx 0 in FRAMEDEF.S). pop/jump-sequence
About: Prince of Persia Jump
CodePrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) ·01 POP Source/Source/COLL.S#L996-L1016:next jsr getseq ;get next byte from seqtab
…
cmp #chx ;"change x" instruction?
bne :no1
…
jsr getseq ;next byte is delta-x
…
jsr addcharx
sta CharX
…
:no1 cmp #chy
…
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRLSUBS.S#L346-L363* In: A = # pixels to add (+ = fwd, - = bkwd)
…
ADDCHARX
bit CharFace ;-1 = left (normal)Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/FRAMEDEF.S#L21* Fimage, Fsword, Fdx, Fdy, FcheckPrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/FRAMEDEF.S#L38-L66:16 db $10,0,0,0,$c0+3 ;standjump-9
…
:44 db $2c,0,0,0,$c0+4 ;runjump-11Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRLSUBS.S#L1654-L1664 ldy #0
lda (framepoint),y
sta Fimage
…
lda (framepoint),y
sta FdxChecked by claude, 2026-10-25 — read ANIMCHAR's chx and chy cases in COLL.S, ADDCHARX in CTRLSUBS.S, the frame definitions for frames 16 to 44 (all with Fdx 0) at the pinned commit, and the frame loader in CTRLSUBS.S (L1650-L1668), which stores a frame's third byte in FdxOther sequence bytes set the action (act), jump (goto), play footsteps (tap), and start a fall (setfall), which gives the speed that gravity works on (pop/freefall).
Cited by: Jump, Prince of Persia
The standing jump (standjump) runs frames 16 to 33. Its chx steps are 2, 2, 2, 2, 2, 7, 9, 5, 1, 4, −3, 5, and 1 units, 39 in all (computed); its only chy steps lift the kid 6 px and set him back down on the next frame. Frames 20 to 25 lack the floor-check bit, so onground doesn't test the floor under him there, and the steps between frame 19 and frame 26 move him 28 units, 2 blocks (computed). pop/standing-jump
About: Prince of Persia Jump
Value
{
"steps": [
2,
2,
2,
2,
2,
7,
9,
5,
1,
4,
-3,
5,
1
],
"total": 39,
"unchecked": 28
}01 POP Source/Source/SEQTABLE.S#L442-L464standjump
db act,1
db 16
db 17,chx,2
db 18,chx,2
db 19,chx,2
db 20,chx,2
db 21,chx,2
db 22,chx,7
db 23,chx,9
db 24,chx,5,chy,-6 ;chx 6?
sjland db 25,chx,1,chy,6
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/FRAMEDEF.S#L41-L48:19 db $13,0,0,0,$40+8 ;standjump-12
:20 db $14,0,0,0,$80+9 ;standjump-13
:21 db $15,0,0,0,$00+11 ;standjump-14
:22 db $16,0,0,0,$80+11 ;standjump-15
:23 db $17,0,0,0,$00+17 ;standjump-16
:24 db $18,0,0,0,$00+7 ;standjump-17
:25 db $19,0,0,0,$00+5 ;standjump-18
:26 db $1a,0,0,0,$c0+1 ;standjump-19Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/GAMEEQ.S#L653Fcheckmark = %01000000Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L311-L316* Is there floor underfoot? If not, start to fall
…
onground
lda Fcheck
and #fcheckmark
beq ]rts ;0--no need to checkChecked by claude, 2026-10-22 — read standjump in SEQTABLE.S, the frame definitions for frames 19 to 26 (bit 6 of Fcheck clear for 20 to 25), Fcheckmark, and onground at the pinned commit; summed the stepsA chx step sits after the frame number it follows, so it moves the kid on the next frame. The distances are CharX's: the floor test reads a foot point that each frame sets in the low bits of Fcheck (GETBASEX, CTRLSUBS.S), which these sums leave out. Frame 26 is where a jump over no floor turns into jumpfall (CTRL.S startfall). The comment ";chx 6?" is Mechner's.
Cited by: Prince of Persia
The running jump (runjump) runs frames 34 to 44. Its chx steps are 5, 6, 3, 5, 7, 12, 8, 8, 4, 4, and 5 units, 67 in all (computed), and its chy steps raise the kid 14 px over three frames and lower him 14 px over the next two. Frames 39 to 43 lack the floor-check bit, and the steps between frame 38 and frame 44 move him 43 units, 3 blocks and 1 unit (computed). pop/running-jump
About: Prince of Persia Jump
Value
{
"steps": [
5,
6,
3,
5,
7,
12,
8,
8,
4,
4,
5
],
"total": 67,
"unchecked": 43
}01 POP Source/Source/SEQTABLE.S#L469-L485runjump
db act,1
db tap,1,34,chx,5
db 35,chx,6
db 36,chx,3
db 37,chx,5
db tap,1,38,chx,7
db 39,chx,12,chy,-3
db 40,chx,8,chy,-9
db 41,chx,8,chy,-2
db 42,chx,4,chy,11
db 43,chx,4,chy,3
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/FRAMEDEF.S#L60-L66:38 db $26,0,0,0,$40+5 ;runjump-5
:39 db $27,0,0,0,$80+14 ;runjump-6
:40 db $28,0,0,0,$00+11 ;runjump-7
:41 db $29,0,0,0,$80+11 ;runjump-8
:42 db $2a,0,0,0,$80+10 ;runjump-9
:43 db $2b,0,0,0,$00+1 ;runjump-10
:44 db $2c,0,0,0,$c0+4 ;runjump-11Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L311-L316onground
lda Fcheck
and #fcheckmark
beq ]rts ;0--no need to checkChecked by claude, 2026-10-22 — read runjump in SEQTABLE.S and the frame definitions for frames 38 to 44 (bit 6 of Fcheck clear for 39 to 43) at the pinned commit; summed the stepsScreen Y grows downward, so the rise is the chy bytes −3, −9, and −2. The last step, 5, moves the kid onto the run cycle (runcyc1) after frame 44. As for the standing jump, the sums are CharX's, not the per-frame foot point the floor test reads.
Cited by: Prince of Persia
GENCTRL, which turns the player's input into moves, picks its branch by the frame the kid shows (standing, starting a run, running, starting a jump up, hanging, turning, or crouching). The frames of the standing and running jumps, 16 to 44, match none of them, and it returns without reading the joystick, so a jump can't be steered once it starts. pop/no-steering
About: Prince of Persia Air control
CodePrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) ·01 POP Source/Source/CTRL.S#L689-L718:cont ldx CharPosn ;previous frame #
…
cpx #15
beq :standing
…
cpx #48
beq :turning
…
cpx #50
bcc :0
cpx #53
bcc :standing ;turn7-8-9/crouch
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L720-L723:1 cpx #109 ;crouching?
beq :crouching
:3
]rts rtsChecked by claude, 2026-10-22 — traced GENCTRL's dispatch on CharPosn at the pinned commit for frames 16 to 44: each reaches :1, fails the test for 109, and returns; PLAYERCTRL reaches it through UserCtrlThe direction comes from the facing: chx steps add in the direction the kid faces (pop/jump-sequence). A jump over no floor turns into a fall sequence, which reads only the button, for a ledge grab (pop/ledge-grab).
Cited by: Air control, Prince of Persia
In a run (frames 4 to 14), arunning reaches the running jump only while the joystick is held forward (centered stops the run, back turns it), and then only on a fresh press of up (clrU negative), with forward and up the names Mechner's comments give the joystick signs; in a full run (frame 7 or later) that calls DoRunjump, which Mechner's comment describes as "Calibrate jump so that foot will push off at edge". It looks for a gap or spikes in the next two blocks and measures from the kid's position 4 units on to that floor's end. When the end is 6 to 15 units off, it moves him so the jump starts with CharX 14 units (one block) short of the end (computed). Farther off, it returns without jumping (comment: "still too far away--wait till next frame"); nearer, it moves him 1 unit (computed) and jumps (comment: "He jumped too late; he'll miss edge"). With no gap in sight, he jumps where he is. pop/run-jump-takeoff
About: Prince of Persia Jump
Value: 14 units before the edge
CodePrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) ·01 POP Source/Source/CTRL.S#L1742-L1750* Calibrate jump so that foot will push off at edge.
…
RJChange = 4 ;projected change in CharX
RJLookahead = 1 ;# blocks you can look ahead
RJLeadDist = 14 ;required leading distance in pixels
RJMaxFujBak = 8 ;# pixels we're willing to fudge back
RJMaxFujFwd = 2 ;and forwardPrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L1752-L1792DoRunjump
lda CharPosn
cmp #7
bcc ]rts ;must be in full run
…
lda #RJChange
jsr addcharx
sta ztemp ;projected CharX
…
cmp #spikes
beq :done
…
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L1793-L1836 bcs :noedge ;no edge in sight--jump anyway
…
jsr getdist1 ;# pixels to end of block
…
adc Mult7,x
clc
adc Mult7,x ;# of pixels to end of floor
…
sbc #RJLeadDist
…
cmp #-RJMaxFujBak
bcs :ok ;move back a little & jump
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L1348-L1378arunning
lda JSTKX
beq :runstop ;jstk centered...stop running
bpl :runturn ;jstk back...turn around
…
lda JSTKY
bmi :runjump ;jstk up... take a running jump
…
:runjump
lda clrU
bpl ]rts
…
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L638-L643* In: Raw input
* JSTKX (- fwd, + back, 0 center)
* JSTKY (- up, + down, 0 center)
…
* clrF-B-U-D-btn (- = fresh press)Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L702-L712 cpx #4
bcc :starting ;run4-5-6
…
:4 cpx #15
bcs :2
jmp :running ;run8-17Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/SPECIALK.S#L917-L930:2 lda clrU
bmi :3
…
ldx JSTKY
bmi :yesU
…
lda #0
beq :staU
…
:yesU cmp #0
bne :3
…
…Checked by claude, 2026-10-25 — read GENCTRL's dispatch to arunning (frames 4 to 14), arunning's joystick tests and :runjump's clrU test, the input comment, CLRJSTK in SPECIALK.S (L883-L930, called from CTRL.S L577), which sets clrU to −1 only when JSTKY is negative and clrU is 0, keeps it while it is −1, and zeroes it when JSTKY isn't negative, and DoRunjump and its constants at the pinned commit. With D the distance from CharX + 4 to the floor's end (the end of the current block plus 14 for each floor block before the gap) and A = D − 14: A from −8 to 1 is kept, 2 to 127 returns, and anything lower becomes −3; the kid then moves A + 4, so a kept A leaves CharX at the end minus 14The loop starts at the block after the kid's (projected) one and stops at the second floor block, so "the next two blocks" means the next block and the one after. The constants' comments call the units pixels; they are CharX units (pop/block-grid). Whether a press that waits is acted on in a later frame depends on whether anything sets clrU to 1 before then, which the atlas hasn't traced. That a negative JSTKY is up and a negative JSTKX forward (after facejstk turns a right-facing kid's input around) rests on Mechner's comments at CTRL.S L638-L643 and L616.
Cited by: Prince of Persia
A falling kid grabs a ledge while the button is down (either Apple II button, unless manual control splits them) and he is alive, his downward speed is under 32 px per cycle, and his feet are within 25 px above the floor plane he is falling toward. fallon then tests for a ledge 8 units behind him (grabreach), requiring clear space above it and a floor piece in front, and on a catch it aligns him to the block, stops his fall, and starts the hang. It runs on the first frames of a fall (102 to 105) and through the free fall. pop/ledge-grab
About: Prince of Persia Ledge grab
Value
{
"maxSpeed": 32,
"lead": 25,
"reach": 8
}01 POP Source/Source/CTRL.S#L45-L47grabreach = -8
grabspeed = 32 ;max Y-vel to grab ledge
grablead = 25 ;increase to grab ledge earlierPrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L248-L298fallon
lda btn ;is button down?
and CharLife ;& is he alive?
bpl ]rts
…
lda CharYVel
cmp #grabspeed
bcs ]rts ;no--falling too fast
…
lda CharY
clc
adc #grablead
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L76-L84falling
lda CharY
…
cmp FloorY,x
bcs :1
…
jmp fallon ;Hasn't reached floor yetPrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L120-L129:2 cmp #4 ;freefall
beq falling
cmp #3
bne :1
lda CharPosn
cmp #102
bcc ]rts
cmp #106
bcs ]rts
jmp fallonPrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRLSUBS.S#L1814-L1858CHECKLEDGE
…
lda blockid ;must be clear
…
* Clear above -- is there a ledge in front?
…
lda ztemp ;must be a solid floorpiece
;with exposed ledgePrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/GRAFIX.S#L1045-L1049 lda BTN1
ldx ManCtrl ;When manual ctrl is on, btn 0 belongs
bmi :1 ;to kbd and btn 1 to jstk. With manual ctrl
ora BTN0 ;off, btns can be used interchangeably.
:1 sta btnChecked by claude, 2026-10-22 — read fallon, its constants, the two paths into it from CHECKFLOOR and falling, CHECKLEDGE, and getjoy's button read at the pinned commitA fall's speed runs 15, 18, 21, 24, 27, 30, and then 33 (pop/freefall), so the speed test lets a grab through every speed below the cap. CHECKLEDGE also refuses a loose floor that is already falling and, facing left, a panel piece with floor. On a catch the kid is stunned for 12 cycles (stuntime), which the atlas hasn't traced further.
Cited by: Ledge grab, Prince of Persia
With the weightless flag clear, a fall (action 4) adds 3 px per cycle to the kid's downward speed, up to 33 px per cycle (AccelGravity, TermVelocity); with it set, gravity is 1 and the cap 4 (WtlessGravity, WtlessTermVel). The fall sequences that start it set the speed to 15 (setfall). In any other action, including the jumps' (action 1) and a fall's first frames (action 3), gravity does nothing. pop/freefall
About: Prince of Persia Gravity
Value
{
"accel": 3,
"cap": 33,
"start": 15
}01 POP Source/Source/SUBS.S#L1613-L1644TermVelocity = 33
AccelGravity = 3
WtlessTermVel = 4
WtlessGravity = 1
…
GRAVITY
lda CharAction
cmp #4
bne ]rts
…
lda CharYVel
clc
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/SEQTABLE.S#L640-L654stepfall ;from #8 (run-11)
db act,3
db chx,1,chy,3
…
fall1
db 102,chx,2,chy,6
db 103,chx,-1,chy,9
db 104,chy,12
db 105,chx,-2
…
db setfall,1,15
db goto
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/SEQTABLE.S#L882-L884freefall
db act,4
:loop db 106Checked by claude, 2026-10-22 — read GRAVITY and its constants in SUBS.S, stepfall, and freefall at the pinned commitThe jump falls, jumpfall and rjumpfall, have the same height steps and the same starting speed of 15.
Cited by: Gravity, Prince of Persia
A landing's cost goes by the kid's downward speed when he reaches a floor: under 22 (OofVelocity) he lands softly; from 22 up to 33 (DeathVelocity) he loses 1 hit point and dies if it was his last; at 33 he loses 100, and dies. A guard who lands at 22 or more dies, and the shadow lands softly at any speed under 33. pop/fall-damage
About: Prince of Persia Fall damage
Value
{
"hurt": 22,
"kill": 33
}01 POP Source/Source/CTRL.S#L42-L43DeathVelocity = 33
OofVelocity = 22Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L184-L211:notspikes
lda CharYVel
cmp #OofVelocity
bcc :softland
…
cmp #DeathVelocity
bcc :medland
…
:hardland
lda #100
jsr decstr
…
…Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/MISC.S#L691-L696DECSTR
ldx CharID
bne :enemy
…
cmp KidStrength
bcs killkidChecked by claude, 2026-10-22 — read hitflr's landing branches, its constants, and DECSTR at the pinned commitSpikes come first: lethal spikes under the kid impale him whatever the speed. A kid already dead lands hard. The cap of 33 (pop/freefall) makes 33 the only killing speed.
Cited by: Fall damage, Prince of Persia
Computed from the fall sequence and gravity: a kid who steps off a ledge has fallen 30 px when the free fall starts at speed 15, and reaches the floor below at speed 21 after one floor (63 px), 30 after two, and 33 after three or more. One floor costs nothing, two cost a hit point, and three or more kill him. The count assumes weightless is clear and that a fall crossing to the screen below keeps its speed and its distance to the next floor, which the atlas hasn't read in the screen-change code. pop/fall-floors
About: Prince of Persia Fall damage
Value
{
"safe": 1,
"hurt": 2,
"kill": 3
}01 POP Source/Source/SEQTABLE.S#L640-L654stepfall ;from #8 (run-11)
db act,3
db chx,1,chy,3
…
db 102,chx,2,chy,6
db 103,chx,-1,chy,9
db 104,chy,12
…
db setfall,1,15Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/TOPCTRL.S#L661-L664 jsr animchar ;Get next frame from sequence table
…
jsr gravity ;Adjust Y-velocity
jsr addfall ;Add falling velocityPrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/SUBS.S#L1651-L1655ADDFALL
lda CharYVel
clc
adc CharY
sta CharYPrince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/SUBS.S#L1613-L1614TermVelocity = 33
AccelGravity = 3Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/TABLES.S#L36BlockHeight = 63Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L42-L43DeathVelocity = 33
OofVelocity = 22Prince of Persia Apple II source code (jmechner/Prince-of-Persia-Apple-II) · 01 POP Source/Source/CTRL.S#L76-L97falling
…
jmp fallon ;Hasn't reached floor yet
…
jsr cmpspace
bne hitflr
…
inc CharBlockY ;Fall thru floor planeChecked by claude, 2026-10-22 — stepped the cycle by hand from the pinned code. The fall's first frames move 3, 6, 9, and 12 px (30 in all, in action 3, where gravity does nothing); then each cycle the speed rises by 3 and is added: 18 (48 px), 21 (69, past the first floor at 63), 24, 27 (120), 30 (150, past 126), 33 (183), 33 (216, past 189). A floor plane with no floor lets him through (`inc CharBlockY`)The count starts from a kid standing on a floor (CharY at the floor's plane), the stepfall sequence; the jump falls, jumpfall and rjumpfall, step the same heights. A start up to 14 px lower gives the same three outcomes (computed): one floor then lands at 18, two at 27, and three still at 33.
Cited by: Fall damage, Prince of Persia