本文整理汇总了C++中sheet_refresh函数的典型用法代码示例。如果您正苦于以下问题:C++ sheet_refresh函数的具体用法?C++ sheet_refresh怎么用?C++ sheet_refresh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sheet_refresh函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sheet_updown
void sheet_updown(struct SHTCTL *ctl, struct SHEET *sht, int height)
{
int h, old = sht->height;
if (height > ctl->top + 1) {
height = ctl->top + 1;
}
if (height < -1) {
height = -1;
}
sht->height = height;
if (old > height) {
if (height >= 0) {
for (h = old; h > height; h--) {
ctl->sheets[h] = ctl->sheets[h - 1];
ctl->sheets[h]->height = h;
}
ctl->sheets[height] = sht;
} else {
if (ctl->top > old) {
for (h = old; h < ctl->top; h++) {
ctl->sheets[h] = ctl->sheets[h + 1];
ctl->sheets[h]->height = h;
}
}
ctl->top--;
}
sheet_refresh(ctl);
} else if (old < height) {
if (old >= 0) {
for (h = old; h < height; h++) {
ctl->sheets[h] = ctl->sheets[h + 1];
ctl->sheets[h]->height = h;
}
ctl->sheets[height] = sht;
} else {
for (h = ctl->top; h >= height; h--) {
ctl->sheets[h + 1] = ctl->sheets[h];
ctl->sheets[h + 1]->height = h + 1;
}
ctl->sheets[height] = sht;
ctl->top++;
}
sheet_refresh(ctl);
}
return;
}
开发者ID:GoodLuckBamboo,项目名称:hariboteos,代码行数:54,代码来源:sheet.c
示例2: task_now
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);
struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
struct SHEET *sht;
int *reg = &eax + 1; /* eaxの次の番地 */
/* 保存のためのPUSHADを強引に書き換える */
/* reg[0] : EDI, reg[1] : ESI, reg[2] : EBP, reg[3] : ESP */
/* reg[4] : EBX, reg[5] : EDX, reg[6] : ECX, reg[7] : EAX */
if (edx == 1) {
cons_putchar(cons, eax & 0xff, 1);
} else if (edx == 2) {
cons_putstr0(cons, (char *) ebx + ds_base);
} else if (edx == 3) {
cons_putstr1(cons, (char *) ebx + ds_base, ecx);
} else if (edx == 4) {
return &(task->tss.esp0);
} else if (edx == 5) {
sht = sheet_alloc(shtctl);
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の上 */
reg[7] = (int) sht;
} else if (edx == 6) {
sht = (struct SHEET *) ebx;
putfonts8_asc(sht->buf, sht->bxsize, esi, edi, eax, (char *) ebp + ds_base);
sheet_refresh(sht, esi, edi, esi + ecx * 8, edi + 16);
} else if (edx == 7) {
sht = (struct SHEET *) ebx;
boxfill8(sht->buf, sht->bxsize, ebp, eax, ecx, esi, edi);
sheet_refresh(sht, eax, ecx, esi + 1, edi + 1);
} else if (edx == 8) {
memman_init((struct MEMMAN *) (ebx + ds_base));
ecx &= 0xfffffff0; /* 16バイト単位に */
memman_free((struct MEMMAN *) (ebx + ds_base), eax, ecx);
} else if (edx == 9) {
ecx = (ecx + 0x0f) & 0xfffffff0; /* 16バイト単位に切り上げ */
reg[7] = memman_alloc((struct MEMMAN *) (ebx + ds_base), ecx);
} else if (edx == 10) {
ecx = (ecx + 0x0f) & 0xfffffff0; /* 16バイト単位に切り上げ */
memman_free((struct MEMMAN *) (ebx + ds_base), eax, ecx);
} else if (edx == 11) {
sht = (struct SHEET *) ebx;
sht->buf[sht->bxsize * edi + esi] = eax;
sheet_refresh(sht, esi, edi, esi + 1, edi + 1);
}
return 0;
}
开发者ID:ymkjp,项目名称:home-made-os,代码行数:52,代码来源:console.c
示例3: putfonts8_asc_sht
void putfonts8_asc_sht(struct SHEET *sht, int x, int y, int c, int b, char *s, int l)
{
struct TASK *task = task_now();
boxfill8(sht->buf, sht->bxsize, b, x, y, x + l * 8 - 1, y + 15);
if (task->langmode != 0 && task->langbyte1 != 0) {
putfonts8_asc(sht->buf, sht->bxsize, x, y, c, s);
sheet_refresh(sht, x - 8, y, x + l * 8, y + 16);
} else {
putfonts8_asc(sht->buf, sht->bxsize, x, y, c, s);
sheet_refresh(sht, x, y, x + l * 8, y + 16);
}
return;
}
开发者ID:barmi,项目名称:bxos,代码行数:13,代码来源:window.c
示例4: change_wtitle8
void change_wtitle8(sheet_t* sht, char act)
{
int x, y, xsize = sht->bxsize;
char c, tc_new, tbc_new, tc_old, tbc_old, *buf = sht->buf;
if (act != 0) {
tc_new = blue;
tbc_new = orange;
tc_old = base1;
tbc_old = base00;
} else {
tc_new = base1;
tbc_new = base00;
tc_old = blue;
tbc_old = orange;
}
for (y = 0; y <= 21; y++) {
for (x = 0; x < xsize; x++) {
c = buf[y * xsize + x];
if (c == tc_old) {
c = tc_new;
} else if (c == tbc_old) {
c = tbc_new;
}
buf[y * xsize + x] = c;
}
}
sheet_refresh(sht, 0, 0, xsize, 21);
return;
}
开发者ID:kingfree,项目名称:haut,代码行数:29,代码来源:window.c
示例5: putfonts8_asc_sht
void putfonts8_asc_sht(sheet_t* sht, int x, int y, int c, int b, char* s, int l)
{
boxfill8(sht->buf, sht->bxsize, b, x, y, x + l * FNT_W - 1, y + FNT_H - 1);
putfonts8_asc(sht->buf, sht->bxsize, x, y, c, s);
sheet_refresh(sht, x, y, x + l * FNT_W, y + FNT_H);
return;
}
开发者ID:kingfree,项目名称:haut,代码行数:7,代码来源:window.c
示例6: cons_newline
void cons_newline(struct CONSOLE *cons)
{
int x, y;
struct SHEET *sheet = cons->sht;
if (cons->cur_y < 28 + 112) {
cons->cur_y += 16; /* 次の行へ */
} else {
/* スクロール */
if (sheet != 0) {
for (y = 28; y < 28 + 112; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = sheet->buf[x + (y + 16) * sheet->bxsize];
}
}
for (y = 28 + 112; y < 28 + 128; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = COL8_000000;
}
}
sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128);
}
}
cons->cur_x = 8;
return;
}
开发者ID:bigpussy,项目名称:harib_os_src,代码行数:25,代码来源:console.c
示例7: cons_newline
void cons_newline(struct CONSOLE *cons)
{
int x, y;
struct SHEET *sheet = cons->sht;
struct TASK *task = task_now();
if (cons->cur_y < 28 + 112) {
cons->cur_y += 16; /* ���� � */
} else {
/* ��ũ�� */
if (sheet != 0) {
for (y = 28; y < 28 + 112; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = sheet->buf[x + (y + 16) * sheet->bxsize];
}
}
for (y = 28 + 112; y < 28 + 128; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = COL8_000000;
}
}
sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128);
}
}
cons->cur_x = 8;
if (task->langmode == 1 && task->langbyte1 != 0) {
cons->cur_x = 16;
}
return;
}
开发者ID:barmi,项目名称:bxos,代码行数:29,代码来源:console.c
示例8: change_wtitle8
void change_wtitle8(struct SHEET *sht, char act)
{
int x, y, xsize = sht->bxsize;
char c, tc_new, tbc_new, tc_old, tbc_old, *buf = sht->buf;
if (act != 0) {
tc_new = COL8_FFFFFF;
tbc_new = COL8_000084;
tc_old = COL8_C6C6C6;
tbc_old = COL8_848484;
} else {
tc_new = COL8_C6C6C6;
tbc_new = COL8_848484;
tc_old = COL8_FFFFFF;
tbc_old = COL8_000084;
}
for (y = 3; y <= 20; y++) {
for (x = 3; x <= xsize - 4; x++) {
c = buf[y * xsize + x];
if (c == tc_old && x <= xsize - 22) {
c = tc_new;
} else if (c == tbc_old) {
c = tbc_new;
}
buf[y * xsize + x] = c;
}
}
sheet_refresh(sht, 3, 3, xsize, 21);
return;
}
开发者ID:barmi,项目名称:bxos,代码行数:29,代码来源:window.c
示例9: putfonts8_asc_sht
void putfonts8_asc_sht(struct SHEET *sht, int x, int y, int c, int b, char *s, int l)
{
boxfill8(sht->buf, sht->bxsize, b, x, y, x + l * 8 - 1, y + 15);
putfonts8_asc(sht->buf, sht->bxsize, x, y, c, s);
sheet_refresh(sht, x, y, x + l * 8, y + 16);
return;
}
开发者ID:LinuxKernelDevelopment,项目名称:30,代码行数:7,代码来源:bootpack.c
示例10: console_task
void console_task(struct SHEET *sheet)
{
struct TIMER *timer;
struct TASK *task = task_now();
int i, fifobuf[128], cursor_x = 16, cursor_c = COL8_000000;
char s[2];
fifo32_init(&task->fifo, 128, fifobuf, task);
timer = timer_alloc();
timer_init(timer, &task->fifo, 1);
timer_settime(timer, 50);
/* 显示提示符 */
putfonts8_asc_sht(sheet, 8, 28, COL8_FFFFFF, COL8_000000, ">", 1);
for (;;) {
io_cli();
if (fifo32_status(&task->fifo) == 0) {
task_sleep(task);
io_sti();
} else {
i = fifo32_get(&task->fifo);
io_sti();
if (i <= 1) { /* 光标用定时器 */
if (i != 0) {
timer_init(timer, &task->fifo, 0); /* 下次置0 */
cursor_c = COL8_FFFFFF;
} else {
timer_init(timer, &task->fifo, 1); /* 下次置1 */
cursor_c = COL8_000000;
}
timer_settime(timer, 50);
}
if (256 <= i && i <= 511) { /* 键盘数据(通过任务A) */
if (i == 8 + 256) {
/* 退格键 */
if (cursor_x > 16) {
/* 用空白擦除光标后将光标前移一位 */
putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, " ", 1);
cursor_x -= 8;
}
} else {
/* 一般字符 */
if (cursor_x < 240) {
/* 显示一个字符之后将光标后移一位 */
s[0] = i - 256;
s[1] = 0;
putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, s, 1);
cursor_x += 8;
}
}
}
/* 重新显示光标 */
boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
sheet_refresh(sheet, cursor_x, 28, cursor_x + 8, 44);
}
}
}
开发者ID:NeilJudson,项目名称:HomemadeOS,代码行数:59,代码来源:bootpack.c
示例11: console_task
void console_task(struct SHEET *sheet)
{
struct TIMER *timer;
struct TASK *task = task_now();
int i, fifobuf[128], cursor_x = 16, cursor_c = COL8_000000;
char s[2];
fifo32_init(&task->fifo, 128, fifobuf, task);
timer = timer_alloc();
timer_init(timer, &task->fifo, 1);
timer_settime(timer, 50);
/* プロンプト表示 */
putfonts8_asc_sht(sheet, 8, 28, COL8_FFFFFF, COL8_000000, ">", 1);
for (;;) {
io_cli();
if (fifo32_status(&task->fifo) == 0) {
task_sleep(task);
io_sti();
} else {
i = fifo32_get(&task->fifo);
io_sti();
if (i <= 1) { /* カーソル用タイマ */
if (i != 0) {
timer_init(timer, &task->fifo, 0); /* 次は0を */
cursor_c = COL8_FFFFFF;
} else {
timer_init(timer, &task->fifo, 1); /* 次は1を */
cursor_c = COL8_000000;
}
timer_settime(timer, 50);
}
if (256 <= i && i <= 511) { /* キーボードデータ(タスクA経由) */
if (i == 8 + 256) {
/* バックスペース */
if (cursor_x > 16) {
/* カーソルをスペースで消してから、カーソルを1つ戻す */
putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, " ", 1);
cursor_x -= 8;
}
} else {
/* 一般文字 */
if (cursor_x < 240) {
/* 一文字表示してから、カーソルを1つ進める */
s[0] = i - 256;
s[1] = 0;
putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, s, 1);
cursor_x += 8;
}
}
}
/* カーソル再表示 */
boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
sheet_refresh(sheet, cursor_x, 28, cursor_x + 8, 44);
}
}
}
开发者ID:bigpussy,项目名称:harib_os_src,代码行数:58,代码来源:bootpack.c
示例12: sheet_slide
void sheet_slide(struct SHTCTL *ctl, struct SHEET *sht, int vx0, int vy0)
{
sht->vx0 = vx0;
sht->vy0 = vy0;
if (sht->height >= 0) {
sheet_refresh(ctl);
}
return;
}
开发者ID:LinuxKernelDevelopment,项目名称:30,代码行数:9,代码来源:sheet.c
示例13: cmd_cls
void cmd_cls(struct CONSOLE *cons)
{
int x, y;
struct SHEET *sheet = cons->sht;
for (y = 28; y < 28 + 128; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = COL8_000000;
}
}
sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128);
cons->cur_y = 28;
return;
}
开发者ID:FuDesign2008,项目名称:mess,代码行数:13,代码来源:console.c
示例14: putfonts8_asc_sht
void putfonts8_asc_sht(struct SHEET *sht, int x, int y, int c, int b, char *s, int l)
{
/*
* 重绘sht图层[(x,y),(x+l*8,y+16))区域
* b: 背景颜色
* c: 字符颜色
* s: 字符串
* l: 字符串长度
*/
boxfill8(sht->buf, sht->bxsize, b, x, y, x + l * 8 - 1, y + 15); // 涂背景色
putfonts8_asc(sht->buf, sht->bxsize, x, y, c, s); // 写上字符
sheet_refresh(sht, x, y, x + l * 8, y + 16); // 刷新
return;
}
开发者ID:NeilJudson,项目名称:HomemadeOS,代码行数:14,代码来源:bootpack.c
示例15: cons_newline
int cons_newline(int cursor_y, struct SHEET *sheet)
{
int x, y;
if (cursor_y < 28 + 112) {
cursor_y += 16;
} else {
for (y = 28; y < 28 + 112; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = sheet->buf[x + (y + 16) * sheet->bxsize];
}
}
for (y = 28 + 112; y < 28 + 128; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = COL8_000000;
}
}
sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128);
}
return cursor_y;
}
开发者ID:GoodLuckBamboo,项目名称:hariboteos,代码行数:20,代码来源:console.c
示例16: cons_newline
void cons_newline (struct CONSOLE *cons)
{
int x, y;
struct SHEET *sheet = cons->sht;
if (cons->cur_y < 28 + 112) {
cons->cur_y += 16;
} else { // scroll
for (y = 28; y < 28 + 112; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = sheet->buf[x + (y + 16) * sheet->bxsize];
}
}
for (y = 28 + 112; y < 28 + 128; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = COL8_000000;
}
}
// show Prompt
sheet_refresh (sheet, 8, 28, 8 + 240, 28 + 128);
}
cons->cur_x = 8;
return;
}
开发者ID:msyksphinz,项目名称:sicp_exercise,代码行数:23,代码来源:console.c
示例17: cons_newline
void cons_newline(struct CONSOLE *cons)
{
int x, y;
struct SHEET *sheet = cons->sht;
if (cons->cur_y < 28 + 112) {
cons->cur_y += 16; // 换行
} else {
/* 滚动 */
for (y = 28; y < 28 + 112; y++) { // 上移一行
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = sheet->buf[x + (y + 16) * sheet->bxsize];
}
}
for (y = 28 + 112; y < 28 + 128; y++) { // 涂黑最后一行
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = COL8_000000;
}
}
sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128);
}
cons->cur_x = 8;
return;
}
开发者ID:NeilJudson,项目名称:HomemadeOS,代码行数:23,代码来源:console.c
示例18: console_task
void console_task(struct SHEET *sheet)
{
struct FIFO32 fifo;
struct TIMER *timer;
struct TASK *task = task_now();
int i, fifobuf[128], cursor_x = 8, cursor_c = COL8_000000;
fifo32_init(&fifo, 128, fifobuf, task);
timer = timer_alloc();
timer_init(timer, &fifo, 1);
timer_settime(timer, 50);
for (;;) {
io_cli();
if (fifo32_status(&fifo) == 0) {
task_sleep(task);
io_sti();
} else {
i = fifo32_get(&fifo);
io_sti();
if (i <= 1) { /* カーソル用タイマ */
if (i != 0) {
timer_init(timer, &fifo, 0); /* 次は0を */
cursor_c = COL8_FFFFFF;
} else {
timer_init(timer, &fifo, 1); /* 次は1を */
cursor_c = COL8_000000;
}
timer_settime(timer, 50);
boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
sheet_refresh(sheet, cursor_x, 28, cursor_x + 8, 44);
}
}
}
}
开发者ID:FuDesign2008,项目名称:mess,代码行数:36,代码来源:bootpack.c
示例19: HariMain
//.........这里部分代码省略.........
my = (binfo->scrny - 28 - 16) / 2;
sheet_slide(sht_mouse, mx, my);
sheet_slide(sht_win, 80, 72);
sheet_updown(sht_back, 0);
sheet_updown(sht_win, 1);
sheet_updown(sht_mouse, 2);
sprintf(s, "(%3d, %3d)", mx, my);
putfonts8_asc_sht(sht_back, 0, 0, COL8_FFFFFF, COL8_008484, s, 10);
sprintf(s, "memory %dMB free : %dKB", memtotal / (1024 * 1024), memman_total(memman) / 1024);
putfonts8_asc_sht(sht_back, 0, 32, COL8_FFFFFF, COL8_008484, s, 40);
for (;;) {
io_cli();
if (fifo32_status(&fifo) == 0) {
/* J
char ss[10];
sprintf(ss, "%c", "J");
putfonts8_asc(binfo->vram, binfo->scrnx, 100, 100, COL8_FFFFFF, ss);
*/
io_stihlt();
} else {
i = fifo32_get(&fifo);
io_sti();
if (256 <= i && i <= 511) { /* 键盘数据 */
sprintf(s, "%02X", i - 256);
putfonts8_asc_sht(sht_back, 0, 16, COL8_FFFFFF, COL8_008484, s, 2);
if (i < 256 + 0x54) {
if (keytable[i - 256] != 0 && cursor_x < 144) { /* 通常文字 */
/* 显示1个字符就前移1次光标 */
s[0] = keytable[i - 256];
s[1] = 0;
putfonts8_asc_sht(sht_win, cursor_x, 28, COL8_000000, COL8_FFFFFF, s, 1);
cursor_x += 8;
}
}
if (i == 256 + 0x0e && cursor_x > 8) { /* 退格键 */
/* 用空格键把光标消去后,后移1次光标 */
putfonts8_asc_sht(sht_win, cursor_x, 28, COL8_000000, COL8_FFFFFF, " ", 1);
cursor_x -= 8;
}
/* カーソルの再表示 */
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个字节都齐了,显示出来 */
sprintf(s, "[lcr %4d %4d]", mdec.x, mdec.y);
if ((mdec.btn & 0x01) != 0) {
s[1] = 'L';
}
if ((mdec.btn & 0x02) != 0) {
s[3] = 'R';
}
if ((mdec.btn & 0x04) != 0) {
s[2] = 'C';
}
putfonts8_asc_sht(sht_back, 32, 16, COL8_FFFFFF, COL8_008484, s, 15);
/* 移动鼠标 */
mx += mdec.x;
my += mdec.y;
if (mx < 0) {
mx = 0;
}
if (my < 0) {
my = 0;
}
if (mx > binfo->scrnx - 1) {
mx = binfo->scrnx - 1;
}
if (my > binfo->scrny - 1) {
my = binfo->scrny - 1;
}
sprintf(s, "(%3d, %3d)", mx, my);
putfonts8_asc_sht(sht_back, 0, 0, COL8_FFFFFF, COL8_008484, s, 10);
sheet_slide(sht_mouse, mx, my);
if ((mdec.btn & 0x01) != 0) {
/* 按下左键、移动sht_win */
sheet_slide(sht_win, mx - 80, my - 8);
}
}
} else if (i == 10) { /* 10秒定时器 */
putfonts8_asc_sht(sht_back, 0, 64, COL8_FFFFFF, COL8_008484, "10[sec]", 7);
} else if (i == 3) { /* 3秒定时器 */
putfonts8_asc_sht(sht_back, 0, 80, COL8_FFFFFF, COL8_008484, "3[sec]", 6);
} else if (i <= 1) { /* 光标用定时器 */
if (i != 0) {
timer_init(timer3, &fifo, 0); /* 下面设定0 */
cursor_c = COL8_000000;
} else {
timer_init(timer3, &fifo, 1); /* 下面设定1 */
cursor_c = COL8_FFFFFF;
}
timer_settime(timer3, 50);
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);
}
}
}
}
开发者ID:NeilJudson,项目名称:HomemadeOS,代码行数:101,代码来源:bootpack.c
示例20: HariMain
void HariMain(void)
{
char s[40];
struct MOUSE_DEC mdec;
int mx, my;
int i;
unsigned int memtotal;
unsigned int count;
fifo8 timerfifo;
char keybuf[KEYBUF_SIZE] = {0};
char mousebuf[MOUSEBUF_SIZE] = {0};
char timerbuf[8] = {0};
struct BOOTINFO *binfo;
struct MEMMAN *memman;
shtctl_t *shtctl;
sheet_t *sht_back, *sht_mouse, *sht_win;
unsigned char *buf_back, buf_mouse[256], *buf_win;
binfo = (struct BOOTINFO *) ADR_BOOTINFO;
memman = (struct MEMMAN *)MEMMAN_ADDR;
count = 0;
init_gdtidt ();
init_pic();
io_sti();
fifo8_init(&keyfifo, KEYBUF_SIZE, keybuf); /* keyboard */
fifo8_init(&mousefifo, MOUSEBUF_SIZE, mousebuf); /* mouse */
init_pit();
fifo8_init(&timerfifo, 8, timerbuf); /* timer */
settimer(100, &timerfifo, 1);
io_out8(PIC0_IMR, 0xf8); /* PIC1/keyboard/PIT设置为许可(11111000) */
io_out8(PIC1_IMR, 0xef); /* 鼠标设置为许可(11101111) */
init_keyboard ();
enable_mouse(&mdec);
memtotal = memtest(0x00400000, 0xbfffffff);
memman_init(memman);
memman_free(memman, 0x00001000, 0x0009e000); /* 0x00001000 - 0x0009efff */
memman_free(memman, 0x00400000, memtotal - 0x00400000);
init_palette();
shtctl = shtctl_init(memman, binfo->vram, binfo->scrnx, binfo->scrny);
sht_back = sheet_alloc(shtctl);
sht_mouse = sheet_alloc(shtctl);
sht_win = sheet_alloc(shtctl);
buf_back = (unsigned char *) memman_alloc_4k(memman, binfo->scrnx * binfo->scrny);
buf_win = (unsigned char *) memman_alloc_4k(memman, 160 * 52);
sheet_setbuf(sht_back, buf_back, binfo->scrnx, binfo->scrny, -1);
sheet_setbuf(sht_mouse, buf_mouse, 16, 16, 99);
sheet_setbuf(sht_win, buf_win, 160, 52, -1);
init_screen8(buf_back, binfo->scrnx, binfo->scrny);
init_mouse_cursor8(buf_mouse, 99);
make_window8(buf_win, 160, 52, "counter");
sheet_slide(sht_back, 0, 0);
/* make it in the middle. */
mx = (binfo->scrnx - 16) / 2;
my = (binfo->scrny - 28 - 16) / 2;
//init_mouse_cursor8(mcursor, COL8_008484);
sheet_slide(sht_mouse, mx, my);
sheet_slide(sht_win, 80, 72);
sheet_updown(sht_back, 0);
sheet_updown(sht_win, 1);
sheet_updown(sht_mouse, 2);
//putblock8_8(binfo->vram, binfo->scrnx, 16, 16, mx, my, mcursor, 16);
sprintf(s, "(%3d, %3d)", mx, my);
putfonts8_asc(buf_back, binfo->scrnx, 0, 0, COL8_FFFFFF, s);
sprintf(s, "memory %dMB free : %dKB",
memtotal / (1024 * 1024), memman_total(memman) / 1024);
putfonts8_asc(buf_back, binfo->scrnx, 0, 32, COL8_FFFFFF, s);
sheet_refresh(sht_back, 0, 0, binfo->scrnx, 48);
for (;;) {
++count;
sprintf(s, "%u, %u", timerctl.count, timerctl.timeout);
boxfill8(buf_win, 160, COL8_C6C6C6, 40, 28, 119, 43);
putfonts8_asc(buf_win, 160, 40, 28, COL8_000000, s);
sheet_refresh(sht_win, 40, 28, 120, 44);
io_cli();
if (fifo8_status(&keyfifo) + fifo8_status(&mousefifo) + fifo8_status(&timerfifo) == 0){
io_sti();
} else {
if (fifo8_status(&keyfifo) != 0) {
i = fifo8_get(&keyfifo);
io_sti();
sprintf(s, "%02X", i);
boxfill8(buf_back, binfo->scrnx, COL8_008484, 0, 16, 15, 31);
//.........这里部分代码省略.........
开发者ID:anbenqishi,项目名称:simpleOS_30days,代码行数:101,代码来源:bootpack.c
注:本文中的sheet_refresh函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论