# HG changeset patch # User Michael Pavone # Date 1420345215 28800 # Node ID 18ef3b61e70b4c87b35811f97c55e448f5c0274d # Parent 8ad39a2b0bce859b72e639a8bbfe7e64a0586d40 Restore emulation of Z80 being locked out of the 68K bus during DMA and the like diff -r 8ad39a2b0bce -r 18ef3b61e70b blastem.c --- a/blastem.c Sat Jan 03 20:13:51 2015 -0800 +++ b/blastem.c Sat Jan 03 20:20:15 2015 -0800 @@ -666,12 +666,15 @@ uint8_t z80_read_bank(uint32_t location, void * vcontext) { z80_context * context = vcontext; + genesis_context *gen = context->system; + if (gen->bus_busy) { + context->current_cycle = context->sync_cycle; + } //typical delay from bus arbitration context->current_cycle += 3 * MCLKS_PER_Z80; + //TODO: add cycle for an access right after a previous one location &= 0x7FFF; - //TODO: add cycle for an access right after a previous one - //TODO: block Z80 if VDP has the bus or the 68K is blocked on a VDP access if (context->mem_pointers[1]) { return context->mem_pointers[1][location ^ 1]; } @@ -687,11 +690,15 @@ void *z80_write_bank(uint32_t location, void * vcontext, uint8_t value) { z80_context * context = vcontext; + genesis_context *gen = context->system; + if (gen->bus_busy) { + context->current_cycle = context->sync_cycle; + } //typical delay from bus arbitration context->current_cycle += 3 * MCLKS_PER_Z80; + //TODO: add cycle for an access right after a previous one + location &= 0x7FFF; - //TODO: add cycle for an access right after a previous one - //TODO: block Z80 if VDP has the bus or the 68K is blocked on a VDP access uint32_t address = context->bank_reg << 15 | location; if (address >= 0xE00000) { address &= 0xFFFF;