# HG changeset patch # User Michael Pavone # Date 1459306654 25200 # Node ID a9364f5ee81a25d971dd415c1d837a208ca41a3b # Parent 04fc17376999efb5b825f6438e5fb3b58e3abe33 Fix timing of port IO diff -r 04fc17376999 -r a9364f5ee81a src/cpu.c --- 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);