Not exactly retro: KnightOS (TI Z80 Calculator OS)

While just about a decade old, this ticks several of the usual retro marks: Z80 assembly code, handheld calculators, 64K segments of storage, an OS operating under severe restrictions, a kernel fitting into just 4KiB, and, finally, the graveyard charm of a (mostly) abandoned technology.

KnightOS is an operating system I started writing about 10 years ago, for Texas Instruments line of z80 calculators — the TI-73, TI-83+, TI-84+, and similar calculators are supported. (…) it was a really interesting operating system which was working under some challenging constraints, and overcame them to offer a rather nice Unix-like environment, with a filesystem, preemptive multiprocessing and multithreading, assembly and C programming environments, and more. The entire system was written in handwritten z80 assembly, almost 50,000 lines of it, on a compiler toolchain we built from scratch.

The flash memory storage is, where it gets really interesting, with the restrictions posed on the system in order to economically operate the NOR flash storage of these devices, this starts to remind of typical loopholes of retro architectures:

The non-volatile storage was NOR Flash, which presents some interesting constraints. (…) Due to the constraints of NOR Flash, a custom filesystem was designed which did all daily operations by only resetting bits in the underlying storage. In order to set any bits, we had to set the entire 64 KiB sector to 1. Overhead was also kept to a bare minimum here to maximize storage space available to users.
Writing to Flash storage also renders it unreadable while the operation is in progress. The kernel normally executes directly from Flash, resident at the bottom of the memory. Therefore, in order to modify Flash, the kernel’s Flash driver copies part of itself to RAM, jumps to it, and then jumps back after the operation is complete.

Sometimes, retro is just about yesterday…

Via HN, https://news.ycombinator.com/item?id=22165066

3 Likes

Here’s a video tour (WebM) of KnightOS: https://yukari.sr.ht/knightos.webm