scaffolding for framebuffer functions

This commit is contained in:
Lukas Höppner
2026-08-12 22:44:54 +02:00
parent 84ba0a609a
commit 7c87a38a6a
9 changed files with 384 additions and 113 deletions
+13 -9
View File
@@ -23,8 +23,8 @@
volatile bool is_initialized = false;
volatile bool shutdown_requested = false;
static nova64_io_interface_t g_io_interface_storage;
static const nova64_io_interface_t *g_io_interface = NULL;
static const nova64_io_interface_t *nova64_io_interface = NULL;
static const nova64_ppu_interface_t *nova64_ppu_interface = NULL;
static QueueHandle_t event_queue = NULL;
static TaskHandle_t heartbeat_task_handle = NULL;
@@ -72,8 +72,8 @@ void nova64_log(const char *format, ...) {
log_lock();
if (g_io_interface && g_io_interface->log_message) {
g_io_interface->log_message(buffer);
if (nova64_io_interface && nova64_io_interface->log_message) {
nova64_io_interface->log_message(buffer);
} else {
fputs(buffer, stdout);
fflush(stdout);
@@ -134,16 +134,20 @@ void start_heartbeat_task(void) {
}
const nova64_io_interface_t *nova64_get_io_interface(void) {
return g_io_interface;
return nova64_io_interface;
}
NOVA64_API bool nova64_init(const nova64_io_interface_t *io_interface) {
if (is_initialized || io_interface == NULL) {
const nova64_ppu_interface_t *nova64_get_ppu_interface(void) {
return nova64_ppu_interface;
}
NOVA64_API bool nova64_init(const nova64_io_interface_t *io_interface, const nova64_ppu_interface_t *ppu_interface) {
if (is_initialized || io_interface == NULL || ppu_interface == NULL) {
return false;
}
g_io_interface_storage = *io_interface;
g_io_interface = &g_io_interface_storage;
nova64_io_interface = io_interface;
nova64_ppu_interface = ppu_interface;
nova64_log("System Initializing...\n");
+4 -5
View File
@@ -84,11 +84,10 @@ void nova64_framebuffer_swap(void) {
}
void nova64_framebuffer_clear(pixel_t color) {
uint32_t *p32 = (uint32_t *)nova64_framebuffer.back_buffer;
uint32_t color32 = ((uint32_t)color << 16) | color;
size_t count32 = NOVA64_DISPLAY_PIXELS / 2;
const nova64_ppu_interface_t *ppu = nova64_get_ppu_interface();
for (size_t i = 0; i < count32; i++) {
p32[i] = color32;
if (ppu && ppu->fill_rect) {
ppu->fill_rect(nova64_framebuffer.back_buffer, NOVA64_DISPLAY_WIDTH, 0, 0,
NOVA64_DISPLAY_WIDTH, NOVA64_DISPLAY_HEIGHT, color);
}
}