Writing (debug output) to screen

This commit is contained in:
2017-12-04 00:22:39 +01:00
parent b9e9df32f5
commit 4f00d428bf
5 changed files with 134 additions and 26 deletions

View File

@@ -2,6 +2,7 @@
#include <stdarg.h>
#include <stdint.h>
#include <serial.h>
#include <vga.h>
// TODO: Temporary declarations
void vga_write(char c);

View File

@@ -1,36 +1,13 @@
#include <memory.h>
#include <serial.h>
#include <vga.h>
#include <debug.h>
void clear_screen()
{
unsigned char *vidmem = P2V(0xB8000);
for(int i=0; i < 80*24*2; i++)
*vidmem++ = 0;
}
void print_string(char *str)
{
unsigned char *vidmem = P2V(0xB8000);
while(*str)
{
*vidmem++ = *str++;
*vidmem++ = 0x7;
}
}
void vga_write(char c)
{
// TODO: DUMMY
(void)c;
}
void kmain()
{
clear_screen();
print_string("Hello from c, world!");
serial_init(PORT_COM1);
vga_init();
debug_printf("Hello from debug printing function!\n");
debug_printf("A number:%d\n", 12345);
for(;;);