More and more bugs

This commit is contained in:
Jaby 2024-06-10 07:17:54 +02:00
parent 52cdd4dbc0
commit 8604ebf8d4
5 changed files with 25 additions and 1 deletions

View File

@ -221,6 +221,9 @@ namespace LoadingScene {
} }
void main() { void main() {
printf("Hello Plaschi\n");
CDXA::planschi();
printf("Bye Bye Planschi\n");
setup(); setup();
while(true) { while(true) {

View File

@ -10,5 +10,7 @@ namespace JabyEngine {
void push_play(); void push_play();
void pop_play(); void pop_play();
void planschi();
} }
} }

View File

@ -20,6 +20,7 @@ namespace JabyEngine {
extern State current_state; extern State current_state;
extern volatile uint8_t cmd_interrupt_bit; extern volatile uint8_t cmd_interrupt_bit;
extern uint8_t last_cmd;
struct Command { struct Command {
struct Internal { struct Internal {
@ -36,6 +37,10 @@ namespace JabyEngine {
} while(cur_irq == CD_IO::Interrupt::None); } while(cur_irq == CD_IO::Interrupt::None);
cur_irq = CD_IO::Interrupt::get_type(CD_IO::PortIndex1::InterruptFlag); 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); CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag);
cmd_interrupt_bit = bit::set(cmd_interrupt_bit, cur_irq); cmd_interrupt_bit = bit::set(cmd_interrupt_bit, cur_irq);
return cur_irq; return cur_irq;
@ -97,6 +102,7 @@ namespace JabyEngine {
BCDTimeStamp get_loc(); BCDTimeStamp get_loc();
void enable_CD();
void enable_CDDA(); void enable_CDDA();
void enable_CDXA(bool double_speed); void enable_CDXA(bool double_speed);

View File

@ -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::SetLoc, setting.last_loc.min, setting.last_loc.sec, setting.last_loc.sector);
CD::Command::send_wait(CD_IO::Command::ReadS); 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);
}
}
} }
} }

View File

@ -194,6 +194,11 @@ namespace JabyEngine {
return BCDTimeStamp{min, sec, sectors}; return BCDTimeStamp{min, sec, sectors};
} }
void enable_CD() {
CD_IO::PortIndex0::change_to();
Command::send_wait(CD_IO::Command::SetMode, DataSectorMode);
}
void enable_CDDA() { void enable_CDDA() {
CD_IO::PortIndex0::change_to(); CD_IO::PortIndex0::change_to();
Command::send_wait(CD_IO::Command::SetMode, AudioSectorMode); Command::send_wait(CD_IO::Command::SetMode, AudioSectorMode);
@ -205,9 +210,9 @@ namespace JabyEngine {
const uint8_t mode = XAAudioSectorMode.raw | (double_speed ? DoubleSpeedBit : SingleSpeedBit); const uint8_t mode = XAAudioSectorMode.raw | (double_speed ? DoubleSpeedBit : SingleSpeedBit);
current_state = State::XAMode;
CD_IO::PortIndex0::change_to(); CD_IO::PortIndex0::change_to();
Command::send_wait(CD_IO::Command::SetMode, mode); Command::send_wait(CD_IO::Command::SetMode, mode);
current_state = State::XAMode;
} }
} }
} }