Go + Computer = goputer
A computer emulator/virtual machine that intends to demonstrate how basic computers work at a low level.
Contents
- Custom assembly language and compiler.
- Custom runtime.
- Standalone executables.
- Frontends to show VM output.
- A WASM based runtime that runs in a web browser.
- Expansion cards/modules.
- IDE for easy development.
- Rewrite of compiler.
- High level language.
- Non-native plugins via Lua.
See the project wiki or try the playground at goputer.oscarcp.net.
frontends
Contains source for the frontends.frontends/web
The WASM frontend.frontends/gp32
The Go frontend.frontends/goputerpy
The Python frontend.examples
A list of example code to get started with.cmd/goputer
The CLI tool for compiling, running & disassembling code.cmd/launcher
The GUI for running code.pkg
Shared code. Includes the compiler, VM runtime and constants for instructions and registers.
Build instructions for Linux, other platforms are not supported at the moment as native plugins do not work at all. See plugin
If you have Docker installed, you can build goputer in Docker without installing additional dependencies by running:
./docker_entrypoint.sh
This will build the container and then run mage dev
inside the container, outputting to the build directory.
Note: This uses a Fedora container, so the output will only work on Linux based systems.
Perquisites
-
Languages
- Python ^3.10
- Go ^1.19
- NodeJS ^18.X
-
Build tools
-
Library requirements
Requirements for different display servers & audio.
libgl1-mesa-dev libxi-dev libxcursor-dev libxrandr-dev libxinerama-dev
libgl1-mesa-dev libwayland-dev libxkbcommon-dev
libasound2-dev
mesa-libGL-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel
mesa-libGL-devel wayland-devel libxkbcommon-devel
alsa-lib-devel
Building
-
Install the prerequisites that are mentioned above.
-
Check that everything works.
$ node --version v18.12.1 $ mage --version Mage Build Tool v1.14.0 Build Date: 2022-11-09T16:45:13Z Commit: 300bbc8 built with: go1.19.3 $ poetry --version Poetry version 1.1.13
-
Clone the repository from GitHub
git clone https://github.com/sccreeper/goputer cd goputer
-
Build the project. (This step shouldn't take that long depending on your hardware)
mage dev
Alternatively you can run
mage all
to not build the examples. -
Go to the build directory and run the
hello_world
example.cd build ./goputer run -f gp32 -e ./examples/hello_world
There a small suite of tests written for testing the core of goputer.
To run them use:
go test ./tests -v
- Raylib Go Bindings - gen2brain/raylib-go
- Very useful rendering library.
- See also: Raylib - raysan5/raylib
- Beep - faiface/beep
- Used for producing sound on the fly.
- TOML - BurntSushi/toml
- Configuration format used by frontends.
- See also: TOML - toml-lang/toml
- pygame - pygame/pygame
- Used for rendering & sound output.
- numpy - numpy/numpy
- Used partially for sound generation
- poetry - python-poetry/poetry
- Very useful for Python dependency management.
- Tailwind CSS - tailwindlabs/tailwindcss
- CSS library used to build the UI.
- Parcel - parcel-bundler/parcel
- Module bundler.
- Parcel Static Files Copy - elwin013/parcel-reporter-static-files-copy
- Used for copying static files into the final dist directory.
- Bootstrap Icons - twbs/icons
- Icons used heavily by the UI.
- Microtip - ghosh/microtip
- Tooltip library used in UI.
- CLI - urfave/cli
- Used by the compiler for getting input from the terminal.
- Color - fatih/color
- Used for colouring & formatting the terminal output i.e. making it look nice.
- Termlink - savioxavier/termlink
- Inserting links into the terminal.
- Fyne - fyne-io/fyne
- UI library used
- dialog - sqweek/dialog
- Used for file open dialogs.
- Mage - magefile/mage
- Build system used for development.
MIT - Refer to the LICENSE
file