61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
#include "debug.h"
|
|
#include "assert.h"
|
|
#include "scheduling/PIT.h"
|
|
|
|
#pragma GCC diagnostic push
|
|
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
|
|
|
namespace Debug
|
|
{
|
|
DebugStatus DebugStatus::s_main;
|
|
|
|
void DebugStatus::Init()
|
|
{
|
|
ASSERT(renderer.init());
|
|
}
|
|
|
|
void DebugStatus::StartBootStage(Color stage)
|
|
{
|
|
renderer.paint_rect(x, y, 10, 10, stage);
|
|
y += 11;
|
|
}
|
|
|
|
void DebugStatus::PassBootStage(Color stage)
|
|
{
|
|
renderer.paint_rect(x, y, 10, 10, stage);
|
|
y -= 11;
|
|
x += 11;
|
|
}
|
|
|
|
void DebugStatus::FailBootStage()
|
|
{
|
|
renderer.paint_rect(x, y, 10, 10, Color::Red);
|
|
y -= 11;
|
|
x += 11;
|
|
}
|
|
|
|
void DebugStatus::DebugTick()
|
|
{
|
|
uint8_t blue = (PIT::ms_since_boot / 10) % 255;
|
|
renderer.paint_rect(0, 200, 10, 10, Color{blue, 0x00, 0x00, 0xFF});
|
|
}
|
|
|
|
void DebugStatus::DebugKey(char key)
|
|
{
|
|
renderer.paint_rect(0, 215, 10, 10, Color{0x00, (uint8_t)key, 0x00, 0xFF});
|
|
}
|
|
|
|
void DebugStatus::ThrowException(int exception)
|
|
{
|
|
uint8_t red = (uint8_t)(exception * 8);
|
|
renderer.paint_rect(errx, erry, 10, 10, Color{0x00, 0x00, red, 0xFF});
|
|
errx += 11;
|
|
}
|
|
|
|
DebugStatus* DebugStatus::the()
|
|
{
|
|
return &s_main;
|
|
}
|
|
}
|
|
|
|
#pragma GCC diagnostic pop |