changeset 1994:00873afe1fe9

Fix regressions in Monster World IV and Sonic 3D Blast caused by address latch changes
author Michael Pavone <pavone@retrodev.com>
date Thu, 18 Jun 2020 00:20:25 -0700
parents 8ad431312aa7
children 2ef405b9d3eb
files vdp.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Sat Jun 13 00:38:52 2020 -0700
+++ b/vdp.c	Thu Jun 18 00:20:25 2020 -0700
@@ -3750,8 +3750,6 @@
 		}
 	} else {
 		uint8_t mode_5 = context->regs[REG_MODE_2] & BIT_MODE_5;
-		//contrary to what's in Charles MacDonald's doc, it seems top 2 address bits are cleared
-		//needed for the Mona in 344 Bytes demo
 		context->address_latch = (context->address_latch & 0x1C000) | (value & 0x3FFF);
 		context->cd_latch = (context->cd_latch & 0x3C) | (value >> 14);
 		if ((value & 0xC000) == 0x8000) {
@@ -3781,6 +3779,11 @@
 					update_video_params(context);
 				}
 			}
+			// The fact that this is needed seems to pour some cold water on my theory
+			// about how the address latch actually works. Needs more search to definitively confirm
+			clear_pending(context);
+			context->flags &= ~FLAG_READ_FETCHED;
+			context->flags2 &= ~FLAG2_READ_PENDING;
 		} else if (mode_5) {
 			context->flags |= FLAG_PENDING;
 			//Should these be taken care of here or after the second write?