diff options
-rw-r--r-- | data/predef_pointers.inc | 2 | ||||
-rw-r--r-- | pokegold-spaceworld.link | 814 | ||||
-rw-r--r-- | shim.sym | 1 | ||||
-rw-r--r-- | tools/map2link.py | 183 |
4 files changed, 998 insertions, 2 deletions
diff --git a/data/predef_pointers.inc b/data/predef_pointers.inc index 0cc8d67..f987419 100644 --- a/data/predef_pointers.inc +++ b/data/predef_pointers.inc @@ -87,7 +87,7 @@ GiveItemPredef:: add_predef Function_c8000 add_predef Function_1457a add_predef Function_143e0 - add_predef Function_9695 + add_predef CheckSGB add_predef Function_928b add_predef Function_8786 add_predef Function_8c4be diff --git a/pokegold-spaceworld.link b/pokegold-spaceworld.link new file mode 100644 index 0000000..fb0f24a --- /dev/null +++ b/pokegold-spaceworld.link @@ -0,0 +1,814 @@ +; Automatically generated by map2link.py +ROM0 + "rst00" ; size: $0001 + org $0008 + "rst08" ; size: $0001 + org $0010 + "rst10" ; size: $0001 + org $0018 + "rst18" ; size: $0001 + org $0020 + "rst20" ; size: $0001 + org $0028 + "rst28" ; size: $0001 + org $0030 + "rst30" ; size: $0001 + org $003a + "rst38" ; size: $0003 + org $0042 + "VBlank interrupt vector" ; size: $0003 + org $004a + "LCD interrupt vector" ; size: $0003 + org $0052 + "Timer interrupt vector" ; size: $0003 + org $005a + "Serial interrupt vector" ; size: $0003 + org $0062 + "Joypad interrupt vector" ; size: $0003 + org $0103 + "Entry point" ; size: $0004 + org $014f + "Global check value" ; size: $0002 + org $0316 + "VBlank handler" ; size: $01c7 + "Delay" ; size: $0014 + "Shim for UpdateTimeOfDayPalettes" ; size: $0000 + org $0429 + "LCD functions" ; size: $007c + "Timer dummy interrupt" ; size: $0001 + org $0436 + "Shim for RTC" ; size: $0000 + org $051c + "Shim for Reset" ; size: $0000 + org $0601 + "Init" ; size: $00d3 + "Serial handler" ; size: $004a + org $07f7 + "Joypad dummy interrupt" ; size: $0001 + org $094b + "Joypad functions" ; size: $014e + org $0d01 + "Decompression Functions" ; size: $03a4 + "Shim for LoadFont" ; size: $0000 + org $0d1a + "Shim for LoadFontExtra" ; size: $0000 + org $0e17 + "Video Copy functions" ; size: $00ee + "Shim for ClearTileMap" ; size: $0000 + org $0e3d + "Shim for DrawTextBox" ; size: $0000 + org $0e93 + "Shim for PlaceString" ; size: $0000 + org $0e94 + "Shim for PlaceNextChar" ; size: $0000 + org $0e9d + "Shim for CheckDict" ; size: $0000 + org $1239 + "Text Commands" ; size: $01bc + org $15b4 + "Copy Routines used by VBlank ISR" ; size: $037b + org $1d49 + "Shim for LoadMenuHeader" ; size: $0000 + org $1e58 + "Shim for OpenMenu" ; size: $0000 + org $1f9e + "Shim for ClearWindowData" ; size: $0000 + org $1fcc + "Shim for ClearWindowData.bytefill" ; size: $0000 + org $2017 + "Unknown functions" ; size: $0024 + org $20f7 + "Unknown functions 2" ; size: $0083 + "Shim for RunMapScript" ; size: $0000 + org $232c + "Shim for LoadMapWarp" ; size: $0000 + org $23e5 + "Shim for OverworldFadeIn" ; size: $0000 + org $2c05 + "Shim for StartMenuCheck" ; size: $0000 + org $2c49 + "Startmenu and Select Button Check" ; size: $0045 + org $2fa7 + "Empty function" ; size: $0011 + org $2fdd + "Farcall" ; size: $0036 + org $3024 + "Predef" ; size: $0047 + org $326f + "AddItemToInventory" ; size: $0017 + "Shim for Random" ; size: $0000 + org $32c1 + "SRAM functions" ; size: $001b + "Bankswitch" ; size: $0006 + org $32f6 + "Sprite clearing" ; size: $001b + org $337f + "Copy functions" ; size: $0089 + "Print Letter Delay" ; size: $0040 + org $3438 + "Misc Utility Functions" ; size: $001a + org $3596 + "Number Printing Functions" ; size: $0137 + "Print Hexadecimal functions" ; size: $0036 + "Jumptable functions" ; size: $001f + "Install StartMenu Hook Function" ; size: $000c + org $3621 + "Shim for WaitBGMap" ; size: $0000 + org $362b + "Shim for SetPalettes" ; size: $0000 + org $3634 + "Shim for ClearPalettes" ; size: $0000 + org $363c + "Shim for GetMemSGBLayout" ; size: $0000 + org $363e + "Shim for GetSGBLayout" ; size: $0000 + org $3648 + "Shim for SetHPPal" ; size: $0000 + org $3655 + "Shim for SetHPPal.done" ; size: $0000 + org $3685 + "GiveItem" ; size: $001a + org $36c8 + "Shim for NamesPointers" ; size: $0000 + org $36e0 + "Shim for GetName" ; size: $0000 + org $3740 + "GetNthString" ; size: $000f + org $378d + "GetItemName" ; size: $001f + org $37e3 + "GetMachineName" ; size: $0056 + org $39ba + "Shim for PlayCry" ; size: $0000 + org $3a90 + "3A4B" ; size: $0046 + org $3aec + "BCD Functions" ; size: $003b + org $3c42 + "3AED" ; size: $0156 + "Audio interface" ; size: $00c0 + "Shim for WaitSFX" ; size: $0000 + org $3d87 + "Shim for WaitSFX.wait" ; size: $0000 + org $3da5 + "Shim for MaxVolume" ; size: $0000 + org $3dab + "Shim for LowVolume" ; size: $0000 + org $3db1 + "Shim for VolumeOff" ; size: $0000 + org $3db6 + "Shim for UpdateSoundNTimes" ; size: $0000 + org $3dbe + "Shim for FadeToMapMusic" ; size: $0000 + org $3ddc + "Shim for FadeToMapMusic.dontfade" ; size: $0000 + org $3de1 + "Shim for PlayMapMusic" ; size: $0000 + org $3e00 + "Shim for PlayMapMusic.dontplay" ; size: $0000 + org $3e05 + "Shim for SpecialMapMusic" ; size: $0000 + org $3e14 + "Shim for SpecialMapMusic.state2" ; size: $0000 + org $3e19 + "Shim for SpecialMapMusic.normal" ; size: $0000 + org $3e1b + "Shim for GetMapMusic" ; size: $0000 + org $3e2e + "Shim for GetMapMusic.unk_3E2E" ; size: $0000 + org $3e32 + "Shim for Unk_3E32" ; size: $0000 +ROMX $01 + org $4030 + "PlaceWaitingText" ; size: $0031 + "Shim for Function_4031" ; size: $0000 + org $416a + "OAM DMA" ; size: $0018 + org $53cc + "Shim for MainMenu" ; size: $0000 + org $5472 + "Main Menu Definition" ; size: $005b + org $5d27 + "Shim for Function_5d27" ; size: $0000 + org $5d8c + "Title screen" ; size: $0000 + org $5fb7 + "Title Screen Sprites" ; size: $0100 + org $6114 + "Shim for TitleScreenInputAndTimeout" ; size: $0000 + org $62af + "Title screen TEMPORARY" ; size: $000b + org $63d7 + "Predef pointers" ; size: $0128 + "Shim for Function_6445" ; size: $0000 + org $66b1 + "Shim for Function_66b1" ; size: $0000 + org $6713 + "Shim for Function_6713" ; size: $0000 + org $771d + "ItemNames" ; size: $0732 +ROMX $02 + org $45ce + "Bank 2 Misc GFX" ; size: $0110 + org $4786 + "Shim for Function_8786" ; size: $0000 + org $4856 + "Shim for DecompTownMapTilemap" ; size: $0000 + org $48da + "Shim for DecompTownMapTilemap.tilemap" ; size: $0000 + org $4a16 + "Mon Nest Icon" ; size: $0008 + org $4c7c + "Shim for DrawMap" ; size: $0000 + org $4dc2 + "Shim for TownMapGfx" ; size: $0000 + org $4f32 + "Shim for PokegearRadioGfx" ; size: $0000 + org $51c1 + "Pokegear GFX" ; size: $0290 + "Shim for Function_928b" ; size: $0000 + org $5695 + "Shim for CheckSGB" ; size: $0000 + org $5e1b + "Super Palettes" ; size: $02d0 + org $666b + "Unused SGB Border GFX" ; size: $03a0 + org $6ebb + "SGB Border GFX" ; size: $03a0 +ROMX $03 + org $4791 + "Shim for DebugWarp" ; size: $0000 + org $479f + "Shim for DebugWarp.Destinations" ; size: $0000 + org $49c0 + "Tileset Headers" ; size: $0134 + "Shim for AddItemToInventory_" ; size: $0000 + org $4d33 + "Shim for Function_cd33" ; size: $0000 + org $4d6f + "Shim for Function_cd6f" ; size: $0000 + org $4de3 + "Shim for Function_cde3" ; size: $0000 + "Shim for Function_cde3_2" ; size: $0000 + "Shim for Function_cde3_3" ; size: $0000 + org $4df9 + "Shim for Function_cdf9" ; size: $0000 + org $4e10 + "Shim for Function_ce10" ; size: $0000 + "Shim for Function_ce10_2" ; size: $0000 + org $4e3c + "Shim for Function_ce3c" ; size: $0000 + org $4e7c + "Shim for Function_ce7c" ; size: $0000 + org $5886 + "Shim for Function_d886" ; size: $0000 + org $5a28 + "Shim for Function_da28" ; size: $0000 + org $5a4f + "Shim for Function_da4f" ; size: $0000 + org $5ac8 + "Shim for Function_dac8" ; size: $0000 + org $5c16 + "Shim for Function_dc16" ; size: $0000 + org $5cfc + "Shim for Function_dcfc" ; size: $0000 + org $5d5c + "Shim for Function_dd5c" ; size: $0000 + org $5e79 + "Shim for Function_de79" ; size: $0000 + org $5f7d + "Shim for Function_df7d" ; size: $0000 + org $5f91 + "Shim for Function_df91" ; size: $0000 +ROMX $04 + org $528e + "Title Screen GFX" ; size: $0ac0 + "Shim for Function_1128f" ; size: $0000 + org $52c1 + "Shim for Function_112c1" ; size: $0000 + org $5309 + "TM/HM Moves" ; size: $0039 + org $5677 + "Shim for DoPlayerMovement" ; size: $0000 + org $5c30 + "Mail Icon GFX" ; size: $0080 + org $5dbe + "Shim for DisplayStartMenu" ; size: $0000 + org $640b + "Shim for Function_1240b" ; size: $0000 + org $6c58 + "Shim for CheckRegisteredItem" ; size: $0000 + org $7be2 + "Trainer Card GFX" ; size: $0a72 +ROMX $05 + org $43a6 + "OverworldSprites" ; size: $016c + "Shim for Function_143e0" ; size: $0000 + org $457a + "Shim for Function_1457a" ; size: $0000 + org $45b8 + "Shim for Function_145b8" ; size: $0000 + org $45de + "Shim for Function_145de" ; size: $0000 + org $46dc + "Shim for Function_146dc" ; size: $0000 +ROMX $06 + org $43ff + "Bank 6 Tilesets 00" ; size: $0400 + org $5bff + "Bank 6 Tilesets 01" ; size: $0400 + org $69ff + "Bank 6 Tilesets 02" ; size: $0400 + org $79ff + "Bank 6 Tilesets 09" ; size: $0600 +ROMX $07 + org $45ff + "Bank 7 Tilesets 13" ; size: $0600 + org $50ff + "Bank 7 Tilesets 0e" ; size: $0600 + org $59ff + "Bank 7 Tilesets 06" ; size: $0400 + org $67ff + "Bank 7 Tilesets 05" ; size: $0400 + org $75ff + "Bank 7 Tilesets 03" ; size: $0400 +ROMX $08 + org $43ff + "Bank 8 Tilesets 04" ; size: $0400 + org $51ff + "Bank 8 Tilesets 07" ; size: $0400 + org $5fff + "Bank 8 Tilesets 08" ; size: $0400 + org $6fff + "Bank 8 Tilesets 0f" ; size: $0600 + org $7aff + "Bank 8 Tilesets 11" ; size: $0600 +ROMX $0a + org $4c98 + "Shim for Function_28c98" ; size: $0000 + org $4d6e + "Shim for Function_28d6e" ; size: $0000 + org $4da4 + "Shim for Function_28da4" ; size: $0000 + org $59d0 + "Gameboy GFX" ; size: $0390 +ROMX $0b + org $5663 + "Shim for Function_2d663" ; size: $0000 +ROMX $0c + org $45ff + "Bank C Tilesets 12" ; size: $0600 + org $50ff + "Bank C Tilesets 0b" ; size: $0600 + org $5bff + "Bank C Tilesets 0d" ; size: $0600 + org $66ff + "Bank C Tilesets 14" ; size: $0600 + org $76ff + "Bank C Tilesets 0c" ; size: $0600 +ROMX $0d + org $519a + "Type Matchups" ; size: $012e +ROMX $0e + org $44d3 + "PokeBalls GFX" ; size: $0040 + org $4b78 + "Shim for LoadTrainerClassName" ; size: $0000 + org $4ba0 + "Shim for LoadTrainerClassName.got_name" ; size: $0000 + org $4ba9 + "Shim for LoadTrainerClass" ; size: $0000 + org $4f44 + "TrainerClassNames" ; size: $01b5 + org $543b + "Trainer Parties" ; size: $032c + "Trainer Parties 12 TEMPORARY" ; size: $0000 + org $54b6 + "Trainer Parties 13 TEMPORARY" ; size: $0000 + org $54dc + "Trainer Parties 14 TEMPORARY" ; size: $0000 + org $5506 + "Trainer Parties 15 TEMPORARY" ; size: $000d + org $554b + "Trainer Parties 16 TEMPORARY" ; size: $0000 + org $555d + "Trainer Parties 17 TEMPORARY" ; size: $0000 + org $5566 + "Trainer Parties 18 TEMPORARY" ; size: $0000 + org $5587 + "Trainer Parties 19 TEMPORARY" ; size: $0000 + org $55f4 + "Trainer Parties 20 TEMPORARY" ; size: $0000 + org $5658 + "Trainer Parties 21 TEMPORARY" ; size: $0000 + org $567c + "Trainer Parties 22 TEMPORARY" ; size: $0000 + org $56d7 + "Trainer Parties 23 TEMPORARY" ; size: $0000 + org $5795 + "Trainer Parties 24 TEMPORARY" ; size: $0000 + org $57c5 + "Trainer Parties 25 TEMPORARY" ; size: $0000 + org $5829 + "Trainer Parties 26 TEMPORARY" ; size: $0041 + "Trainer Parties 27 TEMPORARY" ; size: $0000 + org $58cc + "Trainer Parties 28 TEMPORARY" ; size: $0000 + org $58fb + "Trainer Parties 29 TEMPORARY" ; size: $0000 + org $59bb + "Trainer Parties 30 TEMPORARY" ; size: $00b5 +ROMX $0f + org $508c + "Shim for Function_3d08c" ; size: $0000 + org $55ce + "Shim for Function_3d5ce" ; size: $0000 + org $567c + "Shim for Function_3d67c" ; size: $0000 + org $61a4 + "Shim for Function_3e1a4" ; size: $0000 + org $6874 + "Shim for Function_3e874" ; size: $0000 + org $691e + "Shim for Function_3e91e" ; size: $0000 + org $6963 + "Shim for Function_3e963" ; size: $0000 + org $6e3d + "Wild Pokémon" ; size: $0402 + "Shim for Function_3ef19" ; size: $0000 + org $7019 + "Shim for Function_3f019" ; size: $0000 + org $704a + "Shim for Function_3f04a" ; size: $0000 + org $7068 + "Shim for Function_3f068" ; size: $0000 +ROMX $10 + "Shim for Function_40000" ; size: $0000 + org $40a6 + "Shim for ShowPokedexMenu" ; size: $0000 + org $4a3d + "Alphabetical Pokedex Order" ; size: $00fb + "Shim for Function_40ac7" ; size: $0000 + org $4b5c + "Shim for Function_40b5c" ; size: $0000 + org $4f16 + "PokedexTypeSearchStrings" ; size: $004b + org $5076 + "PokedexTypeSearchConversionTable" ; size: $000f + org $58b5 + "MoveNames" ; size: $0615 + org $5fa1 + "Shim for Function_41fa1" ; size: $0000 + org $61f8 + "Shim for Function_421f8" ; size: $0000 + org $6252 + "Shim for Function_42252" ; size: $0000 + org $7ab9 + "Evolutions and Attacks" ; size: $1627 +ROMX $11 + org $4944 + "Pokedex GFX" ; size: $0870 +ROMX $12 + org $7991 + "Trainer Battle Sprites" ; size: $3992 +ROMX $13 + org $45ff + "Bank 13 Tilesets 0a" ; size: $0600 + org $50ff + "Bank 13 Tilesets 16" ; size: $0600 + org $5eff + "Bank 13 Tilesets 19" ; size: $0400 + org $6cff + "Bank 13 Tilesets 1a" ; size: $0400 +ROMX $14 + "Shim for Function_50000" ; size: $0000 + org $4073 + "Shim for Function_50073" ; size: $0000 + org $40a0 + "Shim for Function_500a0" ; size: $0000 + org $40c6 + "Shim for Function_500c6" ; size: $0000 + org $4161 + "TypeNames" ; size: $0085 + org $4244 + "Shim for Function_50244" ; size: $0000 + org $4248 + "Shim for Function_50248" ; size: $0000 + org $42b5 + "Shim for Function_502b5" ; size: $0000 + org $469e + "Shim for Function_5069e" ; size: $0000 + org $46d4 + "Shim for Function_506d4" ; size: $0000 + org $4771 + "Shim for Function_50771" ; size: $0000 + org $4774 + "Shim for Function_50774" ; size: $0000 + org $481f + "Shim for Function_5081f" ; size: $0000 + org $48c4 + "Shim for Function_508c4" ; size: $0000 + org $4b92 + "Shim for Function_50b92" ; size: $0000 + org $4bcd + "Shim for Function_50bcd" ; size: $0000 + org $4bfe + "Shim for Function_50bfe" ; size: $0000 + org $4ed9 + "Shim for Function_50ed9" ; size: $0000 + org $6d74 + "Base Data" ; size: $1e65 + "PokemonNames" ; size: $04e7 + "PKMN Sprite Bank List" ; size: $0018 +ROMX $15 + org $7f9e + "PKMN Pics 1" ; size: $3f9f +ROMX $16 + org $7da7 + "PKMN Pics 2" ; size: $3da8 +ROMX $17 + org $7bed + "PKMN Pics 3" ; size: $3bee +ROMX $18 + org $7b56 + "PKMN Pics 4" ; size: $3b57 +ROMX $19 + org $7ca0 + "PKMN Pics 5" ; size: $3ca1 +ROMX $1a + org $7ce5 + "PKMN Pics 6" ; size: $3ce6 +ROMX $1b + org $7d26 + "PKMN Pics 7" ; size: $3d27 +ROMX $1c + org $7d7e + "PKMN Pics 8" ; size: $3d7f +ROMX $1d + org $7ece + "PKMN Pics 9" ; size: $3ecf +ROMX $1e + org $7e21 + "PKMN Pics 10" ; size: $3e22 +ROMX $1f + org $4d69 + "PKMN Pics 11" ; size: $0d6a + org $6969 + "Annon Pic Ptrs and Pics" ; size: $1c00 + "PKMN Egg Pic" ; size: $005f +ROMX $21 + org $66cf + "Attack Animation GFX" ; size: $26d0 +ROMX $23 + "Shim for AnimateTilesetImpl" ; size: $0000 + org $4349 + "Shim for OverworldFadeOut" ; size: $0000 + org $44be + "Shim for Function_8c4be" ; size: $0000 + org $4940 + "Shim for Function_8c940" ; size: $0000 + org $49c6 + "Shim for Function_8c9c6" ; size: $0000 + org $60cc + "Shim for MenuMonIconGfx" ; size: $0000 + org $70cb + "Pokemon Party Sprites" ; size: $1000 +ROMX $24 + "Shim for SetClockDialog" ; size: $0000 + org $4239 + "Shim for SlotMachineGame" ; size: $0000 + org $5a2a + "Slot Machine GFX" ; size: $0a50 +ROMX $30 + org $7e3f + "Bank 30 Sprites 1" ; size: $3e40 +ROMX $31 + org $663f + "Bank 31 Sprites 2" ; size: $2640 +ROMX $32 + "Shim for Function_c8000" ; size: $0000 + org $76ff + "Shim for Function_cb6ff" ; size: $0000 + org $7710 + "Shim for Function_cb710" ; size: $0000 + org $7733 + "Shim for Function_cb733" ; size: $0000 +ROMX $33 + "Shim for Function_cc000" ; size: $0000 + "Shim for Function_cc000_2" ; size: $0000 + org $4001 + "Shim for Function_cc001" ; size: $0000 +ROMX $37 + org $45ff + "Bank 37 Tilesets 10" ; size: $0600 + org $50ff + "Bank 37 Tilesets 15" ; size: $0600 + org $60ff + "Bank 37 Tilesets 17" ; size: $0600 + org $70ff + "Bank 37 Tilesets 18" ; size: $0600 +ROMX $38 + org $5ae2 + "Poker GFX" ; size: $06e0 + org $6212 + "15 Puzzle GFX" ; size: $0280 + org $6885 + "Matches GFX" ; size: $0280 + org $7806 + "Picross GFX" ; size: $0250 +ROMX $39 + org $432e + "Gamefreak Logo GFX" ; size: $0130 + org $52de + "Intro Underwater GFX" ; size: $0800 + org $60ee + "Intro Water Mon and Forest GFX" ; size: $0b00 + org $7e9e + "Intro Mon" ; size: $1c30 +ROMX $3a + org $410a + "Audio" ; size: $010b + org $42ef + "IsChannelSFXOn" ; size: $0033 + org $441c + "Function_e82f0" ; size: $012d + "Shim for Function_e841d" ; size: $0000 + org $45d8 + "Shim for Function_e85d8" ; size: $0000 + org $47f9 + "Shim for Function_e87f9" ; size: $0000 + org $4839 + "Shim for Function_e8839" ; size: $0000 + org $484f + "Shim for Function_e884f" ; size: $0000 + org $4d8c + "Audio engine, part 2" ; size: $009f + "Shim for _PlayCryHeader" ; size: $0000 + org $4e22 + "Shim for _PlaySFX" ; size: $0000 + org $4f11 + "Shim for LoadChannel" ; size: $0000 + org $4f6c + "Shim for LoadMusicByte" ; size: $0000 + org $52c7 + "Shim for Music" ; size: $0000 + org $52ed + "Song Header Pointers" ; size: $0027 + "Song None" ; size: $000d +ROMX $3b + org $41b8 + "Song NidorinoIntro" ; size: $01b9 + org $44c1 + "Song ViridianCity" ; size: $0309 + "Song Route1" ; size: $01c3 + org $4857 + "Song OakIntro" ; size: $01d3 + org $4e30 + "Song LeaderBattle" ; size: $05d9 + org $55f3 + "Song TrainerBattle" ; size: $07c3 + "Song Heal" ; size: $004a + org $5977 + "Song Bicycle" ; size: $033a + "Song SpottedRocket" ; size: $0072 + org $5b1b + "Song VictoryTrainer" ; size: $0132 + "Song Evolution" ; size: $00a1 +ROMX $3c + org $51cb + "Cries" ; size: $0000 + org $664d + "Song Title" ; size: $0350 +ROMX $3e + org $4161 + "Misc GFX Loading Functions" ; size: $0162 + org $5429 + "Misc GFX" ; size: $12c8 +ROMX $3f + org $40e9 + "Shim for InGameDebugMenu" ; size: $0000 + org $4aae + "GetLandmarkName" ; size: $000a + org $4bc5 + "LandmarkNames" ; size: $0117 + org $50ae + "Town Map Cursor" ; size: $0040 + org $5b66 + "Shim for Function_fdb66" ; size: $0000 + org $64ce + "Shim for MonsterTest" ; size: $0000 + org $654e + "Shim for PicTest" ; size: $0000 + org $6750 + "Shim for PicTestMenu" ; size: $0000 + org $6755 + "Shim for PicTestMenu.loop" ; size: $0000 +WRAM0 + org $c1bb + "Music engine RAM" ; size: $01bc + org $c56f + "OAM buffer" ; size: $0370 + "Shim for wMapScriptNumber" ; size: $0000 + org $c68f + "LY overrides buffer" ; size: $0090 + org $ca22 + "Shim for wTrainerClass" ; size: $0000 + org $cb3b + "CB14" ; size: $0028 + "CB56" ; size: $0002 + org $cb6b + "CB62" ; size: $000a + org $cb76 + "CB71" ; size: $0006 + org $cbe5 + "CBD2" ; size: $0014 + "Shim for wWindowData" ; size: $0000 + "Shim for wWindowStackPointer" ; size: $0000 + org $cbf7 + "CBF7" ; size: $0001 + org $cc02 + "Shim for wMenuDataHeader" ; size: $0000 + org $cc09 + "CC09" ; size: $0001 + org $cc12 + "Shim for wMenuData2" ; size: $0000 + org $cc22 + "Shim for wMenuData3" ; size: $0000 + org $cc2a + "CC2A" ; size: $0001 + org $cc40 + "CC32" ; size: $000f + org $ccbf + "CCAC" ; size: $0014 + "CCC7" ; size: $0001 + org $cccc + "CCCA" ; size: $0003 + "CCCE" ; size: $0001 + org $cd26 + "CD26" ; size: $0001 + org $cd31 + "CD31" ; size: $0001 + org $cd55 + "CD3E" ; size: $0019 + org $cd78 + "CD76" ; size: $0003 + org $cd7d + "CD7D" ; size: $0001 + org $cdbd + "CDBD" ; size: $0001 + "Shim for wTargetMapUnk" ; size: $0000 + org $cdbf + "Shim for wTargetMapGroup" ; size: $0000 + org $cdc0 + "Shim for wTargetMapId" ; size: $0000 + org $ce00 + "CE00" ; size: $0001 + org $ce25 + "CE07" ; size: $001f + "CE37" ; size: $0001 + org $ce3d + "CE3B" ; size: $0003 + org $ce5f + "CE5F" ; size: $0001 + org $ce63 + "CE61" ; size: $0003 + org $ce67 + "Shim for wPlayerName" ; size: $0000 + org $d159 + "D152" ; size: $0008 + org $d165 + "Shim for wTMCounts" ; size: $0000 + org $d19e + "D19E" ; size: $0001 + "Shim for wItems" ; size: $0000 + org $d1c8 + "D1C8" ; size: $0001 + org $d1de + "D1DE" ; size: $0001 + org $d258 + "Shim for wRivalName" ; size: $0000 + org $d264 + "Shim for wPlayerBikeSurfState" ; size: $0000 + org $d4ab + "D4AB" ; size: $0001 + org $d656 + "Shim for wMapGroup" ; size: $0000 + org $d657 + "Shim for wMapId" ; size: $0000 + org $d66a + "Shim for wMapScriptPtr" ; size: $0000 + org $d7d2 + "Shim for wPartyMonOT" ; size: $0000 + org $d874 + "PokeDexFlags" ; size: $005b + org $da3b + "Shim for wUnk_DA3B" ; size: $0000 + org $dfff + "Stack bottom" ; size: $0000 +HRAM + org $fff1 + "HRAM" ; size: $0072 +SRAM 0 + org $a497 + "Sprite Buffers" ; size: $0498 + "Unknown, bank 0" ; size: $0007 @@ -58,7 +58,6 @@ 02:4F32 PokegearRadioGfx 02:528B Function_928b 02:5695 CheckSGB -02:5695 Function_9695 03:4791 DebugWarp 03:479F DebugWarp.Destinations 03:4AA1 AddItemToInventory_ diff --git a/tools/map2link.py b/tools/map2link.py new file mode 100644 index 0000000..b24c82f --- /dev/null +++ b/tools/map2link.py @@ -0,0 +1,183 @@ +#!/bin/python3.6 + +import argparse +import re +import sys +from collections import OrderedDict + + +class MapFile: + LINETYPE_BLANK = -1 + LINETYPE_BANK = 0 + LINETYPE_SECTION = 1 + LINETYPE_SYMBOL = 2 + LINETYPE_SLACK = 3 + LINETYPE_EMPTY = 4 + + bank_types = ('ROM', 'VRAM', 'SRAM', 'WRAM', 'OAM', 'HRAM') + bank_starts = (0x4000, 0x8000, 0xa000, 0xd000, 0xfe00, 0xff80) + + class MapFileLine: + def __init__(self, linestr): + self.raw = linestr + + def __str__(self): + return self.raw + + class BlankLine(MapFileLine): + def __init__(self, linestr): + super().__init__(linestr) + + class BankLine(MapFileLine): + def __init__(self, linestr): + super().__init__(linestr) + match = re.search('#(\d+)', linestr, re.I) + if match is None: + self.bankno = 0 + else: + self.bankno = int(match.group(1)) + try: + self.banktype = MapFile.bank_types.index(linestr.split()[0].rstrip(':')) + except ValueError as e: + raise ValueError(f'Unrecognized bank type: {linestr.split()[0]}') from e + + @property + def name(self): + if self.banktype == 0: # ROM + if self.bankno == 0: + return 'ROM0' + else: + return f'ROMX ${self.bankno:02x}' + elif self.banktype == 3: # WRAM + if self.bankno == 0: + return 'WRAM0' + else: + return f'WRAMX ${self.bankno:02x}' + elif self.banktype < 3: + return f'{MapFile.bank_types[self.banktype]} {self.bankno:d}' + else: + return f'{MapFile.bank_types[self.banktype]}' + + @property + def start(self): + if self.bankno == 0: + if self.banktype == 0: + return 0x0000 + elif self.banktype == 3: + return 0xc000 + return MapFile.bank_starts[self.banktype] + + def __hash__(self): + return hash(self.name) + + class SectionLine(MapFileLine): + def __init__(self, linestr): + super().__init__(linestr) + match = re.search(r'\$([0-9A-F]{4}) \(\$([0-9A-F]+) bytes\) \["(.+)"\]', linestr, re.I) + start, size, self.name = match.groups() + self.start = int(start, 16) + self.size = int(size, 16) + self.end = self.start + self.size + self.symbols = [] + + class SymbolLine(MapFileLine): + def __init__(self, linestr): + super().__init__(linestr) + + class SlackLine(MapFileLine): + def __init__(self, linestr): + super().__init__(linestr) + match = re.search(r'\$([0-9A-F]{4}) bytes', linestr, re.I) + self.slack = int(match.group(1), 16) + + class EmptyLine(MapFileLine): + def __init__(self, linestr): + super().__init__(linestr) + + line_classes = { + LINETYPE_BLANK: BlankLine, + LINETYPE_BANK: BankLine, + LINETYPE_SECTION: SectionLine, + LINETYPE_SYMBOL: SymbolLine, + LINETYPE_SLACK: SlackLine, + LINETYPE_EMPTY: EmptyLine + } + + def __init__(self, fname, *fpargs, **fpkwargs): + self.fname = fname + self.fp = None + self.fpargs = fpargs + self.fpkwargs = fpkwargs + + def open(self): + if self.fp is None or self.fp.closed: + self.fp = open(self.fname, *self.fpargs, **self.fpkwargs) + + def close(self): + if not self.fp.closed: + self.fp.close() + self.fp = None + + def __enter__(self): + self.open() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.fp.__exit__(exc_type, exc_val, exc_tb) + self.fp = None + + def __iter__(self): + if self.fp is None or self.fp.closed: + print('Warning: Cowardly refusing to read closed file', file=sys.stderr) + raise StopIteration + for line in self.fp: + linestr = line.strip('\n') + if linestr == '': + line_type = self.LINETYPE_BLANK + elif 'SECTION:' in linestr: + line_type = self.LINETYPE_SECTION + elif 'SLACK:' in linestr: + line_type = self.LINETYPE_SLACK + elif linestr == ' EMPTY': + line_type = self.LINETYPE_EMPTY + elif ' = ' in linestr: + line_type = self.LINETYPE_SYMBOL + else: + line_type = self.LINETYPE_BANK + yield self.line_classes[line_type](linestr) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('mapfile', type=MapFile) + parser.add_argument('linkfile', type=argparse.FileType('w')) + args = parser.parse_args() + + rom_map = OrderedDict() + cur_bank = None + + print('; Automatically generated by map2link.py', file=args.linkfile) + + with args.mapfile: + for line in args.mapfile: + if isinstance(line, MapFile.BankLine): + cur_bank = line + rom_map[cur_bank] = [] + elif isinstance(line, MapFile.SectionLine): + rom_map[cur_bank].append(line) + + for bank, sections in rom_map.items(): + if len(sections) == 0: + continue + sections.sort(key=lambda s: s.start) + print(bank.name, file=args.linkfile) + start = bank.start + for section in sections: + if section.start > start: + print(f'\torg ${section.start:04x}', file=args.linkfile) + print(f'\t"{section.name}" ; size: ${section.size:04x}', file=args.linkfile) + start = section.end + + +if __name__ == '__main__': + main() |