First experiences with Konilo

2024-03-12

A while ago I spent some time getting into RetroForth, and getting very interested in the VM that runs the language as well.

I thought I'd check in with this project again recently, and discovered that Charles Childers the author has moved forwards and is now implementing a full operating system based on this work!

Konilo, the Tool for Thinking

You get the following main parts for the system :- * ilo, the virtual machine (multicore CPU with a specialist instruction set, dual stack memory model) * ilo.rom, a 256KB image with the base system image (Retro Forth) * ilo.blocks, a 16MB “filesystem” pre-loaded with utility programs, documentation & examples

You can run this on a baremetal x86, using a multiboot binary for the VM, directly on a Sparkfun Teensy 4.1, in the browser (slowly) via an x86 emulator or more usefully from a terminal on your current computer with prebuilt binaries for Linux, *BSD, macOS, Windows, also Haiku, Mac System 5,6,7 and MS-DOS. If you prefer to build from source, help yourself to C, C#, C++, Lisp, Go, Kotlin, Lua, Nim, Python, Rust, Swift ... or hand-built assembly.

This isn't a simple “here, I figured out how to build it” project. This is a “if it's going to be done portably, we need to show it being done everywhere” demonstration of skill. If you want to learn any of those other languages, the ilo VM makes a great Rosetta Stone to compare with.

Using Konilo

Despite the technical excellence of the implementation, Konilo (currently on it's second release, 2023.10) isn't all that friendly to get started with. You have to have the right files in the current working directory, and get used to REPL loops that don't identify themselves with anything as helpful as a prompt.

So grab the tarball or zip file from (http://konilo.org/), and unpack it somewhere. From a command-line, go to the top-level of the package, and execute one of the VMs from the bin directory. For my Linux PC, that's bin/ilo-amd64-linux. Hopefully you'll get the Welcome messages then you'll have a simple input line waiting for you to say something incisive. Try “bye” to immediately exit :–)

$ bin/ilo-amd64-linux 

Welcome to Konilo                                               
                                                                
 ,dPYb,                                    ,dPYb,               
 IP'`Yb                                    IP'`Yb               
 I8  8I                               gg   I8  8I               
 I8  8bgg,                            ""   I8  8'               
 I8 dP" "8    ,ggggg,   ,ggg,,ggg,    gg   I8 dP    ,ggggg,     
 I8d8bggP"   dP"  "Y8  ,8" "8P" "8,   88   I8dP    dP"  "Y8     
 I8P' "Yb,  i8'    ,8I d8   8I   8I   88   I8P    i8'    ,8I    
,d8    `Yb,,d8,   ,d8P8P    8I   Yb,_,88,_,d8b,_ ,d8,   ,d8'    
88P      Y8P"Y8888P"        8I   `Y88P""Y88P'"Y88P"Y8888P"      
                                                                
`manual` for the users guide                                    
`blocks` for help using the block editor                        
`describe name` for help on a specific word                     
`catalogue` to explore the blocks                               

The suggested commands manual, blocks and catalogue all run a console-based text user interface called (termina), which expects a screen that's at least 75 columns wide and 20 lines high (configurable, but that comes later!). The bottom 3 lines are reserved for a help section showing the current numeric selections that will work, and the convention is that 0 will quit from these at any time, returning you to the main RetroForth REPL – but there's no prompt, so you have to know where you are ...

Another gotcha is that there is nothing in the way of command history or autocomplete. If you're on a unix, and you have access to the rlwrap command, there's an autocomplete file in the source distribution (a separate download direct from the author's Fossil repository, or via a Git-based mirror on SourceHut) – see the example ri.sh script.

That's all for my initial noodling around, I hadn't noticed this project starting up but this will be fun I hope ...