For nostalgic reasons, I want to create a Gameboy emulator.
Bad news: I don't know the heads or tails of how to program an emulator.
r/EmuDev recommends the Chip-8 as the gateway drug of choice for emulator development, so that is what I have built here.
This emulator has 3 ROMs embedded into it - mostly to avoid the hassle of opening a file and loading the ROM in WASM.
You can modify the code to use other Chip-8 ROMs.
I have hosted the WASM build here with 3 pre-loaded roms.
go build -o emulator
./emulator [PONG | TANK | TETRIS]
$GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o chip8.wasm
# Start a server which serves the index.html file
$python3 -m http.server 8080
# Go to localhost:8080 where you will find the emulator running on a web-frontend
https://github.com/user-attachments/assets/23af413b-d5ab-4bf2-a86f-49296ea57c62
I have attachmed a wasm_exec.js file - you might have to use your own one for the WASM build.
Copy your wasm_exec.js into the base directory using:
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .