diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-05-31 00:45:21 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-05-31 00:45:21 -0500 |
commit | cce3534cef6818c87710257eab08580189a27809 (patch) | |
tree | 22b156155135014e1f4040fe3766f30c9b4b0561 /main.asm | |
parent | 7ead7d8a64f42c25869409131f2664a0233a3f57 (diff) |
copy in PrintBCDDigit from pokered
Diffstat (limited to 'main.asm')
-rw-r--r-- | main.asm | 33 |
1 files changed, 32 insertions, 1 deletions
@@ -365,7 +365,38 @@ CountSetBits: ; 0x335f ret ; 0x3376 -INCBIN "baserom.gbc",$3376,$4000 - $3376 +INCBIN "baserom.gbc",$3376,$38f2 - $3376 + +PrintBCDDigit: ; 38f2 + and a, %00001111 + and a + jr z, .zeroDigit\@ +.nonzeroDigit\@ + bit 7, b ; have any non-space characters been printed? + jr z, .outputDigit\@ +; if bit 7 is set, then no numbers have been printed yet + bit 5, b ; print the currency symbol? + jr z, .skipCurrencySymbol\@ + ld [hl], "¥" + inc hl + res 5, b +.skipCurrencySymbol\@ + res 7, b ; unset 7 to indicate that a nonzero digit has been reached +.outputDigit\@ + add a, "0" + ld [hli], a + jp PrintLetterDelay +.zeroDigit\@ + bit 7, b ; either printing leading zeroes or already reached a nonzero digit? + jr z, .outputDigit\@ ; if so, print a zero digit + bit 6, b ; left or right alignment? + ret nz + ld a, " " + ld [hli], a ; if right-aligned, "print" a space by advancing the pointer + ret +; 0x3917 + +INCBIN "baserom.gbc",$3917,$4000 - $3917 SECTION "bank1",DATA,BANK[$1] |