diff --git a/Cargo.toml b/architectures/x86/Cargo.toml similarity index 58% rename from Cargo.toml rename to architectures/x86/Cargo.toml index 852bb89..b5f0696 100644 --- a/Cargo.toml +++ b/architectures/x86/Cargo.toml @@ -1,16 +1,14 @@ [package] -name = "nemu" +name = "nemu-arch-x86" version = "0.1.0" edition = "2021" authors = ["Antifallobst ", "Eric-Paul Ickhorn "] -description = "A small web emulator for simple architectures" +description = "The x86 implementation of NEMU" license = "MIT" repository = "https://git.nerdcult.net/nerdcult/nerdemu" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2" \ No newline at end of file +wasm-bindgen = "0.2" diff --git a/src/lib.rs b/architectures/x86/src/lib.rs similarity index 100% rename from src/lib.rs rename to architectures/x86/src/lib.rs diff --git a/base/Cargo.toml b/base/Cargo.toml new file mode 100644 index 0000000..2627023 --- /dev/null +++ b/base/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "nemu-base" +version = "0.1.0" +edition = "2021" +authors = ["Antifallobst ", "Eric-Paul Ickhorn "] +description = "The base layer of NEMU" +license = "MIT" +repository = "https://git.nerdcult.net/nerdcult/nerdemu" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +wasm-bindgen = "0.2" \ No newline at end of file diff --git a/base/src/lib.rs b/base/src/lib.rs new file mode 100644 index 0000000..1dadb36 --- /dev/null +++ b/base/src/lib.rs @@ -0,0 +1,11 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern { + pub fn alert(s: &str); +} + +#[wasm_bindgen] +pub fn greet(name: &str) { + alert(&format!("Hello, {}!", name)); +} diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index 726e2ae..01ab927 --- a/build.sh +++ b/build.sh @@ -1,9 +1,14 @@ #!/usr/bin/bash +set -e nemu_build() { - echo " --> Building NerdEMU" - wasm-pack build --target web + echo " --> Building nemu-base" + wasm-pack build base --target web + + + echo " --> Building nemu-arch-x86" + wasm-pack build architectures/x86 --target web } nemu_run(){ diff --git a/index.html b/index.html index 54a6531..d6ee9b7 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@