Mercurial > repos > blastem
comparison cdd_mcu.c @ 2081:cfd53c94fffb
Initial stab at RF5C164 emulation
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 03 Feb 2022 23:15:42 -0800 |
parents | bafb757e1cd2 |
children | c9d3b8e1ea56 |
comparison
equal
deleted
inserted
replaced
2080:bafb757e1cd2 | 2081:cfd53c94fffb |
---|---|
75 //TODO: more realistic seeking behavior | 75 //TODO: more realistic seeking behavior |
76 if (context->seeking) { | 76 if (context->seeking) { |
77 if (context->seek_pba == context->head_pba) { | 77 if (context->seek_pba == context->head_pba) { |
78 context->seeking = 0; | 78 context->seeking = 0; |
79 } else if (context->seek_pba > context->head_pba) { | 79 } else if (context->seek_pba > context->head_pba) { |
80 if (context->seek_pba - context->head_pba >= COARSE_SEEK) { | 80 if (context->seek_pba - context->head_pba >= COARSE_SEEK || context->head_pba < LEADIN_SECTORS) { |
81 context->head_pba += COARSE_SEEK; | 81 context->head_pba += COARSE_SEEK; |
82 } else if (context->seek_pba - context->head_pba >= FINE_SEEK) { | 82 } else if (context->seek_pba - context->head_pba >= FINE_SEEK) { |
83 context->head_pba += FINE_SEEK; | 83 context->head_pba += FINE_SEEK; |
84 } else { | 84 } else { |
85 context->head_pba++; | 85 context->head_pba++; |
117 { | 117 { |
118 case DS_PLAY: | 118 case DS_PLAY: |
119 handle_seek(context); | 119 handle_seek(context); |
120 if (!context->seeking) { | 120 if (!context->seeking) { |
121 context->head_pba++; | 121 context->head_pba++; |
122 } | |
123 if (context->head_pba >= LEADIN_SECTORS) { | |
122 uint8_t track = context->media->seek(context->media, context->head_pba - LEADIN_SECTORS); | 124 uint8_t track = context->media->seek(context->media, context->head_pba - LEADIN_SECTORS); |
123 if (context->media->tracks[track].type == TRACK_AUDIO) { | 125 if (context->media->tracks[track].type == TRACK_AUDIO) { |
124 gate_array[GAO_CDD_CTRL] &= ~BIT_MUTE; | 126 gate_array[GAO_CDD_CTRL] &= ~BIT_MUTE; |
125 } | 127 } |
126 } | 128 } |
469 next_subcode = context->cycle + SECTOR_CLOCKS; | 471 next_subcode = context->cycle + SECTOR_CLOCKS; |
470 update_status(context, gate_array); | 472 update_status(context, gate_array); |
471 next_nibble = context->cycle; | 473 next_nibble = context->cycle; |
472 context->current_status_nibble = 0; | 474 context->current_status_nibble = 0; |
473 gate_array[GAO_CDD_STATUS] |= BIT_DRS; | 475 gate_array[GAO_CDD_STATUS] |= BIT_DRS; |
474 if (context->status == DS_PLAY && !context->seeking) { | 476 if (context->status == DS_PLAY && context->head_pba >= LEADIN_SECTORS) { |
475 context->current_sector_byte = 0; | 477 context->current_sector_byte = 0; |
476 } | 478 } |
477 } | 479 } |
478 if (context->cycle >= next_nibble) { | 480 if (context->cycle >= next_nibble) { |
479 if (context->current_status_nibble == sizeof(cdd_status)) { | 481 if (context->current_status_nibble == sizeof(cdd_status)) { |