From 77d75a00c5df0bac4cdc7e63cd157d734a6ce79b Mon Sep 17 00:00:00 2001 From: ehw Date: Mon, 4 Jun 2018 00:51:46 -0400 Subject: Title screen disassembled (new pr) --- Makefile | 2 - engine/title.asm | 637 ++++++++++++++++++++++++++++++++++++- gfx.asm | 25 +- gfx/title/title.png | Bin 0 -> 265 bytes gfx/title/title_gold_version.png | Bin 0 -> 276 bytes gfx/title/title_goldlogo.png | Bin 0 -> 225 bytes gfx/title/title_hooh.png | Bin 0 -> 488 bytes gfx/title/title_logo.png | Bin 0 -> 618 bytes gfx/title/title_silver_version.png | Bin 0 -> 282 bytes gfx/title/title_silverlogo.png | Bin 0 -> 243 bytes gfx/title/titlebgdecoration.png | Bin 0 -> 145 bytes home/init.asm | 2 +- shim.sym | 94 +++--- wram.asm | 57 ++-- 14 files changed, 731 insertions(+), 86 deletions(-) create mode 100644 gfx/title/title.png create mode 100644 gfx/title/title_gold_version.png create mode 100644 gfx/title/title_goldlogo.png create mode 100644 gfx/title/title_hooh.png create mode 100644 gfx/title/title_logo.png create mode 100644 gfx/title/title_silver_version.png create mode 100644 gfx/title/title_silverlogo.png create mode 100644 gfx/title/titlebgdecoration.png diff --git a/Makefile b/Makefile index bf7cf66..1bb744d 100644 --- a/Makefile +++ b/Makefile @@ -84,8 +84,6 @@ $(BUILD)/%.o: %.asm | $$(dir $$@) $(BUILD)/gfx/sgb/sgb_border_alt.2bpp: tools/gfx += --trim-whitespace $(BUILD)/gfx/sgb/sgb_border_gold.2bpp: tools/gfx += --trim-whitespace $(BUILD)/gfx/sgb/sgb_border_silver.2bpp: tools/gfx += --trim-whitespace -$(BUILD)/gfx/title/title_gold.2bpp: tools/gfx += --trim-whitespace -$(BUILD)/gfx/title/title_silver.2bpp: tools/gfx += --trim-whitespace $(BUILD)/gfx/trainer_card/leaders.2bpp: tools/gfx += --trim-whitespace $(BUILD)/gfx/trainer_card/trainer_card.2bpp: tools/gfx += --trim-whitespace $(BUILD)/gfx/pokegear/town_map.2bpp: tools/gfx += --trim-trailing diff --git a/engine/title.asm b/engine/title.asm index 961b83b..e141096 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -1,19 +1,648 @@ INCLUDE "constants.asm" +INCLUDE "vram.asm" SECTION "Title screen", ROMX[$5D8C], BANK[$01] -IntroSequence:: ; 5d8c - ; TODO +IntroSequence:: ; 5D8C + callfar GameFreakIntro, $39 + jr c, TitleSequenceStart ; 5DAE + ld a, [wTitleSequenceOpeningType] ; CC38 + and a + jr z, .opening_sequence + +.pikachu_minigame + callfar PikachuMiniGame, $38 + jr TitleSequenceStart ; 5DAE +.opening_sequence + callfar OpeningCutscene, $39 + +TitleSequenceStart:: + call TitleSequenceInit + callfar SetTitleBGDecorationBorder, $02 + +.loop + call TitleScreenMain ; 5FB8 + jr nc, .loop + + call ClearPalettesAndWait ; 361E + call ClearSprites + ld a, $01 + ldh [hBGMapMode], a + call ClearTileMap + call ResetPalette ;33a + + ld a, [wJumptableIndex + 1] ; CB5F + ld e, a + ld d, 0 + ld hl, TitleScreenJumpTable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + + jp hl + +TitleScreenJumpTable:: + dw MainMenu + dw DebugMenu ; 4031 + dw SRAMClearMenu ; 61C6 + dw IntroSequence + +TitleSequenceInit:: + call ClearPalettes + + xor a + ldh [hMapAnims], a + ldh [hSCY], a + ldh [hSCX], a + + ld de, MUSIC_NONE ; Stop the music. + call PlayMusic + + call ClearTileMap + call DisableLCD + call ClearSprites + + ld a, $23 + ld hl, InitEffectObject ; 8CCFD - create another object? + call FarCall_hl + ld hl, vChars0 + ld bc, vBGMap0 - vChars0 + +.clear_loop + ld [hl], $00 + inc hl + dec bc + ld a, b + or c + jr nz, .clear_loop + + ld hl, TitleScreenGFX ; 107CF + ld de, $9410 + ld bc, 13 tiles + ld a, BANK(TitleScreenGFX) + call FarCopyData + + ld hl, TitleScreenVersionGFX ; 1095F + ld de, $9600 + ld bc, 24 tiles + ld a, BANK(TitleScreenVersionGFX) + call FarCopyData + + ld hl, TitleScreenHoOhGFX ; 10ADF + ld de, $9000 + ld bc, 49 tiles + ld a, BANK(TitleScreenHoOhGFX) + call FarCopyData + + ld hl, TitleScreenLogoGFX ; 10DEF + ld de, $8800 + ld bc, 58 tiles + ld a, BANK(TitleScreenLogoGFX) + call FarCopyData + + ld hl, TitleScreenGoldLogoGFX ; 1118F + ld de, $8BA0 + ld bc, 20 tiles + ld a, BANK(TitleScreenGoldLogoGFX) + call FarCopyData + + call SetTitleGfx ; 6288 + ld hl, wTileMapBackup ; C408 + ld a, $24 + ld [hli], a + ld a, $00 + ld [hli], a + + ld hl, vBGMap0 + ld bc, $0800 + ld a, " " + call ByteFill + + ld b, $06 + call GetSGBLayout + call EnableLCD + ld a, $01 + ldh [hBGMapMode], a + 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) + + call .load_position_table + + + ld a, %00011010 + ldh [rBGP], a + ld a, %11100100 + ldh [rOBP0], a + ret + +.load_position_table: + ld hl, FirePositionTable + ld c, 6 ; Load 6 flying objects on the screen. + +.set_fire_note_loop + push bc + ld e, [hl] + inc hl + ld d, [hl] + inc hl + push hl + ld a, $2E ; Title fire/note object effect type? + call InitSpriteAnimStruct ; 3CA8 + pop hl + pop bc + dec c + jr nz, .set_fire_note_loop + ret + +FirePositionTable:: ; 5EAC-5EB7 + dw $4CE0 + dw $58A0 + dw $6490 + dw $70D0 + dw $7CB0 + dw $8800 + +TitleFireGFX:: INCBIN "gfx/title/fire.2bpp" ; 5EB8-5F37 +TitleNotesGFX:: INCBIN "gfx/title/notes.2bpp" ; 5F38=5FB7 + +TitleScreenMain:: ; 5FB8 + ld a, [wJumptableIndex] ; CB5E + bit 7, a + jr nz, .exit + call TitleScreenSequence + ld a, $23 + ld hl, EffectObjectJumpNoDelay ; 8CD13 + call FarCall_hl + call DelayFrame + and a + ret + +.exit + scf + ret + +TitleScreenSequence:: + ld e, a + ld d, 0 + ld hl, TitleScreenSequenceTable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +TitleScreenSequenceTable:: + dw TitleSeq_Start + dw TitleSeq_LoadPokemonLogo + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_MoveTitle + dw TitleSeq_MoveTitleEnd + dw TitleSeq_InitFlashTitle + dw TitleSeq_FlashTitle + + dw TitleSeq_PMJapaneseChara + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_WaitForNextSequence + dw TitleSeq_PMSubtitle + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_IncreaseJumpTableIndex + + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_WaitForNextSequence + dw TitleSeq_Version + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_WaitForNextSequence + dw TitleSeq_CopyRight + + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_WaitForNextSequence + dw TitleSeq_HoOh + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_IncreaseJumpTableIndex + dw TitleSeq_IncreaseJumpTableIndex + + dw TitleSeq_WaitForNextSequence + dw TitleSeq_PressButtonInit + dw TitleSeq_TitleScreenInputAndTimeout + dw TitleSeq_FadeMusicOut + +TitleSeq_IncreaseJumpTableIndex:: ; 6025 + ld hl, wJumptableIndex ; CB5E + inc [hl] + ret + +TitleSeq_WaitForNextSequence:: ; 602A + xor a + ldh [hBGMapMode], a + ld hl, wJumptableIndex + 2 + ld a, [hl] + and a + jr z, .next_seq + dec [hl] + ret + +.next_seq + call TitleSeq_IncreaseJumpTableIndex + ret + +TitleSeq_LoadPokemonLogo:: ; 603a + call PrintPokemonLogo ; 6196 + call TitleSeq_IncreaseJumpTableIndex ; 6025 + ld a, $01 + ldh [hBGMapMode], a + ret + +TitleSeq_Start:: ; 6045 + call TitleSeq_IncreaseJumpTableIndex + push de + ld de, $002D + call PlaySFX ; Play "Swish" sound + pop de + ld a, $80 + ld [wJumptableIndex + 2], a + call SetLYOverrides + ld a, $43 + ldh [hLCDCPointer], a + ret + +TitleSeq_MoveTitle:: ; 605d + xor a + ldh [hBGMapMode], a + ld hl, wJumptableIndex + 2 + ld a, [hl] + and a + jr z, .nextseq + add $04 + ld [hl], a + ld e, a +.wait + ldh a, [rLY] + cp $40 + jr c, .wait + ld a, e + call SetLYOverrides + ret + +.nextseq + call TitleSeq_IncreaseJumpTableIndex + ret + +TitleSeq_MoveTitleEnd:: ; 607A + xor a + ldh [hLCDCPointer], a + call TitleSeq_IncreaseJumpTableIndex + ld de, MUSIC_TITLE + call PlayMusic ; Play "Title Theme" + ret + +TitleSeq_InitFlashTitle:: ; 6087 + call TitleSeq_IncreaseJumpTableIndex + ld a, %00011010 + ld [wJumptableIndex + 2], a + ld a, 6 + ld [wJumptableIndex + 3], a + ret + +TitleSeq_FlashTitle:: ; 6095 + ld hl, wJumptableIndex + 3 + ld a, [hl] + and a + jr z, .exit + dec [hl] + ld a, [wJumptableIndex + 2] + xor %00011010 + ld [wJumptableIndex +2 ], a + ldh [rBGP], a + call DelayFrame + call DelayFrame + ret + +.exit + call TitleSeq_IncreaseJumpTableIndex + ld a, %11100100 + ldh [rBGP], a + ret + +TitleSeq_PMJapaneseChara:: ; 60B6 + call PrintPMJapaneseChara + ld a, $10 + ld [wJumptableIndex + 2], a + call TitleSeq_IncreaseJumpTableIndex + ld a, $01 + ldh [hBGMapMode], a + ret + +TitleSeq_PMSubtitle:: ; 60C6 + call PrintPMSubtitle + ld a, $10 + ld [wJumptableIndex + 2], a + call TitleSeq_IncreaseJumpTableIndex + ld a, $01 + ldh [hBGMapMode], a + ret + +TitleSeq_Version:: ; 60D6 + call PrintVersion + ld a, $10 + ld [wJumptableIndex + 2], a + call TitleSeq_IncreaseJumpTableIndex + ld a, $01 + ldh [hBGMapMode], a + ret + +TitleSeq_CopyRight:: ; 60e6 + call PrintCopyRight + ld a, $10 + ld [wJumptableIndex + 2], a + call TitleSeq_IncreaseJumpTableIndex + ld a, $01 + ldh [hBGMapMode], a + ret + +TitleSeq_HoOh:: ; 60f6 + call Set_HoOh + ld a, $10 + ld [wJumptableIndex + 2], a + call TitleSeq_IncreaseJumpTableIndex + ld a, $01 + ldh [hBGMapMode], a + ret + +TitleSeq_PressButtonInit:: ; 6106 + ld hl, wJumptableIndex + inc [hl] + ld hl, wJumptableIndex + 2 + ld de, DecodeNybble0Table - 3 ; DecodeNybble0Table - 3 = $0C00 + ld [hl], e + inc hl + ld [hl], d + ret + +TitleSeq_TitleScreenInputAndTimeout:: ; 6114 + ld hl, wJumptableIndex + 2 + ld e, [hl] + inc hl + ld d, [hl] + ld a, e + or d + jr z, .psbtn_reset + dec de + ld [hl], d + dec hl + ld [hl], e + call GetJoypad + ld hl, hJoyState ; hJoyState = $FFA3 + ld a, [hl] + 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] + and SELECT ; SELECT will bring you to the debug menu. + jr nz, .psbtn_gotodebug + ld a, [hl] + and $09 + ret z + +.psbtn_play + ld a, $00 ; MainMenu + jr .psbtn_nextseq + +.psbtn_gotodebug +if DEBUG + ld a, $01 ; DebugMenu + jr .psbtn_nextseq +else + ret +endc + +.psbtn_sramclear + ld a, $02 ; SRAMClearMenu + +.psbtn_nextseq + ld [wJumptableIndex + 1], a + ld hl, wJumptableIndex + set 7, [hl] + ret + +.psbtn_reset + ld hl, wJumptableIndex + inc [hl] + xor a + ld [wNextBGM], a ; C1A7 + ld [wNextBGM + 1], a + ld hl, wSoundFade ; C1A5 + ld [hl], 8 + ret + +TitleSeq_FadeMusicOut:: ; 615C + ld a, [wSoundFade] + and a + ret nz + ld a, 3 + ld [wJumptableIndex + 1], a + ld hl, wJumptableIndex + set 7, [hl] + ret + +SetLYOverrides:: ; 616C + ld hl, wLYOverrides + ld c, $30 +.setly_loop + ld [hli], a + dec c + jr nz, .setly_loop + ret + +PrintPMSubtitle:: ; 6176 + coord hl, 2, 6 + ld b, 15 + ld a, $69 + jr LoadPrintArea ; 6186 + +PrintVersion:: ; 617f + coord hl, 4, 1 + ld b, $09 + ld a, $60 + +LoadPrintArea:: ; 6186 + ld [hli], a + inc a + dec b + jr nz, LoadPrintArea + ret + +PrintPMJapaneseChara:: ; 618C + coord hl, 15, 2 + ld a, "こ" + lb bc, 4, 4 + jr PrintBoxArea + +PrintPokemonLogo:: ; 6196 + coord hl, 15, 3 + ld [hl], $B8 + coord hl, 15, 4 + ld [hl], $B9 + coord hl, 1, 2 + ld a, $80 + ld bc, $0E04 + +PrintBoxArea:: + ld de, SCREEN_WIDTH + push bc + push hl + +.xloop + ld [hli], a + inc a + dec b + jr nz, .xloop + pop hl + add hl, de + pop bc + dec c + jr nz, PrintBoxArea + ret + +PrintCopyRight:: + coord hl, 3, 17 + ld a, $41 + ld b, $0D + +.loop + ld [hli], a + inc a + dec b + jr nz, .loop + ret + +SRAMClearMenu:: ; 61C6 + call ClearTileMap + call GetMemSGBLayout + call LoadFont + call LoadFontExtra + ld hl, SRAMClear_TextMsg1 + call PrintText ; E70 + ld hl, SRAMClear_WinPOS + call CopyMenuHeader ; 1D50 + call VerticalMenu ; 1D87 + jp c, Init + ld a, [wMenuCursorY] ; CC2A + cp $01 + jp z, Init + + callfar InitAllSRAMBanks, $05 + jp Init + +SRAMClear_TextMsg1:: +db "すべての セーブデータエりアを" +db "クりア しますか?" + +SRAMClear_WinPOS:: +db 0 +db 7,14,11,19 +dw SRAMClear_TextChoice ; menu data +db 1 ; default option + +SRAMClear_TextChoice:: +db %11000000 +db 2 +db "いいえ@" +db "はい@" + +IntroCopyRightInfo:: ; 6223 + call ClearTileMap + call LoadFontExtra + ld de, TitleScreenGFX + ld hl, $9600 + lb bc, BANK(TitleScreenGFX), $19 + call CopyVideoData + + 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}" + +Set_HoOh:: ; 6264 + coord hl, 7, 9 + ld de, $000D + ld a, $00 + ld b, $07 +.loop + ld c, $07 +.loop2 + ld [hli], a + inc a + dec c + jr nz, .loop2 + add hl, de + dec b + jr nz, .loop + ret + +; Unused code, looks like it sets the font type for the logo? +SetTitleFont:: ; 627A + ld de, $8800 + ld hl, TitleScreenLogoGFX + ld bc, 130 tiles + ld a, $04 + jp FarCopyDataDouble ; 0D3E + +; Sets the type of art that will be displayed on the title screen +; depending on wTitleSequenceOpeningType. +SetTitleGfx:: ;6288 + ld hl, wTitleSequenceOpeningType ; CC38 + ld a, [hl] + xor $01 + ld [hl], a + jr nz, .flame + +.note + ld hl, TitleNotesGFX + jr SetTitleGfxNext + +.flame + ld hl, TitleFireGFX +SetTitleGfxNext:: + ld de, $8000 + ld c, $80 +.loop + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .loop + ret if DEBUG SECTION "Title screen TEMPORARY", ROMX[$62A5],BANK[1] ; TODO: merge this with the main section above else SECTION "Title screen TEMPORARY", ROMX[$62A2],BANK[1] ; TODO: merge this with the main section above endc + -GameInit:: ; 62a5 +GameInit:: ; 62A5 call ClearWindowData ld a, $23 ld [wce5f], a - jp IntroSequence + jp IntroSequence \ No newline at end of file diff --git a/gfx.asm b/gfx.asm index fdd576b..33c37b9 100644 --- a/gfx.asm +++ b/gfx.asm @@ -1,11 +1,5 @@ INCLUDE "constants.asm" -SECTION "Title Screen Sprites", ROMX[$5EB8], BANK[$01] -TitleFireGFX:: -INCBIN "gfx/title/fire.2bpp" -TitleNotesGFX:: -INCBIN "gfx/title/notes.2bpp" - SECTION "Mon Nest Icon", ROMX[$4A0F], BANK[$02] PokedexNestIconGFX:: INCBIN "gfx/pokegear/dexmap_nest_icon.1bpp" @@ -25,6 +19,10 @@ SECTION "Pokegear GFX", ROMX[$4F32], BANK[$02] PokegearGFX:: INCBIN "gfx/pokegear/pokegear.2bpp" +SECTION "Title Screen BG Decoration Border", ROMX[$51FB], BANK[$02] +TitleBGDecorationBorder:: +INCBIN "gfx/title/titlebgdecoration.2bpp" + SECTION "Super Palettes", ROMX[$5B4C], BANK[$02] INCLUDE "data/pokemon/palettes.inc" INCLUDE "data/super_palettes.inc" @@ -42,11 +40,18 @@ INCBIN "gfx/sgb/sgb_border_silver.2bpp" endc SECTION "Title Screen GFX", ROMX[$47CF], BANK[$04] -TitleScreenGFX:: if def(GOLD) -INCBIN "gfx/title/title_gold.2bpp" +TitleScreenGFX:: INCBIN "gfx/title/title.2bpp" +TitleScreenVersionGFX:: INCBIN "gfx/title/title_gold_version.2bpp" +TitleScreenHoOhGFX:: INCBIN "gfx/title/title_hooh.2bpp" +TitleScreenLogoGFX:: INCBIN "gfx/title/title_logo.2bpp" +TitleScreenGoldLogoGFX:: INCBIN "gfx/title/title_goldlogo.2bpp" else -INCBIN "gfx/title/title_silver.2bpp" +TitleScreenGFX:: INCBIN "gfx/title/title.2bpp" +TitleScreenVersionGFX:: INCBIN "gfx/title/title_silver_version.2bpp" +TitleScreenHoOhGFX:: INCBIN "gfx/title/title_hooh.2bpp" +TitleScreenLogoGFX:: INCBIN "gfx/title/title_logo.2bpp" +TitleScreenGoldLogoGFX:: INCBIN "gfx/title/title_silverlogo.2bpp" endc SECTION "Mail Icon GFX", ROMX[$5BB1], BANK[$04] @@ -58,7 +63,7 @@ TrainerCardGFX:: INCBIN "gfx/trainer_card/trainer_card.2bpp" TrainerCardColonGFX:: INCBIN "gfx/trainer_card/colon.2bpp" ; 0x013381--0x013391 TrainerCardIDNoGFX:: INCBIN "gfx/trainer_card/id_no.2bpp" ; 0x013391--0x0133B1 TrainerCardIDNoGFXEnd:: -TrainerCardLeadersGFX:: INCBIN "gfx/trainer_card/leaders.2bpp" ; 0x0133B1--0x013BA1 +TrainerCardLeadersGFX:: INCBIN "gfx/trainer_card/leaders.2bpp" ; 0x0133B1--0x133BA1 if DEBUG || def(GOLD) db $18, $00 ; leftover of previous graphics else diff --git a/gfx/title/title.png b/gfx/title/title.png new file mode 100644 index 0000000..58a8274 Binary files /dev/null and b/gfx/title/title.png differ diff --git a/gfx/title/title_gold_version.png b/gfx/title/title_gold_version.png new file mode 100644 index 0000000..e55f741 Binary files /dev/null and b/gfx/title/title_gold_version.png differ diff --git a/gfx/title/title_goldlogo.png b/gfx/title/title_goldlogo.png new file mode 100644 index 0000000..cb6b12d Binary files /dev/null and b/gfx/title/title_goldlogo.png differ diff --git a/gfx/title/title_hooh.png b/gfx/title/title_hooh.png new file mode 100644 index 0000000..c24e79b Binary files /dev/null and b/gfx/title/title_hooh.png differ diff --git a/gfx/title/title_logo.png b/gfx/title/title_logo.png new file mode 100644 index 0000000..79a7184 Binary files /dev/null and b/gfx/title/title_logo.png differ diff --git a/gfx/title/title_silver_version.png b/gfx/title/title_silver_version.png new file mode 100644 index 0000000..2d6d8d0 Binary files /dev/null and b/gfx/title/title_silver_version.png differ diff --git a/gfx/title/title_silverlogo.png b/gfx/title/title_silverlogo.png new file mode 100644 index 0000000..ffeda09 Binary files /dev/null and b/gfx/title/title_silverlogo.png differ diff --git a/gfx/title/titlebgdecoration.png b/gfx/title/titlebgdecoration.png new file mode 100644 index 0000000..c57bdd4 Binary files /dev/null and b/gfx/title/titlebgdecoration.png differ diff --git a/home/init.asm b/home/init.asm index ef4b745..d8ae530 100644 --- a/home/init.asm +++ b/home/init.asm @@ -40,7 +40,7 @@ Init: ; 052f ld [rOBP1], a ld [rTMA], a ld [rTAC], a - ld [wcc38], a ; Useless, since WRAM gets cleared right after + ld [wTitleSequenceOpeningType], a ; Useless, since WRAM gets cleared right after ld a, 1 << rTAC_ON | rTAC_4096_HZ ld [rTAC], a ld a, 1 << rLCDC_ENABLE diff --git a/shim.sym b/shim.sym index f05010d..91ff32e 100644 --- a/shim.sym +++ b/shim.sym @@ -1,22 +1,27 @@ -00:032B UpdateTimeOfDayPalettes +00:032b UpdateTimeOfDayPalettes +00:033a ResetPalette 00:0436 RTC 00:051C Reset -00:0D0A LoadFont 00:0D1A LoadFontExtra +00:0d0a LoadFont 00:0E2A ClearTileMap -00:0E3D DrawTextBox +00:0e3d DrawTextBox +00:0e70 PrintText 00:0E93 PlaceString 00:0E94 PlaceNextChar 00:0E9D CheckDict -00:1D49 LoadMenuHeader -00:1E58 OpenMenu +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:20ff RunMapScript +00:232c LoadMapWarp +00:23e5 OverworldFadeIn 00:2C05 StartMenuCheck 00:3270 Random +00:361E ClearPalettesAndWait 00:3621 WaitBGMap 00:362B SetPalettes 00:3634 ClearPalettes @@ -27,6 +32,7 @@ 00:36C8 NamesPointers 00:36E0 GetName 00:39BA PlayCry +00:3CA8 InitSpriteAnimStruct 00:3D86 WaitSFX 00:3D87 WaitSFX.wait 00:3DA5 MaxVolume @@ -38,29 +44,30 @@ 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:53CC MainMenu +01:4031 DebugMenu +01:53cc MainMenu 01:5D27 Function_5d27 -01:6114 TitleScreenInputAndTimeout 01:6445 Function_6445 01:66B1 Function_66b1 01:6713 Function_6713 02:4786 Function_8786 02:4856 DecompTownMapTilemap -02:48DA DecompTownMapTilemap.tilemap -02:4C7C DrawMap -02:4DC2 TownMapGfx +02:48da DecompTownMapTilemap.tilemap ; compressed +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 @@ -85,9 +92,10 @@ 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:43B6 InitAllSRAMBanks 05:43E0 Function_143e0 05:457A Function_1457a 05:45B8 Function_145b8 @@ -97,9 +105,9 @@ 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 @@ -140,7 +148,9 @@ 23:44BE Function_8c4be 23:4940 Function_8c940 23:49C6 Function_8c9c6 -23:60CC MenuMonIconGfx +23:4CFD InitEffectObject +23:4d13 EffectObjectJumpNoDelay +23:60cc MenuMonIconGfx 24:4000 SetClockDialog 24:4239 SlotMachineGame 32:4000 Function_c8000 @@ -150,13 +160,9 @@ 33:4000 Function_cc000 33:4000 Function_cc000_2 33:4001 Function_cc001 -3A:4307 Function_e8307 -3A:4352 Function_e8352 -3A:441D Function_e841d -3A:45D8 Function_e85d8 -3A:47F9 Function_e87f9 -3A:4839 Function_e8839 -3A:484F Function_e884f +38:4000 PikachuMiniGame +39:4000 GameFreakIntro +39:432F OpeningCutscene 3A:4D9D _PlayCryHeader 3A:4E22 _PlaySFX 3A:4F11 LoadChannel @@ -164,27 +170,27 @@ 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: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:cdbe wTargetMapUnk +00:cdbf wTargetMapGroup +00:cdc0 wTargetMapId +00:ce67 wPlayerName +01:d165 wTMCounts +01:d19e wItems +01:d258 wRivalName 01:D264 wPlayerBikeSurfState -01:D656 wMapGroup -01:D657 wMapId -01:D66A wMapScriptPtr +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 5d09b77..78a74df 100644 --- a/wram.asm +++ b/wram.asm @@ -17,43 +17,46 @@ wChannel6:: channel_struct wChannel6 ; c0fa wChannel7:: channel_struct wChannel7 ; c12c wChannel8:: channel_struct wChannel8 ; c15e - ds 1 ; c190 + ds 8 ; TODO -wCurTrackDuty:: db ; c191 -wCurTrackIntensity:: db ; c192 -wCurTrackFrequency:: dw ; c193 -wc195:: db ; c195 - - ds 2 ; TODO +wCurChannel:: ; c198 + db -wCurChannel:: db ; c198 -wVolume:: db ; c199 -wSoundOutput:: db ; c19a +wVolume:: ; c199 + db - ds 1 ; TODO + ds 2 ; TODO -wMusicID:: dw ; c19c -wMusicBank:: db ; c19e +wMusicID:: ; c19c + dw +wMusicBank:: ; c19e + db + ds 6 ; TODO + +wSoundFade:: ; c1a5 + db + + ds 1 -wMusicFade:: ; c1a5 -; fades volume over x frames -; bit 7: fade in/out -; bit 0-6: number of frames for each volume level -; $00 = none (default) +wNextBGM:: ; c1a7 db -wMusicFadeCount:: db ; c1a6 -wMusicFadeID:: dw ; c1a7 + + ds 5 + +wMapMusic:: ; c1ad + db - ds 4 ; TODO +wCryPitch:: ; c1ae + dw -wMapMusic:: db ; c1ad -wCryPitch:: dw ; c1ae -wCryLength:: dw ; c1b0 +wCryLength:: ; c1b0 + dw ds 10 ; TODO + ; either wChannelsEnd or wMusicEnd, unsure wMusicInitEnd:: ; c1bc @@ -110,6 +113,9 @@ SECTION "CB56", WRAM0[$CB5B] wcb5b:: ds 1 ; multipurpose, also wName, wMonDexIndex2 wNameCategory:: ds 1 +SECTION "CB5E", WRAM0[$CB5E] +wJumptableIndex:: ds 4 + SECTION "CB62", WRAM0[$CB62] wVBCopySize:: ds 1 ; cb62 @@ -149,7 +155,8 @@ wVBlankOccurred: db ; cc33 ds 4 -wcc38:: ; cc38 ; TODO: wceeb in pokegold, what is this? +;Controls what type of opening (fire/notes) you get. +wTitleSequenceOpeningType:: ; cc38 db wDebugWarpSelection:: ; cc39 -- cgit v1.2.3 From 0866f63f444d58f53cc53624778737a2d48119bc Mon Sep 17 00:00:00 2001 From: ehw Date: Mon, 4 Jun 2018 01:01:20 -0400 Subject: Update wram.asm and title.asm for new sound findings --- engine/title.asm | 8 ++++---- wram.asm | 51 ++++++++++++++++++++++++--------------------------- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/engine/title.asm b/engine/title.asm index e141096..097a585 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -445,14 +445,14 @@ endc ld hl, wJumptableIndex inc [hl] xor a - ld [wNextBGM], a ; C1A7 - ld [wNextBGM + 1], a - ld hl, wSoundFade ; C1A5 + ld [wMusicFadeID], a ; C1A7 + ld [wMusicFadeID + 1], a + ld hl, wMusicFade ; C1A5 ld [hl], 8 ret TitleSeq_FadeMusicOut:: ; 615C - ld a, [wSoundFade] + ld a, [wMusicFade] and a ret nz ld a, 3 diff --git a/wram.asm b/wram.asm index 78a74df..123c4eb 100644 --- a/wram.asm +++ b/wram.asm @@ -17,46 +17,43 @@ wChannel6:: channel_struct wChannel6 ; c0fa wChannel7:: channel_struct wChannel7 ; c12c wChannel8:: channel_struct wChannel8 ; c15e - ds 8 ; TODO + ds 1 ; c190 -wCurChannel:: ; c198 - db +wCurTrackDuty:: db ; c191 +wCurTrackIntensity:: db ; c192 +wCurTrackFrequency:: dw ; c193 +wc195:: db ; c195 -wVolume:: ; c199 - db + ds 2 ; TODO - ds 2 ; TODO +wCurChannel:: db ; c198 +wVolume:: db ; c199 +wSoundOutput:: db ; c19a -wMusicID:: ; c19c - dw + ds 1 ; TODO + +wMusicID:: dw ; c19c +wMusicBank:: db ; c19e -wMusicBank:: ; c19e - db - ds 6 ; TODO - -wSoundFade:: ; c1a5 - db - - ds 1 -wNextBGM:: ; c1a7 +wMusicFade:: ; c1a5 +; fades volume over x frames +; bit 7: fade in/out +; bit 0-6: number of frames for each volume level +; $00 = none (default) db - - ds 5 - -wMapMusic:: ; c1ad - db +wMusicFadeCount:: db ; c1a6 +wMusicFadeID:: dw ; c1a7 -wCryPitch:: ; c1ae - dw + ds 4 ; TODO -wCryLength:: ; c1b0 - dw +wMapMusic:: db ; c1ad +wCryPitch:: dw ; c1ae +wCryLength:: dw ; c1b0 ds 10 ; TODO - ; either wChannelsEnd or wMusicEnd, unsure wMusicInitEnd:: ; c1bc -- cgit v1.2.3 From fe9290283ff906b75c26fd7a5d3de793241e308d Mon Sep 17 00:00:00 2001 From: ehw Date: Mon, 4 Jun 2018 19:12:09 -0400 Subject: Update files --- Makefile | 3 +- engine/title.asm | 214 ++++++++++++++++++++--------------------- shim.sym | 101 ++++++++++++++------ wram.asm | 286 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 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 "すべての セーブデータエりアを" -db "クりア しますか?" +SRAMClear_Message:: + db "すべての セーブデータエりアを" + db "クりア しますか?" 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 -- cgit v1.2.3 From b18ab8b2b7b8a1d945c909b78afa45a3dd2f7560 Mon Sep 17 00:00:00 2001 From: ehw Date: Mon, 4 Jun 2018 19:13:48 -0400 Subject: Add files via upload --- shim.sym | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/shim.sym b/shim.sym index 8748ec0..92bda27 100644 --- a/shim.sym +++ b/shim.sym @@ -1,6 +1,5 @@ ; ROM0 00:032b UpdateTimeOfDayPalettes -00:033a ResetPalette 00:0436 UpdateTime 00:051C Reset 00:0D0A LoadFont @@ -8,7 +7,6 @@ 00:0E18 ClearBox 00:0E2A ClearTileMap 00:0E3D DrawTextBox -00:0e70 PrintText 00:0E93 PlaceString 00:0E94 PlaceNextChar 00:0E9D CheckDict @@ -16,8 +14,6 @@ 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 @@ -27,7 +23,6 @@ 00:23e5 FadeIn ; This is not OverworldFadeIn, but I don't know what it is 00:2C05 StartMenuCheck 00:3270 Random -00:361E ClearPalettesAndWait 00:3621 WaitBGMap 00:362B SetPalettes 00:3634 ClearPalettes @@ -38,7 +33,6 @@ 00:36C8 NamesPointers 00:36E0 GetName 00:39BA PlayCry -00:3CA8 InitSpriteAnimStruct 00:3D86 WaitSFX 00:3D87 WaitSFX.wait 00:3DA5 MaxVolume @@ -58,9 +52,9 @@ 01:4031 Function_4031 -01:4031 DebugMenu 01:53CC MainMenu 01:5D27 Function_5d27 +01:6114 TitleScreenInputAndTimeout 01:6445 Function_6445 01:66B1 Function_66b1 01:6713 Function_6713 @@ -72,7 +66,6 @@ 02:4C7C DrawMap 02:4DC2 TownMapGfx 02:4F32 PokegearRadioGfx -02:51D2 SetTitleBGDecorationBorder 02:528B Function_928b 02:5695 CheckSGB @@ -114,7 +107,6 @@ 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 @@ -184,8 +176,6 @@ 23:44BE Function_8c4be 23:4940 Function_8c940 23:49C6 Function_8c9c6 -23:4CFD InitEffectObject -23:4d13 EffectObjectJumpNoDelay 23:60cc MenuMonIconGfx 24:4000 SetClockDialog @@ -199,9 +189,6 @@ 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 -- cgit v1.2.3 From 68b9e892760994170de072c06d630ead7fc3f538 Mon Sep 17 00:00:00 2001 From: ehw Date: Mon, 4 Jun 2018 19:17:55 -0400 Subject: Remove some tabs --- engine/title.asm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/engine/title.asm b/engine/title.asm index dbc6f7f..868ae1c 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -414,7 +414,7 @@ TitleSeq_TitleScreenInputAndTimeout:: cp D_UP | B_BUTTON | SELECT jr z, .psbtn_sramclear ld a, [hl] - and SELECT ; SELECT will bring you to the debug menu. + and SELECT ; SELECT will bring you to the debug menu. jr nz, .psbtn_gotodebug ld a, [hl] and $09 @@ -579,9 +579,9 @@ IntroCopyRightInfo:: jp PlaceString 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}" + 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:: coord hl, 7, 9 @@ -646,5 +646,3 @@ GameInit:: ld a, $23 ld [wce5f], a jp IntroSequence - - \ No newline at end of file -- cgit v1.2.3 From 7029ed45567c009dbc5625b85b28bb07cefa5441 Mon Sep 17 00:00:00 2001 From: ehw Date: Mon, 4 Jun 2018 19:28:36 -0400 Subject: Add newline to end of file --- engine/title.asm | 1 + 1 file changed, 1 insertion(+) diff --git a/engine/title.asm b/engine/title.asm index 868ae1c..43580ea 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -646,3 +646,4 @@ GameInit:: ld a, $23 ld [wce5f], a jp IntroSequence + -- cgit v1.2.3 From 9fb15b41e9d56e49a2535001ae298a2a516568b0 Mon Sep 17 00:00:00 2001 From: ehw Date: Mon, 4 Jun 2018 22:42:05 -0400 Subject: Farcall/callfar is now callba/callab, leave bank numbers in comments. --- engine/title.asm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/engine/title.asm b/engine/title.asm index 43580ea..95af12c 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -4,22 +4,22 @@ INCLUDE "vram.asm" SECTION "Title screen", ROMX[$5D8C], BANK[$01] IntroSequence:: - callfar GameFreakIntro, $39 + callab GameFreakIntro;, $39 jr c, TitleSequenceStart ld a, [wTitleSequenceOpeningType] and a jr z, .opening_sequence .pikachu_minigame - callfar PikachuMiniGame, $38 + callab PikachuMiniGame;, $38 jr TitleSequenceStart .opening_sequence - callfar OpeningCutscene, $39 + callab OpeningCutscene;, $39 TitleSequenceStart:: call TitleSequenceInit - callfar SetTitleBGDecorationBorder, $02 + callab SetTitleBGDecorationBorder;, $02 .loop call TitleScreenMain @@ -65,9 +65,10 @@ TitleSequenceInit:: call DisableLCD call ClearSprites - ld a, $23 - ld hl, InitEffectObject - call FarCall_hl + ;ld a, $23 + ;ld hl, InitEffectObject + ;call FarCall_hl + callba InitEffectObject ld hl, vChars0 ld bc, vBGMap0 - vChars0 @@ -179,9 +180,10 @@ TitleScreenMain:: bit 7, a jr nz, .exit call TitleScreenSequence - ld a, $23 - ld hl, EffectObjectJumpNoDelay - call FarCall_hl + ;ld a, $23 + ;ld hl, EffectObjectJumpNoDelay + ;call FarCall_hl + callba EffectObjectJumpNoDelay call DelayFrame and a ret @@ -547,7 +549,7 @@ SRAMClearMenu:: cp $01 jp z, Init - callfar InitAllSRAMBanks, $05 + callab InitAllSRAMBanks;, $05 jp Init SRAMClear_Message:: @@ -646,4 +648,3 @@ GameInit:: ld a, $23 ld [wce5f], a jp IntroSequence - -- cgit v1.2.3 From 771d125c7564a0ff1e511733114d53ad0521c3f8 Mon Sep 17 00:00:00 2001 From: ehw Date: Mon, 4 Jun 2018 22:43:32 -0400 Subject: Upload more correct version of last commit. Uploaded old version from offline fork by accident. --- engine/title.asm | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/engine/title.asm b/engine/title.asm index 95af12c..432c9c1 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -4,22 +4,22 @@ INCLUDE "vram.asm" SECTION "Title screen", ROMX[$5D8C], BANK[$01] IntroSequence:: - callab GameFreakIntro;, $39 + callab GameFreakIntro ; Bank $39 jr c, TitleSequenceStart ld a, [wTitleSequenceOpeningType] and a jr z, .opening_sequence .pikachu_minigame - callab PikachuMiniGame;, $38 + callab PikachuMiniGame ; Bank $38 jr TitleSequenceStart .opening_sequence - callab OpeningCutscene;, $39 + callab OpeningCutscene ; Bank $39 TitleSequenceStart:: call TitleSequenceInit - callab SetTitleBGDecorationBorder;, $02 + callab SetTitleBGDecorationBorder ; Bank $02 .loop call TitleScreenMain @@ -65,10 +65,7 @@ TitleSequenceInit:: call DisableLCD call ClearSprites - ;ld a, $23 - ;ld hl, InitEffectObject - ;call FarCall_hl - callba InitEffectObject + callba InitEffectObject ; Bank $23 ld hl, vChars0 ld bc, vBGMap0 - vChars0 @@ -180,10 +177,7 @@ TitleScreenMain:: bit 7, a jr nz, .exit call TitleScreenSequence - ;ld a, $23 - ;ld hl, EffectObjectJumpNoDelay - ;call FarCall_hl - callba EffectObjectJumpNoDelay + callba EffectObjectJumpNoDelay ; Bank $23 call DelayFrame and a ret @@ -549,7 +543,7 @@ SRAMClearMenu:: cp $01 jp z, Init - callab InitAllSRAMBanks;, $05 + callab InitAllSRAMBanks ; Bank $05 jp Init SRAMClear_Message:: -- cgit v1.2.3 From b3c6219cf11ff85f76f13eeb955e90c951cfe031 Mon Sep 17 00:00:00 2001 From: ehw Date: Sat, 9 Jun 2018 20:46:19 -0400 Subject: Update shim and title.asm include vram.asm no longer needed, some function name changes --- engine/title.asm | 4 ++-- shim.sym | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/engine/title.asm b/engine/title.asm index 432c9c1..a8ea9b9 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -1,5 +1,5 @@ INCLUDE "constants.asm" -INCLUDE "vram.asm" +; INCLUDE "vram.asm" SECTION "Title screen", ROMX[$5D8C], BANK[$01] @@ -30,7 +30,7 @@ TitleSequenceStart:: ld a, $01 ldh [hBGMapMode], a call ClearTileMap - call ResetPalette + call UpdateTimePals ld a, [wJumptableIndex + 1] ld e, a diff --git a/shim.sym b/shim.sym index ea38bfc..ee23de1 100644 --- a/shim.sym +++ b/shim.sym @@ -20,6 +20,7 @@ 00:2C05 StartMenuCheck 00:3171 Function3171 +00:361E ClearPalettesAndWait 00:3621 WaitBGMap 00:362B SetPalettes 00:3634 ClearPalettes @@ -28,6 +29,7 @@ 00:3648 SetHPPal 00:3655 SetHPPal.done 00:39BA PlayCry +00:3CA8 InitSpriteAnimStruct 00:3D86 WaitSFX 00:3D87 WaitSFX.wait 00:3DA5 MaxVolume @@ -47,10 +49,10 @@ 01:4031 Function4031 +01:4031 DebugMenu 01:5190 _UpdateSprites 01:53CC MainMenu 01:5D27 Function5d27 -01:6114 TitleScreenInputAndTimeout 01:63D8 ReanchorBGMap_NoOAMUpdate 01:6437 LoadFonts_NoOAMUpdate 01:6445 Function6445 @@ -66,6 +68,7 @@ 02:4C7C DrawMap 02:4DC2 TownMapGfx 02:4F32 PokegearRadioGfx +02:51D2 SetTitleBGDecorationBorder 02:528B Function928b 02:5695 CheckSGB @@ -107,6 +110,7 @@ 05:405B AddIndoorSprites 05:40AA AddOutdoorSprites 05:40FB LoadUsedSpritesGfx ; TODO: maybe there's a better name +05:43B6 InitAllSRAMBanks 05:43E0 Function143e0 05:457A Function1457a 05:45B8 Function145b8 @@ -180,7 +184,9 @@ 23:44BE Function8c4be 23:4940 Function8c940 23:49C6 Function8c9c6 -23:60CC MenuMonIconGfx +23:4CFD InitEffectObject +23:4d13 EffectObjectJumpNoDelay +23:60cc MenuMonIconGfx 24:4000 SetClockDialog 24:4239 SlotMachineGame @@ -429,7 +435,9 @@ 36:73E8 MtFujiRoute_MapAttributes 36:7444 FontoRoute5_MapAttributes 36:7530 BullForestRoute3_MapAttributes - +38:4000 PikachuMiniGame +39:4000 GameFreakIntro +39:432F OpeningCutscene 3A:441D Functione841d 3A:45D8 Functione85d8 3A:47F9 Functione87f9 -- cgit v1.2.3 From 91704c148dcfcec0b4e931d309254ba7d97d1dbd Mon Sep 17 00:00:00 2001 From: ehw Date: Sat, 9 Jun 2018 23:32:21 -0400 Subject: Actually remove the include for vram.asm... --- engine/title.asm | 1 - 1 file changed, 1 deletion(-) diff --git a/engine/title.asm b/engine/title.asm index a8ea9b9..e90bafc 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -1,5 +1,4 @@ INCLUDE "constants.asm" -; INCLUDE "vram.asm" SECTION "Title screen", ROMX[$5D8C], BANK[$01] -- cgit v1.2.3