Integrate all the progress into master #6

Merged
jaby merged 595 commits from ToolBox into main 2025-01-01 13:17:44 +00:00
4 changed files with 31 additions and 21 deletions
Showing only changes of commit 053dbd3f90 - Show all commits

View File

@ -1,5 +1,6 @@
#ifndef BOOT_LOADER_HPP
#define BOOT_LOADER_HPP
#include "color_debug.hpp"
#include <PSX/jabyengine.hpp>
namespace JabyEngine {

View File

@ -3,20 +3,12 @@
#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_color_at(color, x, y, scale) { \
::JabyEngine::GPU::internal::quick_fill_fast(color, {{64*x, 64*y}, {static_cast<uint16_t>(64*scale), static_cast<uint16_t>(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__)
}

View File

@ -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?

View File

@ -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 <PSX/System/IOPorts/dma_io.hpp>
#include <stdio.h>
@ -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();
}