Dragon Warrior IV (NES)/ROM map: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
Line 235: Line 235:
</pre>
</pre>


After the palette number is chosen, four colors set bytes are read, then those are used to get the actual palette colors.
After the palette number is chosen, four color set bytes are read, then those are used to get the actual palette colors.


* $BC0A-$BCE1: Multiply palette number by 4, and read 4 bytes from Table $BC0A.  Each byte read from this table refers to a set of 3 colors.
* $BC0A-$BCE1: Multiply palette number by 4, and read 4 bytes from Table $BC0A.  Each byte read from this table refers to a set of 3 colors.

Revision as of 08:08, 18 October 2024

Chip tiny.png The following article is a ROM map for Dragon Warrior IV (NES).

So very stubbly.
This page is rather stubbly and could use some expansion.
Are you a bad enough dude to rescue this article?

Bank 08: (20000)

Tilesets

  • $8229 = Table with three possible base addresses for graphics tile data
    • Value 0x8000 (used with ROM bank 0C)
    • Value 0x7F01 (used with ROM bank 0D)
    • Value 0x9E14 (used with ROM bank 0D)
  • $8ADB-$975A: Tileset Data
    • There are 50 tilesets.
    • Each Tileset is 64 bytes large, and contains 32 different 16-bit Tile Number values.
    • When loading a map, you multiply the specified tileset by 64, add that to $8ADB, and that provides the address of your tileset.
    • Byte 0: yyyAAXXX
    • Byte 1: xxxxxxxx
      • yyy = Smoothing flags for front-facing tiles
      • AA = Attribute data (which Color palette to use)
      • XXXxxxxxxxx Tile number (Used as index into table $A80D)
  • $A1BB = Table of Tile Increment Patterns (description below)
  • $A28D = Table used with Tile Increment Pattern 0F. Each entry is four 16-bit pointers to graphics data.
  • $A80D = Table of tiles, three bytes per entry
    • Byte 0: Low byte of physical tile number
    • Byte 1: AAAABBCC
      • AAAA = Tile Increment Pattern, determines which of the four 8x8 NES tiles are new tiles, and which tiles get reused, and the pattern to use for that.
        • Uses Value * 3 + Table $A1BB as source address
        • Values E and F are special. (TODO) E seems to be related to sign posts?
      • BB = Which graphics page to read the tile graphics from
      • CC = High two bits of physical tile number
    • Byte 2: Tile Behavior (empty space, walls, water, stairs, etc...) See: Tile Behavior

To calculate the source address of the tile graphics:

  • Use Table $8229 with Graphics Page to get the base address, this will be one of $8000, $7F01, or $9E14.
  • If tile increment pattern is 0-C:
    • Multiply Physical Tile Number by 16, add to the base address
    • Choose ROM Bank 0C for graphics page 0, or ROM Bank 0D for graphics page 1 or 2.
    • To get the address of the other 3 tiles, multiply the signed 8-bit value from the increment pattern by 16, and add to the source address.
  • If tile increment pattern is F:
    • Use physical tile number as an index into Table $A28D (multiply physical tile number by 8), then read the address of all four 8x8 tiles.
    • Choose ROM Bank 0C for graphics page 0, or ROM Bank 0D for graphics page 1 or 2.
  • $AEB7 = (???) Table used with Tile Increment Pattern 0E

Tile Increment Patterns

Tile Increment Patterns are stored in Table A1BB, three bytes per pattern, 14 possible patterns.

These are small lists (3 bytes long) containing a signed displacement from the previous value.

  • 00 indicates same tile as the previous tile.
  • 01 indicates you advance forward one tiles (most common case)
  • 02 indicates you skip ahead one tile (often going back one tile afterwards)
  • FF indicates you go back one tile
  • etc...

Patterns:

  • 01 01 01
  • 00 00 00
  • 00 01 00
  • 01 00 FF
  • 01 FF 01
  • 01 01 00
  • 00 01 01
  • 00 02 FF
  • 01 01 01
  • 00 01 01
  • 03 01 01
  • 01 03 01
  • FF 05 FF
  • FF 03 FF

Bank 09: (24000)

Map Data

Note: The pointers for maps are stored on Bank 17

Bank 09 contains Map Data for these locations:

