Difference between revisions of "Underworld"

From TLoZ: ALTTP Hacking Resources
Jump to: navigation, search
m (Important Hex Addresses)
Line 8: Line 8:
  
 
<blockquote>
 
<blockquote>
Headers are formatted thusly:
+
Headers are $0E (Decimal: 14) bytes formatted thusly:
 
*byte 0: aaab bbcd
 
*byte 0: aaab bbcd
 
**the a bits are transformed into 0000 0aaa and stored to $0414 ("BG2" in Hyrule Magic)
 
**the a bits are transformed into 0000 0aaa and stored to $0414 ("BG2" in Hyrule Magic)
Line 57: Line 57:
 
===Sprite Data===
 
===Sprite Data===
 
*$04D62E-$04D92E - Pointer Table, 2 byte local addresses, indexed by room.
 
*$04D62E-$04D92E - Pointer Table, 2 byte local addresses, indexed by room.
 +
*$04D92E-$04EC9D - Data
 +
<blockquote>
 +
Sprite data is formatted thusly:
 +
*First Byte: Stored to $0FB3. Not sure what the purpose of that is yet.
 +
After the first byte, you will see 3 byte clusters that break down thus: 
 +
*First Byte:
 +
**Bits 4,3,2,1,0 - Y coordinate (in pixels from the top, starting at 0) of the sprite divided by 16.
 +
**Bits 6,5 - If these are set, they will be used to generate a subtype, stored to $0E30, X.
 +
**Bit 7 - If set, the sprite is on BG2, if not it's on BG1
 +
   
 +
*Second Byte:
 +
**Bits 4,3,2,1,0 - X coordinate (in pixels from the far left, starting at 0) of the sprite divided by 16.
 +
**Bits 7,6,5 - If all these bits are set then this is an Overlord, otherwise it's a normal sprite. If only some of them are set they can be used to generate a subtype, stored at $0E30, X
 +
   
 +
*Third Byte: Sprite or Overlord type. If a sprite, this will get loaded into a slot at $0E20, X. If an Overlord, will get loaded to $0B00, X.
 +
   
 +
The array is terminated with a byte of $FF.
 +
</blockquote>
  
 
===Object Data===
 
===Object Data===

Revision as of 21:32, 17 April 2016

The underworld refers to all indoor locations; including dungeons, caves, and houses.

Important Hex Addresses

Room Headers

  • $027502-$027781 - Pointer Table, 2 byte local addresses, indexed by room.
  • $027781-$027FEF - Data

Headers are $0E (Decimal: 14) bytes formatted thusly:

  • byte 0: aaab bbcd
    • the a bits are transformed into 0000 0aaa and stored to $0414 ("BG2" in Hyrule Magic)
    • the b bits are transformed into 0000 0bbb and stored to $046C ("Collision" in Hyrule Magic)
    • the c bit is unused
    • the d bit is stored to $7EC005 (If set, use a lights out routine in the room transition)
  • byte 1: aabb bbbb
    • the a bits are unused
    • the b bits are transformed into bbbb bb00, thus making them a multiple of 4.

This value is used to load 4 different palettes for the dungeon, and corresponds to, you guessed it, Palette # in Hyrule Magic!

The resulting index is used to load values for $0AB6, $0AAC, $0AAD, and $0AAE

  • byte 2: gets stored to $0AA2 (GFX # in Hyrule Magic)
  • byte 3: value + #$40 gets stored to $0AA3 (Sprite GFX # in Hyrule Magic)
  • byte 4: gets stored to $00AD ("Effect" in Hyrule Magic)
  • byte 5: gets stored to $00AE ("Tag1" in Hyrule Magic)
  • byte 6: gets stored to $00AF ("Tag2" in Hyrule Magic)

These are the planes to use for bytes 9 through D. This determines which BG you appear on, and possibly more.

  • byte 7: aabb ccdd
    • the a bits are transformed into 0000 00aa and stored to $063F
    • the b bits are transformed into 0000 00bb and stored to $063E
    • the c bits are transformed into 0000 00cc and stored to $063D
    • the d bits are transformed into 0000 00dd and stored to $063C

Note, the only safe values for a plane seem to be 0,1, or 2. Hyrule Magic appears to violate this rule by letting you put 3 down, but nothing higher.

  • byte 8: aaaa aabb
    • the a bits are unused
    • the b bits are transformed into 0000 00bb and stored to $0640
  • byte 9: stored to $7EC000 These are all room numbers that you could possibly exit to.
  • byte A: stored to $7EC001
  • byte B: stored to $7EC002
  • byte C: stored to $7EC003
  • byte D: stored to $7EC004

Sprite Data

  • $04D62E-$04D92E - Pointer Table, 2 byte local addresses, indexed by room.
  • $04D92E-$04EC9D - Data

Sprite data is formatted thusly:

  • First Byte: Stored to $0FB3. Not sure what the purpose of that is yet.

After the first byte, you will see 3 byte clusters that break down thus:

  • First Byte:
    • Bits 4,3,2,1,0 - Y coordinate (in pixels from the top, starting at 0) of the sprite divided by 16.
    • Bits 6,5 - If these are set, they will be used to generate a subtype, stored to $0E30, X.
    • Bit 7 - If set, the sprite is on BG2, if not it's on BG1
  • Second Byte:
    • Bits 4,3,2,1,0 - X coordinate (in pixels from the far left, starting at 0) of the sprite divided by 16.
    • Bits 7,6,5 - If all these bits are set then this is an Overlord, otherwise it's a normal sprite. If only some of them are set they can be used to generate a subtype, stored at $0E30, X
  • Third Byte: Sprite or Overlord type. If a sprite, this will get loaded into a slot at $0E20, X. If an Overlord, will get loaded to $0B00, X.

The array is terminated with a byte of $FF.

Object Data

  • $0F8000-$0F83BF - Pointer Table, 3 byte long addresses, indexed by room.

Dungeon Secrets Data

  • $00DB69 - $00DDE8 - Pointer Table

Push Block Data

  • $0271DE-$027369 - Pointer Table

(Inter Room) Torch Data

  • $02736A-$027489 - Pointer Table

Chest Contents

  • $00E96E - $00EB65 - Data

Rooms

Main Map

The main underworld map consists of $FF (decimal: 256) rooms.

Secondary Map