summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-01-03 20:20:15 -0800
committerMichael Pavone <pavone@retrodev.com>2015-01-03 20:20:15 -0800
commit64168b8e1d6d46e3569d190ea79aa372b5c86fc2 (patch)
tree50c977818df4b19ac16523dabd422b55a34b3683
parentba230802d2dc53066d94a70cc27c0ca6cf1502b6 (diff)
Restore emulation of Z80 being locked out of the 68K bus during DMA and the like
-rw-r--r--blastem.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/blastem.c b/blastem.c
index 3b02567..2c83075 100644
--- a/blastem.c
+++ b/blastem.c
@@ -666,12 +666,15 @@ uint8_t z80_read_ym(uint32_t location, void * vcontext)
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 @@ uint8_t z80_read_bank(uint32_t location, void * vcontext)
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;
- 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
+
+ location &= 0x7FFF;
uint32_t address = context->bank_reg << 15 | location;
if (address >= 0xE00000) {
address &= 0xFFFF;