summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-09-18 19:10:54 -0700
committerMike Pavone <pavone@retrodev.com>2013-09-18 19:10:54 -0700
commit5830e5828c4680aafe27210935dd3fed9ece0448 (patch)
tree32c4ca3e1e625b29babb8585165110ab9250282e
parentb5767c17b138cfb9b264dbc9cad38252cdd2731c (diff)
Theoretically more correct timing of Z80 bus request
-rw-r--r--blastem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/blastem.c b/blastem.c
index 6c2bdb1..1b5e138 100644
--- a/blastem.c
+++ b/blastem.c
@@ -517,7 +517,6 @@ m68k_context * io_write(uint32_t location, m68k_context * context, uint8_t value
}
} else {
if (location == 0x1100) {
- sync_z80(gen->z80, context->current_cycle * MCLKS_PER_68K);
if (busack_cycle <= context->current_cycle) {
busack = new_busack;
busack_cycle = CYCLE_NEVER;
@@ -526,11 +525,13 @@ m68k_context * io_write(uint32_t location, m68k_context * context, uint8_t value
dputs("bus requesting Z80");
if(!reset && !busreq) {
- busack_cycle = ((gen->z80->current_cycle + Z80_ACK_DELAY) * MCLKS_PER_Z80) / MCLKS_PER_68K;//context->current_cycle + Z80_ACK_DELAY;
+ sync_z80(gen->z80, context->current_cycle * MCLKS_PER_68K + Z80_ACK_DELAY*MCLKS_PER_Z80);
+ busack_cycle = (gen->z80->current_cycle * MCLKS_PER_Z80) / MCLKS_PER_68K;//context->current_cycle + Z80_ACK_DELAY;
new_busack = Z80_REQ_ACK;
}
busreq = 1;
} else {
+ sync_z80(gen->z80, context->current_cycle * MCLKS_PER_68K);
if (busreq) {
dputs("releasing z80 bus");
#ifdef DO_DEBUG_PRINT