L1VM logo small

L1VM is an incredible tiny virtual machine with RISC (or comparable style) CPU, about 61 opcodes and about 40 KB binary size on X86_64 Linux (without JIT-compiler)! The VM has a 64 bit core (256 registers for integer and double float) and can run object code written in brackets (a high level programming language) or l1asm assembly language.

Code and data are in separated memories for a secure execution. Like in Harvard type CPUs (found now in DSPs or microcontrollers). The opcode set with 61 opcodes is my own opinion how things should work. It does not “copy” other instruction sets known in other “real” CPUs.

The design goals are:

- be small
- be fast
- be simple
- be modular

The source code is on my GitHub repository: github.com/koder77/l1vm

A simple “Hello world!” program:

// hello.l1com
(main func)
	(set int64 1 zero 0)
	(set string 13 hello "Hello world!")
	// print string:
	(6 hello 0 0 intr0)
	// print newline:
	(7 0 0 0 intr0)
    // exit with error code 0:
	(255 zero 0 0 intr0)
(funcend)

So for printing a string some interrupts are used there. In the GitHub repo threre are lots of more advanced examples!