-
Notifications
You must be signed in to change notification settings - Fork 1
/
vartests.c
154 lines (124 loc) · 2.48 KB
/
vartests.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include <stdio.h>
int main()
{
cls();
romout();
saveregs();
// background colours
poke( 0xD020, 9 );
poke( 0xD021, 12 );
poke( 0xD011, 59 );
poke( 0xD016, 24 );
poke( 0xD018, 24 );
bank(1);
clearhires();
putbits();
pause();
bank(0);
restoreregs();
romin();
return;
}
void putbits()
{
data b =
{
0xFA, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xAA, 0xAA, 0xFA, 0x0F, 0x00, 0x00, 0x00, 0x00,
0xAA, 0xAA, 0xAA, 0xAA, 0xFA, 0x0F, 0x00, 0x00,
0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xFA, 0x0F,
0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAF, 0xF0,
0xAA, 0xAA, 0xAA, 0xAA, 0xAF, 0xF0, 0x00, 0x00,
0xAA, 0xAA, 0xAF, 0xF0, 0x00, 0x00, 0x00, 0x00,
0xAF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
uint bindex = 0;
uint x = 20;
uint y = 5;
word offset = 0x0000;
offset = y;
offset = offset * 40;
offset = offset + x;
word color1 = offset + 0xD800;
word colors2and3 = offset + 0x4400;
asl( offset );
asl( offset );
asl( offset );
word pixels = offset + 0x6000;
for( uint u = 0; u < 10; inc(u) )
{
poke( color1, 1 );
poke( colors2and3, 0x26 );
color1 = color1 + 1;
colors2and3 = colors2and3 + 1;
for( uint i = 0; i < 8; inc( i ) )
{
poke( pixels, (b)[bindex] );
pixels = pixels + 1;
inc( bindex );
}
}
return;
}
void saveregs()
{
uint oldD011 = peek( 0xD011 );
uint oldD016 = peek( 0xD016 );
uint oldD018 = peek( 0xD018 );
uint oldD020 = peek( 0xD020 );
uint oldD021 = peek( 0xD021 );
uint oldChar = peek( 0x0286 );
return;
}
void restoreregs()
{
poke( 0xD011, oldD011 );
poke( 0xD016, oldD016 );
poke( 0xD018, oldD018 );
poke( 0xD020, oldD020 );
poke( 0xD021, oldD021 );
poke( 0x0286, oldChar );
return;
}
void cr()
{
lda( 0x0D );
jsr( 0xFFD2 );
return;
}
void sp()
{
lda( 0x20 );
jsr( 0xFFD2 );
return;
}
void pause()
{
poke( 0x00C6, 0 );
jsr( 0xFFE4 );
uint pausev = getchar();
while( pausev == 0 )
{
pausev = getchar();
}
return;
}
void clearhires()
{
word mem1 = 0x0000;
for( mem1 = 0xD800; mem1 < 0xDBFF; mem1 = mem1 + 1 )
{
poke( mem1, 0 );
}
for( mem1 = 0x4400; mem1 < 0x47FF; mem1 = mem1 + 1 )
{
poke( mem1, 0 );
}
for( mem1 = 0x6000; mem1 < 0x7FF8; mem1 = mem1 + 1 )
{
poke( mem1, 0 );
}
return;
}