This is an online editor & playground for MemeAssembly. Its concept is similar to the Go Playground, but the way it works is quite different.
Please note that this project is in a very beta state and doesn't work that well right now. Some syscalls (write, read) are implemented, but I am aware of some bugs that I have currently not found the solution for.
This project makes extensive use of WebAssembly. To compile and run a program, the following steps happen:
- The program is translated to the
x86_64
-Assembly text representation using the MemeAssembly compiler- In order to get the compiler running on the web, I compiled it with emscripten
- The resulting
x86_64
-Assembly text is assembled using my assembly-script assembler written in Rust, resulting inx86_64
binary code that could1 run on a real CPU- The main assembly work is done using the
iced-x86
crate
- The main assembly work is done using the
- This assembled binary code is then run using the Unicorn CPU Emulator compiled for WebAssembly
- The WebAssembly version of this emulator was created by @AlexAltea, my fork just makes sure the compilation works with newer emscripten versions
- Hooks are added to catch syscalls and do the correct actions (e.g. for reading/writing data from/to the terminal) that would happen on a real Linux system
- This syscall handler is quite basic and currently has some bugs where characters are written twice
Footnotes
-
Actually the assembler does some tricks that require a very special memory layout and setup to actually run the program, but the website/emulator implements that environment ↩