Disassemble the BLUEMONS.GB debug ROM

This commit is contained in:
Rangi 2020-07-15 13:35:39 -04:00
parent 87f24a885d
commit 4b4ad9894e
25 changed files with 364 additions and 81 deletions

115
engine/debug/debug_menu.asm Normal file
View file

@ -0,0 +1,115 @@
DebugMenu:
IF DEF(_DEBUG)
call ClearScreen
ld hl, DebugPlayerName
ld de, wPlayerName
ld bc, NAME_LENGTH
call CopyData
ld hl, DebugRivalName
ld de, wRivalName
ld bc, NAME_LENGTH
call CopyData
call LoadFontTilePatterns
call LoadHpBarAndStatusTilePatterns
call ClearSprites
call RunDefaultPaletteCommand
hlcoord 5, 6
ld b, 3
ld c, 9
call TextBoxBorder
hlcoord 7, 7
ld de, DebugMenuOptions
call PlaceString
ld a, 3 ; medium speed
ld [wOptions], a
ld a, A_BUTTON | B_BUTTON | START
ld [wMenuWatchedKeys], a
xor a
ld [wMenuJoypadPollCount], a
inc a
ld [wMaxMenuItem], a
ld a, 7
ld [wTopMenuItemY], a
dec a
ld [wTopMenuItemX], a
xor a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
ld [wMenuWatchMovingOutOfBounds], a
call HandleMenuInput
bit BIT_B_BUTTON, a
jp nz, DisplayTitleScreen
ld a, [wCurrentMenuItem]
and a ; FIGHT?
jp z, TestBattle
; DEBUG
ld hl, wd732
set 1, [hl]
jp StartNewGameDebug
DebugPlayerName:
db "Tom@"
DebugRivalName:
db "Juerry@"
DebugMenuOptions:
db "FIGHT"
next "DEBUG@"
ELSE
ret
ENDC
TestBattle:
.loop
call GBPalNormal
; Don't mess around
; with obedience.
ld a, 1 << BIT_EARTHBADGE
ld [wObtainedBadges], a
ld hl, wFlags_D733
set BIT_TEST_BATTLE, [hl]
; Reset the party.
ld hl, wPartyCount
xor a
ld [hli], a
dec a
ld [hl], a
; Give the player a
; level 20 Rhydon.
ld a, RHYDON
ld [wcf91], a
ld a, 20
ld [wCurEnemyLVL], a
xor a
ld [wMonDataLocation], a
ld [wCurMap], a
call AddPartyMon
; Fight against a
; level 20 Rhydon.
ld a, RHYDON
ld [wCurOpponent], a
predef InitOpponent
; When the battle ends,
; do it all again.
ld a, 1
ld [wUpdateSpritesEnabled], a
ldh [hAutoBGTransferEnabled], a
jr .loop

View file

