changeset 2524:25e40370e0e4

Fix some IO port serial mode bugs
author Michael Pavone <pavone@retrodev.com>
date Sat, 26 Oct 2024 14:31:21 -0700
parents 573da2a2e6bb
children 1843adbe9899 90a40be940f7
files genesis.c io.c
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/genesis.c	Thu Oct 24 21:08:10 2024 -0700
+++ b/genesis.c	Sat Oct 26 14:31:21 2024 -0700
@@ -1478,16 +1478,16 @@
 				value = io_rx_read(gen->io.ports + 1, context->cycles);
 				break;
 			case 0xC:
-				value = io_sctrl_read(gen->io.ports, context->cycles);
+				value = io_sctrl_read(gen->io.ports + 1, context->cycles);
 				break;
 			case 0xD:
 				value = gen->io.ports[2].serial_out;
 				break;
 			case 0xE:
-				value = io_rx_read(gen->io.ports + 1, context->cycles);
+				value = io_rx_read(gen->io.ports + 2, context->cycles);
 				break;
 			case 0xF:
-				value = io_sctrl_read(gen->io.ports, context->cycles);
+				value = io_sctrl_read(gen->io.ports + 2, context->cycles);
 				break;
 			default:
 				value = get_open_bus_value(&gen->header) >> 8;
--- a/io.c	Thu Oct 24 21:08:10 2024 -0700
+++ b/io.c	Sat Oct 26 14:31:21 2024 -0700
@@ -1822,9 +1822,7 @@
 
 uint32_t io_next_interrupt(io_port *port, uint32_t current_cycle)
 {
-	if (!(port->control & 0x80)) {
-		return CYCLE_NEVER;
-	}
+	
 	if (port->serial_ctrl & SCTRL_BIT_RX_INTEN) {
 		if (port->serial_ctrl & SCTRL_BIT_RX_READY) {
 			return current_cycle;
@@ -1833,7 +1831,9 @@
 			return port->receive_end;
 		}
 	}
-	//TODO: handle external interrupts from TH transitions
+	/*if (port->control & 0x80) {
+		//TODO: handle external interrupts from TH transitions
+	}*/
 	return CYCLE_NEVER;
 }