summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-12-06 15:42:36 -0800
committerMichael Pavone <pavone@retrodev.com>2015-12-06 15:42:36 -0800
commit0f66f8cd940390c5917614e317e9da8a90d53a1f (patch)
tree8096c5b58277bbabe964d9de21b150b9ca624d7e
parente241085fb527e38bf4e9f992067ccb5cebc6fea9 (diff)
IO port pins should read as high from the perspective of a device when they are set as inputs
-rw-r--r--io.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/io.c b/io.c
index cab81fb..3624c35 100644
--- a/io.c
+++ b/io.c
@@ -1164,7 +1164,8 @@ void io_data_write(io_port * port, uint8_t value, uint32_t current_cycle)
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 @@ uint8_t io_data_read(io_port * port, uint32_t current_cycle)
}
case IO_MOUSE:
{
- uint8_t tr = control & port->output & TR;
+ uint8_t tr = output & TR;
if (th) {
if (tr) {
input = 0x10;