gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/examples/cross-platform/bcd/src/bcd.c
1 #include <stdint.h>
2 #include <stdio.h>
3
4 #include <gbdk/platform.h>
5 #include <gbdk/font.h>
6 #include <gbdk/bcd.h>
7
8 BCD bcd = MAKE_BCD(10203040);
9 BCD bcd2 = MAKE_BCD(05060708);
10 BCD bcd3 = MAKE_BCD(11111111);
11
12 uint8_t len = 0;
13 unsigned char buf[10];
14
15 void main(void) {
16 font_init();
17 font_set(font_load(font_spect));
18
19 len = bcd2text(&bcd, 0x10, buf);
20 set_bkg_tiles(5, 5, len, 1, buf);
21
22 bcd_add(&bcd, &bcd2);
23
24 len = bcd2text(&bcd, 0x10, buf);
25 set_bkg_tiles(5, 6, len, 1, buf);
26
27 bcd_sub(&bcd, &bcd3);
28
29 len = bcd2text(&bcd, 0x10, buf);
30 set_bkg_tiles(5, 7, len, 1, buf);
31
32 uint2bcd(12345, &bcd);
33
34 len = bcd2text(&bcd, 0x10, buf);
35 set_bkg_tiles(5, 8, len, 1, buf);
36 }
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.