changeset 1869:dc94354eab66

Fix accuracy bugs used by Novedicus to detect BlastEm/Exodus
author Michael Pavone <pavone@retrodev.com>
date Mon, 24 Jun 2019 23:47:16 -0700
parents bfacedbae5f0
children e4671a39d155
files genesis.c vdp.c vdp.h
diffstat 3 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/genesis.c	Mon Jun 24 09:11:38 2019 -0700
+++ b/genesis.c	Mon Jun 24 23:47:16 2019 -0700
@@ -648,7 +648,7 @@
 	} else if (vdp_port < 0x18){
 		fatal_error("Illegal read from PSG  port %X\n", vdp_port);
 	} else {
-		value = vdp_test_port_read(v_context);
+		value = get_open_bus_value(&gen->header);
 	}
 	if (v_context->cycles != before_cycle) {
 		//printf("68K paused for %d (%d) cycles at cycle %d (%d) for read\n", v_context->cycles - context->current_cycle, v_context->cycles - before_cycle, context->current_cycle, before_cycle);
@@ -1012,6 +1012,10 @@
 	uint32_t address = gen->z80_bank_reg << 15 | location;
 	if (address >= 0xC00000 && address < 0xE00000) {
 		return z80_vdp_port_read(location & 0xFF, context);
+	} else if (address >= 0xA10000 && address <= 0xA10001) {
+		//Apparently version reg can be read through Z80 banked area
+		//TODO: Check rest of IO region addresses
+		return gen->version_reg;
 	} else {
 		fprintf(stderr, "Unhandled read by Z80 from address %X through banked memory area (%X)\n", address, gen->z80_bank_reg << 15);
 	}
--- a/vdp.c	Mon Jun 24 09:11:38 2019 -0700
+++ b/vdp.c	Mon Jun 24 23:47:16 2019 -0700
@@ -3631,12 +3631,6 @@
 	return context->prefetch;
 }
 
-uint16_t vdp_test_port_read(vdp_context * context)
-{
-	//TODO: Find out what actually gets returned here
-	return context->test_port;
-}
-
 void vdp_adjust_cycles(vdp_context * context, uint32_t deduction)
 {
 	context->cycles -= deduction;
--- a/vdp.h	Mon Jun 24 09:11:38 2019 -0700
+++ b/vdp.h	Mon Jun 24 23:47:16 2019 -0700
@@ -254,7 +254,6 @@
 uint8_t vdp_data_port_read_pbc(vdp_context * context);
 void vdp_latch_hv(vdp_context *context);
 uint16_t vdp_hv_counter_read(vdp_context * context);
-uint16_t vdp_test_port_read(vdp_context * context);
 void vdp_adjust_cycles(vdp_context * context, uint32_t deduction);
 uint32_t vdp_next_hint(vdp_context * context);
 uint32_t vdp_next_vint(vdp_context * context);