From b754cde9d4d1f84d621e027dcdcb0cd417486c6a Mon Sep 17 00:00:00 2001 From: Jaby Date: Tue, 2 Jan 2024 16:43:36 -0600 Subject: [PATCH] Setup Periperhy --- include/PSX/System/IOPorts/periphery_io.hpp | 21 +++++++++++++++++++ .../BootLoader/boot_loader.hpp | 4 ++++ src/Library/src/BootLoader/periphery_boot.cpp | 12 +++++++++++ src/Library/src/BootLoader/start_boot.cpp | 3 +++ 4 files changed, 40 insertions(+) create mode 100644 include/PSX/System/IOPorts/periphery_io.hpp create mode 100644 src/Library/src/BootLoader/periphery_boot.cpp diff --git a/include/PSX/System/IOPorts/periphery_io.hpp b/include/PSX/System/IOPorts/periphery_io.hpp new file mode 100644 index 00000000..dc049264 --- /dev/null +++ b/include/PSX/System/IOPorts/periphery_io.hpp @@ -0,0 +1,21 @@ +#pragma once +#include "ioport.hpp" + +namespace JabyEngine { + namespace Periphery_IO { + __declare_io_value(JOY_MODE, uint16_t) { + static constexpr JOY_MODE create() { + return JOY_MODE{0x000D}; + } + }; + + __declare_io_value(JOY_BAUD, uint16_t) { + static constexpr JOY_BAUD create() { + return JOY_BAUD{0x0088}; + } + }; + + __declare_io_port(, JOY_MODE, 0x1F801048); + __declare_io_port(, JOY_BAUD, 0x1F80104E); + } +} \ No newline at end of file diff --git a/src/Library/internal-include/BootLoader/boot_loader.hpp b/src/Library/internal-include/BootLoader/boot_loader.hpp index 4898671b..08170100 100644 --- a/src/Library/internal-include/BootLoader/boot_loader.hpp +++ b/src/Library/internal-include/BootLoader/boot_loader.hpp @@ -21,6 +21,10 @@ namespace JabyEngine { namespace Timer { void setup(); } + + namespace Periphery { + void setup(); + } } void __no_return run(); diff --git a/src/Library/src/BootLoader/periphery_boot.cpp b/src/Library/src/BootLoader/periphery_boot.cpp new file mode 100644 index 00000000..63843cf7 --- /dev/null +++ b/src/Library/src/BootLoader/periphery_boot.cpp @@ -0,0 +1,12 @@ +#include + +namespace JabyEngine { + namespace boot { + namespace Periphery { + void setup() { + Periphery_IO::JOY_MODE.write(Periphery_IO::JOY_MODE::create()); + Periphery_IO::JOY_BAUD.write(Periphery_IO::JOY_BAUD::create()); + } + } + } +} \ No newline at end of file diff --git a/src/Library/src/BootLoader/start_boot.cpp b/src/Library/src/BootLoader/start_boot.cpp index 798815e0..1dcc2641 100644 --- a/src/Library/src/BootLoader/start_boot.cpp +++ b/src/Library/src/BootLoader/start_boot.cpp @@ -24,6 +24,9 @@ namespace JabyEngine { 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();