In Applesoft, all variables have global scope. Strings, numeric
variables, and arrays live in different namespaces however, so
M$
and M$(0)
are separate entities.
All values are initialized to zero or the empty string if not
set explicitly.
Var | Description | Initial Value |
---|---|---|
AA%(35) | Monster attack damage (actual is (random 1-N) * 0.7). | |
AR | Number of arrows. | 12 |
AX | Player position within window, X coord (0-9). | 1 |
AY | Player position within window, Y coord (0-8). | 4 |
BH | Base (max) hit points. | 125 |
BX | Monster data ptr: X coordinate (170 bytes). | 16384 |
BT | Monster data ptr: type (170 bytes). | BY+170 (16724) |
BY | Monster data ptr: Y coordinate (170 bytes). | BX+170 (16554) |
C0 | Highest object number for monster. | 36 |
C2 | (never used) | 256 |
C9 | (never used) | 9 |
CX | Window position X coord (left 0-70). | 0 |
CY | Window position Y coord (top 0-71). | 35 |
DP | Display mode: 0=hi-res, 1=text, 2=map. | 1 |
EL | Experience Level: 1-9. | 1 |
EN | Experience required for next level. Doubles every time you level up. | 25 * SL% |
EP | Experience points. | 0 |
GP | Gold pieces. | |
H4 | Low health warning (0-2); used to avoid repeating "you're dying" messages. | |
HH(35) | Monster hit points (also experience points). | |
HP | Current hit points. | 125 |
HW | Current weapon: 1=sword, 2=bow. | 1 |
K9 | Map width. | MY+1 (80) |
KL% | Total kills (not used). | |
M$ | Message to show. | |
M$(35) | Monster names. | |
MH%(175) | Monster hit points. | |
ML | Map location, i.e. memory address where the map data is stored. | 40960 ($A000) |
MS | Magic sword (1-3), value indicates bonus. | |
MX | Max map X coordinate. | 79 |
MY | Max map Y coordinate. | 79 |
NM | Number of active monsters (max 169). | 110 |
NN$ | Player's character name (16 chars max). | |
O9 | Bool: set for important messages (dying, teleported, etc) that should appear on hi-res screen even when messages are disabled. | |
RN$(9) | Rank names, displayed on the text screen | Cannon Fodder, Stable Boy, etc. |
RR | Run-away counter. You get (24 - SL%) steps, after which the speed wears off and enemies get a 4-move burst. | 0 |
S2 | Bool: set to 1 when stuck to a mimic. | |
SH | Magic shield (1-3), value indicates bonus. | |
SL% | Skill level (1-9), selected by player. | 0 |
SM | Bool: Show Messages (when in hi-res mode) | 0 |
T0 | Previous contents of square we're standing on; holds C0+2 if we're standing on the Inn, otherwise 0. | C0+2 (38) |
TB | ? | 32704 ($7FC0) |
TN% | Total number of turns taken (not used). | |
X | Player position, map X coordinate (CX+AX) (0-79). | |
Y | Player position, map Y coordinate (CY+AY) (0-79). | |
XL | Lowest AX value for local display (must scroll if lower). | 1 |
XR | Highest AX value for local display (must scroll if higher). | 8 |
YL | Lowest AY value for local display (must scroll if lower). | 1 |
YR | Highest AY value for local display (must scroll if higher). | 7 |
ZA | Commonly-used temp variable. | 0 |
ZW | Player icon index (18=sword, 16/17/19/20=bow, 25=bird) | 0 |
ZX | Commonly-used temp variable. | 0 |
ZY | Commonly-used temp variable. | 0 |
Memory from $4000-41ff holds 3 bytes of state {X,Y,type} for up to 170 monsters. Slot 0 isn't used for a mob (a result of 0 from the "what monster did you hit" code means you hit a dragon part), so the actual limit is 169. This state is accessed by both Applesoft and CF.OBJ. $4000-40a9 holds the X coordinate, $40aa-4153 holds the Y coordinate, and $4154-41fd holds the type (same value stored in the map). One possible reason the limit of 170 monsters was chosen is that floor(512/3)=170.
The 80x80 map uses one byte per square ($a000-b8ff; PEEK(ML + Y * K9 + X)
).
The possible values are:
Entries in (parenthesis) aren't stored in the map, but the type index is used to access entries in the bitmap atlas. Types 21-24 and 26-27 appear to be monsters for which graphics were designed but they weren't included in the game.
If you want to do some tests without worrying about dying, try this:
D6:0
to disable auto-run.E003G
to exit the debugger to the Applesoft prompt.35 HP=1E4:BH=1E4
. That gives you 10K health.20251 ZD=300
. You now do 300 points of damage per hit,
enough to kill anything but the dragon in one shot.RUN
to restart the game.Copyright 2020 by Andy McFadden