- C 92.9%
- Python 4.9%
- Shell 1.4%
- Makefile 0.8%
| .vscode | Update debug port format (with fix) | |
| docs | Rename RTS to RET and STS to FLP | |
| etc/legacy_core | Update to new laki opcodes+core | |
| projects | [laki] Change SFT from r: to k: mode set | |
| src | [laki] Change SFT from r: to k: mode set | |
| .clang-format | Add base uxnasm/uxncli/uxnemu code as starting point | |
| .gitignore | (lakasm) Allow lambdas in macros (uxnasm port) | |
| build.sh | [taka] Update build.sh for MMU | |
| LICENSE | Add base uxnasm/uxncli/uxnemu code as starting point | |
| mkfile | Add base uxnasm/uxncli/uxnemu code as starting point | |
| README.md | Rename RTS to RET and STS to FLP | |
Laki
An assembler and emulator for the Laki stack-machine, written in ANSI C.
Laki is in early stages of development and dramatic changes are likely to occur!
This codebase was forked from the Uxn ANSI C virtual machine, and would not have been possible without the hard work of Devine Lu Linvega, Andrew Alderwick, Andrew Richards, and many others. The vast majority of this code (plus this readme) was written by them.
The main changes from Uxn are:
- Return mode (
r) replaced with immediate mode (:) FLPopcode added to flip/flop the working/return stacksRETopcode added to return from subroutinesGRBopcode added for easy return stack accessDECopcode added for symmetry withINCNEQopcode removed (useSUBorSUB2 ORAfor conditional jumps)
Build
Linux/OS X
To build the Laki emulator, you must install SDL2 for your distro. If you are using a package manager:
sudo pacman -Sy sdl2 # Arch
sudo apt install libsdl2-dev # Ubuntu
sudo xbps-install SDL2-devel # Void Linux
brew install sdl2 # OS X
Build the assembler and emulator by running the build.sh script. The assembler(lakasm) and emulator(taka) are created in the ./bin folder.
./build.sh
--debug # Add debug flags to compiler
--format # Format source code
--install # Copy to ~/bin
If you wish to build the emulator without graphics mode:
cc src/devices/datetime.c src/devices/system.c src/devices/console.c src/devices/file.c src/laki.c -DNDEBUG -Os -g0 -s src/lakli.c -o bin/lakli
Plan 9
To build and install the Laki emulator on 9front, via npe:
mk install
If the build fails on 9front because of missing headers or functions, try again after rm -r /sys/include/npe.
Windows
Laki can be built on Windows with MSYS2. Install by downloading from their website or with Chocolatey with choco install msys2. In the MSYS shell, type:
pacman -S git mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-SDL2
export PATH="${PATH}:/mingw64/bin"
git clone https://codeberg.org/tbsp/laki.git
cd laki
./build.sh
If you'd like to work with the Console device in taka.exe, run ./build.sh --console instead: this will bring up an extra window for console I/O unless you run taka.exe in Command Prompt or PowerShell.
Getting Started
Emulator
To launch a .aki in the emulator, point the emulator to the target rom file:
bin/taka2 bin/piano.aki
You can also use the emulator without graphics by using lakli.
Assembler
The following command will create an Laki-compatible rom from a lakital file. Point the assembler to a .lak file, followed by and the rom name:
bin/lakasm projects/examples/demos/life.lak bin/life.aki
I/O
You can send events from Laki to another application, or another instance of Laki, with the Unix pipe.
taka2 orca.aki | shim
GUI Emulator Options
-2xForce medium scale-3xForce large scale-fForce fullscreen mode--Force next argument to be read as ROM name. (This is useful if your ROM file is named-v,-2x, and so forth.)
GUI Emulator Controls
F1toggle zoomF2toggle debugF3capture screenF4rebootF5soft rebootF11toggle fullscreenF12toggle decorations
GUI Buttons
LCTRLALALTBLSHIFTSELHOMESTART
Need a hand?
The following resources are a good place to start: