Mercurial > repos > blastem
comparison io.c @ 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 |
comparison
equal
deleted
inserted
replaced
910:c030e4af32b7 | 911:73732ae76fa8 |
---|---|
1162 } | 1162 } |
1163 | 1163 |
1164 uint8_t io_data_read(io_port * port, uint32_t current_cycle) | 1164 uint8_t io_data_read(io_port * port, uint32_t current_cycle) |
1165 { | 1165 { |
1166 uint8_t control = port->control | 0x80; | 1166 uint8_t control = port->control | 0x80; |
1167 uint8_t th = control & port->output & 0x40; | 1167 uint8_t output = (control & port->output) | (~control & 0xFF); |
1168 uint8_t th = output & 0x40; | |
1168 uint8_t input; | 1169 uint8_t input; |
1169 switch (port->device_type) | 1170 switch (port->device_type) |
1170 { | 1171 { |
1171 case IO_GAMEPAD3: | 1172 case IO_GAMEPAD3: |
1172 { | 1173 { |
1205 input = ~input; | 1206 input = ~input; |
1206 break; | 1207 break; |
1207 } | 1208 } |
1208 case IO_MOUSE: | 1209 case IO_MOUSE: |
1209 { | 1210 { |
1210 uint8_t tr = control & port->output & TR; | 1211 uint8_t tr = output & TR; |
1211 if (th) { | 1212 if (th) { |
1212 if (tr) { | 1213 if (tr) { |
1213 input = 0x10; | 1214 input = 0x10; |
1214 } else { | 1215 } else { |
1215 input = 0; | 1216 input = 0; |