diff options
| author | Daniel Harding <33dannye@gmail.com> | 2018-07-01 10:54:43 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-01 10:54:43 -0500 |
| commit | e42ec2368b3f61715f1e86d26bd8706684336c62 (patch) | |
| tree | 7e290929824d0857be5846364da0007da0c749a5 /src/engine | |
| parent | 30aa1150f1c42a42aebb4dd1cd9f919b62cbff09 (diff) | |
| parent | e9d1642fbbe19df0dac0c2dca16ac22aed760b84 (diff) | |
Merge pull request #42 from xCrystal/master
More home disassembly ; Redesign TX_SYMBOL constants ; rename 'Kind' labels ; more wram addresses and text symbols ; Don't use the extras submodule ; Add support for disassembling poketcg-specific macros
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/bank01.asm | 94 | ||||
| -rw-r--r-- | src/engine/bank04.asm | 2 | ||||
| -rw-r--r-- | src/engine/bank06.asm | 6 | ||||
| -rw-r--r-- | src/engine/home.asm | 210 |
4 files changed, 212 insertions, 100 deletions
diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 6a21178..42719fe 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -12,7 +12,7 @@ GameLoop: ; 4000 (1:4000) ld a, [sa009] ld [wccf2], a call DisableSRAM - ld a, $1 + ld a, 1 ld [wUppercaseFlag], a ei farcall CommentedOut_1a6cc @@ -37,7 +37,7 @@ GameLoop: ; 4000 (1:4000) Func_4050: ; 4050 (1:4050) farcall Func_1996e - ld a, $1 + ld a, 1 ld [wUppercaseFlag], a ret @@ -76,7 +76,7 @@ ContinueDuel: ; 407a (1:407a) xor a ld [wDuelFinished], a call DuelMainInterface - jp StartDuel.begin_turn + jp MainDuelLoop.begin_turn ; 0x4097 FailedToContinueDuel: ; 4097 (1:4097) @@ -125,9 +125,10 @@ StartDuel: ; 409f (1:409f) call PlaySong call Func_4b60 ret c +; fallthrough ; the loop returns here after every turn switch -.main_duel_loop ; 40ee (1:40ee) +MainDuelLoop ; 40ee (1:40ee) xor a ld [wCurrentDuelMenuItem], a call UpdateSubstatusConditions_StartOfTurn @@ -154,7 +155,7 @@ StartDuel: ; 409f (1:409f) .next_turn call SwapTurn - jr .main_duel_loop + jr MainDuelLoop .practice_duel ld a, [wIsPracticeDuel] @@ -257,7 +258,7 @@ StartDuel: ; 409f (1:409f) ld a, PLAYER_TURN ldh [hWhoseTurn], a call Func_4b60 - jp .main_duel_loop + jp MainDuelLoop .link_duel call Func_0f58 @@ -271,7 +272,7 @@ StartDuel: ; 409f (1:409f) ld a, h ldh [hWhoseTurn], a call Func_4b60 - jp nc, .main_duel_loop + jp nc, MainDuelLoop ret ; 0x420b @@ -365,9 +366,8 @@ PrintDuelMenu: ; 4295 (1:4295) ret nz ld a, [wCurrentDuelMenuItem] call SetMenuItem -; fallthrough -HandleDuelMenuInputAndShortcuts: +.handle_input call DoFrame ldh a, [hButtonsHeld] and B_BUTTON @@ -393,11 +393,11 @@ HandleDuelMenuInputAndShortcuts: jp nz, DuelMenuShortcut_BothActivePokemon ld a, [wcbe7] or a - jr nz, HandleDuelMenuInputAndShortcuts + jr nz, .handle_input call HandleDuelMenuInput ld a, e ld [wCurrentDuelMenuItem], a - jr nc, HandleDuelMenuInputAndShortcuts + jr nc, .handle_input ldh a, [hCurrentMenuItem] ld hl, DuelMenuFunctionTable jp JumpToFunctionInTable @@ -608,7 +608,7 @@ OpenPlayerHandScreen: ; 4436 (1:4436) .handle_input call Func_55f0 push af - ld a, [wcbdf] + ld a, [wSortCardListByID] or a call nz, SortHandCardsByID pop af @@ -646,7 +646,7 @@ UseEnergyCard: ; 4477 (1:4477) call OpenPlayAreaScreenForSelection ; choose card to play energy card on jp c, DuelMainInterface ; exit if no card was chosen .play_energy_set_played - ld a, $1 + ld a, 1 ld [wAlreadyPlayedEnergy], a .play_energy ldh a, [hTempPlayAreaLocationOffset_ff9d] @@ -1858,22 +1858,22 @@ DrawDuelHUD: ; 5093 (1:5093) push de pop bc - ; print the Pkmn icon along with the no. of play area Pokemon - ld a, LOW("<PKMN_ICON>") + ; print the Pokemon icon along with the no. of play area Pokemon + ld a, SYM_POKEMON call WriteByteToBGMap0 inc b ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetTurnDuelistVariable - add LOW("<0>") - 1 + add SYM_0 - 1 call WriteByteToBGMap0 inc b ; print the Prize icon along with the no. of prizes yet to draw - ld a, LOW("<PRIZE_ICON>") + ld a, SYM_PRIZE call WriteByteToBGMap0 inc b call CountPrizes - add LOW("<0>") + add SYM_0 call WriteByteToBGMap0 ; print the arena Pokemon card name and level text @@ -1956,11 +1956,11 @@ DrawDuelHUD: ; 5093 (1:5093) call GetTurnDuelistVariable or a jr z, .check_defender - ld a, LOW("<PLUSPOWER>") + ld a, SYM_PLUSPOWER call WriteByteToBGMap0 inc b ld a, [hl] ; number of attached Pluspower - add LOW("<0>") + add SYM_0 call WriteByteToBGMap0 dec b .check_defender @@ -1969,11 +1969,11 @@ DrawDuelHUD: ; 5093 (1:5093) or a jr z, .done inc c - ld a, LOW("<DEFENDER>") + ld a, SYM_DEFENDER call WriteByteToBGMap0 inc b ld a, [hl] ; number of attached Defender - add LOW("<0>") + add SYM_0 call WriteByteToBGMap0 .done ret @@ -1996,10 +1996,10 @@ DrawDuelHorizontalSeparator: ; 516f (1:516f) DuelEAndHPTileData: ; 5188 (1:5188) ; x, y, tiles[], 0 - db 1, 1, LOW("<E>"), 0 - db 1, 2, LOW("<HP>"), 0 - db 9, 8, LOW("<E>"), 0 - db 9, 9, LOW("<HP>"), 0 + db 1, 1, SYM_E, 0 + db 1, 2, SYM_HP, 0 + db 9, 8, SYM_E, 0 + db 9, 9, SYM_HP, 0 db $ff ; 0x5199 @@ -2221,7 +2221,7 @@ DrawCardListScreenLayout: ; 559a (1:559a) ld hl, wSelectedDuelSubMenuItem ld [hli], a ld [hl], a - ld [wcbdf], a + ld [wSortCardListByID], a ld hl, wcbd8 ld [hli], a ld [hl], a @@ -2229,13 +2229,13 @@ DrawCardListScreenLayout: ; 559a (1:559a) ld a, START ld [wcbd6], a ld hl, wCardListInfoBoxText - ld [hl], LOW(PleaseSelectHandText_) + ldtx [hl], PleaseSelectHandText, & $ff inc hl - ld [hl], HIGH(PleaseSelectHandText_) + ldtx [hl], PleaseSelectHandText, >> 8 inc hl ; wCardListHeaderText - ld [hl], LOW(DuelistHandText_) + ldtx [hl], DuelistHandText, & $ff inc hl - ld [hl], HIGH(DuelistHandText_) + ldtx [hl], DuelistHandText, >> 8 .draw call ZeroObjectPositionsAndToggleOAMCopy call EmptyScreen @@ -2300,7 +2300,7 @@ Func_55f0: ; 55f0 (1:55f0) or a ret .asm_563b - ld a, [wcbdf] + ld a, [wSortCardListByID] or a jr nz, .asm_560b call SortCardsInDuelTempListByID @@ -2308,8 +2308,8 @@ Func_55f0: ; 55f0 (1:55f0) ld hl, wSelectedDuelSubMenuItem ld [hli], a ld [hl], a - ld a, $01 - ld [wcbdf], a + ld a, 1 + ld [wSortCardListByID], a call EraseCursor jr .asm_55f6 .asm_5654 @@ -2386,7 +2386,7 @@ Func_56a0: ; 56a0 (1:56a0) CardListParameters: ; 5710 (1;5710) db 1, 3 ; cursor x, cursor y db 4 ; item x - db $0e + db 14 ; maximum length, in tiles, occupied by the name and level string of each card in the list db 5 ; number of items selectable without scrolling db $0f ; cursor tile number db $00 ; tile behind cursor @@ -3190,7 +3190,7 @@ CheckPrintPoisoned: ; 63bb (1:63bb) and POISONED jr z, .print .poison - ld a, LOW("<POISONED>") + ld a, SYM_POISONED .print call WriteByteToBGMap0 pop af @@ -3224,8 +3224,8 @@ CheckPrintCnfSlpPrz: ; 63ce (1:63ce) ret .status_symbols - ; NO_STATUS, CONFUSED, ASLEEP, PARALYZED - db LOW("< >"), LOW("<CONFUSED>"), LOW("<ASLEEP>"), LOW("<PARALYZED>") + ; NO_STATUS, CONFUSED, ASLEEP, PARALYZED + db SYM_SPACE, SYM_CONFUSED, SYM_ASLEEP, SYM_PARALYZED ; 0x63e6 ; print the symbols of the attached energies of a turn holder's play area card @@ -3246,7 +3246,7 @@ PrintPlayAreaCardAttachedEnergies: ; 63e6 (1:63e6) jr nz, .empty_loop pop hl ld de, wAttachedEnergies - lb bc, LOW("<FIRE>"), NUM_TYPES - 1 + lb bc, SYM_FIRE, NUM_TYPES - 1 .next_color ld a, [de] ; energy count of current color inc de @@ -3264,7 +3264,7 @@ PrintPlayAreaCardAttachedEnergies: ; 63e6 (1:63e6) ld a, [wTotalAttachedEnergies] cp 9 jr c, .place_tiles - ld a, LOW("<+>") + ld a, SYM_PLUS ld [wDefaultText + 7], a .place_tiles pop bc @@ -3280,14 +3280,14 @@ PrintPlayAreaCardAttachedEnergies: ; 63e6 (1:63e6) ; input d, e: max. HP, current HP DrawHPBar: ; 6614 (1:6614) ld a, MAX_HP - ld c, LOW("< >") + ld c, SYM_SPACE call .fill_hp_bar ; empty bar ld a, d - ld c, LOW("<🌕>") + ld c, SYM_HP_OK call .fill_hp_bar ; fill (max. HP) with HP counters ld a, d sub e - ld c, LOW("<🌑>") + ld c, SYM_HP_NOK ; fill (max. HP - current HP) with damaged HP counters .fill_hp_bar or a @@ -3428,7 +3428,7 @@ AIUseEnergyCard: ; 69a5 (1:69a5) call LoadCardDataToBuffer1_FromDeckIndex call DrawLargePictureOfCard call $68e4 - ld a, $1 + ld a, 1 ld [wAlreadyPlayedEnergy], a call DrawDuelMainScene ret @@ -3762,7 +3762,7 @@ _TossCoin: ; 71ad (1:71ad) INCROM $72ff, $7354 BuildVersion: ; 7354 (1:7354) - db "VER 12/20 09:36",TX_END + db "VER 12/20 09:36", TX_END INCROM $7364, $7571 @@ -3770,8 +3770,8 @@ Func_7571: ; 7571 (1:7571) INCROM $7571, $7576 Func_7576: ; 7576 (1:7576) - farcall $6, $591f - ret + farcall $6, $591f + ret ; 0x757b INCROM $757b, $758f diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index 9bf84f3..3656e52 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -10,7 +10,7 @@ Func_10000: ; 10000 (4:4000) ldh [hSCX], a ldh [hSCY], a ld a, [wLCDC] - bit 7, a + bit LCDC_ON, a jr nz, .asm_10025 xor a ld [rSCX], a diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 1a85a24..7c19b74 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -58,14 +58,14 @@ _CopyCardNameAndLevel: ; 18000 (6:4000) jr z, .done ld a, TX_SYMBOL ld [hli], a - ld [hl], LOW("<Lv>") + ld [hl], SYM_Lv inc hl ld a, [wLoadedCard1Level] cp 10 jr c, .one_digit ld [hl], TX_SYMBOL inc hl - ld b, LOW("<0>") - 1 + ld b, SYM_0 - 1 .first_digit_loop inc b sub 10 @@ -76,7 +76,7 @@ _CopyCardNameAndLevel: ; 18000 (6:4000) .one_digit ld [hl], TX_SYMBOL inc hl - add LOW("<0>") + add SYM_0 ld [hl], a ; last (or only) digit inc hl .done diff --git a/src/engine/home.asm b/src/engine/home.asm index f3b5baf..14308b4 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -191,7 +191,7 @@ SetupTimer: ; 0241 (0:0241) .set_timer ld a, b ld [rTMA], a - ld a, rTAC_16384_HZ + ld a, TAC_16384_HZ ld [rTAC], a ld a, $7 ld [rTAC], a @@ -209,7 +209,7 @@ CheckForCGB: ; 025c (0:025c) WaitForVBlank: ; 0264 (0:0264) push hl ld a, [wLCDC] - bit rLCDC_ENABLE, a + bit LCDC_ON, a jr z, .asm_275 ld hl, wVBlankCtr ld a, [hl] @@ -224,12 +224,12 @@ WaitForVBlank: ; 0264 (0:0264) ; turn LCD on EnableLCD: ; 0277 (0:0277) - ld a, [wLCDC] ; - bit rLCDC_ENABLE, a ; - ret nz ; assert that LCD is off - or rLCDC_ENABLE_MASK ; - ld [wLCDC], a ; - ld [rLCDC], a ; turn LCD on + ld a, [wLCDC] ; + bit LCDC_ON, a ; + ret nz ; assert that LCD is off + or 1 << LCDC_ON ; + ld [wLCDC], a ; + ld [rLCDC], a ; turn LCD on ld a, FLUSH_ALL ld [wFlushPaletteFlags], a ret @@ -237,7 +237,7 @@ EnableLCD: ; 0277 (0:0277) ; wait for vblank, then turn LCD off DisableLCD: ; 028a (0:028a) ld a, [rLCDC] ; - bit rLCDC_ENABLE, a ; + bit LCDC_ON, a ; ret z ; assert that LCD is on ld a, [rIE] ld [wIE], a @@ -841,7 +841,9 @@ CallHL: ; 05c1 (0:05c1) jp hl ; 0x5c2 -Func_05c2: ; 5c2 (0:5c2) +; converts two one-digit numbers provided in a to text (ascii) format, +; writes them to [wcaa0] and [wcaa0 + 1], and to the BGMap0 address at bc +WriteTwoOneDigitNumbers: ; 05c2 (0:05c2) push hl push bc push de @@ -852,7 +854,7 @@ Func_05c2: ; 5c2 (0:5c2) pop bc call BCCoordToBGMap0Address pop hl - ld b, $02 + ld b, 2 call JPHblankCopyDataHLtoDE pop de pop bc @@ -860,7 +862,9 @@ Func_05c2: ; 5c2 (0:5c2) ret ; 0x5db -Func_05db: ; 5db (0:5db) +; converts a one-digit number provided in the lower nybble of a to text +; (ascii) format, and writes it to [wcaa0] and to the BGMap0 address at bc +WriteOneDigitNumber: ; 05db (0:05db) push hl push bc push de @@ -871,7 +875,7 @@ Func_05db: ; 5db (0:5db) pop bc call BCCoordToBGMap0Address pop hl - ld b, $01 + ld b, 1 call JPHblankCopyDataHLtoDE pop de pop bc @@ -879,7 +883,9 @@ Func_05db: ; 5db (0:5db) ret ; 0x5f4 -Func_05f4: ; 5f4 (0:5f4) +; converts four one-digit numbers provided in h and l to text (ascii) format, +; writes them to [wcaa0] through [wcaa0 + 3], and to the BGMap0 address at bc +WriteFourOneDigitNumbers: ; 05f4 (0:05f4) push hl push bc push de @@ -895,7 +901,7 @@ Func_05f4: ; 5f4 (0:5f4) pop bc call BCCoordToBGMap0Address pop hl - ld b, $04 + ld b, 4 call JPHblankCopyDataHLtoDE pop de pop bc @@ -903,16 +909,19 @@ Func_05f4: ; 5f4 (0:5f4) ret ; 0x614 -; given two numbers in the two nybbles of register a, write them -; in text format to hl (most significant nybble first) -WriteNumbersInTextFormat: ; 614 (0:614) +; given two one-digit numbers in the two nybbles of register a, +; write them in text (ascii) format to hl (most significant nybble first). +; numbers above 9 are converted to VWF tiles. +WriteNumbersInTextFormat: ; 0614 (0:0614) push af swap a call WriteNumberInTextFormat pop af ; fallthrough -; given a number in the (bottom nybble) of register a, write it in text format to hl +; given a one-digit number in the (lower nybble) of register a, +; write it in text (ascii) format to hl. +; numbers above 9 are converted to VWF tiles. WriteNumberInTextFormat: and $0f add "0" @@ -924,7 +933,46 @@ WriteNumberInTextFormat: ret ; 0x627 - INCROM $0627, $0663 +; converts the one-byte number at a to text (ascii) format, +; and writes it to [wcaa0] and the BGMap0 address at bc +WriteOneByteNumber: ; 0627 (0:0627) + push bc + push hl + ld l, a + ld h, $00 + ld de, wcaa0 + push de + push bc + ld bc, -100 + call TwoByteNumberToText.get_digit + ld bc, -10 + call TwoByteNumberToText.get_digit + ld bc, -1 + call TwoByteNumberToText.get_digit + pop bc + call BCCoordToBGMap0Address + pop hl + ld b, 3 + call JPHblankCopyDataHLtoDE + pop hl + pop bc + ret +; 0x650 + +; converts the two-byte number at hl to text (ascii) format, +; and writes it to [wcaa0] and the BGMap0 address at bc +WriteTwoByteNumber: ; 0650 (0:0650) + push bc + ld de, wcaa0 + push de + call TwoByteNumberToText + call BCCoordToBGMap0Address + pop hl + ld b, 5 + call JPHblankCopyDataHLtoDE + pop bc + ret +; 0x663 ; convert the number at hl to text (ascii) format and write it to de TwoByteNumberToText: ; 0663 (0:0663) @@ -1040,7 +1088,7 @@ WriteByteToBGMap0: ; 06c3 (0:06c3) ld [hl], a call BCCoordToBGMap0Address pop hl - ld b, $1 + ld b, 1 call HblankCopyDataHLtoDE pop bc pop de @@ -2083,7 +2131,67 @@ Func_0c53: ; 0c53 (0:0c53) ret ; 0xc5f - INCROM $0c5f, $0c91 +; returns a /= 10 +; returns carry if a % 10 >= 5 +Func_0c5f: ; 0c5f (0:0c5f) + push de + ld e, -1 +.asm_c62 + inc e + sub 10 + jr nc, .asm_c62 + add 5 + ld a, e + pop de + ret +; 0xc6c + +; Save a pointer to a list, given at de, to wListPointer +SetListPointer: ; 0c6c (0:0c6c) + push hl + ld hl, wListPointer + ld [hl], e + inc hl + ld [hl], d + pop hl + ret +; 0xc75 + +; Return the current element of the list at wListPointer, +; and advance the list to the next element +GetNextElementOfList: ; 0c75 (0:0c75) + push hl + push de + ld hl, wListPointer + ld e, [hl] + inc hl + ld d, [hl] + ld a, [de] + inc de +; fallthrough + +SetListToNextPosition: ; 0c7f (0:0c7f) + ld [hl], d + dec hl + ld [hl], e + pop de + pop hl + ret +; 0xc85 + +; Set the current element of the list at wListPointer to a, +; and advance the list to the next element +SetNextElementOfList: ; 0c85 (0:0c85) + push hl + push de + ld hl, wListPointer + ld e, [hl] + inc hl + ld d, [hl] + ld [de], a + inc de + jr SetListToNextPosition +; 0xc91 ; called at roughly 240Hz by TimerHandler SerialTimerHandler: ; 0c91 (0:0c91) @@ -4333,7 +4441,7 @@ Func_1823: ; 1823 (0:1823) DealConfusionDamageToSelf: ; 1828 (0:1828) bank1call DrawDuelMainScene - ld a, $1 + ld a, 1 ld [wDamageToSelfMode], a ldtx hl, DamageToSelfDueToConfusionText call DrawWideTextBox_PrintText @@ -4437,7 +4545,7 @@ CheckSelfConfusionDamage: ; 18d7 (0:18d7) ldtx de, ConfusionCheckDamageText call TossCoin jr c, .no_confusion_damage - ld a, $1 + ld a, 1 ld [wGotHeadsFromConfusionCheck], a scf ret @@ -5309,7 +5417,7 @@ GetCardAlbumProgress: ; 1da4 (0:1da4) ; if LCD on, copy during h-blank only SafeCopyDataDEtoHL: ; 1dca (0:1dca) ld a, [wLCDC] ; - bit rLCDC_ENABLE, a ; + bit LCDC_ON, a ; jr nz, .lcd_on ; assert that LCD is on .lcd_off_loop ld a, [de] @@ -5384,9 +5492,9 @@ DrawLabeledTextBox: ; 1e00 (0:1e00) push hl ; top left tile of the box ld hl, wc000 - ld a, $5 + ld a, TX_SYMBOL ld [hli], a - ld a, $18 + ld a, SYM_BOX_TOP_L ld [hli], a ; white tile before the text ld a, $70 @@ -5396,7 +5504,7 @@ DrawLabeledTextBox: ; 1e00 (0:1e00) ld d, h pop hl call CopyText - ld hl, $c003 + ld hl, wc000 + 3 call Func_23c1 ld l, e ld h, d @@ -5413,17 +5521,17 @@ DrawLabeledTextBox: ; 1e00 (0:1e00) jr z, .draw_top_border_right_tile ld b, a .draw_top_border_line_loop - ld a, $5 + ld a, TX_SYMBOL ld [hli], a - ld a, $1c + ld a, SYM_BOX_TOP ld [hli], a dec b jr nz, .draw_top_border_line_loop .draw_top_border_right_tile - ld a, $5 + ld a, TX_SYMBOL ld [hli], a - ld a, $19 + ld a, SYM_BOX_TOP_R ld [hli], a ld [hl], $0 pop bc @@ -6140,7 +6248,7 @@ Func_2325: ; 2325 (0:2325) ret ; search linked-list for letters e/d (regisers), if found hoist the result to -; head of list and return it. carry flag denotes success. +; head of list and return it. carry flag denotes success. Func_235e: ; 235e (0:235e) ld a, [wcd0a] ; or a ; @@ -6171,7 +6279,7 @@ Func_235e: ; 235e (0:235e) ld a, [hl] ; if key1[l] == e and ; cp d ; key2[l] == d: ; jr z, .asm_238f ; break ; -.asm_238a ; +.asm_238a ld h, $c8 ; ; ld l, [hl] ; l ← next[l] ; jr .asm_237d @@ -6269,7 +6377,7 @@ Func_23d3: ; 23d3 (0:23d3) ; convert the number at hl to TX_SYMBOL text format and write it to wcaa0 ; replace leading zeros with $00 -TwoByteNumberToLargeText_TrimLeadingZeros: ; 245d (0:245d) +TwoByteNumberToTxSymbol_TrimLeadingZeros: ; 245d (0:245d) push de push bc ld de, wcaa0 @@ -6291,14 +6399,14 @@ TwoByteNumberToLargeText_TrimLeadingZeros: ; 245d (0:245d) .digit_loop inc hl ld a, [hl] - cp LOW("<0>") + cp SYM_0 jr nz, .done ; jump if not zero - ld [hl], LOW("< >") ; trim leading zero + ld [hl], SYM_SPACE ; trim leading zero inc hl dec e jr nz, .digit_loop dec hl - ld [hl], LOW("<0>") + ld [hl], SYM_0 .done dec hl pop bc @@ -6309,7 +6417,7 @@ TwoByteNumberToLargeText_TrimLeadingZeros: ; 245d (0:245d) ld a, TX_SYMBOL ld [de], a inc de - ld a, LOW("<0>") - 1 + ld a, SYM_0 - 1 .substract_loop inc a add hl, bc @@ -6507,7 +6615,7 @@ InitializeCardListParameters: ; 25ea (0:25ea) ld a, [hli] ld [wListItemXPosition], a ld a, [hli] - ld [wcd1c], a + ld [wListItemNameMaxLength], a ld a, [hli] ld [wNumMenuItems], a ld a, [hli] @@ -6852,7 +6960,7 @@ PrintCardListItems: ; 2799 (0:2799) call LoadCardDataToBuffer1_FromDeckIndex call DrawCardSymbol call Func_22ae - ld a, [wcd1c] + ld a, [wListItemNameMaxLength] call CopyCardNameAndLevel ld hl, wDefaultText call Func_21c5 @@ -7648,12 +7756,16 @@ ReadTextOffset: ; 2ded (0:2ded) pop de ret -; convert the number at hl to text (ascii) format and write it to wcaa0 -; return c = 4 - leading_zeros +; if [wcd0a] != 0: +; convert the number at hl to text (ascii) format and write it to wcaa0 +; return c = 4 - leading_zeros +; if [wcd0a] == 0: +; convert the number at hl to TX_SYMBOL text format and write it to wcaa0 +; replace leading zeros with $00 TwoByteNumberToText_CountLeadingZeros: ; 2e12 (0:2e12) ld a, [wcd0a] or a - jp z, TwoByteNumberToLargeText_TrimLeadingZeros + jp z, TwoByteNumberToTxSymbol_TrimLeadingZeros ld de, wcaa0 push de call TwoByteNumberToText @@ -7683,7 +7795,7 @@ CopyTurnDuelistName: ; 2e2c (0:2e2c) pop hl ret -; prints text with id at hl with letter delay in a textbox area +; prints text with id at hl, with letter delay, in a textbox area PrintText: ; 2e41 (0:2e41) ld a, l or h @@ -7721,7 +7833,7 @@ PrintText: ; 2e41 (0:2e41) jr nc, .next_tile_loop ret -; prints text with id at hl without letter delay in a textbox area +; prints text with id at hl, without letter delay, in a textbox area PrintTextNoDelay: ; 2e76 (0:2e76) ldh a, [hBankROM] push af @@ -9436,7 +9548,7 @@ Func_380e: ; 380e (0:380e) ; enable the play time counter and execute the game event at [wGameEvent]. ; then return to the overworld, or restart the game (only after Credits). ExecuteGameEvent: ; 383d (0:383d) - ld a, $1 + ld a, 1 ld [wPlayTimeCounterEnable], a ldh a, [hBankROM] push af @@ -9967,7 +10079,7 @@ Func_3b31: ; 3b31 (0:3b31) ld [wcad4], a .asm_3b45 call ZeroObjectPositions - ld a, $1 + ld a, 1 ld [wVBlankOAMCopyToggle], a pop af call BankswitchHome @@ -10085,7 +10197,7 @@ Func_3c46: ; 3c46 (0:3c46) DoFrameIfLCDEnabled: ; 3c48 (0:3c48) push af ld a, [rLCDC] - bit rLCDC_ENABLE, a + bit LCDC_ON, a jr z, .done push bc push de |
