diff segacd.c @ 2073:c69e42444f96

Fix some cycle adjustment stuff and an off-by one on hte TOCT response
author Michael Pavone <pavone@retrodev.com>
date Mon, 31 Jan 2022 00:01:15 -0800
parents 8e51c0c3f2e3
children bafb757e1cd2
line wrap: on
line diff
--- a/segacd.c	Sun Jan 30 22:29:29 2022 -0800
+++ b/segacd.c	Mon Jan 31 00:01:15 2022 -0800
@@ -597,9 +597,9 @@
 	case GA_CDD_CTRL: {
 		cdd_run(cd, m68k->current_cycle);
 		uint16_t changed = cd->gate_array[reg] ^ value;
-		cd->gate_array[reg] &= ~BIT_HOCK;
-		cd->gate_array[reg] |= value & BIT_HOCK;
 		if (changed & BIT_HOCK) {
+			cd->gate_array[reg] &= ~BIT_HOCK;
+			cd->gate_array[reg] |= value & BIT_HOCK;
 			if (value & BIT_HOCK) {
 				cdd_hock_enabled(&cd->cdd);
 			} else {
@@ -928,11 +928,6 @@
 		return 0xFFFF;
 	default:
 		if (offset < GA_TIMER) {
-			if (offset == GA_CDC_CTRL) {
-				printf("CDC read(main): %X - %X @ %u (%u)\n", address, cd->gate_array[offset], m68k->current_cycle, scd_cycle);
-			} else if (offset >= GA_COMM_FLAG && offset <= GA_COMM_STATUS7) {
-				printf("COMM read(main): %X - %X @ %u (%u)\n", address, cd->gate_array[offset], m68k->current_cycle, scd_cycle);
-			}
 			return cd->gate_array[offset];
 		}
 		//TODO: open bus maybe?
@@ -1049,7 +1044,6 @@
 		//Main CPU can only write the upper byte;
 		cd->gate_array[reg] &= 0xFF;
 		cd->gate_array[reg] |= value & 0xFF00;
-		printf("COMM write(main): %X - %X @ %u (%u)\n", address, value, m68k->current_cycle, scd_cycle);
 		break;
 	case GA_COMM_CMD0:
 	case GA_COMM_CMD1:
@@ -1060,7 +1054,6 @@
 	case GA_COMM_CMD6:
 	case GA_COMM_CMD7:
 		//no effects for these other than saving the value
-		printf("COMM write(main): %X - %X @ %u (%u)\n", address, value, m68k->current_cycle, scd_cycle);
 		cd->gate_array[reg] = value;
 		break;
 	default: