Compare commits

...

9 Commits

Author SHA1 Message Date
Yourtion
95542da7f7 变得更像真正的操作系统(1) 2016-05-13 11:47:29 +08:00
Yourtion
24945ddb18 增加命令行窗口(4) 2016-05-13 11:30:45 +08:00
Yourtion
d1e4c44149 增加命令行窗口(3) 2016-05-13 11:21:01 +08:00
Yourtion
34fc4eca27 bug fix 2016-05-13 11:18:02 +08:00
Yourtion
c512f3e391 增加命令行窗口(2) 2016-05-13 11:08:20 +08:00
Yourtion
d046ca64a4 增加命令行窗口(1) 2016-05-13 10:57:30 +08:00
Yourtion
b306606282 窗口初始位置 2016-05-13 10:48:03 +08:00
Yourtion
c8a0464c52 增加更多的颜色(2) 2016-05-13 10:45:55 +08:00
Yourtion
908570a673 增加更多的颜色(1) 2016-05-13 10:38:37 +08:00
8 changed files with 183 additions and 151 deletions

View File

@@ -429,18 +429,6 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
timer_settime((struct TIMER *) ebx, eax);
} else if (edx == 19) {
timer_free((struct TIMER *) ebx);
} else if (edx == 20) {
if (eax == 0) {
i = io_in8(0x61);
io_out8(0x61, i & 0x0d);
} else {
i = 1193180000 / eax;
io_out8(0x43, 0xb6);
io_out8(0x42, i & 0xff);
io_out8(0x42, i >> 8);
i = io_in8(0x61);
io_out8(0x61, (i | 0x03) & 0x0f);
}
}
return 0;
}

View File

@@ -169,10 +169,24 @@ beepup.bim : beepup.obj a_nask.obj Makefile
beepup.hrb : beepup.bim Makefile
$(BIM2HRB) beepup.bim beepup.hrb 40k
color.bim : color.obj a_nask.obj Makefile
$(OBJ2BIM) @$(RULEFILE) out:color.bim stack:1k map:color.map \
color.obj a_nask.obj
color.hrb : color.bim Makefile
$(BIM2HRB) color.bim color.hrb 56k
color2.bim : color2.obj a_nask.obj Makefile
$(OBJ2BIM) @$(RULEFILE) out:color2.bim stack:1k map:color2.map \
color2.obj a_nask.obj
color2.hrb : color2.bim Makefile
$(BIM2HRB) color2.bim color2.hrb 56k
haribote.img : ipl10.bin haribote.sys Makefile \
hello.hrb hello2.hrb a.hrb hello3.hrb hello4.hrb hello5.hrb \
winhelo.hrb winhelo2.hrb winhelo3.hrb star1.hrb stars.hrb stars2.hrb \
lines.hrb walk.hrb noodle.hrb beepdown.hrb beepup.hrb
lines.hrb walk.hrb noodle.hrb beepdown.hrb beepup.hrb color.hrb color2.hrb
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
wbinimg src:ipl10.bin len:512 from:0 to:0 \
copy from:haribote.sys to:@: \
@@ -195,6 +209,8 @@ haribote.img : ipl10.bin haribote.sys Makefile \
copy from:noodle.hrb to:@: \
copy from:beepdown.hrb to:@: \
copy from:beepup.hrb to:@: \
copy from:color.hrb to:@: \
copy from:color2.hrb to:@: \
imgout:haribote.img
# 其他指令

View File

@@ -5,8 +5,8 @@
#define KEYCMD_LED 0xed
int keywin_off(struct SHEET *key_win, struct SHEET *sht_win, int cur_c, int cur_x);
int keywin_on(struct SHEET *key_win, struct SHEET *sht_win, int cur_c);
void keywin_off(struct SHEET *key_win);
void keywin_on(struct SHEET *key_win);
void HariMain(void)
{
@@ -15,14 +15,13 @@ void HariMain(void)
char s[40];
struct FIFO32 fifo, keycmd;
int fifobuf[128], keycmd_buf[32];
int mx, my, i, cursor_x, cursor_c;
int mx, my, i;
unsigned int memtotal;
struct MOUSE_DEC mdec;
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
unsigned char *buf_back, buf_mouse[256], *buf_win, *buf_cons;
struct SHEET *sht_back, *sht_mouse, *sht_win, *sht_cons;
struct TASK *task_a, *task_cons;
struct TIMER *timer;
unsigned char *buf_back, buf_mouse[256], *buf_cons[2];
struct SHEET *sht_back, *sht_mouse, *sht_win, *sht_cons[2];
struct TASK *task_a, *task_cons[2], *task;
static char keytable0[0x80] = {
0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0, 0,
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '@', '[', 0, 0, 'A', 'S',
@@ -78,35 +77,27 @@ void HariMain(void)
init_screen8(buf_back, binfo->scrnx, binfo->scrny);
/* sht_cons */
sht_cons = sheet_alloc(shtctl);
buf_cons = (unsigned char *) memman_alloc_4k(memman, 256 * 165);
sheet_setbuf(sht_cons, buf_cons, 256, 165, -1); /* 无透明色 */
make_window8(buf_cons, 256, 165, "console", 0);
make_textbox8(sht_cons, 8, 28, 240, 128, COL8_000000);
task_cons = task_alloc();
task_cons->tss.esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024 - 12;
task_cons->tss.eip = (int) &console_task;
task_cons->tss.es = 1 * 8;
task_cons->tss.cs = 2 * 8;
task_cons->tss.ss = 1 * 8;
task_cons->tss.ds = 1 * 8;
task_cons->tss.fs = 1 * 8;
task_cons->tss.gs = 1 * 8;
*((int *) (task_cons->tss.esp + 4)) = (int) sht_cons;
*((int *) (task_cons->tss.esp + 8)) = memtotal;
task_run(task_cons, 2, 2); /* level=2, priority=2 */
/* sht_win */
sht_win = sheet_alloc(shtctl);
buf_win = (unsigned char *) memman_alloc_4k(memman, 160 * 52);
sheet_setbuf(sht_win, buf_win, 144, 52, -1); /* 无透明色 */
make_window8(buf_win, 144, 52, "task_a", 1);
make_textbox8(sht_win, 8, 28, 128, 16, COL8_FFFFFF);
cursor_x = 8;
cursor_c = COL8_FFFFFF;
timer = timer_alloc();
timer_init(timer, &fifo, 1);
timer_settime(timer, 50);
for (i = 0; i < 2; i++) {
sht_cons[i] = sheet_alloc(shtctl);
buf_cons[i] = (unsigned char *) memman_alloc_4k(memman, 256 * 165);
sheet_setbuf(sht_cons[i], buf_cons[i], 256, 165, -1); /*没有透明色*/
make_window8(buf_cons[i], 256, 165, "console", 0);
make_textbox8(sht_cons[i], 8, 28, 240, 128, COL8_000000);
task_cons[i] = task_alloc();
task_cons[i]->tss.esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024 - 12;
task_cons[i]->tss.eip = (int) &console_task;
task_cons[i]->tss.es = 1 * 8;
task_cons[i]->tss.cs = 2 * 8;
task_cons[i]->tss.ss = 1 * 8;
task_cons[i]->tss.ds = 1 * 8;
task_cons[i]->tss.fs = 1 * 8;
task_cons[i]->tss.gs = 1 * 8;
*((int *) (task_cons[i]->tss.esp + 4)) = (int) sht_cons[i];
*((int *) (task_cons[i]->tss.esp + 8)) = memtotal;
task_run(task_cons[i], 2, 2); /* level=2, priority=2 */
sht_cons[i]->task = task_cons[i];
sht_cons[i]->flags |= 0x20; /*有光标*/
}
/* sht_mouse */
sht_mouse = sheet_alloc(shtctl);
@@ -116,16 +107,16 @@ void HariMain(void)
my = (binfo->scrny - 28 - 16) / 2;
sheet_slide(sht_back, 0, 0);
sheet_slide(sht_cons, 32, 4);
sheet_slide(sht_cons[1], 56, 6);
sheet_slide(sht_cons[0], 8, 2);
sheet_slide(sht_win, 64, 56);
sheet_slide(sht_mouse, mx, my);
sheet_updown(sht_back, 0);
sheet_updown(sht_cons, 1);
sheet_updown(sht_win, 2);
sheet_updown(sht_cons[1], 1);
sheet_updown(sht_cons[0], 2);
sheet_updown(sht_mouse, 3);
key_win = sht_win;
sht_cons->task = task_cons;
sht_cons->flags |= 0x20; /*有光标*/
key_win = sht_cons[0];
keywin_on(key_win);
/*为了避免和键盘当前状态冲突,在一开始先进行设置*/
fifo32_put(&keycmd, KEYCMD_LED);
@@ -147,7 +138,6 @@ void HariMain(void)
io_sti();
if (key_win->flags == 0) { /*输入窗口被关闭*/
key_win = shtctl->sheets[shtctl->top - 1];
cursor_c = keywin_on(key_win, sht_win, cursor_c);
}
if (256 <= i && i <= 511) { /* 键盘数据*/
if (i < 0x80 + 256) { /*将按键编码转换为字符编码*/
@@ -164,42 +154,17 @@ void HariMain(void)
s[0] += 0x20; /*将大写字母转换为小写字母*/
}
}
if (s[0] != 0) { /*一般字符*/
if (key_win == sht_win) { /*发送给任务A */
if (cursor_x < 128) {
/*显示一个字符之后将光标后移一位*/
s[1] = 0;
putfonts8_asc_sht(sht_win, cursor_x, 28, COL8_000000, COL8_FFFFFF, s, 1);
cursor_x += 8;
}
} else { /*发送给命令行窗口*/
fifo32_put(&key_win->task->fifo, s[0] + 256);
}
}
if (i == 256 + 0x0e) { /* 退格键 */
if (key_win == sht_win) { /*发送给任务A */
if (cursor_x > 8) {
/*用空白擦除光标后将光标前移一位*/
putfonts8_asc_sht(sht_win, cursor_x, 28, COL8_000000, COL8_FFFFFF, " ", 1);
cursor_x -= 8;
}
} else { /*发送给命令行窗口*/
fifo32_put(&key_win->task->fifo, 8 + 256);
}
}
if (i == 256 + 0x1c) { /*回车键*/
if (key_win != sht_win) { /*发送至命令行窗口*/
fifo32_put(&key_win->task->fifo, 10 + 256);
}
if (s[0] != 0) { /*一般字符、退格键、回车键*/
fifo32_put(&key_win->task->fifo, s[0] + 256);
}
if (i == 256 + 0x0f) { /* Tab键 */
cursor_c = keywin_off(key_win, sht_win, cursor_c, cursor_x);
keywin_off(key_win);
j = key_win->height - 1;
if (j == 0) {
j = shtctl->top - 1;
}
key_win = shtctl->sheets[j];
cursor_c = keywin_on(key_win, sht_win, cursor_c);
keywin_on(key_win);
}
if (i == 256 + 0x2a) { /*左Shift ON */
key_shift |= 1;
@@ -228,13 +193,15 @@ void HariMain(void)
fifo32_put(&keycmd, KEYCMD_LED);
fifo32_put(&keycmd, key_leds);
}
if (i == 256 + 0x3b && key_shift != 0 && task_cons->tss.ss0 != 0) { /* Shift+F1 */
cons = (struct CONSOLE *) *((int *) 0x0fec);
cons_putstr0(cons, "\nBreak(key) :\n");
io_cli(); /*不能在改变寄存器值时切换到其他任务*/
task_cons->tss.eax = (int) &(task_cons->tss.esp0);
task_cons->tss.eip = (int) asm_end_app;
io_sti();
if (i == 256 + 0x3b && key_shift != 0) {
task = key_win->task;
if (task != 0 && task->tss.ss0 != 0) { /* Shift+F1 */
cons_putstr0(cons, "\nBreak(key) :\n");
io_cli(); /*强制结束处理时禁止任务切换*/
task->tss.eax = (int) &(task->tss.esp0);
task->tss.eip = (int) asm_end_app;
io_sti();
}
}
if (i == 256 + 0x57 && shtctl->top > 2) { /* F11 */
sheet_updown(shtctl->sheets[1], shtctl->top - 1);
@@ -246,11 +213,6 @@ void HariMain(void)
wait_KBC_sendready();
io_out8(PORT_KEYDAT, keycmd_wait);
}
/*重新显示光标*/
if (cursor_c >= 0) {
boxfill8(sht_win->buf, sht_win->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
}
sheet_refresh(sht_win, cursor_x, 28, cursor_x + 8, 44);
} else if (512 <= i && i <= 767) { /* 鼠标数据*/
if (mouse_decode(&mdec, i - 512) != 0) {
/* 已经收集了3字节的数据移动光标 */
@@ -283,9 +245,9 @@ void HariMain(void)
if (sht->buf[y * sht->bxsize + x] != sht->col_inv) {
sheet_updown(sht, shtctl->top - 1);
if (sht != key_win) {
cursor_c = keywin_off(key_win, sht_win, cursor_c, cursor_x);
keywin_off(key_win);
key_win = sht;
cursor_c = keywin_on(key_win, sht_win, cursor_c);/*到此结束*/
keywin_on(key_win);
}
if (3 <= x && x < sht->bxsize - 3 && 3 <= y && y < 21) {
mmx = mx; /*进入窗口移动模式*/
@@ -294,12 +256,11 @@ void HariMain(void)
if (sht->bxsize - 21 <= x && x < sht->bxsize - 5 && 5 <=y && y < 19) {
/*点击“×”按钮*/
if ((sht->flags & 0x10) != 0) { /*该窗口是否为应用程序窗口?*/
cons = (struct CONSOLE *) *((int *) 0x0fec);
task = sht->task;
cons_putstr0(cons, "\nBreak(mouse) :\n");
io_cli(); /*强制结束处理禁止切换任务*/
task_cons->tss.eax = (int)
&(task_cons->tss.esp0);
task_cons->tss.eip = (int) asm_end_app;
io_cli(); /*强制结束处理禁止任务切换*/
task->tss.eax = (int) &(task->tss.esp0);/*到此结束*/
task->tss.eip = (int) asm_end_app;
io_sti();
}
}
@@ -321,51 +282,25 @@ void HariMain(void)
}
}
} else if (i <= 1) { /* 光标用定时器*/
if (i != 0) {
timer_init(timer, &fifo, 0); /* 下面设定0 */
if (cursor_c >= 0) {
cursor_c = COL8_000000;
}
} else {
timer_init(timer, &fifo, 1); /* 下面设定1 */
if (cursor_c >= 0) {
cursor_c = COL8_FFFFFF;
}
}
timer_settime(timer, 50);
if (cursor_c >= 0) {
boxfill8(sht_win->buf, sht_win->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
sheet_refresh(sht_win, cursor_x, 28, cursor_x + 8, 44);
}
}
}
}
}
int keywin_off(struct SHEET *key_win, struct SHEET *sht_win, int cur_c, int cur_x)
void keywin_off(struct SHEET *key_win)
{
change_wtitle8(key_win, 0);
if (key_win == sht_win) {
cur_c = -1; /*删除光标*/
boxfill8(sht_win->buf, sht_win->bxsize, COL8_FFFFFF, cur_x, 28, cur_x + 7, 43);
} else {
if ((key_win->flags & 0x20) != 0) {
fifo32_put(&key_win->task->fifo, 3); /*命令行窗口光标OFF */
}
if ((key_win->flags & 0x20) != 0) {
fifo32_put(&key_win->task->fifo, 3); /*命令行窗口光标OFF */
}
return cur_c;
return;
}
int keywin_on(struct SHEET *key_win, struct SHEET *sht_win, int cur_c)
void keywin_on(struct SHEET *key_win)
{
change_wtitle8(key_win, 1);
if (key_win == sht_win) {
cur_c = COL8_000000; /*显示光标*/
} else {
if ((key_win->flags & 0x20) != 0) {
fifo32_put(&key_win->task->fifo, 2); /*命令行窗口光标ON */
}
if ((key_win->flags & 0x20) != 0) {
fifo32_put(&key_win->task->fifo, 2); /*命令行窗口光标ON */
}
return cur_c;
return;
}

View File

@@ -212,6 +212,8 @@ struct TASK {
int level, priority; /* 优先级 */
struct FIFO32 fifo;
struct TSS32 tss;
struct CONSOLE *cons;
int ds_base;
};
struct TASKLEVEL {
int running; /*正在运行的任务数量*/

27
25_day/color.c Normal file
View File

@@ -0,0 +1,27 @@
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
void api_initmalloc(void);
char *api_malloc(int size);
void api_refreshwin(int win, int x0, int y0, int x1, int y1);
void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
int api_getkey(int mode);
void api_end(void);
void HariMain(void)
{
char *buf;
int win, x, y, r, g, b;
api_initmalloc();
buf = api_malloc(144 * 164);
win = api_openwin(buf, 144, 164, -1, "color");
for (y = 0; y < 128; y++) {
for (x = 0; x < 128; x++) {
r = x * 2;
g = y * 2;
b = 0;
buf[(x + 8) + (y + 28) * 144] = 16 + (r / 43) + (g / 43) * 6 + (b / 43) * 36;
}
}
api_refreshwin(win, 8, 28, 136, 156);
api_getkey(1); /*等待按下任意键*/
api_end();
}

42
25_day/color2.c Normal file
View File

@@ -0,0 +1,42 @@
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
void api_initmalloc(void);
char *api_malloc(int size);
void api_refreshwin(int win, int x0, int y0, int x1, int y1);
void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
int api_getkey(int mode);
void api_end(void);
unsigned char rgb2pal(int r, int g, int b, int x, int y);
void HariMain(void)
{
char *buf;
int win, x, y;
api_initmalloc();
buf = api_malloc(144 * 164);
win = api_openwin(buf, 144, 164, -1, "color2");
for (y = 0; y < 128; y++) {
for (x = 0; x < 128; x++) {
buf[(x + 8) + (y + 28) * 144] = rgb2pal(x * 2, y * 2, 0, x, y);
}
}
api_refreshwin(win, 8, 28, 136, 156);
api_getkey(1); /*等待按下任意键*/
api_end();
}
unsigned char rgb2pal(int r, int g, int b, int x, int y)
{
static int table[4] = { 3, 1, 0, 2 };
int i;
x &= 1; /*判断是偶数还是奇数*/
y &= 1;
i = table[x + y * 2]; /*用来生成中间色的常量*/
r = (r * 21) / 256; /* r为020*/
g = (g * 21) / 256;
b = (b * 21) / 256;
r = (r + i) / 4; /* r为05*/
g = (g + i) / 4;
b = (b + i) / 4;
return 16 + r + g * 6 + b * 36;
}

View File

@@ -16,7 +16,7 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
cons.cur_x = 8;
cons.cur_y = 28;
cons.cur_c = -1;
*((int *) 0x0fec) = (int) &cons;
task->cons = &cons;
fifo32_init(&task->fifo, 128, fifobuf, task);
timer = timer_alloc();
@@ -293,13 +293,13 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
datsiz = *((int *) (p + 0x0010));
dathrb = *((int *) (p + 0x0014));
q = (char *) memman_alloc_4k(memman, segsiz);
*((int *) 0xfe8) = (int) q;
set_segmdesc(gdt + 1003, finfo->size - 1, (int) p, AR_CODE32_ER + 0x60);
set_segmdesc(gdt + 1004, segsiz - 1, (int) q, AR_DATA32_RW + 0x60);
task->ds_base = (int) q;
set_segmdesc(gdt + task->sel / 8 + 1000, finfo->size - 1, (int) p, AR_CODE32_ER + 0x60);
set_segmdesc(gdt + task->sel / 8 + 2000, segsiz - 1, (int) q, AR_DATA32_RW + 0x60);
for (i = 0; i < datsiz; i++) {
q[esp + i] = p[dathrb + i];
}
start_app(0x1b, 1003 * 8, esp, 1004 * 8, &(task->tss.esp0));
start_app(0x1b, task->sel + 1000 * 8, esp, task->sel + 2000 * 8, &(task->tss.esp0));
shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
for (i = 0; i < MAX_SHEETS; i++) {
sht = &(shtctl->sheets0[i]);
@@ -323,9 +323,9 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax)
{
int ds_base = *((int *) 0xfe8);
struct TASK *task = task_now();
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
int ds_base = task->ds_base;
struct CONSOLE *cons = task->cons;
struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
struct SHEET *sht;
int *reg = &eax + 1; /* eax后面的地址*/
@@ -348,8 +348,8 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
sht->flags |= 0x10;
sheet_setbuf(sht, (char *) ebx + ds_base, esi, edi, eax);
make_window8((char *) ebx + ds_base, esi, edi, (char *) ecx + ds_base, 0);
sheet_slide(sht, 100, 50);
sheet_updown(sht, 3); /*背景层高度3位于task_a之上*/
sheet_slide(sht, (shtctl->xsize - esi) / 2, (shtctl->ysize - edi) / 2);
sheet_updown(sht, shtctl->top); /*将窗口图层高度指定为当前鼠标所在图层的高度,鼠标移到上层*/
reg[7] = (int) sht;
} else if (edx == 6) {
sht = (struct SHEET *) (ebx & 0xfffffffe);
@@ -429,14 +429,26 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
timer_settime((struct TIMER *) ebx, eax);
} else if (edx == 19) {
timer_free((struct TIMER *) ebx);
} else if (edx == 20) {
if (eax == 0) {
i = io_in8(0x61);
io_out8(0x61, i & 0x0d);
} else {
i = 1193180000 / eax;
io_out8(0x43, 0xb6);
io_out8(0x42, i & 0xff);
io_out8(0x42, i >> 8);
i = io_in8(0x61);
io_out8(0x61, (i | 0x03) & 0x0f);
}
}
return 0;
}
int *inthandler0c(int *esp)
{
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
struct TASK *task = task_now();
struct CONSOLE *cons = task->cons;
char s[30];
cons_putstr0(cons, "\nINT 0C :\n Stack Exception.\n");
sprintf(s, "EIP = %08X\n", esp[11]);
@@ -446,8 +458,8 @@ int *inthandler0c(int *esp)
int *inthandler0d(int *esp)
{
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
struct TASK *task = task_now();
struct CONSOLE *cons = task->cons;
char s[30];
cons_putstr0(cons, "\nINT 0D :\n General Protected Exception.\n");
sprintf(s, "EIP = %08X\n", esp[11]);

View File

@@ -22,10 +22,20 @@ void init_palette(void)
0x00, 0x84, 0x84, /* 14:浅暗蓝 */
0x84, 0x84, 0x84 /* 15:暗灰 */
};
unsigned char table2[216 * 3];
int r, g, b;
set_palette(0, 15, table_rgb);
for (b = 0; b < 6; b++) {
for (g = 0; g < 6; g++) {
for (r = 0; r < 6; r++) {
table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;
table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;
table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;
}
}
}
set_palette(16, 231, table2);
return;
/* C语言中的static char语句只能用于数据相当于汇编中的DB指令 */
}
void set_palette(int start, int end, unsigned char *rgb)