Mercurial > repos > blastem
comparison segacd.c @ 2127:1bf30397dd45
Fix one more test in mcd-verificator CDC DMA1
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 12 Mar 2022 22:54:41 -0800 |
parents | da1fae7d5407 |
children | b0dcf5c9f353 |
comparison
equal
deleted
inserted
replaced
2126:da1fae7d5407 | 2127:1bf30397dd45 |
---|---|
330 } | 330 } |
331 } | 331 } |
332 return vcontext; | 332 return vcontext; |
333 } | 333 } |
334 | 334 |
335 static void cdd_run(segacd_context *cd, uint32_t cycle) | |
336 { | |
337 cdd_mcu_run(&cd->cdd, cycle, cd->gate_array + GA_CDD_CTRL, &cd->cdc, &cd->fader); | |
338 lc8951_run(&cd->cdc, cycle); | |
339 } | |
340 | |
335 static uint8_t pcm_read8(uint32_t address, void *vcontext) | 341 static uint8_t pcm_read8(uint32_t address, void *vcontext) |
336 { | 342 { |
337 m68k_context *m68k = vcontext; | 343 m68k_context *m68k = vcontext; |
338 segacd_context *cd = m68k->system; | 344 segacd_context *cd = m68k->system; |
339 if (address & 1) { | 345 if (address & 1) { |
346 //need to run CD drive because there may be a PCM DMA underway | |
347 cdd_run(cd, m68k->current_cycle); | |
340 rf5c164_run(&cd->pcm, m68k->current_cycle); | 348 rf5c164_run(&cd->pcm, m68k->current_cycle); |
341 return rf5c164_read(&cd->pcm, address >> 1); | 349 return rf5c164_read(&cd->pcm, address >> 1); |
342 } else { | 350 } else { |
343 return 0xFF; | 351 return 0xFF; |
344 } | 352 } |
352 static void *pcm_write8(uint32_t address, void *vcontext, uint8_t value) | 360 static void *pcm_write8(uint32_t address, void *vcontext, uint8_t value) |
353 { | 361 { |
354 m68k_context *m68k = vcontext; | 362 m68k_context *m68k = vcontext; |
355 segacd_context *cd = m68k->system; | 363 segacd_context *cd = m68k->system; |
356 if (address & 1) { | 364 if (address & 1) { |
365 //need to run CD drive because there may be a PCM DMA underway | |
366 cdd_run(cd, m68k->current_cycle); | |
357 rf5c164_run(&cd->pcm, m68k->current_cycle); | 367 rf5c164_run(&cd->pcm, m68k->current_cycle); |
358 rf5c164_write(&cd->pcm, address >> 1, value); | 368 rf5c164_write(&cd->pcm, address >> 1, value); |
359 } | 369 } |
360 return vcontext; | 370 return vcontext; |
361 } | 371 } |
388 cd->timer_value -= ticks; | 398 cd->timer_value -= ticks; |
389 if (!cd->timer_value) { | 399 if (!cd->timer_value) { |
390 cd->timer_pending = 1; | 400 cd->timer_pending = 1; |
391 } | 401 } |
392 } | 402 } |
393 } | |
394 | |
395 static void cdd_run(segacd_context *cd, uint32_t cycle) | |
396 { | |
397 cdd_mcu_run(&cd->cdd, cycle, cd->gate_array + GA_CDD_CTRL, &cd->cdc, &cd->fader); | |
398 lc8951_run(&cd->cdc, cycle); | |
399 } | 403 } |
400 | 404 |
401 static uint32_t next_timer_int(segacd_context *cd) | 405 static uint32_t next_timer_int(segacd_context *cd) |
402 { | 406 { |
403 if (cd->timer_pending) { | 407 if (cd->timer_pending) { |