Disassemble the final English debug ROM

This commit is contained in:
Rangi 2020-07-13 13:05:05 -04:00
parent 4fb0088440
commit e239aa4aba
25 changed files with 2054 additions and 36 deletions

View File

@ -1,4 +1,4 @@
roms := pokecrystal.gbc pokecrystal11.gbc pokecrystal-au.gbc roms := pokecrystal.gbc pokecrystal11.gbc pokecrystal-au.gbc pokecrystal-debug.gbc pokecrystal11-debug.gbc
crystal_obj := \ crystal_obj := \
audio.o \ audio.o \
@ -17,8 +17,10 @@ gfx/sprites.o \
gfx/tilesets.o \ gfx/tilesets.o \
lib/mobile/main.o lib/mobile/main.o
crystal11_obj := $(crystal_obj:.o=11.o) crystal11_obj := $(crystal_obj:.o=11.o)
crystal_au_obj := $(crystal_obj:.o=_au.o) crystal_au_obj := $(crystal_obj:.o=_au.o)
crystal_debug_obj := $(crystal_obj:.o=_debug.o)
crystal11_debug_obj := $(crystal_obj:.o=11_debug.o)
### Build tools ### Build tools
@ -39,24 +41,26 @@ RGBLINK ?= $(RGBDS)rgblink
### Build targets ### Build targets
.SUFFIXES: .SUFFIXES:
.PHONY: all crystal crystal11 crystal_au clean tidy compare tools .PHONY: all crystal crystal11 crystal-au crystal-debug crystal11-debug clean tidy compare tools
.SECONDEXPANSION: .SECONDEXPANSION:
.PRECIOUS: .PRECIOUS:
.SECONDARY: .SECONDARY:
all: crystal all: crystal
crystal: pokecrystal.gbc crystal: pokecrystal.gbc
crystal11: pokecrystal11.gbc crystal11: pokecrystal11.gbc
crystal-au: pokecrystal-au.gbc crystal-au: pokecrystal-au.gbc
crystal-debug: pokecrystal-debug.gbc
crystal11-debug: pokecrystal11-debug.gbc
clean: clean:
rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(crystal_au_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(crystal_au_obj) $(crystal_debug_obj) $(crystal11_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
find gfx \( -name "*.[12]bpp" -o -name "*.lz" -o -name "*.gbcpal" -o -name "*.sgb.tilemap" \) -delete find gfx \( -name "*.[12]bpp" -o -name "*.lz" -o -name "*.gbcpal" -o -name "*.sgb.tilemap" \) -delete
find gfx/pokemon -mindepth 1 ! -path "gfx/pokemon/unown/*" \( -name "bitmask.asm" -o -name "frames.asm" -o -name "front.animated.tilemap" -o -name "front.dimensions" \) -delete find gfx/pokemon -mindepth 1 ! -path "gfx/pokemon/unown/*" \( -name "bitmask.asm" -o -name "frames.asm" -o -name "front.animated.tilemap" -o -name "front.dimensions" \) -delete
$(MAKE) clean -C tools/ $(MAKE) clean -C tools/
tidy: tidy:
rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(crystal_au_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(crystal_au_obj) $(crystal_debug_obj) $(crystal11_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
$(MAKE) clean -C tools/ $(MAKE) clean -C tools/
compare: $(roms) compare: $(roms)
@ -72,9 +76,11 @@ ifeq ($(DEBUG),1)
RGBASMFLAGS += -E RGBASMFLAGS += -E
endif endif
$(crystal_obj): RGBASMFLAGS += $(crystal_obj): RGBASMFLAGS +=
$(crystal11_obj): RGBASMFLAGS += -D _CRYSTAL11 $(crystal11_obj): RGBASMFLAGS += -D _CRYSTAL11
$(crystal_au_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _CRYSTAL_AU $(crystal_au_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _CRYSTAL_AU
$(crystal_debug_obj): RGBASMFLAGS += -D _DEBUG
$(crystal11_debug_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _DEBUG
rgbdscheck.o: rgbdscheck.asm rgbdscheck.o: rgbdscheck.asm
$(RGBASM) -o $@ $< $(RGBASM) -o $@ $<
@ -93,9 +99,11 @@ ifeq (,$(filter clean tools,$(MAKECMDGOALS)))
$(info $(shell $(MAKE) -C tools)) $(info $(shell $(MAKE) -C tools))
$(foreach obj, $(crystal_au_obj), $(eval $(call DEP,$(obj),$(obj:_au.o=.asm))))
$(foreach obj, $(crystal11_obj), $(eval $(call DEP,$(obj),$(obj:11.o=.asm))))
$(foreach obj, $(crystal_obj), $(eval $(call DEP,$(obj),$(obj:.o=.asm)))) $(foreach obj, $(crystal_obj), $(eval $(call DEP,$(obj),$(obj:.o=.asm))))
$(foreach obj, $(crystal11_obj), $(eval $(call DEP,$(obj),$(obj:11.o=.asm))))
$(foreach obj, $(crystal_au_obj), $(eval $(call DEP,$(obj),$(obj:_au.o=.asm))))
$(foreach obj, $(crystal_debug_obj), $(eval $(call DEP,$(obj),$(obj:_debug.o=.asm))))
$(foreach obj, $(crystal11_debug_obj), $(eval $(call DEP,$(obj),$(obj:11_debug.o=.asm))))
endif endif
@ -112,6 +120,14 @@ pokecrystal-au.gbc: $(crystal_au_obj) layout.link
$(RGBLINK) -n pokecrystal-au.sym -m pokecrystal-au.map -l layout.link -p 0 -o $@ $(crystal_au_obj) $(RGBLINK) -n pokecrystal-au.sym -m pokecrystal-au.map -l layout.link -p 0 -o $@ $(crystal_au_obj)
$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTU -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@ $(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTU -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
pokecrystal-debug.gbc: $(crystal_debug_obj) layout.link
$(RGBLINK) -n pokecrystal-debug.sym -m pokecrystal-debug.map -l layout.link -p 0 -o $@ $(crystal_debug_obj)
$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
pokecrystal11-debug.gbc: $(crystal11_debug_obj) layout.link
$(RGBLINK) -n pokecrystal11-debug.sym -m pokecrystal11-debug.map -l layout.link -p 0 -o $@ $(crystal11_debug_obj)
$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
### LZ compression rules ### LZ compression rules

View File

@ -7,6 +7,8 @@ It builds the following ROMs:
- Pokemon - Crystal Version (UE) (V1.0) [C][!].gbc `sha1: f4cd194bdee0d04ca4eac29e09b8e4e9d818c133` - Pokemon - Crystal Version (UE) (V1.0) [C][!].gbc `sha1: f4cd194bdee0d04ca4eac29e09b8e4e9d818c133`
- Pokemon - Crystal Version (UE) (V1.1) [C][!].gbc `sha1: f2f52230b536214ef7c9924f483392993e226cfb` - Pokemon - Crystal Version (UE) (V1.1) [C][!].gbc `sha1: f2f52230b536214ef7c9924f483392993e226cfb`
- Pokemon - Crystal Version (A) [C][!].gbc `sha1: a0fc810f1d4e124434f7be2c989ab5b5892ddf36` - Pokemon - Crystal Version (A) [C][!].gbc `sha1: a0fc810f1d4e124434f7be2c989ab5b5892ddf36`
- CRYSTAL_ps3_010328d.bin `sha1: c60d57a24bbe8ecf7cba54ab3f90669f97bd330d`
- CRYSTAL_ps3_us_revise_010710d.bin `sha1: 391ae86b1d5a26db712ffe6c28bbf2a1f804c3c4`
To set up the repository, see [INSTALL.md](INSTALL.md). To set up the repository, see [INSTALL.md](INSTALL.md).

View File

@ -47,6 +47,8 @@ MAX_BALLS EQU 12
MAX_KEY_ITEMS EQU 25 MAX_KEY_ITEMS EQU 25
MAX_PC_ITEMS EQU 50 MAX_PC_ITEMS EQU 50
MAX_ITEM_STACK EQU 99
; mail ; mail
MAIL_LINE_LENGTH EQU $10 MAIL_LINE_LENGTH EQU $10
MAIL_MSG_LENGTH EQU $20 MAIL_MSG_LENGTH EQU $20

View File

@ -19,6 +19,9 @@ GS_VERSION EQU 0
SAVE_CHECK_VALUE_1 EQU 99 SAVE_CHECK_VALUE_1 EQU 99
SAVE_CHECK_VALUE_2 EQU 127 SAVE_CHECK_VALUE_2 EQU 127
; RTC halted check value
RTC_HALT_VALUE EQU $1234
; time of day boundaries ; time of day boundaries
MORN_HOUR EQU 4 ; 4 AM MORN_HOUR EQU 4 ; 4 AM
DAY_HOUR EQU 10 ; 10 AM DAY_HOUR EQU 10 ; 10 AM

View File

@ -3432,7 +3432,24 @@ DoEnemyDamage:
ld [wBuffer4], a ld [wBuffer4], a
sbc b sbc b
ld [wEnemyMonHP], a ld [wEnemyMonHP], a
if DEF(_DEBUG)
push af
ld a, BANK(sSkipBattle)
call OpenSRAM
ld a, [sSkipBattle]
call CloseSRAM
or a
; If [sSkipBattle] is nonzero, skip the "jr nc, .no_underflow" check,
; so any attack deals maximum damage to the enemy.
jr nz, .debug_skip
pop af
jr nc, .no_underflow jr nc, .no_underflow
push af
.debug_skip
pop af
else
jr nc, .no_underflow
endc
ld a, [wBuffer4] ld a, [wBuffer4]
ld [hli], a ld [hli], a

1762
engine/debug/debug_room.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -168,7 +168,7 @@ PutItemInPocket:
jr z, .terminator jr z, .terminator
cp c cp c
jr nz, .next jr nz, .next
ld a, 99 ld a, MAX_ITEM_STACK
sub [hl] sub [hl]
add b add b
ld b, a ld b, a
@ -205,14 +205,14 @@ PutItemInPocket:
jr nz, .loop2 jr nz, .loop2
ld a, [wItemQuantityBuffer] ld a, [wItemQuantityBuffer]
add [hl] add [hl]
cp 100 cp MAX_ITEM_STACK + 1
jr nc, .newstack jr nc, .newstack
ld [hl], a ld [hl], a
jr .done jr .done
.newstack .newstack
ld [hl], 99 ld [hl], MAX_ITEM_STACK
sub 99 sub MAX_ITEM_STACK
ld [wItemQuantityBuffer], a ld [wItemQuantityBuffer], a
jr .loop2 jr .loop2
@ -408,7 +408,7 @@ ReceiveTMHM:
add hl, bc add hl, bc
ld a, [wItemQuantityChangeBuffer] ld a, [wItemQuantityChangeBuffer]
add [hl] add [hl]
cp 100 cp MAX_ITEM_STACK + 1
jr nc, .toomany jr nc, .toomany
ld [hl], a ld [hl], a
scf scf

View File

@ -498,7 +498,7 @@ BuyMenuLoop:
ret ret
StandardMartAskPurchaseQuantity: StandardMartAskPurchaseQuantity:
ld a, 99 ld a, MAX_ITEM_STACK
ld [wItemQuantityBuffer], a ld [wItemQuantityBuffer], a
ld a, MARTTEXT_HOW_MANY ld a, MARTTEXT_HOW_MANY
call LoadBuyMenuText call LoadBuyMenuText
@ -557,7 +557,7 @@ RooftopSaleAskPurchaseQuantity:
ld a, MARTTEXT_HOW_MANY ld a, MARTTEXT_HOW_MANY
call LoadBuyMenuText call LoadBuyMenuText
call .GetSalePrice call .GetSalePrice
ld a, 99 ld a, MAX_ITEM_STACK
ld [wItemQuantityBuffer], a ld [wItemQuantityBuffer], a
farcall RooftopSale_SelectQuantityToBuy farcall RooftopSale_SelectQuantityToBuy
call ExitMenu call ExitMenu

View File

@ -96,11 +96,11 @@ Function249a7:
jr nz, .asm_249cd jr nz, .asm_249cd
ld a, [wScrollingMenuCursorPosition] ld a, [wScrollingMenuCursorPosition]
call Function24a97 call Function24a97
cp 99 cp MAX_ITEM_STACK
jr z, .asm_249cd jr z, .asm_249cd
ld a, [wSwitchItem] ld a, [wSwitchItem]
call Function24a97 call Function24a97
cp 99 cp MAX_ITEM_STACK
jr nz, .asm_249cf jr nz, .asm_249cf
.asm_249cd .asm_249cd
and a and a
@ -121,14 +121,14 @@ Function249d1:
ld a, [hl] ld a, [hl]
pop hl pop hl
add [hl] add [hl]
cp 100 cp MAX_ITEM_STACK + 1
jr c, .asm_24a01 jr c, .asm_24a01
sub 99 sub MAX_ITEM_STACK
push af push af
ld a, [wScrollingMenuCursorPosition] ld a, [wScrollingMenuCursorPosition]
call ItemSwitch_GetNthItem call ItemSwitch_GetNthItem
inc hl inc hl
ld [hl], 99 ld [hl], MAX_ITEM_STACK
ld a, [wSwitchItem] ld a, [wSwitchItem]
call ItemSwitch_GetNthItem call ItemSwitch_GetNthItem
inc hl inc hl

View File

@ -88,6 +88,12 @@ AreYouABoyOrAreYouAGirl:
farcall InitMobileProfile ; mobile farcall InitMobileProfile ; mobile
ret ret
if DEF(_DEBUG)
DebugRoom: ; unreferenced
farcall _DebugRoom
ret
endc
ResetWRAM: ResetWRAM:
xor a xor a
ldh [hBGMapMode], a ldh [hBGMapMode], a

View File

@ -18,6 +18,7 @@
const MAINMENUITEM_MYSTERY_GIFT ; 3 const MAINMENUITEM_MYSTERY_GIFT ; 3
const MAINMENUITEM_MOBILE ; 4 const MAINMENUITEM_MOBILE ; 4
const MAINMENUITEM_MOBILE_STUDIUM ; 5 const MAINMENUITEM_MOBILE_STUDIUM ; 5
const MAINMENUITEM_DEBUG_ROOM ; 6
MobileMenuGFX: MobileMenuGFX:
INCBIN "gfx/mobile/mobile_menu.2bpp" INCBIN "gfx/mobile/mobile_menu.2bpp"
@ -70,6 +71,9 @@ MainMenu:
db "MYSTERY GIFT@" db "MYSTERY GIFT@"
db "MOBILE@" db "MOBILE@"
db "MOBILE STUDIUM@" db "MOBILE STUDIUM@"
if DEF(_DEBUG)
db "DEBUG ROOM@"
endc
.Jumptable: .Jumptable:
; entries correspond to MAINMENUITEM_* constants ; entries correspond to MAINMENUITEM_* constants
@ -79,6 +83,9 @@ MainMenu:
dw MainMenu_MysteryGift dw MainMenu_MysteryGift
dw MainMenu_Mobile dw MainMenu_Mobile
dw MainMenu_MobileStudium dw MainMenu_MobileStudium
if DEF(_DEBUG)
dw MainMenu_DebugRoom
endc
MainMenuItems: MainMenuItems:
; entries correspond to MAINMENU_* constants ; entries correspond to MAINMENU_* constants
@ -90,71 +97,95 @@ MainMenuItems:
db -1 db -1
; MAINMENU_CONTINUE ; MAINMENU_CONTINUE
db 3 db 3 + DEF(_DEBUG)
db MAINMENUITEM_CONTINUE db MAINMENUITEM_CONTINUE
db MAINMENUITEM_NEW_GAME db MAINMENUITEM_NEW_GAME
db MAINMENUITEM_OPTION db MAINMENUITEM_OPTION
if DEF(_DEBUG)
db MAINMENUITEM_DEBUG_ROOM
endc
db -1 db -1
; MAINMENU_MOBILE_MYSTERY ; MAINMENU_MOBILE_MYSTERY
db 5 db 5 + DEF(_DEBUG)
db MAINMENUITEM_CONTINUE db MAINMENUITEM_CONTINUE
db MAINMENUITEM_NEW_GAME db MAINMENUITEM_NEW_GAME
db MAINMENUITEM_OPTION db MAINMENUITEM_OPTION
db MAINMENUITEM_MYSTERY_GIFT db MAINMENUITEM_MYSTERY_GIFT
db MAINMENUITEM_MOBILE db MAINMENUITEM_MOBILE
if DEF(_DEBUG)
db MAINMENUITEM_DEBUG_ROOM
endc
db -1 db -1
; MAINMENU_MOBILE ; MAINMENU_MOBILE
db 4 db 4 + DEF(_DEBUG)
db MAINMENUITEM_CONTINUE db MAINMENUITEM_CONTINUE
db MAINMENUITEM_NEW_GAME db MAINMENUITEM_NEW_GAME
db MAINMENUITEM_OPTION db MAINMENUITEM_OPTION
db MAINMENUITEM_MOBILE db MAINMENUITEM_MOBILE
if DEF(_DEBUG)
db MAINMENUITEM_DEBUG_ROOM
endc
db -1 db -1
; MAINMENU_MOBILE_STUDIUM ; MAINMENU_MOBILE_STUDIUM
db 5 db 5 + DEF(_DEBUG)
db MAINMENUITEM_CONTINUE db MAINMENUITEM_CONTINUE
db MAINMENUITEM_NEW_GAME db MAINMENUITEM_NEW_GAME
db MAINMENUITEM_OPTION db MAINMENUITEM_OPTION
db MAINMENUITEM_MOBILE db MAINMENUITEM_MOBILE
db MAINMENUITEM_MOBILE_STUDIUM db MAINMENUITEM_MOBILE_STUDIUM
if DEF(_DEBUG)
db MAINMENUITEM_DEBUG_ROOM
endc
db -1 db -1
; MAINMENU_MYSTERY_MOBILE_STUDIUM ; MAINMENU_MYSTERY_MOBILE_STUDIUM
db 6 db 6 + DEF(_DEBUG)
db MAINMENUITEM_CONTINUE db MAINMENUITEM_CONTINUE
db MAINMENUITEM_NEW_GAME db MAINMENUITEM_NEW_GAME
db MAINMENUITEM_OPTION db MAINMENUITEM_OPTION
db MAINMENUITEM_MYSTERY_GIFT db MAINMENUITEM_MYSTERY_GIFT
db MAINMENUITEM_MOBILE db MAINMENUITEM_MOBILE
db MAINMENUITEM_MOBILE_STUDIUM db MAINMENUITEM_MOBILE_STUDIUM
if DEF(_DEBUG)
db MAINMENUITEM_DEBUG_ROOM
endc
db -1 db -1
; MAINMENU_MYSTERY ; MAINMENU_MYSTERY
db 4 db 4 + DEF(_DEBUG)
db MAINMENUITEM_CONTINUE db MAINMENUITEM_CONTINUE
db MAINMENUITEM_NEW_GAME db MAINMENUITEM_NEW_GAME
db MAINMENUITEM_OPTION db MAINMENUITEM_OPTION
db MAINMENUITEM_MYSTERY_GIFT db MAINMENUITEM_MYSTERY_GIFT
if DEF(_DEBUG)
db MAINMENUITEM_DEBUG_ROOM
endc
db -1 db -1
; MAINMENU_MYSTERY_STUDIUM ; MAINMENU_MYSTERY_STUDIUM
db 5 db 5 + DEF(_DEBUG)
db MAINMENUITEM_CONTINUE db MAINMENUITEM_CONTINUE
db MAINMENUITEM_NEW_GAME db MAINMENUITEM_NEW_GAME
db MAINMENUITEM_OPTION db MAINMENUITEM_OPTION
db MAINMENUITEM_MYSTERY_GIFT db MAINMENUITEM_MYSTERY_GIFT
db MAINMENUITEM_MOBILE_STUDIUM db MAINMENUITEM_MOBILE_STUDIUM
if DEF(_DEBUG)
db MAINMENUITEM_DEBUG_ROOM
endc
db -1 db -1
; MAINMENU_STUDIUM ; MAINMENU_STUDIUM
db 4 db 4 + DEF(_DEBUG)
db MAINMENUITEM_CONTINUE db MAINMENUITEM_CONTINUE
db MAINMENUITEM_NEW_GAME db MAINMENUITEM_NEW_GAME
db MAINMENUITEM_OPTION db MAINMENUITEM_OPTION
db MAINMENUITEM_MOBILE_STUDIUM db MAINMENUITEM_MOBILE_STUDIUM
if DEF(_DEBUG)
db MAINMENUITEM_DEBUG_ROOM
endc
db -1 db -1
MainMenu_GetWhichMenu: MainMenu_GetWhichMenu:

View File

@ -25,6 +25,20 @@ NextCallReceiveDelay:
ld hl, .ReceiveCallDelays ld hl, .ReceiveCallDelays
add hl, de add hl, de
ld a, [hl] ld a, [hl]
if DEF(_DEBUG)
ld h, a
ld a, BANK(sDebugTimeCyclesSinceLastCall)
call OpenSRAM
ld a, [sDebugTimeCyclesSinceLastCall]
call CloseSRAM
dec a
cp 2
jr nc, .debug_ok
xor 1
ld h, a
.debug_ok
ld a, h
endc
jp RestartReceiveCallDelay jp RestartReceiveCallDelay
.ReceiveCallDelays: .ReceiveCallDelays:

View File

@ -185,6 +185,10 @@ EggStatsJoypad:
.check .check
bit A_BUTTON_F, a bit A_BUTTON_F, a
jr nz, .quit jr nz, .quit
if DEF(_DEBUG)
cp START
jr z, .hatch
endc
and D_DOWN | D_UP | A_BUTTON | B_BUTTON and D_DOWN | D_UP | A_BUTTON | B_BUTTON
jp StatsScreen_JoypadAction jp StatsScreen_JoypadAction
@ -193,6 +197,39 @@ EggStatsJoypad:
call StatsScreen_SetJumptableIndex call StatsScreen_SetJumptableIndex
ret ret
if DEF(_DEBUG)
.hatch
ld a, [wMonType]
or a
jr nz, .skip
push bc
push de
push hl
ld a, [wCurPartyMon]
ld bc, PARTYMON_STRUCT_LENGTH
ld hl, wPartyMon1Happiness
call AddNTimes
ld [hl], 1
ld a, 1
ld [wTempMonHappiness], a
ld a, 127
ld [wStepCount], a
ld de, .HatchSoonString
hlcoord 8, 17
call PlaceString
ld hl, wcf64
set 5, [hl]
pop hl
pop de
pop bc
.skip
xor a
jp StatsScreen_JoypadAction
.HatchSoonString:
db "▶HATCH SOON!@"
endc
StatsScreen_LoadPage: StatsScreen_LoadPage:
call StatsScreen_LoadGFX call StatsScreen_LoadGFX
ld hl, wcf64 ld hl, wcf64
@ -970,6 +1007,17 @@ EggStatsScreen:
ld de, FiveQMarkString ld de, FiveQMarkString
hlcoord 11, 5 hlcoord 11, 5
call PlaceString call PlaceString
if DEF(_DEBUG)
ld de, .PushStartString
hlcoord 8, 17
call PlaceString
jr .placed_push_start
.PushStartString:
db "▶PUSH START.@"
.placed_push_start
endc
ld a, [wTempMonHappiness] ; egg status ld a, [wTempMonHappiness] ; egg status
ld de, EggSoonString ld de, EggSoonString
cp $6 cp $6

View File

@ -1138,7 +1138,7 @@ MaskObject::
ld d, $0 ld d, $0
ld hl, wObjectMasks ld hl, wObjectMasks
add hl, de add hl, de
ld [hl], -1 ; , masked ld [hl], -1 ; masked
ret ret
UnmaskObject:: UnmaskObject::
@ -1150,6 +1150,28 @@ UnmaskObject::
ld [hl], 0 ; unmasked ld [hl], 0 ; unmasked
ret ret
if DEF(_DEBUG)
ComputeROMXChecksum::
ldh a, [hROMBank]
push af
ld a, c
rst Bankswitch
ld hl, $4000 ; ROMX start
.loop
ld a, [hli]
add e
ld e, a
ld a, d
adc 0
ld d, a
ld a, h
cp $80 ; HIGH(ROMX end)
jr c, .loop
pop af
rst Bankswitch
ret
endc
ScrollMapUp:: ScrollMapUp::
hlcoord 0, 0 hlcoord 0, 0
ld de, wBGMapBuffer ld de, wBGMapBuffer

View File

@ -2,6 +2,22 @@ OpenSRAM::
; if invalid bank, sram is disabled ; if invalid bank, sram is disabled
cp NUM_SRAM_BANKS cp NUM_SRAM_BANKS
jr c, .valid jr c, .valid
if DEF(_DEBUG)
push af
push bc
ld b, 1
.loop
sla b
dec a
jr nz, .loop
ld a, BANK(sOpenedInvalidSRAM)
call OpenSRAM
ld a, [sOpenedInvalidSRAM]
or b
ld [sOpenedInvalidSRAM], a
pop bc
pop af
endc
jr CloseSRAM jr CloseSRAM
.valid: .valid:

View File

@ -165,6 +165,10 @@ hSGB:: db
hDMATransfer:: db hDMATransfer:: db
hMobile:: db hMobile:: db
hSystemBooted:: db hSystemBooted:: db
if DEF(_DEBUG)
hDebugRoomMenuPage::
endc
hClockResetTrigger:: db hClockResetTrigger:: db
ds 19 ds 19

View File

@ -294,6 +294,7 @@ ROMX $77
"Tileset Data 7" "Tileset Data 7"
"bank77_2" "bank77_2"
ROMX $78 ROMX $78
"Debug Room"
"Tileset Data 8" "Tileset Data 8"
ROMX $7b ROMX $7b
"Battle Tower Text" "Battle Tower Text"

View File

@ -290,7 +290,7 @@ INCLUDE "engine/overworld/player_movement.asm"
INCLUDE "engine/events/engine_flags.asm" INCLUDE "engine/events/engine_flags.asm"
INCLUDE "engine/overworld/variables.asm" INCLUDE "engine/overworld/variables.asm"
INCLUDE "data/text/battle.asm" INCLUDE "data/text/battle.asm"
INCLUDE "engine/menus/debug.asm" INCLUDE "engine/debug/color_picker.asm"
SECTION "bank21", ROMX SECTION "bank21", ROMX
@ -696,6 +696,13 @@ INCBIN "gfx/pokegear/pokegear.2bpp.lz"
INCLUDE "engine/pokemon/european_mail.asm" INCLUDE "engine/pokemon/european_mail.asm"
SECTION "Debug Room", ROMX
if DEF(_DEBUG)
INCLUDE "engine/debug/debug_room.asm"
endc
SECTION "Battle Tower Text", ROMX SECTION "Battle Tower Text", ROMX
INCLUDE "data/battle_tower/trainer_text.asm" INCLUDE "data/battle_tower/trainer_text.asm"
@ -722,7 +729,15 @@ SECTION "Mobile Stadium 2", ROMX
if DEF(_CRYSTAL_AU) if DEF(_CRYSTAL_AU)
INCBIN "mobile/stadium/stadium2_au.bin" INCBIN "mobile/stadium/stadium2_au.bin"
elif DEF(_CRYSTAL11) elif DEF(_CRYSTAL11)
if DEF(_DEBUG)
INCBIN "mobile/stadium/stadium2_11_debug.bin"
else
INCBIN "mobile/stadium/stadium2_11.bin" INCBIN "mobile/stadium/stadium2_11.bin"
endc
else
if DEF(_DEBUG)
INCBIN "mobile/stadium/stadium2_debug.bin"
else else
INCBIN "mobile/stadium/stadium2.bin" INCBIN "mobile/stadium/stadium2.bin"
endc endc
endc

View File

@ -844,3 +844,9 @@ Function4a6d8:
dec b dec b
jr nz, Function4a6d8 jr nz, Function4a6d8
ret ret
if DEF(_DEBUG)
MainMenu_DebugRoom:
farcall _DebugRoom
ret
endc

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,5 @@
f4cd194bdee0d04ca4eac29e09b8e4e9d818c133 *pokecrystal.gbc f4cd194bdee0d04ca4eac29e09b8e4e9d818c133 *pokecrystal.gbc
f2f52230b536214ef7c9924f483392993e226cfb *pokecrystal11.gbc f2f52230b536214ef7c9924f483392993e226cfb *pokecrystal11.gbc
a0fc810f1d4e124434f7be2c989ab5b5892ddf36 *pokecrystal-au.gbc a0fc810f1d4e124434f7be2c989ab5b5892ddf36 *pokecrystal-au.gbc
c60d57a24bbe8ecf7cba54ab3f90669f97bd330d *pokecrystal-debug.gbc
391ae86b1d5a26db712ffe6c28bbf2a1f804c3c4 *pokecrystal11-debug.gbc

View File

@ -90,6 +90,14 @@ sBackupCheckValue2:: db ; loaded with SAVE_CHECK_VALUE_2, used to check save cor
sStackTop:: dw sStackTop:: dw
if DEF(_DEBUG)
sRTCHaltCheckValue:: dw
sSkipBattle:: db
sDebugTimeCyclesSinceLastCall:: db
sOpenedInvalidSRAM:: db
sIsBugMon:: db
endc
SECTION "Save", SRAM SECTION "Save", SRAM

View File

@ -1177,6 +1177,49 @@ wccb5:: ds 3
wccb8:: ds 1 wccb8:: ds 1
wccb9:: ds 1 wccb9:: ds 1
wccba:: ds 102 wccba:: ds 102
if DEF(_DEBUG)
NEXTU
; debug room
; debug room RTC values
wDebugRoomRTCSec:: db
wDebugRoomRTCMin:: db
wDebugRoomRTCHour:: db
wDebugRoomRTCDay:: dw
wDebugRoomRTCCurSec:: db
wDebugRoomRTCCurMin:: db
wDebugRoomRTCCurHour:: db
wDebugRoomRTCCurDay:: dw
; debug room paged values
wDebugRoomCurPage:: db
wDebugRoomCurValue:: db
wDebugRoomAFunction:: dw
wDebugRoomStartFunction:: dw
wDebugRoomSelectFunction:: dw
wDebugRoomAutoFunction:: dw
wDebugRoomPageCount:: db
wDebugRoomPagedValuesPtr:: dw
wDebugRoomROMChecksum:: dw
wDebugRoomCurChecksumBank:: db
UNION
; debug room new item values
wDebugRoomItemID:: db
wDebugRoomItemQuantity:: db
NEXTU
; debug room new pokemon values
wDebugRoomMon:: box_struct wDebugRoomMon
wDebugRoomMonBox:: db
NEXTU
; debug room GB ID values
wDebugRoomGBID:: dw
ENDU
endc
ENDU ENDU