comparison sms.c @ 1143:d4d770cfbc62

Fix handling of IO control writes in SMS mode
author Michael Pavone <pavone@retrodev.com>
date Tue, 03 Jan 2017 20:42:15 -0800
parents 5c8b1c33ca10
children 80ef49539550
comparison
equal deleted inserted replaced
1142:5c8b1c33ca10 1143:d4d770cfbc62
10 static void *memory_io_write(uint32_t location, void *vcontext, uint8_t value) 10 static void *memory_io_write(uint32_t location, void *vcontext, uint8_t value)
11 { 11 {
12 z80_context *z80 = vcontext; 12 z80_context *z80 = vcontext;
13 sms_context *sms = z80->system; 13 sms_context *sms = z80->system;
14 if (location & 1) { 14 if (location & 1) {
15 sms->io.ports[0].control = ~(value << 5 & 0x60); 15 sms->io.ports[0].control = (~value) << 5 & 0x60;
16 sms->io.ports[1].control = ~(value << 3 & 0x60); 16 sms->io.ports[1].control = (~value) << 3 & 0x60;
17 io_data_write(sms->io.ports, value << 1, z80->current_cycle); 17 io_data_write(sms->io.ports, value << 1, z80->current_cycle);
18 io_data_write(sms->io.ports + 1, value >> 1, z80->current_cycle); 18 io_data_write(sms->io.ports + 1, value >> 1, z80->current_cycle);
19 } else { 19 } else {
20 //TODO: memory control write 20 //TODO: memory control write
21 } 21 }