diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-22 12:52:24 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-22 12:52:24 +0100 |
commit | 7fdecfff5dc39c14e7cc02cf38c327284f10cc7d (patch) | |
tree | 6f656b00d376b3c2c90d086abe2624ffc0097edd | |
parent | 7a9afa86e9a25ad8246bf4d5665f869f2a162ae3 (diff) | |
download | tr8vm-7fdecfff5dc39c14e7cc02cf38c327284f10cc7d.tar.gz tr8vm-7fdecfff5dc39c14e7cc02cf38c327284f10cc7d.zip |
Write BCD numbers using the bitmap front
-rw-r--r-- | game/text.asm | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/game/text.asm b/game/text.asm index 388b0bf..0c7a1e6 100644 --- a/game/text.asm +++ b/game/text.asm @@ -93,3 +93,54 @@ put_text_c: ld y, 3 port b, y ret + +; +; in: [a : x]: number +; b, y: (x, y) dst coords +; stack: 1 byte digits +put_bcd_number: + push y + push b + +put_bcd_number_loop: + ld y, [a : x] + inc x + bo + inc a + + add y, 16 + + push a + push x + + rol y, 5 + ld x, y + and x, 31 + and y, 224 + + ld a, >font + add a, x + + ld x, <font + add x, y + bo + inc a + + call put_text_c + + pop x + pop a + + pop b + add b, 4 + push b + + ld y, [sp + 4] + dec y + ld [sp + 4], y + bnz + jmp put_bcd_number_loop + + pop b + pop y + ret |