@ -1,5 +1,4 @@
; This function appears to never be used.
; It is likely a debugging feature to give the player Tsunekazu Ishihara's
; This function is a debugging feature to give the player Tsunekazu Ishihara's
; favorite Pokemon. This is indicated by the overpowered Exeggutor, which
; Ishihara (president of Creatures Inc.) said was his favorite Pokemon in an ABC
; interview on February 8, 2000.
@ -11,7 +10,7 @@ SetIshiharaTeam:
ld de, IshiharaTeam
.loop
ld a, [de]
cp $ff
cp -1
ret z
ld [wcf91], a
inc de
@ -22,12 +21,139 @@ SetIshiharaTeam:
jr .loop
IshiharaTeam:
db EXEGGUTOR,90
db MEW,20
db JOLTEON,56
db DUGTRIO,56
db ARTICUNO,57
db $FF
db EXEGGUTOR, 90
IF DEF(_DEBUG)
db MEW, 5
ELSE
db MEW, 20
ENDC
db JOLTEON, 56
db DUGTRIO, 56
db ARTICUNO, 57
IF DEF(_DEBUG)
db PIKACHU, 5
ENDC
db -1 ; end
DebugStart:
IF DEF(_DEBUG)
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
; Fly anywhere.
dec a ; $ff
ld [wTownVisitedFlag], a
ld [wTownVisitedFlag + 1], a
; Get all badges except Earth Badge.
ld a, $ff ^ (1 << BIT_EARTHBADGE)
ld [wObtainedBadges], a
call SetIshiharaTeam
; Exeggutor gets four HM moves.
ld hl, wPartyMon1Moves
ld a, FLY
ld [hli], a
ld a, CUT
ld [hli], a
ld a, SURF
ld [hli], a
ld a, STRENGTH
ld [hl], a
ld hl, wPartyMon1PP
ld a, 15
ld [hli], a
ld a, 30
ld [hli], a
ld a, 15
ld [hli], a
ld [hl], a
; Jolteon gets Thunderbolt.
ld hl, wPartyMon3Moves + 3
ld a, THUNDERBOLT
ld [hl], a
ld hl, wPartyMon3PP + 3
ld a, 15
ld [hl], a
; Articuno gets Fly.
ld hl, wPartyMon5Moves
ld a, FLY
ld [hl], a
ld hl, wPartyMon5PP
ld a, 15
ld [hl], a
; Pikachu gets Surf.
ld hl, wPartyMon6Moves + 2
ld a, SURF
ld [hl], a
ld hl, wPartyMon6PP + 2
ld a, 15
ld [hl], a
; Get some debug items.
ld hl, wNumBagItems
ld de, DebugItemsList
.items_loop
ld a, [de]
cp -1
jr z, .items_end
ld [wcf91], a
inc de
ld a, [de]
inc de
ld [wItemQuantity], a
call AddItemToInventory
jr .items_loop
.items_end
; Complete the Pokédex.
ld hl, wPokedexOwned
call DebugSetPokedexEntries
ld hl, wPokedexSeen
call DebugSetPokedexEntries
SetEvent EVENT_GOT_POKEDEX
; Rival chose Squirtle,
; Player chose Charmander.
ld hl, wRivalStarter
ld a, STARTER2
ld [hli], a
inc hl ; hl = wPlayerStarter
ld a, STARTER1
ld [hl], a
EmptyFunc:
ret
DebugSetPokedexEntries:
ld b, wPokedexOwnedEnd - wPokedexOwned - 1
ld a, %11111111
.loop
ld [hli], a
dec b
jr nz, .loop
ld [hl], %01111111
ret
DebugItemsList:
db BICYCLE, 1
db FULL_RESTORE, 99
db FULL_HEAL, 99
db ESCAPE_ROPE, 99
db RARE_CANDY, 99
db MASTER_BALL, 99
db TOWN_MAP, 1
db SECRET_KEY, 1
db CARD_KEY, 1
db S_S_TICKET, 1
db LIFT_KEY, 1
db -1 ; end
DebugUnusedList:
db -1 ; end
ELSE
ret
ENDC

View file

@ -1,45 +0,0 @@
TestBattle:
ret
.loop
call GBPalNormal
; Don't mess around
; with obedience.
ld a, 1 << BIT_EARTHBADGE
ld [wObtainedBadges], a
ld hl, wFlags_D733
set BIT_TEST_BATTLE, [hl]
; Reset the party.
ld hl, wPartyCount
xor a
ld [hli], a
dec a
ld [hl], a
; Give the player a
; level 20 Rhydon.
ld a, RHYDON
ld [wcf91], a
ld a, 20
ld [wCurEnemyLVL], a
xor a
ld [wMonDataLocation], a
ld [wCurMap], a
call AddPartyMon
; Fight against a
; level 20 Rhydon.
ld a, RHYDON
ld [wCurOpponent], a
predef InitOpponent
; When the battle ends,
; do it all again.
ld a, 1
ld [wUpdateSpritesEnabled], a
ldh [hAutoBGTransferEnabled], a
jr .loop