Skip to content

Commit

Permalink
md: remove extra bus arbitration delays
Browse files Browse the repository at this point in the history
Commit history shows that these were initially added to get audio working in OverDrive 2, but now it works better without them.

Having these additional delays present caused audio to stop working late in overdrive 2's execution, most likely due to causing extended delays and confusing timing sensitive code.
  • Loading branch information
LukeUsher committed Oct 23, 2023
1 parent 864bc6e commit 02dcc63
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
4 changes: 0 additions & 4 deletions ares/md/apu/bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ auto APU::write(n16 address, n8 data) -> void {
}

auto APU::readExternal(n24 address) -> n8 {
//bus arbiter delay rough approximation (2-5 cycles)
step(4);
while(MegaDrive::bus.acquired() && !scheduler.synchronizing()) step(1);
MegaDrive::bus.acquire(MegaDrive::Bus::APU);

Expand All @@ -56,8 +54,6 @@ auto APU::readExternal(n24 address) -> n8 {
}

auto APU::writeExternal(n24 address, n8 data) -> void {
//bus arbiter delay rough approximation
step(4);
while(MegaDrive::bus.acquired() && !scheduler.synchronizing()) step(1);
MegaDrive::bus.acquire(MegaDrive::Bus::APU);

Expand Down
2 changes: 0 additions & 2 deletions ares/md/bus/inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ alwaysinline auto Bus::read(n1 upper, n1 lower, n24 address, n16 data) -> n16 {

if(address >= 0xa00000 && address <= 0xa0ffff) {
if(!apu.busgrantedCPU()) return data;
if(cpu.active()) cpu.wait(11); //todo: inaccurate approximation of Z80 RAM access delay
address.bit(15) = 0; //a080000-a0ffff mirrors a00000-a07fff
//word reads load the even input byte into both output bytes
auto byte = apu.read(address | !upper); //upper==0 only on odd byte reads
Expand Down Expand Up @@ -94,7 +93,6 @@ alwaysinline auto Bus::write(n1 upper, n1 lower, n24 address, n16 data) -> void

if(address >= 0xa00000 && address <= 0xa0ffff) {
if(!apu.busgrantedCPU()) return;
if(cpu.active()) cpu.wait(11); //todo: inaccurate approximation of Z80 RAM access delay
address.bit(15) = 0; //a08000-a0ffff mirrors a00000-a07fff
//word writes store the upper input byte into the lower output byte
return apu.write(address | !upper, data.byte(upper)); //upper==0 only on odd byte reads
Expand Down

0 comments on commit 02dcc63

Please sign in to comment.