00 Keeleon                  8000 8085 812B 81AE 81C1
01 Santeem                  8206 82DD 8344
02 Burland                  8398 850C 85DE 865D
03 Dire Palace              869B 87B5 8834 88CF
04 Endor                    88E7 8A45 8AAB 8B7D 8B96 8BB5 8C04 8C77 8DD6 8DF4 8E0F 8E2C 8E5A 8E92 8EC9
05 Bonmalmo                 8F28 8F62
06 Branca                   9063 9171 91C3 91D5
07 Soretta                  91ED 92CB
08 Gardenbur                9313 93C9 9492 9506 9544
09 Stancia                  9563 963A 9728 97A8 984B 98B4 98D8 9931
0A Aktemto                  997D
0B Riverton                 9A67 9B5B
0C Bazaar                   9BA8
0D Mintos                   9C47 9D2A 9D86
0E Tempe                    9DD2
0F Frenor                   9EE9 9FEA
10 Aneaux                   A02F A113 A136 A154
11 Haville                  A179 A2CB A321 A348 A3EA A43A
12 Izmit                    A45E A548 A597
13 Surene                   A5BB A6E6 A73A A774 A7B3
14 Hometown                 A7D1 A873 A89C
15 Monbaraba                A97F AA95 AAE2 AB8A
16 Lakanaba                 AC9D ADC1 AE03
17 Kievs                    AE2E AF1C
18 Foxville                 AF51 AFE8
19 Seaside Village          B013 B0DA B194
1A Gottside                 B1B6 B369
1B Rosaville                B3AA B4A4 B505 B528 B56B
1C Secret Playground        B570 B5CD
1D House of Prophecy        B5E6
1E Shrine to Endor          B604
1F Inn Shrine               B62F
20 Woodsman's Shack         B672
21 Desert Inn               B6BE
22 Small Medal King         B738 B78D
23 Soretta Shrine           B7CA
24 Small Island             B81F
25 Royal Crypt              B854 B88C
26 Last Refuge              B8D3
27 Gigademon Shrine         B947 B9AB B9E5
28 Anderoug Shrine          BA1D BA34 BA4C
29 Infurnus Shadow Shrine   BAAA BADA
2A Final Cave               BB11
2B Riverton Travel Door     BB41
2C Shrine of Colossus       BB4D
2D Aktemto Mine             BC25 BCBF BD80 BDA1 BE5E BEF7 BF68 BFBB (Remaining two submaps are on Bank 0A)

Bank 0A: (28000)

Map Data

Note: The pointers for maps are stored on Bank 17

Bank 0A contains Map Data for these locations:

2D Aktemto Mine             803E 82EF (Previous eight submaps are on Bank 09)
2E Shrine of Breaking Waves 830C 847D
2F Padaquea Cave            84B9 84F1 8616
30 Bakor's Hideout          86C8 86F0 88D4
31 Sphere Of Silence Cave   8B0C 8B7E 8C06 8C39 8CB7
32 Golden Bracelet Cave     8CF0 8DBB
33 Secret Playground        8E5C 8EE9 8F33 8F53 8FBF 900C 902A
34 Cascade Cave             9044 9133 9311 93EB 940C
35 Final Cave               9705 978D 984E 98FB 9988 99CE 99E9 9A0B 9A59 9A80
36 Iron Safe Cave           9AA0 9AD2 9B2D 9B86 9BB0 9C4B 9C6A
37 Cave of Betrayal         9C9D 9D02 9D59
38 Silver Statuette Cave    9DAB 9DE1 9E5C 9EC0 9F95 A026
39 Branca-Izmit tunnel      A070
3A Branca-Endor tunnel      A0DF A111
3B Royal Crypt Dungeon      A15A A1E1 A269
3C Necrosaro's Lair         A2F4
3D Zenethian Tower          A507 A6EA A79C A7C6 A7F6 A814 A83D A856 A88D A8D5 A904 A94A A979 A9A6 A9CC
3E Outside Zenethia         AB0F
3F Birdsong Tower           ABE1 AC2D AC99 ACEA AD52 AD6C
40 World Tree               AD92 AE4E AF97 B0D8 B212 B327
41 Loch Tower               B40A B439 B497 B4F7 B577 B5CF
42 Lighthouse               B611 B681 B6B2 B71B B784
43 Konenber                 B7D6 B898 B8DD B904 B91C B953 B96A BAA7 BB3A BB8A BBAE
44 Radimvice Shrine         BBE4 BBFB BC1B BC59
45 Necrosaro's Palace       BCA5 BE6C BF10 BF6A BFA1   (Remaining three submaps are on Bank 0B)

Bank 0B: (2C000)

Map Data

Note: The pointers for maps are stored on Bank 17

Bank 0B contains Map Data for these locations:

