Skip to content
Snippets Groups Projects
Verified Commit ac7e98cd authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: new secure feature

parent 3fe2d11f
No related branches found
No related tags found
1 merge request!16Support for Game Boy Color (CGB) 😎🖍️
Pipeline #2572 failed
...@@ -17,6 +17,7 @@ crate-type = ["cdylib", "rlib"] ...@@ -17,6 +17,7 @@ crate-type = ["cdylib", "rlib"]
[features] [features]
wasm = ["wasm-bindgen"] wasm = ["wasm-bindgen"]
debug = [] debug = []
secure = []
cpulog = [] cpulog = []
gen-mock = [] gen-mock = []
......
...@@ -10,6 +10,7 @@ edition = "2018" ...@@ -10,6 +10,7 @@ edition = "2018"
[features] [features]
slow = [] slow = []
debug = ["boytacean/debug"] debug = ["boytacean/debug"]
secure = ["boytacean/secure"]
cpulog = ["boytacean/cpulog"] cpulog = ["boytacean/cpulog"]
[dependencies.boytacean] [dependencies.boytacean]
......
...@@ -32,8 +32,9 @@ cargo run --features debug ...@@ -32,8 +32,9 @@ cargo run --features debug
## Features ## Features
| Provider | Description | | Provider | Description |
| -------- | --------------------------------------------------------------------------- | | -------- | ------------------------------------------------------------------------------------------------- |
| `debug` | Activates the base `debug` feature from Boytacean. | | `debug` | Activates the base `debug` feature from Boytacean. |
| `slow` | Runs the emulator at a very slow page 60x slower to allow visual debugging. | | `secure` | Additional safety instructions are executed to make sure the machine does no run "out of tracks". |
| `cpulog` | Prints a log of the CPU instruction executed. | | `slow` | Runs the emulator at a very slow page 60x slower to allow visual debugging. |
| `cpulog` | Prints a log of the CPU instruction executed. |
...@@ -280,7 +280,12 @@ impl Cpu { ...@@ -280,7 +280,12 @@ impl Cpu {
} }
#[cfg(feature = "cpulog")] #[cfg(feature = "cpulog")]
println!("[0x{:04x}] {}", self.pc - 1, inst_str); println!("[0x{:04x}] {}\t({} cycles)", self.pc - 1, inst_str, inst_time);
#[cfg(feature = "secure")]
if self.mmu.boot_active() && self.pc - 1 > 0x08ff {
panic!("Invalid boot address: {:04x}", self.pc - 1);
}
// calls the current instruction and increments the number of // calls the current instruction and increments the number of
// cycles executed by the instruction time of the instruction // cycles executed by the instruction time of the instruction
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment