From 2fce2e7bd46d422768a43777e640bbb8eff06013 Mon Sep 17 00:00:00 2001 From: ElectroDeoxys Date: Thu, 15 Apr 2021 17:40:48 +0100 Subject: Disassemble referenced functions in bank 2 --- src/constants/card_data_constants.asm | 21 +- src/engine/bank01.asm | 19 +- src/engine/bank02.asm | 6290 +++++++++++++++++++++++++-------- src/engine/bank03.asm | 2 +- src/engine/bank06.asm | 21 +- src/engine/bank1c.asm | 4 +- src/engine/effect_functions.asm | 2 +- src/engine/home.asm | 21 +- src/hram.asm | 1 + src/sram.asm | 4 +- src/text/text2.asm | 44 +- src/text/text3.asm | 24 +- src/text/text_offsets.asm | 68 +- src/wram.asm | 48 +- 14 files changed, 5019 insertions(+), 1550 deletions(-) (limited to 'src') diff --git a/src/constants/card_data_constants.asm b/src/constants/card_data_constants.asm index 3b775b0..cd7d401 100644 --- a/src/constants/card_data_constants.asm +++ b/src/constants/card_data_constants.asm @@ -128,13 +128,22 @@ DIAMOND EQU $1 STAR EQU $2 PROMOSTAR EQU $ff +; card set constants (set 1) + const_def + const CARD_SET_COLOSSEUM ; $0 + const CARD_SET_EVOLUTION ; $1 + const CARD_SET_MYSTERY ; $2 + const CARD_SET_LABORATORY ; $3 + const CARD_SET_PROMOTIONAL ; $4 + const CARD_SET_ENERGY ; $5 + ; CARD_DATA_SET constants (set 1) -COLOSSEUM EQU $0 << 4 -EVOLUTION EQU $1 << 4 -MYSTERY EQU $2 << 4 -LABORATORY EQU $3 << 4 -PROMOTIONAL EQU $4 << 4 -ENERGY EQU $5 << 4 +COLOSSEUM EQU CARD_SET_COLOSSEUM << 4 +EVOLUTION EQU CARD_SET_EVOLUTION << 4 +MYSTERY EQU CARD_SET_MYSTERY << 4 +LABORATORY EQU CARD_SET_LABORATORY << 4 +PROMOTIONAL EQU CARD_SET_PROMOTIONAL << 4 +ENERGY EQU CARD_SET_ENERGY << 4 ; CARD_DATA_SET constants (set 2) JUNGLE EQU $1 diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index c706842..449cd75 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -1813,7 +1813,7 @@ Func_4b60: ; 4b60 (1:4b60) call ChooseInitialArenaAndBenchPokemon call SwapTurn jp c, .asm_4c77 - call Func_311d + call DrawPlayAreaToPlacePrizeCards ldtx hl, PlacingThePrizesText call DrawWideTextBox_WaitForInput call ExchangeRNG @@ -3684,7 +3684,7 @@ Func_5805: ; 5805 (1:5805) ldtx hl, WillDrawNPrizesText call DrawWideTextBox_WaitForInput ld a, [wNumberPrizeCardsToTake] - call Func_310a + call SelectPrizeCards ld hl, hTemp_ffa0 ld d, [hl] inc hl @@ -8523,7 +8523,20 @@ Func_7576: ; 7576 (1:7576) ret ; 0x757b - INCROM $757b, $758a +Func_757b: ; 757b (1:757b) + farcall Func_19e42 + ret +; 0x7580 + +Func_7580: ; 7580 (1:7580) + farcall Func_1a162 + ret +; 0x7585 + +Func_7585: ; 7585 (1:7585) + farcall Func_1a270 + ret +; 0x758a Func_758a: ; 758a (1:758a) farcall Func_19eb4 diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index 3483af2..05a79d7 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -1281,7 +1281,7 @@ HandleCheckMenuInput_YourOrOppPlayArea: ; 86ac (2:46ac) ld e, a .erase - ld a, $01 + ld a, TRUE ld [wPlaysSfx], a push de call EraseCheckMenuCursor_YourOrOppPlayArea @@ -1620,8 +1620,68 @@ Func_8883_TransitionTable: ; 88fa (2:48fa) cursor_transition $08, $38, $00, $07, $07, $05, $04 cursor_transition $08, $60, $00, $06, $06, $01, $00 -Func_8932: ; 8932 (2:4932) - INCROM $8932, $8992 +_DrawAIPeekScreen: ; 8932 (2:4932) + push bc + call Set_OBJ_8x8 + call LoadCursorTile + xor a + ld [wce56], a + ldh a, [hWhoseTurn] + ld l, a + ld de, Func_8764_TransitionTable + pop bc + bit AI_PEEK_TARGET_HAND_F, b + jr z, .draw_play_area + +; AI chose the hand + call SwapTurn + ld a, $01 + ld [wce56], a + ldh a, [hWhoseTurn] + ld de, Func_8883_TransitionTable +.draw_play_area + ld h, a + push bc + push de + call DrawYourOrOppPlayAreaScreen + pop de + pop bc + +; get the right cursor position +; depending on what action the AI chose +; (prize card, hand, deck) + ld hl, wMenuInputTablePointer + ld [hl], e + inc hl + ld [hl], d + ld a, b + and $7f + cp $7f + jr nz, .prize_card +; cursor on the deck + ld a, $7 + ld [wPrizeCardCursorPosition], a + jr .got_cursor_position +.prize_card + bit AI_PEEK_TARGET_PRIZE_F, a + jr z, .hand + and $3f + ld [wPrizeCardCursorPosition], a + jr .got_cursor_position +.hand + ld a, $6 + ld [wPrizeCardCursorPosition], a +.got_cursor_position + call Func_89ae.draw_cursor + + ld a, $1 + ld [wVBlankOAMCopyToggle], a + ld a, [wce56] + or a + ret z + call SwapTurn + ret +; 0x8992 LoadCursorTile: ; 8992 (2:4992) ld de, v0Tiles0 @@ -1755,7 +1815,7 @@ Func_89ae: ; 89ae (2:49ae) jr .make_bitmask_loop .next - ld a, $01 + ld a, TRUE ld [wPlaysSfx], a ; reset cursor blink @@ -1826,11 +1886,232 @@ ZeroObjectPositionsWithCopyToggleOn: ; 8aa1 (2:4aa1) ld [wVBlankOAMCopyToggle], a ret -Func_8aaa: ; 8aaa (2:4aaa) - INCROM $8aaa, $8b85 +; handles the screen for Player to select prize card(s) +_SelectPrizeCards: ; 8aaa (2:4aaa) + xor a + call GetFirstSetPrizeCard + ld [wPrizeCardCursorPosition], a + ld de, hTempPlayAreaLocation_ffa1 + ld hl, wSelectedPrizeCardListPtr + ld [hl], e + inc hl + ld [hl], d + +.check_prize_cards_to_select + ld a, [wNumberOfPrizeCardsToSelect] + or a + jr z, .done_selection + ld a, DUELVARS_PRIZES + call GetTurnDuelistVariable + or a + jr nz, .got_prizes + +.done_selection + ld a, DUELVARS_PRIZES + call GetTurnDuelistVariable + ldh [hTemp_ffa0], a + ld a, [wSelectedPrizeCardListPtr + 0] + ld l, a + ld a, [wSelectedPrizeCardListPtr + 1] + ld h, a + ld [hl], $ff + ret + +.got_prizes + ldh a, [hWhoseTurn] + ld h, a + ld l, a + call DrawYourOrOppPlayAreaScreen + call DrawWideTextBox + ld de, $10e + call InitTextPrinting + ldtx hl, PleaseChooseAPrizeText + call ProcessTextFromID + ld de, .cursor_transition_table + ld hl, wMenuInputTablePointer + ld [hl], e + inc hl + ld [hl], d +.loop_handle_input + ld a, $1 + ld [wVBlankOAMCopyToggle], a + call DoFrame + call Func_89ae + jr nc, .loop_handle_input + cp $ff + jr z, .loop_handle_input + + call ZeroObjectPositionsWithCopyToggleOn + +; get prize bit mask that corresponds +; to the one pointed by the cursor + ld a, [wPrizeCardCursorPosition] + ld c, a + ld b, $1 +.loop + or a + jr z, .got_prize_mask + sla b + dec a + jr .loop + +.got_prize_mask + ; if cursor prize is not set, + ; then return to input loop + ld a, DUELVARS_PRIZES + call GetTurnDuelistVariable + and b + jp z, .loop_handle_input ; can be jr + + ; remove prize + ld a, DUELVARS_PRIZES + call GetTurnDuelistVariable + sub b + ld [hl], a + + ; get its deck index + ld a, c + add DUELVARS_PRIZE_CARDS + call GetTurnDuelistVariable + + ld hl, wSelectedPrizeCardListPtr + ld e, [hl] + inc hl + ld d, [hl] + ld [de], a ; store deck index + inc de + ld [hl], d + dec hl + ld [hl], e + + ; add prize card to hand + call AddCardToHand + call LoadCardDataToBuffer1_FromDeckIndex + call Set_OBJ_8x16 + bank1call OpenCardPage_FromHand + ld a, [wNumberOfPrizeCardsToSelect] + dec a + ld [wNumberOfPrizeCardsToSelect], a + ld a, [wPrizeCardCursorPosition] + call GetFirstSetPrizeCard + ld [wPrizeCardCursorPosition], a + jp .check_prize_cards_to_select + +.cursor_transition_table + cursor_transition $08, $28, $00, $04, $02, $01, $01 + cursor_transition $30, $28, $20, $05, $03, $00, $00 + cursor_transition $08, $38, $00, $00, $04, $03, $03 + cursor_transition $30, $38, $20, $01, $05, $02, $02 + cursor_transition $08, $48, $00, $02, $00, $05, $05 + cursor_transition $30, $48, $20, $03, $01, $04, $04 +; 0x8b85 + +_DrawPlayAreaToPlacePrizeCards: ; 8b85 (2:4b85) + xor a + ld [wTileMapFill], a + call ZeroObjectPositions + call EmptyScreen + call LoadSymbolsFont + call LoadPlacingThePrizesScreenTiles + + ldh a, [hWhoseTurn] + ld [wCheckMenuPlayAreaWhichLayout], a + ld [wCheckMenuPlayAreaWhichDuelist], a + + lb de, 0, 10 + ld c, 3 + call DrawPlayArea_BenchCards + ld hl, .player_icon_coordinates + call DrawYourOrOppPlayArea_Icons.draw + lb de, 8, 6 + ld a, $a0 + lb hl, 1, 4 + lb bc, 4, 3 + call FillRectangle + + call SwapTurn + ld a, $01 + ld [wce56], a + ldh a, [hWhoseTurn] + ld [wCheckMenuPlayAreaWhichDuelist], a + lb de, 6, 0 + ld c, 3 + call DrawPlayArea_BenchCards + ld hl, .opp_icon_coordinates + call DrawYourOrOppPlayArea_Icons.draw + lb de, 8, 3 + ld a, $a0 + lb hl, 1, 4 + lb bc, 4, 3 + call FillRectangle + call SwapTurn + ret + +.player_icon_coordinates + db 15, 11 + db 15, 6 + db 15, 8 + +.opp_icon_coordinates + db 0, 0 + db 0, 4 + db 0, 2 +; 0x8bf2 + + INCROM $8bf2, $8c57 + +; gets the first prize card index that is set +; beginning from index in register a +; a = prize card index +GetFirstSetPrizeCard: ; 8c57 (2:4c57) + push bc + push de + push hl + ld e, PRIZES_6 + ld c, a + ldh a, [hWhoseTurn] + ld h, a + ld l, DUELVARS_PRIZES + ld d, [hl] +.loop_prizes + call .GetPrizeMask + and d + jr nz, .done ; prize is set + dec e + jr nz, .next_prize + ld c, 0 + jr .done +.next_prize + inc c + ld a, PRIZES_6 + cp c + jr nz, .loop_prizes + ld c, 0 + jr .loop_prizes + +.done + ld a, c ; first prize index that is set + pop hl + pop de + pop bc + ret -Func_8b85: ; 8b85 (2:4b85) - INCROM $8b85, $8c8e +; returns 1 shifted left by c bits +.GetPrizeMask + push bc + ld a, c + ld b, $1 +.loop + or a + jr z, .got_mask + sla b + dec a + jr .loop +.got_mask + ld a, b + pop bc + ret +; 0x8c8e OpenGlossaryScreen_TransitionTable: cursor_transition $08, $28, $00, $04, $01, $05, $05 @@ -1951,8 +2232,7 @@ Data_8da9: ; 8da9 (2:4da9) db $50, $04, $01 dw HandleDeckConfigurationMenu dw DeckConfigurationMenu_TransitionTable - - INCROM $8db0, $8db0 +; 0x8db0 Func_8db0: ; 8db0 (2:4db0) ld hl, Data_8da9 @@ -1962,7 +2242,7 @@ Func_8db0: ; 8db0 (2:4db0) xor a Func_8dbc: ; 8dbc (2:4dbc) - ld hl, Unknown_8de2 + ld hl, .DeckSelectionMenuParameters call InitializeMenuParameters ldtx hl, PleaseSelectDeckText call DrawWideTextBox_PrintText @@ -1979,8 +2259,13 @@ Func_8dbc: ; 8dbc (2:4dbc) ld [wceb1], a jp Func_8e42 -Unknown_8de2: ; 8de2 (2:4de2) - INCROM $8de2, $8dea +.DeckSelectionMenuParameters + db 1, 2 ; cursor x, cursor y + db 3 ; y displacement between items + db 4 ; number of items + db SYM_CURSOR_R ; cursor tile number + db SYM_SPACE ; tile behind cursor + dw NULL ; function pointer if non-0 Func_8dea: ; 8dea (2:4dea) ldh a, [hDPadHeld] @@ -2031,7 +2316,7 @@ Func_8e1f: ; 8e1f (2:4e1f) Func_8e42: ; 8e42 (2:4e42) call DrawWideTextBox - ld hl, Unknown_9027 + ld hl, DeckSelectionData call PlaceTextItems call ResetCheckMenuCursorPositionAndBlink .asm_8e4e @@ -2263,8 +2548,13 @@ Func_8ff2: ; 8ff2 (2:4ff2) Func_9026: ; 9026 (2:5026) ret -Unknown_9027: ; 9027 (2:5027) - INCROM $9027, $9038 +DeckSelectionData: ; 9027 (2:5027) + textitem 2, 14, ModifyDeckText + textitem 12, 14, SelectDeckText + textitem 2, 16, ChangeNameText + textitem 12, 16, CancelText + db $ff +; 0x9038 ; return, in hl, the pointer to sDeckXName where X is [wceb1] + 1 GetPointerToDeckName: ; 9038 (2:5038) @@ -2342,7 +2632,7 @@ HandleCheckMenuInput: ; 9065 (2:5065) ld e, a .okay - ld a, $01 + ld a, TRUE ld [wPlaysSfx], a push de call EraseCheckMenuCursor @@ -2538,7 +2828,7 @@ Func_9168: ; 9168 (2:5168) lb de, 0, 9 lb bc, 20, 4 call DrawRegularTextBox - ld hl, Unknown_9242 + ld hl, DeckNameMenuData call PlaceTextItems ld a, 4 ld hl, wceb2 @@ -2621,9 +2911,15 @@ Func_9168: ; 9168 (2:5168) call DrawHandCardsTileOnSelectedDeck call EnableLCD ret +; 0x9242 -Unknown_9242: ; 9242 (2:5242) - INCROM $9242, $9253 +DeckNameMenuData: ; 9242 (2:5242) + textitem 4, 2, Deck1Text + textitem 4, 5, Deck2Text + textitem 4, 8, Deck3Text + textitem 4, 11, Deck4Text + db $ff +; 0x9253 Func_9253: ; 9253 (2:5253) ld de, wDefaultText @@ -2772,7 +3068,7 @@ Func_9345: ; 9345 (2:5345) xor a ld [wcea1], a - ld [wced3], a + ld [wCurCardTypeFilter], a call Func_993d .skip_draw @@ -2786,16 +3082,16 @@ Func_9345: ; 9345 (2:5345) ld a, $01 call PlaySFXConfirmOrCancel call ConfirmDeckConfiguration - ld a, [wced3] + ld a, [wCurCardTypeFilter] ld [wNamingScreenCursorY], a jr .wait_input .no_start_btn - ld a, [wced3] + ld a, [wCurCardTypeFilter] ld b, a ld a, [wNamingScreenCursorY] cp b jr z, .check_down_btn - ld [wced3], a + ld [wCurCardTypeFilter], a ld hl, wcea1 ld [hl], $00 call Func_993d @@ -2815,15 +3111,15 @@ Func_9345: ; 9345 (2:5345) cp $ff jp z, Func_9461 .asm_93a9 - ld a, [wceab + 3] + ld a, [wceae] or a jr z, .wait_input xor a .asm_93b0 ld hl, Data_9670 call Func_9a6d - ld a, [wceab + 3] - ld [wcfe4 + 2], a + ld a, [wceae] + ld [wcfe6], a ld hl, wcecb cp [hl] jr nc, .asm_93c5 @@ -2872,7 +3168,7 @@ Func_9345: ; 9345 (2:5345) call DrawCardTypeIconsAndPrintCardCounts ld hl, Data_9667 call Func_9a6d - ld a, [wced3] + ld a, [wCurCardTypeFilter] ld [wNamingScreenCursorY], a call Func_9b20 call PrintDeckBuildingCardList @@ -2892,7 +3188,7 @@ Func_9345: ; 9345 (2:5345) jr nz, .asm_93fc ld hl, Data_9667 call Func_9a6d - ld a, [wced3] + ld a, [wCurCardTypeFilter] ld [wNamingScreenCursorY], a jp .wait_input ; 0x9461 @@ -2939,7 +3235,7 @@ HandleDeckConfigurationMenu: ; 9480 (2:5480) call DrawCardTypeIconsAndPrintCardCounts ld a, [wced4] ld [wNamingScreenCursorY], a - ld a, [wced3] + ld a, [wCurCardTypeFilter] call Func_993d jp Func_9345.skip_draw @@ -2975,10 +3271,10 @@ ConfirmDeckConfiguration: ; 94d3 (2:54d3) call DrawCardTypeIconsAndPrintCardCounts ld hl, Data_9667 call Func_9a6d - ld a, [wced3] + ld a, [wCurCardTypeFilter] ld [wNamingScreenCursorY], a call Func_9b20 - ld a, [wced3] + ld a, [wCurCardTypeFilter] call Func_993d ld a, [wced6] ld [wNamingScreenCursorY], a @@ -3056,7 +3352,7 @@ DismantleDeck: ; 9566 (2:5566) call EmptyScreen ld hl, Data_9667 call Func_9a6d - ld a, [wced3] + ld a, [wCurCardTypeFilter] ld [wNamingScreenCursorY], a call Func_9b20 call PrintDeckBuildingCardList @@ -3458,7 +3754,7 @@ CreateFilteredCardList: ; 978b (2:578b) .add_terminator_byte ld a, l - ld [wceab + 3], a + ld [wceae], a ; add terminator bytes in both lists xor a ld c, l @@ -4061,7 +4357,57 @@ Func_9a6d: ; 9a6d (2:5a6d) ; 0x9a83 Func_9a83: ; 9a83 (2:5a83) - INCROM $9a83, $9ad7 + xor a + ld [wPlaysSfx], a + ldh a, [hDPadHeld] + or a + jr z, .handle_ab_btns + ld b, a + ld a, [wNamingScreenKeyboardHeight] + ld c, a + ld a, [wNamingScreenCursorY] + bit D_LEFT_F, b + jr z, .check_d_right + dec a + bit 7, a + jr z, .got_new_cursor_y + ld a, [wNamingScreenKeyboardHeight] + dec a + jr .got_new_cursor_y +.check_d_right + bit D_RIGHT_F, b + jr z, .handle_ab_btns + inc a + cp c + jr c, .got_new_cursor_y + + xor a +.got_new_cursor_y + push af + ld a, TRUE + ld [wPlaysSfx], a + call Func_9b00 + pop af + + ld [wNamingScreenCursorY], a + xor a + ld [wCheckMenuCursorBlinkCounter], a + +.handle_ab_btns + ld a, [wNamingScreenCursorY] + ld [hffb3], a + ldh a, [hKeysPressed] + and A_BUTTON | B_BUTTON + jr z, Func_9ae8 + and A_BUTTON + jr nz, Func_9ad7 + ; b button + ld a, $ff + ld [hffb3], a + call PlaySFXConfirmOrCancel + scf + ret +; 0x9ad7 Func_9ad7: ; 9ad7 (2:5ad7) call Func_9b20 @@ -4074,7 +4420,25 @@ Func_9ad7: ; 9ad7 (2:5ad7) ret ; 0x9ae8 - INCROM $9ae8, $9b03 +Func_9ae8: ; 9ae8 (2:5ae8) + ld a, [wPlaysSfx] + or a + jr z, .skip_sfx + call PlaySFX +.skip_sfx + ld hl, wCheckMenuCursorBlinkCounter + ld a, [hl] + inc [hl] + and $0f + ret nz + ld a, [wceaa] + bit 4, [hl] + jr z, Func_9b03 +; 0x9b00 + +Func_9b00: ; 9b00 (2:5b00) + ld a, [wceab] +; fallthrough Func_9b03: ; 9b03 (2:5b03) ld e, a @@ -4102,33 +4466,169 @@ Func_9b20: ; 9b20 (2:5b20) ; 0x9b25 Func_9b25: ; 9b25 (2:5b25) - INCROM $9b25, $9c0e - -Func_9c0e: ; 9c0e (2:5c0e) - INCROM $9c0e, $9c11 + xor a ; FALSE + ld [wPlaysSfx], a -; a = tile to write -Func_9c11: ; 9c11 (2:5c11) - ld e, a - ld a, [wcea5 + 3] - ld l, a - ld a, [wNamingScreenCursorY] - ld h, a - call HtimesL - ld a, l - ld hl, wcea5 - add [hl] + ldh a, [hDPadHeld] + or a + jp z, .asm_9bb9 ld b, a - ld a, [wcea5 + 2] - ld l, a - ld a, [wNamingScreenCursorY] - ld h, a - call HtimesL - ld a, l - ld hl, wcea5 + 1 - add [hl] + ld a, [wNamingScreenKeyboardHeight] ld c, a - ld a, e + ld a, [wNamingScreenCursorY] + bit D_UP_F, b + jr z, .check_d_down + push af + ld a, TRUE + ld [wPlaysSfx], a + pop af + dec a + bit 7, a + jr z, .asm_9b8f + ld a, [wcea1] + or a + jr z, .asm_9b5a + dec a + ld [wcea1], a + ld hl, wcece + call CallIndirect + xor a + jr .asm_9b8f +.asm_9b5a + xor a + ld [wPlaysSfx], a + jr .asm_9b8f + +.check_d_down + bit D_DOWN_F, b + jr z, .asm_9b9d + push af + ld a, TRUE + ld [wPlaysSfx], a + pop af + inc a + cp c + jr c, .asm_9b8f + push af + ld a, [wcecd] + or a + jr nz, .asm_9b87 + ld a, [wcea1] + inc a + ld [wcea1], a + ld hl, wcece + call CallIndirect + pop af + dec a + jr .asm_9b8f + +.asm_9b87 + pop af + dec a + push af + xor a ; FALSE + ld [wPlaysSfx], a + pop af +.asm_9b8f + push af + call Func_9c0e + pop af + ld [wNamingScreenCursorY], a + xor a + ld [wCheckMenuCursorBlinkCounter], a + jr .asm_9bb9 +.asm_9b9d + ld a, [wced2] + or a + jr z, .asm_9bb9 + + bit D_LEFT_F, b + jr z, .check_d_right + call Func_9db3 + call Func_9de4 + jr .asm_9bb9 +.check_d_right + bit D_RIGHT_F, b + jr z, .asm_9bb9 + call Func_9db3 + call Func_9d0c +.asm_9bb9 + ld a, [wNamingScreenCursorY] + ld [hffb3], a + ld hl, wceac + ld a, [hli] + or [hl] + jr z, .asm_9be2 + ld a, [hld] + ld l, [hl] + ld h, a + ld a, [hffb3] + call CallHL + jr nc, .handle_blink +.asm_9bd1 + call Func_9c3a + ld a, $01 + call PlaySFXConfirmOrCancel + ld a, [wNamingScreenCursorY] + ld e, a + ld a, [hffb3] + scf + ret + +.asm_9be2 + ldh a, [hKeysPressed] + and A_BUTTON | B_BUTTON + jr z, .asm_9bf6 + and A_BUTTON + jr nz, .asm_9bd1 + ld a, $ff + ld [hffb3], a + call PlaySFXConfirmOrCancel + scf + ret + +.asm_9bf6 + ld a, [wPlaysSfx] + or a + jr z, .handle_blink + call PlaySFX +.handle_blink + ld hl, wCheckMenuCursorBlinkCounter + ld a, [hl] + inc [hl] + and $0f + ret nz + ld a, [wceaa] + bit 4, [hl] + jr z, Func_9c11 +; 0x9c0e + +Func_9c0e: ; 9c0e (2:5c0e) + ld a, [wceab] +; fallthrough + +; a = tile to write +Func_9c11: ; 9c11 (2:5c11) + ld e, a + ld a, [wcea5 + 3] + ld l, a + ld a, [wNamingScreenCursorY] + ld h, a + call HtimesL + ld a, l + ld hl, wcea5 + add [hl] + ld b, a + ld a, [wcea5 + 2] + ld l, a + ld a, [wNamingScreenCursorY] + ld h, a + call HtimesL + ld a, l + ld hl, wcea5 + 1 + add [hl] + ld c, a + ld a, e call WriteByteToBGMap0 or a ret @@ -4140,1614 +4640,4459 @@ Func_9c3a: ; 9c3a (2:5c3a) ; 0x9c3f Func_9c3f: ; 9c3f (2:5c3f) - INCROM $9c3f, $9e31 + ld hl, wcfd8 + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wNamingScreenCursorY] + ld c, a + ld b, $00 + add hl, bc + ld a, [wcea1] + ld c, a + ld b, $00 + add hl, bc + ld e, [hl] + ld d, $00 + push de + call LoadCardDataToBuffer1_FromCardID + lb de, $38, $9f + call SetupText + bank1call OpenCardPage_FromCheckHandOrDiscardPile + pop de -Func_9e31: ; 9e31 (2:5e31) - ld hl, hffb0 - ld [hl], $01 - call Func_9fc0 - ld hl, hffb0 - ld [hl], $00 - jp PrintConfirmationCardList -; 0x9e41 +.handle_input + ldh a, [hDPadHeld] + ld b, a + and A_BUTTON | B_BUTTON | SELECT | START + jp nz, .asm_9ce1 -Func_9e41: ; 9e41 (2:5e41) - ld a, [wcecc] + xor a ; FALSE + ld [wPlaysSfx], a + ld a, [wNamingScreenKeyboardHeight] + ld c, a + ld a, [wNamingScreenCursorY] + bit D_UP_F, b + jr z, .asm_9c94 + push af + ld a, TRUE + ld [wPlaysSfx], a + pop af + dec a + bit 7, a + jr z, .asm_9cc6 + ld a, [wcea1] or a - jp z, Func_9f40 - call Func_a028 - call Func_a06e - - xor a + jr z, .asm_9cd9 + dec a ld [wcea1], a -.asm_9e52 - ld hl, Data_9eaf - call Func_9a6d - ld a, [wced9] - ld [wcfe4+ 2], a - cp $07 - jr c, .asm_9e64 - ld a, $07 -.asm_9e64 - ld [wNamingScreenKeyboardHeight], a - ld [wcecb], a - call Func_9f52 - ld hl, Func_9e31 - ld d, h - ld a, l - ld hl, wcece - ld [hli], a - ld [hl], d xor a - ld [wced2], a -.asm_9e7b - call DoFrame - call Func_9b25 - jr c, .asm_9ea7 - call Func_9eb8 - jr c, .asm_9e7b - ldh a, [hDPadHeld] - and START - jr z, .asm_9e7b + jr .asm_9cc6 -.asm_9e8e - ld a, $01 - call PlaySFXConfirmOrCancel - ld a, [wNamingScreenCursorY] - ld [wced7], a - ld de, wOwnedCardsCountList +.asm_9c94 + bit D_DOWN_F, b + jr z, .asm_9cd9 + push af + ld a, TRUE + ld [wPlaysSfx], a + pop af + inc a + cp c + jr c, .asm_9cc6 + push af ld hl, wcfd8 - ld [hl], e - inc hl - ld [hl], d - call Func_9c3f - jr .asm_9e52 - -.asm_9ea7 - ld a, [hffb3] - cp $ff - ret z - jr .asm_9e8e -; 0x9eaf - -Data_9eaf: - db $00, $05, $02, $00, $07, $0f, $00, $00, $00 - -Func_9eb8: ; 9eb8 (2:5eb8) - ld a, [wNamingScreenKeyboardHeight] - ld d, a + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wNamingScreenCursorY] + ld c, a + ld b, $00 + add hl, bc ld a, [wcea1] + inc a ld c, a - ldh a, [hDPadHeld] - cp D_RIGHT - jr z, .right - cp D_LEFT - jr z, .left + ld b, $00 + add hl, bc + ld a, [hl] or a - ret - -.right + jr z, .asm_9cd6 ld a, [wcea1] - add d - ld b, a - add d - ld hl, wcfe4 + 2 - cp [hl] - jr c, .asm_9ee8 - ld a, [wcfe4 + 2] - sub d - ld b, a - jr .asm_9ee8 - -.left - ld a, [wcea1] - sub d - ld b, a - jr nc, .asm_9ee8 - ld b, $00 -.asm_9ee8 - ld a, b + inc a ld [wcea1], a - cp c - jr z, .asm_9efa - ld a, SFX_01 + pop af + dec a +.asm_9cc6 + ld [wNamingScreenCursorY], a + ld a, [wPlaysSfx] + or a + jp z, Func_9c3f call PlaySFX - ld hl, wcece - call CallIndirect -.asm_9efa - scf - ret -; 0x9efc + jp Func_9c3f -Func_9efc: ; 9efc (2:5efc) - INCROM $9efc, $9f40 +.asm_9cd6 + pop af + jr .asm_9cd9 ; unnecessary jr +.asm_9cd9 + push de + bank1call OpenCardPage.input_loop + pop de + jp .handle_input -Func_9f40: ; 9f40 (2:5f40) - call Func_9f81 -.wait_input - call DoFrame - ldh a, [hKeysPressed] - and B_BUTTON - jr z, .wait_input - ld a, $ff - call PlaySFXConfirmOrCancel +.asm_9ce1 + ld a, $1 + ld [wVBlankOAMCopyToggle], a + ld a, [wNamingScreenCursorY] + ld [wced4], a ret -; 0x9f52 +; 0x9ced -Func_9f52: ; 9f52 (2:5f52) - call Func_9f81 - lb de, 3, 5 - ld hl, wced0 + INCROM $9ced, $9d0c + +Func_9d0c: ; 9d0c (2:5d0c) + call Func_9d22 + ret c + push de + call PrintCardTypeCounts + lb de, 15, 0 + call PrintTotalCardCount + pop de + call Func_9850 + call Func_9dbf + ret +; 0x9d22 + +Func_9d22: ; 9d22 (2:5d22) + ld a, [wcfd1] + ld d, a + ld a, [wcecc] + cp d + jr nz, .asm_9d2e + scf + ret + +.asm_9d2e + push de + call Func_9d74 + pop de + ret c + push de + call Func_9850 + ld b, a + ld hl, wOwnedCardsCountList + ld d, $00 + ld a, [wcea1] + ld e, a + add hl, de + ld a, [wNamingScreenCursorY] + ld e, a + add hl, de + ld d, [hl] + ld a, b + cp d + pop de + scf + ret z + ld a, SFX_01 + call PlaySFX + push de + call Func_9d65 + ld a, [wCurCardTypeFilter] + ld c, a + ld b, $00 + ld hl, wcebb + add hl, bc + inc [hl] + pop de + or a + ret +; 0x9d65 + +; finds first empty slot in wcf17 +; then writes the value in e to it +Func_9d65: ; 9d65 (2:5d65) + ld hl, wcf17 +.loop + ld a, [hl] + or a + jr z, .empty + inc hl + jr .loop +.empty ld [hl], e inc hl - ld [hl], d - call PrintConfirmationCardList + xor a + ld [hl], a ret -; 0x9f62 +; 0x9d74 -; counts all values stored in wcebb -; if the total count is 0, then -; prints "No cards chosen." -Func_9f62: ; 9f62 (2:5f62) - lb bc, 0, 0 - ld hl, wcebb +; e = card id +Func_9d74: ; 9d74 (2:5d74) + call LoadCardDataToBuffer1_FromCardID + ld a, [wLoadedCard1Type] + cp TYPE_ENERGY_DOUBLE_COLORLESS + jr z, .double_colorless + and TYPE_ENERGY + cp TYPE_ENERGY + jr z, .exit ; return if basic energy card +.double_colorless + +; compare this card's name to +; the names of cards in list wcf17 + ld a, [wLoadedCard1Name + 0] + ld c, a + ld a, [wLoadedCard1Name + 1] + ld b, a + ld hl, wcf17 + ld d, $00 + push de .loop ld a, [hli] - add b - ld b, a - inc c - ld a, $9 + or a + jr z, .exit_pop_de + ld e, a + ld d, $00 + call GetCardName + ld a, e cp c jr nz, .loop - ld a, b - or a - ret nz - lb de, 11, 1 - call InitTextPrinting - ldtx hl, NoCardsChosenText - call ProcessTextFromID + ld a, d + cp b + jr nz, .loop + ; has same name + pop de + inc d + ld a, [wcfd1 + 1] + cp d + push de + jr nz, .loop + pop de + scf ret -; 0x9f81 -Func_9f81: ; 9f81 (2:5f81) - call Func_8d56 - lb de, 0, 0 - lb bc, 20, 4 - call DrawRegularTextBox - ld a, [wcfb9] +.exit_pop_de + pop de +.exit or a - jp z, .print_card_count ; should be jr - call Func_9fc0 - ld a, [wceb1] - ld b, a - call EnableSRAM - ld a, [sCurrentlySelectedDeck] - call DisableSRAM - cp b - jr nz, .print_card_count - lb de, 2, 1 - call DrawHandCardsTileAtDE + ret +; 0x9db3 -.print_card_count - lb de, 14, 1 - call PrintTotalCardCount - lb de, 16, 1 - call PrintSlashSixty - call Func_9f62 - call EnableLCD +; gets the element in wcec4 +; corresponding to index wNamingScreenCursorY +Func_9db3: ; 9db3 (2:5db3) + ld hl, wcec4 + ld a, [wNamingScreenCursorY] + ld e, a + ld d, $00 + add hl, de + ld e, [hl] ret -; 0x9fc0 +; 0x9dbf -Func_9fc0: ; 9fc0 (2:5fc0) - ld a, [wceb1] - cp $ff - jr z, .asm_9fea - lb de, 3, 2 - call InitTextPrinting - ld a, [wceb1] - bit 7, a - jr z, .asm_9fd8 - and $7f - jr .asm_9fd9 -.asm_9fd8 - inc a -.asm_9fd9 - ld hl, wDefaultText +; a = value to convert to numerical digits +Func_9dbf: ; 9dbf (2:5dbf) + ld hl, wc590 call ConvertToNumericalDigits - ld [hl], $77 - inc hl ld [hl], TX_END - ld hl, wDefaultText - call ProcessText - -.asm_9fea - ld hl, wcfb9 - ld de, wDefaultText - call CopyListFromHLToDE - ld a, [wceb1] - cp $ff - jr z, .asm_a01b - ld hl, wDefaultText - call GetTextLengthInTiles - ld b, $0 - ld hl, wDefaultText - add hl, bc - ld d, h - ld e, l - ld hl, Data_92a7 - call CopyListFromHLToDE - lb de, 6, 2 - ld hl, wDefaultText + ld a, [wcea5 + 2] + ld l, a + ld a, [wNamingScreenCursorY] + ld h, a + call HtimesL + ld a, l + ld hl, wcea5 + 1 + add [hl] + ld e, a + ld d, $0e call InitTextPrinting + ld hl, wc590 call ProcessText ret +; 0x9de4 -.asm_a01b - lb de, 2, 2 - ld hl, wDefaultText - call InitTextPrinting - call ProcessText +Func_9de4: ; 9de4 (2:5de4) + call Func_9dfa + ret nc + push de + call PrintCardTypeCounts + lb de, 15, 0 + call PrintTotalCardCount + pop de + call Func_9850 + call Func_9dbf ret -; 0xa028 +; 0x9dfa -Func_a028: ; a028 (2:6028) +Func_9dfa: ; 9dfa (2:5dfa) + push de + call Func_9850 + pop de + or a + ret z + ld a, SFX_01 + call PlaySFX + push de + call Func_9e18 + ld a, [wCurCardTypeFilter] + ld c, a + ld b, $00 + ld hl, wcebb + add hl, bc + dec [hl] + pop de + scf + ret +; 0x9e18 + +Func_9e18: ; 9e18 (2:5e18) ld hl, wcf17 - ld de, wOpponentDeck - ld bc, wDuelTempList - ld a, -1 - ld [bc], a -.loop_copy - inc a - push af + ld d, $00 +.loop_1 + inc d + ld a, [hli] + cp e + jr nz, .loop_1 + ld c, l + ld b, h + dec bc +.loop_2 + inc d ld a, [hli] - ld [de], a - inc de or a - jr z, .sort_cards - pop af + jr z, .done ld [bc], a inc bc - jr .loop_copy - -.sort_cards - pop af - ld a, $ff + jr .loop_2 +.done + xor a ld [bc], a - ldh a, [hWhoseTurn] - push af - ld a, OPPONENT_TURN - ldh [hWhoseTurn], a - call SortCardsInDuelTempListByID - pop af - ldh [hWhoseTurn], a + ret +; 0x9e31 - ld hl, wcf17 - ld de, wDuelTempList -.asm_a058 - ld a, [de] - cp $ff - jr z, .done - ld c, a - ld b, $0 - push hl - ld hl, wOpponentDeck - add hl, bc - ld a, [hl] - pop hl - ld [hli], a - inc de - jr .asm_a058 +Func_9e31: ; 9e31 (2:5e31) + ld hl, hffb0 + ld [hl], $01 + call Func_9fc0 + ld hl, hffb0 + ld [hl], $00 + jp PrintConfirmationCardList +; 0x9e41 + +Func_9e41: ; 9e41 (2:5e41) + ld a, [wcecc] + or a + jp z, Func_9f40 + call Func_a028 + call Func_a06e -.done xor a - ld [hl], a - ret -; 0xa06e + ld [wcea1], a +.asm_9e52 + ld hl, Data_9eaf + call Func_9a6d + ld a, [wced9] + ld [wcfe6], a + cp $07 + jr c, .asm_9e64 + ld a, $07 +.asm_9e64 + ld [wNamingScreenKeyboardHeight], a + ld [wcecb], a + call Func_9f52 + ld hl, Func_9e31 + ld d, h + ld a, l + ld hl, wcece + ld [hli], a + ld [hl], d + xor a + ld [wced2], a +.asm_9e7b + call DoFrame + call Func_9b25 + jr c, .asm_9ea7 + call Func_9eb8 + jr c, .asm_9e7b + ldh a, [hDPadHeld] + and START + jr z, .asm_9e7b -; goes through list in wcf17, and for each card in it -; creates list in wTempHandCardList of all unique cards -; it finds (assuming wcf17 is sorted by ID) -; also counts the number of the different cards -Func_a06e: ; a06e (2:606e) - ld b, 0 - ld c, $0 - ld hl, wcf17 - ld de, wTempHandCardList -.loop - ld a, [hli] - cp c - jr z, .loop +.asm_9e8e + ld a, $01 + call PlaySFXConfirmOrCancel + ld a, [wNamingScreenCursorY] + ld [wced7], a + ld de, wOwnedCardsCountList + ld hl, wcfd8 + ld [hl], e + inc hl + ld [hl], d + call Func_9c3f + jr .asm_9e52 + +.asm_9ea7 + ld a, [hffb3] + cp $ff + ret z + jr .asm_9e8e +; 0x9eaf + +Data_9eaf: + db $00, $05, $02, $00, $07, $0f, $00, $00, $00 + +Func_9eb8: ; 9eb8 (2:5eb8) + ld a, [wNamingScreenKeyboardHeight] + ld d, a + ld a, [wcea1] ld c, a - ld [de], a - inc de + ldh a, [hDPadHeld] + cp D_RIGHT + jr z, .right + cp D_LEFT + jr z, .left or a - jr z, .done - inc b - jr .loop -.done - ld a, b - ld [wced9], a ret -; 0xa08a -; prints the list of cards visible in the window -; of the confirmation screen -; card info is presented with name, level and -; its count preceded by "x" -PrintConfirmationCardList: ; a08a (2:608a) - push bc - ld hl, wced0 - ld e, [hl] - inc hl - ld d, [hl] - ld b, 19 ; x coord - ld c, e - dec c +.right ld a, [wcea1] - or a - jr z, .no_cursor - ld a, SYM_CURSOR_U - jr .got_cursor_tile_1 -.no_cursor - ld a, SYM_SPACE -.got_cursor_tile_1 - call WriteByteToBGMap0 + add d + ld b, a + add d + ld hl, wcfe6 + cp [hl] + jr c, .asm_9ee8 + ld a, [wcfe6] + sub d + ld b, a + jr .asm_9ee8 -; iterates by decreasing value in wcecb -; by 1 until it reaches 0 +.left ld a, [wcea1] - ld c, a - ld b, $0 - ld hl, wTempHandCardList - add hl, bc - ld a, [wcecb] -.loop_cards - push de - or a - jr z, .exit_loop + sub d ld b, a - ld a, [hli] - or a - jr z, .no_more_cards - ld e, a - call Func_9a59 - call LoadCardDataToBuffer1_FromCardID - ; places in wDefaultText the card's name and level - ; then appends at the end "x" with the count of that card - ; draws the card's type icon as well - ld a, 13 - push bc - push hl - push de - call CopyCardNameAndLevel - pop de - call .PrintCardCount - pop hl - pop bc - pop de - call .DrawCardTypeIcon - push hl - call InitTextPrinting - ld hl, wDefaultText - call ProcessText - pop hl + jr nc, .asm_9ee8 + ld b, $00 +.asm_9ee8 ld a, b - dec a - inc e - inc e - jr .loop_cards + ld [wcea1], a + cp c + jr z, .asm_9efa + ld a, SFX_01 + call PlaySFX + ld hl, wcece + call CallIndirect +.asm_9efa + scf + ret +; 0x9efc -.exit_loop - ld a, [hli] +Func_9efc: ; 9efc (2:5efc) + ld a, [wNamingScreenKeyboardHeight] + ld d, a + ld a, [wcea1] + ld c, a + ldh a, [hDPadHeld] + cp SELECT | D_DOWN + jr z, .sel_down + cp SELECT | D_UP + jr z, .sel_up or a - jr z, .no_more_cards - pop de - xor a - ld [wcecd], a - ld a, SYM_CURSOR_D - jr .got_cursor_tile_2 - -.no_more_cards - pop de - ld a, $01 - ld [wcecd], a - ld a, SYM_SPACE -.got_cursor_tile_2 - ld b, 19 ; x coord - ld c, e - dec c - dec c - call WriteByteToBGMap0 - pop bc ret -; prints the card count preceded by a cross -; for example "x42" -.PrintCardCount - push af - push bc - push de - push hl -.loop_search - ld a, [hl] - or a - jr z, .found_card_id - inc hl - jr .loop_search -.found_card_id - call Func_9850 - ld [hl], TX_SYMBOL - inc hl - ld [hl], SYM_CROSS - inc hl - call ConvertToNumericalDigits - ld [hl], TX_END - pop hl - pop de - pop bc - pop af +.sel_down + ld a, [wcea1] + add d + ld b, a + add d + ld hl, wcfe6 + cp [hl] + jr c, .asm_9f2c + ld a, [wcfe6] + sub d + ld b, a + jr .asm_9f2c +.sel_up + ld a, [wcea1] + sub d + ld b, a + jr nc, .asm_9f2c + ld b, $00 +.asm_9f2c + ld a, b + ld [wcea1], a + cp c + jr z, .set_carry + ld a, SFX_01 + call PlaySFX + ld hl, wcece + call CallIndirect +.set_carry + scf ret +; 0x9f40 -; draws the icon corresponding to the loaded card's type -; can be any of Pokemon stages (basic, 1st and 2nd stage) -; Energy or Trainer -; draws it 2 tiles to the left and 1 up to -; the current coordinate in de -.DrawCardTypeIcon - push hl - push de - push bc - ld a, [wLoadedCard1Type] - cp TYPE_ENERGY - jr nc, .not_pkmn_card - -; pokemon card - ld a, [wLoadedCard1Stage] - ld b, a - add b - add b - add b ; *4 - add ICON_TILE_BASIC_POKEMON - jr .got_tile +Func_9f40: ; 9f40 (2:5f40) + call Func_9f81 +.wait_input + call DoFrame + ldh a, [hKeysPressed] + and B_BUTTON + jr z, .wait_input + ld a, $ff + call PlaySFXConfirmOrCancel + ret +; 0x9f52 -.not_pkmn_card - cp TYPE_TRAINER - jr nc, .trainer_card +Func_9f52: ; 9f52 (2:5f52) + call Func_9f81 + lb de, 3, 5 + ld hl, wced0 + ld [hl], e + inc hl + ld [hl], d + call PrintConfirmationCardList + ret +; 0x9f62 -; energy card - sub TYPE_ENERGY - ld b, a - add b +; counts all values stored in wcebb +; if the total count is 0, then +; prints "No cards chosen." +Func_9f62: ; 9f62 (2:5f62) + lb bc, 0, 0 + ld hl, wcebb +.loop + ld a, [hli] add b - add b ; *4 - add ICON_TILE_FIRE - jr .got_tile - -.trainer_card - ld a, ICON_TILE_TRAINER -.got_tile - dec d - dec d - dec e - push af - lb hl, 1, 2 - lb bc, 2, 2 - call FillRectangle - pop af - - call GetCardTypeIconPalette ld b, a - ld a, [wConsole] - cp CONSOLE_CGB - jr nz, .skip_pal + inc c + ld a, $9 + cp c + jr nz, .loop ld a, b - lb bc, 2, 2 - lb hl, 0, 0 - call BankswitchVRAM1 - call FillRectangle - call BankswitchVRAM0 -.skip_pal - pop bc - pop de - pop hl + or a + ret nz + lb de, 11, 1 + call InitTextPrinting + ldtx hl, NoCardsChosenText + call ProcessTextFromID ret -; 0xa173 +; 0x9f81 -; returns in a the BG Pal corresponding to the -; card type icon in input register a -; if not found, returns $00 -GetCardTypeIconPalette: ; a173 (2:6173) - push bc - push hl - ld b, a - ld hl, .CardTypeIconPalettes -.loop - ld a, [hli] +Func_9f81: ; 9f81 (2:5f81) + call Func_8d56 + lb de, 0, 0 + lb bc, 20, 4 + call DrawRegularTextBox + ld a, [wcfb9] or a - jr z, .done + jp z, .print_card_count ; should be jr + call Func_9fc0 + ld a, [wceb1] + ld b, a + call EnableSRAM + ld a, [sCurrentlySelectedDeck] + call DisableSRAM cp b - jr z, .done - inc hl - jp .loop ; should be jr -.done - ld a, [hl] - pop hl - pop bc + jr nz, .print_card_count + lb de, 2, 1 + call DrawHandCardsTileAtDE + +.print_card_count + lb de, 14, 1 + call PrintTotalCardCount + lb de, 16, 1 + call PrintSlashSixty + call Func_9f62 + call EnableLCD ret +; 0x9fc0 -.CardTypeIconPalettes -; icon tile, BG pal - db ICON_TILE_FIRE, 1 - db ICON_TILE_GRASS, 2 - db ICON_TILE_LIGHTNING, 1 - db ICON_TILE_WATER, 2 - db ICON_TILE_FIGHTING, 3 - db ICON_TILE_PSYCHIC, 3 - db ICON_TILE_COLORLESS, 0 - db ICON_TILE_ENERGY, 2 - db ICON_TILE_BASIC_POKEMON, 2 - db ICON_TILE_STAGE_1_POKEMON, 2 - db ICON_TILE_STAGE_2_POKEMON, 1 - db ICON_TILE_TRAINER, 2 - db $00, $ff -; 0xa1a2 +Func_9fc0: ; 9fc0 (2:5fc0) + ld a, [wceb1] + cp $ff + jr z, .asm_9fea + lb de, 3, 2 + call InitTextPrinting + ld a, [wceb1] + bit 7, a + jr z, .asm_9fd8 + and $7f + jr .asm_9fd9 +.asm_9fd8 + inc a +.asm_9fd9 + ld hl, wDefaultText + call ConvertToNumericalDigits + ld [hl], $77 + inc hl + ld [hl], TX_END + ld hl, wDefaultText + call ProcessText -Func_a1a2: ; a1a2 (2:61a2) - ld hl, wcf17 - ld a, DECK_SIZE + $15 - call ClearNBytesFromHL - ld a, $ff - ld [wceb1], a - ld hl, .text - ld de, wcfb9 +.asm_9fea + ld hl, wcfb9 + ld de, wDefaultText call CopyListFromHLToDE - ld hl, .unknown_a1d8 - call Func_8d9d - call Func_9345 + ld a, [wceb1] + cp $ff + jr z, .asm_a01b + ld hl, wDefaultText + call GetTextLengthInTiles + ld b, $0 + ld hl, wDefaultText + add hl, bc + ld d, h + ld e, l + ld hl, Data_92a7 + call CopyListFromHLToDE + lb de, 6, 2 + ld hl, wDefaultText + call InitTextPrinting + call ProcessText ret -.text - text "Cards chosen to send" - db TX_END +.asm_a01b + lb de, 2, 2 + ld hl, wDefaultText + call InitTextPrinting + call ProcessText + ret +; 0xa028 -.unknown_a1d8 - db $3c, $3c, $00 - dw HandleSendDeckConfigurationMenu - dw SendDeckConfigurationMenu_TransitionTable +Func_a028: ; a028 (2:6028) + ld hl, wcf17 + ld de, wOpponentDeck + ld bc, wDuelTempList + ld a, -1 + ld [bc], a +.loop_copy + inc a + push af + ld a, [hli] + ld [de], a + inc de + or a + jr z, .sort_cards + pop af + ld [bc], a + inc bc + jr .loop_copy + +.sort_cards + pop af + ld a, $ff + ld [bc], a + ldh a, [hWhoseTurn] + push af + ld a, OPPONENT_TURN + ldh [hWhoseTurn], a + call SortCardsInDuelTempListByID + pop af + ldh [hWhoseTurn], a + + ld hl, wcf17 + ld de, wDuelTempList +.asm_a058 + ld a, [de] + cp $ff + jr z, .done + ld c, a + ld b, $0 + push hl + ld hl, wOpponentDeck + add hl, bc + ld a, [hl] + pop hl + ld [hli], a + inc de + jr .asm_a058 + +.done + xor a + ld [hl], a + ret +; 0xa06e + +; goes through list in wcf17, and for each card in it +; creates list in wOwnedCardsCountList of all unique cards +; it finds (assuming wcf17 is sorted by ID) +; also counts the number of the different cards +Func_a06e: ; a06e (2:606e) + ld b, 0 + ld c, $0 + ld hl, wcf17 + ld de, wOwnedCardsCountList +.loop + ld a, [hli] + cp c + jr z, .loop + ld c, a + ld [de], a + inc de + or a + jr z, .done + inc b + jr .loop +.done + ld a, b + ld [wced9], a + ret +; 0xa08a + +; prints the list of cards visible in the window +; of the confirmation screen +; card info is presented with name, level and +; its count preceded by "x" +PrintConfirmationCardList: ; a08a (2:608a) + push bc + ld hl, wced0 + ld e, [hl] + inc hl + ld d, [hl] + ld b, 19 ; x coord + ld c, e + dec c + ld a, [wcea1] + or a + jr z, .no_cursor + ld a, SYM_CURSOR_U + jr .got_cursor_tile_1 +.no_cursor + ld a, SYM_SPACE +.got_cursor_tile_1 + call WriteByteToBGMap0 + +; iterates by decreasing value in wcecb +; by 1 until it reaches 0 + ld a, [wcea1] + ld c, a + ld b, $0 + ld hl, wOwnedCardsCountList + add hl, bc + ld a, [wcecb] +.loop_cards + push de + or a + jr z, .exit_loop + ld b, a + ld a, [hli] + or a + jr z, .no_more_cards + ld e, a + call Func_9a59 + call LoadCardDataToBuffer1_FromCardID + ; places in wDefaultText the card's name and level + ; then appends at the end "x" with the count of that card + ; draws the card's type icon as well + ld a, 13 + push bc + push hl + push de + call CopyCardNameAndLevel + pop de + call .PrintCardCount + pop hl + pop bc + pop de + call .DrawCardTypeIcon + push hl + call InitTextPrinting + ld hl, wDefaultText + call ProcessText + pop hl + ld a, b + dec a + inc e + inc e + jr .loop_cards + +.exit_loop + ld a, [hli] + or a + jr z, .no_more_cards + pop de + xor a + ld [wcecd], a + ld a, SYM_CURSOR_D + jr .got_cursor_tile_2 + +.no_more_cards + pop de + ld a, $01 + ld [wcecd], a + ld a, SYM_SPACE +.got_cursor_tile_2 + ld b, 19 ; x coord + ld c, e + dec c + dec c + call WriteByteToBGMap0 + pop bc + ret + +; prints the card count preceded by a cross +; for example "x42" +.PrintCardCount + push af + push bc + push de + push hl +.loop_search + ld a, [hl] + or a + jr z, .found_card_id + inc hl + jr .loop_search +.found_card_id + call Func_9850 + ld [hl], TX_SYMBOL + inc hl + ld [hl], SYM_CROSS + inc hl + call ConvertToNumericalDigits + ld [hl], TX_END + pop hl + pop de + pop bc + pop af + ret + +; draws the icon corresponding to the loaded card's type +; can be any of Pokemon stages (basic, 1st and 2nd stage) +; Energy or Trainer +; draws it 2 tiles to the left and 1 up to +; the current coordinate in de +.DrawCardTypeIcon + push hl + push de + push bc + ld a, [wLoadedCard1Type] + cp TYPE_ENERGY + jr nc, .not_pkmn_card + +; pokemon card + ld a, [wLoadedCard1Stage] + ld b, a + add b + add b + add b ; *4 + add ICON_TILE_BASIC_POKEMON + jr .got_tile + +.not_pkmn_card + cp TYPE_TRAINER + jr nc, .trainer_card + +; energy card + sub TYPE_ENERGY + ld b, a + add b + add b + add b ; *4 + add ICON_TILE_FIRE + jr .got_tile + +.trainer_card + ld a, ICON_TILE_TRAINER +.got_tile + dec d + dec d + dec e + push af + lb hl, 1, 2 + lb bc, 2, 2 + call FillRectangle + pop af + + call GetCardTypeIconPalette + ld b, a + ld a, [wConsole] + cp CONSOLE_CGB + jr nz, .skip_pal + ld a, b + lb bc, 2, 2 + lb hl, 0, 0 + call BankswitchVRAM1 + call FillRectangle + call BankswitchVRAM0 +.skip_pal + pop bc + pop de + pop hl + ret +; 0xa173 + +; returns in a the BG Pal corresponding to the +; card type icon in input register a +; if not found, returns $00 +GetCardTypeIconPalette: ; a173 (2:6173) + push bc + push hl + ld b, a + ld hl, .CardTypeIconPalettes +.loop + ld a, [hli] + or a + jr z, .done + cp b + jr z, .done + inc hl + jp .loop ; should be jr +.done + ld a, [hl] + pop hl + pop bc + ret + +.CardTypeIconPalettes +; icon tile, BG pal + db ICON_TILE_FIRE, 1 + db ICON_TILE_GRASS, 2 + db ICON_TILE_LIGHTNING, 1 + db ICON_TILE_WATER, 2 + db ICON_TILE_FIGHTING, 3 + db ICON_TILE_PSYCHIC, 3 + db ICON_TILE_COLORLESS, 0 + db ICON_TILE_ENERGY, 2 + db ICON_TILE_BASIC_POKEMON, 2 + db ICON_TILE_STAGE_1_POKEMON, 2 + db ICON_TILE_STAGE_2_POKEMON, 1 + db ICON_TILE_TRAINER, 2 + db $00, $ff +; 0xa1a2 + +Func_a1a2: ; a1a2 (2:61a2) + ld hl, wcf17 + ld a, DECK_SIZE + $15 + call ClearNBytesFromHL + ld a, $ff + ld [wceb1], a + ld hl, .text + ld de, wcfb9 + call CopyListFromHLToDE + ld hl, .unknown_a1d8 + call Func_8d9d + call Func_9345 + ret + +.text + text "Cards chosen to send" + db TX_END + +.unknown_a1d8 + db $3c, $3c, $00 + dw HandleSendDeckConfigurationMenu + dw SendDeckConfigurationMenu_TransitionTable ; 0xa1df -SendDeckConfigurationMenu_TransitionTable: ; a1df (2:61df) - cursor_transition $10, $20, $00, $00, $00, $01, $02 - cursor_transition $48, $20, $00, $01, $01, $02, $00 - cursor_transition $80, $20, $00, $02, $02, $00, $01 +SendDeckConfigurationMenu_TransitionTable: ; a1df (2:61df) + cursor_transition $10, $20, $00, $00, $00, $01, $02 + cursor_transition $48, $20, $00, $01, $01, $02, $00 + cursor_transition $80, $20, $00, $02, $02, $00, $01 + +SendDeckConfigurationMenuData: ; a1f4 (2:61f4) + textitem 2, 2, ConfirmText + textitem 9, 2, SendText + textitem 16, 2, CancelText + db $ff + +HandleSendDeckConfigurationMenu: ; a201 (2:6201) + ld de, $0 + lb bc, 20, 6 + call DrawRegularTextBox + ld hl, SendDeckConfigurationMenuData + call PlaceTextItems + ld a, $ff + ld [wDuelInitialPrizesUpperBitsSet], a +.loop_input + ld a, $01 + ld [wVBlankOAMCopyToggle], a + call DoFrame + call Func_89ae + jr nc, .loop_input + ld [wced6], a + cp $ff + jr nz, .asm_a23b + call DrawCardTypeIconsAndPrintCardCounts + ld a, [wced4] + ld [wNamingScreenCursorY], a + ld a, [wCurCardTypeFilter] + call Func_993d + jp Func_9345.skip_draw +.asm_a23b + ld hl, .func_table + call JumpToFunctionInTable + jp Func_9461.asm_9475 + +.func_table + dw ConfirmDeckConfiguration ; Confirm + dw SendDeckConfiguration ; Send + dw CancelSendDeckConfiguration ; Cancel +; 0xa24a + +SendDeckConfiguration: ; a24a (2:624a) + ld a, [wcf17] + or a + jr z, CancelSendDeckConfiguration + xor a + ld [wcea1], a + ld hl, Data_b04a + call Func_9a6d + ld hl, wcf17 + ld de, wDuelTempList + call CopyListFromHLToDE + call Func_b131 + call Func_b088 + call EnableLCD + ldtx hl, SendTheseCardsText + call YesOrNoMenuWithText + jr nc, .asm_a279 + add sp, $2 + jp Func_9345.skip_count +.asm_a279 + add sp, $2 + scf + ret + +CancelSendDeckConfiguration: ; a27d (2:627d) + add sp, $2 + or a + ret +; 0xa281 + +; copies b bytes from hl to de +CopyNBytesFromHLToDE: ; a281 (2:6281) + ld a, [hli] + ld [de], a + inc de + dec b + jr nz, CopyNBytesFromHLToDE + ret +; 0xa288 + +Func_a288: ; a288 (2:6288) + call Func_8ce7 + call Func_a4c6 + xor a + ld [wcea1], a + ld [wCurCardTypeFilter], a + call Func_a39f + call EnableLCD + xor a + ld hl, Data_9667 + call Func_9a6d +.asm_a2a2 + call DoFrame + ld a, [wCurCardTypeFilter] + ld b, a + ld a, [wNamingScreenCursorY] + cp b + jr z, .asm_a2cc + ld [wCurCardTypeFilter], a + ld hl, wcea1 + ld [hl], $00 + call Func_a39f + + ld hl, hffb0 + ld [hl], $01 + call Func_a4de + ld hl, hffb0 + ld [hl], $00 + + ld a, $09 + ld [wNamingScreenKeyboardHeight], a +.asm_a2cc + ldh a, [hDPadHeld] + and D_DOWN + jr z, .asm_a2d7 + call Func_9ad7 + jr .asm_a2e4 + +.asm_a2d7 + call Func_9a83 + jr nc, .asm_a2a2 + ld a, [hffb3] + cp $ff + jr nz, .asm_a2e4 + ret + +.asm_a2e4 + ld a, [wceae] + or a + jr z, .asm_a2a2 + + xor a + ld hl, Data_a396 + call Func_9a6d + ld a, [wceae] + ld [wcfe6], a + ld hl, wcecb + cp [hl] + jr nc, .asm_a300 + ld [wNamingScreenKeyboardHeight], a +.asm_a300 + ld hl, PrintCardSelectionList + ld d, h + ld a, l + ld hl, wcece + ld [hli], a + ld [hl], d + xor a + ld [wced2], a + +.loop_input + call DoFrame + call Func_9efc + jr c, .loop_input + call Func_9b25 + jr c, .asm_a36a + ldh a, [hDPadHeld] + and START + jr z, .loop_input + ; start btn pressed + +.asm_a321 + ld a, $01 + call PlaySFXConfirmOrCancel + ld a, [wNamingScreenKeyboardHeight] + ld [wcfdf], a + ld a, [wNamingScreenCursorY] + ld [wced4], a + ld de, wHandTempList + ld hl, wcfd8 + ld [hl], e + inc hl + ld [hl], d + call Func_9c3f + call Func_a4c6 + ld hl, Data_9667 + call Func_9a6d + ld a, [wCurCardTypeFilter] + ld [wNamingScreenCursorY], a + call Func_9b20 + call PrintCardSelectionList + call EnableLCD + ld hl, Data_a396 + call Func_9a6d + ld a, [wcfdf] + ld [wNamingScreenKeyboardHeight], a + ld a, [wced4] + ld [wNamingScreenCursorY], a + jr .loop_input + +.asm_a36a + call Func_9c0e + ld a, [wNamingScreenCursorY] + ld [wced4], a + ld a, [hffb3] + cp $ff + jr nz, .asm_a321 + ld hl, Data_9667 + call Func_9a6d + ld a, [wCurCardTypeFilter] + ld [wNamingScreenCursorY], a + ld hl, hffb0 + ld [hl], $01 + call Func_a4de + ld hl, hffb0 + ld [hl], $00 + jp .asm_a2a2 +; 0xa396 + +Data_a396: ; a396 (2:6396) + db $01, $05, $02, $00, $07, $0f, $00, $00, $00 +; 0xa39f + +; a = which card type filter +Func_a39f: ; a39f (2:639f) + push af + ld hl, CardTypeFilters + ld b, $00 + ld c, a + add hl, bc + ld a, [hl] + push af + ld a, $ff + call Func_a3ca + pop af + call CreateFilteredCardList + + ld a, $07 + ld [wcecb], a + lb de, 2, 5 + ld hl, wced0 + ld [hl], e + inc hl + ld [hl], d + ld a, SYM_SPACE + ld [wCursorAlternateTile], a + call PrintCardSelectionList + pop af + ret +; 0xa3ca + +Func_a3ca: ; a3ca (2:63ca) + ld [hffb5], a + ld hl, sCardCollection + ld de, wTempCardCollection + ld b, $ff + call EnableSRAM + call CopyNBytesFromHLToDE + call DisableSRAM +; deck_1 + ld a, [hffb5] ; should be ldh + bit 0, a + jr z, .deck_2 + ld de, sDeck1Cards + call GetDeckCardCounts +.deck_2 + ld a, [hffb5] ; should be ldh + bit 1, a + jr z, .deck_3 + ld de, sDeck2Cards + call GetDeckCardCounts +.deck_3 + ld a, [hffb5] ; should be ldh + bit 2, a + jr z, .deck_4 + ld de, sDeck3Cards + call GetDeckCardCounts +.deck_4 + ld a, [hffb5] ; should be ldh + bit 3, a + ret z + ld de, sDeck4Cards + call GetDeckCardCounts + ret +; 0xa412 + +; goes through deck cards in de +; and gets the count of each card ID +; in wTempCardCollection in card collection order +GetDeckCardCounts: ; a412 (2:6412) + call EnableSRAM + ld bc, wTempCardCollection + ld h, DECK_SIZE +.loop + ld a, [de] + inc de + or a + jr z, .done + push hl + ld h, $0 + ld l, a + add hl, bc + inc [hl] + pop hl + dec h + jr nz, .loop +.done + call DisableSRAM + ret +; 0xa42d + +; prints the name, level and storage count of the cards +; that are visible in the list window +; in the form: +; CARD NAME/LEVEL X +; where X is the current count of that card +PrintCardSelectionList: ; a42d (2:642d) + push bc + ld hl, wced0 + ld e, [hl] + inc hl + ld d, [hl] + ld b, 19 ; x coord + ld c, e + ld a, [wcea1] + or a + jr z, .alternate_cursor_tile + ld a, SYM_CURSOR_U + jr .got_cursor_tile_1 +.alternate_cursor_tile + ld a, [wCursorAlternateTile] +.got_cursor_tile_1 + call WriteByteToBGMap0 + +; iterates by decreasing value in wcecb +; by 1 until it reaches 0 + ld a, [wcea1] + ld c, a + ld b, $0 + ld hl, wFilteredCardList + add hl, bc + ld a, [wcecb] +.loop_filtered_cards + push de + or a + jr z, .exit_loop + ld b, a + ld a, [hli] + or a + jr z, .invalid_card ; card ID of 0 + ld e, a + call Func_9a59 + call LoadCardDataToBuffer1_FromCardID + ; places in wDefaultText the card's name and level + ; then appends at the end the count of that card + ; in the card storage + ld a, 14 + push bc + push hl + push de + call CopyCardNameAndLevel + pop de + call AppendOwnedCardCountNumber + pop hl + pop bc + pop de + push hl + call InitTextPrinting + ld hl, wDefaultText + jr .process_text +.invalid_card + pop de + push hl + call InitTextPrinting + ld hl, Text_9a36 +.process_text + call ProcessText + pop hl + + ld a, b + dec a + inc e + inc e + jr .loop_filtered_cards + +.exit_loop + ld a, [hli] + or a + jr z, .cannot_scroll + pop de +; draw down cursor because +; there are still more cards +; to be scrolled down + xor a + ld [wcecd], a + ld a, SYM_CURSOR_D + jr .got_cursor_tile_2 +.cannot_scroll + pop de + ld a, $01 + ld [wcecd], a + ld a, [wCursorAlternateTile] +.got_cursor_tile_2 + ld b, 19 ; x coord + ld c, e + dec c + dec c + call WriteByteToBGMap0 + pop bc + ret +; 0xa4ae + +; appends the card count given in register e +; to the list in hl, in numerical form +; (i.e. its numeric symbol representation) +AppendOwnedCardCountNumber: ; a4ae (2:64ae) + push af + push bc + push de + push hl +; increment hl until end is reached ($00 byte) +.loop + ld a, [hl] + or a + jr z, .end + inc hl + jr .loop +.end + call GetOwnedCardCount + call ConvertToNumericalDigits + ld [hl], $00 ; insert byte terminator + pop hl + pop de + pop bc + pop af + ret +; 0xa4c6 + +Func_a4c6: ; a4c6 (2:64c6) + call Set_OBJ_8x8 + call Func_8d78 +; fallthrough + +Func_a4cc: ; a4cc (2:64cc) + lb bc, 0, 4 + ld a, SYM_BOX_TOP + call FillBGMapLineWithA + call PrintTotalNumberOfCardsInCollection + call Func_a4de + call DrawCardTypeIcons + ret +; 0xa4de + +Func_a4de: ; a4de (2:64de) + ld de, $100 + call InitTextPrinting + ld de, wc590 + call CopyPlayerName + ld hl, wc590 + call ProcessText + ld hl, wc590 + call GetTextLengthInTiles + inc b + ld d, b + ld e, $00 + call InitTextPrinting + ldtx hl, SCardsText + call ProcessTextFromID + ret +; 0xa504 + +PrintTotalNumberOfCardsInCollection: ; a504 (2:6504) + ld a, $ff + call Func_a3ca + +; count all the cards in collection + ld de, wTempCardCollection + 1 + ld b, 0 + ld hl, 0 +.loop_all_cards + ld a, [de] + inc de + and $7f + push bc + ld b, $00 + ld c, a + add hl, bc + pop bc + inc b + ld a, NUM_CARDS + cp b + jr nz, .loop_all_cards + +; hl = total number of cards in collection + call .GetTotalCountDigits + ld hl, wTempCardCollection + ld de, wOnesAndTensPlace + ld b, $00 + call .PlaceNumericalChar + call .PlaceNumericalChar + call .PlaceNumericalChar + call .PlaceNumericalChar + call .PlaceNumericalChar + ld a, $07 + ld [hli], a + ld [hl], TX_END + ld de, $d00 + call InitTextPrinting + ld hl, wTempCardCollection + call ProcessText + ret + +; places a numerical character in hl from de +; doesn't place a 0 if no non-0 +; numerical character has been placed before +; this makes it so that there are no +; 0s in more significant digits +.PlaceNumericalChar + ld [hl], TX_SYMBOL + inc hl + ld a, b + or a + jr z, .leading_num + ld a, [de] + inc de + ld [hli], a + ret +.leading_num +; don't place a 0 as a leading number + ld a, [de] + inc de + cp SYM_0 + jr z, .space_char + ld [hli], a + ld b, $01 ; at least one non-0 char was placed + ret +.space_char + xor a ; SYM_SPACE + ld [hli], a + ret + +; gets the digits in decimal form +; of value stored in hl +; stores the result in wOnesAndTensPlace +.GetTotalCountDigits + ld de, wOnesAndTensPlace + ld bc, -10000 + call .GetDigit + ld bc, -1000 + call .GetDigit + ld bc, -100 + call .GetDigit + ld bc, -10 + call .GetDigit + ld bc, -1 + call .GetDigit + ret + +.GetDigit + ld a, SYM_0 - 1 +.loop + inc a + add hl, bc + jr c, .loop + ld [de], a + inc de + ld a, l + sub c + ld l, a + ld a, h + sbc b + ld h, a + ret +; 0xa596 + +; a = CARD_SET_* constant +Func_a596: ; a596 (2:6596) + push af + ld a, DECK_SIZE + ld hl, wHandTempList + call ClearNBytesFromHL + ld a, DECK_SIZE + ld hl, wOwnedCardsCountList + call ClearNBytesFromHL + xor a + ld [wcfe2], a + pop af + + ld hl, 0 + lb de, 0, 0 + ld b, a +.loop_all_cards + inc e + call LoadCardDataToBuffer1_FromCardID + jr c, .asm_a5e6 + ld a, [wLoadedCard1Set] + and $f0 ; set 1 + swap a + cp b + jr nz, .loop_all_cards + +; it's same set as input + ld a, e + cp VENUSAUR1 + jp z, .Func_a681 + cp MEW2 + jp z, .Func_a667 + + push bc + push hl + ld bc, wHandTempList + add hl, bc + ld [hl], e ; card ID + + ld hl, wTempCardCollection + add hl, de + ld a, [hl] + pop hl + push hl + ld bc, wOwnedCardsCountList + add hl, bc + ld [hl], a ; card count in collection + pop hl + + inc l + pop bc + jr .loop_all_cards + +.asm_a5e6 + ld a, b + cp CARD_SET_MYSTERY + jr z, .mystery + or a + jr nz, .not_colosseum_or_mystery + +; colosseum +; places all basic energy cards in wHandTempList + lb de, 0, 0 +.loop_basic_energy_cards + inc e + ld a, e + cp DOUBLE_COLORLESS_ENERGY + jr z, .not_colosseum_or_mystery + push bc + push hl + ld bc, wHandTempList + add hl, bc + ld [hl], e + ld hl, wTempCardCollection + add hl, de + ld a, [hl] + pop hl + push hl + ld bc, wOwnedCardsCountList + add hl, bc + ld [hl], a + pop hl + inc l + pop bc + jr .loop_basic_energy_cards + +.mystery +; places double colorless energy card in wHandTempList + lb de, 0, 0 +.loop_find_double_colorless + inc e + ld a, e + cp BULBASAUR + jr z, .not_colosseum_or_mystery + cp DOUBLE_COLORLESS_ENERGY + jr nz, .loop_find_double_colorless + ; double colorless energy + push bc + push hl + ld bc, wHandTempList + add hl, bc + ld [hl], e + ld hl, wTempCardCollection + add hl, de + ld a, [hl] + pop hl + push hl + ld bc, wOwnedCardsCountList + add hl, bc + ld [hl], a + pop hl + inc l + pop bc + jr .loop_find_double_colorless + +.not_colosseum_or_mystery + ld a, [wcfe2] + bit 0, a + jr z, .asm_a63e + call .Func_a685 +.asm_a63e + bit 1, a + jr z, .asm_a645 + call .Func_a69a + +.asm_a645 + dec l + ld c, l + ld b, h +.loop_owned_cards + ld hl, wOwnedCardsCountList + add hl, bc + ld a, [hl] + cp $80 + jr nz, .found_not_owned + dec c + jr .loop_owned_cards + +.found_not_owned + inc c + ld a, c + ld [wceae], a + xor a + ld hl, wHandTempList + add hl, bc + ld [hl], a + ld a, $ff + ld hl, wOwnedCardsCountList + add hl, bc + ld [hl], a + ret + +.Func_a667 + ld a, $02 +; fallthrough + +.Func_a669 + push hl + push bc + ld b, a + ld hl, wTempCardCollection + add hl, de + ld a, [hl] + cp $80 + jr z, .asm_a67c + ld a, [wcfe2] + or b + ld [wcfe2], a +.asm_a67c + pop bc + pop hl + jp .loop_all_cards + +.Func_a681 + ld a, $01 + jr .Func_a669 + +.Func_a685 + push af + push hl + ld e, VENUSAUR1 +; fallthrough + +.Func_a689 + ld bc, wHandTempList + add hl, bc + ld [hl], e + pop hl + push hl + ld bc, wOwnedCardsCountList + add hl, bc + ld [hl], $01 + pop hl + inc l + pop af + ret + +.Func_a69a + push af + push hl + ld e, MEW2 + jr .Func_a689 +; 0xa6a0 + +; a = CARD_SET_* constant +Func_a6a0: ; a6a0 (2:66a0) + push af + ld hl, sCardCollection + ld de, wTempCardCollection + ld b, $ff + call EnableSRAM + call CopyNBytesFromHLToDE + call DisableSRAM + pop af + + push af + call Func_a6ca + call Func_a596 + ld a, $07 + ld [wcecb], a + ld de, $204 + ld hl, wced0 + ld [hl], e + inc hl + ld [hl], d + pop af + ret +; 0xa6ca + +; a = CARD_SET_* constant +Func_a6ca: ; a6ca (2:66ca) + push af + cp CARD_SET_PROMOTIONAL + jr nz, .asm_a6d4 + ld de, $33f + jr .asm_a6f2 +.asm_a6d4 + cp CARD_SET_LABORATORY + jr nz, .asm_a6dd + ld de, $333 + jr .asm_a6f2 +.asm_a6dd + cp CARD_SET_MYSTERY + jr nz, .asm_a6e6 + ld de, $332 + jr .asm_a6f2 +.asm_a6e6 + cp CARD_SET_EVOLUTION + jr nz, .asm_a6ef + ld de, $331 + jr .asm_a6f2 +.asm_a6ef + ld de, $330 +.asm_a6f2 + ld hl, wcfb9 + ld [hl], d + inc hl + ld [hl], e + pop af + ret +; 0xa6fa + +Func_a6fa: ; a6fa (2:66fa) + push bc + ld hl, wced0 + ld e, [hl] + inc hl + ld d, [hl] + ld b, $13 + ld c, e + dec c + dec c + ld a, [wcea1] + or a + jr z, .asm_a710 + ld a, $0c + jr .asm_a712 +.asm_a710 + ld a, $19 +.asm_a712 + call WriteByteToBGMap0 + ld a, [wcea1] + ld l, a + ld h, $00 + ld a, [wcecb] +.asm_a71e + push de + or a + jr z, .asm_a777 + ld b, a + ld de, wHandTempList + push hl + add hl, de + ld a, [hl] + pop hl + inc l + or a + jr z, .asm_a788 + ld e, a + call Func_9a59 + call LoadCardDataToBuffer1_FromCardID + push bc + push hl + ld de, wOwnedCardsCountList + add hl, de + dec hl + ld a, [hl] + cp $80 + jr nz, .asm_a74c + ld hl, $6799 + ld de, wc590 + call CopyListFromHLToDE + jr .asm_a751 +.asm_a74c + ld a, $0d + call CopyCardNameAndLevel +.asm_a751 + pop hl + pop bc + pop de + push hl + call InitTextPrinting + pop hl + push hl + call Func_a7a7 + call ProcessText + ld hl, wc590 + jr .asm_a76d + pop de + push hl + call InitTextPrinting + ld hl, Text_9a36 +.asm_a76d + call ProcessText + pop hl + ld a, b + dec a + inc e + inc e + jr .asm_a71e +.asm_a777 + ld de, wHandTempList + add hl, de + ld a, [hl] + or a + jr z, .asm_a788 + pop de + xor a + ld [wcecd], a + ld a, $2f + jr .asm_a790 +.asm_a788 + pop de + ld a, $01 + ld [wcecd], a + ld a, $1b +.asm_a790 + ld b, $13 + ld c, $11 + call WriteByteToBGMap0 + pop bc + ret +; 0xa799 + + INCROM $a799, $a7a7 + +Func_a7a7: ; a7a7 (2:67a7) + push bc + push de + ld de, wHandTempList + add hl, de + dec hl + ld a, [hl] + cp BULBASAUR + jr c, .energy_card + cp VENUSAUR1 + jr z, .phantom_card + cp MEW2 + jr z, .phantom_card + + ld a, [wcecb] + sub b + ld hl, wcea1 + add [hl] + inc a + call CalculateOnesAndTensDigits + ld hl, wOnesAndTensPlace + ld a, [hli] + ld b, a + ld a, [hl] + or a + jr nz, .asm_a7d2 + ld a, SYM_0 +.asm_a7d2 + ld hl, wcfb9 + 2 + ld [hl], TX_SYMBOL + inc hl + ld [hli], a + ld [hl], TX_SYMBOL + inc hl + ld a, b + ld [hli], a + ld [hl], TX_SYMBOL + inc hl + xor a + ld [hli], a + ld [hl], a + ld hl, wcfb9 + pop de + pop bc + ret + +.energy_card + call CalculateOnesAndTensDigits + ld hl, wOnesAndTensPlace + ld a, [hli] + ld b, a + ld hl, wcfb9 + 2 + ld de, $334 + ld [hl], d + inc hl + ld [hl], e + inc hl + ld [hl], TX_SYMBOL + inc hl + ld a, SYM_0 + ld [hli], a + ld [hl], TX_SYMBOL + inc hl + ld a, b + ld [hli], a + ld [hl], TX_SYMBOL + inc hl + xor a + ld [hli], a + ld [hl], a + ld hl, wcfb9 + 2 + pop de + pop bc + ret + +.phantom_card + ld hl, wcfb9 + 2 + ld [hl], $6c + inc hl + ld [hl], $6c + inc hl + ld [hl], TX_SYMBOL + inc hl + xor a + ld [hli], a + ld [hl], a + ld hl, wcfb9 + pop de + pop bc + ret +; 0xa828 + +Func_a828: ; a828 (2:6828) + ld a, [wNamingScreenCursorY] + ld b, a + ld a, [wcea1] + add b + ld c, a + ld b, $00 + ld hl, wOwnedCardsCountList + add hl, bc + ld a, [hl] + cp $80 + jr z, .handle_input + + ld hl, wcfd8 + ld a, [hli] + ld h, [hl] + ld l, a + add hl, bc + ld e, [hl] + ld d, $00 + push de + call LoadCardDataToBuffer1_FromCardID + lb de, $38, $9f + call SetupText + bank1call OpenCardPage_FromCheckHandOrDiscardPile + pop de + +.handle_input + ldh a, [hDPadHeld] + ld b, a + and A_BUTTON | B_BUTTON | SELECT | START + jp nz, .asm_a8f5 + xor a ; FALSE + ld [wPlaysSfx], a + ld a, [wNamingScreenKeyboardHeight] + ld c, a + ld a, [wNamingScreenCursorY] + bit D_UP_F, b + jr z, .asm_a891 + + push af + ld a, TRUE + ld [wPlaysSfx], a + ld a, [wNamingScreenCursorY] + ld hl, wcea1 + add [hl] + ld hl, wcfe5 + cp [hl] + jr z, .open_card_page_pop_af + pop af + + dec a + bit 7, a + jr z, .asm_a8c3 + ld a, [wcea1] + or a + jr z, .open_card_page + dec a + ld [wcea1], a + xor a + jr .asm_a8c3 + +.asm_a891 + bit D_DOWN_F, b + jr z, .asm_a8d6 + + push af + ld a, TRUE + ld [wPlaysSfx], a + pop af + + inc a + cp c + jr c, .asm_a8c3 + push af + ld hl, wcfd8 + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wNamingScreenCursorY] + ld c, a + ld b, $00 + add hl, bc + ld a, [wcea1] + inc a + ld c, a + ld b, $00 + add hl, bc + ld a, [hl] + or a + jr z, .asm_a8d3 + ld a, [wcea1] + inc a + ld [wcea1], a + pop af + dec a +.asm_a8c3 + ld [wNamingScreenCursorY], a + ld a, [wPlaysSfx] + or a + jp z, Func_a828 + call PlaySFX + jp Func_a828 +.asm_a8d3 + pop af + jr .open_card_page + +.asm_a8d6 + ld a, [wced2] + or a + jr z, .open_card_page + bit D_LEFT_F, b + jr z, .asm_a8e5 + call Func_9dfa + jr .open_card_page +.asm_a8e5 + bit D_RIGHT_F, b + jr z, .open_card_page + call Func_9d22 + +.open_card_page_pop_af + pop af +.open_card_page + push de + bank1call OpenCardPage.input_loop + pop de + jp .handle_input + +.asm_a8f5 + ld a, $01 + ld [wVBlankOAMCopyToggle], a + ld a, [wNamingScreenCursorY] + ld [wced4], a + ret +; 0xa901 + +Func_a901: ; a901 (2:6901) + ld hl, wOwnedCardsCountList + ld b, $00 +.asm_a906 + ld a, [hli] + cp $80 + jr nz, .asm_a90e + inc b + jr .asm_a906 +.asm_a90e + ld a, b + ld [wcfe5], a + ret +; 0xa913 + +Func_a913: ; a913 (2:6913) + ld a, $01 + ld [hffb4], a ; should be ldh + + xor a +.asm_a919 + ld hl, .MenuParameters + call InitializeMenuParameters + call .Func_aade +.loop_input_1 + call DoFrame + call HandleMenuInput + jp nc, .loop_input_1 ; should be jr + ldh a, [hCurMenuItem] + cp $ff + ret z + ld c, a + ld b, $00 + ld hl, wcec4 + add hl, bc + ld a, [hl] + or a + jr nz, .loop_input_1 + + ld a, c + ld [wcfe0], a + call Func_a6a0 + call .Func_aa24 + xor a + ld [wcea1], a + call Func_a6fa + call EnableLCD + ld a, [wceae] + or a + jr nz, .asm_a968 + +.loop_input_2 + call DoFrame + ldh a, [hKeysPressed] + and B_BUTTON + jr z, .loop_input_2 + ld a, $ff + call PlaySFXConfirmOrCancel + ldh a, [hCurMenuItem] + jp .asm_a919 + +.asm_a968 + call .Func_aa13 + xor a + ld hl, .data_aa0a + call Func_9a6d + ld a, [wceae] + ld hl, wcecb + cp [hl] + jr nc, .asm_a97e + ld [wNamingScreenKeyboardHeight], a +.asm_a97e + ld hl, Func_a6fa + ld d, h + ld a, l + ld hl, wcece + ld [hli], a + ld [hl], d + + xor a + ld [wced2], a +.loop_input_3 + call DoFrame + call Func_9b25 + jr c, .asm_a9ed + call Func_9eb8 + jr c, .loop_input_3 + ldh a, [hDPadHeld] + and START + jr z, .loop_input_3 +.asm_a99f + ld a, $01 + call PlaySFXConfirmOrCancel + ld a, [wNamingScreenKeyboardHeight] + ld [wcfdf], a + ld a, [wNamingScreenCursorY] + ld [wced4], a + ld c, a + ld a, [wcea1] + add c + ld hl, wOwnedCardsCountList + ld c, a + ld b, $00 + add hl, bc + ld a, [hl] + cp $80 + jr z, .loop_input_3 + ld de, wHandTempList + ld hl, wcfd8 + ld [hl], e + inc hl + ld [hl], d + call Func_a901 + call Func_a828 + call .Func_aa24 + call Func_a6fa + call EnableLCD + ld hl, .data_aa0a + call Func_9a6d + ld a, [wcfdf] + ld [wNamingScreenKeyboardHeight], a + ld a, [wced4] + ld [wNamingScreenCursorY], a + jr .loop_input_3 + +.asm_a9ed + call Func_9c0e + ld a, [wNamingScreenCursorY] + ld [wced4], a + ld a, [hffb3] + cp $ff + jr nz, .asm_a99f + ldh a, [hCurMenuItem] + jp .asm_a919 + +.MenuParameters + db 3, 3 ; cursor x, cursor y + db 2 ; y displacement between items + db 5 ; number of items + db SYM_CURSOR_R ; cursor tile number + db SYM_SPACE ; tile behind cursor + dw NULL ; function pointer if non-0 + +.data_aa0a + db $01, $04, $02, $00, $07, $0f, $00, $00, $00 + +.Func_aa13 + ld hl, wHandTempList + ld b, $00 +.asm_aa18 + ld a, [hli] + or a + jr z, .asm_aa1f + inc b + jr .asm_aa18 +.asm_aa1f + ld a, b + ld [wcfe6], a + ret + +.Func_aa24 + call Set_OBJ_8x8 + xor a + ld [wTileMapFill], a + call ZeroObjectPositions + call EmptyScreen + ld a, $01 + ld [wVBlankOAMCopyToggle], a + call LoadCursorTile + call LoadSymbolsFont + call LoadDuelCardSymbolTiles + bank1call SetDefaultPalettes + lb de, $3c, $ff + call SetupText + ld de, $101 + call InitTextPrinting + + ld a, [wcfe0] + cp CARD_SET_PROMOTIONAL + jr nz, .check_laboratory + ldtx hl, Item5PromotionalCardText + ld e, 18 + ld a, [wcfe2] + bit 0, a + jr z, .asm_aa62 + inc e ; 19 +.asm_aa62 + bit 1, a + jr z, .asm_aa8f + inc e ; 20 + jr .asm_aa8f +.check_laboratory + cp CARD_SET_LABORATORY + jr nz, .check_mystery + ldtx hl, Item4LaboratoryText + ld e, 51 + jr .asm_aa8f +.check_mystery + cp CARD_SET_MYSTERY + jr nz, .check_evolution + ldtx hl, Item3MysteryText + ld e, 51 + jr .asm_aa8f +.check_evolution + cp CARD_SET_EVOLUTION + jr nz, .colosseum + ldtx hl, Item2EvolutionText + ld e, 50 + jr .asm_aa8f +.colosseum + ldtx hl, Item1ColosseumText + ld e, 56 + +.asm_aa8f + push de + call ProcessTextFromID + call .Func_aac8 + ld de, SerialHandleSend.send_escaped + call InitTextPrinting + + ld a, [wcfe1] + ld hl, wc590 + call ConvertToNumericalDigits + call CalculateOnesAndTensDigits + ld [hl], TX_SYMBOL + inc hl + ld [hl], SYM_SLASH + inc hl + pop de + + ld a, e + call ConvertToNumericalDigits + ld [hl], TX_END + ld hl, wc590 + call ProcessText + lb de, 0, 2 + lb bc, 20, 16 + call DrawRegularTextBox + call EnableLCD + ret + +.Func_aac8 + ld hl, wOwnedCardsCountList + ld b, $00 +.asm_aacd + ld a, [hli] + cp $ff + jr z, .asm_aad9 + cp $80 + jr z, .asm_aacd + inc b + jr .asm_aacd +.asm_aad9 + ld a, b + ld [wcfe1], a + ret + +.Func_aade + xor a + ld [wTileMapFill], a + call EmptyScreen + ld a, [hffb4] + dec a + jr nz, .asm_ab0b + ld [hffb4], a + call Set_OBJ_8x8 + call ZeroObjectPositions + ld a, $01 + ld [wVBlankOAMCopyToggle], a + call LoadCursorTile + call LoadSymbolsFont + call LoadDuelCardSymbolTiles + bank1call SetDefaultPalettes + lb de, $3c, $ff + call SetupText + +.asm_ab0b + lb de, 0, 0 + lb bc, 20, 13 + call DrawRegularTextBox + ld hl, .BoosterPacksMenuData + call PlaceTextItems + ld a, 5 + ld hl, wcec4 + call ClearNBytesFromHL + call EnableSRAM + ld a, [sb703] + call DisableSRAM + or a + jr nz, .asm_ab58 + + ld a, CARD_SET_PROMOTIONAL + call Func_a6a0 + ld a, [wHandTempList] + or a + jr nz, .asm_ab4d + ld a, $01 + ld [wcec4 + 4], a + ld e, $0b + ld d, $05 + call InitTextPrinting + ldtx hl, Text0259 + call ProcessTextFromID + jr .asm_ab58 + +.asm_ab4d + call EnableSRAM + ld a, $01 + ld [sb703], a + call DisableSRAM +.asm_ab58 + ldtx hl, ViewWhichCardFileText + call DrawWideTextBox_PrintText + call EnableLCD + ret + +.BoosterPacksMenuData + textitem 7, 1, BoosterPackTitleText + textitem 5, 3, Item1ColosseumText + textitem 5, 5, Item2EvolutionText + textitem 5, 7, Item3MysteryText + textitem 5, 9, Item4LaboratoryText + textitem 5, 11, Item5PromotionalCardText + db $ff +; 0xab7b + +PrinterMenu_PokemonCards: ; ab7b (2:6b7b) + call Func_8ce7 + call Func_a4c6 + xor a + ld [wcea1], a + ld [wCurCardTypeFilter], a + call Func_a39f + call EnableLCD + xor a + ld hl, Data_9667 + call Func_9a6d + +.loop_frame_1 + call DoFrame + ld a, [wCurCardTypeFilter] + ld b, a + ld a, [wNamingScreenCursorY] + cp b + jr z, .handle_input + ld [wCurCardTypeFilter], a + ld hl, wcea1 + ld [hl], $00 + call Func_a39f + ld hl, hffb0 + ld [hl], $01 + call Func_a4de + ld hl, hffb0 + ld [hl], $00 + ld a, $09 + ld [wNamingScreenKeyboardHeight], a +.handle_input + ldh a, [hDPadHeld] + and D_DOWN + jr z, .asm_abca +; d_down + call Func_9ad7 + jr .asm_abd7 +.asm_abca + call Func_9a83 + jr nc, .loop_frame_1 + ld a, [hffb3] + cp $ff + jr nz, .asm_abd7 + ret + +.asm_abd7 + ld a, [wceae] + or a + jr z, .loop_frame_1 + + xor a + ld hl, Data_a396 + call Func_9a6d + ld a, [wceae] + ld [wcfe6], a + ld hl, wcecb + cp [hl] + jr nc, .asm_abf6 + ld [wNamingScreenKeyboardHeight], a + ld [wcfdf], a +.asm_abf6 + ld hl, PrintCardSelectionList + ld d, h + ld a, l + ld hl, wcece + ld [hli], a + ld [hl], d + xor a + ld [wced2], a + +.loop_frame_2 + call DoFrame + call Func_9efc + jr c, .loop_frame_2 + call Func_9b25 + jr c, .asm_ac60 + ldh a, [hDPadHeld] + and START + jr z, .loop_frame_2 +; start btn + ld a, $01 + call PlaySFXConfirmOrCancel + ld a, [wNamingScreenKeyboardHeight] + ld [wcfdf], a + ld a, [wNamingScreenCursorY] + ld [wced4], a + ld de, wHandTempList + ld hl, wcfd8 + ld [hl], e + inc hl + ld [hl], d + call Func_9c3f + call Func_a4c6 + +.asm_ac37 + ld hl, Data_9667 + call Func_9a6d + ld a, [wCurCardTypeFilter] + ld [wNamingScreenCursorY], a + call Func_9b20 + call PrintCardSelectionList + call EnableLCD + ld hl, Data_a396 + call Func_9a6d + ld a, [wcfdf] + ld [wNamingScreenKeyboardHeight], a + ld a, [wced4] + ld [wNamingScreenCursorY], a + jr .loop_frame_2 + +.asm_ac60 + call Func_9c0e + ld a, [wNamingScreenKeyboardHeight] + ld [wcfdf], a + ld a, [wNamingScreenCursorY] + ld [wced4], a + ld a, [hffb3] + cp $ff + jr nz, .asm_ac92 + + ld hl, Data_9667 + call Func_9a6d + ld a, [wCurCardTypeFilter] + ld [wNamingScreenCursorY], a + ld hl, hffb0 + ld [hl], $01 + call Func_a4de + ld hl, hffb0 + ld [hl], $00 + jp .loop_frame_1 + +.asm_ac92 + call Func_9c3a + call .Func_acde + ld de, $101 + call InitTextPrinting + ldtx hl, PrintThisCardYesNoText + call ProcessTextFromID + ld a, $01 + ld hl, Data_ad05 + call Func_9a6d +.loop_frame + call DoFrame + call Func_9a83 + jr nc, .loop_frame + ld a, [hffb3] + or a + jr nz, .asm_acd5 + ld hl, wHandTempList + ld a, [wced4] + ld c, a + ld b, $00 + add hl, bc + ld a, [wcea1] + ld c, a + ld b, $00 + add hl, bc + ld a, [hl] + bank1call Func_758a + call Func_a4c6 + jp .asm_ac37 + +.asm_acd5 + call .Func_acde + call Func_a4cc + jp .asm_ac37 + +.Func_acde + xor a + lb hl, 0, 0 + lb de, 0, 0 + lb bc, 20, 4 + call FillRectangle + ld a, [wConsole] + cp CONSOLE_CGB + ret nz ; exit if not CGB + + xor a + lb hl, 0, 0 + lb de, 0, 0 + lb bc, 20, 4 + call BankswitchVRAM1 + call FillRectangle + call BankswitchVRAM0 + ret +; 0xad0e + +Data_ad05: ; ad05 (2:6d05) + db $03, $03, $00, $04, $02, $0f, $00, $00, $00 +; 0xad0e + +PrinterMenu_CardList: ; ad0e (2:6d0e) + call Func_8ce7 + call Set_OBJ_8x8 + call Func_8d78 + lb bc, 0, 4 + ld a, SYM_BOX_TOP + call FillBGMapLineWithA + + xor a + ld [wcea1], a + ld [wCurCardTypeFilter], a + call Func_a39f + call EnableLCD + ld de, $101 + call InitTextPrinting + ld hl, EnableLCD + call ProcessTextFromID + ld a, $01 + ld hl, Data_ad05 + call Func_9a6d +.loop_frame + call DoFrame + call Func_9a83 + jr nc, .loop_frame + ld a, [hffb3] + or a + ret nz + bank1call Func_7585 + ret +; 0xad51 + +HandlePrinterMenu: ; ad51 (2:6d51) + bank1call Func_757b + ret c + xor a +.loop + ld hl, PrinterMenuParameters + call InitializeMenuParameters + call Func_8d56 + lb de, 4, 0 + lb bc, 12, 12 + call DrawRegularTextBox + ld de, $602 + call InitTextPrinting + ldtx hl, PrintMenuItemsText + call ProcessTextFromID + ldtx hl, WhatWouldYouLikeToPrintText + call DrawWideTextBox_PrintText + call EnableLCD +.loop_input + call DoFrame + call HandleMenuInput + jr nc, .loop_input + ldh a, [hCurMenuItem] + cp $ff + call z, PrinterMenu_QuitPrint + ld [wcfe4], a + ld hl, PrinterMenuFunctionTable + call JumpToFunctionInTable + ld a, [wcfe4] + jr .loop +; 0xad9a + +PrinterMenu_QuitPrint: ; ad9a (2:6d9a) + add sp, $2 ; exit menu + ldtx hl, PleaseMakeSureToTurnGameBoyPrinterOffText + call DrawWideTextBox_WaitForInput + ret +; 0xada3 + +PrinterMenuFunctionTable: ; ada3 (2:6da3) + dw PrinterMenu_PokemonCards + dw PrinterMenu_DeckConfiguration + dw PrinterMenu_CardList + dw PrinterMenu_PrintQuality + dw PrinterMenu_QuitPrint +; 0xadad + +PrinterMenuParameters: ; adad (2:6dad) + db 5, 2 ; cursor x, cursor y + db 2 ; y displacement between items + db 5 ; number of items + db SYM_CURSOR_R ; cursor tile number + db SYM_SPACE ; tile behind cursor + dw NULL ; function pointer if non-0 +; 0xadb5 + +PrinterMenu_PrintQuality: ; adb5 (2:6db5) + ldtx hl, PleaseSetTheContrastText + call DrawWideTextBox_PrintText + call EnableSRAM + ld a, [sPrinterContrastLevel] + call DisableSRAM + ld hl, Data_adf5 + call Func_9a6d +.loop_frame + call DoFrame + call Func_9a83 + jr nc, .loop_frame + ld a, [hffb3] + cp $ff + jr z, .asm_ade2 + call EnableSRAM + ld [sPrinterContrastLevel], a + call DisableSRAM +.asm_ade2 + add sp, $2 ; exit menu + ld a, [wcfe4] + ld hl, PrinterMenuParameters + call InitializeMenuParameters + ldtx hl, WhatWouldYouLikeToPrintText + call DrawWideTextBox_PrintText + jr HandlePrinterMenu.loop_input +; 0xadf5 + +Data_adf5: ; adf5 (2:6df5) + db $05, $10, $00, $02, $05, $0f, $00, $00, $00 +; 0xadfe + +Func_adfe: ; adfe (2:6dfe) + push de + ld de, wcfb9 + call CopyListFromHLToDEInSRAM + pop de + ld hl, wcf17 + call Func_8cd4 + ld a, $09 + ld hl, wcebb + call ClearNBytesFromHL + ld a, DECK_SIZE + ld [wcecc], a + ld hl, wcebb + ld [hl], a + call Func_ae21 + ret +; 0xae21 + +Func_ae21: ; ae21 (2:6e21) + call Func_a028 + call Func_a06e + xor a + ld [wcea1], a +.loop + ld hl, Data_ae91 + call Func_9a6d + ld a, [wced9] + ld [wcfe6], a + cp $05 + jr c, .asm_ae3d + ld a, $05 +.asm_ae3d + ld [wNamingScreenKeyboardHeight], a + ld [wcecb], a + call Func_aeb9 + ld hl, wcfda + ld a, [hli] + ld h, [hl] + ld l, a + call DrawWideTextBox_PrintText + + ld hl, Func_ae9a + ld d, h + ld a, l + ld hl, wcece + ld [hli], a + ld [hl], d + xor a + ld [wced2], a + +.loop_input + call DoFrame + call Func_9b25 + jr c, .asm_ae89 + call Func_9eb8 + jr c, .loop_input + ldh a, [hDPadHeld] + and START + jr z, .loop_input +.asm_ae70 + ld a, $01 + call PlaySFXConfirmOrCancel + ld a, [wNamingScreenCursorY] + ld [wced7], a + ld de, wOwnedCardsCountList + ld hl, wcfd8 + ld [hl], e + inc hl + ld [hl], d + call Func_9c3f + jr .loop + +.asm_ae89 + ld a, [hffb3] + cp $ff + ret z + jr .asm_ae70 +; 0xae91 + +Data_ae91: ; ae91 (2:6e91) + db $00, $03, $02, $00, $05, $0f, $00, $00, $00 +; 0xae9a + +Func_ae9a: ; ae9a (2:6e9a) + ld hl, hffb0 + ld [hl], $01 + call Func_aed3 + ld de, $10e + call InitTextPrinting + ld hl, wcfda + ld a, [hli] + ld h, [hl] + ld l, a + call ProcessTextFromID + ld hl, hffb0 + ld [hl], $00 + jp PrintConfirmationCardList +; 0xaeb9 + +Func_aeb9: ; aeb9 (2:6eb9) + call .Func_aec9 + ld de, $303 + ld hl, wced0 + ld [hl], e + inc hl + ld [hl], d + call PrintConfirmationCardList + ret + +.Func_aec9 + call Func_8d56 + call Func_aed3 + call EnableLCD + ret +; 0xaed3 + +Func_aed3: ; aed3 (2:6ed3) + ld a, [wcfb9] + or a + ret z + ld de, $1 + call InitTextPrinting + ld a, [wceb1] + inc a + ld hl, wc590 + call ConvertToNumericalDigits + ld [hl], $77 + inc hl + ld [hl], TX_END + ld hl, wc590 + call ProcessText + + ld hl, wcfb9 + ld de, wc590 + call CopyListFromHLToDE + ld hl, wc590 + call GetTextLengthInTiles + ld b, $00 + ld hl, wc590 + add hl, bc + ld d, h + ld e, l + ld hl, Data_92a7 + call CopyListFromHLToDE + ld de, $301 + ld hl, wc590 + call InitTextPrinting + call ProcessText + ret +; 0xaf1d + +Func_af1d: ; af1d (2:6f1d) + xor a + ld [wTileMapFill], a + call ZeroObjectPositions + call EmptyScreen + ld a, $1 + ld [wVBlankOAMCopyToggle], a + call LoadSymbolsFont + bank1call SetDefaultPalettes + + lb de, $3c, $bf + call SetupText + lb de, 3, 1 + call InitTextPrinting + ldtx hl, ProceduresForSendingCardsText + call ProcessTextFromID + lb de, 1, 3 + call InitTextPrinting + ldtx hl, CardSendingProceduresText + ld a, $01 + ld [wLineSeparation], a + call ProcessTextFromID + xor a + ld [wLineSeparation], a + ldtx hl, PleaseReadTheProceduresForSendingCardsText + call DrawWideTextBox_WaitForInput + + call EnableLCD + call Func_a1a2 + jr c, .asm_af6b + ld a, $01 + or a + ret + +.asm_af6b + ld hl, wcf17 + ld de, wDuelTempList + call CopyListFromHLToDE + xor a + ld [wNameBuffer], a + bank1call Func_756c + ret c + call EnableSRAM + ld hl, wcf17 + call Func_910a + call DisableSRAM + call SaveGame + ld hl, wNameBuffer + ld de, wDefaultText + call CopyListFromHLToDE + xor a + ret + +; never reached + scf + ret +; 0xaf98 + +Func_af98: ; af98 (2:6f98) + xor a + ld [wDuelTempList], a + ld [wNameBuffer], a + bank1call Func_7567 + ret c + + call EnableSRAM + ld hl, wDuelTempList + call Func_9120 + call DisableSRAM + call SaveGame + xor a + ld [wcea1], a + ld hl, Data_b04a + call Func_9a6d + call Func_b141 + call Func_b088 + call EnableLCD + ld a, [wceae] + ld [wcfe6], a + ld hl, wcecb + cp [hl] + jr nc, .asm_afd4 + ld [wNamingScreenKeyboardHeight], a +.asm_afd4 + ld hl, Func_b053 + ld d, h + ld a, l + ld hl, wcece + ld [hli], a + ld [hl], d + + xor a + ld [wced2], a +.asm_afe2 + call DoFrame + call Func_9b25 + jr c, .asm_b02f + call Func_9eb8 + jr c, .asm_afe2 + ldh a, [hDPadHeld] + and START + jr z, .asm_afe2 +.asm_aff5 + ld a, $01 + call PlaySFXConfirmOrCancel + ld a, [wNamingScreenCursorY] + ld [wced4], a + ld de, wFilteredCardList + ld hl, wcfd8 + ld [hl], e + inc hl + ld [hl], d + call Func_9c3f + call Func_b141 + call PrintCardSelectionList + call EnableLCD + ld hl, Data_b04a + call Func_9a6d + ld a, [wceae] + ld hl, wcecb + cp [hl] + jr nc, .asm_b027 + ld [wNamingScreenKeyboardHeight], a +.asm_b027 + ld a, [wced4] + ld [wNamingScreenCursorY], a + jr .asm_afe2 +.asm_b02f + call Func_9c0e + ld a, [wNamingScreenCursorY] + ld [wced4], a + ld a, [hffb3] + cp $ff + jr nz, .asm_aff5 + ld hl, wNameBuffer + ld de, wDefaultText + call CopyListFromHLToDE + or a + ret + +Data_b04a: ; b04a (2:704a) + db $01, $03, $02, $00, $05, $0f, $00, $00, $00 + +Func_b053: ; b053 (2:7053) + ld hl, hffb0 + ld [hl], $01 + lb de, 1, 1 + call InitTextPrinting + ldtx hl, CardReceivedText + call ProcessTextFromID + ld hl, wNameBuffer + ld de, wDefaultText + call CopyListFromHLToDE + xor a + ld [wTxRam2 + 0], a + ld [wTxRam2 + 1], a + lb de, 1, 14 + call InitTextPrinting + ldtx hl, ReceivedTheseCardsFromText + call PrintTextNoDelay + ld hl, hffb0 + ld [hl], $00 + jp PrintCardSelectionList +; 0xb088 + +Func_b088: ; b088 (2:7088) + ld a, $ff + ld hl, wTempCardCollection + call ClearNBytesFromHL + ld de, wDuelTempList + call .Func_b0b2 + ld a, $ff + call .Func_b0c0 + ld a, $05 + ld [wcecb], a + lb de, 2, 3 + ld hl, wced0 + ld [hl], e + inc hl + ld [hl], d + ld a, SYM_BOX_RIGHT + ld [wCursorAlternateTile], a + call PrintCardSelectionList + ret + +.Func_b0b2 + ld bc, wTempCardCollection +.loop + ld a, [de] + inc de + or a + ret z + ld h, $00 + ld l, a + add hl, bc + inc [hl] + jr .loop + +.Func_b0c0 + push af + push bc + push de + push hl + push af + ld a, DECK_SIZE + ld hl, wOwnedCardsCountList + call ClearNBytesFromHL + ld a, DECK_SIZE + ld hl, wFilteredCardList + call ClearNBytesFromHL + pop af + ld hl, $0 + ld de, $0 + ld b, a +.asm_b0dd + inc e + call GetCardType + jr c, .asm_b119 + ld c, a + ld a, b + cp $ff + jr z, .asm_b0fc + and $20 + cp $20 + jr z, .asm_b0f5 + ld a, c + cp b + jr nz, .asm_b0dd + jr .asm_b0fc +.asm_b0f5 + ld a, c + and TYPE_ENERGY + cp TYPE_ENERGY + jr nz, .asm_b0dd +.asm_b0fc + push bc + push hl + ld bc, wFilteredCardList + add hl, bc + ld [hl], e + ld hl, wTempCardCollection + add hl, de + ld a, [hl] + and $7f + pop hl + or a + jr z, .asm_b116 + push hl + ld bc, wOwnedCardsCountList + add hl, bc + ld [hl], a + pop hl + inc l +.asm_b116 + pop bc + jr .asm_b0dd + +.asm_b119 + ld a, l + ld [wceae], a + xor a + ld c, l + ld b, h + ld hl, wFilteredCardList + add hl, bc + ld [hl], a + ld a, $ff + ld hl, wOwnedCardsCountList + add hl, bc + ld [hl], a + pop hl + pop de + pop bc + pop af + ret +; 0xb131 + +Func_b131: ; b131 (2:7131) + call Func_b141.Func_b167 + lb de, 1, 1 + call InitTextPrinting + ldtx hl, CardToSendText + call ProcessTextFromID + ret +; 0xb141 -SendDeckConfigurationMenuData: ; a1f4 (2:61f4) - textitem 2, 2, ConfirmText - textitem 9, 2, SendText - textitem 16, 2, CancelText - db $ff +Func_b141: ; b141 (2:7141) + call .Func_b167 + lb de, 1, 1 + call InitTextPrinting + ldtx hl, CardReceivedText + call ProcessTextFromID + ld hl, wNameBuffer + ld de, wDefaultText + call CopyListFromHLToDE + xor a + ld [wTxRam2 + 0], a + ld [wTxRam2 + 1], a + ldtx hl, ReceivedTheseCardsFromText + call DrawWideTextBox_PrintText + ret -HandleSendDeckConfigurationMenu: ; a201 (2:6201) +.Func_b167 + call Set_OBJ_8x8 + call Func_8d78 ld de, $0 - lb bc, 20, 6 + lb bc, 20, 13 call DrawRegularTextBox - ld hl, SendDeckConfigurationMenuData - call PlaceTextItems - ld a, $ff - ld [wDuelInitialPrizesUpperBitsSet], a -.loop_input - ld a, $01 - ld [wVBlankOAMCopyToggle], a - call DoFrame - call Func_89ae - jr nc, .loop_input - ld [wced6], a - cp $ff - jr nz, .asm_a23b - call DrawCardTypeIconsAndPrintCardCounts - ld a, [wced4] - ld [wNamingScreenCursorY], a - ld a, [wced3] - call Func_993d - jp Func_9345.skip_draw -.asm_a23b - ld hl, .func_table + ret +; 0xb177 + +Func_b177: ; b177 (2:7177) + ld a, [wd10e] + and $03 + ld hl, .FunctionTable call JumpToFunctionInTable - jp Func_9461.asm_9475 + jr c, .asm_b18f + or a + jr nz, .asm_b18f + xor a + ld [wTxRam2 + 0], a + ld [wTxRam2 + 1], a + ret +.asm_b18f + ld a, $ff + ld [wd10e], a + ret -.func_table - dw ConfirmDeckConfiguration ; Confirm - dw SendDeckConfiguration ; Send - dw CancelSendDeckConfiguration ; Cancel -; 0xa24a +.FunctionTable + dw Func_af1d + dw Func_af98 + dw Func_bc04 + dw Func_bc7a +; 0xb19d -SendDeckConfiguration: ; a24a (2:624a) - ld a, [wcf17] - or a - jr z, CancelSendDeckConfiguration +Func_b19d: ; b19d (2:719d) xor a ld [wcea1], a - ld hl, Data_b04a + ldtx de, DeckSaveMachineText + ld hl, wd0a2 + ld [hl], e + inc hl + ld [hl], d + call Func_b379 + ld a, $3c + ld [wd0a5], a + xor a +.asm_b1b3 + ld hl, Data_b6fb call Func_9a6d - ld hl, wcf17 - ld de, wDuelTempList - call CopyListFromHLToDE - call Func_b131 - call Func_b088 - call EnableLCD - ldtx hl, SendTheseCardsText + call Func_b704 + call Func_b545 + ldtx hl, PleaseSelectDeckText + call DrawWideTextBox_PrintText + ldtx de, PleaseSelectDeckText + call Func_b285 + call Func_b29f + jr c, .asm_b1b3 + cp $ff + ret z + ld b, a + ld a, [wcea1] + add b + ld [wd088], a + call ResetCheckMenuCursorPositionAndBlink + call DrawWideTextBox + ld hl, Unknown_b274 + call PlaceTextItems +.asm_b1e7 + call DoFrame + call HandleCheckMenuInput + jp nc, .asm_b1e7 + cp $ff + jr nz, .asm_b1fa + ld a, [wd086] + jp .asm_b1b3 + +.asm_b1fa + ld a, [wCheckMenuCursorYPosition] + sla a + ld hl, wCheckMenuCursorXPosition + add [hl] + or a + jr nz, .asm_b22c + call Func_b35b + jr nc, .asm_b216 + call Func_b592 + ld a, [wd086] + jp c, .asm_b1b3 + jr .asm_b25e + +.asm_b216 + ldtx hl, OKIfFileDeletedText call YesOrNoMenuWithText - jr nc, .asm_a279 - add sp, $2 - jp Func_9345.skip_count -.asm_a279 - add sp, $2 + ld a, [wd086] + jr c, .asm_b1b3 + call Func_b592 + ld a, [wd086] + jp c, .asm_b1b3 + jr .asm_b25e + +.asm_b22c + cp $1 + jr nz, .asm_b24c + call Func_b35b + jr c, .asm_b240 + call Func_b6ca + ld a, [wd086] + jp c, .asm_b1b3 + jr .asm_b25e + +.asm_b240 + ld hl, WaitForVBlank + call DrawWideTextBox_WaitForInput + ld a, [wd086] + jp .asm_b1b3 + +.asm_b24c + cp $2 + jr nz, .asm_b273 + call Func_b35b + jr c, .asm_b240 + call Func_b7c6 + ld a, [wd086] + jp nc, .asm_b1b3 + +.asm_b25e + ld a, [wd087] + ld [wcea1], a + call Func_b379 + call Func_b704 + call Func_b545 + ld a, [wd086] + jp .asm_b1b3 + +.asm_b273 + ret + +Unknown_b274: ; b274 (2:7274) + textitem 2, 14, SaveADeckText + textitem 12, 14, DeleteADeckText + textitem 2, 16, BuildADeckText + textitem 12, 16, CancelText + db $ff + +Func_b285: ; b285 (2:7285) + ld a, $05 + ld [wNamingScreenKeyboardHeight], a + ld hl, wd0a7 + ld [hl], e + inc hl + ld [hl], d + ld hl, Func_b403 + ld d, h + ld a, l + ld hl, wcece + ld [hli], a + ld [hl], d + xor a + ld [wced2], a + ret +; 0xb29f + +Func_b29f: ; b29f (2:729f) + call DoFrame + call Func_9b25 + jr c, .asm_b303 + call .Func_b317 + jr c, Func_b29f ; loop back to start + ldh a, [hDPadHeld] + and START + jr z, Func_b29f ; loop back to start + +; start btn + ld a, [wcea1] + ld [wd087], a + ld b, a + ld a, [wNamingScreenCursorY] + ld [wd086], a + add b + ld c, a + inc a + or $80 + ld [wceb1], a + sla c + ld b, $00 + ld hl, wd00d + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + push hl + ld bc, $18 + add hl, bc + ld d, h + ld e, l + call EnableSRAM + ld a, [hl] + call DisableSRAM + pop hl + or a + jr z, Func_b29f ; loop back to start + + ld a, $01 + call PlaySFXConfirmOrCancel + call Func_8e1f + ld a, [wd087] + ld [wcea1], a + call Func_b379 + call Func_b704 + call Func_b545 + ld a, [wd086] + ld [wNamingScreenCursorY], a scf ret -CancelSendDeckConfiguration: ; a27d (2:627d) - add sp, $2 +.asm_b303 + call Func_9c3a + ld a, [wcea1] + ld [wd087], a + ld a, [wNamingScreenCursorY] + ld [wd086], a + ld a, [hffb3] or a ret -; 0xa281 -; copies b bytes from hl to de -CopyNBytesFromHLToDE: ; a281 (2:6281) - ld a, [hli] - ld [de], a - inc de - dec b - jr nz, CopyNBytesFromHLToDE +.Func_b317 + ld a, [wcea1] + ld c, a + ldh a, [hDPadHeld] + cp D_RIGHT + jr z, .d_right + cp D_LEFT + jr z, .d_left + or a ret -; 0xa288 -Func_a288: ; a288 (2:6288) - INCROM $a288, $a3ca +.d_right + ld a, [wcea1] + add $05 + ld b, a + add $05 + ld hl, wd0a5 + cp [hl] + jr c, .asm_b347 + ld a, [wd0a5] + sub $05 + ld b, a + jr .asm_b347 -Func_a3ca: ; a3ca (2:63ca) - ld [hffb5], a - ld hl, sCardCollection - ld de, wTempCardCollection - ld b, $ff - call EnableSRAM - call CopyNBytesFromHLToDE - call DisableSRAM -; deck_1 - ld a, [hffb5] ; should be ldh - bit 0, a - jr z, .deck_2 - ld de, sDeck1Cards - call GetDeckCardCounts -.deck_2 - ld a, [hffb5] ; should be ldh - bit 1, a - jr z, .deck_3 - ld de, sDeck2Cards - call GetDeckCardCounts -.deck_3 - ld a, [hffb5] ; should be ldh - bit 2, a - jr z, .deck_4 - ld de, sDeck3Cards - call GetDeckCardCounts -.deck_4 - ld a, [hffb5] ; should be ldh - bit 3, a - ret z - ld de, sDeck4Cards - call GetDeckCardCounts +.d_left + ld a, [wcea1] + sub $05 + ld b, a + jr nc, .asm_b347 + ld b, $00 + +.asm_b347 + ld a, b + ld [wcea1], a + cp c + jr z, .asm_b359 + ld a, SFX_01 + call PlaySFX + call Func_b403 + call Func_b545 +.asm_b359 + scf ret -; 0xa412 +; 0xb35b -; goes through deck cards in de -; and gets the count of each card ID -; in wTempCardCollection in card collection order -GetDeckCardCounts: ; a412 (2:6412) - call EnableSRAM - ld bc, wTempCardCollection - ld h, DECK_SIZE -.loop - ld a, [de] - inc de - or a - jr z, .done - push hl - ld h, $0 +Func_b35b: ; b35b (2:735b) + ld a, [wd088] + sla a ld l, a + ld h, $00 + ld bc, wd00d add hl, bc - inc [hl] - pop hl - dec h - jr nz, .loop -.done + ld a, [hli] + ld h, [hl] + ld l, a + ld bc, $18 + add hl, bc + call EnableSRAM + ld a, [hl] call DisableSRAM + or a + ret nz + scf ret -; 0xa42d +; 0xb379 -; prints the name, level and storage count of the cards -; that are visible in the list window -; in the form: -; CARD NAME/LEVEL X -; where X is the current count of that card -PrintCardSelectionList: ; a42d (2:642d) - push bc - ld hl, wced0 - ld e, [hl] - inc hl - ld d, [hl] - ld b, 19 ; x coord - ld c, e - ld a, [wcea1] - or a - jr z, .alternate_cursor_tile - ld a, SYM_CURSOR_U - jr .got_cursor_tile_1 -.alternate_cursor_tile - ld a, [wCursorAlternateTile] -.got_cursor_tile_1 - call WriteByteToBGMap0 +Func_b379: ; b379 (2:7379) + call Set_OBJ_8x8 + xor a + ld [wTileMapFill], a + call ZeroObjectPositions + call EmptyScreen + ld a, $01 + ld [wVBlankOAMCopyToggle], a + call LoadSymbolsFont + call LoadDuelCardSymbolTiles + bank1call SetDefaultPalettes + lb de, $3c, $ff + call SetupText + lb de, 0, 0 + lb bc, 20, 13 + call DrawRegularTextBox + call Func_b3b3 + call Func_b3c3 + call Func_b3e5 + call Func_b525 + call EnableLCD + ret +; 0xb3b3 -; iterates by decreasing value in wcecb -; by 1 until it reaches 0 - ld a, [wcea1] - ld c, a - ld b, $0 - ld hl, wFilteredCardList +Func_b3b3: ; b3b3 (2:73b3) + lb de, 1, 0 + call InitTextPrinting + ld hl, wd0a2 + ld a, [hli] + ld h, [hl] + ld l, a + call ProcessTextFromID + ret +; 0xb3c3 + +Func_b3c3: ; b3c3 (2:73c3) + ld a, DECK_SIZE + add DECK_SIZE + ld hl, wd00d + call ClearNBytesFromHL + ld de, wd00d + ld hl, s0a350 + ld bc, $54 + ld a, DECK_SIZE +.asm_b3d8 + push af + ld a, l + ld [de], a + inc de + ld a, h + ld [de], a + inc de add hl, bc - ld a, [wcecb] -.loop_filtered_cards + pop af + dec a + jr nz, .asm_b3d8 + ret +; 0xb3e5 + +Func_b3e5: ; b3e5 (2:73e5) + ld a, [wcea1] + ld de, $202 + ld b, $05 +.asm_b3ed + push af + push bc push de - or a - jr z, .exit_loop - ld b, a + call Func_b424 + pop de + pop bc + pop af + ret c + dec b + ret z + inc a + inc e + inc e + jr .asm_b3ed +; 0xb3fe + +Func_b3fe: ; b3fe (2:73fe) + call Func_b704 + jr Func_b3e5 +; 0xb403 + +Func_b403: ; b403 (2:7403) + call Func_b704 + ld hl, hffb0 + ld [hl], $01 + call Func_b3b3 + lb de, 1, 14 + call InitTextPrinting + ld hl, wd0a7 ld a, [hli] - or a - jr z, .invalid_card ; card ID of 0 - ld e, a - call Func_9a59 - call LoadCardDataToBuffer1_FromCardID - ; places in wDefaultText the card's name and level - ; then appends at the end the count of that card - ; in the card storage - ld a, 14 + ld h, [hl] + ld l, a + call ProcessTextFromID + ld hl, hffb0 + ld [hl], $00 + jr Func_b3e5 +; 0xb424 + +Func_b424: ; b424 (2:7424) + ld b, a push bc - push hl + ld hl, wDefaultText + inc a + call ConvertToNumericalDigits + ld [hl], $77 + inc hl + ld [hl], $00 + call InitTextPrinting + ld hl, wDefaultText + call ProcessText + pop af + push af + sla a + ld l, a + ld h, $00 + ld bc, wd00d + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + inc d + inc d + inc d push de - call CopyCardNameAndLevel + call Func_92be pop de - call AppendOwnedCardCountNumber - pop hl pop bc - pop de - push hl + jr nc, .asm_b46b call InitTextPrinting - ld hl, wDefaultText - jr .process_text -.invalid_card - pop de - push hl + ldtx hl, Text025b + call ProcessTextFromID + ld d, 13 + inc e call InitTextPrinting - ld hl, Text_9a36 -.process_text + ld hl, Text_b4d4 call ProcessText - pop hl + scf + ret - ld a, b - dec a - inc e - inc e - jr .loop_filtered_cards +.asm_b46b + push de + push bc + ld d, 18 + call InitTextPrinting + ld a, $00 + call Func_b625 + pop bc + ld hl, wDefaultText + jr c, .asm_b482 + ld de, $35f ; "○" + jr .asm_b4c2 -.exit_loop +.asm_b482 + push bc + ld a, $ff + call Func_b625 + jr c, .asm_b490 + pop bc + ld de, $360 ; "❄" + jr .asm_b4c2 + +.asm_b490 + ld de, $6c ; "✕" + call Func_22ca + pop bc + pop de + push bc + ld d, 17 + inc e + call InitTextPrinting + pop bc + call Func_b4e1 + call CalculateOnesAndTensDigits + ld hl, wOnesAndTensPlace ld a, [hli] + ld b, a + ld a, [hl] + ld hl, wDefaultText + ld [hl], TX_SYMBOL + inc hl + ld [hli], a + ld [hl], TX_SYMBOL + inc hl + ld a, b + ld [hli], a + ld [hl], TX_END + ld hl, wDefaultText + call ProcessText or a - jr z, .cannot_scroll - pop de -; draw down cursor because -; there are still more cards -; to be scrolled down - xor a - ld [wcecd], a - ld a, SYM_CURSOR_D - jr .got_cursor_tile_2 -.cannot_scroll + ret + +.asm_b4c2 + call Func_22ca pop de - ld a, $01 - ld [wcecd], a - ld a, [wCursorAlternateTile] -.got_cursor_tile_2 - ld b, 19 ; x coord - ld c, e - dec c - dec c - call WriteByteToBGMap0 - pop bc + ld d, 13 + inc e + call InitTextPrinting + ld hl, Text_b4d4 + call ProcessText + or a ret -; 0xa4ae +; 0xb4d4 -; appends the card count given in register e -; to the list in hl, in numerical form -; (i.e. its numeric symbol representation) -AppendOwnedCardCountNumber: ; a4ae (2:64ae) - push af +Text_b4d4: ; b4d4 (2:74d4) + db TX_SYMBOL, TX_END + db TX_SYMBOL, TX_END + db TX_SYMBOL, TX_END + db TX_SYMBOL, TX_END + db TX_SYMBOL, TX_END + db TX_SYMBOL, TX_END + db TX_END +; 0xb4e1 + +Func_b4e1: ; b4e1 (2:74e1) push bc - push de + call Func_b644 + call Func_a3ca + call Func_b664 + pop bc + sla b + ld c, b + ld b, $00 + ld hl, wd00d + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld bc, $18 + add hl, bc + call EnableSRAM + ld de, wTempCardCollection + ld bc, $0 +.asm_b505 + inc b + ld a, DECK_SIZE + cp b + jr c, .asm_b520 + ld a, [hli] push hl -; increment hl until end is reached ($00 byte) -.loop + ld l, a + ld h, $00 + add hl, de ld a, [hl] + and $7f or a - jr z, .end - inc hl - jr .loop -.end - call GetOwnedCardCount - call ConvertToNumericalDigits - ld [hl], $00 ; insert byte terminator + jr z, .asm_b51c + dec a + ld [hl], a pop hl - pop de - pop bc - pop af + jr .asm_b505 +.asm_b51c + inc c + pop hl + jr .asm_b505 +.asm_b520 + ld a, c + call DisableSRAM ret -; 0xa4c6 - - INCROM $a4c6, $a913 - -Func_a913: ; a913 (2:6913) - INCROM $a913, $ad51 - -Func_ad51: ; ad51 (2:6d51) - INCROM $ad51, $adfe - -Func_adfe: ; adfe (2:6dfe) - INCROM $adfe, $af1d - -Func_af1d: ; af1d (2:6f1d) - xor a - ld [wTileMapFill], a - call ZeroObjectPositions - call EmptyScreen - ld a, $1 - ld [wVBlankOAMCopyToggle], a - call LoadSymbolsFont - bank1call SetDefaultPalettes - - lb de, $3c, $bf - call SetupText - lb de, 3, 1 - call InitTextPrinting - ldtx hl, ProceduresForSendingCardsText - call ProcessTextFromID - lb de, 1, 3 - call InitTextPrinting - ldtx hl, CardSendingProceduresText - ld a, $01 - ld [wLineSeparation], a - call ProcessTextFromID - xor a - ld [wLineSeparation], a - ldtx hl, PleaseReadTheProceduresForSendingCardsText - call DrawWideTextBox_WaitForInput +; 0xb525 - call EnableLCD - call Func_a1a2 - jr c, .asm_af6b - ld a, $01 +Func_b525: ; b525 (2:7525) + call EnableSRAM + ld hl, s0a350 + ld bc, $54 + ld d, DECK_SIZE + ld e, $00 +.loop + ld a, [hl] or a + jr z, .asm_b537 + inc e +.asm_b537 + dec d + jr z, .asm_b53d + add hl, bc + jr .loop +.asm_b53d + ld a, e + ld [wd085], a + call DisableSRAM ret +; 0xb545 -.asm_af6b - ld hl, wcf17 - ld de, wDuelTempList - call CopyListFromHLToDE - xor a - ld [wNameBuffer], a - bank1call Func_756c - ret c - call EnableSRAM - ld hl, wcf17 - call Func_910a - call DisableSRAM - call SaveGame - ld hl, wNameBuffer - ld de, wDefaultText - call CopyListFromHLToDE - xor a +Func_b545: ; b545 (2:7545) + ld a, [wd085] + ld hl, wc590 + call ConvertToNumericalDigits + ld a, TX_SYMBOL + ld [hli], a + ld a, SYM_SLASH + ld [hli], a + ld a, DECK_SIZE + call ConvertToNumericalDigits + ld [hl], TX_END + ld de, SerialHandleSend.send_escaped + call InitTextPrinting + ld hl, wc590 + call ProcessText ret +; 0xb568 -; never reached - scf - ret -; 0xaf98 + INCROM $b568, $b592 -Func_af98: ; af98 (2:6f98) +Func_b592: ; b592 (2:7592) + ld a, $ff + call Func_9168 xor a - ld [wDuelTempList], a - ld [wNameBuffer], a - bank1call Func_7567 - ret c +.asm_b598 + ld hl, DeckMachineMenuParameters + call InitializeMenuParameters + ldtx hl, ChooseADeckToSaveText + call DrawWideTextBox_PrintText +.loop_input + call DoFrame + call Func_8dea + jr c, .asm_b598 + call HandleMenuInput + jp nc, .loop_input ; should be jr + ldh a, [hCurMenuItem] + cp $ff + ret z + ld [wceb1], a + call Func_8ff2 + jp nc, .Func_b5c8 + call Func_8fe8 + ld a, [wceb1] + jr .asm_b598 +.Func_b5c8 + call GetPointerToDeckName + call Func_b611 + ld b, $54 call EnableSRAM - ld hl, wDuelTempList - call Func_9120 + call CopyNBytesFromHLToDE call DisableSRAM - call SaveGame - xor a - ld [wcea1], a - ld hl, Data_b04a - call Func_9a6d - call Func_b141 - call Func_b088 - call EnableLCD - ld a, [wceab + 3] - ld [wcfe4 + 2], a - ld hl, wcecb - cp [hl] - jr nc, .asm_afd4 - ld [wNamingScreenKeyboardHeight], a -.asm_afd4 - ld hl, Func_b053 - ld d, h - ld a, l - ld hl, wcece - ld [hli], a - ld [hl], d - - xor a - ld [wced2], a -.asm_afe2 - call DoFrame - call Func_9b25 - jr c, .asm_b02f - call Func_9eb8 - jr c, .asm_afe2 - ldh a, [hDPadHeld] - and START - jr z, .asm_afe2 -.asm_aff5 - ld a, $01 - call PlaySFXConfirmOrCancel - ld a, [wNamingScreenCursorY] - ld [wced4], a - ld de, wFilteredCardList - ld hl, wcfd8 - ld [hl], e - inc hl - ld [hl], d - call Func_9c3f - call Func_b141 - call PrintCardSelectionList - call EnableLCD - ld hl, Data_b04a + call Func_b379 + call Func_b704 + call Func_b545 + ld a, [wd086] + ld hl, Data_b6fb call Func_9a6d - ld a, [wceab + 3] - ld hl, wcecb - cp [hl] - jr nc, .asm_b027 - ld [wNamingScreenKeyboardHeight], a -.asm_b027 - ld a, [wced4] - ld [wNamingScreenCursorY], a - jr .asm_afe2 -.asm_b02f - call Func_9c0e - ld a, [wNamingScreenCursorY] - ld [wced4], a - ld a, [hffb3] - cp $ff - jr nz, .asm_aff5 - ld hl, wNameBuffer - ld de, wDefaultText - call CopyListFromHLToDE - or a - ret - -Data_b04a: ; b04a (2:704a) - db $01, $03, $02, $00, $05, $0f, $00, $00, $00 - -Func_b053: ; b053 (2:7053) - ld hl, hffb0 - ld [hl], $01 - lb de, 1, 1 - call InitTextPrinting - ldtx hl, CardReceivedText - call ProcessTextFromID - ld hl, wNameBuffer - ld de, wDefaultText - call CopyListFromHLToDE + call Func_9c3a + call GetPointerToDeckName + call EnableSRAM + call Func_9253 + call DisableSRAM xor a ld [wTxRam2 + 0], a ld [wTxRam2 + 1], a - lb de, 1, 14 - call InitTextPrinting - ldtx hl, ReceivedTheseCardsFromText - call PrintTextNoDelay - ld hl, hffb0 - ld [hl], $00 - jp PrintCardSelectionList -; 0xb088 + ldtx hl, SavedTheConfigurationForText + call DrawWideTextBox_WaitForInput + scf + ret +; 0xb609 -Func_b088: ; b088 (2:7088) - ld a, $ff - ld hl, wTempCardCollection - call ClearNBytesFromHL - ld de, wDuelTempList - call .Func_b0b2 - ld a, $ff - call .Func_b0c0 - ld a, $05 - ld [wcecb], a - lb de, 2, 3 - ld hl, wced0 - ld [hl], e +DeckMachineMenuParameters: ; b609 (2:7609) + db 1, 2 ; cursor x, cursor y + db 3 ; y displacement between items + db 4 ; number of items + db SYM_CURSOR_R ; cursor tile number + db SYM_SPACE ; tile behind cursor + dw NULL ; function pointer if non-0 +; 0xb611 + +Func_b611: ; b611 (2:7611) + push af + push hl + ld a, [wd088] + sla a + ld e, a + ld d, $00 + ld hl, wd00d + add hl, de + ld e, [hl] inc hl - ld [hl], d - ld a, SYM_BOX_RIGHT - ld [wCursorAlternateTile], a - call PrintCardSelectionList + ld d, [hl] + pop hl + pop af ret +; 0xb625 -.Func_b0b2 - ld bc, wTempCardCollection -.loop - ld a, [de] - inc de - or a - ret z - ld h, $00 +Func_b625: ; b625 (2:7625) + push bc + call Func_b644 + call Func_a3ca + call Func_b664 + pop bc + sla b + ld c, b + ld b, $00 + ld hl, wd00d + add hl, bc + ld a, [hli] + ld h, [hl] ld l, a + ld bc, $18 add hl, bc - inc [hl] - jr .loop + call Func_b675 + ret +; 0xb644 -.Func_b0c0 +; switches to SRAM bank 0 and stores current SRAM bank in wd0a4 +; skips if current SRAM bank is already 0 +Func_b644: ; b644 (2:7644) push af - push bc - push de - push hl + ldh a, [hBankSRAM] + or a + jr z, .skip + ld [wd0a4], a + xor a + call BankswitchSRAM +.skip + pop af + ret +; 0xb653 + +; switches to SRAM bank 1 and stores current SRAM bank in wd0a4 +; skips if current SRAM bank is already 1 +Func_b653: ; b653 (2:7653) push af - ld a, DECK_SIZE - ld hl, wOwnedCardsCountList - call ClearNBytesFromHL - ld a, DECK_SIZE - ld hl, wFilteredCardList - call ClearNBytesFromHL + ldh a, [hBankSRAM] + cp BANK("SRAM1") + jr z, .skip + ld [wd0a4], a + ld a, BANK("SRAM1") + call BankswitchSRAM +.skip pop af - ld hl, $0 - ld de, $0 - ld b, a -.asm_b0dd - inc e - call GetCardType - jr c, .asm_b119 - ld c, a - ld a, b - cp $ff - jr z, .asm_b0fc - and $20 - cp $20 - jr z, .asm_b0f5 - ld a, c - cp b - jr nz, .asm_b0dd - jr .asm_b0fc -.asm_b0f5 - ld a, c - and TYPE_ENERGY - cp TYPE_ENERGY - jr nz, .asm_b0dd -.asm_b0fc + ret +; 0xb664 + +Func_b664: ; b664 (2:7664) + push af push bc + ldh a, [hBankSRAM] + ld b, a + ld a, [wd0a4] + cp b + jr z, .asm_b672 + call BankswitchSRAM +.asm_b672 + pop bc + pop af + ret +; 0xb675 + +Func_b675: ; b675 (2:7675) + call EnableSRAM + ld de, wTempCardCollection + ld b, 0 +.asm_b67d + inc b + ld a, DECK_SIZE + cp b + jr c, .no_carry + ld a, [hli] push hl - ld bc, wFilteredCardList - add hl, bc - ld [hl], e - ld hl, wTempCardCollection + ld l, a + ld h, $00 add hl, de ld a, [hl] - and $7f - pop hl or a - jr z, .asm_b116 - push hl - ld bc, wOwnedCardsCountList - add hl, bc + jr z, .set_carry + cp $80 + jr z, .set_carry + dec a ld [hl], a pop hl - inc l -.asm_b116 - pop bc - jr .asm_b0dd + jr .asm_b67d -.asm_b119 - ld a, l - ld [wceab + 3], a - xor a - ld c, l - ld b, h - ld hl, wFilteredCardList - add hl, bc - ld [hl], a - ld a, $ff - ld hl, wOwnedCardsCountList - add hl, bc - ld [hl], a +.set_carry pop hl - pop de - pop bc - pop af + call DisableSRAM + scf ret -; 0xb131 -Func_b131: ; b131 (2:7131) - call Func_b141.Func_b167 - lb de, 1, 1 - call InitTextPrinting - ldtx hl, CardToSendText - call ProcessTextFromID +.no_carry + call DisableSRAM + or a ret -; 0xb141 +; 0xb6a1 -Func_b141: ; b141 (2:7141) - call .Func_b167 - lb de, 1, 1 - call InitTextPrinting - ldtx hl, CardReceivedText - call ProcessTextFromID - ld hl, wNameBuffer - ld de, wDefaultText - call CopyListFromHLToDE +Func_b6a1: ; b6a1 (2:76a1) + ld hl, sDeck1Cards + ld a, [hl] + or a + jr nz, .check_deck_2 xor a - ld [wTxRam2 + 0], a - ld [wTxRam2 + 1], a - ldtx hl, ReceivedTheseCardsFromText - call DrawWideTextBox_PrintText ret -.Func_b167 - call Set_OBJ_8x8 - call Func_8d78 - ld de, $0 - lb bc, 20, 13 - call DrawRegularTextBox +.check_deck_2 + ld hl, sDeck2Cards + ld a, [hl] + or a + jr nz, .check_deck_3 + ld a, $01 ret -; 0xb177 -Func_b177: ; b177 (2:7177) - ld a, [wd10e] - and $03 - ld hl, .FunctionTable - call JumpToFunctionInTable - jr c, .asm_b18f +.check_deck_3 + ld hl, sDeck3Cards + ld a, [hl] or a - jr nz, .asm_b18f - xor a - ld [wTxRam2 + 0], a - ld [wTxRam2 + 1], a - ret -.asm_b18f - ld a, $ff - ld [wd10e], a + jr nz, .check_deck_4 + ld a, $02 ret -.FunctionTable - dw Func_af1d - dw Func_af98 - dw Func_bc04 - dw Func_bc7a -; 0xb19d - -Func_b19d: ; b19d (2:719d) - xor a - ld [wcea1], a - ldtx de, DeckSaveMachineText - ld hl, wd0a2 - ld [hl], e - inc hl - ld [hl], d - call Func_b379 - ld a, $3c - ld [wd0a5], a - xor a -.asm_b1b3 - ld hl, Data_b6fb - call Func_9a6d - call Func_b704 - call Func_b545 - ldtx hl, PleaseSelectDeckText - call DrawWideTextBox_PrintText - ldtx de, PleaseSelectDeckText - call Func_b285 - call Func_b29f - jr c, .asm_b1b3 - cp $ff - ret z - ld b, a - ld a, [wcea1] - add b - ld [wd088], a - call ResetCheckMenuCursorPositionAndBlink - call DrawWideTextBox - ld hl, Unknown_b274 - call PlaceTextItems -.asm_b1e7 - call DoFrame - call HandleCheckMenuInput - jp nc, .asm_b1e7 - cp $ff - jr nz, .asm_b1fa - ld a, [wd086] - jp .asm_b1b3 - -.asm_b1fa - ld a, [wCheckMenuCursorYPosition] - sla a - ld hl, wCheckMenuCursorXPosition - add [hl] +.check_deck_4 + ld hl, sDeck4Cards + ld a, [hl] or a - jr nz, .asm_b22c - call Func_b35b - jr nc, .asm_b216 - call Func_b592 - ld a, [wd086] - jp c, .asm_b1b3 - jr .asm_b25e - -.asm_b216 - ldtx hl, OKIfFileDeletedText - call YesOrNoMenuWithText - ld a, [wd086] - jr c, .asm_b1b3 - call Func_b592 - ld a, [wd086] - jp c, .asm_b1b3 - jr .asm_b25e - -.asm_b22c - cp $1 - jr nz, .asm_b24c - call Func_b35b - jr c, .asm_b240 - call Func_b6ca - ld a, [wd086] - jp c, .asm_b1b3 - jr .asm_b25e - -.asm_b240 - ld hl, WaitForVBlank - call DrawWideTextBox_WaitForInput - ld a, [wd086] - jp .asm_b1b3 - -.asm_b24c - cp $2 - jr nz, .asm_b273 - call Func_b35b - jr c, .asm_b240 - call Func_b7c6 - ld a, [wd086] - jp nc, .asm_b1b3 - -.asm_b25e - ld a, [wd087] - ld [wcea1], a - call Func_b379 - call Func_b704 - call Func_b545 - ld a, [wd086] - jp .asm_b1b3 - -.asm_b273 + jr nz, .set_carry + ld a, $03 ret -Unknown_b274: ; b274 (2:7274) - INCROM $b274, $b285 +.set_carry + scf + ret +; 0xb6ca -Func_b285: ; b285 (2:7285) - ld a, $05 - ld [wNamingScreenKeyboardHeight], a - ld hl, wd0a7 - ld [hl], e - inc hl - ld [hl], d - ld hl, Func_b403 - ld d, h - ld a, l - ld hl, wcece - ld [hli], a - ld [hl], d +Func_b6ca: ; b6ca (2:76ca) + ldtx hl, DoYouReallyWishToDeleteText + call YesOrNoMenuWithText + jr c, .no + call Func_b611 + ld l, e + ld h, d + push hl + call EnableSRAM + call Func_9253 + pop hl + ld a, $54 + call ClearNBytesFromHL + call DisableSRAM xor a - ld [wced2], a + ld [wTxRam2 + 0], a + ld [wTxRam2 + 1], a + ldtx hl, DeletedTheConfigurationForText + call DrawWideTextBox_WaitForInput + or a + ret + +.no + ld a, [wNamingScreenCursorY] + scf ret -; 0xb29f +; 0xb6fb -Func_b29f: ; b29f (2:729f) - INCROM $b29f, $b35b +Data_b6fb: ; b6fb (2:76fb) + db $01, $02, $02, $00, $05, $0f, $00, $00, $00 -Func_b35b: ; b35b (2:735b) - INCROM $b35b, $b379 +Func_b704: ; b704 (2:7704) + ld a, [wcea1] + or a + jr z, .asm_b70e + ld a, SYM_CURSOR_U + jr .got_tile_1 +.asm_b70e + ld a, SYM_BOX_RIGHT +.got_tile_1 + lb bc, 19, 1 + call WriteByteToBGMap0 -Func_b379: ; b379 (2:7379) - INCROM $b379, $b3b3 + ld a, [wcea1] + add $06 + ld b, a + ld a, [wd0a5] + cp b + jr c, .asm_b72a + xor a + ld [wcecd], a + ld a, SYM_CURSOR_D + jr .got_tile_2 +.asm_b72a + ld a, $01 + ld [wcecd], a + ld a, SYM_BOX_RIGHT +.got_tile_2 + lb bc, 19, 11 + call WriteByteToBGMap0 + ret +; 0xb738 -Func_b3b3: ; b3b3 (2:73b3) - lb de, 1, 0 - call InitTextPrinting - ld hl, wd0a2 - ld a, [hli] - ld h, [hl] - ld l, a - call ProcessTextFromID +Func_b738: ; b738 (2:7738) + ldtx hl, YouMayOnlyCarry4DecksText + call DrawWideTextBox_WaitForInput + call Func_b644 + ld a, $ff + call Func_9168 + xor a +.init_menu_params + ld hl, DeckMachineMenuParameters + call InitializeMenuParameters + ldtx hl, ChooseADeckToDismantleText + call DrawWideTextBox_PrintText +.loop_input + call DoFrame + call Func_8dea + jr c, .init_menu_params + call HandleMenuInput + jp nc, .loop_input ; should be jr + ldh a, [hCurMenuItem] + cp $ff + jr nz, .asm_b76c + call Func_b664 + scf ret -; 0xb3c3 - INCROM $b3c3, $b3e5 +.asm_b76c + ld [wceb1], a + ldtx hl, DismantleThisDeckText + call YesOrNoMenuWithText + jr nc, .dismantle + ld a, [wceb1] + jr .init_menu_params -Func_b3e5: ; b3e5 (2:73e5) - ld a, [wcea1] - ld de, $202 - ld b, $05 -.asm_b3ed - push af +.dismantle + call GetPointerToDeckName + push hl + ld de, wd089 + call EnableSRAM + call CopyListFromHLToDE + pop hl + push hl + ld bc, $18 + add hl, bc + call Func_9152 + pop hl + ld a, $54 + call ClearNBytesFromHL + call DisableSRAM + ld a, $ff + call Func_9168 + ld a, [wceb1] + ld hl, DeckMachineMenuParameters + call InitializeMenuParameters + call DrawCursor2 + call Func_b664 + ld hl, wd089 + call Func_9253 + xor a + ld [wTxRam2 + 0], a + ld [wTxRam2 + 1], a + ld hl, $26a + call DrawWideTextBox_WaitForInput + ld a, [wceb1] + ret +; 0xb7c6 + +Func_b7c6: ; b7c6 (2:77c6) + ld a, [wd088] + ld b, a push bc - push de - call Func_b424 - pop de + ld a, $00 + call Func_b625 pop bc - pop af - ret c - dec b - ret z - inc a - inc e - inc e - jr .asm_b3ed -; 0xb3fe + jr nc, .asm_b7f3 + ld a, $ff + call Func_b625 + jr c, .asm_b7ea + ldtx hl, ThisDeckCanOnlyBeBuiltIfYouDismantleText + call DrawWideTextBox_WaitForInput + call Func_b87d + jr nc, .asm_b7f3 -Unknown_b3fe: ; b3fe (2:73fe) - INCROM $b3fe, $b403 +.asm_b7e5 + ld a, [wNamingScreenCursorY] + scf + ret -Func_b403: ; b403 (2:7403) - call Func_b704 - ld hl, hffb0 - ld [hl], $01 - call Func_b3b3 - lb de, 1, 14 - call InitTextPrinting - ld hl, wd0a7 - ld a, [hli] - ld h, [hl] - ld l, a - call ProcessTextFromID - ld hl, hffb0 - ld [hl], $00 - jr Func_b3e5 -; 0xb424 +.asm_b7ea + ldtx hl, YouDoNotOwnAllCardsNeededToBuildThisDeckText + call DrawWideTextBox_WaitForInput + jp Func_b8f4 -Func_b424: ; b424 (2:7424) - ld b, a - push bc - ld hl, wDefaultText - inc a - call ConvertToNumericalDigits - ld [hl], $77 - inc hl - ld [hl], $00 - call InitTextPrinting - ld hl, wDefaultText - call ProcessText - pop af - push af - sla a - ld l, a - ld h, $00 - ld bc, wd00d +.asm_b7f3 + call EnableSRAM + call Func_b644 + call Func_b6a1 + call Func_b664 + call DisableSRAM + jr nc, .asm_b80b + call Func_b738 + jr nc, .asm_b80b + scf + ret + +.asm_b80b + ld [wd08a + $17], a + ld a, [wd088] + ld c, a + ld b, $00 + sla c + ld hl, wd00d add hl, bc ld a, [hli] ld h, [hl] ld l, a - inc d - inc d - inc d - push de - call Func_92be - pop de - pop bc - jr nc, .asm_b46b - call InitTextPrinting - ldtx hl, Text025b - call ProcessTextFromID - ld d, 13 - inc e - call InitTextPrinting - ld hl, Text_b4d4 - call ProcessText - scf - ret + ld de, wc000 + ld b, $54 + call EnableSRAM + call CopyNBytesFromHLToDE -.asm_b46b - push de - push bc - ld d, 18 - call InitTextPrinting - ld a, $00 - call Func_b625 - pop bc - ld hl, wDefaultText - jr c, .asm_b482 - ld de, $35f - jr .asm_b4c2 + ld hl, wc000 + $18 + call Func_b644 + call Func_910a + ld a, [wd08a + $17] + ld l, a + ld h, $54 + call HtimesL + ld bc, sDeck1Name + add hl, bc + ld d, h + ld e, l + ld hl, wc000 + ld b, $54 + call CopyNBytesFromHLToDE + call DisableSRAM -.asm_b482 - push bc ld a, $ff - call Func_b625 - jr c, .asm_b490 - pop bc - ld de, $360 - jr .asm_b4c2 - -.asm_b490 - ld de, $6c - call Func_22ca - pop bc - pop de - push bc - ld d, 17 - inc e - call InitTextPrinting - pop bc - call Func_b4e1 - call CalculateOnesAndTensDigits - ld hl, wOnesAndTensPlace - ld a, [hli] - ld b, a - ld a, [hl] - ld hl, wDefaultText - ld [hl], TX_SYMBOL - inc hl - ld [hli], a - ld [hl], TX_SYMBOL - inc hl - ld a, b - ld [hli], a - ld [hl], TX_END - ld hl, wDefaultText - call ProcessText - or a - ret + call Func_9168 + ld a, [wd08a + $17] + ld [wceb1], a + ld hl, DeckMachineMenuParameters + call InitializeMenuParameters + call DrawCursor2 + call GetPointerToDeckName + call EnableSRAM + call Func_9253 + call DisableSRAM + call Func_b664 -.asm_b4c2 - call Func_22ca - pop de - ld d, 13 - inc e - call InitTextPrinting - ld hl, Text_b4d4 - call ProcessText - or a + xor a + ld [wTxRam2 + 0], a + ld [wTxRam2 + 1], a + ldtx hl, BuiltDeckText + call DrawWideTextBox_WaitForInput + scf ret -; 0xb4d4 - -Text_b4d4: ; b4d4 (2:74d4) - db TX_SYMBOL, TX_END - db TX_SYMBOL, TX_END - db TX_SYMBOL, TX_END - db TX_SYMBOL, TX_END - db TX_SYMBOL, TX_END - db TX_SYMBOL, TX_END - db TX_END -; 0xb4e1 +; 0xb87d -Func_b4e1: ; b4e1 (2:74e1) - push bc +Func_b87d: ; b87d (2:787d) + farcall Func_1ba9a call Func_b644 - call Func_a3ca + call Func_9168 + ldtx hl, DismantleTheseDecksText + call YesOrNoMenuWithText + jr nc, .yes +; no call Func_b664 - pop bc - sla b - ld c, b - ld b, $00 - ld hl, wd00d - add hl, bc - ld a, [hli] - ld h, [hl] + scf + ret + +.yes + call EnableSRAM + ld a, [wd0a6] + bit 0, a + jr z, .asm_b8a3 + ld a, $00 + call .Func_b8db +.asm_b8a3 + ld a, [wd0a6] + bit 1, a + jr z, .asm_b8af + ld a, $01 + call .Func_b8db +.asm_b8af + ld a, [wd0a6] + bit 2, a + jr z, .asm_b8bb + ld a, $02 + call .Func_b8db +.asm_b8bb + ld a, [wd0a6] + bit 3, a + jr z, .asm_b8c7 + ld a, $03 + call .Func_b8db +.asm_b8c7 + call DisableSRAM + ld a, [wd0a6] + call Func_9168 + call Func_b664 + ldtx hl, DismantledTheDeckText + call DrawWideTextBox_WaitForInput + or a + ret + +.Func_b8db ld l, a + ld h, $54 + call HtimesL + ld bc, sDeck1Name + add hl, bc + push hl ld bc, $18 add hl, bc + call Func_9152 + pop hl + ld a, $54 + call ClearNBytesFromHL + ret +; 0xb8f4 + +Func_b8f4: ; b8f4 (2:78f4) + ld a, [wd088] + ld [wceb1], a + call Func_b611 + ld hl, $18 + add hl, de + ld de, wcf17 + ld b, DECK_SIZE call EnableSRAM - ld de, wTempCardCollection - ld bc, $0 -.asm_b505 - inc b - ld a, DECK_SIZE - cp b - jr c, .asm_b520 + call CopyNBytesFromHLToDE + call DisableSRAM + xor a + ld [wcf53], a + call Func_a028 + call Func_a06e + ld a, $ff + call Func_b644 + call Func_a3ca + call Func_b664 + ld hl, wTempHandCardList + ld de, wHandTempList +.asm_b92a ld a, [hli] - push hl - ld l, a - ld h, $00 - add hl, de - ld a, [hl] - and $7f or a - jr z, .asm_b51c - dec a - ld [hl], a - pop hl - jr .asm_b505 -.asm_b51c - inc c + jr z, .asm_b946 + ld b, a + push bc + push de + push hl + ld hl, wcf17 + call Func_b960 pop hl - jr .asm_b505 -.asm_b520 + pop de + pop bc + jr nc, .asm_b92a + ld c, a + ld a, b +.asm_b93f + ld [de], a + inc de + dec c + jr nz, .asm_b93f + jr .asm_b92a +.asm_b946 + xor a + ld [de], a + ldtx bc, TheseCardsAreNeededToBuildThisDeckText + ld hl, wcfda ld a, c - call DisableSRAM - ret -; 0xb525 - - INCROM $b525, $b545 - -Func_b545: ; b545 (2:7545) - INCROM $b545, $b592 + ld [hli], a + ld a, b + ld [hl], a + call Func_b611 + ld h, d + ld l, e + ld de, wHandTempList + call Func_adfe + jp Func_b7c6.asm_b7e5 +; 0xb960 -Func_b592: ; b592 (2:7592) - INCROM $b592, $b611 +Func_b960: ; b960 (2:7960) + call .Func_b976 + ld hl, wc000 + push de + call .Func_b986 + ld a, e + pop de + cp d + jr c, .asm_b971 + or a + ret +.asm_b971 + ld e, a + ld a, d + sub e + scf + ret z -Func_b611: ; b611 (2:7611) +.Func_b976 push af - push hl - ld a, [wd088] - sla a ld e, a ld d, $00 - ld hl, wd00d - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - pop hl +.loop + ld a, [hli] + or a + jr z, .asm_b984 + cp e + jr nz, .loop + inc d + jr .loop +.asm_b984 pop af ret -; 0xb625 - -Func_b625: ; b625 (2:7625) - INCROM $b625, $b644 - -Func_b644: ; b644 (2:7644) - INCROM $b644, $b653 - -Func_b653: ; b653 (2:7653) - INCROM $b653, $b664 -Func_b664: ; b664 (2:7664) +.Func_b986 push af - push bc - ldh a, [hBankSRAM] - ld b, a - ld a, [wd0a4] - cp b - jr z, .asm_b672 - call BankswitchSRAM -.asm_b672 - pop bc + ld e, a + ld d, $00 + add hl, de + ld a, [hl] + and $7f + ld e, a pop af ret -; 0xb675 +; 0xb991 - INCROM $b675, $b6ca - -Func_b6ca: ; b6ca (2:76ca) - INCROM $b6ca, $b6fb +PrinterMenu_DeckConfiguration: ; b991 (2:7991) + xor a + ld [wcea1], a + call Func_b379 + ld a, DECK_SIZE + ld [wd0a5], a -Data_b6fb: ; b6fb (2:76fb) - db $01, $02, $02, $00, $05, $0f, $00, $00, $00 + xor a +.asm_b99e + ld hl, Data_b6fb + call Func_9a6d + call Func_b704 + call Func_b545 + ld hl, WaitForVBlank.lcd_off + call DrawWideTextBox_PrintText + ld de, WaitForVBlank.lcd_off + call Func_b285 +.asm_b9b6 + call Func_b29f + jr c, .asm_b99e + cp $ff + ret z -Func_b704: ; b704 (2:7704) - INCROM $b704, $b7c6 + ld b, a + ld a, [wcea1] + add b + ld [wd088], a + call Func_b35b + jr c, .asm_b9b6 + call DrawWideTextBox + ldtx hl, PrintThisDeckText + call YesOrNoMenuWithText + jr c, .no + call Func_b611 + ld hl, $18 + add hl, de + ld de, wcf17 + ld b, DECK_SIZE + call EnableSRAM + call CopyNBytesFromHLToDE + call DisableSRAM + xor a + ld [wcf53], a + call Func_a028 + ld a, [wd088] + bank1call Func_7580 + call Func_b379 -Func_b7c6: ; b7c6 (2:77c6) - INCROM $b7c6, $ba04 +.no + ld a, [wd086] + ld [wNamingScreenCursorY], a + jp .asm_b99e +; 0xba04 Func_ba04: ; ba04 (2:7a04) ld a, [wd0a9] @@ -5771,13 +9116,13 @@ Func_ba04: ; ba04 (2:7a04) ; fallthrough Func_ba25: ; ba25 (2:7a25) - ld hl, Func_bb6e + ld hl, .MenuParameters call InitializeMenuParameters ldtx hl, PleaseSelectDeckText call DrawWideTextBox_PrintText ld a, $5 ld [wNamingScreenKeyboardHeight], a - ld hl, Unknown_b3fe + ld hl, Func_b3fe ld d, h ld a, l ld hl, wcece @@ -5934,11 +9279,20 @@ Func_ba25: ; ba25 (2:7a25) ld a, [wd086] jp Func_ba25 -Func_bb6e: ; bb6e (2:7b6e) - INCROM $bb6e, $bb76 +.MenuParameters + db 1, 2 ; cursor x, cursor y + db 2 ; y displacement between items + db 5 ; number of items + db SYM_CURSOR_R ; cursor tile number + db SYM_SPACE ; tile behind cursor + dw NULL ; function pointer if non-0 +; 0xbb76 Data_bb76: ; bb76 (2:7b76) - INCROM $bb76, $bb83 + textitem 2, 14, BuildADeckText + textitem 12, 14, CancelText + textitem 2, 16, ReadTheInstructionsText + db $ff Data_bb83: ; bb83 (2:7b83) tx FightingMachineText @@ -5953,7 +9307,59 @@ Data_bb83: ; bb83 (2:7b83) tx LegendaryMachineText Func_bb97: ; bb97 (2:7b97) - INCROM $bb97, $bc04 + call Set_OBJ_8x8 + xor a + ld [wTileMapFill], a + call ZeroObjectPositions + call EmptyScreen + ld a, $01 + ld [wVBlankOAMCopyToggle], a + call LoadSymbolsFont + call LoadDuelCardSymbolTiles + bank1call SetDefaultPalettes + lb de, $3c, $ff + call SetupText + lb de, 0, 0 + lb bc, 20, 13 + call DrawRegularTextBox + ld de, $100 + call InitTextPrinting + ld hl, wd0a2 + ld a, [hli] + ld h, [hl] + ld l, a + call ProcessTextFromID + call Func_b653 + farcall Func_1ba14 + call Func_bbe4 + call Func_b3e5 + call Func_b644 + call EnableLCD + ret +; 0xbbe4 + +Func_bbe4: ; bbe4 (2:7be4) + ld a, $0a + ld hl, wd00d + call ClearNBytesFromHL + ld de, wd00d + ld hl, s0a350 + ld bc, $54 + ld a, $05 +.loop + push af + ld a, l + ld [de], a + inc de + ld a, h + ld [de], a + inc de + add hl, bc + pop af + dec a + jr nz, .loop + ret +; 0xbc04 Func_bc04: ; bc04 (2:7c04) xor a diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index d2065ae..fa60650 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -1272,7 +1272,7 @@ Func_c877: ; c877 (3:4877) ldh [hSCY], a call Set_OBJ_8x16 farcall Func_1288c - farcall Func_ad51 + farcall HandlePrinterMenu call Set_OBJ_8x8 call WhiteOutDMGPals call DoFrameIfLCDEnabled diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index a03f631..c52a4a4 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -2087,8 +2087,8 @@ Func_1996e: ; 1996e (6:596e) add hl, de dec c jr nz, .asm_199b2 - ld a, $2 - ld [s0a003], a + ld a, 2 + ld [sPrinterContrastLevel], a ld a, $2 ld [sTextSpeed], a ld [wTextSpeed], a @@ -2673,6 +2673,7 @@ CalculateNameHash: ; 19e32 (6:5e32) ret ; 0x19e42 +Func_19e42: ; 19e42 (6:5e42) INCROM $19e42, $19e5a ; shows message on screen depending on wPrinterStatus @@ -2955,7 +2956,7 @@ Func_1a035: ; 1a035 (6:6035) ld a, $10 ld [wce9b], a call EnableSRAM - ld a, [s0a003] + ld a, [sPrinterContrastLevel] ld [wce99], a call DisableSRAM ldh a, [hBankSRAM] @@ -3140,7 +3141,13 @@ Func_1a138: ; 1a138 (6:6138) db $00, $20, $40, $60, $7f ; 0x1a14b - INCROM $1a14b, $1a435 + INCROM $1a14b, $1a162 + +Func_1a162: ; 1a162 (6:6162) + INCROM $1a162, $1a270 + +Func_1a270: ; 1a270 (6:6270) + INCROM $1a270, $1a435 ; compresses $28 tiles in sGfxBuffer5 ; and writes it in sGfxBuffer5 + $28 tiles. @@ -4917,11 +4924,9 @@ KeyboardData_Deck: ; 1b019 (6:7019) ; unknown data. ; needs analyze. ; (6:70d6) - INCROM $1b0d6, $1ba12 + INCROM $1b0d6, $1ba14 -Func_1ba12: ; 1ba12 (6:7a12) - push af - ld [bc], a +Func_1ba14: ; 1ba14 (6:7a14) call EnableSRAM ld a, [wd0a9] ld l, a diff --git a/src/engine/bank1c.asm b/src/engine/bank1c.asm index 1c68fb5..e7eb5e5 100644 --- a/src/engine/bank1c.asm +++ b/src/engine/bank1c.asm @@ -430,7 +430,7 @@ ENDM border_medal_tile v0Tiles1 + $23a, $6a, $10 border_medal_tile v0Tiles1 + $23c, $6b, $10 -; FIGHTING_MEDAL +; PSYCHIC_MEDAL border_medal_tile v0Tiles1 + $2b8, $7e, $10 border_medal_tile v0Tiles1 + $2ba, $7f, $10 border_medal_tile v0Tiles1 + $2bc, $80, $10 @@ -452,7 +452,7 @@ ENDM border_medal_tile v0Tiles1 + $43a, $7c, $10 border_medal_tile v0Tiles1 + $43c, $7d, $10 -; PSYCHIC_MEDAL +; FIGHTING_MEDAL border_medal_tile v0Tiles1 + $4b8, $6c, $10 border_medal_tile v0Tiles1 + $4ba, $6d, $10 border_medal_tile v0Tiles1 + $4bc, $6e, $10 diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index b8b4914..e999242 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -6660,7 +6660,7 @@ Peek_SelectEffect: ; 2e2b4 (b:62b4) call SwapTurn ldh a, [hAIPkmnPowerEffectParam] xor $80 - call Func_30f9 + call DrawAIPeekScreen call SwapTurn ldtx hl, CardPeekWasUsedOnText call DrawWideTextBox_WaitForInput diff --git a/src/engine/home.asm b/src/engine/home.asm index b848287..05a5cdc 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -9315,34 +9315,35 @@ Func_30e7: ; 30e7 (0:30e7) ld a, b ret -Func_30f9: ; 30f9 (0:30f9) +DrawAIPeekScreen: ; 30f9 (0:30f9) ld b, a ldh a, [hBankROM] push af - ld a, BANK(Func_8932) + ld a, BANK(_DrawAIPeekScreen) call BankswitchROM - call Func_8932 + call _DrawAIPeekScreen pop af call BankswitchROM ret -Func_310a: ; 310a (0:310a) - ld [wce59], a +; a = number of prize cards for player to select to take +SelectPrizeCards: ; 310a (0:310a) + ld [wNumberOfPrizeCardsToSelect], a ldh a, [hBankROM] push af - ld a, BANK(Func_8aaa) + ld a, BANK(_SelectPrizeCards) call BankswitchROM - call Func_8aaa + call _SelectPrizeCards pop af call BankswitchROM ret -Func_311d: ; 311d (0:311d) +DrawPlayAreaToPlacePrizeCards: ; 311d (0:311d) ldh a, [hBankROM] push af - ld a, BANK(Func_8b85) + ld a, BANK(_DrawPlayAreaToPlacePrizeCards) call BankswitchROM - call Func_8b85 + call _DrawPlayAreaToPlacePrizeCards pop af call BankswitchROM ret diff --git a/src/hram.asm b/src/hram.asm index fee69a9..6877f9c 100644 --- a/src/hram.asm +++ b/src/hram.asm @@ -171,6 +171,7 @@ hCurSelectionItem:: ; ffb2 hffb3:: ; ffb3 ds $1 +hffb4:: ; ffb4 ds $1 hffb5:: ; ffb5 diff --git a/src/sram.asm b/src/sram.asm index 481c8e4..cb8d7d2 100644 --- a/src/sram.asm +++ b/src/sram.asm @@ -3,7 +3,9 @@ SECTION "SRAM0", SRAM s0a000:: ; a000 ds $3 -s0a003:: ; a003 +; what was the last option selected by the player +; for the printer contrast level (0 ~ 4) +sPrinterContrastLevel:: ; a003 ds $1 s0a004:: ; a004 ds $1 diff --git a/src/text/text2.asm b/src/text/text2.asm index 0e0c083..1cba1e0 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -1607,15 +1607,15 @@ PleaseSelectDeckText: ; 3ba0d (e:7a0d) text "Please select deck." done -Text0225: ; 3ba22 (e:7a22) +ModifyDeckText: ; 3ba22 (e:7a22) text "Modify deck" done -Text0226: ; 3ba2f (e:7a2f) +ChangeNameText: ; 3ba2f (e:7a2f) text "Change name" done -Text0227: ; 3ba3c (e:7a3c) +SelectDeckText: ; 3ba3c (e:7a3c) text "Select deck" done @@ -1771,7 +1771,7 @@ WhichCardWouldYouLikeToSeeText: ; 3bce5 (e:7ce5) text "Which card would you like to see?" done -Text024d: ; 3bd08 (e:7d08) +PleaseChooseAPrizeText: ; 3bd08 (e:7d08) text "Please choose a Prize." done @@ -1792,31 +1792,31 @@ EmptyLineText: ; 3bd42 (e:7d42) textfw0 " ", " ", " ", " ", " ", " ", " ", " ", " " done -Text0252: ; 3bd55 (e:7d55) +BoosterPackTitleText: ; 3bd55 (e:7d55) text "Booster Pack" done -Text0253: ; 3bd63 (e:7d63) +Item1ColosseumText: ; 3bd63 (e:7d63) text "1. Colosseum" done -Text0254: ; 3bd71 (e:7d71) +Item2EvolutionText: ; 3bd71 (e:7d71) text "2. Evolution" done -Text0255: ; 3bd7f (e:7d7f) +Item3MysteryText: ; 3bd7f (e:7d7f) text "3. Mystery" done -Text0256: ; 3bd8b (e:7d8b) +Item4LaboratoryText: ; 3bd8b (e:7d8b) text "4. Laboratory" done -Text0257: ; 3bd9a (e:7d9a) +Item5PromotionalCardText: ; 3bd9a (e:7d9a) text "5. Promotional Card" done -Text0258: ; 3bdaf (e:7daf) +ViewWhichCardFileText: ; 3bdaf (e:7daf) text "View which Card File?" done @@ -1824,7 +1824,7 @@ Text0259: ; 3bdc6 (e:7dc6) textfw0 "-", "-", "-", "-", "-", "-", "-", "-", "-", "-" done -Text025a: ; 3bdd1 (e:7dd1) +SCardsText: ; 3bdd1 (e:7dd1) text "'s Cards" done @@ -1836,19 +1836,19 @@ DeckSaveMachineText: ; 3bdea (e:7dea) text " Deck Save Machine " done -Text025d: ; 3be02 (e:7e02) +SaveADeckText: ; 3be02 (e:7e02) text "Save a Deck" done -Text025e: ; 3be0f (e:7e0f) +DeleteADeckText: ; 3be0f (e:7e0f) text "Delete a Deck" done -Text025f: ; 3be1e (e:7e1e) +BuildADeckText: ; 3be1e (e:7e1e) text "Build a Deck" done -Text0260: ; 3be2c (e:7e2c) +ChooseADeckToSaveText: ; 3be2c (e:7e2c) text "Choose a Deck to Save." done @@ -1861,7 +1861,7 @@ Text0262: ; 3be7d (e:7e7d) text "for" done -Text0263: ; 3be82 (e:7e82) +SavedTheConfigurationForText: ; 3be82 (e:7e82) text "Saved the configuration for" line "" text "! " @@ -1876,21 +1876,21 @@ Text0265: ; 3beb7 (e:7eb7) line "configuration to delete." done -Text0266: ; 3bee7 (e:7ee7) +DoYouReallyWishToDeleteText: ; 3bee7 (e:7ee7) text "Do you really wish to delete?" done -Text0267: ; 3bf06 (e:7f06) +DeletedTheConfigurationForText: ; 3bf06 (e:7f06) text "Deleted the configuration for" line "" text "." done -Text0268: ; 3bf29 (e:7f29) +YouMayOnlyCarry4DecksText: ; 3bf29 (e:7f29) text "You may only carry 4 Decks!" done -Text0269: ; 3bf46 (e:7f46) +ChooseADeckToDismantleText: ; 3bf46 (e:7f46) text "Choose a deck to dismantle." done @@ -1905,7 +1905,7 @@ Text026b: ; 3bf73 (e:7f73) line "you wish to Build." done -Text026c: ; 3bf9e (e:7f9e) +ThisDeckCanOnlyBeBuiltIfYouDismantleText: ; 3bf9e (e:7f9e) text "This Deck can only be built if" line "you dismantle another Deck." done diff --git a/src/text/text3.asm b/src/text/text3.asm index 3d32c15..bf23e60 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -1,23 +1,23 @@ -Text026d: ; 3c000 (f:4000) +YouDoNotOwnAllCardsNeededToBuildThisDeckText: ; 3c000 (f:4000) text "You do not own all cards needed" line "to build this Deck." done -Text026e: ; 3c035 (f:4035) +BuiltDeckText: ; 3c035 (f:4035) text "Built" line "" done -Text026f: ; 3c03e (f:403e) +TheseCardsAreNeededToBuildThisDeckText: ; 3c03e (f:403e) text "These cards are needed" line "to build this Deck:" done -Text0270: ; 3c06a (f:406a) +DismantleTheseDecksText: ; 3c06a (f:406a) text "Dismantle these Decks?" done -Text0271: ; 3c082 (f:4082) +DismantledTheDeckText: ; 3c082 (f:4082) text "Dismantled the Deck." done @@ -25,11 +25,11 @@ OKIfFileDeletedText: ; 3c098 (f:4098) text "OK if this file is deleted?" done -Text0273: ; 3c0b5 (f:40b5) +ReadTheInstructionsText: ; 3c0b5 (f:40b5) text "Read the Instructions" done -Text0274: ; 3c0cc (f:40cc) +PrintThisCardYesNoText: ; 3c0cc (f:40cc) text "Print this card?" line " Yes No" done @@ -39,7 +39,7 @@ Text0275: ; 3c0ef (f:40ef) line "to print." done -Text0276: ; 3c11d (f:411d) +PrintThisDeckText: ; 3c11d (f:411d) text "Print this Deck?" done @@ -48,7 +48,7 @@ Text0277: ; 3c12f (f:412f) line " Yes No" done -Text0278: ; 3c156 (f:4156) +PrintMenuItemsText: ; 3c156 (f:4156) text "Pokémon Cards" line "Deck Configuration" line "Card List" @@ -56,16 +56,16 @@ Text0278: ; 3c156 (f:4156) line "Quit Print" done -Text0279: ; 3c19b (f:419b) +WhatWouldYouLikeToPrintText: ; 3c19b (f:419b) text "What would you like to print?" done -Text027a: ; 3c1ba (f:41ba) +PleaseSetTheContrastText: ; 3c1ba (f:41ba) text "Please set the contrast:" line " Light 1 2 3 4 5 Dark" done -Text027b: ; 3c1f7 (f:41f7) +PleaseMakeSureToTurnGameBoyPrinterOffText: ; 3c1f7 (f:41f7) text "Please make sure to turn" line "the Game Boy Printer OFF." done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index b8a1dbf..02d028b 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -550,9 +550,9 @@ TextOffsets:: ; 34000 (d:4000) textpointer DeckNameKeyboardText ; 0x0222 textpointer NewDeckText ; 0x0223 textpointer PleaseSelectDeckText ; 0x0224 - textpointer Text0225 ; 0x0225 - textpointer Text0226 ; 0x0226 - textpointer Text0227 ; 0x0227 + textpointer ModifyDeckText ; 0x0225 + textpointer ChangeNameText ; 0x0226 + textpointer SelectDeckText ; 0x0227 textpointer CancelText ; 0x0228 textpointer Text0229 ; 0x0229 textpointer ChosenAsDuelingDeckText ; 0x022a @@ -590,53 +590,53 @@ TextOffsets:: ; 34000 (d:4000) textpointer InPlayAreaText ; 0x024a textpointer GlossaryText ; 0x024b textpointer WhichCardWouldYouLikeToSeeText ; 0x024c - textpointer Text024d ; 0x024d + textpointer PleaseChooseAPrizeText ; 0x024d textpointer HandText_2 ; 0x024e textpointer DuelistHandText_2 ; 0x024f textpointer DuelistDiscardPileText ; 0x0250 textpointer EmptyLineText ; 0x0251 - textpointer Text0252 ; 0x0252 - textpointer Text0253 ; 0x0253 - textpointer Text0254 ; 0x0254 - textpointer Text0255 ; 0x0255 - textpointer Text0256 ; 0x0256 - textpointer Text0257 ; 0x0257 - textpointer Text0258 ; 0x0258 + textpointer BoosterPackTitleText ; 0x0252 + textpointer Item1ColosseumText ; 0x0253 + textpointer Item2EvolutionText ; 0x0254 + textpointer Item3MysteryText ; 0x0255 + textpointer Item4LaboratoryText ; 0x0256 + textpointer Item5PromotionalCardText ; 0x0257 + textpointer ViewWhichCardFileText ; 0x0258 textpointer Text0259 ; 0x0259 - textpointer Text025a ; 0x025a + textpointer SCardsText ; 0x025a textpointer Text025b ; 0x025b textpointer DeckSaveMachineText ; 0x025c - textpointer Text025d ; 0x025d - textpointer Text025e ; 0x025e - textpointer Text025f ; 0x025f - textpointer Text0260 ; 0x0260 + textpointer SaveADeckText ; 0x025d + textpointer DeleteADeckText ; 0x025e + textpointer BuildADeckText ; 0x025f + textpointer ChooseADeckToSaveText ; 0x0260 textpointer Text0261 ; 0x0261 textpointer Text0262 ; 0x0262 - textpointer Text0263 ; 0x0263 + textpointer SavedTheConfigurationForText ; 0x0263 textpointer Text0264 ; 0x0264 textpointer Text0265 ; 0x0265 - textpointer Text0266 ; 0x0266 - textpointer Text0267 ; 0x0267 - textpointer Text0268 ; 0x0268 - textpointer Text0269 ; 0x0269 + textpointer DoYouReallyWishToDeleteText ; 0x0266 + textpointer DeletedTheConfigurationForText ; 0x0267 + textpointer YouMayOnlyCarry4DecksText ; 0x0268 + textpointer ChooseADeckToDismantleText ; 0x0269 textpointer Text026a ; 0x026a textpointer Text026b ; 0x026b - textpointer Text026c ; 0x026c - textpointer Text026d ; 0x026d - textpointer Text026e ; 0x026e - textpointer Text026f ; 0x026f - textpointer Text0270 ; 0x0270 - textpointer Text0271 ; 0x0271 + textpointer ThisDeckCanOnlyBeBuiltIfYouDismantleText ; 0x026c + textpointer YouDoNotOwnAllCardsNeededToBuildThisDeckText ; 0x026d + textpointer BuiltDeckText ; 0x026e + textpointer TheseCardsAreNeededToBuildThisDeckText ; 0x026f + textpointer DismantleTheseDecksText ; 0x0270 + textpointer DismantledTheDeckText ; 0x0271 textpointer OKIfFileDeletedText ; 0x0272 - textpointer Text0273 ; 0x0273 - textpointer Text0274 ; 0x0274 + textpointer ReadTheInstructionsText ; 0x0273 + textpointer PrintThisCardYesNoText ; 0x0274 textpointer Text0275 ; 0x0275 - textpointer Text0276 ; 0x0276 + textpointer PrintThisDeckText ; 0x0276 textpointer Text0277 ; 0x0277 - textpointer Text0278 ; 0x0278 - textpointer Text0279 ; 0x0279 - textpointer Text027a ; 0x027a - textpointer Text027b ; 0x027b + textpointer PrintMenuItemsText ; 0x0278 + textpointer WhatWouldYouLikeToPrintText ; 0x0279 + textpointer PleaseSetTheContrastText ; 0x027a + textpointer PleaseMakeSureToTurnGameBoyPrinterOffText ; 0x027b textpointer ProceduresForSendingCardsText ; 0x027c textpointer CardSendingProceduresText ; 0x027d textpointer PleaseReadTheProceduresForSendingCardsText ; 0x027e diff --git a/src/wram.asm b/src/wram.asm index 75e1e66..f1b740d 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1740,9 +1740,14 @@ wInPlayAreaPreservedPosition:: ; ce57 wInPlayAreaTemporaryPosition:: ; ce58 ds $1 -wce59:: ; ce59 +; number of prize cards still to be +; picked by the player +wNumberOfPrizeCardsToSelect:: ; ce59 ds $1 +; pointer to a $ff-terminated list +; of the prize cards selected by the player +wSelectedPrizeCardListPtr:: ; ce5a ds $2 wce5c:: ; ce5c @@ -1917,7 +1922,13 @@ wceaa:: ; ceaa ds $1 wceab:: ; ceab - ds $4 + ds $1 + +wceac:: ; ceac + ds $2 + +wceae:: ; ceae + ds $1 wCheckMenuCursorXPosition:: ; ceaf ds $1 @@ -1974,7 +1985,9 @@ wced0:: ; ced0 wced2:: ; ced2 ds $1 -wced3:: ; ced3 +; the current filter being used +; from the CardTypeFilters list +wCurCardTypeFilter:: ; ced3 ds $1 wced4:: ; ced4 @@ -2012,7 +2025,10 @@ wcf16:: ; cf16 wcf17:: ; cf17 ds DECK_SIZE - ds $15 +wcf53:: ; cf53 + ds $1 + + ds $14 ; stores the count number of cards owned ; can be 0 in the case that a card is not available @@ -2049,14 +2065,27 @@ wCursorAlternateTile:: ; cfde wcfdf:: ; cfdf ds $1 - ds $3 +wcfe0:: ; cfe0 + ds $1 + +wcfe1:: ; cfe1 + ds $1 + +wcfe2:: ; cfe2 + ds $1 ; a flag indicating whether sfx should be played. wPlaysSfx:: ; cfe3 ds $1 wcfe4:: ; cfe4 - ds $3 + ds $1 + +wcfe5:: ; cfe5 + ds $1 + +wcfe6:: ; cfe6 + ds $1 ; a name buffer in the naming screen. wNamingScreenBuffer:: ; cfe7 @@ -2092,9 +2121,12 @@ wd009:: ; d009 ds $4 wd00d:: ; d00d - ds $1 + ds $18 - ds $78 + ds $60 + +wd085:: ; d085 + ds $1 wd086:: ; d086 ds $1 -- cgit v1.2.3