45 Necrosaro's Palace       8075 80C1 8158 (Previous five submaps are on Bank 0A)
46 Zenethia                 81A8 8313 834D 83B9
47 Shrine of the Horn       84C1 857A
48 Shrine of Colossus       85A8 8618 875B 8848 8945 89AF 8A5B 8B46 8BDC 8C49

Overworld Map Data and Pointers

  • 8CEE: Map Data for Main Overworld Map (pointers point here)
  • A590: Row Pointers for Main Overworld Map
  • A990: Map Data for Gottside Overworld Map
  • AB65: Row Pointers for Gottside Overworld Map
  • AC65: Map Data for Underworld Overworld Map
  • AE89: Row Pointers for Underworld Overworld map

Format for overworld row pointers:

  • 2-bytes Pointer
  • 1-byte Size of compressed data in bytes until you reach X=128
  • 1-byte Size of compressed data in bytes until you reach X=256 (for the small overworld maps, this matches the previous byte)

Format for overworld data:

  • ...xxxxx = Length (add 1)
  • xxx..... = Tile
  • If byte value >= 0xE8 (Tile 7 and length value >= 8), it's a special tile that's one long. Subtract 0xE0 from the byte, and use that as the tile number.


Bank 0C: (30000)

Graphics

  • $8000: Map Tile Graphics. Used when the game wants the tile graphics from page 0

Bank 0D: (34000)

Graphics

  • $8001: Map Tile graphics. Used when the game wants tile graphics from page 1
  • $9F14: Map Tile graphics. Used when the game wants tile graphics from page 2
  • $B304: Character sprite graphics

Other

  • $BE44: Empty space
  • $BFD4: End of empty space, some other code or data

Bank 0E: (38000)

Code

  • $8008-$8090: Code

Graphics

  • $8097: Character sprite graphics
  • $BAD7: end of character sprite graphics, some other code or data

Map Palette Decision

  • $BAF7-$BB52: Code for deciding palette for the map

Normally, the tileset number is used to select the palette. But this can be overridden. If the Map and Submap is found on a list, it can use a substitute value instead of the tileset number.

  • $BB53-$BB66: List of map numbers with palette overrides, $80-$FF terminates list. Map numbers will repeat if multiple submaps need to be checked.
  • $BB75-$BB87: List of submap numbers for the list above, $80-$FF matches any submap.
  • $BB67-$BB74: The override values, used instead of the Tileset number. Only used when the map and submap matches, and list index is less than $0E.
  • $BB88-$BC09: List of palette numbers. Usually, the index into this table is Tileset * 2 + (00 for daytime or 01 for night time), but "Tileset" can be overridden.

Special cases:

  • When List Index is $0E (Lighthouse), check if bit $#10 of $6293 is set. If it is, the Lighthouse has been cleared, and use value #$36 instead of the tileset number.
  • When List Index is $0F or $10 (Final Cave), force night time
  • When List Index is $11 or higher (Endor Casino and Cascade Cave), force day time

Maps that have palette overrides:

Map                        Submap Numbers
48 = Shrine of Colossus  - 08 06 05 00
46 = Zenethia            - 01 02 03
3B = Royal Crypt         - FF
2D = Aktemto Mine        - 05 06 07 09
3D = Zenethian Tower     - 0F 10
42 = Lighthouse          - FF  <-this is list index 0E
2A = Final Cave          - FF  <-this is list index 0F
35 = Final Cave          - FF
04 = Endor               - 01  <-this is list index 11
34 = Cascade Cave        - 03

After the palette number is chosen, four color set bytes are read, then those are used to get the actual palette colors.

  • $BC0A-$BCE1: Multiply palette number by 4, and read 4 bytes from Table $BC0A. Each byte read from this table refers to a set of 3 colors.
  • $BCE2-$BE12: The actual palette data. Multiply the number above by 3 and add to the base address, then copy 3 palette colors out.

Bank 17: (5C000)

Map Pointers

Maps 0x00-0x48 are defined. See Map List

There are two variables used to look up map numbers: Main Map Number ($63), and Submap Number ($64). Submaps include upstairs areas or different floors of a dungeon.

  • $B08D-$B11F: Pointer Table for Map Information.
    • There are 73 total entries in this table, one for each map. It points to a 3-byte 'Map Information Data' described below. Add 3 * Submap Number to the pointer that you read from this table.
  • $B121-$B4AE: Map Information data. There is one entry per submap, and after the last entry, there is an FF byte separator. Each entry is 3 bytes long.
    • Byte 0: Tileset Number
    • Byte 1,2: Map Data Address (low byte then high byte)

Note: Bank number for the map is not stored in any table. There is a function at Bank 0F, Address 3E9AD that returns the bank number for a given map and submap number.