1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-22 14:33:51 +00:00
8bitworkshop/presets/c64/bcd.c

21 lines
279 B
C
Raw Normal View History

2020-02-02 18:17:31 +00:00
#include "common.h"
word bcd_add(word a, word b) {
2022-08-11 20:27:20 +00:00
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;
}
}