1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-28 05:29:33 +00:00
8bitworkshop/presets/c64/bcd.c
2022-08-20 18:03:54 -05:00

21 lines
279 B
C

#include "common.h"
word bcd_add(word a, word b) {
asm("sed");
a += b;
asm("cld");
return a;
}
void draw_bcd_word(word address, word bcd) {
byte i;
address += 4;
for (i=0; i<4; i++) {
POKE(address, (bcd & 0b1111) + '0');
address--;
bcd >>= 4;
}
}