changeset 911:73732ae76fa8

IO port pins should read as high from the perspective of a device when they are set as inputs
author Michael Pavone <pavone@retrodev.com>
date Sun, 06 Dec 2015 15:42:36 -0800
parents c030e4af32b7
children 599e2861f484
files io.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/io.c	Sat Dec 05 18:40:34 2015 -0800
+++ b/io.c	Sun Dec 06 15:42:36 2015 -0800
@@ -1164,7 +1164,8 @@
 uint8_t io_data_read(io_port * port, uint32_t current_cycle)
 {
 	uint8_t control = port->control | 0x80;
-	uint8_t th = control & port->output & 0x40;
+	uint8_t output = (control & port->output) | (~control & 0xFF);
+	uint8_t th = output & 0x40;
 	uint8_t input;
 	switch (port->device_type)
 	{
@@ -1207,7 +1208,7 @@
 	}
 	case IO_MOUSE:
 	{
-		uint8_t tr = control & port->output & TR;
+		uint8_t tr = output & TR;
 		if (th) {
 			if (tr) {
 				input = 0x10;