/
main.c
117 lines (99 loc) · 2.82 KB
/
main.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
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <caos.h>
#include <conio.h>
void next() {
kbd();
clrscr();
}
const int graphic_widht = 320;
const int graphic_widht2 = 160;
const int graphic_heigth = 256;
const int graphic_heigth2 = 128;
uint16_t index;
uint8_t color = 0;
uint16_t result;
uint16_t x;
uint8_t y;
uint8_t data[] = { 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1,
0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0,
1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1 };
uint8_t *screen;
void main() {
unsigned char version=caos_version();
clrscr();
printf("CAOS Version: %x\n",version);
if (version>=0x31)
{
for (index = 0; index < graphic_heigth; index += 5) {
line(0, index, graphic_widht - 1, graphic_heigth - 1 - index, color);
color = 0x7f & (color + 0x08);
}
for (index = 0; index < graphic_widht; index += 5) {
line(graphic_widht - 1 - index, 0, index, graphic_heigth - 1, color);
color = 0x7f & (color + 0x08);
}
next();
// circle demo
color = 0;
for (index = 10; index < graphic_widht2; index += 2) {
circle(graphic_widht2, graphic_heigth2, index, color);
color = 0x7f & (color + 0x08);
}
} else
{
printf("Linen und Kreis-Demo funktioniert hier\n"
"leider nicht. Die CAOS Funktionen gibt\n"
"es erst ab Version 3.1 aufwaerts.\n");
}
next();
// pixel demo
color = 0;
home();
for (index = 0; index < graphic_heigth; index++) {
// set
puse(graphic_heigth - 1 - index, index, color);
puse(graphic_heigth - index, index, color);
puse(graphic_heigth + 1 - index, index, color);
color = 0x7f & (color + 0x08);
}
next();
// pixel delete demo
putchar('\x0c');
home();
putchar('f');
crlf();
for (y = 255; y > 247; y--) {
for (x = 0; x < 8; x++) {
result = pude(x, y);
if ((result & 0x01) == 0x01) {
putchar('E');
} else {
if ((result & 0x40) == 0x00) {
putchar('o');
} else {
putchar('.');
puse(x, y, (WHITE << 3));
}
}
}
crlf();
}
next();
// pixel set demo
index = 0;
for (y = 255; y > 247; y--) {
for (x = 0; x < 8; x++) {
puse(x, y, ((YELLOW - data[index]) << 3) + (data[index] << 1));
index++;
}
}
next();
// direct BWS access
screen = (uint8_t *) 0x8000;
for (index = 0; index < 0x2800; index++) {
screen[ index] = (uint8_t)( rand() % 256);
//screen[index] = reg_r();
}
}