Ngaro 20110929

A portable virtual machine for a dual-stack architecture

  Add it to your Download Basket!

 Add it to your Watch List!


Rate it!

What's new in Ngaro 20110929:

  • This version brings updated versions of all implementations and substantially updated documentation.
  • There are now 14 implementations written in Python, Ruby, Perl, Common Lisp, x86 Assembly, ANS Forth, JavaScript, Retro, Lua, Java, C, C#, F#, and Go.
Read full changelog
send us
an update
Open Software License 
2.9/5 22
Charles Childers
ROOT \ System \ Emulators
Ngaro is a portable virtual machine for a dual-stack architecture. The instruction set is essentially a subset of Forth. Though limited in its ability to interact with the underlying OS, it should be sufficient to allow a variety of programs to be written and run on it.

The package includes some basic documentation, full source code, the machine forth compiler, and a few small examples.


./ngaro imagename

The instruction set is kept minimalistic. The exact set of instructions
changes occasionally, but the following list has been stable for about a
year. (The last three, dealing with the port-based I/O model, are new)

0 NOP Does nothing
1 LIT Push the value in the following cell to the stack
2 DUP Duplicate the top
item on the stack
3 DROP Drop the top item
on the stack
4 SWAP Exchange the top two
items on the stack
5 PUSH Push the top item on
the stack to the
address stack, drop
6 POP Pop the top item of
the address stack off
and put it on the
data stack
7 CALL Call the address that
the following literal
corresponds to
8 JUMP Jump to the address
that the following
literal corresponds
9 ; Return to the caller,
used with CALL
10 >JUMP Conditional jump. It
compares TOS and NOS.
11 Shift bits right
25 0; Exit (and drop) if
TOS is 0
26 1+ Increment TOS by 1
27 1- Decrement TOS by 1
28 IN Read a port
29 OUT Store to a port
30 WAIT Wait for a port-based
request to finish

If an unsupported opcode is encountered, the interal IP register is set to
the end of memory. Execution of the image code will halt when this happens.

A few instructions make use of a the following cell to contain addresses or
values. These are:

10 >jump

Last updated on October 3rd, 2011

#virtual machine #dual-stack architecture #hardware emulator #virtual #machine #VM #dual-stack

Add your review!