From 7fdecfff5dc39c14e7cc02cf38c327284f10cc7d Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 22 May 2023 12:52:24 +0100 Subject: Write BCD numbers using the bitmap front --- game/text.asm | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) 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,