summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-06-15 23:50:59 -0700
committerMike Pavone <pavone@retrodev.com>2013-06-15 23:50:59 -0700
commit4f485a73fea7918ce60bc842da5de0120934a6c4 (patch)
treec878901883161b1b6bac2217e944e70e74a33214
parent60dc4ba96b86eaac9f24440ba3b4ca7fd7144f50 (diff)
Assert z80 interrupt longer so that they are not missed when they should not be
-rw-r--r--blastem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/blastem.c b/blastem.c
index 42d3479..77daaf3 100644
--- a/blastem.c
+++ b/blastem.c
@@ -170,6 +170,8 @@ uint8_t new_busack = 0;
#define dputs
#endif
+#define Z80_VINT_DURATION 128
+
void sync_z80(z80_context * z_context, uint32_t mclks)
{
if (z80_enabled && !reset && !busreq) {
@@ -181,7 +183,7 @@ void sync_z80(z80_context * z_context, uint32_t mclks)
z_context->sync_cycle = mclks / MCLKS_PER_Z80;
uint32_t vint_cycle = vdp_next_vint_z80(gen->vdp) / MCLKS_PER_Z80;
while (z_context->current_cycle < z_context->sync_cycle) {
- if (z_context->iff1 && z_context->current_cycle < vint_cycle) {
+ if (z_context->iff1 && z_context->current_cycle < (vint_cycle + Z80_VINT_DURATION)) {
z_context->int_cycle = vint_cycle < z_context->int_enable_cycle ? z_context->int_enable_cycle : vint_cycle;
}
z_context->target_cycle = z_context->sync_cycle < z_context->int_cycle ? z_context->sync_cycle : z_context->int_cycle;