diff options
| author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-11-04 15:16:20 -0500 |
|---|---|---|
| committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-11-04 19:44:31 -0500 |
| commit | aae999f72bd81a3156c7e00da4ebf499f52da5a6 (patch) | |
| tree | 32fef70a31af3a0b5ad2b0d34042c312574fb42d /home | |
| parent | Merge branch 'master' of https://github.com/pret/pokered (diff) | |
| download | pokeyellow-aae999f72bd81a3156c7e00da4ebf499f52da5a6.tar.gz pokeyellow-aae999f72bd81a3156c7e00da4ebf499f52da5a6.tar.xz pokeyellow-aae999f72bd81a3156c7e00da4ebf499f52da5a6.zip | |
Start reorganizing pokeyellow
Diffstat (limited to 'home')
| -rw-r--r-- | home/bankswitch2.asm | 39 | ||||
| -rw-r--r-- | home/cgb_palettes.asm | 81 | ||||
| -rw-r--r-- | home/copy2.asm | 5 | ||||
| -rw-r--r-- | home/init.asm | 2 | ||||
| -rw-r--r-- | home/lcdc.asm | 2 | ||||
| -rw-r--r-- | home/overworld.asm | 8 | ||||
| -rw-r--r-- | home/palettes.asm | 3 | ||||
| -rwxr-xr-x | home/pikachu.asm | 2 | ||||
| -rw-r--r-- | home/pikachu_cries.asm | 46 | ||||
| -rw-r--r-- | home/print_num.asm | 11 | ||||
| -rw-r--r-- | home/text_script.asm | 4 |
11 files changed, 196 insertions, 7 deletions
diff --git a/home/bankswitch2.asm b/home/bankswitch2.asm new file mode 100644 index 00000000..cc7169cd --- /dev/null +++ b/home/bankswitch2.asm @@ -0,0 +1,39 @@ +BankswitchCommon:: + ldh [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +Bankswitch:: +; self-contained bankswitch, use this when not in the home bank +; switches to the bank in b + ldh a, [hLoadedROMBank] + push af + ld a, b + ldh [hLoadedROMBank], a + ld [MBC1RomBank], a + call JumpToAddress + pop bc + ld a, b + ldh [hLoadedROMBank], a + ld [MBC1RomBank], a + ret +JumpToAddress:: + jp hl + +SwitchSRAMBankAndLatchClockData:: + push af + ld a, $1 + ld [MBC1SRamBankingMode], a + ld a, SRAM_ENABLE + ld [MBC1SRamEnable], a + pop af + ld [MBC1SRamBank], a + ret + +PrepareRTCDataAndDisableSRAM:: + push af + ld a, $0 + ld [MBC1SRamBankingMode], a + ld [MBC1SRamEnable], a + pop af + ret diff --git a/home/cgb_palettes.asm b/home/cgb_palettes.asm new file mode 100644 index 00000000..24738ae2 --- /dev/null +++ b/home/cgb_palettes.asm @@ -0,0 +1,81 @@ +UpdateGBCPal_BGP:: + push af + ldh a, [hGBC] + and a + jr z, .notGBC + push bc + push de + push hl + ldh a, [rBGP] + ld b, a + ld a, [wLastBGP] + cp b + jr z, .noChangeInBGP + farcall _UpdateGBCPal_BGP +.noChangeInBGP + pop hl + pop de + pop bc +.notGBC + pop af + ret + +UpdateGBCPal_OBP0:: + push af + ldh a, [hGBC] + and a + jr z, .notGBC + push bc + push de + push hl + ldh a, [rOBP0] + ld b, a + ld a, [wLastOBP0] + cp b + jr z, .noChangeInOBP0 + ld b, BANK(_UpdateGBCPal_OBP) + ld hl, _UpdateGBCPal_OBP + ld c, CONVERT_OBP0 + call Bankswitch +.noChangeInOBP0 + pop hl + pop de + pop bc +.notGBC + pop af + ret + +UpdateGBCPal_OBP1:: + push af + ldh a, [hGBC] + and a + jr z, .notGBC + push bc + push de + push hl + ldh a, [rOBP1] + ld b, a + ld a, [wLastOBP1] + cp b + jr z, .noChangeInOBP1 + ld b, BANK(_UpdateGBCPal_OBP) + ld hl, _UpdateGBCPal_OBP + ld c, CONVERT_OBP1 + call Bankswitch +.noChangeInOBP1 + pop hl + pop de + pop bc +.notGBC + pop af + ret + +Func_3082:: + ldh a, [hLoadedROMBank] + push af + call FadeOutAudio + callbs Music_DoLowHealthAlarm + callbs Audio1_UpdateMusic + pop af + call BankswitchCommon + ret diff --git a/home/copy2.asm b/home/copy2.asm index bff26570..6245ad5d 100644 --- a/home/copy2.asm +++ b/home/copy2.asm @@ -1,3 +1,8 @@ +IsTilePassable:: +; sets carry if tile is passable, resets carry otherwise + homecall_sf _IsTilePassable + ret + FarCopyDataDouble:: ; Expand bc bytes of 1bpp image data ; from a:de to 2bpp data at hl. diff --git a/home/init.asm b/home/init.asm index 878f329a..331a3657 100644 --- a/home/init.asm +++ b/home/init.asm @@ -128,7 +128,7 @@ ClearVram:: StopAllSounds:: - ld a, BANK(AudioEngine1) + ld a, BANK("Audio Engine 1") ld [wAudioROMBank], a ld [wAudioSavedROMBank], a xor a diff --git a/home/lcdc.asm b/home/lcdc.asm index dd3fb2fb..4b350cc2 100644 --- a/home/lcdc.asm +++ b/home/lcdc.asm @@ -7,7 +7,7 @@ LCDC:: ; [C700 + [rLY]] --> [FF00 + [hLCDCPointer]] ldh a, [rLY] ld l, a - ld h, wLYOverrides / $100 + ld h, HIGH(wLYOverrides) ld h, [hl] ; h != not part of pointer ldh a, [hLCDCPointer] ld l, a diff --git a/home/overworld.asm b/home/overworld.asm index 0cd63cf7..2909b01e 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1801,7 +1801,7 @@ LoadMapHeader:: jr asm_0dbd Func_0db5:: ; XXX - farcall LoadUnusedBluesHouseMissableObjectData + farcall LoadMissableObjectData asm_0dbd: ld a, [wCurMapTileset] ld [wUnusedD119], a @@ -2009,7 +2009,7 @@ ReloadMapAfterSurfingMinigame:: call ReloadMapSpriteTilePatterns pop af call BankswitchCommon - jr asm_0f4d + jr FinishReloadingMap ReloadMapAfterPrinter:: ldh a, [hLoadedROMBank] @@ -2019,9 +2019,9 @@ ReloadMapAfterPrinter:: call LoadTileBlockMap pop af call BankswitchCommon -asm_0f4d: +FinishReloadingMap: jpfar SetMapSpecificScriptFlagsOnMapReload - ret ; useless? + ret ; useless ResetMapVariables:: ld a, $98 diff --git a/home/palettes.asm b/home/palettes.asm index 3b944a03..af66e74b 100644 --- a/home/palettes.asm +++ b/home/palettes.asm @@ -1,3 +1,6 @@ +InitMapSprites:: + jpfar _InitMapSprites + RestoreScreenTilesAndReloadTilePatterns:: call ClearSprites ld a, $1 diff --git a/home/pikachu.asm b/home/pikachu.asm index c276b3d4..c9c94635 100755 --- a/home/pikachu.asm +++ b/home/pikachu.asm @@ -56,7 +56,7 @@ SpawnPikachu:: dec a swap a ldh [hTilePlayerStandingOn], a - homecall SpawnPikachu_ ; 3f:46d5 + homecall SpawnPikachu_ ret Pikachu_IsInArray:: diff --git a/home/pikachu_cries.asm b/home/pikachu_cries.asm new file mode 100644 index 00000000..84889ef9 --- /dev/null +++ b/home/pikachu_cries.asm @@ -0,0 +1,46 @@ +PlayPikachuPCM:: + ldh a, [hLoadedROMBank] + push af + ld a, b + call BankswitchCommon + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a +.loop + ld a, [hli] + ld d, a + ld a, $3 +.playSingleSample + dec a + jr nz, .playSingleSample + +REPT 7 + call LoadNextSoundClipSample + call PlaySoundClipSample +ENDR + + call LoadNextSoundClipSample + dec bc + ld a, c + or b + jr nz, .loop + pop af + call BankswitchCommon + ret + +LoadNextSoundClipSample:: + ld a, d + and $80 + srl a + srl a + ldh [rNR32], a + sla d + ret + +PlaySoundClipSample:: + ld a, $3 +.loop + dec a + jr nz, .loop + ret diff --git a/home/print_num.asm b/home/print_num.asm index e2628b1f..d86527a6 100644 --- a/home/print_num.asm +++ b/home/print_num.asm @@ -1,3 +1,14 @@ +FarPrintText:: +; print text b:hl at (1, 14) + ldh a, [hLoadedROMBank] + push af + ld a, b + call BankswitchCommon + call PrintText + pop af + call BankswitchCommon + ret + PrintNumber:: ; Print the c-digit, b-byte value at de. ; Allows 2 to 7 digits. For 1-digit numbers, add diff --git a/home/text_script.asm b/home/text_script.asm index 1847e23b..20cfb71d 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -1,3 +1,7 @@ +UnknownText_2812:: ; unreferenced + text_far _PokemonText + text_end + ; this function is used to display sign messages, sprite dialog, etc. ; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID DisplayTextID:: |
