comparison sms.c @ 2196:2648081f3100

Implement Game Gear PSG panning
author Michael Pavone <pavone@retrodev.com>
date Sun, 21 Aug 2022 23:14:08 -0700
parents 40290a923886
children 74b92e20e2ef
comparison
equal deleted inserted replaced
2195:40290a923886 2196:2648081f3100
210 static void *gg_io_write(uint32_t location, void *vcontext, uint8_t value) 210 static void *gg_io_write(uint32_t location, void *vcontext, uint8_t value)
211 { 211 {
212 //TODO: implement link port 212 //TODO: implement link port
213 return vcontext; 213 return vcontext;
214 } 214 }
215
216 static uint8_t psg_pan_read(uint32_t location, void *vcontext)
217 {
218 //TODO: implement PSG pan
219 return 0xFF;
220 }
221
222 static void *psg_pan_write(uint32_t location, void *vcontext, uint8_t value) 215 static void *psg_pan_write(uint32_t location, void *vcontext, uint8_t value)
223 { 216 {
224 //TODO: implement PSG pan 217 z80_context *z80 = vcontext;
218 sms_context *sms = z80->system;
219 psg_run(sms->psg, z80->Z80_CYCLE);
220 sms->psg->pan = value;
225 return vcontext; 221 return vcontext;
226 } 222 }
227 static memmap_chunk io_map[] = { 223 static memmap_chunk io_map[] = {
228 {0x00, 0x40, 0xFF, .write_8 = memory_io_write}, 224 {0x00, 0x40, 0xFF, .write_8 = memory_io_write},
229 {0x40, 0x80, 0xFF, .read_8 = hv_read, .write_8 = sms_psg_write}, 225 {0x40, 0x80, 0xFF, .read_8 = hv_read, .write_8 = sms_psg_write},
231 {0xC0, 0x100,0xFF, .read_8 = io_read} 227 {0xC0, 0x100,0xFF, .read_8 = io_read}
232 }; 228 };
233 229
234 static memmap_chunk io_gg[] = { 230 static memmap_chunk io_gg[] = {
235 {0x00, 0x07, 0xFF, .read_8 = gg_io_read, .write_8 = gg_io_write}, 231 {0x00, 0x07, 0xFF, .read_8 = gg_io_read, .write_8 = gg_io_write},
236 {0x07, 0x08, 0xFF, .read_8 = psg_pan_read, .write_8 = psg_pan_write}, 232 {0x07, 0x08, 0xFF, .write_8 = psg_pan_write},
237 {0x08, 0x40, 0xFF, .write_8 = memory_io_write}, 233 {0x08, 0x40, 0xFF, .write_8 = memory_io_write},
238 {0x40, 0x80, 0xFF, .read_8 = hv_read, .write_8 = sms_psg_write}, 234 {0x40, 0x80, 0xFF, .read_8 = hv_read, .write_8 = sms_psg_write},
239 {0x80, 0xC0, 0xFF, .read_8 = vdp_read, .write_8 = vdp_write}, 235 {0x80, 0xC0, 0xFF, .read_8 = vdp_read, .write_8 = vdp_write},
240 {0xC0, 0x100,0xFF, .read_8 = io_read} 236 {0xC0, 0x100,0xFF, .read_8 = io_read}
241 }; 237 };