summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-12-27 13:59:01 -0800
committerMichael Pavone <pavone@retrodev.com>2016-12-27 13:59:01 -0800
commit757e3fc06a32641c1077a6023a46e4ff41245b66 (patch)
tree6ae6df4b2295934b741c1daa3b18854753b8f53f
parent4985c875c2548682fcf3bc31663ec8e8515750d1 (diff)
Clear interrupt status flags after getting the status register value rather than before
-rw-r--r--sms.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sms.c b/sms.c
index 9ca96d6..5e3b9a9 100644
--- a/sms.c
+++ b/sms.c
@@ -56,9 +56,10 @@ static uint8_t vdp_read(uint32_t location, void *vcontext)
sms_context *sms = z80->system;
vdp_run_context(sms->vdp, z80->current_cycle);
if (location & 1) {
+ uint8_t ret = vdp_control_port_read(sms->vdp);
sms->vdp->flags2 &= ~(FLAG2_VINT_PENDING|FLAG2_HINT_PENDING);
update_interrupts(sms);
- return vdp_control_port_read(sms->vdp);
+ return ret;
} else {
return vdp_data_port_read(sms->vdp);
}