void HariMain(void) { struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; char s[40], mcursor[256], keybuf[32]; int mx, my, i; init_gdtidt(); init_pic(); io_sti(); fifo8_init(&keyfifo, 32, keybuf); io_out8(PIC0_IMR, 0xf9); io_out8(PIC1_IMR, 0xef); init_palette(); init_screen8(binfo->vram, binfo->scrnx, binfo->scrny); mx = (binfo->scrnx - 16) / 2; my = (binfo->scrny - 28 - 16) / 2; init_mouse_cursor8(mcursor, COL8_008484); putblock8_8(binfo->vram, binfo->scrnx, 16, 16, mx, my, mcursor, 16); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, s); for (;;) { io_cli(); if (fifo8_status(&keyfifo) == 0) { io_stihlt(); } else { i = fifo8_get(&keyfifo); io_sti(); boxfill8(binfo->vram, binfo->scrnx, COL8_008484, 0, 16, 15, 31); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 16, COL8_FFFFFF, s); } } }
void HariMain(void) { char *vram; BOOTINFO_t *binfo; char mcursor[16*16]; int mx, my; binfo = (BOOTINFO_t *)BOOTINFO_ENTRY; init_palette(); init_screen(binfo->vram, binfo->scrnx, binfo->scrny); static char font_A[16] = { 0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x24, 0x24, 0x7e, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00 }; putfont8(binfo->vram, binfo->scrnx, 8, 8, COL8_0000FF, hankaku+'A'*16); putfonts8_asc(binfo->vram, binfo->scrnx, 16, 8, COL8_0000FF, "BC 123"); putfonts8_asc(binfo->vram, binfo->scrnx, 31, 31, COL8_000000, "EasyOS."); putfonts8_asc(binfo->vram, binfo->scrnx, 30, 30, COL8_FFFFFF, "EasyOS."); mx = my = 100; init_mouse_cursor8(mcursor, COL8_008484); putblock8_8(binfo->vram, binfo->scrnx, 16, 16, mx, my, mcursor, 16); fin: io_hlt(); goto fin; }
void HariMain(void) { struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; char s[40], mcursor[256], keybuf[32], mousebuf[128]; int mx, my, i; init_gdtidt(); init_pic(); io_sti(); /* IDT/PIC的初始化结束,开启CPU中断 */ fifo8_init(&keyfifo, 32, keybuf); fifo8_init(&mousefifo, 128, mousebuf); io_out8(PIC0_IMR, 0xf9); /* 许可PIC1和键盘(11111001) */ io_out8(PIC1_IMR, 0xef); /* 许可鼠标(11101111) */ init_keyboard(); init_palette(); init_screen8(binfo->vram, binfo->scrnx, binfo->scrny); mx = (binfo->scrnx - 16) / 2; my = (binfo->scrny - 28 - 16) / 2; init_mouse_cursor8(mcursor, COL8_008484); putblock8_8(binfo->vram, binfo->scrnx, 16, 16, mx, my, mcursor, 16); sprintf(s, "(%d, %d)", mx, my); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, s); enable_mouse(); for (;;) { io_cli(); if (fifo8_status(&keyfifo) + fifo8_status(&mousefifo) == 0) { /* J char ss[10]; sprintf(ss, "%c", "J"); putfonts8_asc(binfo->vram, binfo->scrnx, 100, 100, COL8_FFFFFF, ss); */ io_stihlt(); } else if (fifo8_status(&keyfifo) != 0) { i = fifo8_get(&keyfifo); io_sti(); sprintf(s, "%02X", i); boxfill8(binfo->vram, binfo->scrnx, COL8_008484, 0, 16, 15, 31); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 16, COL8_FFFFFF, s); } else if (fifo8_status(&mousefifo) != 0) { i = fifo8_get(&mousefifo); io_sti(); sprintf(s, "%02X", i); boxfill8(binfo->vram, binfo->scrnx, COL8_008484, 32, 16, 47, 31); putfonts8_asc(binfo->vram, binfo->scrnx, 32, 16, COL8_FFFFFF, s); } } }
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; }
void HariMain(void) { struct BOOTINFO *binfo = (struct BOOTINFO *) 0x0ff0; init_palette(); init_screen(binfo->vram, binfo->scrnx, binfo->scrny); putfonts8_asc(binfo->vram, binfo->scrnx, 8, 8, COL8_FFFFFF, "ABC 123"); putfonts8_asc(binfo->vram, binfo->scrnx, 31, 31, COL8_000000, "Haribote OS."); putfonts8_asc(binfo->vram, binfo->scrnx, 30, 30, COL8_FFFFFF, "Haribote OS."); for (;;) { io_hlt(); } }
void make_wtitle8(unsigned char* buf, int xsize, char* title, char act) { static char closebtn[7][8] = { "oo oo", " oo oo ", " oooo ", " oo ", " oooo ", " oo oo ", "oo oo", }; /* 仿 Windows 8 关闭按钮 */ int x, y; char c; boxfill8(buf, xsize, act ? blue : base1, 1, 1, xsize - 2, 20); boxfill8(buf, xsize, act ? orange : base00, xsize - 30, 1, xsize - 2, 18); for (y = 0; y < 7; y++) { for (x = 0; x < 8; x++) { c = closebtn[y][x]; if (c == 'o') { buf[(7 + y) * xsize + (xsize - 19 + x)] = base3; } } } putfonts8_asc(buf, xsize, (xsize - strlen(title) * FNT_W) / 2, (22 - FNT_H) / 2, base3, title); return; }
void print_on_screen(char *msg) { struct BOOTINFO *bootinfo = (struct BOOTINFO *) ADR_BOOTINFO; int x0 = 10, y0 = 200; static int invoke_count = 0; boxfill8(bootinfo->vram,bootinfo->scrnx, COL8_848484, x0, y0 + invoke_count * 16, x0 + strlen(msg)*8, y0 + invoke_count * 16 + 16); putfonts8_asc(bootinfo->vram, bootinfo->scrnx, x0, y0 + invoke_count * 16, COL8_000000, msg); invoke_count++; //没有空间记录日志,则刷新日志,从头开始显示日志 if(invoke_count == 35){ invoke_count = 0; boxfill8(bootinfo->vram,bootinfo->scrnx, COL8_008484, x0, y0, x0 + 1024, y0 + 768); putfonts8_asc(bootinfo->vram, bootinfo->scrnx, x0, y0 + invoke_count * 16, COL8_000000, msg); } }
void HariMain(void) { struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; char s[40],mcursor[256]; int mx, my; init_gdtidt(); init_pic(); io_sti(); init_palette(); init_screen8(binfo->vram, binfo->scrnx, binfo->scrny); mx = (binfo->scrnx - 16) / 2; my = (binfo->scrny - 28 - 16) / 2; init_mouse_cursor8(mcursor, COL8_008484); putblock8_8(binfo->vram, binfo->scrnx, 16, 16, mx, my, mcursor, 16); sprintf(s, "(%d, %d)", mx, my); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, s); io_out8(PIC0_IMR, 0xf9); io_out8(PIC1_IMR, 0xef); for (;;) { io_hlt(); } }
/* void bootmain(void){ //注意这里的函数名字为bootmain,因为在entry.S中设定的入口名字也是bootmain,两者要保持一致 clear_screen(40); char *vram; int xsize, ysize; struct BOOTINFO *binfo; binfo=(struct BOOTINFO *)0x0ff0; init_screen((struct BOOTINFO*)0x0ff0); draw_window(); init_palette(); vram=(char *)0x0ff0; char font_A[16]={ 0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x24, 0x24, 0x7e, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00 }; //putfont8(vram, 20, 50, 50, 'd', font_A); putfont8(binfo->vram binfo->xsize, 8, 8, COL8_FFFFFF, font_A); } */ void bootmain(void){ struct BOOTINFO *binfo = (struct BOOTINFO*) 0x0ff0; extern char hankaku[2048]; init_palette(); init_screen(binfo->vram, binfo->scrnx, binfo->scrny); //putfont8_asc(binfo->vram, binfo->scrnx, 8, 8, COL8_FFFFFF, "ChrisZZ"); //putfont8_asc(binfo->vram, binfo->scrnx, 31, 31, COL8_000000, "Haribote OS"); //putfont8_asc(binfo->vram, binfo->scrnx, 32, 32, COL8_FFFFFF, "Haribote OS"); char s[10]; //sprintf(s, "scrnx=%d", binfo->scrnx); //putfont8_asc(binfo->vram, binfo->scrnx, 16, 64, COL8_FFFFFF, s); char mcursor[256]; int mx, my; mx = (binfo->scrnx-16)/2; my = (binfo->scrny-28-16)/2; init_mouse_cursor8(mcursor, COL8_008484); putblock8_8(binfo->vram, binfo->scrnx, 16, 16, mx, my, mcursor, 16); sprintf(s, "(%d, %d)", mx, my); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, s); while(1); }
void HariMain(void) { struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; /* s是输出缓冲区 mcursor存放鼠标图形 */ char s[40], mcursor[256]; int mx, my; init_gdtidt(); /* 初始化GDT, IDT */ init_pic(); /* 初始化PIC */ io_sti(); /* 打开所有可屏蔽中断 */ init_palette(); /* 初始化调色板 */ init_screen8(binfo->vram, binfo->scrnx, binfo->scrny); /* 绘制"桌面" */ mx = (binfo->scrnx - 16) / 2; /* 计算鼠标图形在屏幕上的位置 它在整个桌面的中心位置 */ my = (binfo->scrny - 28 - 16) / 2; init_mouse_cursor8(mcursor, COL8_008484); putblock8_8(binfo->vram, binfo->scrnx, 16, 16, mx, my, mcursor, 16); /* 显示鼠标图形 */ sprintf(s, "(%d, %d)", mx, my); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, s); /* 输出鼠标图形左上角在屏幕上的坐标 */ io_out8(PIC0_IMR, 0xf9); /* PIC0(11111001) (打开IRQ1键盘中断和连接从PIC的IRQ2)*/ io_out8(PIC1_IMR, 0xef); /* PIC1(11101111) (打开PS2鼠标中断 即IRQ12)*/ for (;;) { io_hlt(); } }
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; }
/* b:background color, c : char color len: length*/ int bps(struct SHEET *sht, int x,int y, int b,int c, char *s , int len) { boxfill8(sht->buf,sht->bxsize,b,x,y,x+8*len -1,y+15); putfonts8_asc(sht->buf,sht->bxsize,x,y, c,s); sheet_refresh(sht,x,y,x+8*len,y+16); return 1; }
void print_debug(char *str) { struct BOOTINFO *binfo; binfo = (struct BOOTINFO *) 0xff0; boxfill8(binfo->vram, binfo->scrnx, COL8_008484, 0, 128, 320, 128 + 16); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 128, COL8_FFFFFF, str); }
void debug_print(int x, int y, unsigned char *s) { struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; putfonts8_asc(binfo->vram, binfo->scrnx, x, y, COL8_FF0000, s); return; }
// P119 需要执行 STI void inthandler27(int *esp) { BOOTINFO_t *binfo = (BOOTINFO_t *) BOOTINFO_ENTRY; boxfill8(binfo->vram, binfo->scrnx, COL8_000000, 0, 0, 32 * 8 - 1, 15); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, "INT 27 (IRQ-7) : None"); io_out8(PIC0_OCW2, 0x67); }
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; }
void HariMain(void) { int i; struct BOOTINFO *binfo = (struct BOOTINFO *)0x0ff0; int xsize = (*binfo).scrnx; int ysize = (*binfo).scrny; char *vram = (*binfo).vram; char msg[40], mcursor[256]; const int mx = xsize/2; const int my = ysize/2; init_gdtidt (); init_pic (); io_sti (); init_pallete(); init_screen (vram, xsize, ysize); putfonts8_asc (binfo->vram, binfo->scrnx, 8, 8, COL8_FFFFFF, "ABC 123"); putfonts8_asc (binfo->vram, binfo->scrnx, 31, 31, COL8_000000, "Haribote OS."); putfonts8_asc (binfo->vram, binfo->scrnx, 30, 30, COL8_FFFFFF, "Haribote OS."); sprintf(msg, "scrnx = %d", binfo->scrnx); putfonts8_asc (binfo->vram, binfo->scrnx, 30, 48, COL8_FFFFFF, msg); init_mouse_cursor8 (mcursor, COL8_008484); putblock8_8 (binfo->vram, binfo->scrnx, 16, 16, mx,my, mcursor, 16); io_out8(PIC0_IMR, 0xf9); /* PIC1とキーボードを許可(11111001) */ io_out8(PIC1_IMR, 0xef); /* マウスを許可(11101111) */ for (;;) { io_cli(); if (keybuf.flag == 0) { io_stihlt(); } else { i = keybuf.data; keybuf.flag = 0; io_sti(); unsigned char s[4]; sprintf (s, "%x", i); boxfill8(binfo->vram, binfo->scrnx, COL8_008484, 0, 48, 15, 31+48); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 48, COL8_FFFFFF, s); } } }
void HariMain(void) { struct BOOTINFO *binfo = (struct BOOTINFO *) 0x0ff0; char s[40], mcursor[256]; int mx, my, i; init_gdtidt(); init_pic(); // Set IF (interrupt flag to 1) io_sti(); init_palette(); init_screen8(binfo->vram, binfo->scrnx, binfo->scrny); mx = (binfo->scrnx - 16) / 2; /* 画面中央になるように座標計算 */ my = (binfo->scrny - 28 - 16) / 2; init_mouse_cursor8(mcursor, COL8_008484); putblock8_8(binfo->vram, binfo->scrnx, 16, 16, mx, my, mcursor, 16); sprintf(s, "(%d, %d)", mx, my); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, s); io_out8(PIC0_IMR, 0xf9); /* (11111001) Open IRQ 1 (keyboard) and IRQ 2 (connect to PIC 1) */ io_out8(PIC1_IMR, 0xef); /* (11101111) Open IRQ 12 */ //--keyboard char keybuf[32]; fifo8_init(&keyfifo,32, keybuf); init_keyboard(); for (;;) { io_cli(); if (fifo8_status(&keyfifo) == 0) { io_stihlt(); } else { i = fifo8_get(&keyfifo); io_sti(); sprintf(s, "%02X", i); boxfill8(binfo->vram, binfo->scrnx, COL8_008484, 0, 16, 15, 31); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 16, COL8_FFFFFF, s); } } }
void HariMain(void) { struct BOOTINFO *binfo = (struct BOOTINFO *) 0x0ff0; char s[40]; init_palette(); init_screen(binfo->vram, binfo->scrnx, binfo->scrny); putfonts8_asc(binfo->vram, binfo->scrnx, 8, 8, COL8_FFFFFF, "ABC 123"); putfonts8_asc(binfo->vram, binfo->scrnx, 31, 31, COL8_000000, "Haribote OS."); putfonts8_asc(binfo->vram, binfo->scrnx, 30, 30, COL8_FFFFFF, "Haribote OS."); sprintf(s, "scrnx = %d", binfo->scrnx); putfonts8_asc(binfo->vram, binfo->scrnx, 16, 64, COL8_FFFFFF, s); for (;;) { io_hlt(); } }
void inthandler2c(int *esp) { struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; boxfill8(binfo->vram, binfo->scrnx, COL8_000000, 0, 0, 32 * 8 - 1, 15); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, "INT 2C (IRQ-12) : PS/2 mouse"); for (;;) { io_hlt(); } }
void inthandler21(int *esp) /* PS/2键盘的中断 */ { struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; boxfill8(binfo->vram, binfo->scrnx, COL8_000000, 0, 0, 32 * 8 - 1, 15); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, "INT 21 (IRQ-1) : PS/2 keyboard"); for (;;) { io_hlt(); } }
void make_window8(unsigned char *buf, int xsize, int ysize, char *title, char act) { static char closebtn[14][16] = { "OOOOOOOOOOOOOOO@", "OQQQQQQQQQQQQQ$@", "OQQQQQQQQQQQQQ$@", "OQQQ@@QQQQ@@QQ$@", "OQQQQ@@QQ@@QQQ$@", "OQQQQQ@@@@QQQQ$@", "OQQQQQQ@@QQQQQ$@", "OQQQQQ@@@@QQQQ$@", "OQQQQ@@QQ@@QQQ$@", "OQQQ@@QQQQ@@QQ$@", "OQQQQQQQQQQQQQ$@", "OQQQQQQQQQQQQQ$@", "O$$$$$$$$$$$$$$@", "@@@@@@@@@@@@@@@@" }; int x, y; char c, tc, tbc; if (act != 0) { tc = COL8_FFFFFF; tbc = COL8_000084; } else { tc = COL8_C6C6C6; tbc = COL8_848484; } boxfill8(buf, xsize, COL8_C6C6C6, 0, 0, xsize - 1, 0 ); boxfill8(buf, xsize, COL8_FFFFFF, 1, 1, xsize - 2, 1 ); boxfill8(buf, xsize, COL8_C6C6C6, 0, 0, 0, ysize - 1); boxfill8(buf, xsize, COL8_FFFFFF, 1, 1, 1, ysize - 2); boxfill8(buf, xsize, COL8_848484, xsize - 2, 1, xsize - 2, ysize - 2); boxfill8(buf, xsize, COL8_000000, xsize - 1, 0, xsize - 1, ysize - 1); boxfill8(buf, xsize, COL8_C6C6C6, 2, 2, xsize - 3, ysize - 3); boxfill8(buf, xsize, tbc, 3, 3, xsize - 4, 20 ); boxfill8(buf, xsize, COL8_848484, 1, ysize - 2, xsize - 2, ysize - 2); boxfill8(buf, xsize, COL8_000000, 0, ysize - 1, xsize - 1, ysize - 1); putfonts8_asc(buf, xsize, 24, 4, tc, title); for (y = 0; y < 14; y++) { for (x = 0; x < 16; x++) { c = closebtn[y][x]; if (c == '@') { c = COL8_000000; } else if (c == '$') { c = COL8_848484; } else if (c == 'Q') { c = COL8_C6C6C6; } else { c = COL8_FFFFFF; } buf[(5 + y) * xsize + (xsize - 21 + x)] = c; } } return; }
void inthandler21(int *esp) { struct BOOTINFO *binfo = (struct BOOTINFO*)ADR_BOOTINFO; char data, s[4]; outb(PIC0_OCW2, 0X61); data = inb(PORT_KEYDAT); sprintf(s, "%02X", data); boxfill8(binfo->vram, binfo->scrnx, COL8_000000, 0, 16, 15, 31); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 16, COL8_FFFFFF, s); return; }
void inthandler21(int *esp) { unsigned char data, s[4]; BOOTINFO_t *binfo = (BOOTINFO_t *) BOOTINFO_ENTRY; io_out8(PIC0_OCW2, 0x61); // 通知 IRQ-1 已经受理完毕 data = io_in8(PORT_KEYDAT); sprintf(s, "%02X", data); boxfill8(binfo->vram, binfo->scrnx, COL8_000000, 0, 0, 32 * 8 - 1, 15); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, s); }
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; }
/* 创建窗口图形 */ void make_window8(unsigned char *buf, int xsize, int ysize, char *title) { /* 这个数组定义的是窗口右上角那个叉叉图形 */ static char closebtn[14][16] = { "OOOOOOOOOOOOOOO@", "OQQQQQQQQQQQQQ$@", "OQQQQQQQQQQQQQ$@", "OQQQ@@QQQQ@@QQ$@", "OQQQQ@@QQ@@QQQ$@", "OQQQQQ@@@@QQQQ$@", "OQQQQQQ@@QQQQQ$@", "OQQQQQ@@@@QQQQ$@", "OQQQQ@@QQ@@QQQ$@", "OQQQ@@QQQQ@@QQ$@", "OQQQQQQQQQQQQQ$@", "OQQQQQQQQQQQQQ$@", "O$$$$$$$$$$$$$$@", "@@@@@@@@@@@@@@@@" }; int x, y; char c; /* 先画出窗口的形状 */ boxfill8(buf, xsize, COL8_C6C6C6, 0, 0, xsize - 1, 0 ); boxfill8(buf, xsize, COL8_FFFFFF, 1, 1, xsize - 2, 1 ); boxfill8(buf, xsize, COL8_C6C6C6, 0, 0, 0, ysize - 1); boxfill8(buf, xsize, COL8_FFFFFF, 1, 1, 1, ysize - 2); boxfill8(buf, xsize, COL8_848484, xsize - 2, 1, xsize - 2, ysize - 2); boxfill8(buf, xsize, COL8_000000, xsize - 1, 0, xsize - 1, ysize - 1); boxfill8(buf, xsize, COL8_C6C6C6, 2, 2, xsize - 3, ysize - 3); boxfill8(buf, xsize, COL8_000084, 3, 3, xsize - 4, 20 ); boxfill8(buf, xsize, COL8_848484, 1, ysize - 2, xsize - 2, ysize - 2); boxfill8(buf, xsize, COL8_000000, 0, ysize - 1, xsize - 1, ysize - 1); /* 输出窗口的标题 */ putfonts8_asc(buf, xsize, 24, 4, COL8_FFFFFF, title); /* 画出右上角的叉叉 */ for (y = 0; y < 14; y++) { for (x = 0; x < 16; x++) { c = closebtn[y][x]; if (c == '@') { c = COL8_000000; } else if (c == '$') { c = COL8_848484; } else if (c == 'Q') { c = COL8_C6C6C6; } else { c = COL8_FFFFFF; } buf[(5 + y) * xsize + (xsize - 21 + x)] = c; } } return; }
void inthandler2c(int *esp) { unsigned char data; BOOTINFO_t *binfo = (BOOTINFO_t *) BOOTINFO_ENTRY; io_out8(PIC1_OCW2, 0x64); // 通知 PIC1 IRQ-12 已受理完毕 io_out8(PIC0_OCW2, 0x62); // 通知 PIC0 IRQ-02 已受理完毕 data = io_in8(PORT_KEYDAT); boxfill8(binfo->vram, binfo->scrnx, COL8_000000, 0, 0, 32 * 8 - 1, 15); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, "INT 2c (IRQ-c) : mouse"); return; }
void inthandler21(int *esp){ struct BOOTINFO *binfo = (struct BOOTINFO*)ADR_BOOTINFO; // putfonts8_asc(binfo->vram, binfo->scrnx, 0, 16, COL8_000084, ""); boxfill8(binfo->vram, binfo->scrnx, COL8_000084, 0, 16, 31, 31); unsigned char data; char s[4]; outb(PIC0_OCW2, 0x61); data = inb(PORT_KEYDAT); sprintf(s, "%x", data); // boxfill8(binfo->vram, binfo->scrnx, COL8_000084, 0, 16, 15, 31); putfonts8_asc(binfo->vram, binfo->scrnx, 0, 16, COL8_FFFFFF, s); return; }
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; }
void make_wtitle8(unsigned char *buf, int xsize, char *title, char act) { /* * act: 为1时,颜色不变;为0时,标题栏变灰色。 */ static char closebtn[14][16] = { "OOOOOOOOOOOOOOO@", "OQQQQQQQQQQQQQ$@", "OQQQQQQQQQQQQQ$@", "OQQQ@@QQQQ@@QQ$@", "OQQQQ@@QQ@@QQQ$@", "OQQQQQ@@@@QQQQ$@", "OQQQQQQ@@QQQQQ$@", "OQQQQQ@@@@QQQQ$@", "OQQQQ@@QQ@@QQQ$@", "OQQQ@@QQQQ@@QQ$@", "OQQQQQQQQQQQQQ$@", "OQQQQQQQQQQQQQ$@", "O$$$$$$$$$$$$$$@", "@@@@@@@@@@@@@@@@" }; int x, y; char c, tc, tbc; if (act != 0) { // act为1时,颜色不变;act为0时,标题栏变灰色 tc = COL8_FFFFFF; tbc = COL8_000084; } else { tc = COL8_C6C6C6; tbc = COL8_848484; } boxfill8(buf, xsize, tbc, 3, 3, xsize - 4, 20); putfonts8_asc(buf, xsize, 24, 4, tc, title); for (y = 0; y < 14; y++) { for (x = 0; x < 16; x++) { c = closebtn[y][x]; if (c == '@') { c = COL8_000000; } else if (c == '$') { c = COL8_848484; } else if (c == 'Q') { c = COL8_C6C6C6; } else { c = COL8_FFFFFF; } buf[(5 + y) * xsize + (xsize - 21 + x)] = c; } } return; }