void putfonts8_asc(char *vram, int xsize, int x, int y, char c, unsigned char *s) { extern char hankaku[4096]; for (; *s != 0x00; s++) { putfont8(vram, xsize, x, y, c, hankaku + *s * 16); x += 8; } return; }
void putfonts8_asc(char* vram, int xsize, int x, int y, char c, char *s){ //其实这就是一个简易版本的printf extern char hankaku[2048]; for(; *s!=0x00; s++){ putfont8(vram, xsize, x, y, c, hankaku+*s*16); x+=8; } return; }
void putfonts8_asc( char* vram, int xsize, int x, int y, char color, unsigned char* str ) { extern char hankaku[4096]; for( ; *str != '\0'; str++ ) { putfont8( vram, xsize, x, y, color, hankaku + *str * 16 ); x += 8; } return; }
/* this function is used to put a string */ void putfonts8_asc(char *vram, int xsize, int x, int y, char color, unsigned char *s) { extern char hankaku[4096]; /* 0x00 is the end of a string */ for(;*s != 0x00; s++) { putfont8(vram, xsize, x, y, color, hankaku + *s * 16); x += 8; } }
void putfonts8_asc_count(char *vram, int xsize, int x, int y, char c, unsigned char *s, int len) { extern char ascii[4096]; unsigned int i; for (i = 0; i < len; i++, s++) { putfont8(vram, xsize, x, y, c, ascii + *s * 16); x += 8; } return; }
void putfonts8_asc(char *vram, int xsize, int x, int y, char c, unsigned char *s) { extern char hankaku[4096]; struct TASK *task = task_now(); char *nihongo = (char *) *((int *) 0x0fe8); if (task->langmode == 0) { for (; *s != 0x00; s++) { putfont8(vram, xsize, x, y, c, hankaku + *s * 16); x += 8; } } if (task->langmode == 1) { for (; *s != 0x00; s++) { putfont8(vram, xsize, x, y, c, nihongo + *s * 16); x += 8; } } return; }
void putHexs(char *vram, int xsize, int x, int y, char c, unsigned char *s, int len){ extern char ascii[4096]; for (; len > 0x00; len--) { putHex(vram, xsize, x, y, c, s++); x += 16; putfont8(vram, xsize, x, y, c, ascii + ' ' * 16); x += 8; if(len % 27 == 0){ y += 24; x = 0; } } }
void putfonts8_asc(char *vram, int xsize, int x, int y, char c, unsigned char *s) { /* * д���ַ��� * �ڴ�vram��(x,y)����ʼ * c: �ַ���ɫ * s: �ַ��� */ extern char hankaku[4096]; for (; *s != 0x00; s++) { putfont8(vram, xsize, x, y, c, hankaku + *s * 16); x += 8; } return; }
void putfonts8_ascbg( char* vram, int xsize, int x, int y, char fgcolor, char bgcolor, unsigned char* str ) { extern char hankaku[4096]; for( ; *str != '\0'; str++ ) { boxfill8( vram, xsize, bgcolor, x, y, (x + 8) -1, (y + 16) -1 ); putfont8( vram, xsize, x, y, fgcolor, hankaku + *str * 16 ); x += 8; } return; }
void HariMain(void) { struct BOOTINFO *binfo = (struct BOOTINFO *) 0x0ff0; static char font_A[16] = { 0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x24, 0x24, 0x7e, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00 }; init_palette(); init_screen(binfo->vram, binfo->scrnx, binfo->scrny); putfont8(binfo->vram, binfo->scrnx, 10, 10, COL8_FFFFFF, font_A); for (;;) { io_hlt(); } }
void _start(void) { struct BOOTINFO *bootinfo_ptr = (struct BOOTINFO *) 0x0ff0; init_palette(); init_screen(bootinfo_ptr->vram, bootinfo_ptr->scrnx, bootinfo_ptr->scrny); static char font_A[16] = { 0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x24, 0x24, 0x7e, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00 }; putfont8(bootinfo_ptr->vram, bootinfo_ptr->scrnx, 10, 10, COL8_FFFFFF, font_A); while (1) { io_hlt(); } }
void _start(void) { struct BOOTINFO *bootinfo_ptr = (struct BOOTINFO *) 0x0ff0; extern char g_font[4096]; init_palette(); init_screen(bootinfo_ptr->vram, bootinfo_ptr->scrnx, bootinfo_ptr->scrny); putfont8(bootinfo_ptr->vram, bootinfo_ptr->scrnx, 28, 28, COL8_FFFFFF, g_font + 'A' * 16); char abc[28]; sprintf(abc, "_start addr: 0x%x", (unsigned int)_start); putfonts8_asc(bootinfo_ptr->vram, bootinfo_ptr->scrnx, 8, 8, COL8_FFFFFF, abc); while (1) { io_hlt(); } }
void vx_putchar(char c){ u32_t screen_x = vram_info->vx; if (c == '\n' || c == '\r') { newline: xpos = 0; ypos++; if (ypos >= LINES){ ypos = 0; } cls_line(ypos); return; } // *(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF; // *(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE; putfont8((char *)((u32_t)vram_info->vram+xpos*Font::vx+ypos*screen_x*Font::vy),c); xpos++; if (xpos >= COLUMNS) goto newline; }
void HariMain(void) { struct BOOTINFO *binfo = (struct BOOTINFO *) 0x0ff0; extern char hankaku[4096]; init_palette(); init_screen(binfo->vram, binfo->scrnx, binfo->scrny); putfont8(binfo->vram, binfo->scrnx, 8, 8, COL8_FFFFFF, hankaku + 'A' * 16); putfont8(binfo->vram, binfo->scrnx, 16, 8, COL8_FFFFFF, hankaku + 'B' * 16); putfont8(binfo->vram, binfo->scrnx, 24, 8, COL8_FFFFFF, hankaku + 'C' * 16); putfont8(binfo->vram, binfo->scrnx, 40, 8, COL8_FFFFFF, hankaku + '1' * 16); putfont8(binfo->vram, binfo->scrnx, 48, 8, COL8_FFFFFF, hankaku + '2' * 16); putfont8(binfo->vram, binfo->scrnx, 56, 8, COL8_FFFFFF, hankaku + '3' * 16); for (;;) { io_hlt(); } }
void HariMain(void) { BOOTINFO_t *binfo; char mcursor[16*16]; int mx, my, i; extern char hankaku[4096]; char s[40], keybuf[32], mousebuf[128]; binfo = (BOOTINFO_t *)BOOTINFO_ENTRY; fifo8_init(&keyfifo, 32, keybuf); fifo8_init(&mousefifo, 128, mousebuf); // init programmable interrupt controller init_gdtidt(); init_pic(); io_sti(); // 开启中断 // init fifo buffer // ...... io_out8(PIC0_IMR, 0xf9); /* (11111001) 设置PIC0 中断mask , 打开irq1 */ io_out8(PIC1_IMR, 0xef); /* (11101111) 设置PIC1 中断mask , 打开irq12 */ init_keyboard(); // 初始化键盘控制芯片中的鼠标控制器 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); enable_mouse(); // 通知开启鼠标中断信息产生 for (;;) { io_cli(); // 屏蔽中断 if (fifo8_status(&keyfifo) + fifo8_status(&mousefifo) == 0) { 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); } } } fin: io_hlt(); goto fin; }
void HariMain(void) { char *vram; int xsize; int ysize; //short *binfo_scrnx,*binfo_scrny; //int *binfo_vram; struct BOOTINFO *binfo; extern char hankaku[4096]; /*static char font_A[16] = { 0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x24, 0x24, 0x7e, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00 };*/ int i; char s[40]; init_gdtidt(); init_pic(); io_sti(); init_keyboard(); init_palette(); binfo = (struct BOOTINFO *) 0x0ff0; xsize = binfo->scrnx; ysize = binfo->scrny; vram = binfo->vram; /* initlize the os background */ init_screen(vram,xsize,ysize); putfont8(binfo->vram, binfo->scrnx, 8, 8, COL8_FFFFFF, hankaku+'A'*16); putfont8(binfo->vram, binfo->scrnx, 16, 8, COL8_FFFFFF, hankaku+'B'*16); putfont8(binfo->vram, binfo->scrnx, 24, 8, COL8_FFFFFF, hankaku+'C'*16); putfont8(binfo->vram, binfo->scrnx, 40, 8, COL8_FFFFFF, hankaku+'1'*16); putfont8(binfo->vram, binfo->scrnx, 48, 8, COL8_FFFFFF, hankaku+'2'*16); putfonts8_asc(binfo->vram,binfo->scrnx,60,50,COL8_FFFFFF,"hello os."); // interaction input sprintf(s,"scrnx= %d",binfo->scrnx); putfonts8_asc(binfo->vram,binfo->scrnx,16,64,COL8_FFFFFF,s); char mcursor[256],keybuf[32]; int mx, my; mx = (binfo->scrnx - 16) / 2; my = (binfo->scrny - 28 - 16) / 2; // mouse image enable_mouse(); init_mouse_cursor8(mcursor,COL8_008484); putblock8_8(binfo->vram,binfo->scrnx,16,16,mx,my,mcursor,16); io_out8(PIC0_IMR, 0xf9); /* PIC1�ƃL�[�{�[�h������(11111001) */ io_out8(PIC1_IMR, 0xef); //11101111 , allow irq12 // keyboard fifo8_init(&keyfifo,32,keybuf); for(;;) { io_cli(); // forbid all interrupts if(fifo8_status(&keyfifo) == 0) io_stihlt(); // read data until it's empty else { i=fifo8_get(&keyfifo); io_sti(); // open interrupts 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 putfonts8_asc(char *vram, int xsize, int x, int y, char c, unsigned char *s) { extern char hankaku[4096]; struct TASK *task = task_now(); char *nihongo = (char *) *((int *) 0x0fe8), *font; int k, t; if (task->langmode == 0) { for (; *s != 0x00; s++) { putfont8(vram, xsize, x, y, c, hankaku + *s * 16); x += 8; } } if (task->langmode == 1) { for (; *s != 0x00; s++) { if (task->langbyte1 == 0) { if ((0x81 <= *s && *s <= 0x9f) || (0xe0 <= *s && *s <= 0xfc)) { task->langbyte1 = *s; } else { putfont8(vram, xsize, x, y, c, nihongo + *s * 16); } } else { if (0x81 <= task->langbyte1 && task->langbyte1 <= 0x9f) { k = (task->langbyte1 - 0x81) * 2; } else { k = (task->langbyte1 - 0xe0) * 2 + 62; } if (0x40 <= *s && *s <= 0x7e) { t = *s - 0x40; } else if (0x80 <= *s && *s <= 0x9e) { t = *s - 0x80 + 63; } else { t = *s - 0x9f; k++; } task->langbyte1 = 0; font = nihongo + 256 * 16 + (k * 94 + t) * 32; putfont8(vram, xsize, x - 8, y, c, font ); /* 왼쪽 반 */ putfont8(vram, xsize, x , y, c, font + 16); /* 오른쪽 반 */ } x += 8; } } if (task->langmode == 2) { for (; *s != 0x00; s++) { if (task->langbyte1 == 0) { if (0x81 <= *s && *s <= 0xfe) { task->langbyte1 = *s; } else { putfont8(vram, xsize, x, y, c, nihongo + *s * 16); } } else { k = task->langbyte1 - 0xa1; t = *s - 0xa1; task->langbyte1 = 0; font = nihongo + 256 * 16 + (k * 94 + t) * 32; putfont8(vram, xsize, x - 8, y, c, font ); /* 왼쪽 반 */ putfont8(vram, xsize, x , y, c, font + 16); /* 오른쪽 반 */ } x += 8; } } return; }