Just how compact can you make an implementation of a programming language, and still have a legitimate programming language? Inspired by projects such as milliForth, Philippe Brochard was determined to find out. The result of Brochard’s explorations is something called 10biForthOS, and it is most definitely small at just 46 bytes. But exactly what that “something” is is not entirely clear.
Brochard calls it a two-instruction implementation of Forth and a full 8086 operating system. After the machine boots the tiny code, all interaction with 10biForthOS is handled via a serial connection. The two available instructions are “compile” and “execute”. A compile instruction is followed by a byte representing an 8086 opcode, which is stored at a fixed memory location. After all instructions have been entered, an execute command does exactly what it sounds like — it executes the instructions.
The full 10biForthOS implementation (📷: Philippe Brochard)
It is debatable whether or not 10biForthOS really qualifies as an implementation of Forth. After all, Forth is a stack-oriented language, and 10biForthOS does not implement a stack. You will not find a dictionary or defining words, either. As such, it could be seen as a very basic assembly language IDE. But Brochard argues that the inner and outer interpreters, which interpret machine code and assembly code, respectively, are intact, and that is enough to count it as Forth.
You might also find the claim that it is an operating system a little hard to swallow. But it does provide I/O capabilities, filesystem access, and the ability to program the machine. So maybe it really is the world’s smallest operating system for an 8086?
Whatever it may be, the fact that it can boot up an 8086 and provide anything at all resembling a programming language or operating system in only 46 bytes is very impressive. Now the only question that remains is: Who can do it in 45?