-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathk_vga.c
33 lines (32 loc) · 869 Bytes
/
k_vga.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
#include "k_vga.h"
void init_palette(void) {
static unsigned char table_rgb[16 * 3] = {
0x00, 0x00, 0x00,
0xff, 0x00, 0x00,
0x00, 0xff, 0x00,
0xff, 0xff, 0x00,
0x00, 0x00, 0xff,
0xff, 0x00, 0xff,
0x00, 0xff, 0xff,
0xff, 0xff, 0xff,
0xc6, 0xc6, 0xc6,
0x84, 0x00, 0x00,
0x00, 0x84, 0x00,
0x84, 0x84, 0x00,
0x00, 0x00, 0x84,
0x84, 0x00, 0x84,
0x00, 0x84, 0x84,
0x84, 0x84, 0x84
};
set_palette(0, 15, table_rgb);
}
void set_palette(int start, int end, unsigned char *pRGB) {
int i;
_io_out8(0x03c8, start);
for (i = start; i <= end; i++) {
_io_out8(0x03c9, pRGB[0] >> 2);
_io_out8(0x03c9, pRGB[1] >> 2);
_io_out8(0x03c9, pRGB[2] >> 2);
pRGB += 3;
}
}