Skip to content

Commit b0276d9

Browse files
committed
Flash the text while playing music.
1 parent f61d0c8 commit b0276d9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

examples/sms/libpsgtest.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,32 @@ extern unsigned char music[];
88
static const unsigned char pal0[] =
99
{ 0x00, 0x3f };
1010

11+
static const unsigned char pal1[] =
12+
{ 0x00, 0x03 };
13+
14+
static const unsigned char *pal[] =
15+
{&pal0[1], &pal1[1]};
16+
1117
void isr(void)
1218
{
19+
static unsigned char flashDelay = 0;
20+
static unsigned char palette = 0;
21+
22+
// Flash the text by swapping palette index 1
23+
if(flashDelay++ & 0x10)
24+
{
25+
flashDelay = 0;
26+
palette ^= 1;
27+
load_palette((unsigned char *) pal[palette], 1, 1);
28+
}
29+
1330
// Play the next frame of music
1431
PSGFrame();
1532
}
1633

1734
void main(void)
1835
{
19-
int x = 0;
36+
unsigned char x = 0;
2037

2138
// Clear the video RAM
2239
clear_vram();

0 commit comments

Comments
 (0)