-
Notifications
You must be signed in to change notification settings - Fork 1
/
testlib.c
39 lines (33 loc) · 982 Bytes
/
testlib.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
#include "vdp.h"
#include "halt.h"
// tested
int main() {
unsigned char x = set_text_raw();
unsigned char col = (COLOR_GRAY<<4)|COLOR_DKBLUE;
unsigned char cnt = 0;
// TODO: test - do we need delay between register writes?
VDP_SAFE_DELAY();
VDP_SET_REGISTER(VDP_REG_COL, col);
VDP_SAFE_DELAY();
VDP_SET_REGISTER(VDP_REG_MODE1, x);
charsetlc();
putstring("hello world!\n");
vdpwaitvint(); // to make sure the first wait is not late
while (1) {
if (vdpwaitvint()) { // wait for an int to occur
// it was late - change colors - should not see this happen
++col;
VDP_SET_REGISTER(VDP_REG_COL, col);
}
if (vdpwaitvint()) { // wait for an int to occur
// it was late - change colors - should not see this happen
++col;
VDP_SET_REGISTER(VDP_REG_COL, col);
}
VDP_SET_ADDRESS_WRITE(14); // position for counter
faster_hexprint(VDP_INT_COUNTER);
VDP_SET_ADDRESS_WRITE(54); // position for counter
faster_hexprint(++cnt);
}
return 0;
}