Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 16 submissions in the queue.
posted by Fnord666 on Wednesday June 10 2020, @02:57AM   Printer-friendly
from the a-new-OS-is-forth-coming dept.

It appears the leadership of Collapse OS have decided to switch from Z-80 to Forth. In this article, they explain their reasoning.

Collapse OS' first incarnation was written in Z80 assembler. One of the first feedbacks I had after it went viral was "why not Forth?". I briefly looked at it and it didn't seem such a great choice at first, so I first dismissed it. Then, I had what alcoholics refer to as a "Moment of clarity".

[...] The Z80 asm version of Collapse OS self-hosts on a RC2014 with a 5K shell on ROM, a 5K assembler binary loaded in RAM from SD card (but that could be in ROM, that's why I count it as ROM in my project's feature highlights) and 8K of RAM. That is, it can assemble itself from source within those resources.

[...] If I wanted to re-implement that assembler feature-for-feature in Forth, it would probably require much more resources to build. Even though higher level words are more compact, the base of the pyramid to get there couldn't compete with the straight assembler version. This was under this reasoning that I first dismissed Forth.

So, again, what makes Forth more compact than assembler? Simplicity. The particularity of Forth is that it begins "walking by itself", that is, implementing its own words from its base set, very, very early. This means that only a tiny part of it needs to be assembled into native code. This tiny part of native code requires much less tooling, and thus an assembler with much less features. This assembler requires less RAM.

What is more compact than something that doesn't exist? Even Z80 assembler can't beat the void.

That's how although Forth is not more compact that native code (duh!), a Forth Collapse OS achieves self-hosting with as much resources than its Z80 counterpart.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 4, Insightful) by driverless on Wednesday June 10 2020, @03:26AM (3 children)

    by driverless (4770) on Wednesday June 10 2020, @03:26AM (#1005629)

    Uhh... it's a minimal operating environment for a Z80, sort of like CP/M from nearly half a century ago but not as sophisticated. Why is this news?

    And if the news is Forth, that's also half a century old and since Forth is interactive it's been a sort of shell/operating system from day one. In particular microFORTH has been running on most of the popular 8-bit CPUs for 40+ years.

    Starting Score:    1  point
    Moderation   +2  
       Insightful=1, Informative=1, Total=2
    Extra 'Insightful' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   4  
  • (Score: 0) by Anonymous Coward on Wednesday June 10 2020, @03:34AM

    by Anonymous Coward on Wednesday June 10 2020, @03:34AM (#1005637)

    CP/M doesn't self assembles on those kind of resources. Is microforth self-hosting on its target machines?

  • (Score: 5, Informative) by RamiK on Wednesday June 10 2020, @12:49PM

    by RamiK (1813) on Wednesday June 10 2020, @12:49PM (#1005775)

    Why Collapse OS?

    https://collapseos.org/why.html [collapseos.org]
    https://collapseos.org/roadmap.html [collapseos.org]

    It's a prepper's OS.

    Why is this news?

    Putting aside the civilization collapse silliness, we could use something like Open Firmware [wikipedia.org] with lots of input and storage peripheral drivers to kickstart new non-C-compatible architecture that's targeting MCUs. That is, future novel architectures would want to have a tiny MCU loading their actual OS into their novel compute cores instead of falling into the x86's dos mode pitfall or ending up like the RasPi with a custom written bootloader for each board version as it needs to support new peripheral since someone thought it would make sense having the proprietary GPU cores boot first.

    --
    compiling...
  • (Score: 0) by Anonymous Coward on Wednesday June 10 2020, @07:15PM

    by Anonymous Coward on Wednesday June 10 2020, @07:15PM (#1005947)

    Look at it this way: working on this keeps them off the streets and messing up traffic. We could use a lot more of that these days.