1
0
Fork
You've already forked laki
0
forked from tbsp/laki
A personal virtual machine based on Uxn/Varvara.
  • C 92.9%
  • Python 4.9%
  • Shell 1.4%
  • Makefile 0.8%
2024年12月11日 09:34:38 -08:00
.vscode Update debug port format (with fix) 2024年03月05日 12:29:50 -08:00
docs Rename RTS to RET and STS to FLP 2024年04月09日 09:27:46 -07:00
etc/legacy_core Update to new laki opcodes+core 2024年08月21日 13:27:18 -07:00
projects [laki] Change SFT from r: to k: mode set 2024年12月11日 09:34:38 -08:00
src [laki] Change SFT from r: to k: mode set 2024年12月11日 09:34:38 -08:00
.clang-format Add base uxnasm/uxncli/uxnemu code as starting point 2024年01月24日 13:32:10 -08:00
.gitignore (lakasm) Allow lambdas in macros (uxnasm port) 2024年04月02日 14:43:30 -07:00
build.sh [taka] Update build.sh for MMU 2024年11月12日 20:49:16 -08:00
LICENSE Add base uxnasm/uxncli/uxnemu code as starting point 2024年01月24日 13:32:10 -08:00
mkfile Add base uxnasm/uxncli/uxnemu code as starting point 2024年01月24日 13:32:10 -08:00
README.md Rename RTS to RET and STS to FLP 2024年04月09日 09:27:46 -07:00

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 (:)
  • FLP opcode added to flip/flop the working/return stacks
  • RET opcode added to return from subroutines
  • GRB opcode added for easy return stack access
  • DEC opcode added for symmetry with INC
  • NEQ opcode removed (use SUB or SUB2 ORA for 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

  • -2x Force medium scale
  • -3x Force large scale
  • -f Force 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

  • F1 toggle zoom
  • F2 toggle debug
  • F3 capture screen
  • F4 reboot
  • F5 soft reboot
  • F11 toggle fullscreen
  • F12 toggle decorations

GUI Buttons

  • LCTRL A
  • LALT B
  • LSHIFT SEL
  • HOME START

Need a hand?

The following resources are a good place to start: