summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-08-22 09:46:18 -0700
committerMichael Pavone <pavone@retrodev.com>2016-08-22 09:46:18 -0700
commit4a56a7e2dfe615e03e81e29952003291090470fe (patch)
treee2a7fc9bc4d4188f934d8dcd80afba0ec278c8a7 /io.c
parent00c00b816bac8f05e49f4733ecbedd363b0b8da2 (diff)
Cleanup the separation of render backend and VDP code in preparation for having extra debug windows. Make determination of H40/H32 based on number of lines in each mode.
Diffstat (limited to 'io.c')
-rw-r--r--io.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/io.c b/io.c
index 30783a9..acab08f 100644
--- a/io.c
+++ b/io.c
@@ -21,6 +21,7 @@
#include "util.h"
#define CYCLE_NEVER 0xFFFFFFFF
+#define MIN_POLL_INTERVAL 6840
const char * device_type_names[] = {
"3-button gamepad",
@@ -1146,6 +1147,7 @@ void mouse_check_ready(io_port *port, uint32_t current_cycle)
}
}
+uint32_t last_poll_cycle;
void io_adjust_cycles(io_port * port, uint32_t current_cycle, uint32_t deduction)
{
/*uint8_t control = pad->control | 0x80;
@@ -1167,6 +1169,11 @@ void io_adjust_cycles(io_port * port, uint32_t current_cycle, uint32_t deduction
port->device.mouse.ready_cycle -= deduction;
}
}
+ if (last_poll_cycle >= deduction) {
+ last_poll_cycle -= deduction;
+ } else {
+ last_poll_cycle = 0;
+ }
}
#ifndef _WIN32
@@ -1345,6 +1352,10 @@ uint8_t io_data_read(io_port * port, uint32_t current_cycle)
uint8_t output = (control & port->output) | (~control & 0xFF);
uint8_t th = output & 0x40;
uint8_t input;
+ if (current_cycle - last_poll_cycle > MIN_POLL_INTERVAL) {
+ process_events();
+ last_poll_cycle = current_cycle;
+ }
switch (port->device_type)
{
case IO_GAMEPAD3: