-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpalette.c
57 lines (50 loc) · 938 Bytes
/
palette.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
/* Jedi/Sector One */
#include <stdlib.h>
#include <stddef.h>
#ifndef __linux__
# include <pc.h>
#else
# include "xymode.h"
# include <sys/io.h>
#endif
#include <string.h>
#include "palette_.h"
void setpal(void)
{
#ifndef __linux__
outportb(0x3c8, 0);
outportsb(0x3c9, pal, (sizeof pal) / sizeof pal[0]);
#else
const unsigned char *ppnt = pal;
int t = sizeof pal / sizeof pal[0];
outb(0, 0x3c8);
do {
outb(*ppnt++, 0x3c9);
t--;
} while (t != 0);
#endif
}
void setpalcrew(void)
{
#ifndef __linux__
outportb(0x3c8, 0);
outportsb(0x3c9, palcrew, (sizeof palcrew) / sizeof palcrew[0]);
#else
const unsigned char *ppnt = palcrew;
int t = sizeof palcrew / sizeof palcrew[0];
outb(0, 0x3c8);
do {
outb(*ppnt++, 0x3c9);
t--;
} while (t != 0);
#endif
}
void setblack(void)
{
int t = 256 * 3;
outportb(0x3c8, 0);
do {
outportb(0x3c9, 0);
t--;
} while (t != 0);
}