From c926e76afc2059d7d58b9994126fcd2289ec09eb Mon Sep 17 00:00:00 2001 From: Jaby Date: Fri, 22 Sep 2023 21:51:24 +0200 Subject: [PATCH] Locate XEBRA freeze --- .../BootLoader/boot_loader.hpp | 1 + .../BootLoader/color_debug.hpp | 16 +++--------- src/Library/src/BootLoader/cd_boot.cpp | 10 ++++++++ src/Library/src/BootLoader/start_boot.cpp | 25 ++++++++++++------- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/Library/internal-include/BootLoader/boot_loader.hpp b/src/Library/internal-include/BootLoader/boot_loader.hpp index 888c1b54..6290445c 100644 --- a/src/Library/internal-include/BootLoader/boot_loader.hpp +++ b/src/Library/internal-include/BootLoader/boot_loader.hpp @@ -1,5 +1,6 @@ #ifndef BOOT_LOADER_HPP #define BOOT_LOADER_HPP +#include "color_debug.hpp" #include namespace JabyEngine { diff --git a/src/Library/internal-include/BootLoader/color_debug.hpp b/src/Library/internal-include/BootLoader/color_debug.hpp index d4d63fa8..14f52593 100644 --- a/src/Library/internal-include/BootLoader/color_debug.hpp +++ b/src/Library/internal-include/BootLoader/color_debug.hpp @@ -3,20 +3,12 @@ #include 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_color_at(color, x, y, scale) { \ + ::JabyEngine::GPU::internal::quick_fill_fast(color, {{64*x, 64*y}, {static_cast(64*scale), static_cast(64*scale)}}); \ } - #define __debug_boot_print_at(color, diag, ...) { \ - __debug_boot_color_at(color, diag); \ + #define __debug_boot_print_at(color, x, y, scale, ...) { \ + __debug_boot_color_at(color, x, y, scale); \ 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__) } \ No newline at end of file diff --git a/src/Library/src/BootLoader/cd_boot.cpp b/src/Library/src/BootLoader/cd_boot.cpp index 00168569..ef78618b 100644 --- a/src/Library/src/BootLoader/cd_boot.cpp +++ b/src/Library/src/BootLoader/cd_boot.cpp @@ -16,6 +16,11 @@ namespace JabyEngine { using JabyEngine::CD::internal::Command; void setup() { + static constexpr auto DebugX = 1; + static constexpr auto DebugY = 1; + static constexpr auto DebugScale = 1.0; + + __debug_boot_color_at(::JabyEngine::GPU::Color24::White(), DebugX, DebugY, DebugScale); __syscall_EnterCriticalSection(); Memory_IO::COM_DELAY.write(Memory_IO::COM_DELAY::create()); Memory_IO::CD_DELAY.write(Memory_IO::CD_DELAY::create()); @@ -24,16 +29,21 @@ namespace JabyEngine { CD_IO::PortIndex1::change_to(); CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag); + CD_IO::Interrupt::enable(CD_IO::PortIndex1::InterruptEnable); Interrupt::enable_irq(Interrupt::CDROM); Interrupt::ack_irq(Interrupt::CDROM); __syscall_ExitCriticalSection(); + __debug_boot_color_at(::JabyEngine::GPU::Color24::Red(), DebugX, DebugY, DebugScale); CD_IO::PortIndex0::change_to(); + __debug_boot_color_at(::JabyEngine::GPU::Color24::Green(), DebugX, DebugY, DebugScale); Command::send_wait(CD_IO::PortIndex0::CommandFifo, CD_IO::PortIndex0::ParameterFifo, CD_IO::Command::GetStat); + __debug_boot_color_at(::JabyEngine::GPU::Color24::Blue(), DebugX, DebugY, DebugScale); Command::send_wait(CD_IO::PortIndex0::CommandFifo, CD_IO::PortIndex0::ParameterFifo, CD_IO::Command::GetStat); + __debug_boot_color_at(::JabyEngine::GPU::Color24::Yellow(), DebugX, DebugY, DebugScale); Command::send_wait(CD_IO::PortIndex0::CommandFifo, CD_IO::PortIndex0::ParameterFifo, CD_IO::Command::Init); // Demute? diff --git a/src/Library/src/BootLoader/start_boot.cpp b/src/Library/src/BootLoader/start_boot.cpp index 074316aa..973dbdd2 100644 --- a/src/Library/src/BootLoader/start_boot.cpp +++ b/src/Library/src/BootLoader/start_boot.cpp @@ -1,5 +1,4 @@ #include "../../internal-include/BootLoader/boot_loader.hpp" -#include "../../internal-include/BootLoader/color_debug.hpp" #include "../../internal-include/GPU/gpu_internal.hpp" #include #include @@ -19,18 +18,22 @@ namespace JabyEngine { } static void setup() { - __debug_boot_color1(::JabyEngine::GPU::Color24::White()); + static constexpr auto DebugX = 1; + static constexpr auto DebugY = 0; + static constexpr auto DebugScale = 1.0; + + __debug_boot_color_at(::JabyEngine::GPU::Color24::White(), DebugX, DebugY, DebugScale); enable_DMA(); - __debug_boot_color1(::JabyEngine::GPU::Color24::Red()); + __debug_boot_color_at(::JabyEngine::GPU::Color24::Red(), DebugX, DebugY, DebugScale); SPU::stop_voices(); - __debug_boot_color1(::JabyEngine::GPU::Color24::Green()); + __debug_boot_color_at(::JabyEngine::GPU::Color24::Green(), DebugX, DebugY, DebugScale); CD::setup(); - __debug_boot_color1(::JabyEngine::GPU::Color24::Blue()); + __debug_boot_color_at(::JabyEngine::GPU::Color24::Blue(), DebugX, DebugY, DebugScale); Timer::setup(); - __debug_boot_color1(::JabyEngine::GPU::Color24::Yellow()); + __debug_boot_color_at(::JabyEngine::GPU::Color24::Yellow(), DebugX, DebugY, DebugScale); GPU::setup(); GPU::display_logo(); @@ -40,13 +43,17 @@ namespace JabyEngine { } } void start() { - __debug_boot_print0(GPU::Color24::White(), "Starting Planschbecken\n"); + static constexpr auto DebugX = 0; + static constexpr auto DebugY = 0; + static constexpr auto DebugScale = 1.0; + + __debug_boot_print_at(GPU::Color24::White(), DebugX, DebugY, DebugScale, "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); - __debug_boot_print0(GPU::Color24::Green(), "PLANSCHI from 0x%p to 0x%p\n", &__planschi_start, &__planschi_end); + __debug_boot_print_at(GPU::Color24::Green(), DebugX, DebugY, DebugScale, "PLANSCHI from 0x%p to 0x%p\n", &__planschi_start, &__planschi_end); boot::Start::setup(); - __debug_boot_print0(GPU::Color24::Red(), "Running main...\n"); + __debug_boot_print_at(GPU::Color24::Red(), DebugX, DebugY, DebugScale, "Running main...\n"); GPU::internal::wait_vsync(0); run(); }