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

feat: simplified tsconfig and added chip8 classic

to the web version
parent f415a33e
No related branches found
No related tags found
No related merge requests found
Pipeline #678 passed
......@@ -50,9 +50,13 @@ And... yes this is the real inspiration behind the emulator's name:
## Inspiration
Many articles and websites helped me in this quest to build the emulator these are some of them:
* [Guide to making a CHIP-8 emulator](https://tobiasvl.github.io/blog/write-a-chip-8-emulator)
* [Writing a CHIP-8 emulator with Rust and WebAssembly](https://blog.scottlogic.com/2017/12/13/chip8-emulator-webassembly-rust.html)
* [Wikipedia - CHIP-8](https://en.wikipedia.org/wiki/CHIP-8)
* [itch.io - OctoJam 6][https://itch.io/jam/octojam-6]
* [CHIP-8 Archive](https://johnearnest.github.io/chip8Archive)
## License
......
import {
default as wasm,
Chip8Neo
Chip8Neo,
Chip8Classic
} from "./lib/chip_ahoyto.js";
const PIXEL_SET_COLOR = 0x50cb93ff;
......@@ -47,7 +48,7 @@ const ROM_PATH = "res/roms/pong.ch8";
const ROM_NAME = "pong.ch8";
type State = {
chip8: Chip8Neo,
chip8: Chip8Neo | Chip8Classic,
logicFrequency: number,
visualFrequency: number,
timerFrequency: number,
......
File added
File added
......@@ -331,6 +331,46 @@ impl Chip8Classic {
}
}
#[cfg_attr(feature = "wasm", wasm_bindgen)]
impl Chip8Classic {
pub fn load_rom_ws(&mut self, rom: &[u8]) {
self.load_rom(rom)
}
pub fn reset_ws(&mut self) {
self.reset()
}
pub fn reset_hard_ws(&mut self) {
self.reset_hard()
}
pub fn vram_ws(&self) -> Vec<u8> {
self.vram()
}
pub fn clock_ws(&mut self) {
self.clock()
}
pub fn clock_dt_ws(&mut self) {
self.clock_dt()
}
pub fn clock_st_ws(&mut self) {
self.clock_st()
}
pub fn key_press_ws(&mut self, key: u8) {
self.key_press(key)
}
pub fn key_lift_ws(&mut self, key: u8) {
self.key_lift(key)
}
}
impl Default for Chip8Classic {
fn default() -> Chip8Classic {
Chip8Classic::new()
......
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