changeset 20:a9364f5ee81a

Fix timing of port IO
author Michael Pavone <pavone@retrodev.com>
date Tue, 29 Mar 2016 19:57:34 -0700
parents 04fc17376999
children 91ded3b12d96
files src/cpu.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu.c	Mon Mar 28 23:43:31 2016 -0700
+++ b/src/cpu.c	Tue Mar 29 19:57:34 2016 -0700
@@ -100,6 +100,7 @@
 
 uint16_t cpu_read_port(cpu *context, uint8_t port)
 {
+	context->cycles += context->clock_inc;
 	port &= 0xF;
 	if (context->port_handlers[port].read) {
 		return context->port_handlers[port].read(context, port);
@@ -109,6 +110,7 @@
 
 void cpu_write_port(cpu *context, uint8_t port, uint16_t value)
 {
+	context->cycles += context->clock_inc;
 	port &= 0xF;
 	if (context->port_handlers[port].write) {
 		context->port_handlers[port].write(context, port, value);