diff --git a/Core/ram.asm b/Core/ram.asm index 729e532..bf65c41 100644 --- a/Core/ram.asm +++ b/Core/ram.asm @@ -1,7 +1,7 @@ -;=================================================================================================== -;--------------------------------------------------------------------------------------------------- +; ========================================================= +; --------------------------------------------------------- ; USING THIS SYMBOLS MAP -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Except for larger blocks of data, every address will be given at least one symbol ; Symbols are each given a unique name with focus on hierarchy by nature of usage ; @@ -22,19 +22,19 @@ ; For documentation on hardware registers, see «registers.asm» ; For documentation on save game data, see «symbols_sram.asm» ; For documentation on APU addresses, see «symbols_apu.asm» -;=================================================================================================== +; ========================================================= -;=================================================================================================== -;--------------------------------------------------------------------------------------------------- +; ========================================================= +; --------------------------------------------------------- ; DIRECT PAGE -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Reminder that direct page is always an address in bank 00. ; For ALTTP's mapping and functionality this will always be a mirror of bank 7E page 00 or page 1F. ; For the most part, ALTTP leaves the direct page register (D) at $0000. ; The polyhedral code that draws the triforce and crystals will change this register during IRQ. ; The symbols here mirror page 00 of bank 7E. -;--------------------------------------------------------------------------------------------------- -;=================================================================================================== +; --------------------------------------------------------- +; ========================================================= ; Any use of these addresses should be considered incredibly volatile. ; LENGTH: 0x10 @@ -49,11 +49,11 @@ SCRAP07 = $7E0007 SCRAP08 = $7E0008 SCRAP09 = $7E0009 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; TILE ACT NOTES -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; SCRAP0A is used as a direction bitfield during tile act routines. -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; For tile act bitfields, each property is flagged with 4 bits. ; These bits indicate which tile relative Link the tile was found ; @@ -68,7 +68,7 @@ SCRAP09 = $7E0009 ; d - found to the south east ; ; L - Link -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- SCRAP0A = $7E000A SCRAP0B = $7E000B @@ -727,15 +727,15 @@ UNUSED_FE = $7E00FE ; Vertical scanline trigger for IRQ NMIVTIME = $7E00FF -;=================================================================================================== -;--------------------------------------------------------------------------------------------------- +; ========================================================= +; --------------------------------------------------------- ; WRAM MIRROR -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Pages 0x00–0x1F of bank 7E are mirrored to every program bank ALTTP uses. ; These addresses can be accessed with absolute addressing, ; as long as the data bank is not 0x70 or 0x7F. -;--------------------------------------------------------------------------------------------------- -;=================================================================================================== +; --------------------------------------------------------- +; ========================================================= ; Link animation values POSECHR = $7E0100 @@ -867,7 +867,7 @@ RESETRET = $7E01FE ; Top of stack STACK = $7E01FF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Used by interfaces as a submodule ID. ; High byte is never written, but always expected to be 0x00. @@ -1271,7 +1271,7 @@ UNUSED_7E02FD = $7E02FD UNUSED_7E02FE = $7E02FE UNUSED_7E02FF = $7E02FF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Step counter for Y-item animations. Also used for zap. ITEMSTEP = $7E0300 @@ -1933,7 +1933,7 @@ INBIRD = $7E03FD UNUSED_7E03FE = $7E03FE UNUSED_7E03FF = $7E03FF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Doors unlocked in a given room ; High byte is the main one used and sent to SRAM. @@ -2416,7 +2416,7 @@ TORCHD = $7E04FD TORCHE = $7E04FE TORCHF = $7E04FF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Used in the overworld as a buffer for tile16 M16BUFF500 = $7E0500 @@ -2508,7 +2508,7 @@ PBLOCK1X = $7E05FD UNUSED_7E05FE = $7E05FE UNUSED_7E05FF = $7E05FF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Camera scroll boundaries for big (B) and small (A) rooms in directions NSEW SCROLLAN = $7E0600 @@ -2792,7 +2792,7 @@ UNUSED_7E06FD = $7E06FD UNUSED_7E06FE = $7E06FE UNUSED_7E06FF = $7E06FF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; ........ yyyzxxx. ; Caclulated as: @@ -2856,7 +2856,7 @@ OWSCROLLH = $7E0717 ; BIG FREE RAM: 0xE8 MAP16OVERFLOW = $7E0718 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Main buffer sent to OAM OAMBUFF = $7E0800 @@ -2866,7 +2866,7 @@ OAMBUFF2 = $7E0A00 ; ORA'd in every frame. OAMBUFFSX = $7E0A20 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; GFX sheets MAINGFX = $7E0AA0 @@ -3041,7 +3041,7 @@ UNUSED_7E0AFD = $7E0AFD UNUSED_7E0AFE = $7E0AFE UNUSED_7E0AFF = $7E0AFF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Overlord IDs OL0ID = $7E0B00 @@ -3390,7 +3390,7 @@ SPRDPRIZE = $7E0BED SPREPRIZE = $7E0BEE SPRFPRIZE = $7E0BEF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; TODO ANC0MISCM = $7E0BF0 @@ -3601,7 +3601,7 @@ ANC7OAML = $7E0C97 ANC8OAML = $7E0C98 ANC9OAML = $7E0C99 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Current overworld screen sprite is loaded on. ; Used to kill sprites during screen transitions @@ -3785,7 +3785,7 @@ CHACHING = $7E0CFD PAL2F = $7E0CFE PAL2FH = $7E0CFF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Sprite coordinates ; y low @@ -4755,7 +4755,7 @@ BOULDER = $7E0FFE ; Light world or dark world WORLDFLAG = $7E0FFF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Used by stripes for arbitrary VRAM transfers. GFXSTRIPES = $7E1000 @@ -4763,7 +4763,7 @@ GFXSTRIPES = $7E1000 ; Used for room drawing ROOMSTRIPES = $7E1100 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Door types TODO DOOR0TYPE = $7E1980 @@ -4888,7 +4888,7 @@ EXIT3TXH = $7E19E9 ; FREE RAM: 0x16 UNUSED_7E19EA = $7E19EA -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; 20 steps of animation and movement caching for followers FOLLOWERYL = $7E1A00 @@ -4966,12 +4966,12 @@ UNUSED_7E1AFE = $7E1AFE ; Not used for anything. MIRRORCOUNT = $7E1AFF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Spotlight windowing values for the IRIS HDMA IRIS = $7E1B00 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; FREE RAM: 0x10 UNUSED_7E1CC0 = $7E1CC0 @@ -5087,7 +5087,7 @@ UNUSED_7E1CFD = $7E1CFD UNUSED_7E1CFE = $7E1CFE UNUSED_7E1CFF = $7E1CFF -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Self-explanatory sprite caching CACHE_0DD0 = $7E1D00 @@ -5107,11 +5107,11 @@ CACHE_0F20 = $7E1DD0 CACHE_0D80 = $7E1DE0 CACHE_0E60 = $7E1DF0 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Polyhedral variables used by the intro and ending sequence. -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Be wary of FREE RAM listed here, as it will be cleared with other values here. -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Cutscene act SCENESTEP = $7E1E00 @@ -5184,18 +5184,18 @@ UNUSED_7E1E68 = $7E1E68 ; This big block is actually 100% safe UNUSED_7E1E70 = $7E1E70 -;=================================================================================================== -;--------------------------------------------------------------------------------------------------- +; ========================================================= +; --------------------------------------------------------- ; IRQ DIRECT PAGE -;--------------------------------------------------------------------------------------------------- -;=================================================================================================== -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- +; ========================================================= +; --------------------------------------------------------- ; The polyhedral code is the only instance of direct page juggling in ALTTP ; most addresses here will be accessed with direct page addressing ; ; Be wary of FREE RAM listed here, as it will be zeroed whenever the polyhedral thread initializes. -;--------------------------------------------------------------------------------------------------- -;=================================================================================================== +; --------------------------------------------------------- +; ========================================================= ; Tells the polyhedral thread to wait for IRQ. POLYWAIT = $7E1F00 @@ -5363,13 +5363,13 @@ UNUSED_7E1FFD = $7E1FFD UNUSED_7E1FFE = $7E1FFE UNUSED_7E1FFF = $7E1FFF -;=================================================================================================== -;--------------------------------------------------------------------------------------------------- +; ========================================================= +; --------------------------------------------------------- ; UNMIRRORED WRAM ; Addresses from here on can only be accessed with long addressing ; or absolute addressing with the appropriate data bank set -;--------------------------------------------------------------------------------------------------- -;=================================================================================================== +; --------------------------------------------------------- +; ========================================================= ; In the underworld, this holds a copy of the entire BG tilemap for ; Layer 1 (BG2) in TILEMAPA @@ -5379,12 +5379,12 @@ UNUSED_7E1FFF = $7E1FFF TILEMAPA = $7E2000 TILEMAPB = $7E4000 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Decompression scratch space DECOMP = $7E6000 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Fully decompressed 4BPP buffer for common graphics GFX_SWORD = $7E9000 @@ -5413,12 +5413,12 @@ GFX_FOLLOWER = $7EB940 GFX_ITEMGET = $7EBD40 GFX_STARS = $7EBDC0 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; BIG FREE RAM: 0x0200 UNUSED_7EBE00 = $7EBE00 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Target room ID of pits/warps and stairs WARPTO = $7EC000 @@ -5476,7 +5476,7 @@ AGAFADEDIR = $7EC01F ; BIG FREE RAM: 0xDB UNUSED_7EC025 = $7EC025 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Variable caching for special overworld SPO_OWSCR2L = $7EC100 @@ -5679,7 +5679,7 @@ CC_DNGFLOOR = $7EC1AA ; FREE RAM: 0x55 UNUSED_7EC1AB = $7EC1AB -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Overworld map caching OMC_BG1HORZL = $7EC200 @@ -5759,9 +5759,9 @@ LASTSPRSET1 = $7EC2FD LASTSPRSET2 = $7EC2FE LASTSPRSET3 = $7EC2FF -;=================================================================================================== +; ========================================================= ; Palette buffer 2 -;=================================================================================================== +; ========================================================= ; HUD palettes PALB_HUD0 = $7EC300 @@ -5805,9 +5805,9 @@ PALB_SPR6B = $7EC4D0 PALB_SPR7A = $7EC4E0 PALB_SPR7B = $7EC4F0 -;=================================================================================================== +; ========================================================= ; Main palette block written to CGRAM -;=================================================================================================== +; ========================================================= ; HUD palettes PAL_HUD0 = $7EC500 @@ -5851,13 +5851,13 @@ PAL_SPR6B = $7EC6D0 PAL_SPR7A = $7EC6E0 PAL_SPR7B = $7EC6F0 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; TODO MORE ; Tilemap buffer for the HUD HUD = $7EC700 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; FREE RAM: 0x36 UNUSED_7EC84A = $7EC84A @@ -5868,18 +5868,18 @@ WALLDRAW = $7EC880 ; BIG FREE RAM: 0x1F00 UNUSED_7EC900 = $7EC900 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; TODO POLYDRAW = $7EE800 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; SRAM mirror for current file ; see symbols_sram.asm WRAMSAVE = $7EF000 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; FREE RAM: 0x80 UNUSED_7EF500 = $7EF500 @@ -5887,7 +5887,7 @@ UNUSED_7EF500 = $7EF500 ; Tracks lifted pot secrets POTLIFT = $7EF580 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Caches the tilemap location of changed map16 tiles on the overworld M16CHTMAPX = $7EF800 @@ -5905,26 +5905,26 @@ TORCHES = $7EFB40 SHEETLISTA = $7EFCC0 SHEETLISTB = $7EFD40 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; FREE RAM: 0x40 UNUSED_7EFDC0 = $7EFDC0 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Table of tile properties for interaction TILEATTR = $7EFE00 -;=================================================================================================== -;--------------------------------------------------------------------------------------------------- +; ========================================================= +; --------------------------------------------------------- ; Bank 7F -;--------------------------------------------------------------------------------------------------- -;=================================================================================================== +; --------------------------------------------------------- +; ========================================================= ; Decompression buffer DECOMPA = $7F0000 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; In the underworld, these arrays contain tile the tile's collision type for each layer. ; Layer 1 (COLMAPA) @@ -5936,7 +5936,7 @@ DECOMPA = $7F0000 COLMAPA = $7F2000 COLMAPB = $7F3000 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Decompression buffer DECOMPB = $7F4000 @@ -5944,7 +5944,7 @@ DECOMPB = $7F4000 ; BIG FREE RAM: 0x0800 UNUSED_7F5000 = $7F5000 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Used by medallions, sword beams, gt crystals, and rupee pond rupees ; Not worth documenting them all right now @@ -6008,7 +6008,7 @@ ANC_7F58B6 = $7F58B6 ANC_7F58B8 = $7F58B8 ANC_7F58E4 = $7F58E4 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; TODO at least this much ; FREE RAM: 0x024 @@ -6051,29 +6051,29 @@ BOMBOS_7F5A57 = $7F5A57 ; BIG FREE RAM: 0xA8 UNUSED_7F5A58 = $7F5A58 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Used when decompressing text characters TEXTDECOMP = $7F5B00 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; BIG FREE RAM: 0xFE UNUSED_7F5F02 = $7F5F02 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Damage class to subclass for every enemy ; 16 bytes per enemy, including garbage from garbage data for invalid sprites ; See «resources/damagetable.asm» for decompressed and decompiled data DMGTABLE = $7F6000 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Used as a buffer for writing to IRIS IRISBUFFER = $7F7000 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Text pointers in bank 1C, built procedurally. ; Expected vanilla values for JP1.0 listed as comment. @@ -6474,12 +6474,12 @@ MSG0189 = $7F74D2 ; $F310 MSG018A = $7F74D4 ; $F325 MSG018B = $7F74D6 ; $F356 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; MASSIVE FREE RAM: 0x68A8 UNUSED_7F74D8 = $7F74D8 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; TODO PALSAVE = $7FDD80 @@ -6496,12 +6496,12 @@ UWDEATH = $7FDF80 ; Flags overworld sprite deaths/enemies already spawned OWDEATH = $7FEF80 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; BIG FREE RAM: 0x680 UNUSED_7FF180 = $7FF180 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Garnish IDs GRN00_ID = $7FF800 @@ -7038,7 +7038,7 @@ GRN1B_9FE = $7FFA19 GRN1C_9FE = $7FFA1A GRN1D_9FE = $7FFA1B -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Current stage of lifting for sprite SPR0LIFT = $7FFA1C @@ -7128,7 +7128,7 @@ SPRCACHE_7FFADC = $7FFADC ; FREE RAM: 0x30 UNUSED_7FFAEC = $7FFAEC -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; TODO SWAMSEG2A = $7FFB1C @@ -7164,7 +7164,7 @@ GANONWARPYH = $7FFD6E ; Used with drawing segmented enemies SEGMENTS_7FFD80 = $7FFD80 -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; Number of digs in digging game DIGS = $7FFE00 @@ -7191,9 +7191,9 @@ SPR_7FFE00 = $7FFE00 SPR_7FFE80 = $7FFE00 SPR_7FFF00 = $7FFF00 -;=================================================================================================== +; ========================================================= -;=================================================================================================== +; ========================================================= ; Save data is located in 2 separate locations in SRAM: ; File 1: $70:0000 Mirror: $70:0F00 ; File 2: $70:0500 Mirror: $70:1400 @@ -7204,9 +7204,9 @@ SPR_7FFF00 = $7FFF00 ; ; Use of unused SRAM is not recommended for general purpose memory ; As it will be kept across game sessions -;=================================================================================================== +; ========================================================= ; The following ASCII art is included because MathOnNapkins likes it: -;--------------------------------------------------------------------------------------------------- +; --------------------------------------------------------- ; ; /\/\/\/ ||\\\\ || |||\\ /\ |||||||||||| /\ ; /| || || // \\ //\\ || || || //\\ @@ -7226,7 +7226,7 @@ SPR_7FFF00 = $7FFF00 ; <<>> **** **** **** ; <> ** ** ** ; -;=================================================================================================== +; ========================================================= FILE1MAIN = $700000 FILE2MAIN = $700500 FILE3MAIN = $700A00 @@ -7240,14 +7240,14 @@ FREESRAM = $701E00 ; Used to find the correct save file offset to use when transferring between SRAM and WRAM. SRAMOFF = $701FFE -;=================================================================================================== +; ========================================================= ; Documention is for WRAM, as SRAM is not directly accessed except when ; verifying the file ; loading/saving ; Do note that the offset into any particular block of save is data is ; just equal to the bottom 3 nibbles of the WRAM address. ; e.g. $7E:F340 is an offset of +$0340 into the block -;=================================================================================================== +; ========================================================= ; Room flag data ; dddd bkut sehc qqqq ; d - door opened @@ -7582,13 +7582,13 @@ RMFLG13D = $7EF27A RMFLG13E = $7EF27C RMFLG13F = $7EF27E -;=================================================================================================== +; ========================================================= ; Overworld data ; .io. ..b. ; i - item collected / lightning barrier destroyed ; o - overlay active ; b - bomb wall opened -;=================================================================================================== +; ========================================================= OWFLG00 = $7EF280 OWFLG01 = $7EF281 OWFLG02 = $7EF282 @@ -7756,9 +7756,9 @@ OWFLG9D = $7EF31D OWFLG9E = $7EF31E OWFLG9F = $7EF31F -;=================================================================================================== +; ========================================================= ; Items -;=================================================================================================== +; ========================================================= ; 0x00 - Nothing ; 0x01 - Bow ; 0x02 - Bow and arrows @@ -8164,7 +8164,7 @@ UNUSED_7EF403 = $7EF403 SAVEICKSML = $7EF4FE SAVEICKSMH = $7EF4FF -;=================================================================================================== +; ========================================================= INIDISP = $002100 OBSEL = $002101