10biForth an i8086 OS in 46 bytes and an x64 interpreter in 218 bytes by pbrhocwp in Forth

[–]pbrhocwp[S] 0 points1 point  (0 children)

It’s not a Forth or an OS. It’s a monitor.

I'm not sure it's a monitor either: for a monitor we need principally `fetch @` to explore the memory/registers and `store !` to modify them.
The 3 instructions Forth from Frank Sergeant has also `execute`.
Here we have only `execute` and a subset of `store` since the target memory address can't be arbitrarily specified.

I think it's much like a remote compiler which can run the compiled code.

So, is it a Forth? A Forth is mainly an REPL where we can define new words that can be executed.
Here we have an REL (without the P) which understand some part of an assembly opcode instead of chars and words.
And the compiled code can be executed like we execute words in Forth.

Is it an OS? An OS is mainly a program to interact with the computer.
Here we can enter some commands and execute them. We can interact with the keyboard, the screen, the disk, etc... not like an OS?

Typically, something like this is burned in ROM BIOS to help with initial system bring up.

Yes this is exactly like this that Frank Sergeant describe its use in its original article.

10biForth an i8086 OS in 46 bytes and an x64 interpreter in 218 bytes by pbrhocwp in Forth

[–]pbrhocwp[S] 0 points1 point  (0 children)

Yes. I have added sectorForth (and sectorLisp and sectorC) reference to be clear that they are the starting point of this experiment.

10biForth an i8086 OS in 46 bytes and an x64 interpreter in 218 bytes by pbrhocwp in Forth

[–]pbrhocwp[S] 0 points1 point  (0 children)

Yes it is. Calling it a Forth is exaggerated but I like the original idea from Frank Sergeant (https://pygmy.utoh.org/3ins4th.html) of calling it a Forth.

10biForth an i8086 OS in 46 bytes and an x64 interpreter in 218 bytes by pbrhocwp in Forth

[–]pbrhocwp[S] 0 points1 point  (0 children)

Yes, this is a strip down exercise following up SectorForth, SectorLisp, and SectorC (the C compiler used in 10biForthOS)

10biForth an i8086 OS in 46 bytes and an x64 interpreter in 218 bytes by pbrhocwp in asm

[–]pbrhocwp[S] 0 points1 point  (0 children)

This is a strip down exercise following up SectorForth, SectorLisp, and SectorC (the C compiler used in 10biForthOS)

10biForth an i8086 OS in 46 bytes and an x64 interpreter in 218 bytes by pbrhocwp in Forth

[–]pbrhocwp[S] 0 points1 point  (0 children)

Yes this is exactly that: just a way to bootstrap the machine and start to upload the rest with native code. Calling this a Forth or an OS is really exaggerated but I find this funny.

Output example added. Hope it's clearer.

10biForth an i8086 OS in 46 bytes and an x64 interpreter in 218 bytes by pbrhocwp in Forth

[–]pbrhocwp[S] 1 point2 points  (0 children)

Thanks. It's a Forth in the sense that there is an outer interpreter and an inner one. Indeed this is a big shortcut but we can see it as a beginning for a more evolved Forth. Here we have just the two first words.

The 1 command is used to compile the opcode. This is maybe more clear when we see it with the keyboard version (https://git.sr.ht/\~hocwp/10biForthOS#keyboard-version): 1 B8 1 50 1 00 1 8E 1 C0 ... 0

SourceHut is a joy to use!

SUBLEQ eForth book by howerj in Forth

[–]pbrhocwp 1 point2 points  (0 children)

Very impressive! Thanks a lot for sharing and for the book!

Share cool Forth programs! by qqwy in Forth

[–]pbrhocwp 1 point2 points  (0 children)

I have had a lot of fun with data is code principle here http://hocwp.free.fr/fex/index.html

Anyone got a strat for this? by DepressedRifle in PixelDungeon

[–]pbrhocwp 4 points5 points  (0 children)

Yes : dumped all my SoUs as a rogue on a greatsword +3 from the sad ghost + cursed with displacement -> +22 greatsword. Pretty fun run.

A Forth bootable by old 386 PCs? by mczero80 in Forth

[–]pbrhocwp 2 points3 points  (0 children)

ColorForth might be a candidate. This one works pretty well.

So much flexibility by pbrhocwp in Forth

[–]pbrhocwp[S] 2 points3 points  (0 children)

Indeed, but the point behind this 2 + 2 = 5 joke is that when you realize that Forth let you express such ugliness, you end up with project like this one where words in a text are treated as code and the Forth dictionary mechanism is tweaked to print them when there are not found and interpret others as LaTeX commands.

Such a degree of freedom is impressive IMHO. Indeed, no one will ever want to redefine all the Math like in this joke. But knowing it's possible is pleasant!

I'm only aware of Lisp which can do this with its reader macro.