changeset 1148:80ef49539550

Fix reading from second controller port in SMS mode
author Michael Pavone <pavone@retrodev.com>
date Tue, 03 Jan 2017 23:03:30 -0800
parents 06468b25a543
children 6b0da6021544
files sms.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sms.c	Tue Jan 03 21:37:36 2017 -0800
+++ b/sms.c	Tue Jan 03 23:03:30 2017 -0800
@@ -86,12 +86,12 @@
 	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;