Mercurial > repos > blastem
comparison sms.c @ 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 | d4d770cfbc62 |
children | 6b0da6021544 |
comparison
equal
deleted
inserted
replaced
1147:06468b25a543 | 1148:80ef49539550 |
---|---|
84 { | 84 { |
85 z80_context *z80 = vcontext; | 85 z80_context *z80 = vcontext; |
86 sms_context *sms = z80->system; | 86 sms_context *sms = z80->system; |
87 if (location == 0xC0 || location == 0xDC) { | 87 if (location == 0xC0 || location == 0xDC) { |
88 uint8_t port_a = io_data_read(sms->io.ports, z80->current_cycle); | 88 uint8_t port_a = io_data_read(sms->io.ports, z80->current_cycle); |
89 uint8_t port_b = io_data_read(sms->io.ports, z80->current_cycle); | 89 uint8_t port_b = io_data_read(sms->io.ports+1, z80->current_cycle); |
90 return (port_a & 0x3F) | (port_b << 6); | 90 return (port_a & 0x3F) | (port_b << 6); |
91 } | 91 } |
92 if (location == 0xC1 || location == 0xDD) { | 92 if (location == 0xC1 || location == 0xDD) { |
93 uint8_t port_a = io_data_read(sms->io.ports, z80->current_cycle); | 93 uint8_t port_a = io_data_read(sms->io.ports, z80->current_cycle); |
94 uint8_t port_b = io_data_read(sms->io.ports, z80->current_cycle); | 94 uint8_t port_b = io_data_read(sms->io.ports+1, z80->current_cycle); |
95 return (port_a & 0x40) | (port_b >> 2 & 0xF) | (port_b << 1 & 0x80) | 0x10; | 95 return (port_a & 0x40) | (port_b >> 2 & 0xF) | (port_b << 1 & 0x80) | 0x10; |
96 } | 96 } |
97 return 0xFF; | 97 return 0xFF; |
98 } | 98 } |
99 | 99 |