1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-05-28 08:41:30 +00:00
8bitworkshop/presets/c64/sprite_test.c
2022-08-09 20:08:59 -05:00

43 lines
1.3 KiB
C

#include "common.h"
/*{w:24,h:21,bpp:1,brev:1,count:1}*/
const char SPRITE_DATA[64] = {
0x0f,0xff,0x80,0x17,0xff,0x40,0x2b,0xfe,
0xa0,0x7f,0xff,0xf0,0xff,0xc0,0x3f,0xe0,
0x3f,0xc0,0x17,0xbe,0xc0,0x2d,0x7f,0xf0,
0x2b,0x7f,0xf8,0x2a,0xff,0xf8,0x15,0xf6,
0x00,0x3f,0xf8,0x00,0xfd,0xfc,0x00,0xfd,
0xff,0x00,0xfe,0xff,0x80,0xff,0x7f,0xc0,
0xff,0xff,0xc0,0xff,0xff,0xc0,0x0a,0xa8,
0x00,0x0f,0xf8,0x00,0x0f,0xff,0x80,0x03,
};
/*{w:12,h:21,bpp:2,brev:1,count:1,aspect:2}*/
const char SPRITE_MC_DATA[64] = {
0x0a,0xaa,0x80,0x0a,0xaa,0x80,0x2a,0xaa,
0xa0,0x2a,0xaa,0xa0,0xaa,0xaa,0xaa,0xff,
0xd5,0x40,0x0d,0xd7,0x40,0x3d,0xd5,0x54,
0x37,0x55,0x54,0x37,0x55,0x54,0x35,0x55,
0x00,0x3a,0xa0,0x00,0xea,0xa8,0x00,0xab,
0xaa,0x00,0xab,0xaa,0x00,0xab,0xaa,0x80,
0xaa,0xea,0x80,0xaa,0xaa,0x80,0x0f,0xfc,
0x00,0x0f,0xfc,0x00,0x0f,0xff,0xc0,0x83,
};
void main(void) {
// clear the screen
clrscr();
// copy sprite pattern to RAM address 0x3800
memcpy((char*)0x3800, SPRITE_DATA, sizeof(SPRITE_DATA));
// set sprite #0 shape entry (224)
POKE(0x400 + 0x3f8, 0x3800 / 64);
// set X and Y coordinate for sprite #0
VIC.spr_pos[0].x = 172;
VIC.spr_pos[0].y = 145;
// set color for sprite #0
VIC.spr_color[0] = COLOR_GREEN;
// enable sprite #0
VIC.spr_ena = 0b00000001;
}