From cdef244f38e68b9bb6341630621f8e7387b0ca10 Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Sun, 22 Sep 2024 01:19:47 +0200 Subject: [PATCH] Implement SA1 I-RAM write protection --- bsnes/sfc/coprocessor/sa1/iram.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bsnes/sfc/coprocessor/sa1/iram.cpp b/bsnes/sfc/coprocessor/sa1/iram.cpp index b4b01ddf..2a89faf7 100644 --- a/bsnes/sfc/coprocessor/sa1/iram.cpp +++ b/bsnes/sfc/coprocessor/sa1/iram.cpp @@ -24,6 +24,7 @@ auto SA1::IRAM::readCPU(uint address, uint8 data) -> uint8 { auto SA1::IRAM::writeCPU(uint address, uint8 data) -> void { cpu.synchronizeCoprocessors(); + if(!(sa1.mmio.siwp & 1 << (address >> 8 & 7))) return; return write(address, data); } @@ -32,5 +33,6 @@ auto SA1::IRAM::readSA1(uint address, uint8 data) -> uint8 { } auto SA1::IRAM::writeSA1(uint address, uint8 data) -> void { + if(!(sa1.mmio.ciwp & 1 << (address >> 8 & 7))) return; return write(address, data); }