It’s not often that we can include an operating system in a Hackaday article, but here’s the full 46-byte source of [Philippe Brochard]’s 10biForthOS in 8086 opcodes:
50b8 8e00 31d8 e8ff 0017 003c 0575 00ea
5000 3c00 7401 eb02 e8ee 0005 0588 eb47
b8e6 0200 d231 14cd e480 7580 c3f4
Admittedly, this is quite a minimal operating system. It’s written for the Intel 8086, and consists of a Forth implementation with only two instructions: compile (1) and execute (0). It can receive commands over a serial connection or from a keyboard. This allows a host computer to load more complex software onto it, one byte at a time. In particular, [Philippe] provides instructions for loading more advanced compilers, such as subleq-eForth for a more complete Forth implementation, or SectorC for C programming. He’s also written a 217-byte port of the OS to Linux Intel x64.
[Philippe] doesn’t take a strong stance on whether this should technically qualify as a Forth implementation, given that the base implementation lacks stacks, dictionaries, and the ability to define words. However, it does have an outer and inner interpreter, the ability to compile and execute code, and most importantly, “the simplicity and hacky feeling of Forth.”
[Philippe] writes that this masterpiece of minimalism continues the tradition of the minimal Forth implementations we’ve covered before. We’ve even seen Forth run on an Arduino.
Hi, I think this is more of a basic monitor program at this stage.
Next would be adding a debugger, maybe. It’s a start, though! 🙂
Imagine an OS small enough to fit into a HaS comment field.
Quite silly to call this an “operating system”. You could call it a monitor or a boot loader. I am opposed the watering down of definitions just to grab some attention. In the long term it only ads crud to searches and makes the internet more difficult to use.
The minimum I would dare call an operating system (in modern times) would probably be micropython. It has a file system, you can load and store and execute programs from the file system. It even has a sort of “autoexec.bat” batch file, so you can set which program it runs after booting. My knowledge of uPython is quite limited though. I once flashed it in a Black Pill (after soldering on NAND Flash) and toyed with it for an afternoon of two.
ARM uC’s can also execute programs from RAM (There is a tutorial for overlays in the book “Beginning STM32 from Warren Gay https://doi.org/10.1007/978-1-4842-3624-6 ) Extending uPython with some “OS like” commands to make it resemble more of the old DOS, CP/M or Linux command line functions would be intriguing.
Micropython board also acts as an extension of your own PC. My Linux PC sees the uPython board in it’s file system, I can directly load python sourcecode from it in a text editor, and then save it back.
A operating system does not necessarily need to have a filesystem. A tv remote doesn’t have a filesystem but yet it’s microcontroller have a preprogrammed sequence for each button in order to give the tv a command.
A TV remote might have a program inside it. Not an operating system. An operating system is not an application, it is not a bootloader, and it is not a monitor. It is more than those parts. I dont have an exact definition right now, but I would start with the words it is composed of. “Operating” and “System”.
A lot of people independently invented Forth style interpretation in the 1980’s, particularly on 6502. However they did not put all the pieces together that make Forth so versatile with the exception of PostScript (Warnock has always claimed he had never seen Forth). I think that without a stack and stack operation primitives like SWAP ROT DUP + */ etc. and flow control you should not call it Forth.
The BIOS is the operating system. That should be obvious. Or Linux on that version. This is called a “bootstrap”. Or perhaps a virus payload, because that is the most common use of such things of late. Having programs write machine code into instruction space and then execute it is something most real OS would prevent these days, for any but the most privileged programs, if even those.
This is essentially bootstrapping right? The initial steps in running a computer that comes with no OS or software.
This is Not FORTH. FORTH is a virtual machine that shouldn’t require the knowledge of any processor op codes. There are variants that have built in words like multiplication, and smaller versions that make you write a successive adder in FORTH commands that run slower, but that is implementation dependent. There may be some predefined constants (like I/O locations) or they may be
magic numbers that you are expected to know. Still Forth. You can build stacks for lots of different things, and they may run slow, but no opcodes are really necessary. This is a very old debate.
I know you can write an editor, assembler and linker in forth. Doesn’t make it an OS.
And yes, you can write a Operating system in FORTH with the usual functions :
Memory Management, Multitasking, Interrupts, Message Passing, I/O etc.
It just gets slow without hardware and processor opcodes. That doesn’t make
everything, especially a byte loader, a FORTH system.
-Gar.
Consider Lua which can support small micros such as ESP32
I have a feeling the [static Forth] is a subset of a large static know-able seeable set of names to xor thru. Otherwise how know?