mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 00:56:14 +00:00
Add a Console device and start refactoring screen output.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "StdLib.h"
|
||||
#include "Task.h"
|
||||
#include <stdarg.h>
|
||||
#include "Console.h"
|
||||
|
||||
PRIVATE BYTE *vga_mem = 0L;
|
||||
PRIVATE BYTE current_attr = 0x07;
|
||||
@@ -15,6 +16,11 @@ template<typename PutChFunc> static int printNumber(PutChFunc, char*&, DWORD);
|
||||
template<typename PutChFunc> static int printHex(PutChFunc, char*&, DWORD, BYTE fields);
|
||||
template<typename PutChFunc> static int printSignedNumber(PutChFunc, char*&, int);
|
||||
|
||||
static void console_putch(char*, char ch)
|
||||
{
|
||||
Console::the().write((byte*)&ch, 1);
|
||||
}
|
||||
|
||||
static void vga_putch(char*, char ch)
|
||||
{
|
||||
WORD row;
|
||||
@@ -120,6 +126,15 @@ int kprintfInternal(PutChFunc putch, char* buffer, const char*& fmt, char*& ap)
|
||||
}
|
||||
|
||||
int kprintf(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
int ret = kprintfInternal(console_putch, nullptr, fmt, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int kprintfFromConsole(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
||||
Reference in New Issue
Block a user