Integrate all the progress into master #6

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

View File

@ -63,7 +63,6 @@ namespace JabyEngine {
void enable_CDXA(bool double_speed);
static void pause() {
CD_IO::PortIndex0::change_to();
Command::send<CD_IO::PortIndex0>(CD_IO::Command::Pause);
}
}

View File

@ -29,8 +29,6 @@ namespace JabyEngine {
struct XASectorHeader {
Header header;
SubHeader sub_header;
SubHeader copy_subheader;
uint32_t part_data;
};
class SectorBufferAllocator {

View File

@ -87,8 +87,10 @@ namespace JabyEngine {
}
static void read_sector_to(uint32_t* dst, size_t bytes) {
CD_IO::PortIndex0::change_to();
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);
@ -125,7 +127,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);
@ -142,6 +144,8 @@ namespace JabyEngine {
current_state = State::Done;
pause();
}
goto skip_ack;
}
else {
@ -172,6 +176,7 @@ namespace JabyEngine {
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: {
@ -179,6 +184,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);
@ -193,7 +203,6 @@ namespace JabyEngine {
sector_allocator = buffer_allocator;
Command::wait_completed();
CD_IO::PortIndex0::change_to();
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetMode, DataSectorMode);
send_read_n(cur_cfg.file.cur_lba);
@ -235,7 +244,6 @@ namespace JabyEngine {
void enable_CDDA() {
Command::wait_completed();
CD_IO::PortIndex0::change_to();
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetMode, AudioSectorMode);
}
@ -246,7 +254,6 @@ namespace JabyEngine {
const uint8_t mode = XAAudioSectorMode.raw | (double_speed ? DoubleSpeedBit : SingleSpeedBit);
Command::wait_completed();
CD_IO::PortIndex0::change_to();
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetMode, mode);
}
}