This commit is contained in:
Eric-Paul Ickhorn 2023-03-17 00:51:08 +01:00
commit 5c089fa51c
9 changed files with 53 additions and 34 deletions

View File

@ -1,14 +1,12 @@
[package]
name = "nemu"
name = "nemu-arch-x86"
version = "0.1.0"
edition = "2021"
authors = ["Antifallobst <antifallobst@systemausfall.org>", "Eric-Paul Ickhorn <atnx@protonmail.com>"]
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"]

View File

@ -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));
}

14
base/Cargo.toml Normal file
View File

@ -0,0 +1,14 @@
[package]
name = "nemu-base"
version = "0.1.0"
edition = "2021"
authors = ["Antifallobst <antifallobst@systemausfall.org>", "Eric-Paul Ickhorn <atnx@protonmail.com>"]
description = "The base layer of NEMU"
license = "MIT"
repository = "https://git.nerdcult.net/nerdcult/nerdemu"
[lib]
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "0.2"

11
base/src/lib.rs Normal file
View File

@ -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));
}

View File

@ -1,9 +1,14 @@
#!/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(){

View File

@ -6,7 +6,7 @@
</head>
<body>
<script type="module">
import init, { greet } from "./pkg/nemu.js";
import init, { greet } from "./base/pkg/nemu_base.js";
init().then(() => {
greet("NerdEMU");
});

6
systems/8086.json Normal file
View File

@ -0,0 +1,6 @@
{
"name": "i8086",
"version": "0.0",
"architecture": "x86"
}

View File

@ -1,10 +0,0 @@
// The NerdEMU - emulator | This software is protected under the MIT-license
// Copyright 2023: [The Original NerdEMU-Authors] as seen on:
// (nerdcult.net/projects/nerdemu/ OR git.nerdcult.net/nerdcult/nerdemu)
// x86/src/i8086.rs: The emulation code for the i8086 - microprocessor
// and a basic mainbus which connects it to the memory and other simple
// devices.

View File

@ -1,16 +0,0 @@
// The NerdEMU - emulator | This software is protected under the MIT-license
// Copyright 2023: [The Original NerdEMU-Authors] as seen on:
// (nerdcult.net/projects/nerdemu/ OR git.nerdcult.net/nerdcult/nerdemu)
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern {
pub fn alert(s: &str);
}
#[wasm_bindgen]
pub fn greet(name: &str) {
alert(&format!("Hello, {}!", name));
}