Make music loop

This commit is contained in:
Jaby 2024-05-12 13:45:45 +02:00
parent 02ab2198d0
commit acd4402c56
1 changed files with 16 additions and 16 deletions

View File

@ -210,15 +210,12 @@ int changeThread(int threadId) { return SysCall::changeThreadSubFunction((uint32
printf("EPC: 0x%p; SR: 0x%p\n", get_current_tcb().reg[31], get_current_tcb().sr); while(true);*/ printf("EPC: 0x%p; SR: 0x%p\n", get_current_tcb().reg[31], get_current_tcb().sr); while(true);*/
//SysCall::ReturnFromException(); //SysCall::ReturnFromException();
CD_IO::PortIndex0::change_to(); if(thread != 0) {
Command::send<CD_IO::PortIndex0>(CD_IO::Command::SetLoc, static_cast<uint8_t>(0x0), static_cast<uint8_t>(0x09), static_cast<uint8_t>(0x0)); //changeThread(thread);
printf("About to change...\n");
CD_IO::PortIndex1::change_to(); exec_TCB->entry = reinterpret_cast<TCB*>(&__globals->threads[thread & 0xffff]);
while(CD_IO::Interrupt::get_type(CD_IO::PortIndex1::InterruptFlag) != CD_IO::Interrupt::Acknowledge); printf("Changed!\n");
CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag); }
CD_IO::PortIndex0::change_to();
Command::send<CD_IO::PortIndex0>(CD_IO::Command::Play);
} break; } break;
case CD_IO::Interrupt::DiskError: { case CD_IO::Interrupt::DiskError: {
@ -229,11 +226,8 @@ int changeThread(int threadId) { return SysCall::changeThreadSubFunction((uint32
// No masking required because we can only write bit 0 - 2 // No masking required because we can only write bit 0 - 2
CD_IO::IndexStatus.write(old_status); CD_IO::IndexStatus.write(old_status);
Interrupt::ack_irq(Interrupt::CDROM); Interrupt::ack_irq(Interrupt::CDROM);
Interrupt::enable_irq(Interrupt::CDROM);
if(thread != 0) { printf("RET-E\n");
//changeThread(thread);
exec_TCB->entry = reinterpret_cast<TCB*>(&__globals->threads[thread & 0xffff]);
}
SysCall::ReturnFromException(); SysCall::ReturnFromException();
__builtin_unreachable(); __builtin_unreachable();
} }
@ -257,8 +251,6 @@ int changeThread(int threadId) { return SysCall::changeThreadSubFunction((uint32
} }
} }
void enable_CDDA() { void enable_CDDA() {
if(thread == 0) { if(thread == 0) {
__globals = reinterpret_cast<Globals*>(0x100); __globals = reinterpret_cast<Globals*>(0x100);
@ -271,6 +263,14 @@ int changeThread(int threadId) { return SysCall::changeThreadSubFunction((uint32
printf("Hallo!\n"); printf("Hallo!\n");
printf("Me: 0x%p - 0x%p\n", get_tcb_of_th(thread), &get_current_tcb()); printf("Me: 0x%p - 0x%p\n", get_tcb_of_th(thread), &get_current_tcb());
printf("Blubb!\n");
CD_IO::PortIndex0::change_to();
printf("Schwupp!\n");
Command::send<CD_IO::PortIndex0>(CD_IO::Command::SetLoc, static_cast<uint8_t>(0x0), static_cast<uint8_t>(0x09), static_cast<uint8_t>(0x0));
printf("Mupp\n");
Command::send<CD_IO::PortIndex0>(CD_IO::Command::Play);
printf("Done!!\n");
exec_TCB->entry = mainFlow; exec_TCB->entry = mainFlow;
SysCall::ReturnFromException(); SysCall::ReturnFromException();
//changeThread(0); //changeThread(0);