changeset 472:93dc0382fd70

Fix VSRAM reads
author Mike Pavone <pavone@retrodev.com>
date Sun, 15 Sep 2013 22:43:01 -0700
parents f065769836e8
children 1358045c0bdd
files vdp.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Sun Sep 15 22:20:43 2013 -0700
+++ b/vdp.c	Sun Sep 15 22:43:01 2013 -0700
@@ -1583,13 +1583,13 @@
 	switch (context->cd & 0xF)
 	{
 	case VRAM_READ:
-		value = context->vdpmem[context->address] << 8;
+		value = context->vdpmem[context->address & 0xFFFE] << 8;
 		context->flags &= ~FLAG_UNUSED_SLOT;
 		context->flags2 |= FLAG2_READ_PENDING;
 		while (!(context->flags & FLAG_UNUSED_SLOT)) {
 			vdp_run_context(context, context->cycles + ((context->latched_mode & BIT_H40) ? 16 : 20));
 		}
-		value |= context->vdpmem[context->address ^ 1];
+		value |= context->vdpmem[context->address | 1];
 		break;
 	case CRAM_READ:
 		value = context->cram[(context->address/2) & (CRAM_SIZE-1)] & CRAM_BITS;
@@ -1597,7 +1597,7 @@
 		break;
 	case VSRAM_READ:
 		if (((context->address / 2) & 63) < VSRAM_SIZE) {
-			value = context->vsram[context->address & 63] & VSRAM_BITS;
+			value = context->vsram[(context->address / 2) & 63] & VSRAM_BITS;
 			value |= context->fifo[context->fifo_write].value & VSRAM_DIRTY_BITS;
 		}
 		break;