Implement color based debugging

This commit is contained in:
Jaby Blubb 2023-09-22 21:36:43 +02:00
parent 283878d5bc
commit c19729ce23
2 changed files with 31 additions and 4 deletions

View File

@ -0,0 +1,22 @@
#pragma once
#include "../GPU/gpu_internal.hpp"
#include <stdio.h>
namespace JabyEngine {
#define __debug_boot_color_at(color, diag) { \
::JabyEngine::GPU::internal::quick_fill_fast(color, {{diag*64, diag*64}, {64, 64}}); \
}
#define __debug_boot_print_at(color, diag, ...) { \
__debug_boot_color_at(color, diag); \
printf(__VA_ARGS__); \
}
#define __debug_boot_color0(color) __debug_boot_color_at(color, 0)
#define __debug_boot_color1(color) __debug_boot_color_at(color, 1)
#define __debug_boot_color2(color) __debug_boot_color_at(color, 2)
#define __debug_boot_print0(color, ...) __debug_boot_print_at(color, 0, __VA_ARGS__)
#define __debug_boot_print1(color, ...) __debug_boot_print_at(color, 1, __VA_ARGS__)
#define __debug_boot_print2(color, ...) __debug_boot_print_at(color, 2, __VA_ARGS__)
}

View File

@ -1,4 +1,5 @@
#include "../../internal-include/BootLoader/boot_loader.hpp"
#include "../../internal-include/BootLoader/color_debug.hpp"
#include "../../internal-include/GPU/gpu_internal.hpp"
#include <PSX/System/IOPorts/dma_io.hpp>
#include <stdio.h>
@ -18,13 +19,18 @@ namespace JabyEngine {
}
static void setup() {
__debug_boot_color1(::JabyEngine::GPU::Color24::White());
enable_DMA();
__debug_boot_color1(::JabyEngine::GPU::Color24::Red());
SPU::stop_voices();
__debug_boot_color1(::JabyEngine::GPU::Color24::Green());
CD::setup();
__debug_boot_color1(::JabyEngine::GPU::Color24::Blue());
Timer::setup();
__debug_boot_color1(::JabyEngine::GPU::Color24::Yellow());
GPU::setup();
GPU::display_logo();
@ -33,15 +39,14 @@ namespace JabyEngine {
}
}
}
void start() {
printf("Starting Planschbecken\n");
__debug_boot_print0(GPU::Color24::White(), "Starting Planschbecken\n");
printf("Heap starts @0x%p\n", &__heap_start);
printf("BSS from 0x%p to 0x%p (%u)\n", &__bss_start, &__bss_end, __bss_len);
printf("PLANSCHI from 0x%p to 0x%p\n", &__planschi_start, &__planschi_end);
__debug_boot_print0(GPU::Color24::Green(), "PLANSCHI from 0x%p to 0x%p\n", &__planschi_start, &__planschi_end);
boot::Start::setup();
printf("Running main...\n");
__debug_boot_print0(GPU::Color24::Red(), "Running main...\n");
GPU::internal::wait_vsync(0);
run();
}