diff --git a/examples/PoolBox/application/src/application.cpp b/examples/PoolBox/application/src/application.cpp index 8db4687a..a3ef5960 100644 --- a/examples/PoolBox/application/src/application.cpp +++ b/examples/PoolBox/application/src/application.cpp @@ -221,6 +221,9 @@ namespace LoadingScene { } void main() { + printf("Hello Plaschi\n"); + CDXA::planschi(); + printf("Bye Bye Planschi\n"); setup(); while(true) { diff --git a/include/PSX/Audio/CDXA.hpp b/include/PSX/Audio/CDXA.hpp index d4506b5d..23bdab77 100644 --- a/include/PSX/Audio/CDXA.hpp +++ b/include/PSX/Audio/CDXA.hpp @@ -10,5 +10,7 @@ namespace JabyEngine { void push_play(); void pop_play(); + + void planschi(); } } \ No newline at end of file diff --git a/src/Library/internal-include/CD/cd_internal.hpp b/src/Library/internal-include/CD/cd_internal.hpp index ee092b6e..83d61dfc 100644 --- a/src/Library/internal-include/CD/cd_internal.hpp +++ b/src/Library/internal-include/CD/cd_internal.hpp @@ -20,6 +20,7 @@ namespace JabyEngine { extern State current_state; extern volatile uint8_t cmd_interrupt_bit; + extern uint8_t last_cmd; struct Command { struct Internal { @@ -36,6 +37,10 @@ namespace JabyEngine { } while(cur_irq == CD_IO::Interrupt::None); cur_irq = CD_IO::Interrupt::get_type(CD_IO::PortIndex1::InterruptFlag); + if(cur_irq == CD_IO::Interrupt::DataReady) { + printf("Wopsie!\n"); + } + CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag); cmd_interrupt_bit = bit::set(cmd_interrupt_bit, cur_irq); return cur_irq; @@ -97,6 +102,7 @@ namespace JabyEngine { BCDTimeStamp get_loc(); + void enable_CD(); void enable_CDDA(); void enable_CDXA(bool double_speed); diff --git a/src/Library/src/Audio/CDXA.cpp b/src/Library/src/Audio/CDXA.cpp index 6af080e7..bf8f37d7 100644 --- a/src/Library/src/Audio/CDXA.cpp +++ b/src/Library/src/Audio/CDXA.cpp @@ -68,5 +68,13 @@ namespace JabyEngine { CD::Command::send_wait(CD_IO::Command::SetLoc, setting.last_loc.min, setting.last_loc.sec, setting.last_loc.sector); CD::Command::send_wait(CD_IO::Command::ReadS); } + + void planschi() { + for(size_t n = 0; n < 100; n++) { + CD::enable_CD(); + CD::enable_CDXA(false); + printf("%i\n", n); + } + } } } \ No newline at end of file diff --git a/src/Library/src/CD/cd.cpp b/src/Library/src/CD/cd.cpp index b295258e..f0eef7aa 100644 --- a/src/Library/src/CD/cd.cpp +++ b/src/Library/src/CD/cd.cpp @@ -194,6 +194,11 @@ namespace JabyEngine { return BCDTimeStamp{min, sec, sectors}; } + void enable_CD() { + CD_IO::PortIndex0::change_to(); + Command::send_wait(CD_IO::Command::SetMode, DataSectorMode); + } + void enable_CDDA() { CD_IO::PortIndex0::change_to(); Command::send_wait(CD_IO::Command::SetMode, AudioSectorMode); @@ -205,9 +210,9 @@ namespace JabyEngine { const uint8_t mode = XAAudioSectorMode.raw | (double_speed ? DoubleSpeedBit : SingleSpeedBit); - current_state = State::XAMode; CD_IO::PortIndex0::change_to(); Command::send_wait(CD_IO::Command::SetMode, mode); + current_state = State::XAMode; } } }