summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--engine/title.asm214
-rw-r--r--shim.sym101
-rw-r--r--wram.asm286
4 files changed, 457 insertions, 147 deletions
diff --git a/Makefile b/Makefile
index 1bb744d..adada63 100644
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,8 @@ mostlyclean:
rm -rf $(ROM) $(CORRECTEDROM) $(OBJS) $(OBJS:.o=.d) $(ROMS:.gb=.sym) $(ROMS:.gb=.map)
$(CORRECTEDROM): %-correctheader.gb: %.gb
- cp $< $@
+ $(RGBASM) $(RGBASMFLAGS) -o $(BUILD)/zero_checksum.o zero_checksum.inc
+ $(RGBLINK) -O $< -o $@ $(BUILD)/zero_checksum.o
$(RGBFIX) -f hg -m 0x10 $@
$(ROM): poke%-spaceworld.gb: $(OBJS) | $(BASEROM)
diff --git a/engine/title.asm b/engine/title.asm
index 097a585..dbc6f7f 100644
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -3,16 +3,16 @@ INCLUDE "vram.asm"
SECTION "Title screen", ROMX[$5D8C], BANK[$01]
-IntroSequence:: ; 5D8C
+IntroSequence::
callfar GameFreakIntro, $39
- jr c, TitleSequenceStart ; 5DAE
- ld a, [wTitleSequenceOpeningType] ; CC38
+ jr c, TitleSequenceStart
+ ld a, [wTitleSequenceOpeningType]
and a
jr z, .opening_sequence
.pikachu_minigame
callfar PikachuMiniGame, $38
- jr TitleSequenceStart ; 5DAE
+ jr TitleSequenceStart
.opening_sequence
callfar OpeningCutscene, $39
@@ -22,17 +22,17 @@ TitleSequenceStart::
callfar SetTitleBGDecorationBorder, $02
.loop
- call TitleScreenMain ; 5FB8
+ call TitleScreenMain
jr nc, .loop
- call ClearPalettesAndWait ; 361E
+ call ClearPalettesAndWait
call ClearSprites
ld a, $01
ldh [hBGMapMode], a
call ClearTileMap
- call ResetPalette ;33a
+ call ResetPalette
- ld a, [wJumptableIndex + 1] ; CB5F
+ ld a, [wJumptableIndex + 1]
ld e, a
ld d, 0
ld hl, TitleScreenJumpTable
@@ -46,8 +46,8 @@ TitleSequenceStart::
TitleScreenJumpTable::
dw MainMenu
- dw DebugMenu ; 4031
- dw SRAMClearMenu ; 61C6
+ dw DebugMenu
+ dw SRAMClearMenu
dw IntroSequence
TitleSequenceInit::
@@ -58,7 +58,7 @@ TitleSequenceInit::
ldh [hSCY], a
ldh [hSCX], a
- ld de, MUSIC_NONE ; Stop the music.
+ ld de, MUSIC_NONE ; Stop the music.
call PlayMusic
call ClearTileMap
@@ -66,7 +66,7 @@ TitleSequenceInit::
call ClearSprites
ld a, $23
- ld hl, InitEffectObject ; 8CCFD - create another object?
+ ld hl, InitEffectObject
call FarCall_hl
ld hl, vChars0
ld bc, vBGMap0 - vChars0
@@ -79,45 +79,45 @@ TitleSequenceInit::
or c
jr nz, .clear_loop
- ld hl, TitleScreenGFX ; 107CF
- ld de, $9410
+ ld hl, TitleScreenGFX
+ ld de, vChars2 + 65 tiles
ld bc, 13 tiles
ld a, BANK(TitleScreenGFX)
call FarCopyData
- ld hl, TitleScreenVersionGFX ; 1095F
- ld de, $9600
+ ld hl, TitleScreenVersionGFX
+ ld de, vChars2 + 96 tiles
ld bc, 24 tiles
ld a, BANK(TitleScreenVersionGFX)
call FarCopyData
- ld hl, TitleScreenHoOhGFX ; 10ADF
- ld de, $9000
+ ld hl, TitleScreenHoOhGFX
+ ld de, vChars2
ld bc, 49 tiles
ld a, BANK(TitleScreenHoOhGFX)
call FarCopyData
- ld hl, TitleScreenLogoGFX ; 10DEF
- ld de, $8800
+ ld hl, TitleScreenLogoGFX
+ ld de, vChars1
ld bc, 58 tiles
ld a, BANK(TitleScreenLogoGFX)
call FarCopyData
- ld hl, TitleScreenGoldLogoGFX ; 1118F
- ld de, $8BA0
+ ld hl, TitleScreenGoldLogoGFX
+ ld de, vChars0 + 186 tiles
ld bc, 20 tiles
ld a, BANK(TitleScreenGoldLogoGFX)
call FarCopyData
- call SetTitleGfx ; 6288
- ld hl, wTileMapBackup ; C408
+ call SetTitleGfx
+ ld hl, wTileMapBackup
ld a, $24
ld [hli], a
ld a, $00
ld [hli], a
ld hl, vBGMap0
- ld bc, $0800
+ ld bc, 128 tiles
ld a, " "
call ByteFill
@@ -129,11 +129,11 @@ TitleSequenceInit::
call WaitBGMap
xor a
ldh [hBGMapMode], a
- ld hl, wJumptableIndex ; CB5E
- ld [hli], a ; (Possibly wJumptableIndex from Crystal)
- ld [hli], a ; (Possibly wIntroSceneFrameCounter from Crystal)
- ld [hli], a ; (Possibly wTitleScreenTimer from Crystal)
- ld [hl], a ; (Possibly wTitleScreenTimer + 1 from Crystal)
+ ld hl, wJumptableIndex
+ ld [hli], a ; (Possibly wJumptableIndex from Crystal)
+ ld [hli], a ; (Possibly wIntroSceneFrameCounter from Crystal)
+ ld [hli], a ; (Possibly wTitleScreenTimer from Crystal)
+ ld [hl], a ; (Possibly wTitleScreenTimer + 1 from Crystal)
call .load_position_table
@@ -146,7 +146,7 @@ TitleSequenceInit::
.load_position_table:
ld hl, FirePositionTable
- ld c, 6 ; Load 6 flying objects on the screen.
+ ld c, 6 ; Load 6 flying objects on the screen.
.set_fire_note_loop
push bc
@@ -155,15 +155,15 @@ TitleSequenceInit::
ld d, [hl]
inc hl
push hl
- ld a, $2E ; Title fire/note object effect type?
- call InitSpriteAnimStruct ; 3CA8
+ ld a, $2E ; Title fire/note object effect type?
+ call InitSpriteAnimStruct
pop hl
pop bc
dec c
jr nz, .set_fire_note_loop
ret
-FirePositionTable:: ; 5EAC-5EB7
+FirePositionTable::
dw $4CE0
dw $58A0
dw $6490
@@ -171,16 +171,16 @@ FirePositionTable:: ; 5EAC-5EB7
dw $7CB0
dw $8800
-TitleFireGFX:: INCBIN "gfx/title/fire.2bpp" ; 5EB8-5F37
-TitleNotesGFX:: INCBIN "gfx/title/notes.2bpp" ; 5F38=5FB7
+TitleFireGFX:: INCBIN "gfx/title/fire.2bpp" ; 5EB8-5F37
+TitleNotesGFX:: INCBIN "gfx/title/notes.2bpp" ; 5F38=5FB7
-TitleScreenMain:: ; 5FB8
- ld a, [wJumptableIndex] ; CB5E
+TitleScreenMain::
+ ld a, [wJumptableIndex]
bit 7, a
jr nz, .exit
call TitleScreenSequence
ld a, $23
- ld hl, EffectObjectJumpNoDelay ; 8CD13
+ ld hl, EffectObjectJumpNoDelay
call FarCall_hl
call DelayFrame
and a
@@ -243,12 +243,12 @@ TitleScreenSequenceTable::
dw TitleSeq_TitleScreenInputAndTimeout
dw TitleSeq_FadeMusicOut
-TitleSeq_IncreaseJumpTableIndex:: ; 6025
- ld hl, wJumptableIndex ; CB5E
+TitleSeq_IncreaseJumpTableIndex::
+ ld hl, wJumptableIndex
inc [hl]
ret
-TitleSeq_WaitForNextSequence:: ; 602A
+TitleSeq_WaitForNextSequence::
xor a
ldh [hBGMapMode], a
ld hl, wJumptableIndex + 2
@@ -262,18 +262,18 @@ TitleSeq_WaitForNextSequence:: ; 602A
call TitleSeq_IncreaseJumpTableIndex
ret
-TitleSeq_LoadPokemonLogo:: ; 603a
- call PrintPokemonLogo ; 6196
- call TitleSeq_IncreaseJumpTableIndex ; 6025
+TitleSeq_LoadPokemonLogo::
+ call PrintPokemonLogo
+ call TitleSeq_IncreaseJumpTableIndex
ld a, $01
ldh [hBGMapMode], a
ret
-TitleSeq_Start:: ; 6045
+TitleSeq_Start::
call TitleSeq_IncreaseJumpTableIndex
push de
ld de, $002D
- call PlaySFX ; Play "Swish" sound
+ call PlaySFX ; Play "Swish" sound
pop de
ld a, $80
ld [wJumptableIndex + 2], a
@@ -282,7 +282,7 @@ TitleSeq_Start:: ; 6045
ldh [hLCDCPointer], a
ret
-TitleSeq_MoveTitle:: ; 605d
+TitleSeq_MoveTitle::
xor a
ldh [hBGMapMode], a
ld hl, wJumptableIndex + 2
@@ -304,15 +304,15 @@ TitleSeq_MoveTitle:: ; 605d
call TitleSeq_IncreaseJumpTableIndex
ret
-TitleSeq_MoveTitleEnd:: ; 607A
+TitleSeq_MoveTitleEnd::
xor a
ldh [hLCDCPointer], a
call TitleSeq_IncreaseJumpTableIndex
ld de, MUSIC_TITLE
- call PlayMusic ; Play "Title Theme"
+ call PlayMusic ; Play "Title Theme"
ret
-TitleSeq_InitFlashTitle:: ; 6087
+TitleSeq_InitFlashTitle::
call TitleSeq_IncreaseJumpTableIndex
ld a, %00011010
ld [wJumptableIndex + 2], a
@@ -320,7 +320,7 @@ TitleSeq_InitFlashTitle:: ; 6087
ld [wJumptableIndex + 3], a
ret
-TitleSeq_FlashTitle:: ; 6095
+TitleSeq_FlashTitle::
ld hl, wJumptableIndex + 3
ld a, [hl]
and a
@@ -340,7 +340,7 @@ TitleSeq_FlashTitle:: ; 6095
ldh [rBGP], a
ret
-TitleSeq_PMJapaneseChara:: ; 60B6
+TitleSeq_PMJapaneseChara::
call PrintPMJapaneseChara
ld a, $10
ld [wJumptableIndex + 2], a
@@ -349,7 +349,7 @@ TitleSeq_PMJapaneseChara:: ; 60B6
ldh [hBGMapMode], a
ret
-TitleSeq_PMSubtitle:: ; 60C6
+TitleSeq_PMSubtitle::
call PrintPMSubtitle
ld a, $10
ld [wJumptableIndex + 2], a
@@ -358,7 +358,7 @@ TitleSeq_PMSubtitle:: ; 60C6
ldh [hBGMapMode], a
ret
-TitleSeq_Version:: ; 60D6
+TitleSeq_Version::
call PrintVersion
ld a, $10
ld [wJumptableIndex + 2], a
@@ -367,7 +367,7 @@ TitleSeq_Version:: ; 60D6
ldh [hBGMapMode], a
ret
-TitleSeq_CopyRight:: ; 60e6
+TitleSeq_CopyRight::
call PrintCopyRight
ld a, $10
ld [wJumptableIndex + 2], a
@@ -376,7 +376,7 @@ TitleSeq_CopyRight:: ; 60e6
ldh [hBGMapMode], a
ret
-TitleSeq_HoOh:: ; 60f6
+TitleSeq_HoOh::
call Set_HoOh
ld a, $10
ld [wJumptableIndex + 2], a
@@ -385,7 +385,7 @@ TitleSeq_HoOh:: ; 60f6
ldh [hBGMapMode], a
ret
-TitleSeq_PressButtonInit:: ; 6106
+TitleSeq_PressButtonInit::
ld hl, wJumptableIndex
inc [hl]
ld hl, wJumptableIndex + 2
@@ -395,7 +395,7 @@ TitleSeq_PressButtonInit:: ; 6106
ld [hl], d
ret
-TitleSeq_TitleScreenInputAndTimeout:: ; 6114
+TitleSeq_TitleScreenInputAndTimeout::
ld hl, wJumptableIndex + 2
ld e, [hl]
inc hl
@@ -408,9 +408,9 @@ TitleSeq_TitleScreenInputAndTimeout:: ; 6114
dec hl
ld [hl], e
call GetJoypad
- ld hl, hJoyState ; hJoyState = $FFA3
+ ld hl, hJoyState
ld a, [hl]
- and D_UP | B_BUTTON | SELECT ; UP + B + SELECT brings you to the SRAM clear screen.
+ and D_UP | B_BUTTON | SELECT ; UP + B + SELECT brings you to the SRAM clear screen.
cp D_UP | B_BUTTON | SELECT
jr z, .psbtn_sramclear
ld a, [hl]
@@ -421,19 +421,19 @@ TitleSeq_TitleScreenInputAndTimeout:: ; 6114
ret z
.psbtn_play
- ld a, $00 ; MainMenu
+ ld a, $00 ; MainMenu
jr .psbtn_nextseq
.psbtn_gotodebug
if DEBUG
- ld a, $01 ; DebugMenu
+ ld a, $01 ; DebugMenu
jr .psbtn_nextseq
else
ret
endc
.psbtn_sramclear
- ld a, $02 ; SRAMClearMenu
+ ld a, $02
.psbtn_nextseq
ld [wJumptableIndex + 1], a
@@ -445,13 +445,13 @@ endc
ld hl, wJumptableIndex
inc [hl]
xor a
- ld [wMusicFadeID], a ; C1A7
+ ld [wMusicFadeID], a
ld [wMusicFadeID + 1], a
- ld hl, wMusicFade ; C1A5
+ ld hl, wMusicFade
ld [hl], 8
ret
-TitleSeq_FadeMusicOut:: ; 615C
+TitleSeq_FadeMusicOut::
ld a, [wMusicFade]
and a
ret nz
@@ -461,7 +461,7 @@ TitleSeq_FadeMusicOut:: ; 615C
set 7, [hl]
ret
-SetLYOverrides:: ; 616C
+SetLYOverrides::
ld hl, wLYOverrides
ld c, $30
.setly_loop
@@ -470,31 +470,31 @@ SetLYOverrides:: ; 616C
jr nz, .setly_loop
ret
-PrintPMSubtitle:: ; 6176
+PrintPMSubtitle::
coord hl, 2, 6
ld b, 15
ld a, $69
- jr LoadPrintArea ; 6186
+ jr LoadPrintArea
-PrintVersion:: ; 617f
+PrintVersion::
coord hl, 4, 1
ld b, $09
ld a, $60
-LoadPrintArea:: ; 6186
+LoadPrintArea::
ld [hli], a
inc a
dec b
jr nz, LoadPrintArea
ret
-PrintPMJapaneseChara:: ; 618C
+PrintPMJapaneseChara::
coord hl, 15, 2
ld a, "こ"
lb bc, 4, 4
jr PrintBoxArea
-PrintPokemonLogo:: ; 6196
+PrintPokemonLogo::
coord hl, 15, 3
ld [hl], $B8
coord hl, 15, 4
@@ -532,58 +532,58 @@ PrintCopyRight::
jr nz, .loop
ret
-SRAMClearMenu:: ; 61C6
+SRAMClearMenu::
call ClearTileMap
call GetMemSGBLayout
call LoadFont
call LoadFontExtra
- ld hl, SRAMClear_TextMsg1
- call PrintText ; E70
+ ld hl, SRAMClear_Message
+ call PrintText
ld hl, SRAMClear_WinPOS
- call CopyMenuHeader ; 1D50
- call VerticalMenu ; 1D87
+ call CopyMenuHeader
+ call VerticalMenu
jp c, Init
- ld a, [wMenuCursorY] ; CC2A
+ ld a, [wMenuCursorY]
cp $01
jp z, Init
callfar InitAllSRAMBanks, $05
jp Init
-SRAMClear_TextMsg1::
-db "<NULL>すべての セーブデータエりアを"
-db "<LINE>クりア しますか?<DONE>"
+SRAMClear_Message::
+ db "<NULL>すべての セーブデータエりアを"
+ db "<LINE>クりア しますか?<DONE>"
SRAMClear_WinPOS::
-db 0
-db 7,14,11,19
-dw SRAMClear_TextChoice ; menu data
-db 1 ; default option
+ db 0
+ db 7,14,11,19
+ dw SRAMClear_TextChoice ; menu data
+ db 1 ; default option
SRAMClear_TextChoice::
-db %11000000
-db 2
-db "いいえ@"
-db "はい@"
+ db %11000000
+ db 2
+ db "いいえ@"
+ db "はい@"
-IntroCopyRightInfo:: ; 6223
+IntroCopyRightInfo::
call ClearTileMap
call LoadFontExtra
ld de, TitleScreenGFX
ld hl, $9600
lb bc, BANK(TitleScreenGFX), $19
- call CopyVideoData
+ call Request2bpp
coord hl, 5, 7
ld de, IntroCopyRightInfo_Text
jp PlaceString
-IntroCopyRightInfo_Text:: ; 623E
-db $60, $61, $62, $63, $6D, $6E, $6F, $70, $71, $72, $4E ; "(C)1997 Nintendo\n"
-db $60, $61, $62, $63, $73, $74, $75, $76, $77, $78, $6B, $6C, $4E ; "(C)1997 Creatures Inc.\n"
-db $60, $61, $62, $63, $64, $65, $66, $67, $68, $69, $6A, $6B, $6C, $50 ; "(C)1997 GAME FREAK Inc.{EOL}"
+IntroCopyRightInfo_Text::
+ db $60, $61, $62, $63, $6D, $6E, $6F, $70, $71, $72, $4E ; "(C)1997 Nintendo\n"
+ db $60, $61, $62, $63, $73, $74, $75, $76, $77, $78, $6B, $6C, $4E ; "(C)1997 Creatures Inc.\n"
+ db $60, $61, $62, $63, $64, $65, $66, $67, $68, $69, $6A, $6B, $6C, $50 ; "(C)1997 GAME FREAK Inc.{EOL}"
-Set_HoOh:: ; 6264
+Set_HoOh::
coord hl, 7, 9
ld de, $000D
ld a, $00
@@ -601,17 +601,17 @@ Set_HoOh:: ; 6264
ret
; Unused code, looks like it sets the font type for the logo?
-SetTitleFont:: ; 627A
- ld de, $8800
+SetTitleFont::
+ ld de, vChars1
ld hl, TitleScreenLogoGFX
ld bc, 130 tiles
ld a, $04
- jp FarCopyDataDouble ; 0D3E
+ jp FarCopyDataDouble
; Sets the type of art that will be displayed on the title screen
; depending on wTitleSequenceOpeningType.
-SetTitleGfx:: ;6288
- ld hl, wTitleSequenceOpeningType ; CC38
+SetTitleGfx::
+ ld hl, wTitleSequenceOpeningType
ld a, [hl]
xor $01
ld [hl], a
@@ -624,7 +624,7 @@ SetTitleGfx:: ;6288
.flame
ld hl, TitleFireGFX
SetTitleGfxNext::
- ld de, $8000
+ ld de, vChars0
ld c, $80
.loop
ld a, [hli]
@@ -641,8 +641,10 @@ SECTION "Title screen TEMPORARY", ROMX[$62A2],BANK[1] ; TODO: merge this with th
endc
-GameInit:: ; 62A5
+GameInit::
call ClearWindowData
ld a, $23
ld [wce5f], a
- jp IntroSequence \ No newline at end of file
+ jp IntroSequence
+
+ \ No newline at end of file
diff --git a/shim.sym b/shim.sym
index 91ff32e..8748ec0 100644
--- a/shim.sym
+++ b/shim.sym
@@ -1,24 +1,30 @@
+; ROM0
00:032b UpdateTimeOfDayPalettes
00:033a ResetPalette
-00:0436 RTC
+00:0436 UpdateTime
00:051C Reset
+00:0D0A LoadFont
00:0D1A LoadFontExtra
-00:0d0a LoadFont
+00:0E18 ClearBox
00:0E2A ClearTileMap
-00:0e3d DrawTextBox
+00:0E3D DrawTextBox
00:0e70 PrintText
00:0E93 PlaceString
00:0E94 PlaceNextChar
00:0E9D CheckDict
+00:15be GetMapObject
+00:1720 CheckObjectVisibility
+00:17bf GetObjectStruct
00:1d49 LoadMenuHeader
00:1d50 CopyMenuHeader
00:1d87 VerticalMenu
00:1e58 OpenMenu
00:1F9E ClearWindowData
00:1FCC ClearWindowData.bytefill
+
00:20ff RunMapScript
-00:232c LoadMapWarp
-00:23e5 OverworldFadeIn
+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:361E ClearPalettesAndWait
@@ -44,30 +50,34 @@
00:3DE1 PlayMapMusic
00:3E00 PlayMapMusic.dontplay
00:3E05 SpecialMapMusic
-00:3E14 SpecialMapMusic.state2 ; ?
+00:3E14 SpecialMapMusic.state2
00:3E19 SpecialMapMusic.normal
00:3E1B GetMapMusic
00:3E2E GetMapMusic.unk_3E2E
00:3E32 Unk_3E32
+
+
01:4031 Function_4031
01:4031 DebugMenu
-01:53cc MainMenu
+01:53CC MainMenu
01:5D27 Function_5d27
01:6445 Function_6445
01:66B1 Function_66b1
01:6713 Function_6713
02:4786 Function_8786
+
+02:4098 _InitializeVisibleSprites
02:4856 DecompTownMapTilemap
-02:48da DecompTownMapTilemap.tilemap ; compressed
-02:4c7c DrawMap
-02:4dc2 TownMapGfx
+02:48DA DecompTownMapTilemap.tilemap
+02:4C7C DrawMap
+02:4DC2 TownMapGfx
02:4F32 PokegearRadioGfx
02:51D2 SetTitleBGDecorationBorder
02:528B Function_928b
02:5695 CheckSGB
-02:5695 Function_9695
+
03:4791 DebugWarp
-03:479f DebugWarp.Destinations
+03:479F DebugWarp.Destinations
03:4AA1 AddItemToInventory_
03:4D33 Function_cd33
03:4D6F Function_cd6f
@@ -89,25 +99,45 @@
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:5DBE DisplayStartMenu
04:640B Function_1240b
-04:6c58 CheckRegisteredItem
+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:43B6 InitAllSRAMBanks
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
@@ -115,10 +145,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
@@ -126,6 +158,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
@@ -143,26 +176,37 @@
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:4CFD InitEffectObject
23:4d13 EffectObjectJumpNoDelay
23:60cc MenuMonIconGfx
+
24:4000 SetClockDialog
24:4239 SlotMachineGame
-32:4000 Function_c8000
32:76FF Function_cb6ff
32:7710 Function_cb710
32:7733 Function_cb733
33:4000 Function_cc000
33:4000 Function_cc000_2
33:4001 Function_cc001
+33:467B QueueBattleAnimation
+33:625D BattleAnim_Sine_e
+33:6263 BattleAnim_Cosine_e
38:4000 PikachuMiniGame
39:4000 GameFreakIntro
39:432F OpeningCutscene
+3A:441D Function_e841d
+3A:45D8 Function_e85d8
+3A:47F9 Function_e87f9
+3A:4839 Function_e8839
+3A:484F Function_e884f
3A:4D9D _PlayCryHeader
3A:4E22 _PlaySFX
3A:4F11 LoadChannel
@@ -170,27 +214,26 @@
3A:52C7 Music
3F:40E9 InGameDebugMenu
3F:5B66 Function_fdb66
-3f:64ce MonsterTest
-3f:654e PicTest
-3f:6750 PicTestMenu
-3f:6755 PicTestMenu.loop
-00:c5e8 wMapScriptNumber
-00:ca22 wTrainerClass
+3F:64CE MonsterTest
+3F:654E PicTest
+3F:6750 PicTestMenu
+3F:6755 PicTestMenu.loop
+
+00:C5E8 wMapScriptNumber
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
01:D264 wPlayerBikeSurfState
+; 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:d66a wMapScriptPtr
01:D7D2 wPartyMonOT
01:DA3B wUnk_DA3B
diff --git a/wram.asm b/wram.asm
index 123c4eb..f3cb156 100644
--- a/wram.asm
+++ b/wram.asm
@@ -28,14 +28,24 @@ wc195:: db ; c195
wCurChannel:: db ; c198
wVolume:: db ; c199
-wSoundOutput:: db ; c19a
+wSoundOutput:: ; c19a
+; corresponds to $ff25
+; bit 4-7: ch1-4 so2 on/off
+; bit 0-3: ch1-4 so1 on/off
+ db
ds 1 ; TODO
wMusicID:: dw ; c19c
wMusicBank:: db ; c19e
- ds 6 ; TODO
+ ds 5 ; TODO
+
+wLowHealthAlarm:: ; c1a4
+; bit 7: on/off
+; bit 4: pitch
+; bit 0-3: counter
+ db
wMusicFade:: ; c1a5
; fades volume over x frames
@@ -46,8 +56,9 @@ wMusicFade:: ; c1a5
wMusicFadeCount:: db ; c1a6
wMusicFadeID:: dw ; c1a7
- ds 4 ; TODO
+ ds 2 ; TODO
+wIncrementTempo: dw ; c1ab
wMapMusic:: db ; c1ad
wCryPitch:: dw ; c1ae
wCryLength:: dw ; c1b0
@@ -83,10 +94,97 @@ 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
+; c690
+ ds $10
+wLYOverrides2:: ; c6a0
+
+NEXTU
+; Battle-related
+
+ ds $1ea
+
+; c7ea
+wActiveBGEffects:: ; c7ea
+wBGEffect1:: battle_bg_effect wBGEffect1
+wBGEffect2:: battle_bg_effect wBGEffect2
+wBGEffect3:: battle_bg_effect wBGEffect3
+wBGEffect4:: battle_bg_effect wBGEffect4
+wBGEffect5:: battle_bg_effect wBGEffect5
+wActiveBGEffectsEnd::
+
+wNumActiveBattleAnims:: db ; c7fe
+
+wBattleAnimFlags:: db ; c7ff
+wBattleAnimAddress:: dw ; c800
+wBattleAnimDuration:: db ; c802
+wBattleAnimParent:: dw ; c803
+wBattleAnimLoops:: db ; c805
+wBattleAnimVar:: db ; c806
+wBattleAnimByte:: db ; c807
+wBattleAnimOAMPointerLo:: db ; c808
+ db
+
+UNION ; c80a
+; unidentified
+wBattleAnimTemp0:: db
+wBattleAnimTemp1:: db
+wBattleAnimTemp2:: db
+wBattleAnimTemp3:: db
+
+NEXTU ; c80a
+wBattleAnimTempOAMFlags:: db
+wBattleAnimTempField02:: db
+wBattleAnimTempTileID:: db
+wBattleAnimTempXCoord:: db
+wBattleAnimTempYCoord:: db
+wBattleAnimTempXOffset:: db
+wBattleAnimTempYOffset:: db
+wBattleAnimTempAddSubFlags:: db
+wBattleAnimTempPalette:: db
+ENDU ; c813
+
+ ds $32
+wBattleAnimEnd::
+; c845
+
+ ds $1f8 ; TODO
+
+wPlayerSubStatus3:: db ; ca3d
+ ds $4
+wEnemySubStatus3:: db ; ca42
+; ca43
+ ds $14
+wTrainerClass:: ; ca57
+ db
+
+ENDU
+
SECTION "CB14", WRAM0[$CB14]
@@ -129,12 +227,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]
@@ -153,6 +259,7 @@ wVBlankOccurred: db ; cc33
ds 4
;Controls what type of opening (fire/notes) you get.
+wcc38::
wTitleSequenceOpeningType:: ; cc38
db
@@ -164,7 +271,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
@@ -195,6 +309,7 @@ wOBP1:: db ; cccc
SECTION "CCCE", WRAM0[$CCCE]
wDisableVBlankWYUpdate:: db ; ccce
+wcccf:: db
SECTION "CD26", WRAM0[$CD26]
@@ -257,6 +372,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
@@ -363,21 +482,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
@@ -385,7 +547,7 @@ wMapTimeOfDayPaletteMap:: db ; d158
; | \----- Map Palette for TimeOfDay 0x02
; \------- Map Palette for TimeOfDay 0x03
-wMapTimeOfDay:: db ; d159
+wCurTimeOfDay:: db ; d159
SECTION "D19E", WRAM0[$D19E]
@@ -412,6 +574,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
@@ -426,6 +683,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