initial state
This commit is contained in:
parent
f518e390fa
commit
ac6c2afd10
54
Cargo.lock
generated
54
Cargo.lock
generated
|
@ -224,9 +224,21 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"minifb",
|
"minifb",
|
||||||
|
"rand",
|
||||||
"spin_sleep",
|
"spin_sleep",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -437,6 +449,12 @@ version = "0.3.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
|
checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-error"
|
name = "proc-macro-error"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
|
@ -479,6 +497,36 @@ dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "raw-window-handle"
|
name = "raw-window-handle"
|
||||||
version = "0.3.4"
|
version = "0.3.4"
|
||||||
|
@ -664,6 +712,12 @@ version = "0.9.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.84"
|
version = "0.2.84"
|
||||||
|
|
|
@ -8,4 +8,5 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = {version = "4.1.1", features = ["derive"]}
|
clap = {version = "4.1.1", features = ["derive"]}
|
||||||
spin_sleep = "1.1.1"
|
spin_sleep = "1.1.1"
|
||||||
minifb = "0.23"
|
minifb = "0.23"
|
||||||
|
rand = "0.8.5"
|
|
@ -67,6 +67,7 @@ struct Args {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cpu_ram_init(cpu: &mut CPU) {
|
fn cpu_ram_init(cpu: &mut CPU) {
|
||||||
|
cpu.memory.set(0xFF04, 0xAD);
|
||||||
cpu.memory.set(0xFF10, 0x80);
|
cpu.memory.set(0xFF10, 0x80);
|
||||||
cpu.memory.set(0xFF11, 0xBF);
|
cpu.memory.set(0xFF11, 0xBF);
|
||||||
cpu.memory.set(0xFF12, 0xF3);
|
cpu.memory.set(0xFF12, 0xF3);
|
||||||
|
@ -86,6 +87,9 @@ fn cpu_ram_init(cpu: &mut CPU) {
|
||||||
cpu.memory.set(0xFF47, 0xFC);
|
cpu.memory.set(0xFF47, 0xFC);
|
||||||
cpu.memory.set(0xFF48, 0xFF);
|
cpu.memory.set(0xFF48, 0xFF);
|
||||||
cpu.memory.set(0xFF49, 0xFF);
|
cpu.memory.set(0xFF49, 0xFF);
|
||||||
|
for i in 0xC000..0xE000 {
|
||||||
|
cpu.memory.set(i, if rand::random() { 0xFF } else { 0x00 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut PAUSE_ENABLED: bool = false;
|
static mut PAUSE_ENABLED: bool = false;
|
||||||
|
|
|
@ -200,8 +200,7 @@ impl Default for Registers {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
// default post-bootrom values
|
// default post-bootrom values
|
||||||
Self {
|
Self {
|
||||||
af: 0x00B0,
|
af: 0x01B0,
|
||||||
// af: 0x01B0,
|
|
||||||
bc: 0x0013,
|
bc: 0x0013,
|
||||||
de: 0x00D8,
|
de: 0x00D8,
|
||||||
hl: 0x014D,
|
hl: 0x014D,
|
||||||
|
|
Loading…
Reference in a new issue