# HG changeset patch # User Michael Pavone # Date 1483504935 28800 # Node ID d4d770cfbc62812673a8315b4c37a8f87757cc8f # Parent 5c8b1c33ca104eae25f61036146e08a52d1f064d Fix handling of IO control writes in SMS mode diff -r 5c8b1c33ca10 -r d4d770cfbc62 sms.c --- a/sms.c Mon Jan 02 23:35:40 2017 -0800 +++ b/sms.c Tue Jan 03 20:42:15 2017 -0800 @@ -12,8 +12,8 @@ z80_context *z80 = vcontext; sms_context *sms = z80->system; if (location & 1) { - sms->io.ports[0].control = ~(value << 5 & 0x60); - sms->io.ports[1].control = ~(value << 3 & 0x60); + sms->io.ports[0].control = (~value) << 5 & 0x60; + sms->io.ports[1].control = (~value) << 3 & 0x60; io_data_write(sms->io.ports, value << 1, z80->current_cycle); io_data_write(sms->io.ports + 1, value >> 1, z80->current_cycle); } else {