diff options
-rw-r--r-- | constants.asm | 1 | ||||
-rw-r--r-- | constants/sgb_constants.asm | 150 | ||||
-rw-r--r-- | data/predef_pointers.inc | 24 | ||||
-rw-r--r-- | engine/battle_anims/bg_effects.asm | 2 | ||||
-rw-r--r-- | home/init.asm | 4 | ||||
-rw-r--r-- | home/math.asm | 25 | ||||
-rw-r--r-- | home/misc_32c8.asm | 98 | ||||
-rw-r--r-- | home/mon_stats.asm | 82 | ||||
-rw-r--r-- | home/print_text.asm | 21 | ||||
-rw-r--r-- | home/scrolling_menu.asm | 93 | ||||
-rw-r--r-- | home/tilemap.asm | 70 | ||||
-rw-r--r-- | home/unknown_388f.asm | 101 | ||||
-rw-r--r-- | home/util.asm | 85 | ||||
-rw-r--r-- | hram.asm | 4 | ||||
-rw-r--r-- | macros/farcall.asm | 2 | ||||
-rw-r--r-- | shim.sym | 33 | ||||
-rw-r--r-- | wram.asm | 22 |
17 files changed, 779 insertions, 38 deletions
diff --git a/constants.asm b/constants.asm index cac62a5..c141901 100644 --- a/constants.asm +++ b/constants.asm @@ -31,3 +31,4 @@ INCLUDE "constants/misc_constants.asm" INCLUDE "constants/battle_anim_constants.asm" INCLUDE "constants/menu_constants.asm" +INCLUDE "constants/sgb_constants.asm" diff --git a/constants/sgb_constants.asm b/constants/sgb_constants.asm new file mode 100644 index 0000000..69fe02f --- /dev/null +++ b/constants/sgb_constants.asm @@ -0,0 +1,150 @@ +; GetSGBLayout arguments (see engine/gfx/cgb_layouts.asm and engine/gfx/sgb_layouts.asm) + const_def + const SGB_BATTLE_GRAYSCALE + const SGB_BATTLE_COLORS + const SGB_POKEGEAR_PALS + const SGB_STATS_SCREEN_HP_PALS + const SGB_POKEDEX + const SGB_SLOT_MACHINE + const SGB_06 + const SGB_GS_INTRO + const SGB_DIPLOMA + const SGB_MAPPALS + const SGB_PARTY_MENU + const SGB_EVOLUTION + const SGB_GS_TITLE_SCREEN + const SGB_0D + const SGB_MOVE_LIST + const SGB_BETA_PIKACHU_MINIGAME + const SGB_POKEDEX_SEARCH_OPTION + const SGB_BETA_POKER + const SGB_POKEPIC + const SGB_13 + const SGB_PACKPALS + const SGB_TRAINER_CARD + const SGB_POKEDEX_UNOWN_MODE + const SGB_BILLS_PC + const SGB_UNOWN_PUZZLE + const SGB_GAMEFREAK_LOGO + const SGB_PLAYER_OR_MON_FRONTPIC_PALS + const SGB_TRADE_TUBE + const SGB_TRAINER_OR_MON_FRONTPIC_PALS + const SGB_MYSTERY_GIFT + const SGB_1E + +SGB_PARTY_MENU_HP_PALS EQU -4 +SGB_RAM EQU -1 + +; PredefPals indexes (see gfx/sgb/predef.pal) +; GetPredefPal arguments (see engine/gfx/color.asm) + const_def + const PREDEFPAL_00 + const PREDEFPAL_PALLET + const PREDEFPAL_VIRIDIAN + const PREDEFPAL_PEWTER + const PREDEFPAL_CERULEAN + const PREDEFPAL_LAVENDER + const PREDEFPAL_VERMILION + const PREDEFPAL_CELADON + const PREDEFPAL_FUCHSIA + const PREDEFPAL_CINNABAR + const PREDEFPAL_SAFFRON + const PREDEFPAL_INDIGO + const PREDEFPAL_NEW_BARK + const PREDEFPAL_CHERRYGROVE + const PREDEFPAL_VIOLET + const PREDEFPAL_AZALEA + const PREDEFPAL_GOLDENROD + const PREDEFPAL_ECRUTEAK + const PREDEFPAL_OLIVINE + const PREDEFPAL_CIANWOOD + const PREDEFPAL_MAHOGANY + const PREDEFPAL_BLACKTHORN + const PREDEFPAL_LAKE_OF_RAGE + const PREDEFPAL_SILVER_CAVE + const PREDEFPAL_DUNGEONS + const PREDEFPAL_NITE + const PREDEFPAL_BLACKOUT + const PREDEFPAL_DIPLOMA ; RB_MEWMON + const PREDEFPAL_TRADE_TUBE ; RB_BLUEMON + const PREDEFPAL_POKEDEX ; RB_REDMON + const PREDEFPAL_RB_CYANMON + const PREDEFPAL_RB_PURPLEMON + const PREDEFPAL_RB_BROWNMON + const PREDEFPAL_RB_GREENMON + const PREDEFPAL_RB_PINKMON + const PREDEFPAL_RB_YELLOWMON + const PREDEFPAL_CGB_BADGE ; RB_GREYMON + const PREDEFPAL_BETA_SHINY_MEWMON + const PREDEFPAL_BETA_SHINY_BLUEMON + const PREDEFPAL_BETA_SHINY_REDMON + const PREDEFPAL_BETA_SHINY_CYANMON + const PREDEFPAL_BETA_SHINY_PURPLEMON + const PREDEFPAL_BETA_SHINY_BROWNMON + const PREDEFPAL_BETA_SHINY_GREENMON + const PREDEFPAL_BETA_SHINY_PINKMON + const PREDEFPAL_BETA_SHINY_YELLOWMON + const PREDEFPAL_PARTY_ICON ; BETA_SHINY_GREYMON + const PREDEFPAL_HP_GREEN + const PREDEFPAL_HP_YELLOW + const PREDEFPAL_HP_RED + const PREDEFPAL_POKEGEAR + const PREDEFPAL_BETA_LOGO_1 + const PREDEFPAL_BETA_LOGO_2 + const PREDEFPAL_GS_INTRO_GAMEFREAK_LOGO + const PREDEFPAL_GS_INTRO_SHELLDER_LAPRAS + const PREDEFPAL_BETA_INTRO_LAPRAS + const PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_BG + const PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_OB + const PREDEFPAL_GS_INTRO_STARTERS_TRANSITION + const PREDEFPAL_BETA_INTRO_VENUSAUR + const PREDEFPAL_PACK ; GS_INTRO_CHARIZARD + const PREDEFPAL_SLOT_MACHINE_0 + const PREDEFPAL_SLOT_MACHINE_1 + const PREDEFPAL_SLOT_MACHINE_2 + const PREDEFPAL_SLOT_MACHINE_3 + const PREDEFPAL_BETA_POKER_0 + const PREDEFPAL_BETA_POKER_1 + const PREDEFPAL_BETA_POKER_2 + const PREDEFPAL_BETA_POKER_3 + const PREDEFPAL_BETA_RADIO + const PREDEFPAL_BETA_POKEGEAR + const PREDEFPAL_47 + const PREDEFPAL_GS_TITLE_SCREEN_0 + const PREDEFPAL_GS_TITLE_SCREEN_1 + const PREDEFPAL_GS_TITLE_SCREEN_2 + const PREDEFPAL_GS_TITLE_SCREEN_3 + const PREDEFPAL_UNOWN_PUZZLE + const PREDEFPAL_4D + const PREDEFPAL_GAMEFREAK_LOGO + +; SGB system command codes +; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_System_Command_Table + const_def + const SGB_PAL01 + const SGB_PAL23 + const SGB_PAL03 + const SGB_PAL12 + const SGB_ATTR_BLK + const SGB_ATTR_LIN + const SGB_ATTR_DIV + const SGB_ATTR_CHR + const SGB_SOUND + const SGB_SOU_TRN + const SGB_PAL_SET + const SGB_PAL_TRN + const SGB_ATRC_EN + const SGB_TEST_EN + const SGB_ICON_EN + const SGB_DATA_SND + const SGB_DATA_TRN + const SGB_MLT_REG + const SGB_JUMP + const SGB_CHR_TRN + const SGB_PCT_TRN + const SGB_ATTR_TRN + const SGB_ATTR_SET + const SGB_MASK_EN + const SGB_OBJ_TRN + +PALPACKET_LENGTH EQU $10 diff --git a/data/predef_pointers.inc b/data/predef_pointers.inc index de14d19..58b2de9 100644 --- a/data/predef_pointers.inc +++ b/data/predef_pointers.inc @@ -11,7 +11,7 @@ PredefPointers:: ; 1:62d3 ; Please be a peach and nuke the hell out of these: ; WE NEED LABELS! ; Thank youu~ - add_predef Function6445 + add_predef Function6445 ; 0 add_predef Function5d27 add_predef Function6713 add_predef Function66b1 @@ -19,7 +19,7 @@ PredefPointers:: ; 1:62d3 add_predef Functionce10 add_predef Functioncd6f add_predef Functioncde3 - add_predef Functioncde3_2 + add_predef Functioncde3_2 ; 8 add_predef Functioncde3_3 add_predef Functioncdf9 add_predef Functionce10_2 @@ -28,7 +28,7 @@ GiveItemPredef:: dbw 3, GiveItem add_predef Functionce3c add_predef Functionda28 - add_predef Functiond886 + add_predef Functiond886 ; 10 add_predef Functionda4f add_predef Functiondac8 add_predef Functiondcfc @@ -36,15 +36,15 @@ GiveItemPredef:: add_predef Functiondd5c add_predef Functionde79 add_predef Functionce7c - add_predef Functiondf7d + add_predef Functiondf7d ; 18 add_predef Functiondf91 add_predef Function1128f add_predef Function112c1 add_predef Function28c98 add_predef Function2d663 add_predef Function3d5ce - add_predef Function3f019 - add_predef Function3f068 + add_predef PlaceGraphic + add_predef Function3f068 ; 20 add_predef Function3f04a add_predef Function3d08c add_predef Function3d67c @@ -52,7 +52,7 @@ GiveItemPredef:: add_predef Function3ef19 add_predef Function3e874 add_predef Function3e91e - add_predef Function3e963 + add_predef Function3e963 ; 28 add_predef Function421f8 add_predef Function42252 add_predef Function41fa1 @@ -60,7 +60,7 @@ GiveItemPredef:: add_predef Function28d6e add_predef Function40ac7 add_predef Function40000 - add_predef Function40b5c + add_predef Function40b5c ; 30 add_predef Function50000 add_predef Function50bfe add_predef Function50bcd @@ -68,7 +68,7 @@ GiveItemPredef:: add_predef Function508c4 add_predef Function50771 add_predef Function50774 - add_predef Function5081f + add_predef Function5081f ; 38 add_predef Function506d4 add_predef Function5069e add_predef Function502b5 @@ -76,7 +76,7 @@ GiveItemPredef:: add_predef Function50248 add_predef Function500c6 add_predef Function500a0 - add_predef Function50073 + add_predef Function50073 ; 40 add_predef Function50ed9 add_predef Functioncb6ff add_predef Functioncb710 @@ -84,7 +84,7 @@ GiveItemPredef:: add_predef Function145b8 add_predef Function146dc add_predef Function145de - add_predef ExecuteBGEffects + add_predef ExecuteBGEffects ; 48 add_predef Function1457a add_predef Function143e0 add_predef CheckSGB @@ -92,7 +92,7 @@ GiveItemPredef:: add_predef Function8786 add_predef Function8c4be add_predef Function8c9c6 - add_predef Function8c940 + add_predef Function8c940 ; 50 add_predef Functioncc001 add_predef Functioncc000 add_predef Functioncc000_2 diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index 746c979..7e51b03 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -2357,7 +2357,7 @@ BGEffect_CheckFlyDigStatus: ; c8ccc (32:4ccc) ret BattleBGEffects_CheckSGB: ; c8ce3 (32:4ce3) - ld a, [wcccf] + ld a, [wSGB] and a ret diff --git a/home/init.asm b/home/init.asm index 515ce84..98fa129 100644 --- a/home/init.asm +++ b/home/init.asm @@ -104,9 +104,7 @@ Init: ; 052f call DisableAudio call _2007 - ; predef ??? - ld a, $4B ; TODO: add predefs so the line above can be uncommented - call Predef + predef CheckSGB ld a, $1F ld [rIE], a ld a, HIGH($9C00) diff --git a/home/math.asm b/home/math.asm new file mode 100644 index 0000000..8b3db6f --- /dev/null +++ b/home/math.asm @@ -0,0 +1,25 @@ +include "constants.asm" + +if DEBUG +SECTION "Math utility functions", ROM0 [$3380] +else +SECTION "Math utility functions", ROM0 [$3344] +endc + +Multiply:: + push hl + push bc + callab _Multiply + pop bc + pop hl + ret + +Divide:: + push hl + push de + push bc + homecall _Divide + pop bc + pop de + pop hl + ret diff --git a/home/misc_32c8.asm b/home/misc_32c8.asm new file mode 100644 index 0000000..3eabb12 --- /dev/null +++ b/home/misc_32c8.asm @@ -0,0 +1,98 @@ +include "constants.asm" + +if DEBUG +SECTION "Unknown 32c8", ROM0[$32c8] +else +SECTION "Unknown 32c8", ROM0[$328c] +endc + +Function32c8:: + predef Functionce10 + ld a, b + and a + ret + +Function32d0:: + ld hl, .Data + ret + +.Data: ; 00:32d4 + db "@" + +SubtractSigned:: + sub b + ret nc + cpl + add $1 + scf + ret + +if DEBUG +SECTION "Unknown 3686", ROM0[$3686] +else +SECTION "Unknown 3686", ROM0[$364a] +endc + +GiveMonToPlayer:: ; 3686 +; Give to the player Pokemon of species b at level c. + ld a, b + ld [wMonDexIndex], a + ld a, c + ld [wCurPartyLevel], a + xor a + ld [wMonType], a + jpba Function1130a + +WaitPressedAny:: ; 369a +; Waits for one of the buttons in d to be pressed. +; If bc is negative, waits forever. +; Otherwise, times out after bc frames then returns z. + +; Reset hJoypadSum to clear button history + xor a + ldh [hJoypadSum], a +.loop: ; 00:369d +; Wait for joypad polling. + call DelayFrame + +; If any of the buttons in d were pressed, return nz. + ldh a, [hJoypadSum] + and a + jr z, .not_pressed + and d + ret nz +.not_pressed: ; 00:36a7 + +; If bc < 0, don't check timeout. + bit 7, b + jr nz, .loop + +; Count down to timeout. + dec bc + ld a, b + or c + jr nz, .loop + +; Return z, signifying that the request timed out. + ret + +CountSetBits:: ; 36b1 +; Count the number of bits set in b bytes at hl. +; Return to a, c, and wce37. + ld c, $0 +.asm_36b3: ; 00:36b3 + ld a, [hli] + ld e, a + ld d, $8 +.asm_36b7: ; 00:36b7 + srl e + ld a, $0 + adc c + ld c, a + dec d + jr nz, .asm_36b7 + dec b + jr nz, .asm_36b3 + ld a, c + ld [wce37], a + ret diff --git a/home/mon_stats.asm b/home/mon_stats.asm new file mode 100644 index 0000000..8d702e8 --- /dev/null +++ b/home/mon_stats.asm @@ -0,0 +1,82 @@ +include "constants.asm" + +if DEBUG +SECTION "Mon Stats", ROM0 [$394b] +else +SECTION "Mon Stats", ROM0 [$390f] +endc + +DrawBattleHPBar:: + push hl + push de + push bc + ld a, $60 + ld [hli], a + ld a, $61 + ld [hli], a + push hl + ld a, $62 +.asm_3957: ; 00:3957 + ld [hli], a + dec d + jr nz, .asm_3957 + ld a, $6b + add b + ld [hl], a + pop hl + ld a, e + and a + jr nz, .asm_396a + ld a, c + and a + jr z, .asm_397d + ld e, $1 +.asm_396a: ; 00:396a + ld a, e + sub $8 + jr c, .asm_3979 + ld e, a + ld a, $6a + ld [hli], a + ld a, e + and a + jr z, .asm_397d + jr .asm_396a + +.asm_3979: ; 00:3979 + ld a, $62 + add e + ld [hl], a +.asm_397d: ; 00:397d + pop bc + pop de + pop hl + ret + +PrepMonFrontpic:: + ld a, $1 + ld [wSpriteFlipped], a +_PrepMonFrontpic:: + ld a, [wMonDexIndex] + and a + jr z, .asm_39a8 + cp 252 + jr nc, .asm_39a8 + push hl + ld de, $9000 + call LoadMonFrontSprite + pop hl + xor a + ldh [hGraphicStartTile], a + lb bc, 7, 7 + predef PlaceGraphic + xor a + ld [wSpriteFlipped], a + ret + +.asm_39a8: ; 00:39a8 + xor a + ld [wSpriteFlipped], a + inc a + ld [wMonDexIndex], a + ret diff --git a/home/print_text.asm b/home/print_text.asm index e8b4eeb..0a17688 100644 --- a/home/print_text.asm +++ b/home/print_text.asm @@ -48,4 +48,23 @@ PrintLetterDelay:: ; 33a3 (0:33a3) pop de pop hl ret -; 0x33e3
\ No newline at end of file +; 0x33e3 + +CopyDataUntil:: ; 33e3 +; Copy [hl .. bc) to de. + +; In other words, the source data is +; from hl up to but not including bc, +; and the destination is de. + +.asm_33e3: ; 00:33e3 + ld a, [hli] + ld [de], a + inc de + ld a, h + cp b + jr nz, .asm_33e3 + ld a, l + cp c + jr nz, .asm_33e3 + ret diff --git a/home/scrolling_menu.asm b/home/scrolling_menu.asm new file mode 100644 index 0000000..28d3d3e --- /dev/null +++ b/home/scrolling_menu.asm @@ -0,0 +1,93 @@ +include "constants.asm" + +if DEBUG +SECTION "Scrolling Menu", ROM0 [$3810] +else +SECTION "Scrolling Menu", ROM0 [$37D4] +endc + +Function3810:: + ld e, [hl] + inc hl + ld d, [hl] + inc hl + push hl + ld h, d + ld l, e + call CopyMenuHeader + pop hl + ld e, [hl] + inc hl + ld d, [hl] + inc hl + ld a, [de] + ld [wMenuCursorBuffer], a + push de + ld e, [hl] + inc hl + ld d, [hl] + inc hl + ld a, [de] + ld [wMenuScrollPosition], a + push de + call ScrollingMenu + pop de + ld a, [wMenuScrollPosition] + ld [de], a + pop de + ld a, [wMenuCursorY] + ld [de], a + ld a, [wMenuJoypad] + ret + +ScrollingMenu:: ; 00:383e + call CopyMenuData + ldh a, [hROMBank] + push af + + ld a, BANK(_InitScrollingMenu) ; and BANK(_ScrollingMenu) + call Bankswitch + + call _InitScrollingMenu + call SetPalettes + call _ScrollingMenu + + pop af + call Bankswitch + + ld a, [wMenuJoypad] + ret + +Function385a:: + push hl + jr asm_3865 + +Function385d:: + callab Function_8f1cb +asm_3865: ; 00:3865 + pop hl + call MenuTextBox + ld c, $0 + call Function3872 + call CloseWindow + ret + +Function3872:: ; 00:3872 + push bc + jr asm_387d + +Function3875:: + callab Function8cd0c +asm_387d: ; 00:387d + pop bc + call GetJoypad + ldh a, [hJoyDown] + and A_BUTTON | B_BUTTON + jr nz, .asm_388e + ld a, c + and a + jr z, Function3872 + dec c + jr z, Function3872 +.asm_388e: ; 00:388e + ret diff --git a/home/tilemap.asm b/home/tilemap.asm new file mode 100644 index 0000000..ca97f42 --- /dev/null +++ b/home/tilemap.asm @@ -0,0 +1,70 @@ +include "constants.asm" + +if DEBUG +SECTION "Tilemap Functions", ROM0 [$360B] +else +SECTION "Tilemap Functions", ROM0 [$35CF] +endc + +Function360b:: + call ClearSprites + ld hl, wVramState + set 0, [hl] + call Function3657 + call LoadFontExtra + call GetMemSGBLayout + jr WaitBGMap + +ClearBGPalettes:: + call ClearPalettes +WaitBGMap:: ; 00:3621 +; Tell VBlank to update BG Map + ld a, $1 + ldh [hBGMapMode], a +; Wait for it to do its magic + ld c, 3 + call DelayFrames + ret + +SetPalettes:: ; 00:362b + ld a, %11100100 + ldh [rBGP], a + ld a, %11010000 + ldh [rOBP0], a + ret + +ClearPalettes:: ; 00:3634 + xor a + ldh [rBGP], a + ldh [rOBP0], a + ldh [rOBP1], a + ret + +GetMemSGBLayout:: ; 00:363c + ld b, SGB_RAM +GetSGBLayout:: ; 00:363e + ld a, [wSGB] + and a + ret z + predef_jump Function928b + +SetHPPal:: ; 00:3648 + ld a, e + cp 27 ; 56.25% + ld d, $0 + jr nc, .done + cp 10 ; 20.83% + inc d + jr nc, .done + inc d +.done: ; 00:3655 + ld [hl], d + ret + +Function3657:: ; 00:3657 + call DisableLCD + callab Function140d9 + call LoadFont + call UpdateSprites + call EnableLCD + ret diff --git a/home/unknown_388f.asm b/home/unknown_388f.asm new file mode 100644 index 0000000..54aea4d --- /dev/null +++ b/home/unknown_388f.asm @@ -0,0 +1,101 @@ +include "constants.asm" + +if DEBUG +SECTION "Unknown 388F", ROM0 [$388F] +else +SECTION "Unknown 388F", ROM0 [$3853] +endc + + +Function388f:: + ret + +Function3890:: + callba Function14cac + ret + +Function3899:: + callba Function14dac + ret + +Function38a2:: + callba Function14dc4 + ret + +Function38ab:: + callba Function14ddd + ret + +Function38b4:: + callba Function14e00 + ret + +Function38bd:: + callba Function14e5f + ret + +Function38c6:: + callba Function14e27 + ret + +Function38cf:: + callba Function14e4a + ret + +Function38d8:: + ld hl, wc5ed + set 7, [hl] + ld a, $8 + ld [wd637], a + ret + +Function38e3:: + ldh a, [hJoyState] + and $f0 + ret z + call Function3233 + jp nz, Function323e + callab Function3ee3e + ld a, [wBattleMode] + and a + ret z + ld a, $3 + call Function2117 + call Function3240 + ret + +Function3904:: + predef Function3ef19 + ld a, $f3 + ldh [hMapEntryMethod], a + ld hl, wd4a9 + set 5, [hl] + ld hl, wJoypadFlags + set 4, [hl] + set 6, [hl] + ld a, $b + call Function2117 + ret + +Function391f:: + ret + +Function3910:: + ld a, [wcd5d] + cp $1 + jr z, .asm_392d + ld a, $4 + call Function2117 + ret + +.asm_392d: ; 00:392d + ld hl, wJoypadFlags + res 4, [hl] + ld hl, .text + call Function3111 + call RotateFourPalettesLeft + jp Init + +.text: + text "つぎは がんばるぞ!!" + done diff --git a/home/util.asm b/home/util.asm index 6591da2..880513b 100644 --- a/home/util.asm +++ b/home/util.asm @@ -1,12 +1,59 @@ INCLUDE "constants.asm" if DEBUG -SECTION "Misc Utility Functions", ROM0[$341F] +SECTION "Misc Utility Functions", ROM0[$33EF] else -SECTION "Misc Utility Functions", ROM0[$33E3] +SECTION "Misc Utility Functions", ROM0[$33B3] endc -_341F:: ; 341f +Function33ef:: + ; hl = src + ; de = dest + ; b = y + ; c = x + push hl + push de + push bc + ld a, b + dec a + dec a + ld b, $0 +.asm_33f7: ; 00:33f7 + add hl, bc + dec a + jr nz, .asm_33f7 + pop bc + dec b + ld a, b + push hl + add hl, bc + ld d, h + ld e, l + pop hl +.asm_3403: ; 00:3403 + push af + push bc + call CopyBytes + pop bc + push bc + ld a, c + xor $ff + ld c, a + ld b, $ff + inc bc + add hl, bc + ld d, h + ld e, l + add hl, bc + pop bc + pop af + dec a + jr nz, .asm_3403 + pop hl + pop de + jp CopyBytes + +SkipNames:: ; 341f ; Returns hl + a * 6 and a ret z @@ -39,3 +86,35 @@ memcmp:: ; 3430 dec c jr nz, .loop ret + +Function3439:: ; 3439 +; Place 2x2 sprite from *de into OAM at slot a + ld h, HIGH(wVirtualOAM) + swap a + ld l, a + call .Load + push bc + ld a, $8 + add c + ld c, a + call .Load + pop bc + ld a, $8 + add b + ld b, a + call .Load + ld a, $8 + add c + ld c, a +.Load: ; 00:3455 + ld [hl], b + inc hl + ld [hl], c + inc hl + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + ret @@ -57,7 +57,9 @@ hJoyDebounceSrc:: db ; ffa5 hJoypadState2:: db ; ffa6 - ds 8 ; TODO + ds 6 ; TODO +hGraphicStartTile:: db ; ffad +hMoveMon:: db UNION diff --git a/macros/farcall.asm b/macros/farcall.asm index 05bb7b1..5e39410 100644 --- a/macros/farcall.asm +++ b/macros/farcall.asm @@ -12,7 +12,7 @@ callab: MACRO ; address, bank ENDM homecall: MACRO - ld a, [hROMBank] + ldh a, [hROMBank] push af ld a, BANK(\1) call Bankswitch @@ -17,18 +17,15 @@ 00:1CEB MenuBox 00:1D2D MenuBoxCoord2Tile 00:202C Function202c - +00:2117 Function2117 00:23DC LoadWildMons 00:23E5 FadeIn ; This is not OverworldFadeIn, but I don't know what it is 00:2C05 StartMenuCheck +00:3111 Function3111 00:3171 Function3171 -00:3621 WaitBGMap -00:362B SetPalettes -00:3634 ClearPalettes -00:363C GetMemSGBLayout -00:363E GetSGBLayout -00:3648 SetHPPal -00:3655 SetHPPal.done +00:3233 Function3233 +00:323E Function323e +00:3240 Function3240 00:39BA PlayCry 00:3D86 WaitSFX 00:3D87 WaitSFX.wait @@ -57,6 +54,8 @@ 01:6445 Function6445 01:66B1 Function66b1 01:6713 Function6713 +01:6810 _Multiply +01:6870 _Divide 01:68F3 ItemAttributes 02:4000 Function8000 @@ -95,6 +94,7 @@ 04:528F Function1128f 04:52C1 Function112c1 +04:530A Function1130a 04:5677 DoPlayerMovement 04:5DBE DisplayStartMenu 04:640B Function1240b @@ -106,6 +106,7 @@ 05:404C CheckInteriorMap 05:405B AddIndoorSprites 05:40AA AddOutdoorSprites +05:40D9 Function140d9 05:40FB LoadUsedSpritesGfx ; TODO: maybe there's a better name 05:43E0 Function143e0 05:457A Function1457a @@ -119,6 +120,17 @@ ; ptr Copied to c5eb ; word Unknown (2 bytes) 05:470E UnknownMapBufferPointers +05:4CAC Function14cac +05:4DAC Function14dac +05:4DC4 Function14dc4 +05:4DDD Function14ddd +05:4E00 Function14e00 +05:4E5F Function14e5f +05:4E27 Function14e27 +05:4E4A Function14e4a + +09:426A _InitScrollingMenu +09:4287 _ScrollingMenu 0A:4C98 Function28c98 0A:4D6E Function28d6e @@ -138,8 +150,9 @@ 0F:691E Function3e91e 0F:6963 Function3e963 0F:69A9 _LoadWildMons +0F:6E3E Function3ee3e 0F:6F19 Function3ef19 -0F:7019 Function3f019 +0F:7019 PlaceGraphic 0F:704A Function3f04a 0F:7068 Function3f068 @@ -178,7 +191,9 @@ 23:44BE Function8c4be 23:4940 Function8c940 23:49C6 Function8c9c6 +23:4D0C Function8cd0c 23:60CC MenuMonIconGfx +23:71CB Function_8f1cb 24:4000 SetClockDialog 24:4239 SlotMachineGame @@ -100,7 +100,8 @@ wMapBuffer:: wMapScriptNumber:: db ; c5e8 wMapScriptNumberLocation:: dw ; c5e9 wUnknownMapPointer:: dw ; c5eb ; TODO - ds 19 ; TODO +wc5ed:: db ; c5ed + ds 18 ; TODO wMapBufferEnd:: ; c600 @@ -215,8 +216,7 @@ wPlayerLinkAction:: db ; cb51 wLinkTimeoutFrames:: dw ; cb56 wcb58:: ds 2 ; cb58 -; cb5a - ds 1 ; TODO +wMonType:: db ; cb5a wCurSpecies:: db ; cb5b wNamedObjectTypeBuffer:: db ; cb5c @@ -300,7 +300,7 @@ wDebugWarpSelection:: ; cc39 ds 6 -wSGB:: ; cc40 +wcc40:: ; cc40 db SECTION "CC9C", WRAM0[$CC9C] @@ -341,7 +341,7 @@ wOBP1:: db ; cccc SECTION "CCCE", WRAM0[$CCCE] wDisableVBlankWYUpdate:: db ; ccce -wcccf:: db +wSGB:: db SECTION "CD26", WRAM0[$CD26] @@ -385,7 +385,10 @@ wFarCallBCBuffer:: ; cd54 dw ds 3 ; TODO -wVramState:: db +wVramState:: db ; cd59 + + ds 3 ; TODO +wcd5d:: db ; cd5d SECTION "CD72", WRAM0[$CD72] wcd72:: dw ; cd72 @@ -404,6 +407,7 @@ wItemQuantityBuffer:: db ; cd7e SECTION "CDBA", WRAM0[$CDBA] wItemAttributeParamBuffer:: db ; cdba +wCurPartyLevel:: db ; cdbb SECTION "CDBD", WRAM0[$CDBD] @@ -618,8 +622,10 @@ wBallQuantities:: db ; d1df SECTION "Rival's Name", WRAM0[$D258] wRivalsName:: ds 6 ; d258 -SECTION "D4AB", WRAM0[$D4AB] +SECTION "D4AB", WRAM0[$D4A9] +wd4a9:: db ; d4a9 + ds 1 ; TODO wJoypadFlags:: db ; d4ab ; 76543210 ; ||||\__/ @@ -652,6 +658,8 @@ ENDR wCurrMapObjectCount:: ; d5f6 db +SECTION "D637", WRAM0[$D637] +wd637:: db ; d637 SECTION "Used sprites", WRAM0[$D643] |