From 4437c3730dfbe7e038bc28da6531d140ddbfbcd4 Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Sun, 15 Sep 2013 22:43:01 -0700 Subject: Fix VSRAM reads --- vdp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vdp.c') diff --git a/vdp.c b/vdp.c index 8e5eb81..87e3d59 100644 --- a/vdp.c +++ b/vdp.c @@ -1583,13 +1583,13 @@ uint16_t vdp_data_port_read(vdp_context * context) 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 @@ uint16_t vdp_data_port_read(vdp_context * context) 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; -- cgit v1.2.3