

Forth is a language that was designed to be run on bare-metal – without an underlying operating system. Some interesting quotes from Chuck Moore:
The operating system is another concept that is curious. Operating systems are dauntingly complex and totally unnecessary. It’s a brilliant thing that Bill Gates has done in selling the world on the notion of operating systems. It’s probably the greatest con game the world has ever seen.
https://www.oreilly.com/library/view/masterminds-of-programming/9780596801670/ch04.html
Lisp did not address I/O. In fact, C did not address I/O and because it didn’t, it needed an operating system. Forth addressed I/O from the very beginning. I don’t believe in the most common denominator. I think that if you go to a new machine, the only reason it’s a new machine is because it’s different in some way and you want to take advantage of those differences. So, you want to be there at the input-output level so you can do that.
ibid
So, I was certainly interested in the idea of Forth running on bare-metal. What I found quickly was byok.
I was able to get it compiled fairly easily using the pre-built toolchain provided by the author. However, I had to delete two lines in the kernel directory Makefile:
diff --git a/kernel/Makefile b/kernel/Makefile
index b54cfb0..4ed0dc3 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -49,9 +49,7 @@ $(CRTN_OBJ) \
OBJ_LINK_LIST:=\
$(CRTI_OBJ) \
-$(CRTBEGIN_OBJ) \
$(OBJS) \
-$(CRTEND_OBJ) \
$(CRTN_OBJ) \
all: byok.kernel
The system boots up using Grub. The words display as expected.

I was able to create variables and store/pull data from them. However, a slight oddity is that the @ symbol and the ” symbol are swapped around on the keyboard, which had me confused for about 10 minutes. But I was fine after figuring that out.

The system comes with a nice block editor, for saving a program to block memory, though I think actual disk I/O is not coded yet.


And the dump word is available:

I’m definitely interested in playing around with this some more, and exploring what x86 architecture functionality is accessible with memory reads and writes.
Nothing like reinventing the wheel is there … to ignorant brains like mine interesting … but quite beyond my comprehension. Ah, I have a great friend at work who can help overcome my ignorance. Great article.
LikeLike
Byok: bring your own k?
LikeLike
I’m not quite sure what play on words is intended exactly, but I believe that is a reference to the forth word BYE, which is the program exit command, and the work OK, which appears after statements run successfully.
LikeLiked by 1 person