summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/gfx.asm52
-rw-r--r--engine/palettes.asm113
-rw-r--r--home/copy2.asm14
-rw-r--r--home/joypad.asm2
-rw-r--r--home/pokemon.asm2
-rw-r--r--hram.asm32
-rw-r--r--macros/wram.asm15
-rw-r--r--shim.sym82
-rw-r--r--wram.asm212
9 files changed, 453 insertions, 71 deletions
diff --git a/engine/gfx.asm b/engine/gfx.asm
index 2c19fe6..66b3f90 100644
--- a/engine/gfx.asm
+++ b/engine/gfx.asm
@@ -6,22 +6,22 @@ LoadFontGraphics:: ; f8000 (3e:4000)
ld de, FontGFX
ld hl, $8800
lb bc, BANK(FontGFX), ((FontGFXEnd - FontGFX) / LEN_1BPP_TILE)
- jp CopyVideoDataDoubleOptimized
+ jp Get1bpp
LoadFontExtraGraphicsWithCursor:: ; f800c (3e:400c)
ld de, FontExtraCDEFGHIVSLM_GFX
ld hl, $9620
lb bc, BANK(FontExtraCDEFGHIVSLM_GFX), ((FontSmallKanaPunctuationGFXEnd - FontExtraCDEFGHIVSLM_GFX) / LEN_2BPP_TILE)
- call CopyVideoDataOptimized
+ call Get2bpp
ld de, BlackTileAndCursor1bppGFX
ld hl, $9600
lb bc, BANK(BlackTileAndCursor1bppGFX), ((BlackTileAndCursor1bppGFXEnd - BlackTileAndCursor1bppGFX) / LEN_1BPP_TILE)
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
jr LoadActiveFrameGraphics
LoadPokemonMenuGraphics:: ; f8026 (3e:4026)
ld de, BattleHPBarGFX
ld hl, $9600
lb bc, BANK(BattleHPBarGFX), ((LevelUpGFXEnd - BattleHPBarGFX) / LEN_2BPP_TILE)
- call CopyVideoDataOptimized
+ call Get2bpp
jr LoadActiveFrameGraphics
LoadHexadecimalFontOrHUDGraphics:: ; f8034 (3e:4034)
call LoadActiveFrameGraphics
@@ -31,25 +31,25 @@ LoadHexadecimalFontOrHUDGraphics:: ; f8034 (3e:4034)
ld hl, $9660
ld de, FontGFX + (("0" - "ア") * $08)
lb bc, BANK(FontGFX), ("9" - "0" + 1)
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
ld hl, $9700
ld de, FontExtraAB_GFX
lb bc, BANK(FontExtraAB_GFX), ("F" - "A" + 1)
- call CopyVideoDataOptimized
+ call Get2bpp
ret
LoadHudGraphics:: ; f8057 (3e:4057)
ld hl, $9660
ld de, FontGFX + (("0" - "ア") * $08)
lb bc, BANK(FontGFX), ("9" - "0" + 1)
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
ld hl, $9700
ld de, $7381
ld bc, $0401
- call CopyVideoDataOptimized
+ call Get2bpp
ld hl, $9710
ld de, HUD_GFX
lb bc, BANK(HUD_GFX), ((HUD_GFXEnd - HUD_GFX) / LEN_2BPP_TILE)
- call CopyVideoDataOptimized
+ call Get2bpp
ret
LoadActiveFrameGraphics:: ; f807c (3e:407c)
ld a, [wActiveFrame]
@@ -60,80 +60,80 @@ LoadActiveFrameGraphics:: ; f807c (3e:407c)
ld e, l
ld hl, $9790
lb bc, BANK(FrameGFX), ((FrameGFXFirstFrameEnd - FrameGFXFirstFrame) / LEN_1BPP_TILE)
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
ld hl, $97f0
ld de, EmptyTile1bppGFX
lb bc, BANK(EmptyTile1bppGFX), ((EmptyTile1bppGFXEnd - EmptyTile1bppGFX) / LEN_1BPP_TILE)
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
ret
LoadPokeDexGraphics:: ; f80a0 (3e:40a0)
call LoadPokemonMenuGraphics
ld de, PokedexGFX
ld hl, $9600
lb bc, BANK(PokedexGFX), ((PokedexLocationGFXEnd - PokedexGFX) / LEN_2BPP_TILE)
- call CopyVideoDataOptimized
+ call Get2bpp
ld de, PokeBallsGFX
ld hl, $9720
lb bc, BANK(PokeBallsGFX), 1 ; 1 of 4 tiles
- jp CopyVideoDataOptimized
+ jp Get2bpp
LoadBattleGraphics:: ; f80bb (3e:40bb)
ld de, BattleHPBarGFX
ld hl, $9600
lb bc, BANK(BattleHPBarGFX), ((BattleHPBarGFXEnd - BattleHPBarGFX) / LEN_2BPP_TILE)
- call CopyVideoDataOptimized
+ call Get2bpp
ld hl, $9700
ld de, BattleMarkersGFX
lb bc, BANK(BattleMarkersGFX), ((BattleMarkersGFXEnd - BattleMarkersGFX) / LEN_2BPP_TILE)
- call CopyVideoDataOptimized
+ call Get2bpp
call LoadActiveFrameGraphics
ld de, HpExpBarParts0GFX
ld hl, $96c0
lb bc, BANK(HpExpBarParts0GFX), ((HpExpBarParts0GFXEnd - HpExpBarParts0GFX) / LEN_1BPP_TILE)
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
ld de, HpExpBarParts1GFX
ld hl, $9730
lb bc, BANK(HpExpBarParts1GFX), ((HpExpBarParts3GFXEnd - HpExpBarParts1GFX) / LEN_1BPP_TILE)
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
ld de, ExpBarGFX
ld hl, $9550
lb bc, BANK(ExpBarGFX), ((ExpBarGFXEnd - ExpBarGFX) / LEN_2BPP_TILE)
- call CopyVideoDataOptimized
+ call Get2bpp
ret
LoadPokemonStatsGraphics:: ; f80fb (3e:40fb)
call LoadPokemonMenuGraphics
ld de, HpExpBarParts0GFX
ld hl, $96c0
lb bc, BANK(HpExpBarParts0GFX), ((HpExpBarParts0GFXEnd - HpExpBarParts0GFX) / LEN_1BPP_TILE)
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
ld de, HpExpBarParts1GFX
ld hl, $9780
lb bc, BANK(HpExpBarParts1GFX), 1 ; 1 of 6 tiles
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
ld de, HpExpBarParts2GFX
ld hl, $9760
lb bc, BANK(HpExpBarParts0GFX), ((HpExpBarParts2GFXEnd - HpExpBarParts2GFX) / LEN_1BPP_TILE)
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
ld de, ExpBarGFX
ld hl, $9550
lb bc, BANK(ExpBarGFX), ((ExpBarGFXEnd - ExpBarGFX) / LEN_2BPP_TILE)
- call CopyVideoDataOptimized
+ call Get2bpp
ld de, StatsGFX
ld hl, $9310
lb bc, BANK(StatsGFX), ((StatsGFXEnd - StatsGFX) / LEN_2BPP_TILE)
- call CopyVideoDataOptimized
+ call Get2bpp
ret
LoadBackpackGraphics:: ; f813b (3e:413b)
ld de, BlackTileAndCursor1bppGFX
ld hl, $9600
lb bc, BANK(BlackTileAndCursor1bppGFX), ((BlackTileAndCursor1bppGFXEnd - BlackTileAndCursor1bppGFX) / LEN_1BPP_TILE)
- call CopyVideoDataDoubleOptimized
+ call Get1bpp
ld de, PackIconGFX
ld hl, $9620
lb bc, BANK(PackIconGFX), 12 ; 12 of 15 tiles
- call CopyVideoDataOptimized
+ call Get2bpp
ld de, FontSmallKanaPunctuationGFX
ld hl, $96e0
lb bc, BANK(FontSmallKanaPunctuationGFX), ((FontSmallKanaPunctuationGFXEnd - FontSmallKanaPunctuationGFX) / LEN_2BPP_TILE)
- call CopyVideoDataOptimized
+ call Get2bpp
jp LoadActiveFrameGraphics
; 0xf8162 \ No newline at end of file
diff --git a/engine/palettes.asm b/engine/palettes.asm
new file mode 100644
index 0000000..d1f93c0
--- /dev/null
+++ b/engine/palettes.asm
@@ -0,0 +1,113 @@
+INCLUDE "constants.asm"
+
+SECTION "Overworld fade", ROMX[$433e],BANK[$23]
+
+OverworldFadeIn:: ; 23:433e
+ ld c, 0
+ call GetFadeStep
+ ld b, 4
+ call FadeTowardsWhite
+ ret
+
+OverworldFadeOut:: ; 23:4349
+ ld c, 9
+ call GetFadeStep
+ ld b, 4
+ call FadeTowardsBlack
+ ret
+
+
+; TODO: merge this
+SECTION "Palette fading, part 2?", ROMX[$43d1],BANK[$23]
+
+ApplyPalettesAtHL:: ; 23:43d1
+ push hl
+ ld a, [hli]
+ ld [rBGP], a
+ ld a, [hli]
+ ld [rOBP0], a
+ ld a, [hli]
+ ld [rOBP1], a
+ pop hl
+ ret
+
+FadeTowardsWhite:: ; 23:43dd
+ call ApplyPalettesAtHL
+ inc hl
+ inc hl
+ inc hl
+ ld c, 8
+ call DelayFrames
+ dec b
+ jr nz, FadeTowardsWhite
+ ret
+
+FadeTowardsBlack:: ; 23:43ec
+ call ApplyPalettesAtHL
+ dec hl
+ dec hl
+ dec hl
+ ld c, 8
+ call DelayFrames
+ dec b
+ jr nz, FadeTowardsBlack
+ ret
+
+GetFadeStep:: ; 23:43fb
+ ld a, [wTimeOfDayPal]
+ and 3
+ push bc
+ ld c, a
+ ld b, 0
+ ld hl, .sequences
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ pop bc
+ ld b, 0
+ add hl, bc
+ ret
+
+.sequences
+ dw .sequence0
+ dw .sequence1
+ dw .sequence2
+ dw .sequence3
+
+.sequence0
+ db $ff, $ff, $ff
+ db $fe, $fe, $fe
+ db $f9, $e4, $e4
+ db $e4, $d0, $d0
+ db $90, $80, $80
+ db $40, $40, $40
+ db $00, $00, $00
+
+.sequence1
+ db $ff, $ff, $ff
+ db $fe, $fe, $fe
+ db $f9, $e4, $e4
+ db $e9, $d0, $d0
+ db $90, $80, $80
+ db $40, $40, $40
+ db $00, $00, $00
+
+.sequence2
+ db $ff, $ff, $ff
+ db $fe, $fe, $ff
+ db $f9, $e4, $ff
+ db $f9, $d0, $ff
+ db $90, $80, $90
+ db $40, $40, $40
+ db $00, $00, $00
+
+.sequence3
+ db $ff, $ff, $ff
+ db $fe, $fe, $fe
+ db $f9, $e4, $e4
+ db $e8, $d0, $d0
+ db $90, $80, $80
+ db $40, $40, $40
+ db $00, $00, $00
diff --git a/home/copy2.asm b/home/copy2.asm
index 0a0ee54..5d3afe2 100644
--- a/home/copy2.asm
+++ b/home/copy2.asm
@@ -49,7 +49,7 @@ FarCopyDataDouble: ; d3e (0:d3e)
call Bankswitch
ret
-CopyVideoData:: ; d68 (0:d68)
+Request2bpp:: ; d68 (0:d68)
; Wait for the next VBlank, then copy c 2bpp
; tiles from b:de to hl, 8 tiles at a time.
; This takes c/8 frames.
@@ -89,7 +89,7 @@ CopyVideoData:: ; d68 (0:d68)
ld c, a
jr .loop
-CopyVideoDataDouble:: ; da6 (0:da6)
+Request1bpp:: ; da6 (0:da6)
; Wait for the next VBlank, then copy c 1bpp
; tiles from b:de to hl, 8 tiles at a time.
; This takes c/8 frames.
@@ -129,13 +129,14 @@ CopyVideoDataDouble:: ; da6 (0:da6)
ld c, a
jr .loop
-CopyVideoDataOptimized:: ; de4 (0:de4)
+Get2bpp:: ; de4 (0:de4)
; Copy c 2bpp tiles from b:de to hl in VRAM
; using VBlank service or direct copy in
; case LCD is off
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
- jp nz, CopyVideoData ; copy video data during vblank while screen is on
+ jp nz, Request2bpp ; copy video data during vblank while screen is on
+Copy2bpp:: ; 0deb
push hl ; convert to FarCopyData call
ld h, d
ld l, e
@@ -152,13 +153,14 @@ CopyVideoDataOptimized:: ; de4 (0:de4)
pop af
jp FarCopyData
-CopyVideoDataDoubleOptimized: ; dff (0:dff)
+Get1bpp: ; dff (0:dff)
; Copy c 1bpp tiles from b:de to hl in VRAM
; using VBlank service or direct copy in
; case LCD is off
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
- jp nz, CopyVideoDataDouble
+ jp nz, Request1bpp
+Copy1bpp:: ; 0e06
push de
ld d, h
ld e, l
diff --git a/home/joypad.asm b/home/joypad.asm
index e0740f2..5a4e549 100644
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -210,7 +210,7 @@ WaitAorB_BlinkCursor:: ; 8ea (0:8ea)
ldh a, [hJoySum]
and (A_BUTTON | B_BUTTON)
ret nz
- call RTC
+ call UpdateTime
call UpdateTimeOfDayPalettes
ld a, $01
ldh [hBGMapMode], a
diff --git a/home/pokemon.asm b/home/pokemon.asm
index 6cf1eb5..bb1bcc5 100644
--- a/home/pokemon.asm
+++ b/home/pokemon.asm
@@ -219,7 +219,7 @@ InterlaceMergeSpriteBuffers:: ; 3bc6 (0:3bc6)
ld c, (2 * SPRITEBUFFERSIZE) / 16 ; $31, number of 16 byte chunks to be copied
ldh a, [hROMBank]
ld b, a
- call CopyVideoDataOptimized
+ call Get2bpp
call CloseSRAM
ret
diff --git a/hram.asm b/hram.asm
index 694b92e..9e3e438 100644
--- a/hram.asm
+++ b/hram.asm
@@ -1,7 +1,9 @@
SECTION "HRAM", HRAM[$FF80]
hOAMDMA:: ; ff80
- ds 13
+ ds 10
+
+ ds 3 ; TODO
hRTCHours:: db ; ff8d
hRTCMinutes:: db ; ff8e
@@ -19,7 +21,8 @@ hROMBank:: ; ff98
hVBlank:: ; ff99
db
- db ; TODO
+hMapEntryMethod:: ; ff9a
+ db
hStartmenuCloseAndSelectHookEnable:: db ; ff9b
@@ -59,11 +62,27 @@ UNION
hTextBoxCursorBlinkInterval:: ds 2 ; ffaf
NEXTU
+
hSpriteWidth:: ; ffaf
hSpriteInterlaceCounter:: ; ffaf
db
hSpriteHeight:: ; ffb0
db
+
+NEXTU
+
+hConnectionStripLength:: ; ffaf
+ db
+hConnectedMapWidth:: ; ffb0
+ db
+
+NEXTU
+
+hMapObjectIndexBuffer:: ; ffaf
+ db
+hObjectStructIndexBuffer:: ; ffb0
+ db
+
ENDU
hSpriteOffset:: ; ffb1
@@ -158,8 +177,13 @@ hRedrawRowOrColumnMode:: db ; ffe5
hRedrawRowOrColumnDest:: ds 2 ; ffe6
hMapAnims:: ; ffe8
- ; TODO: figure out size
- ds 7
+ db
+
+hTileAnimFrame:: ; ffe9
+ db
+
+ ds 5 ; TODO
+
hRandomAdd:: db ; ffef
hRandomSub:: db ; fff0
hRTCRandom:: db ; fff1
diff --git a/macros/wram.asm b/macros/wram.asm
index c598245..77fe153 100644
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -114,6 +114,19 @@ box: MACRO
ENDM
+map_connection_struct: MACRO
+\1ConnectedMapGroup:: db
+\1ConnectedMapNumber:: db
+\1ConnectionStripPointer:: dw
+\1ConnectionStripLocation:: dw
+\1ConnectionStripLength:: db
+\1ConnectedMapWidth:: db
+\1ConnectionStripYOffset:: db
+\1ConnectionStripXOffset:: db
+\1ConnectionWindow:: dw
+ENDM
+
+
channel_struct: MACRO
; TODO: CH1 isn't at C101, please rebase all of these
; Addreses are Channel1 (c101).
@@ -247,7 +260,6 @@ slot_reel: MACRO
endm
object_struct: MACRO
-\1Struct::
\1Sprite:: ds 1
\1MapObjectIndex:: ds 1
\1SpriteTile:: ds 1
@@ -285,7 +297,6 @@ object_struct: MACRO
ENDM
map_object: MACRO
-\1Object::
\1ObjectStructID:: ds 1
\1ObjectSprite:: ds 1
\1ObjectYCoord:: ds 1
diff --git a/shim.sym b/shim.sym
index faf2e32..6460009 100644
--- a/shim.sym
+++ b/shim.sym
@@ -1,5 +1,6 @@
-00:032B UpdateTimeOfDayPalettes
-00:0436 RTC
+; ROM0
+00:032b UpdateTimeOfDayPalettes
+00:0436 UpdateTime
00:051C Reset
00:0D0A LoadFont
00:0D1A LoadFontExtra
@@ -8,13 +9,17 @@
00:0E93 PlaceString
00:0E94 PlaceNextChar
00:0E9D CheckDict
-00:1D49 LoadMenuHeader
-00:1E58 OpenMenu
+00:15be GetMapObject
+00:1720 CheckObjectVisibility
+00:17bf GetObjectStruct
+00:1d49 LoadMenuHeader
+00:1e58 OpenMenu
00:1F9E ClearWindowData
00:1FCC ClearWindowData.bytefill
-00:20FF RunMapScript
-00:232C LoadMapWarp
-00:23E5 OverworldFadeIn
+
+00:20ff RunMapScript
+00:23dc LoadWildMons
+00:23e5 FadeIn ; This is not OverworldFadeIn, but I don't know what it is
00:2C05 StartMenuCheck
00:3270 Random
00:3621 WaitBGMap
@@ -43,6 +48,8 @@
00:3E1B GetMapMusic
00:3E2E GetMapMusic.unk_3E2E
00:3E32 Unk_3E32
+
+
01:4031 Function_4031
01:53CC MainMenu
01:5D27 Function_5d27
@@ -51,6 +58,8 @@
01:66B1 Function_66b1
01:6713 Function_6713
02:4786 Function_8786
+
+02:4098 _InitializeVisibleSprites
02:4856 DecompTownMapTilemap
02:48DA DecompTownMapTilemap.tilemap
02:4C7C DrawMap
@@ -58,6 +67,7 @@
02:4F32 PokegearRadioGfx
02:528B Function_928b
02:5695 CheckSGB
+
03:4791 DebugWarp
03:479F DebugWarp.Destinations
03:4AA1 AddItemToInventory_
@@ -81,24 +91,44 @@
03:5E79 Function_de79
03:5F7D Function_df7d
03:5F91 Function_df91
+
+04:4001 MapGroupPointers
04:528F Function_1128f
04:52C1 Function_112c1
04:5677 DoPlayerMovement
04:5DBE DisplayStartMenu
04:640B Function_1240b
04:6C58 CheckRegisteredItem
+
+05:400a GetPlayerSprite
+05:4036 AddMapSprites
+05:404c CheckInteriorMap
+05:405b AddIndoorSprites
+05:40aa AddOutdoorSprites
+05:40fb LoadUsedSpritesGfx ; TODO: maybe there's a better name
05:43E0 Function_143e0
05:457A Function_1457a
05:45B8 Function_145b8
05:45DE Function_145de
05:46DC Function_146dc
+; Structure:
+; byte Map group ($ff = end)
+; byte Map ID
+; ptr Copied to c5e9, also byte pointed to written at wUnknownIdc5e8
+; ptr Copied to c5eb
+; word Unknown (2 bytes)
+05:470e UnknownMapBufferPointers
+
0A:4C98 Function_28c98
0A:4D6E Function_28d6e
0A:4DA4 Function_28da4
+
0B:5663 Function_2d663
-0E:4B78 LoadTrainerClassName
-0E:4BA0 LoadTrainerClassName.got_name
-0E:4BA9 LoadTrainerClass
+
+0e:4b78 LoadTrainerClassName
+0e:4ba0 LoadTrainerClassName.got_name
+0e:4ba9 LoadTrainerClass
+
0F:508C Function_3d08c
0F:55CE Function_3d5ce
0F:567C Function_3d67c
@@ -106,10 +136,12 @@
0F:6874 Function_3e874
0F:691E Function_3e91e
0F:6963 Function_3e963
+0f:69a9 _LoadWildMons
0F:6F19 Function_3ef19
0F:7019 Function_3f019
0F:704A Function_3f04a
0F:7068 Function_3f068
+
10:4000 Function_40000
10:40A6 ShowPokedexMenu
10:4AC7 Function_40ac7
@@ -117,6 +149,7 @@
10:5FA1 Function_41fa1
10:61F8 Function_421f8
10:6252 Function_42252
+
14:4000 Function_50000
14:4073 Function_50073
14:40A0 Function_500a0
@@ -134,12 +167,16 @@
14:4BCD Function_50bcd
14:4BFE Function_50bfe
14:4ED9 Function_50ed9
+
23:4000 AnimateTilesetImpl
-23:4349 OverworldFadeOut
+23:42dc UpdateTimeOfDayPal
+23:4354 ReplaceTimeOfDayPals
+23:4370 GetTimePalette
23:44BE Function_8c4be
23:4940 Function_8c940
23:49C6 Function_8c9c6
-23:60CC MenuMonIconGfx
+23:60cc MenuMonIconGfx
+
24:4000 SetClockDialog
24:4239 SlotMachineGame
32:4000 Function_c8000
@@ -165,23 +202,22 @@
3F:654E PicTest
3F:6750 PicTestMenu
3F:6755 PicTestMenu.loop
+
00:C5E8 wMapScriptNumber
-00:CA22 wTrainerClass
00:CBF2 wWindowData
00:CBF2 wWindowStackPointer
00:CC02 wMenuDataHeader
00:CC12 wMenuData2
00:CC22 wMenuData3
-00:CDBE wTargetMapUnk
-00:CDBF wTargetMapGroup
-00:CDC0 wTargetMapId
-00:CE67 wPlayerName
-01:D165 wTMCounts
-01:D19E wItems
-01:D258 wRivalName
+00:ce67 wPlayerName
+
+01:d165 wTMCounts
+01:d19e wItems
+01:d258 wRivalName
01:D264 wPlayerBikeSurfState
-01:D656 wMapGroup
-01:D657 wMapId
-01:D66A wMapScriptPtr
+; The starting house's map script number is stored at d29a. Others are probably nearby.
+01:d35f wOptions
+01:d656 wMapGroup
+01:d657 wMapId
01:D7D2 wPartyMonOT
01:DA3B wUnk_DA3B
diff --git a/wram.asm b/wram.asm
index 5ae4140..861fd97 100644
--- a/wram.asm
+++ b/wram.asm
@@ -94,11 +94,43 @@ wWhichPicTest:: ; c40b
ENDU
-SECTION "LY overrides buffer", WRAM0[$C600]
+SECTION "Unknown map buffer?", WRAM0[$C5E8]
+
+; TODO: this is probably not related to the map script. Figure out what it actually is
+wUnknownIdC5E8:: ; c5e8
+ db
+
+wUnknownIdC5E8Location::
+ dw ; c5e9 ; TODO
+
+wUnknownMapPointer::
+ dw ; c5eb ; TODO
+
+ ds 19 ; TODO
+wUnknownMapBufferEnd:: ; c600
+
+
+UNION
+
+wOverworldMapBlocks:: ; c600
+ ds $514 ; TODO: constantify this
+wOverworldMapBlocksEnd:: ; cb14
+
+NEXTU
wLYOverrides:: ; c600
ds SCREEN_HEIGHT_PX
+NEXTU
+
+ ds $422 ; TODO
+
+wTrainerClass:: ; ca22
+ db
+
+ENDU
+
+
SECTION "CB14", WRAM0[$CB14]
UNION
@@ -137,12 +169,20 @@ wVBCopyFarSrc:: ds 2 ; cb72
wVBCopyFarDst:: ds 2 ; cb74
wVBCopyFarSrcBank:: ds 1 ; cb76
+SECTION "Collision buffer", WRAM0[$CB90]
+
+wTileDown:: db ; cb90
+wTileUp:: db ; cb91
+wTileLeft:: db ; cb92
+wTileRight:: db ; cb93
+
SECTION "CBD2", WRAM0[$CBD2]
wcbd2:: ; cbd2
ds $14
SECTION "CBF7", WRAM0[$CBF7]
+wWhichIndexSet::
wActiveBackpackPocket:: db ; cbf7
SECTION "CC09", WRAM0[$CC09]
@@ -171,7 +211,14 @@ wDebugWarpSelection:: ; cc39
wSGB:: ; cc40
db
-SECTION "CCAC", WRAM0[$CCAC]
+SECTION "CC9C", WRAM0[$CC9C]
+
+wUnknownWordCC9C:: ; cc9c
+ dw
+
+wUnknownBufferCC9E:: ; cc9e
+ ds 14
+
wSpriteCurPosX : ds 1 ; ccac
wSpriteCurPosY : ds 1 ; ccad
@@ -264,6 +311,10 @@ wLinkMode:: db ; cdbd
; 02 -
; 03 -
+wTargetMapUnk:: db ; cdbe ; TODO: Probably warp ID, check
+wTargetMapGroup:: db ; cdbf
+wTargetMapId:: db ; cdc0
+
SECTION "CE00", WRAM0[$CE00]
wBattleMode:: ; ce00
@@ -370,21 +421,64 @@ wce63:: db ; ce63
; 76543210
; \-- global debug enable
-SECTION "D152", WRAM0[$D152]
-wMapTimeOfDayPalette:: db ; d152
-; Applied according to wMapTimeOfDay from wMapTimeOfDayPaletteMap
+SECTION "CE7F", WRAM0[$CE76]
+
+wObjectFollow_Leader:: ; ce76
+ db
+wObjectFollow_Follower:: ; ce77
+ db
+
+
+SECTION "Object structs", WRAM0[$CECF]
+
+wObjectStructs:: ; cecf
+wPlayerStruct:: object_struct wPlayer
+wObject1Struct:: object_struct wObject1
+wObject2Struct:: object_struct wObject2
+wObject3Struct:: object_struct wObject3
+wObject4Struct:: object_struct wObject4
+wObject5Struct:: object_struct wObject5
+wObject6Struct:: object_struct wObject6
+wObject7Struct:: object_struct wObject7
+wObjectStructsEnd:: ; d00f
+
+SECTION "Objects", WRAM0[$D04F]
+
+wMapObjects:: ; d04f
+wPlayerObject:: map_object wPlayer
+wMap1Object:: map_object wMap1
+wMap2Object:: map_object wMap2
+wMap3Object:: map_object wMap3
+wMap4Object:: map_object wMap4
+wMap5Object:: map_object wMap5
+wMap6Object:: map_object wMap6
+wMap7Object:: map_object wMap7
+wMap8Object:: map_object wMap8
+wMap9Object:: map_object wMap9
+wMap10Object:: map_object wMap10
+wMap11Object:: map_object wMap11
+wMap12Object:: map_object wMap12
+wMap13Object:: map_object wMap13
+wMap14Object:: map_object wMap14
+wMap15Object:: map_object wMap15
+wMapObjectsEnd:: ; d14f
+
+ ds 3 ; TODO
+
+wTimeOfDayPal:: db ; d152
+; Applied according to wCurTimeOfDay from wTimeOfDayPalset
wd153:: db ; d153
; 76543210
; \-------- switch overworld palettes according to seconds not hours
ds 3 ; TODO
-wd157:: db ; d157
+wTimeOfDayPalFlags:: db ; d157
; 76543210
; \-------- disable overworld palette switch
-wMapTimeOfDayPaletteMap:: db ; d158
+wTimeOfDayPalset:: db ; d158
; 76543210
; \/\/\/\/
; | | | \- Map Palette for TimeOfDay 0x00
@@ -392,7 +486,7 @@ wMapTimeOfDayPaletteMap:: db ; d158
; | \----- Map Palette for TimeOfDay 0x02
; \------- Map Palette for TimeOfDay 0x03
-wMapTimeOfDay:: db ; d159
+wCurTimeOfDay:: db ; d159
SECTION "D19E", WRAM0[$D19E]
@@ -419,6 +513,101 @@ wJoypadFlags:: db ; d4ab
; |\------- joypad sync mtx
; \-------- joypad disabled
+
+SECTION "Warp data", WRAM0[$D514]
+
+wCurrMapWarpCount:: ; d514
+ db
+
+wCurrMapWarps:: ; d515
+REPT 32 ; TODO: confirm this
+ ds 5
+ENDR
+
+
+wCurrMapSignCount:: ; d5b5
+ db
+
+wCurrMapSigns:: ; d5b6
+REPT 16 ; TODO: confirm this
+ ds 4
+ENDR
+
+wCurrMapObjectCount:: ; d5f6
+ db
+
+
+SECTION "Used sprites", WRAM0[$D643]
+
+wBGMapAnchor:: ; d643
+ dw
+
+wUsedSprites:: ; d645
+ dw ; This is for the player
+ ds 2 * 5 ; This is for the NPCs
+wUsedSpritesEnd:: ; d651
+
+
+SECTION "Map header", WRAM0[$D658]
+
+wOverworldMapAnchor:: ; d658
+ dw
+
+wYCoord:: db ; d65a
+wXCoord:: db ; d65b
+
+wMetaTileStandingY:: db ; d65c
+wMetaTileStandingX:: db ; d65d
+
+; d65f
+ ds 1 ; TODO
+
+wMapPartial:: ; d65f
+wMapAttributesBank:: ; d65f
+ db
+wMapTileset:: ; d660
+ db
+wMapPermissions:: ; d661
+ db
+wMapAttributesPtr:: ; d662
+ dw
+wMapPartialEnd:: ; d664
+
+wMapAttributes:: ; d664
+wMapHeight:: ; d664
+ db
+wMapWidth:: ; d665
+ db
+wMapBlocksPointer:: ; d666
+ dw
+ ds 2 ; TODO
+wMapScriptPtr:: ; d66a
+ dw
+wMapObjectsPtr:: ; d66c
+ dw
+wMapConnections:: ; d66e
+ db
+wMapAttributesEnd:: ; d66f
+
+wNorthMapConnection:: map_connection_struct wNorth ; d66f
+wSouthMapConnection:: map_connection_struct wSouth ; d67b
+wWestMapConnection:: map_connection_struct wWest ; d687
+wEastMapConnection:: map_connection_struct wEast ; d693
+
+
+wTileset:: ; d69f
+wTilesetBank:: ; d69f
+ db
+wTilesetBlocksAddress:: ; d6a0
+ dw
+wTilesetTilesAddress:: ; d6a2
+ dw
+wTilesetCollisionAddress:: ; d6a4
+ dw
+ ds 4 ; TODO
+wTilesetEnd:: ; d6aa
+
+
SECTION "PokeDexFlags", WRAM0[$D81A]
wPokedexOwned:: ; d81a
@@ -433,6 +622,13 @@ wAnnonDex:: ds 26 ; d85a
wAnnonID:: ds 1 ; d874
+
+SECTION "Wild mon buffer", WRAM0[$D91B]
+
+wWildMons:: ; d91b
+ ds 41
+
+
SECTION "Stack bottom", WRAM0[$DFFF]
; Where SP is set at game init