From a3519baa935ea9c26cec2ab838b0e38b7a1d8070 Mon Sep 17 00:00:00 2001 From: EkeEke Date: Sat, 2 Feb 2013 02:32:40 +0100 Subject: [PATCH] [SCD] fixed & improved emulation of PRG-RAM write protection register (broken by previous revision): fixes Lunar - Eternal Blue (J) --- source/cd_hw/scd.c | 6 ++++++ source/mem68k.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/source/cd_hw/scd.c b/source/cd_hw/scd.c index c8b6574..8ec9347 100644 --- a/source/cd_hw/scd.c +++ b/source/cd_hw/scd.c @@ -92,6 +92,12 @@ void prg_ram_dma_w(unsigned int words) /* update DMA source address */ cdc.dac.w += (words << 1); + /* check PRG-RAM write protected area */ + if (dst_index < (scd.regs[0x02>>1].byte.h << 9)) + { + return; + } + /* DMA transfer */ while (words--) { diff --git a/source/mem68k.c b/source/mem68k.c index 499cceb..5798d75 100644 --- a/source/mem68k.c +++ b/source/mem68k.c @@ -650,6 +650,12 @@ void ctrl_io_write_byte(unsigned int address, unsigned int data) return; } + case 0x02: /* PRG-RAM Write Protection */ + { + scd.regs[0x02>>1].byte.h = data; + return; + } + case 0x03: /* Memory mode */ { m68k_poll_sync(0x02);