-
Notifications
You must be signed in to change notification settings - Fork 1
/
loadsprites.c
98 lines (77 loc) · 1.42 KB
/
loadsprites.c
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
void main()
{
shortcls();
poke( 0xD020, 1 );
poke( 0xD021, 1 );
// multicolour for sprites other than #2
poke( 0xD01C, 0x1B );
// colours for all sprites (Light grey)
poke( 0xD025, 0x0F );
// Black for all sprites
poke( 0xD026, 0x00 );
word xstart = 0x0040;
for( uint i = 0x00; i < 0x05; inc( i ) )
{
spritecolour( i, 0x09 );
spritex( i, xstart );
spritey( i, 0x40 );
xstart = xstart + 0x0020;
}
spritecolour( 0x02, 0x07 );
// turn on sprites (b000000011 = 0x03 = zero and one)
spriteon( 0x1F );
// sprite pointers
poke( 0x07F8, 192 );
poke( 0x07F9, 211 );
poke( 0x07FA, 224 );
poke( 0x07FB, 225 );
poke( 0x07FC, 226 );
setfilename( "SPRITES1,S,R" );
setlfs( 3, 8, 3 );
fopen();
fchkin( 3 );
for( word addr = 0xB000; addr < 0xB8C0; addr = addr + 0x0001 )
{
poke( addr, fchrin() );
}
fclose(3);
fclrchn();
animate();
return;
}
void animate()
{
uint A = peek( 0x07F8 );
uint B = peek( 0x07F9 );
clearkb();
uint c = getin();
while( c != 62 )
{
poke( 0x07F8, A );
poke( 0x07F9, B );
inc( A );
inc( B );
if( A > 210 )
{
A = 192;
}
if( B > 223 )
{
B = 211;
}
delay();
c = getin();
}
clearkb();
return;
}
void delay()
{
for( word x = 0x0000; x < 0x0AFF; x = x + 0x0001 )
{
nop();
nop();
nop();
}
return;
}