From 75a4a4e444e9573eedc4f2b02dc1f1193a137137 Mon Sep 17 00:00:00 2001 From: Jaby Date: Tue, 6 Feb 2024 22:21:44 -0500 Subject: [PATCH] Collect information for future work --- .../Overlay/ScreenCenter/include/frame.hpp | 2 + examples/PoolBox/iso/Config.xml | 1 + .../PSX/GPU/Primitives/linked_elements.hpp | 3 + .../BootLoader/color_debug.hpp | 2 +- .../BootLoader/BIOSFont/bios_font_types.hpp | 1 + src/Library/src/BootLoader/start_boot.cpp | 76 +++++++++---------- 6 files changed, 46 insertions(+), 39 deletions(-) diff --git a/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp b/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp index 1de7b08b..3ba02d37 100644 --- a/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp +++ b/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp @@ -5,6 +5,8 @@ namespace ScreenCenter { using namespace JabyEngine; + // TODO: Fit these pieces into 16Word buffers (sizeof(T) >> 2 == words) + // TODO: Can we DMA all of this? class Frame : public GPU::internal::LinkedElementCreator { private: GPU::TILE top_left[2]; diff --git a/examples/PoolBox/iso/Config.xml b/examples/PoolBox/iso/Config.xml index f34eb2b7..c4fe8644 100644 --- a/examples/PoolBox/iso/Config.xml +++ b/examples/PoolBox/iso/Config.xml @@ -1,6 +1,7 @@ Jaby + %PSX_LICENSE_PATH%/LICENSEE.DAT diff --git a/include/PSX/GPU/Primitives/linked_elements.hpp b/include/PSX/GPU/Primitives/linked_elements.hpp index 360f9df9..1e52a3c0 100644 --- a/include/PSX/GPU/Primitives/linked_elements.hpp +++ b/include/PSX/GPU/Primitives/linked_elements.hpp @@ -76,6 +76,9 @@ namespace JabyEngine { constexpr T* operator->() { return &this->element; } + + // TODO: Remove this magic number? + //static_assert((sizeof(T) >> 2) <= 16); }; namespace internal { diff --git a/src/Library/internal-include/BootLoader/color_debug.hpp b/src/Library/internal-include/BootLoader/color_debug.hpp index 28674adf..1c3f780f 100644 --- a/src/Library/internal-include/BootLoader/color_debug.hpp +++ b/src/Library/internal-include/BootLoader/color_debug.hpp @@ -16,7 +16,7 @@ namespace JabyEngine { #ifdef __USE_DEBUG_COLOR__ #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)}}); \ + ::JabyEngine::GPU::internal::quick_fill_fast(color, ::JabyEngine::GPU::AreaU16::create(64*x, 64*y, static_cast(64*scale), static_cast(64*scale))); \ } #define __debug_boot_print_at(color, x, y, scale, ...) { \ diff --git a/src/Library/src/BootLoader/BIOSFont/bios_font_types.hpp b/src/Library/src/BootLoader/BIOSFont/bios_font_types.hpp index efd3b8ec..6e4c6cfa 100644 --- a/src/Library/src/BootLoader/BIOSFont/bios_font_types.hpp +++ b/src/Library/src/BootLoader/BIOSFont/bios_font_types.hpp @@ -30,6 +30,7 @@ namespace JabyEngine { }; // Letters are actually only 16x15 but should be treated 16x16 + // TODO: DMA this? struct Letter : public GPU::internal::LinkedElementCreator { CPU2VRAM cmd; Line lines[BIOS_Font::Size.height - 1]; diff --git a/src/Library/src/BootLoader/start_boot.cpp b/src/Library/src/BootLoader/start_boot.cpp index 0ea5a5cf..9ad0bf2f 100644 --- a/src/Library/src/BootLoader/start_boot.cpp +++ b/src/Library/src/BootLoader/start_boot.cpp @@ -16,42 +16,6 @@ extern "C" uint32_t __planschi_start; extern "C" uint32_t __planschi_end; namespace JabyEngine { - namespace boot { - namespace Start { - static void enable_DMA() { - DMA_IO::DPCR.write(DMA_IO::DPCR.read().set(DMA_IO::DPCR::SPUEnable, DMA_IO::DPCR::GPUEnable, DMA_IO::DPCR::CDROMEnable)); - } - - static void setup() { - 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); - Periphery::setup(); - - __debug_boot_color_at(::JabyEngine::GPU::Color24::White(), DebugX, DebugY, DebugScale); - enable_DMA(); - - __debug_boot_color_at(::JabyEngine::GPU::Color24::Red(), DebugX, DebugY, DebugScale); - SPU::stop_voices(); - - __debug_boot_color_at(::JabyEngine::GPU::Color24::Green(), DebugX, DebugY, DebugScale); - CD::setup(); - __debug_boot_color_at(::JabyEngine::GPU::Color24::Blue(), DebugX, DebugY, DebugScale); - Timer::setup(); - - __debug_boot_color_at(::JabyEngine::GPU::Color24::Yellow(), DebugX, DebugY, DebugScale); - GPU::setup(); - GPU::display_logo(); - GTE::setup(); - - //Pause?? - SPU::setup(); - } - } - } - static void test_bios_font() { static constexpr uint16_t SJIS = 0x83B5; @@ -136,6 +100,44 @@ namespace JabyEngine { printf("---\n"); } } + + namespace boot { + namespace Start { + static void enable_DMA() { + DMA_IO::DPCR.write(DMA_IO::DPCR.read().set(DMA_IO::DPCR::SPUEnable, DMA_IO::DPCR::GPUEnable, DMA_IO::DPCR::CDROMEnable)); + } + + static void setup() { + 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); + Periphery::setup(); + + __debug_boot_color_at(::JabyEngine::GPU::Color24::White(), DebugX, DebugY, DebugScale); + enable_DMA(); + + __debug_boot_color_at(::JabyEngine::GPU::Color24::Red(), DebugX, DebugY, DebugScale); + SPU::stop_voices(); + + __debug_boot_color_at(::JabyEngine::GPU::Color24::Green(), DebugX, DebugY, DebugScale); + CD::setup(); + __debug_boot_color_at(::JabyEngine::GPU::Color24::Blue(), DebugX, DebugY, DebugScale); + Timer::setup(); + + __debug_boot_color_at(::JabyEngine::GPU::Color24::Yellow(), DebugX, DebugY, DebugScale); + GPU::setup(); + GPU::display_logo(); + GTE::setup(); + test_bios_font(); + test_gte(); + + //Pause?? + SPU::setup(); + } + } + } void start() { static constexpr auto DebugX = 0; @@ -145,8 +147,6 @@ namespace JabyEngine { __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); - test_bios_font(); - test_gte(); __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();