gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/examples/cross-platform/gbdecompress/src/main.c
1 #include <gbdk/platform.h>
2 #include <gbdk/gbdecompress.h>
3
4 #include <stdint.h>
5
6 // Include graphics data
7 #include "monalisa_tiles_comp.h"
8 #include "monalisa_map.h"
9
10 // The map tiles were exported from GBTD with compression enabled
11 // using this updated version of GBTD: https://github.com/untoxa/GBTD_GBMB
12 // Size was 4096 bytes -> 3493 bytes
13
14 uint8_t buffer[4096];
15
16 void main(void)
17 {
18 #if defined(SEGA)
19 __WRITE_VDP_REG(VDP_R2, R2_MAP_0x3800);
20 __WRITE_VDP_REG(VDP_R5, R5_SAT_0x3F00);
21 #endif
22 // Decompress the map tiles into the background tile vram.
23 //
24 // Notice that the number of tiles isn't specified. The amount
25 // of data to decompress is embedded in the compressed data.
26 //
27 // Note: For non-compressed data the equivalent would be: set_bkg_data(0, 253u, monalisa_tiles)
28 //
29 set_bkg_data(0, gb_decompress(monalisa_tiles_comp, buffer) >> 4, buffer);
30
31 // Now set the map and turn the background on
32 set_bkg_tiles(0,0, monalisa_mapWidth, monalisa_mapHeight, monalisa_mapPLN0);
33 SHOW_BKG;
34
35 // Loop forever
36 while(1) {
37
38 // Main loop processing goes here
39
40 // Done processing, yield CPU and wait for start of next frame
41 vsync();
42 }
43 }
44
45
46
47
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.