Mercurial > repos > blastem
comparison cdd_mcu.c @ 2100:539450d905b3
Fix CDD PLAY command and CDD fader sample alignment
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 09 Feb 2022 23:39:03 -0800 |
parents | 460c93c19146 |
children | e93ced356a21 |
comparison
equal
deleted
inserted
replaced
2099:b92c998c6742 | 2100:539450d905b3 |
---|---|
483 context->error_status = DS_CMD_ERROR; | 483 context->error_status = DS_CMD_ERROR; |
484 break; | 484 break; |
485 } | 485 } |
486 if (context->status == DS_STOP || context->status == DS_TOC_READ) { | 486 if (context->status == DS_STOP || context->status == DS_TOC_READ) { |
487 context->seeking = 1; | 487 context->seeking = 1; |
488 context->seek_pba = LEADIN_SECTORS + context->media->tracks[0].fake_pregap + context->media->tracks[0].start_lba; | 488 context->seek_pba = LEADIN_SECTORS + context->media->tracks[0].fake_pregap + context->media->tracks[0].start_lba - 4; |
489 printf("CDD CMD: PAUSE, seeking to %u\n", context->seek_pba); | 489 printf("CDD CMD: PLAY, seeking to %u\n", context->seek_pba); |
490 } else { | 490 } else { |
491 puts("CDD CMD: PAUSE"); | 491 puts("CDD CMD: PLAY"); |
492 } | 492 } |
493 context->status = DS_PLAY; | |
493 break; | 494 break; |
494 //TODO: CMD_FFWD, CMD_RWD | 495 //TODO: CMD_FFWD, CMD_RWD |
495 case CMD_TRACK_SKIP: | 496 case CMD_TRACK_SKIP: |
496 if (context->status != DS_PLAY && context->status != DS_PAUSE && context->status != DS_DISC_LEADOUT) { | 497 if (context->status != DS_PLAY && context->status != DS_PAUSE && context->status != DS_DISC_LEADOUT) { |
497 context->error_status = DS_CMD_ERROR; | 498 context->error_status = DS_CMD_ERROR; |
598 context->last_nibble_cycle = context->cycle; | 599 context->last_nibble_cycle = context->cycle; |
599 next_cmd_nibble = context->cycle + NIBBLE_CLOCKS; | 600 next_cmd_nibble = context->cycle + NIBBLE_CLOCKS; |
600 } | 601 } |
601 } | 602 } |
602 if (context->cycle >= context->next_byte_cycle) { | 603 if (context->cycle >= context->next_byte_cycle) { |
603 if (context->current_sector_byte >= 0) { | 604 if (context->current_sector_byte >= 0 && (!fader->byte_counter || context->current_sector_byte)) { |
604 uint8_t byte = context->media->read(context->media, context->current_sector_byte); | 605 uint8_t byte = context->media->read(context->media, context->current_sector_byte); |
605 lc8951_write_byte(cdc, cd_block_to_mclks(context->cycle), context->current_sector_byte++, byte); | 606 lc8951_write_byte(cdc, cd_block_to_mclks(context->cycle), context->current_sector_byte++, byte); |
606 cdd_fader_data(fader, gate_array[GAO_CDD_CTRL] & BIT_MUTE ? 0 : byte); | 607 cdd_fader_data(fader, gate_array[GAO_CDD_CTRL] & BIT_MUTE ? 0 : byte); |
607 } else { | 608 } else { |
608 cdd_fader_data(fader, 0); | 609 cdd_fader_data(fader, 0); |
610 if (context->current_sector_byte >= 0) { | |
611 next_subcode += BYTE_CLOCKS; | |
612 context->last_subcode_cycle += BYTE_CLOCKS; | |
613 } | |
609 } | 614 } |
610 if (context->current_sector_byte == 2352) { | 615 if (context->current_sector_byte == 2352) { |
611 context->current_sector_byte = -1; | 616 context->current_sector_byte = -1; |
612 } | 617 } |
613 context->next_byte_cycle += BYTE_CLOCKS; | 618 context->next_byte_cycle += BYTE_CLOCKS; |