diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-01-03 23:03:30 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-01-03 23:03:30 -0800 |
commit | 7efc7891c5d5c9bc1daf954510f90e79b6db5c75 (patch) | |
tree | 0298da1fc56c6c772798c8c5c1d230863bcfd0f0 /sms.c | |
parent | d292350bf054f117ba5bcc813058500a86189a6a (diff) |
Fix reading from second controller port in SMS mode
Diffstat (limited to 'sms.c')
-rw-r--r-- | sms.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -86,12 +86,12 @@ static uint8_t io_read(uint32_t location, void *vcontext) sms_context *sms = z80->system; if (location == 0xC0 || location == 0xDC) { uint8_t port_a = io_data_read(sms->io.ports, z80->current_cycle); - uint8_t port_b = io_data_read(sms->io.ports, z80->current_cycle); + uint8_t port_b = io_data_read(sms->io.ports+1, z80->current_cycle); return (port_a & 0x3F) | (port_b << 6); } if (location == 0xC1 || location == 0xDD) { uint8_t port_a = io_data_read(sms->io.ports, z80->current_cycle); - uint8_t port_b = io_data_read(sms->io.ports, z80->current_cycle); + uint8_t port_b = io_data_read(sms->io.ports+1, z80->current_cycle); return (port_a & 0x40) | (port_b >> 2 & 0xF) | (port_b << 1 & 0x80) | 0x10; } return 0xFF; |