From 7efc7891c5d5c9bc1daf954510f90e79b6db5c75 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 3 Jan 2017 23:03:30 -0800 Subject: Fix reading from second controller port in SMS mode --- sms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sms.c') diff --git a/sms.c b/sms.c index e9fff74..2cb3dc7 100644 --- a/sms.c +++ b/sms.c @@ -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; -- cgit v1.2.3