Integrate all the progress into master #6

Merged
jaby merged 595 commits from ToolBox into main 2025-01-01 13:17:44 +00:00
9 changed files with 18 additions and 24 deletions
Showing only changes of commit 3eb2cc350f - Show all commits

View File

@ -2,7 +2,7 @@
#include "syscalls.hpp"
namespace JabyEngine {
namespace Callback {
namespace [[deprecated("Callbacks are deprecated for now")]] Callback {
struct VSyncCallback {
using Function = void (*)();

View File

@ -8,7 +8,7 @@ namespace JabyEngine {
void identify();
}
namespace Callbacks {
namespace [[deprecated("Callbacks are deprecated for now")]] Callbacks {
void setup();
}

View File

@ -26,9 +26,13 @@ namespace JabyEngine {
};
namespace internal {
struct XASectorHeader {
struct RawXADataSector {
Header header;
SubHeader sub_header;
SubHeader copy_sub_header;
uint8_t data[0x800];
uint32_t edc;
uint8_t ecc[0x114];
};
class SectorBufferAllocator {

View File

@ -2,7 +2,7 @@
#include <PSX/System/threads.hpp>
namespace JabyEngine {
namespace Callback {
namespace [[deprecated("Callbacks are deprecated for now")]] Callback {
namespace internal {
namespace VSync {
static constexpr size_t StackSize = 64;

View File

@ -47,7 +47,7 @@ namespace JabyEngine {
static constexpr auto DebugScale = 1.0;
BIOS::identify();
Callbacks::setup();
//Callbacks::setup();
__debug_boot_color_at(::JabyEngine::GPU::Color24::Grey(), DebugX, DebugY, DebugScale);
DMA::setup();

View File

@ -6,7 +6,7 @@
namespace JabyEngine {
namespace CD {
namespace internal {
namespace internal {
union Configuration {
struct File {
uint32_t cur_lba;
@ -88,9 +88,6 @@ namespace JabyEngine {
static void read_sector_to(uint32_t* dst, size_t bytes) {
CD_IO::PortIndex0::Request.write(CD_IO::Request::want_data());
CD_IO::PortIndex1::change_to();
CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag);
CD_IO::PortIndex0::change_to();
// We only support DMA rn
read_sector_dma(dst, bytes);
@ -100,7 +97,6 @@ namespace JabyEngine {
}
static void resume_at(const CDTimeStamp& cd_time) {
CD_IO::PortIndex0::change_to();
Command::send<CD_IO::PortIndex0>(CD_IO::Command::SetLoc, cd_time.get_min_cd(), cd_time.get_sec_cd(), cd_time.get_sector_cd());
CD_IO::PortIndex1::change_to();
@ -127,6 +123,7 @@ namespace JabyEngine {
CD_IO::PortIndex1::change_to();
const auto cur_irq = CD_IO::Interrupt::get_type(CD_IO::PortIndex1::InterruptFlag);
CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag);
CD_IO::PortIndex0::change_to();
cmd_interrupt_bit = bit::clear(cmd_interrupt_bit, cur_irq);
@ -144,8 +141,6 @@ namespace JabyEngine {
current_state = State::Done;
pause();
}
goto skip_ack;
}
else {
@ -169,14 +164,14 @@ namespace JabyEngine {
else {
switch(cur_irq) {
case CD_IO::Interrupt::DataReady: {
XASectorHeader xa_file;
// The IRQ stack is 0x1000 bytes large so this should fit
RawXADataSector xa_file;
read_sector_to(reinterpret_cast<uint32_t*>(&xa_file), sizeof(XASectorHeader));
read_sector_to(reinterpret_cast<uint32_t*>(&xa_file), sizeof(RawXADataSector));
if(cur_cfg.xa.channel == xa_file.sub_header.channel_number) {
resume_at(cur_cfg.xa.start_time);
Command::send<CD_IO::PortIndex0>(CD_IO::Command::ReadS);
}
goto skip_ack;
} break;
case CD_IO::Interrupt::DiskError: {
@ -184,15 +179,11 @@ namespace JabyEngine {
} break;
};
}
CD_IO::PortIndex1::change_to();
CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag);
skip_ack:
CD_IO::PortIndex0::change_to();
// No masking required because we can only write bit 0 - 2
CD_IO::IndexStatus.write(old_status);
Interrupt::ack_irq(Interrupt::CDROM);
SysCall::ReturnFromException();
__builtin_unreachable();
}

View File

@ -1,5 +1,4 @@
#include "../../internal-include/GPU/gpu_internal.hpp"
#include "../../internal-include/System/callbacks_internal.hpp"
#include <PSX/Timer/frame_timer.hpp>
#include <PSX/System/IOPorts/interrupt_io.hpp>
#include <PSX/System/syscalls.hpp>
@ -41,7 +40,8 @@ namespace JabyEngine {
MasterTime::value++;
Interrupt::ack_irq(Interrupt::VBlank);
Callback::internal::VSync::execute();
//Callback::internal::VSync::execute();
SysCall::ReturnFromException();
__builtin_unreachable();
}

View File

@ -1,8 +1,6 @@
#include "../../internal-include/System/callbacks_internal.hpp"
cody marked this conversation as resolved
Review

Is this needed?

Is this needed?
#include <PSX/System/callbacks.hpp>
#include <stdio.hpp>
namespace JabyEngine {
namespace Callback {
VSyncCallback::Function VSyncCallback :: callback = nullptr;
@ -17,6 +15,7 @@ namespace JabyEngine {
if(VSyncCallback::callback) {
VSyncCallback::callback();
}
SysCall::EnterCriticalSection();
MainThread::restore();
}
}