Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.18 KB

README.md

File metadata and controls

45 lines (31 loc) · 1.18 KB

elsevm

A virtual machine implementation written in Go.

The main purpose was learning what is, how does it work and what could be done with a virtual machine by following the Write your Own Virtual Machine tutorial without copy-pasting the entire code, that's the reason why I used another language, Go instead of C.

Usage

Both 2048.obj and rogue.obj assembly programs are available.

In project's directory, compile:

go build

Run it, passing an assembly program as argument:

./elsevm 2048.obj
./elsevm rogue.obj

You can also run main file without compiling:

go run main.go 2048.obj
go run main.go rogue.obj

Feel free to test other assemblies.

Access the keyboard

Originally, termios.h was used in the tutorial to deal with input/output communication ports.

I have tried a similar behavior using bufio, a Go's standard library package. But I couldn't fix some bugs, which led me switching to eiannone keyboard library afterwards.