comparison cdd_mcu.c @ 2075:983f57d08eff

Fix a couple of CDD bugs
author Michael Pavone <pavone@retrodev.com>
date Mon, 31 Jan 2022 19:05:54 -0800
parents c69e42444f96
children 3f29e2726522
comparison
equal deleted inserted replaced
2074:c5323c02dde4 2075:983f57d08eff
484 gate_array[GAO_CDD_STATUS] &= ~BIT_DRS; 484 gate_array[GAO_CDD_STATUS] &= ~BIT_DRS;
485 if (context->cmd_recv_pending) { 485 if (context->cmd_recv_pending) {
486 context->cmd_recv_pending = 0; 486 context->cmd_recv_pending = 0;
487 context->current_cmd_nibble = 0; 487 context->current_cmd_nibble = 0;
488 gate_array[GAO_CDD_STATUS] |= BIT_DTS; 488 gate_array[GAO_CDD_STATUS] |= BIT_DTS;
489 next_nibble = context->cycle + NIBBLE_CLOCKS; 489 next_cmd_nibble = context->cycle + NIBBLE_CLOCKS;
490 } else { 490 } else {
491 context->cmd_recv_wait = 1; 491 context->cmd_recv_wait = 1;
492 next_nibble = CYCLE_NEVER; 492 }
493 } 493 next_nibble = CYCLE_NEVER;
494 } else { 494 } else {
495 uint8_t value = ((uint8_t *)&context->status_buffer)[context->current_status_nibble]; 495 uint8_t value = ((uint8_t *)&context->status_buffer)[context->current_status_nibble];
496 int ga_index = GAO_CDD_STATUS + (context->current_status_nibble >> 1); 496 int ga_index = GAO_CDD_STATUS + (context->current_status_nibble >> 1);
497 if (context->current_status_nibble & 1) { 497 if (context->current_status_nibble & 1) {
498 gate_array[ga_index] = value | (gate_array[ga_index] & 0xFF00); 498 gate_array[ga_index] = value | (gate_array[ga_index] & 0xFF00);
545 } else { 545 } else {
546 byte = fgetc(context->media->f); 546 byte = fgetc(context->media->f);
547 } 547 }
548 lc8951_write_byte(cdc, cd_block_to_mclks(context->cycle), context->current_sector_byte++, byte); 548 lc8951_write_byte(cdc, cd_block_to_mclks(context->cycle), context->current_sector_byte++, byte);
549 context->last_byte_cycle = context->cycle; 549 context->last_byte_cycle = context->cycle;
550 next_byte = context->cycle + BYTE_CLOCKS;
551 if (context->current_sector_byte == 2352) { 550 if (context->current_sector_byte == 2352) {
552 context->current_sector_byte = -1; 551 context->current_sector_byte = -1;
553 552 next_byte = CYCLE_NEVER;
553 } else {
554 next_byte = context->cycle + BYTE_CLOCKS;
554 } 555 }
555 } 556 }
556 } 557 }
557 } 558 }
558 559