(back to project list)

Caverns of Freitag Disassembly

Caverns of Freitag is an action role-playing game for the Apple II, written in 1982 by David Shapiro (a/k/a "Dr. Cat"). It has the standard elements -- running around in a maze bashing various monsters to death to become strong enough to face the boss -- making it one of the earliest examples of the ARPG genre. The interface is a clever mix of text and hi-res graphics.

The game is written primarily in Applesoft, with assembly-language routines for animation. The disassembly is based on the (very clean) 4am crack.

When reading the CF source code, it can be helpful to have the list of variables handy.

You can download the SourceGen project set for the binaries. The disk image is available on asimov.

How to Play

The goal is to kill the dragon (technically "Dwagon") in the bottom-right part of the maze, and return safely to the Inn.

During setup you can pick your character name, skill level, and game speed. Skill level 1 is the easiest. It affects the initial monster generation, the number of experience points required to level up, and how far you can run while fleeing. At skill levels 8 and 9, two walls are added near the Inn, blocking the most direct route to the dragon and making the bottom half of the maze difficult to access.

The speed determines how long the game will wait before moving without you; speed 50 is the slowest. In hi-res mode you'll see a timer dot running across the bottom, in text mode an asterisk. The game cannot be paused. (Dr. Cat pointed out that you can pause if you're quick... if you bump into a wall and immediately hit Ctrl+S, the firmware text output code will catch it and pause until you hit another key.)

You can move in 8 directions, using keys centered around the 'H' key:

  T Y U
  B N M

Holding the Ctrl key down attacks in that direction. Hitting H passes the turn, which can be useful when you want an enemy to approach.

Moving onto the Inn restores all your hit points, and if you have enough experience, raises you one level. (If you have a lot of experience, move on and off the Inn a few times to get all of your new levels.) The only other way to heal is to walk onto a Healer or kill the dragon. You start with 125 HP, and gain 100 HP each time you level up.

The damage you do is based on your experience level. You start at level 1, and can reach level 8. When you kill the dragon, you are immediately promoted to level 9 ("Dragon Slayer"). Swords do rnd(1-10) * level per hit. Magic swords add their bonus (1-3) to the experience level. Arrows do rnd(1-6) * (level + 2). Arrows do not fly off screen.

Every experience level gives you a 5% chance to block attacks with your shield, so at max level (9) you have a 45% chance. Magic shields add 5% per bonus point (1-3). Your shield doesn't work when the bow is readied, and Invisoids can't be blocked.

The maze is initially populated with 62 chests. 5/6ths of the time, chests contain 1-50 gold coins. The other 17% of the time, you have even odds of finding arrows, a magic sword, a magic shield, a teleportation trap, or nothing at all. A new chest is created every other time you open one, so new chests will appear but you will eventually run out.

Initially there are 110 monsters. Every time you kill one, two more are spawned, until there are 169 monsters. The types of spawned monsters are completely random, and not based on skill level or location. (The initial set of monsters *is* based on skill level; the highest monster it will create is equal to your skill level plus 4. So at level 1 the maze will be filled with nothing but Serpents and Electric Moths until you start killing things.) Moving onto a healer "kills" the healer and fills its slot with a wizard.

The game can feel a bit sluggish, but if you run it in an emulator at 2x it perks right up.


Monsters will tend to move toward you, but have a 1 in 8 chance of moving randomly. Some monsters have special movement patterns, e.g. Mad Robots can't move diagonally, Wizards will prefer to run rather than melee, and Healers will tend to move away from you.

Monster melee attacks hit for 1 to N points of damage, where N is the damage value from the table below multiplied by 0.7. The experience you receive for killing a monster is equal to their hit points.

Num Img Name HP Dam Notes
3 Serpent3020
4 Electric Moth1515
5 Mad Robot5030Can't move diagonally.
6 Burbleblort7545
7 Griffin150100
8 Flamebat10070
9 Invisoid2020Invisible; attacks cannot be blocked.
10 Thunderbug5150Can move twice in one turn (but only attacks once).
11 Coldcrystal3008
12 Phoenix200150
13 Mimic88200Doesn't move. Successful attack immobilizes player.
14 Healer11Walk onto for healing (26-175 pts).
15 Wizard6520No melee attacks. Ranged "zappo" attack does 26-75.
35 Dwagon350120Boss. Flame attack does 250.


Copyright 2020 by Andy McFadden