1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-25 03:34:05 +00:00
8bitworkshop/presets/c64/testlz4.c

51 lines
1.1 KiB
C

// sid config so we don't use stack above $8000
//#resource "c64-sid.cfg"
#define CFGFILE c64-sid.cfg
#include "common.h"
//#link "common.c"
#include "mcbitmap.h"
//#link "mcbitmap.c"
#include <lz4.h>
// include the LZ4 binary data -> image_c64_multi_lz4[]
const char image_c64_multi_lz4[] = {
#embed "image-c64.multi.lz4"
};
/*
CharData 8000 bytes
ScreenData 1000 bytes
ColorData 1000 bytes
XtraData 2 bytes
*/
void main() {
char* const uncomp = (char*)0xb000;
char bgcolor;
// setup VIC for multicolor bitmap
// colormap = $c000-$c7ff
// bitmap = $e000-$ffff
setup_bitmap_multi();
// enable HIMEM so we can write to $c000-$ffff
ENABLE_HIMEM();
// decompress into $8000-$a711
decompress_lz4(image_c64_multi_lz4+11, uncomp, 10002);
// read background color
bgcolor = uncomp[10000];
// copy data to destination areas
memcpy((void*)MCB_BITMAP, uncomp, 8000);
memcpy(COLOR_RAM, uncomp+9000, 1000);
memcpy((void*)MCB_COLORS, uncomp+8000, 1000);
DISABLE_HIMEM();
// set background color
VIC.bgcolor0 = bgcolor;
// wait for key
cgetc();
}