aboutsummaryrefslogtreecommitdiffstats
path: root/home/print_bcd.asm
diff options
context:
space:
mode:
authorSylvie <35663410+Rangi42@users.noreply.github.com>2024-09-23 23:51:44 -0400
committerGitHub <noreply@github.com>2024-09-23 23:51:44 -0400
commit8f1dcf07e598c6e3d34b5d255f04faff1667d83b (patch)
treefe962b2c23dd40ad3d69f7145a46a002c3285a76 /home/print_bcd.asm
parentRemove the Discord webhook and tools/unnamed.py (diff)
downloadpokeyellow-8f1dcf07e598c6e3d34b5d255f04faff1667d83b.tar.gz
pokeyellow-8f1dcf07e598c6e3d34b5d255f04faff1667d83b.tar.xz
pokeyellow-8f1dcf07e598c6e3d34b5d255f04faff1667d83b.zip
Identify more flag bits (#464)
Diffstat (limited to 'home/print_bcd.asm')
-rw-r--r--home/print_bcd.asm28
1 files changed, 14 insertions, 14 deletions
diff --git a/home/print_bcd.asm b/home/print_bcd.asm
index 38aedd3c..57ec12a8 100644
--- a/home/print_bcd.asm
+++ b/home/print_bcd.asm
@@ -13,12 +13,12 @@
; their meaning at the beginning of the functions's execution.
PrintBCDNumber::
ld b, c ; save flags in b
- res 7, c
- res 6, c
- res 5, c ; c now holds the length
- bit 5, b
+ res BIT_LEADING_ZEROES, c
+ res BIT_LEFT_ALIGN, c
+ res BIT_MONEY_SIGN, c ; c now holds the length
+ bit BIT_MONEY_SIGN, b
jr z, .loop
- bit 7, b
+ bit BIT_LEADING_ZEROES, b
jr nz, .loop
ld [hl], "¥"
inc hl
@@ -31,14 +31,14 @@ PrintBCDNumber::
inc de
dec c
jr nz, .loop
- bit 7, b ; were any non-zero digits printed?
+ bit BIT_LEADING_ZEROES, b
jr z, .done ; if so, we are done
.numberEqualsZero ; if every digit of the BCD number is zero
- bit 6, b ; left or right alignment?
+ bit BIT_LEFT_ALIGN, b
jr nz, .skipRightAlignmentAdjustment
dec hl ; if the string is right-aligned, it needs to be moved back one space
.skipRightAlignmentAdjustment
- bit 5, b
+ bit BIT_MONEY_SIGN, b
jr z, .skipCurrencySymbol
ld [hl], "¥"
inc hl
@@ -54,24 +54,24 @@ PrintBCDDigit::
and a
jr z, .zeroDigit
.nonzeroDigit
- bit 7, b ; have any non-space characters been printed?
+ bit BIT_LEADING_ZEROES, b
jr z, .outputDigit
; if bit 7 is set, then no numbers have been printed yet
- bit 5, b ; print the currency symbol?
+ bit BIT_MONEY_SIGN, b
jr z, .skipCurrencySymbol
ld [hl], "¥"
inc hl
- res 5, b
+ res BIT_MONEY_SIGN, b
.skipCurrencySymbol
- res 7, b ; unset 7 to indicate that a nonzero digit has been reached
+ res BIT_LEADING_ZEROES, b
.outputDigit
add "0"
ld [hli], a
jp PrintLetterDelay
.zeroDigit
- bit 7, b ; either printing leading zeroes or already reached a nonzero digit?
+ bit BIT_LEADING_ZEROES, b
jr z, .outputDigit ; if so, print a zero digit
- bit 6, b ; left or right alignment?
+ bit BIT_LEFT_ALIGN, b
ret nz
inc hl ; if right-aligned, "print" a space by advancing the pointer
ret