Legacy of the Wizard:ROM map

From Data Crystal
Revision as of 00:13, 13 April 2020 by Rainwarrior (talk | contribs) (documenting ROM banks and map format)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PRG Banks

8kb MMC3 banks

$0-8 - $00000-$1FFFF level maps
$9-9 - $12000-$13FFF metatile sets, dragon map
$A-B - $14000-17FFF music, unused title screen
$C-D - $18000-1FFFF music, title screen, code, credits
$E-F - $1C000-1FFFF fixed upper bank, code

Map Format

Each 1kb of PRG in the map banks represents a single 4-screen map in the dungeon.

$000-2FF - 64 columns of 12 tiles each
$300 - Metatile Page
$301 - Enemy CHR (PPU $1400)
$302 - Secret Wall Tile
$303 - Secret Wall Replacement
$304 - Block Replacement
$305 - Terrain CHR 0 (PPU $0000)
$306 - Terrain CHR 1 (PPU $0800)
$307 - Treasure Active (1 = active)
$308 - Treasure X (grid 0-63)
$309 - Treasury Y (pixel 0-191)
$30A - Treasure Contents (0-23)
$30B - Music track (0-15)
$30C - Celina Teleport Map X (0-3)
$30D - Celina Teleport May Y (0-17)
$30E - Celina Teleport Player X (grid 0-63)
$30F - Celina Teleport Player Y (pixel 0-191)
$310 - Shop Item 0 (0-15)
$311 - Shop Price 0
$312 - Shop Item 1
$313 - Shop Price 1
$314 - Demo Bitfield
$315 - Music Control Bitfield
$316 - Unused*
$320-3AF - 9 x 16 byte enemy
    $3X0 - First Sprite Index
    $3X1 - Draw Attribute
    $3X2 - Position X (grid 0-63)
    $3X3 - Position Y (0-191)
    $3X4 - Hit Points
    $3X5 - Damage
    $3X6 - Death Sprite Index
    $3X7 - Animation Style
    $3X8 - Behaviour (0-8)
    $3X9 - Speed
$3E0-3FF - Palette

All unlisted bytes are always filled with 0.

The map grid is one byte per tile. The high 2 bits select a palette. The low 6 bits select metatile from the selected metatile page. Each metatile index has a special function:

  • $00 - Ladder
  • $01 - Shop or Inn door (requires sign on the tile above to function)
  • $02 - Locked door
  • $03 - Celina portrait
  • $04 - Shop sign
  • $05 - Inn sign
  • $06-2F - Open space
  • $30 - Spike
  • $31-3D - Solid
  • $3E - Movable block
  • $3F - Solid

Metatile pages are stored in bank 9. Each page contains 64 4-byte entries. Each entry is two columns of tiles to select from the terrain CHR.

The secret tile designates a tile that will be replaced by another when touched. (The high 2 bits are ignored.) The replacement tile will replace it, and its top 2 bits will apply a new palette. Any pair of tiles can be used here, for a lot of different functions. E.g.:

  • Open replaced by open: the player will fall through.
  • Solid replaced by open: the player must push on it to pass through.
  • Inn replaced by shop: touching the sign converts the inn to a shop.

The block replacement is simply the tile that appears under a block or locked door when it is moved or destroyed. This only happens when it's moved from its starting position.

Music tracks:

  • 0 - dungeon
  • 1 - xemn
  • 2 - meyna
  • 3 - lyll
  • 4 - pochi
  • 5 - dragon
  • 6 - inn
  • 7 - shop
  • 8 - death
  • 9 - title
  • 10 - credits
  • 11 - boss
  • 12 - home

Music Control Bitfield: this prevents switching the music if the previously playing track is in the bitfield. (Only works for the first 8 tracks.) 1<<0 is dungeon, 1<<1 is xemn, etc.

Demo Bitfield: this controls which family members can be randomly selected in each from for random demonstration during title screen:

  • 0 - xemn
  • 1 - meyna
  • 2 - roas
  • 3 - lyll
  • 4 - pochi

Shop items are in same order as inventory screen. 0 is wings, 1 is armour, etc.

Treasure includes 8 more items:

  • 0 - bread
  • 1 - magic
  • 2 - gold
  • 3 - poison
  • 4 - key
  • 5 - ring
  • 6 - cross
  • 7 - scroll
  • 8+ - same as shop if 8 less: wings, armour, etc.

The unused field $316 is not 0 in only two maps. It does not appear to be read for any purpose. The shops read $315 and $316 and use them to draw a few tiles offscreen, but this does not seem to serve any purpose and is probably just harmless vestigial code?