-
Notifications
You must be signed in to change notification settings - Fork 0
/
animation.h
41 lines (39 loc) · 898 Bytes
/
animation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#if defined(__C64__) && defined(GRAPHIC) && defined(ANIMATION)
// from animation.s
void set_interrupt(void);
unsigned char tick = 0;
extern void animate(void)
{
switch (tick)
{
case 0:
VIC.addr = (VIC.addr & BYTE(1111,0000)) | BYTE(0000,1110);
break;
case 12:
VIC.addr = (VIC.addr & BYTE(1111,0000)) | BYTE(0000,1100);
break;
case 24:
VIC.addr = (VIC.addr & BYTE(1111,0000)) | BYTE(0000,1110);
break;
case 35:
VIC.addr = (VIC.addr & BYTE(1111,0000)) | BYTE(0000,1100);
break;
}
if (tick == 0) tick = 50;
tick--;
}
void set_animation(void)
{
/* https://sta.c64.org/cbm64mem.html https://www.c64-wiki.com/wiki/Raster_interrupt
*/
SEI();
CIA1.icr = BYTE(0111,1111); // to fix
VIC.ctrl1 = VIC.ctrl1 & BYTE(0111,1111);
__asm__("lda $DCOD");
__asm__("lda $DDOD");
VIC.rasterline = 210;
set_interrupt();
VIC.imr = BYTE(0000,0001);
CLI();
}
#endif