NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Tumble Forth – from assembly to OS with C compiler (2023) (tumbleforth.hardcoded.net)
irchans 17 hours ago [-]
For years I've had an idea in my head to add a Forth to the old game Master of Orion so that I could automate some of my common actions in the game. There is an open source GIThub called 1oom with source code for the game and I thought I would just write my own Forth. Well, I've recently been using AI's to code, so I asked GPT and it suggested that I use ficl rather than writing my own Forth. It helped me add ficl to 1oom. I've added Forth words to access most of the game variables and I've just begun adding forth words that can manipulate the game state. It's been fun. I had not written much, if any, Forth code in the last 30 years, so it's been a fun trip down memory lane.
jackb4040 18 hours ago [-]
I think it's a bit silly to assume that a supply chain collapse will lead people to using your handmade unoptimized systems stack and not well-understood commodity OSes like Linux or FreeRTOS.

Reminds me of preppers hoping for an apocalypse that makes their buckets of dried food valuable but leaves their access to fresh water and medicine intact.

It's probably an interesting series regardless, I just find that framing silly

andai 17 hours ago [-]
The bloat will continue until morale improves.
fjfaase 23 hours ago [-]
For the C compiler that I developed to replace the GNU Mes compiler in the live-bootstrap project, I also used a Forth like language that uses two stack. One stack for parameters and return values and one for the return addresses and local variables. The Forth like language is transpiled in assembly and through some steps made into an ELF file. The targets are: x86, x86_46, and arm64. Work on supporting riscv64 has started, but is currently on hold due to other responsibilities. If there is anyone willing to complete it, I do have some small funds as a bonus.
romforth 5 hours ago [-]
https://github.com/romforth/romforth already has a port to RISV-V for both 32 and 64 bit, (among many others). So if you don't mind lowering your language implementation to romforth (or even rewriting your compiler to directly generate it), you should be able to use it "for free", no funds required ;)
drivers99 22 hours ago [-]
Oh yeah, this is right up my alley. I've been thinking about making a Forth on bare metal for a while (made a Forth interpreter in C last summer, and a tiny amount of testing stack manipulation in hand-assembled machine language on a C64U), and the thought I (coincidentally) had moments before seeing this link was about making a boot sector on some floppies I just got for my 8088 IBM PC. I know that will only work for the Real Mode part but it might be fun to start there anyway. Edit: I knew about CollapseOS but didn’t realize this had been around too.
zovirl 21 hours ago [-]
> An alternate way to go about this is to sidestep that complexity entirely and build your own OS.

> We'll go bare metal and then build an operating system of our own, with a C compiler of our own. It's simpler this way.

I love the audacity of those statements. And I appreciate this sort of approach which says "let's implement the simplest possible version of _______ to learn how it is done."

dang 22 hours ago [-]
Related. Others?

Tumble Forth - https://news.ycombinator.com/item?id=38184539 - Nov 2023 (22 comments)

einpoklum 1 days ago [-]
Point of clarification: Rummaging through that site, and as far I can see - the Forth language is not used.
astrobe_ 1 days ago [-]
It is. When you read "6. A Tale Of Two Stacks" you can be pretty sure that Forth is involved.
zovirl 21 hours ago [-]
They start implementing their Forth in chapter 4: https://tumbleforth.hardcoded.net/01-duskcc/04-wordsshell.ht...
ozonator 1 days ago [-]
Did you miss the C compiler written in Forth?
just60sec 14 hours ago [-]
[dead]
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 22:36:43 GMT+0000 (Coordinated Universal Time) with Vercel.