feature: start to implement the drivers for char printing support
This commit is contained in:
20
src/kernel.c
20
src/kernel.c
@ -29,24 +29,6 @@
|
||||
#error "This tutorial needs to be compiled with a ix86-elf compiler"
|
||||
#endif
|
||||
|
||||
static void put_pixel(uint32_t color, uint32_t x, uint32_t y)
|
||||
{
|
||||
// /
|
||||
// 4 cause display.buff is in 32bit instead of 8bit
|
||||
const uint32_t coords = x + y * display.pitch / 4;
|
||||
display.buff[coords] = color;
|
||||
}
|
||||
|
||||
void draw_icon(uint32_t pos_x, uint32_t pos_y, struct icon *img)
|
||||
{
|
||||
for (uint32_t y = 0; y < img->height; y++) {
|
||||
for (uint32_t x = 0; x < img->width; x++) {
|
||||
put_pixel(img->pixels[y * img->width + x], pos_x + x,
|
||||
pos_y + y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
||||
{
|
||||
/* terminal_initialize(); */
|
||||
@ -60,7 +42,7 @@ void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
||||
/* "complex 8*unknown quantity -byte descriptor table. -- Troy "
|
||||
*/
|
||||
/* "Martin 03:50, 22 March 2009 (UTC)\n"); */
|
||||
draw_icon(0, 0, &image_icon);
|
||||
terminal_putchar('A');
|
||||
/* memset(display.buff, 255, 1024 * 1024); */
|
||||
/* shell_init(); */
|
||||
}
|
||||
|
Reference in New Issue
Block a user