mirror of https://github.com/garritfra/ditto-os
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
633 B
24 lines
633 B
#include "kmain.h" |
|
#include "fb.h" |
|
|
|
void fb_write_cell(unsigned int i, char c, unsigned char fg, unsigned char bg) { |
|
char *fb = (char *) 0x000B8000; |
|
fb[i] = c; |
|
fb[i + 1] = ((fg & 0x0F) << 4) | (bg & 0x0F); |
|
} |
|
|
|
void fb_move_cursor(unsigned short pos) |
|
{ |
|
outb(FB_COMMAND_PORT, FB_HIGH_BYTE_COMMAND); |
|
outb(FB_DATA_PORT, ((pos >> 8) & 0x00FF)); |
|
outb(FB_COMMAND_PORT, FB_LOW_BYTE_COMMAND); |
|
outb(FB_DATA_PORT, pos & 0x00FF); |
|
} |
|
|
|
int fb_write(char *buf, unsigned int len) { |
|
for(int i = 0; i <= (int)len; i++) { |
|
fb_write_cell((int)(i * 2), buf[i], 0, 15); |
|
fb_move_cursor(i); |
|
} |
|
return 0; |
|
} |