Mercurial > repos > blastem
comparison cdd_mcu.c @ 2130:28b6453cf7e3
Emulate CDC sync detection and sync insertion rather than relying on external knowledge about sector offset
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 15 Mar 2022 08:58:04 -0700 |
parents | ad346054ca78 |
children | 11a3d5b00a66 |
comparison
equal
deleted
inserted
replaced
2129:4c9e447aa25b | 2130:28b6453cf7e3 |
---|---|
541 //it's a little unclear if this gates the actual cd block clock or just handshaking | 541 //it's a little unclear if this gates the actual cd block clock or just handshaking |
542 //assum it's actually the clock for now | 542 //assum it's actually the clock for now |
543 for (; context->cycle < cd_cycle; context->cycle += CDD_MCU_DIVIDER) { | 543 for (; context->cycle < cd_cycle; context->cycle += CDD_MCU_DIVIDER) { |
544 if (context->cycle >= context->next_byte_cycle) { | 544 if (context->cycle >= context->next_byte_cycle) { |
545 cdd_fader_data(fader, 0); | 545 cdd_fader_data(fader, 0); |
546 lc8951_write_byte(cdc, cd_block_to_mclks(context->cycle), 0, 0); | |
546 context->next_byte_cycle += BYTE_CLOCKS; | 547 context->next_byte_cycle += BYTE_CLOCKS; |
547 } | 548 } |
548 } | 549 } |
549 gate_array[GAO_CDD_CTRL] |= BIT_MUTE; | 550 gate_array[GAO_CDD_CTRL] |= BIT_MUTE; |
550 return; | 551 return; |
629 if (context->current_sector_byte >= 0 && (!fader->byte_counter || context->current_sector_byte)) { | 630 if (context->current_sector_byte >= 0 && (!fader->byte_counter || context->current_sector_byte)) { |
630 uint8_t byte = context->media->read(context->media, context->current_sector_byte); | 631 uint8_t byte = context->media->read(context->media, context->current_sector_byte); |
631 lc8951_write_byte(cdc, cd_block_to_mclks(context->cycle), context->current_sector_byte++, byte); | 632 lc8951_write_byte(cdc, cd_block_to_mclks(context->cycle), context->current_sector_byte++, byte); |
632 cdd_fader_data(fader, gate_array[GAO_CDD_CTRL] & BIT_MUTE ? 0 : byte); | 633 cdd_fader_data(fader, gate_array[GAO_CDD_CTRL] & BIT_MUTE ? 0 : byte); |
633 } else { | 634 } else { |
635 lc8951_write_byte(cdc, cd_block_to_mclks(context->cycle), 0, 0); | |
634 cdd_fader_data(fader, 0); | 636 cdd_fader_data(fader, 0); |
635 if (context->current_sector_byte >= 0) { | 637 if (context->current_sector_byte >= 0) { |
636 next_subcode += BYTE_CLOCKS; | 638 next_subcode += BYTE_CLOCKS; |
637 context->last_sector_cycle += BYTE_CLOCKS; | 639 context->last_sector_cycle += BYTE_CLOCKS; |
638 } | 640 } |