Identify remaining debug color picker labels

This commit is contained in:
Rangi 2020-10-23 12:38:07 -04:00
parent bd3f634049
commit 8a73bb9ab2

View File

@ -1,3 +1,4 @@
; DebugColor_GFX tile IDs
const_def $6a const_def $6a
const DEBUGTEST_TICKS_1 ; $6a const DEBUGTEST_TICKS_1 ; $6a
const DEBUGTEST_TICKS_2 ; $6b const DEBUGTEST_TICKS_2 ; $6b
@ -22,9 +23,17 @@
const DEBUGTEST_E ; $7e const DEBUGTEST_E ; $7e
const DEBUGTEST_F ; $7f const DEBUGTEST_F ; $7f
; DebugColorMain.Jumptable indexes
const_def
const DEBUGCOLORMAIN_INITSCREEN ; 0
const DEBUGCOLORMAIN_UPDATESCREEN ; 1
const DEBUGCOLORMAIN_UPDATEPALETTES ; 2
const DEBUGCOLORMAIN_JOYPAD ; 3
const DEBUGCOLORMAIN_INITTMHM ; 4
const DEBUGCOLORMAIN_TMHMJOYPAD ; 5
DebugColorPicker: DebugColorPicker:
; A debug menu to test monster and trainer palettes at runtime. ; A debug menu to test monster and trainer palettes at runtime.
ldh a, [hCGB] ldh a, [hCGB]
and a and a
jr nz, .cgb jr nz, .cgb
@ -35,17 +44,19 @@ DebugColorPicker:
.cgb .cgb
ldh a, [hInMenu] ldh a, [hInMenu]
push af push af
ld a, 1 ld a, TRUE
ldh [hInMenu], a ldh [hInMenu], a
call DisableLCD call DisableLCD
call DebugColor_InitVRAM call DebugColor_InitVRAM
call DebugColor_LoadGFX call DebugColor_LoadGFX
call DebugColor_InitPalettes call DebugColor_InitPalettes
call DebugColor_InitMonColor call DebugColor_InitMonOrTrainerColor
call EnableLCD call EnableLCD
ld de, MUSIC_NONE ld de, MUSIC_NONE
call PlayMusic call PlayMusic
xor a
xor a ; DEBUGCOLORMAIN_INITSCREEN
ld [wJumptableIndex], a ld [wJumptableIndex], a
ld [wcf66], a ld [wcf66], a
ld [wd003], a ld [wd003], a
@ -63,13 +74,14 @@ DebugColorPicker:
ldh [hInMenu], a ldh [hInMenu], a
ret ret
DebugColor_InitMonColor: DebugColor_InitMonOrTrainerColor:
ld a, [wd002] ld a, [wd002]
and a and a
jr nz, DebugColor_InitTrainerColor jr nz, DebugColor_InitTrainerColor
ld hl, PokemonPalettes ld hl, PokemonPalettes
; fallthrough
DebugColor_InitMonColor2: DebugColor_InitMonColor:
ld de, wOverworldMapBlocks ld de, wOverworldMapBlocks
ld c, NUM_POKEMON + 1 ld c, NUM_POKEMON + 1
.loop .loop
@ -159,11 +171,12 @@ DebugColor_LoadGFX:
ld bc, 22 tiles ld bc, 22 tiles
call CopyBytes call CopyBytes
ld hl, DebugUpArrowGFX ld hl, DebugColor_UpArrowGFX
ld de, vTiles0 ld de, vTiles0
ld bc, 1 tiles ld bc, 1 tiles
call CopyBytes call CopyBytes
; Invert the font colors.
call LoadStandardFont call LoadStandardFont
ld hl, vTiles1 ld hl, vTiles1
ld bc, $80 tiles ld bc, $80 tiles
@ -234,7 +247,7 @@ INCLUDE "gfx/debug/ob.pal"
DebugColorMain: DebugColorMain:
call JoyTextDelay call JoyTextDelay
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
cp 4 cp DEBUGCOLORMAIN_INITTMHM
jr nc, .no_start_select jr nc, .no_start_select
ld hl, hJoyLast ld hl, hJoyLast
ld a, [hl] ld a, [hl]
@ -245,11 +258,11 @@ DebugColorMain:
jr nz, .PreviousMon jr nz, .PreviousMon
.no_start_select .no_start_select
jumptable Jumptable_81acf, wJumptableIndex jumptable .Jumptable, wJumptableIndex
.NextMon .NextMon:
call DebugColor_BackupSpriteColors call DebugColor_BackupSpriteColors
call DebugColor_SetMaxNum call .SetMaxNum
ld e, a ld e, a
ld a, [wcf66] ld a, [wcf66]
inc a inc a
@ -258,40 +271,41 @@ DebugColorMain:
xor a xor a
jr .SwitchMon jr .SwitchMon
.PreviousMon .PreviousMon:
call DebugColor_BackupSpriteColors call DebugColor_BackupSpriteColors
ld a, [wcf66] ld a, [wcf66]
dec a dec a
cp -1 cp -1
jr nz, .SwitchMon jr nz, .SwitchMon
call DebugColor_SetMaxNum call .SetMaxNum
dec a dec a
.SwitchMon .SwitchMon:
ld [wcf66], a ld [wcf66], a
ld a, 0 ld a, DEBUGCOLORMAIN_INITSCREEN
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
DebugColor_SetMaxNum: .SetMaxNum:
; Looping back around the pic set. ; Looping back around the pic set.
ld a, [wd002] ld a, [wd002]
and a and a
jr nz, .trainer jr nz, .trainer
; .mon ; mon
ld a, NUM_POKEMON ; CELEBI ld a, NUM_POKEMON ; CELEBI
ret ret
.trainer .trainer
ld a, NUM_TRAINER_CLASSES - 1 ; MYSTICALMAN ld a, NUM_TRAINER_CLASSES - 1 ; MYSTICALMAN
ret ret
Jumptable_81acf: .Jumptable:
; entries correspond to DEBUGCOLORMAIN_* constants
dw DebugColor_InitScreen dw DebugColor_InitScreen
dw Function81c18 dw DebugColor_UpdateScreen
dw Function81c33 dw DebugColor_UpdatePalettes
dw Function81cc2 dw DebugColor_Joypad
dw Function81d8e dw DebugColor_InitTMHM
dw Function81daf dw DebugColor_TMHMJoypad
DebugColor_InitScreen: DebugColor_InitScreen:
xor a xor a
@ -326,7 +340,7 @@ DebugColor_InitScreen:
and a and a
jr nz, .trainer jr nz, .trainer
; .mon ; mon
ld a, UNOWN_A ld a, UNOWN_A
ld [wUnownLetter], a ld [wUnownLetter], a
call GetPokemonName call GetPokemonName
@ -346,19 +360,17 @@ DebugColor_InitScreen:
ld a, [wd003] ld a, [wd003]
and a and a
jr z, .load_normal_text jr z, .normal
; .load_shiny_text ; shiny
ld de, DebugColor_ShinyText ld de, .ShinyText
jr .place_switch_text jr .place_text
.normal
.load_normal_text ld de, .NormalText
ld de, DebugColor_NormalText .place_text
.place_switch_text
hlcoord 7, 17 hlcoord 7, 17
call PlaceString call PlaceString
hlcoord 0, 17 hlcoord 0, 17
ld de, DebugColor_SwitchText ld de, .SwitchText
call PlaceString call PlaceString
jr .done jr .done
@ -379,33 +391,32 @@ DebugColor_InitScreen:
predef PlaceGraphic predef PlaceGraphic
.done .done
ld a, 1 ld a, DEBUGCOLORMAIN_UPDATESCREEN
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
DebugColor_ShinyText: .ShinyText:
db "レア", DEBUGTEST_BLACK, DEBUGTEST_BLACK, "@" ; Rare (shiny) db "レア", DEBUGTEST_BLACK, DEBUGTEST_BLACK, "@" ; Rare (shiny)
DebugColor_NormalText: .NormalText:
db "ノーマル@" ; Normal db "ノーマル@" ; Normal
DebugColor_SwitchText: .SwitchText:
db DEBUGTEST_A, "きりかえ▶@" ; (A) Switches db DEBUGTEST_A, "きりかえ▶@" ; (A) Switches
DebugColor_LoadRGBMeter: DebugColor_LoadRGBMeter:
decoord 0, 11, wAttrmap decoord 0, 11, wAttrmap
hlcoord 2, 11 hlcoord 2, 11
ld a, $1 ld a, 1
call Function81bde call .load_meter
decoord 0, 13, wAttrmap decoord 0, 13, wAttrmap
hlcoord 2, 13 hlcoord 2, 13
ld a, $2 ld a, 2
call Function81bde call .load_meter
decoord 0, 15, wAttrmap decoord 0, 15, wAttrmap
hlcoord 2, 15 hlcoord 2, 15
ld a, $3 ld a, 3
.load_meter:
Function81bde:
push af push af
ld a, DEBUGTEST_TICKS_1 ld a, DEBUGTEST_TICKS_1
ld [hli], a ld [hli], a
@ -438,10 +449,11 @@ DebugColor_SetRGBMeter:
call DebugColor_CalculateRGB call DebugColor_CalculateRGB
ret ret
Function81c18: DebugColor_UpdateScreen:
ldh a, [hCGB] ldh a, [hCGB]
and a and a
jr z, .sgb jr z, .sgb
ld a, 2 ld a, 2
ldh [hBGMapMode], a ldh [hBGMapMode], a
call DelayFrame call DelayFrame
@ -450,16 +462,17 @@ Function81c18:
.sgb .sgb
call WaitBGMap call WaitBGMap
ld a, 2
ld a, DEBUGCOLORMAIN_UPDATEPALETTES
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
Function81c33: DebugColor_UpdatePalettes:
ldh a, [hCGB] ldh a, [hCGB]
and a and a
jr z, .sgb jr z, .sgb
; .cgb ; cgb
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals2) ld a, BANK(wBGPals2)
@ -467,18 +480,20 @@ Function81c33:
ld hl, wBGPals2 ld hl, wBGPals2
ld de, wc608 ld de, wc608
ld c, $1 ld c, 1
call Function81ee3 call DebugColor_LoadPalettes_White_Col1_Col2_Black
hlcoord 10, 2 hlcoord 10, 2
ld de, wc608 ld de, wc608
call Function81ca7 call DebugColor_PrintHexColor
hlcoord 15, 2 hlcoord 15, 2
ld de, wc608 + 2 ld de, wc608 + 2
call Function81ca7 call DebugColor_PrintHexColor
ld a, TRUE ld a, TRUE
ldh [hCGBPalUpdate], a ldh [hCGBPalUpdate], a
ld a, 3 ld a, DEBUGCOLORMAIN_JOYPAD
ld [wJumptableIndex], a ld [wJumptableIndex], a
pop af pop af
@ -505,52 +520,54 @@ Function81c33:
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld hl, wSGBPals ld hl, wSGBPals
call Function81f0c call DebugColor_PushSGBPals
hlcoord 10, 2 hlcoord 10, 2
ld de, wc608 ld de, wc608
call Function81ca7 call DebugColor_PrintHexColor
hlcoord 15, 2 hlcoord 15, 2
ld de, wc608 + 2 ld de, wc608 + 2
call Function81ca7 call DebugColor_PrintHexColor
ld a, 3 ld a, DEBUGCOLORMAIN_JOYPAD
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
Function81ca7: DebugColor_PrintHexColor:
inc hl inc hl
inc hl inc hl
inc hl inc hl
ld a, [de] ld a, [de]
call Function81cbc call .place_tile
ld a, [de] ld a, [de]
swap a swap a
call Function81cbc call .place_tile
inc de inc de
ld a, [de] ld a, [de]
call Function81cbc call .place_tile
ld a, [de] ld a, [de]
swap a swap a
.place_tile:
Function81cbc:
and $f and $f
add DEBUGTEST_0 add DEBUGTEST_0
ld [hld], a ld [hld], a
ret ret
Function81cc2: DebugColor_Joypad:
ldh a, [hJoyLast] ldh a, [hJoyLast]
and B_BUTTON and B_BUTTON
jr nz, .b jr nz, .tmhm
ldh a, [hJoyLast] ldh a, [hJoyLast]
and A_BUTTON and A_BUTTON
jr nz, .a jr nz, .toggle_shiny
ld a, [wcf64] ld a, [wcf64]
and $3 maskbits 4 ; .PointerTable length
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, Jumptable_81d02 ld hl, .PointerTable
add hl, de add hl, de
add hl, de add hl, de
ld a, [hli] ld a, [hli]
@ -558,15 +575,18 @@ Function81cc2:
ld l, a ld l, a
jp hl jp hl
.b .tmhm
ld a, 4 ; Enter the TM/HM checker.
ld a, DEBUGCOLORMAIN_INITTMHM
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
.a .toggle_shiny
; Toggle between the normal and shiny mon colors.
ld a, [wd002] ld a, [wd002]
and a and a
ret nz ret nz
ld a, [wd003] ld a, [wd003]
xor %00000100 xor %00000100
ld [wd003], a ld [wd003], a
@ -574,12 +594,13 @@ Function81cc2:
ld b, 0 ld b, 0
ld hl, PokemonPalettes ld hl, PokemonPalettes
add hl, bc add hl, bc
call DebugColor_InitMonColor2 call DebugColor_InitMonColor
ld a, 0
ld a, DEBUGCOLORMAIN_INITSCREEN
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
Jumptable_81d02: .PointerTable:
dw DebugColor_SelectColorBox dw DebugColor_SelectColorBox
dw DebugColor_ChangeRedValue dw DebugColor_ChangeRedValue
dw DebugColor_ChangeGreenValue dw DebugColor_ChangeGreenValue
@ -592,21 +613,21 @@ DebugColor_SelectColorBox:
jr nz, DebugColor_NextRGBColor jr nz, DebugColor_NextRGBColor
ld a, [hl] ld a, [hl]
and D_LEFT and D_LEFT
jr nz, .lightcolor jr nz, .light
ld a, [hl] ld a, [hl]
and D_RIGHT and D_RIGHT
jr nz, .darkcolor jr nz, .dark
ret ret
.lightcolor .light
xor a xor a
ld [wcf65], a ld [wcf65], a
ld de, wc608 ld de, wc608
call DebugColor_CalculateRGB call DebugColor_CalculateRGB
ret ret
.darkcolor .dark
ld a, $1 ld a, TRUE
ld [wcf65], a ld [wcf65], a
ld de, wc608 + 2 ld de, wc608 + 2
call DebugColor_CalculateRGB call DebugColor_CalculateRGB
@ -621,7 +642,7 @@ DebugColor_ChangeRedValue:
and D_UP and D_UP
jr nz, DebugColor_PreviousRGBColor jr nz, DebugColor_PreviousRGBColor
ld hl, wc608 + 10 ld hl, wc608 + 10
jr DebugColor_UpdateSpriteColor jr DebugColor_UpdateRGBColor
DebugColor_ChangeGreenValue: DebugColor_ChangeGreenValue:
ld hl, hJoyLast ld hl, hJoyLast
@ -632,7 +653,7 @@ DebugColor_ChangeGreenValue:
and D_UP and D_UP
jr nz, DebugColor_PreviousRGBColor jr nz, DebugColor_PreviousRGBColor
ld hl, wc608 + 11 ld hl, wc608 + 11
jr DebugColor_UpdateSpriteColor jr DebugColor_UpdateRGBColor
DebugColor_ChangeBlueValue: DebugColor_ChangeBlueValue:
ld hl, hJoyLast ld hl, hJoyLast
@ -641,31 +662,31 @@ DebugColor_ChangeBlueValue:
jr nz, DebugColor_PreviousRGBColor jr nz, DebugColor_PreviousRGBColor
ld hl, wc608 + 12 ld hl, wc608 + 12
DebugColor_UpdateSpriteColor: DebugColor_UpdateRGBColor:
ldh a, [hJoyLast] ldh a, [hJoyLast]
and D_RIGHT and D_RIGHT
jr nz, .increment_color_value jr nz, .increment
ldh a, [hJoyLast] ldh a, [hJoyLast]
and D_LEFT and D_LEFT
jr nz, .decrement_color_value jr nz, .decrement
ret ret
.increment_color_value: .increment
ld a, [hl] ld a, [hl]
cp 31 cp 31
ret nc ret nc
inc [hl] inc [hl]
jr .done jr .done
.decrement_color_value: .decrement
ld a, [hl] ld a, [hl]
and a and a
ret z ret z
dec [hl] dec [hl]
.done: .done
call DebugColor_CalculatePalette call DebugColor_CalculatePalette
ld a, 2 ld a, DEBUGCOLORMAIN_UPDATEPALETTES
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
@ -679,7 +700,7 @@ DebugColor_NextRGBColor:
inc [hl] inc [hl]
ret ret
Function81d8e: DebugColor_InitTMHM:
hlcoord 0, 10 hlcoord 0, 10
ld bc, SCREEN_WIDTH * 8 ld bc, SCREEN_WIDTH * 8
ld a, DEBUGTEST_BLACK ld a, DEBUGTEST_BLACK
@ -689,21 +710,21 @@ Function81d8e:
call PlaceString call PlaceString
xor a xor a
ld [wd004], a ld [wd004], a
call Function81df4 call DebugColor_PrintTMHMMove
ld a, 5 ld a, DEBUGCOLORMAIN_TMHMJOYPAD
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
Function81daf: DebugColor_TMHMJoypad:
ld hl, hJoyPressed ld hl, hJoyPressed
ld a, [hl] ld a, [hl]
and B_BUTTON and B_BUTTON
jr nz, .cancel jr nz, .cancel
call DebugColor_TMHMJoypad call .scroll
ret ret
.cancel .cancel
ld a, 0 ld a, DEBUGCOLORMAIN_INITSCREEN
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
@ -712,7 +733,7 @@ Function81daf:
set 7, [hl] set 7, [hl]
ret ret
DebugColor_TMHMJoypad: .scroll:
ld hl, hJoyLast ld hl, hJoyLast
ld a, [hl] ld a, [hl]
and D_UP and D_UP
@ -745,18 +766,19 @@ DebugColor_TMHMJoypad:
.done .done
ld [wd004], a ld [wd004], a
call Function81df4 call DebugColor_PrintTMHMMove
ret ret
Function81df4: DebugColor_PrintTMHMMove:
hlcoord 10, 11 hlcoord 10, 11
call Function81e5e call .ClearRow
hlcoord 10, 12 hlcoord 10, 12
call Function81e5e call .ClearRow
hlcoord 10, 13 hlcoord 10, 13
call Function81e5e call .ClearRow
hlcoord 10, 14 hlcoord 10, 14
call Function81e5e call .ClearRow
ld a, [wd004] ld a, [wd004]
inc a inc a
ld [wTempTMHM], a ld [wTempTMHM], a
@ -766,37 +788,38 @@ Function81df4:
call GetMoveName call GetMoveName
hlcoord 10, 12 hlcoord 10, 12
call PlaceString call PlaceString
ld a, [wd004] ld a, [wd004]
call Function81e55 call .GetNumberedTMHM
ld [wCurItem], a ld [wCurItem], a
predef CanLearnTMHMMove predef CanLearnTMHMMove
ld a, c ld a, c
and a and a
ld de, DebugColor_AbleText ld de, .AbleText
jr nz, .place_string jr nz, .place_string
ld de, DebugColor_NotAbleText ld de, .NotAbleText
.place_string .place_string
hlcoord 10, 14 hlcoord 10, 14
call PlaceString call PlaceString
ret ret
DebugColor_AbleText: .AbleText:
db "おぼえられる@" ; Learnable db "おぼえられる@" ; Learnable
DebugColor_NotAbleText: .NotAbleText:
db "おぼえられない@" ; Not learnable db "おぼえられない@" ; Not learnable
Function81e55: .GetNumberedTMHM:
cp NUM_TMS cp NUM_TMS
jr c, .tm jr c, .tm
; .hm ; hm - skip two gap items
inc a inc a
inc a inc a
.tm .tm
add TM01 add TM01
ret ret
Function81e5e: .ClearRow:
ld bc, 10 ld bc, 10
ld a, DEBUGTEST_BLACK ld a, DEBUGTEST_BLACK
call ByteFill call ByteFill
@ -825,16 +848,16 @@ DebugColor_CalculatePalette:
ld d, a ld d, a
ld a, [wcf65] ld a, [wcf65]
and a and a
jr z, .LightPalette jr z, .light
; .DarkPalette ; dark
ld a, e ld a, e
ld [wc608 + 2], a ld [wc608 + 2], a
ld a, d ld a, d
ld [wc608 + 3], a ld [wc608 + 3], a
ret ret
.LightPalette .light
ld a, e ld a, e
ld [wc608], a ld [wc608], a
ld a, d ld a, d
@ -880,25 +903,17 @@ DebugColor_BackupSpriteColors:
call CopyBytes call CopyBytes
ret ret
Function81ee3: DebugColor_LoadPalettes_White_Col1_Col2_Black:
; Set palette buffer
.loop .loop
ld a, LOW(PALRGB_WHITE) ld a, LOW(PALRGB_WHITE)
ld [hli], a ld [hli], a
ld a, HIGH(PALRGB_WHITE) ld a, HIGH(PALRGB_WHITE)
ld [hli], a ld [hli], a
rept 4
ld a, [de] ld a, [de]
inc de inc de
ld [hli], a ld [hli], a
ld a, [de] endr
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
xor a xor a
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
@ -923,17 +938,17 @@ DebugColor_FillBoxWithByte:
jr nz, .row jr nz, .row
ret ret
Function81f0c: DebugColor_PushSGBPals:
ld a, [wcfbe] ld a, [wcfbe]
push af push af
set 7, a set 7, a
ld [wcfbe], a ld [wcfbe], a
call DebugColor_PushSGBPals call _DebugColor_PushSGBPals
pop af pop af
ld [wcfbe], a ld [wcfbe], a
ret ret
DebugColor_PushSGBPals: _DebugColor_PushSGBPals:
ld a, [hl] ld a, [hl]
and $7 and $7
ret z ret z
@ -993,9 +1008,11 @@ DebugColor_PlaceCursor:
ld [hl], a ld [hl], a
hlcoord 1, 15 hlcoord 1, 15
ld [hl], a ld [hl], a
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
cp 3 cp DEBUGCOLORMAIN_JOYPAD
jr nz, .clearsprites jr nz, .clearsprites
ld a, [wcf64] ld a, [wcf64]
and a and a
jr z, .place_cursor jr z, .place_cursor
@ -1008,19 +1025,17 @@ DebugColor_PlaceCursor:
.place_cursor .place_cursor
ld a, [wcf65] ld a, [wcf65]
and a and a
jr z, .lightcolor jr z, .light
; dark
; .darkcolor
hlcoord 15, 0 hlcoord 15, 0
jr .place jr .place
.light
.lightcolor
hlcoord 10, 0 hlcoord 10, 0
.place .place
ld [hl], "▶" ld [hl], "▶"
ld b, $70
ld c, $5 ld b, $70 ; initial tile id
ld c, 5 ; initial palette
ld hl, wVirtualOAM ld hl, wVirtualOAM
ld de, wc608 + 10 ld de, wc608 + 10
call .placesprite call .placesprite
@ -1030,7 +1045,7 @@ DebugColor_PlaceCursor:
call .placesprite call .placesprite
ret ret
.placesprite .placesprite:
ld a, b ld a, b
ld [hli], a ; y ld [hli], a ; y
ld a, [de] ld a, [de]
@ -1048,26 +1063,27 @@ DebugColor_PlaceCursor:
inc c inc c
ret ret
.clearsprites .clearsprites:
call ClearSprites call ClearSprites
ret ret
DebugColor_AreYouFinishedString: DebugColor_AreYouFinishedString:
db "おわりますか?" ; Are you finished? db "おわりますか?" ; Are you finished?
next "はい<DOT><DOT><DOT>", DEBUGTEST_A ; YES...(A) next "はい<DOT><DOT><DOT>", DEBUGTEST_A ; YES...(A)
next "いいえ<DOT><DOT>", DEBUGTEST_B ; NO..(B) next "いいえ<DOT><DOT>", DEBUGTEST_B ; NO..(B)
db "@" db "@"
DebugUpArrowGFX: DebugColor_UpArrowGFX:
INCBIN "gfx/debug/up_arrow.2bpp" INCBIN "gfx/debug/up_arrow.2bpp"
DebugColor_GFX: DebugColor_GFX:
INCBIN "gfx/debug/color_test.2bpp" INCBIN "gfx/debug/color_test.2bpp"
TilesetColorPicker: TilesetColorPicker:
; A debug function to test tileset palettes at runtime. ; A debug menu to test tileset palettes at runtime.
; dummied out ; dummied out
ret ret
xor a xor a
ld [wJumptableIndex], a ld [wJumptableIndex], a
ld [wcf64], a ld [wcf64], a
@ -1083,9 +1099,9 @@ TilesetColorPicker:
ld hl, vTiles2 tile DEBUGTEST_TICKS_1 ld hl, vTiles2 tile DEBUGTEST_TICKS_1
lb bc, BANK(DebugColor_GFX), 22 lb bc, BANK(DebugColor_GFX), 22
call Request2bpp call Request2bpp
ld de, DebugUpArrowGFX ld de, DebugColor_UpArrowGFX
ld hl, vTiles1 ld hl, vTiles1
lb bc, BANK(DebugUpArrowGFX), 1 lb bc, BANK(DebugColor_UpArrowGFX), 1
call Request2bpp call Request2bpp
ld a, HIGH(vBGMap1) ld a, HIGH(vBGMap1)
ldh [hBGMapAddress + 1], a ldh [hBGMapAddress + 1], a
@ -1110,7 +1126,7 @@ TilesetColorPicker:
ld a, DEBUGTEST_BLACK ld a, DEBUGTEST_BLACK
call DebugTileset_DrawColorSwatch call DebugTileset_DrawColorSwatch
call DebugTileset_LoadRGBMeter call DebugTileset_LoadRGBMeter
call Function8220f call DebugTileset_LoadPalettes
call WaitBGMap2 call WaitBGMap2
ld [wJumptableIndex], a ld [wJumptableIndex], a
ld a, $40 ld a, $40
@ -1154,7 +1170,7 @@ DebugTileset_LoadRGBMeter:
call ByteFill call ByteFill
ret ret
Function8220f: DebugTileset_LoadPalettes:
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals1) ld a, BANK(wBGPals1)
@ -1186,7 +1202,7 @@ DebugColorMain2: ; unreferenced
ld a, [hl] ld a, [hl]
and B_BUTTON and B_BUTTON
jr nz, .cancel jr nz, .cancel
call Function822f0 call DebugTileset_Joypad
ret ret
.loop7 .loop7
@ -1207,10 +1223,12 @@ DebugColorMain2: ; unreferenced
call DebugColor_DrawAttributeSwatch call DebugColor_DrawAttributeSwatch
decoord 16, 1, 0 decoord 16, 1, 0
call DebugColor_DrawAttributeSwatch call DebugColor_DrawAttributeSwatch
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals2) ld a, BANK(wBGPals2)
ldh [rSVBK], a ldh [rSVBK], a
ld hl, wBGPals2 ld hl, wBGPals2
ld a, [wcf64] ld a, [wcf64]
ld bc, 1 palettes ld bc, 1 palettes
@ -1218,8 +1236,10 @@ DebugColorMain2: ; unreferenced
ld de, wc608 ld de, wc608
ld bc, 1 palettes ld bc, 1 palettes
call CopyBytes call CopyBytes
pop af pop af
ldh [rSVBK], a ldh [rSVBK], a
ld a, 2 ld a, 2
ldh [hBGMapMode], a ldh [hBGMapMode], a
ld c, 3 ld c, 3
@ -1235,11 +1255,12 @@ DebugColorMain2: ; unreferenced
ldh [hWY], a ldh [hWY], a
ret ret
Function822a3: DebugTileset_UpdatePalettes:
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals2) ld a, BANK(wBGPals2)
ldh [rSVBK], a ldh [rSVBK], a
ld hl, wBGPals2 ld hl, wBGPals2
ld a, [wcf64] ld a, [wcf64]
ld bc, 1 palettes ld bc, 1 palettes
@ -1249,28 +1270,32 @@ Function822a3:
ld hl, wc608 ld hl, wc608
ld bc, 1 palettes ld bc, 1 palettes
call CopyBytes call CopyBytes
hlcoord 1, 0 hlcoord 1, 0
ld de, wc608 ld de, wc608
call Function81ca7 call DebugColor_PrintHexColor
hlcoord 6, 0 hlcoord 6, 0
ld de, wc608 + 2 ld de, wc608 + 2
call Function81ca7 call DebugColor_PrintHexColor
hlcoord 11, 0 hlcoord 11, 0
ld de, wc608 + 4 ld de, wc608 + 4
call Function81ca7 call DebugColor_PrintHexColor
hlcoord 16, 0 hlcoord 16, 0
ld de, wc608 + 6 ld de, wc608 + 6
call Function81ca7 call DebugColor_PrintHexColor
pop af pop af
ldh [rSVBK], a ldh [rSVBK], a
ld a, TRUE ld a, TRUE
ldh [hCGBPalUpdate], a ldh [hCGBPalUpdate], a
call DelayFrame call DelayFrame
ret ret
Function822f0: DebugTileset_Joypad:
ld a, [wcf65] ld a, [wcf65]
and 3 maskbits 4 ; .PointerTable length
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, .PointerTable ld hl, .PointerTable
@ -1282,16 +1307,16 @@ Function822f0:
jp hl jp hl
.PointerTable: .PointerTable:
dw DebugColor_SelectColorBox2 dw DebugTileset_SelectColorBox
dw Function82339 ; Red dw DebugTileset_ChangeRedValue
dw Function8234b ; Green dw DebugTileset_ChangeGreenValue
dw Function8235d ; Blue dw DebugTileset_ChangeBlueValue
DebugColor_SelectColorBox2: DebugTileset_SelectColorBox:
ld hl, hJoyLast ld hl, hJoyLast
ld a, [hl] ld a, [hl]
and D_DOWN and D_DOWN
jr nz, Function8238c jr nz, DebugTileset_NextRGBColor
ld a, [hl] ld a, [hl]
and D_LEFT and D_LEFT
jr nz, .left jr nz, .left
@ -1322,73 +1347,73 @@ DebugColor_SelectColorBox2:
call DebugColor_CalculateRGB call DebugColor_CalculateRGB
ret ret
Function82339: DebugTileset_ChangeRedValue:
ld hl, hJoyLast ld hl, hJoyLast
ld a, [hl] ld a, [hl]
and D_DOWN and D_DOWN
jr nz, Function8238c jr nz, DebugTileset_NextRGBColor
ld a, [hl] ld a, [hl]
and D_UP and D_UP
jr nz, Function82387 jr nz, DebugTileset_PreviousRGBColor
ld hl, wc608 + 10 ld hl, wc608 + 10
jr Function82368 jr DebugTileset_UpdateRGBColor
Function8234b: DebugTileset_ChangeGreenValue:
ld hl, hJoyLast ld hl, hJoyLast
ld a, [hl] ld a, [hl]
and D_DOWN and D_DOWN
jr nz, Function8238c jr nz, DebugTileset_NextRGBColor
ld a, [hl] ld a, [hl]
and D_UP and D_UP
jr nz, Function82387 jr nz, DebugTileset_PreviousRGBColor
ld hl, wc608 + 11 ld hl, wc608 + 11
jr Function82368 jr DebugTileset_UpdateRGBColor
Function8235d: DebugTileset_ChangeBlueValue:
ld hl, hJoyLast ld hl, hJoyLast
ld a, [hl] ld a, [hl]
and D_UP and D_UP
jr nz, Function82387 jr nz, DebugTileset_PreviousRGBColor
ld hl, wc608 + 12 ld hl, wc608 + 12
Function82368: DebugTileset_UpdateRGBColor:
ldh a, [hJoyLast] ldh a, [hJoyLast]
and D_RIGHT and D_RIGHT
jr nz, .right jr nz, .increment
ldh a, [hJoyLast] ldh a, [hJoyLast]
and D_LEFT and D_LEFT
jr nz, .left jr nz, .decrement
ret ret
.right .increment
ld a, [hl] ld a, [hl]
cp 31 cp 31
ret nc ret nc
inc [hl] inc [hl]
jr .done jr .done
.left .decrement
ld a, [hl] ld a, [hl]
and a and a
ret z ret z
dec [hl] dec [hl]
.done .done
call Function82391 call DebugTileset_CalculatePalette
call Function822a3 call DebugTileset_UpdatePalettes
ret ret
Function82387: DebugTileset_PreviousRGBColor:
ld hl, wcf65 ld hl, wcf65
dec [hl] dec [hl]
ret ret
Function8238c: DebugTileset_NextRGBColor:
ld hl, wcf65 ld hl, wcf65
inc [hl] inc [hl]
ret ret
Function82391: DebugTileset_CalculatePalette:
ld a, [wc608 + 10] ld a, [wc608 + 10]
and %00011111 and %00011111
ld e, a ld e, a