diff --git a/frontends/sdl/README.md b/frontends/sdl/README.md index efa465e9dfa8870d3d94f542238e79540f5b5b2f..0cd39b9bbf84614923d5a2be0d7d63fcc2d18939 100644 --- a/frontends/sdl/README.md +++ b/frontends/sdl/README.md @@ -32,9 +32,9 @@ cargo run --features debug ## Features -| Provider | Description | -| -------- | ------------------------------------------------------------------------------------------------- | -| `debug` | Activates the base `debug` feature from Boytacean. | -| `secure` | Additional safety instructions are executed to make sure the machine does no run "out of tracks". | -| `slow` | Runs the emulator at a very slow page 60x slower to allow visual debugging. | -| `cpulog` | Prints a log of the CPU instruction executed. | +| Provider | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | +| `debug` | Activates the base `debug` feature from Boytacean. | +| `secure` | Additional safety instructions are executed to make sure the machine does no run "out of tracks", making sure to run many `panic()` calls. | +| `slow` | Runs the emulator at a very slow page 60x slower to allow visual debugging. | +| `cpulog` | Prints a log of the CPU instruction executed. | diff --git a/src/rom.rs b/src/rom.rs index bdad478dfbb7cdfcefaa53e31cf02945436af22a..46d32d04ed7f67a970a5d3c98975bd7bec162417 100644 --- a/src/rom.rs +++ b/src/rom.rs @@ -601,6 +601,8 @@ pub static MBC1: Mbc = Mbc { }, write_ram: |rom: &mut Cartridge, addr: u16, value: u8| { if !rom.ram_enabled { + #[cfg(feature = "secure")] + panic!("Attempt to write to ERAM while write protect is active"); debugln!("Attempt to write to ERAM while write protect is active"); return; } @@ -657,6 +659,8 @@ pub static MBC3: Mbc = Mbc { }, write_ram: |rom: &mut Cartridge, addr: u16, value: u8| { if !rom.ram_enabled { + #[cfg(feature = "secure")] + panic!("Attempt to write to ERAM while write protect is active"); debugln!("Attempt to write to ERAM while write protect is active"); return; } @@ -709,6 +713,8 @@ pub static MBC5: Mbc = Mbc { }, write_ram: |rom: &mut Cartridge, addr: u16, value: u8| { if !rom.ram_enabled { + #[cfg(feature = "secure")] + panic!("Attempt to write to ERAM while write protect is active"); debugln!("Attempt to write to ERAM while write protect is active"); return; }