finetuning putchar and preparing scaling

This commit is contained in:
Jarkko Toivanen 2023-09-22 23:28:52 +03:00
parent 2b716fcc4c
commit b047235d75
Signed by: jt
GPG Key ID: 9151B109B73ECAD5
2 changed files with 20 additions and 25 deletions

View File

@ -67,12 +67,19 @@ void putchar(
}
unsigned char *rowdata = font8x8_basic[*character];
unsigned int charx, chary;
unsigned char charx, chary, iy, ix;
unsigned char sizex=2;
unsigned char sizey=2;
for (chary=0;chary<8;chary++) {
for (charx=0;charx<8;charx++) {
unsigned char pix = rowdata[chary] & 1 << charx;
if (pix)
putpixel(x+charx, y+chary, r*pix, g*pix, b*pix);
if (pix) {
for (iy=1;iy<=sizey;iy++) {
for (ix=1;ix<=sizex;ix++) {
putpixel(x+charx*sizex+ix, y+chary*sizey+iy, r, g, b);
}
}
}
}
}
}

View File

@ -80,30 +80,18 @@ void kmain (unsigned int mbootmagick, multiboot_info_t* mbootinfo)
mbootinfo->framebuffer_green_field_position,
mbootinfo->framebuffer_blue_field_position
);
// int x, y, i;
// unsigned char c = 0;
// for (;;) {
// for (;c<255;c+=5) {
// for (y=0; y < mbootinfo->framebuffer_height; y++) {
// for (x=0; x < mbootinfo->framebuffer_width; x++) {
// putpixel(x, y, 0, c, c);
// }
// }
// }
// for (;c>0;c-=5) {
// for (y=mbootinfo->framebuffer_height; y>=0; y--) {
// for (x=mbootinfo->framebuffer_width; x>=0; x--) {
// putpixel(x, y, 0, c, c);
// }
// }
// }
// }
int x, y;
for (y=mbootinfo->framebuffer_height; y>=0; y--) {
for (x=mbootinfo->framebuffer_width; x>=0; x--) {
putpixel(x, y, 0, 0x55, 0x55);
}
}
putchar("r", 0, 0, 0xff, 0xff, 0xff);
putchar("O", 8, 0, 0xff, 0xff, 0xff);
putchar("S", 16, 0, 0xff, 0xff, 0xff);
putchar("k", 24, 0, 0xff, 0xff, 0xff);
putchar("a", 32, 0, 0xff, 0xff, 0xff);
putchar("O", 16, 0, 0xff, 0xff, 0xff);
putchar("S", 32, 0, 0xff, 0xff, 0xff);
putchar("k", 48, 0, 0xff, 0xff, 0xff);
putchar("a", 64, 0, 0xff, 0xff, 0xff);
while(1){}
serial_write_string("\nExecution finished, halting...\n");