KnightOS - For Texas Instruments calculators

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
SirCmpwn
Member
Member
Posts: 34
Joined: Thu Mar 06, 2014 4:57 pm

KnightOS - For Texas Instruments calculators

Post by SirCmpwn »

Hi! Lurked here for a while, and decided to post about my own project today. It's not nearly as cool as some of the neat x86 OSes I see here, but it's mine and I love it.

KnightOS

http://www.knightos.org/

Remember that old TI calculator in your closet? The one you bought as a high school freshman and forgot about after you left school. I never forgot about mine, and I've spent the past three and a half years building an operating system for the little buggers. These calculators have a z80 inside. Specs vary by device, but the most common is clocked at 15 MHz, with 48K of RAM, and 2MB of Flash ROM. KnightOS is a single-user OS for these calculators, with preemptive multitasking, dynamic memory management, a tree-based filesystem based on the FHS, IPC, and loads of other goodies. It is written entirely in z80 assembly. Here's a video I recently made about the brand-new TI-84+ Color Silver Edition and KnightOS:



How do I try it?

Source code: kernel, userspace

Code: Select all

$ git clone --recursive git://github.com/KnightOS/KnightOS.git
$ cd KnightOS
$ make run # Run it in an emulator
If you want to run it on real hardware, there are instructions in the README. Build depends on Mono, and the emulator depends on Wine (I'm working on a replacement emulator).

Technical Details

I built most of the toolchain for this OS from scratch. The tools already available were very dated (the z80 came out in 1976, after all), so I wrote some more modern ones. The source code for all of these tools is here. I've also spent a lot of time documenting everything. I also built my own filesystem for the things, whose spec is here. These calculators have NAND Flash, which means there's a lot of special things to consider when designing a filesystem, and most common filesystems aren't really up to the task in such a limited enviornment.

How do I get involved?

I would love some extra help. There are a few extra contributors helping out, but this is such a big project that it'd really help if there was more. Feel free to join the IRC channel, #knightos on Freenode, to get involved or just to chat. I accept pull requests and would be happy to help you familiarize yourself with the code. That's all I have to say! I hope you like this project, it's my pride and joy. Let me know if you have any questions.
embryo

Re: KnightOS - For Texas Instruments calculators

Post by embryo »

SirCmpwn wrote:KnightOS
Really nice work! Unfortunately the area where it can be used is too small. But it's a lot of work!
User avatar
bwat
Member
Member
Posts: 359
Joined: Fri Jul 03, 2009 6:21 am

Re: KnightOS - For Texas Instruments calculators

Post by bwat »

SirCmpwn wrote:It's not nearly as cool as some of the neat x86 OSes I see here
Yes it is.
embryo wrote:Unfortunately the area where it can be used is too small.
It looks like it is well suited to its ecological niche.
Every universe of discourse has its logical structure --- S. K. Langer.
embryo

Re: KnightOS - For Texas Instruments calculators

Post by embryo »

bwat wrote:It looks like it is well suited to its ecological niche.
Yes, but the niche is too small ...

Hopefully the experience gained will deliver some profit for the author.

By the way - big modern systems without good architecture are not feasible. And the architecture supposes high level languages. OSes written in assembler are a good start for microcontroller programming and all the likes.
User avatar
bwat
Member
Member
Posts: 359
Joined: Fri Jul 03, 2009 6:21 am

Re: KnightOS - For Texas Instruments calculators

Post by bwat »

embryo wrote:
bwat wrote:It looks like it is well suited to its ecological niche.
Yes, but the niche is too small ...

Hopefully the experience gained will deliver some profit for the author.
Two points:
  • He may not share your definition of success.
  • He's probably going to have more users than most, if not all, project operating systems developed by OSDevers here.
embryo wrote:
By the way - big modern systems without good architecture are not feasible. And the architecture supposes high level languages. OSes written in assembler are a good start for microcontroller programming and all the likes.
The hierarchical structure common to most modern operating systems and the semaphore was first implemented in assembler. See http://www.cs.utexas.edu/users/EWD/ewd01xx/EWD196.PDF.
As for big, that's not necessarily a good thing.

[Edit: I misunderstood legacy mode so I've removed a comment.]
Every universe of discourse has its logical structure --- S. K. Langer.
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: KnightOS - For Texas Instruments calculators

Post by Bender »

Whoah!
Amazing! Never seen anything like this. Since I am not experienced in anything further than x86 or ARM, I could just stare and look at this great piece of code. :)
Cool? It's super cool! My question to you would be how difficult was it to write such a thing on limited and less documented hardware? Guess x86 was too common. :)
Forgive me for my ignorance but do any of you know any C or any HL compiler that targets the TI Calculators?
BTW I have never seen a TI Calculator in my life. :P
-Bender
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: KnightOS - For Texas Instruments calculators

Post by Antti »

@SirCmpwn: Excellent video, web-pages, documentation, etc.
bwat wrote:He's probably going to have more users than most, if not all, project operating systems developed by OSDevers here.
This is so true. At least a very good point.
SirCmpwn
Member
Member
Posts: 34
Joined: Thu Mar 06, 2014 4:57 pm

Re: KnightOS - For Texas Instruments calculators

Post by SirCmpwn »

Hi guys, thanks for all the comments! I took a family picture yesterday that you guys might like:

Image

By the way, I helped make that image/audio/video hosting site, too, if you're interested (source code).
embryo wrote:Yes, but the niche is too small ...
Every American high schooler has one of these in his or her backpack. I can't speak for other countries, but these devices are very prevelant here.
embryo wrote:By the way - big modern systems without good architecture are not feasible. And the architecture supposes high level languages. OSes written in assembler are a good start for microcontroller programming and all the likes.
I've been thinking about a C interface to the kernel, so that userspace programs can be written in C. I am also planning on writing a python-like interpreter to be the default shell (with fancier maths support so it's suitable for a student's default interface).
Bender wrote:Amazing! Never seen anything like this. Since I am not experienced in anything further than x86 or ARM, I could just stare and look at this great piece of code. :)
Here's a crash course in z80 assembly, for anyone who wants to understand the codebase a little more: ld is like mov. There are several 16-bit registers: AF, BC, DE, HL, IX, IY, SP, and PC, the latter two being the stack pointer and program counter. Some of these registers can be used as two 8-bit registers: A, B, C, D, E, H, and L. ld (0x8000), hl loads HL into address 0x8000, little endian. If you see any instructions that look like they should have two operands, but only have one (i.e. or b), they operate on the accumulator (that one is equivalent to or a, b).
Bender wrote:Cool? It's super cool! My question to you would be how difficult was it to write such a thing on limited and less documented hardware? Guess x86 was too common. :)
It wasn't too difficult. I knew assembly long before I knew C, I'm very comfortable with it. As for hardware documentation, the rest of the TI hacking community has been kind enough to reverse engineer it while I've been off playing in osdev land.
Bender wrote:Forgive me for my ignorance but do any of you know any C or any HL compiler that targets the TI Calculators?
SDCC supports z80. I did not use it because it produces code that is too slow and bloated for my tastes - the entire KnightOS kernel (in assembly) is about 9K right now.
embryo

Re: KnightOS - For Texas Instruments calculators

Post by embryo »

SirCmpwn wrote:Every American high schooler has one of these in his or her backpack. I can't speak for other countries, but these devices are very prevelant here.
And what about smartphones? Are all those Blackberries and Androids used in high school? And desktop PCs, I hope, should have very wide niche.

However - for me it is very interesting news about high school tools preference.
SirCmpwn wrote:I've been thinking about a C interface to the kernel
If it is all about high school, then there should be Python or other scripting language. It should be simple, just like Basic.
SirCmpwn wrote:ld is like mov. There are several 16-bit registers: AF, BC, DE, HL, IX, IY, SP, and PC, the latter two being the stack pointer and program counter. Some of these registers can be used as two 8-bit registers: A, B, C, D, E, H, and L.
Interesting. The Z80 is a successor of Intel's 8080 chip. And x86 architecture also has it's roots in 8080 chip. But it seems Z80 is different because 8080 has 8-bit registers. Also about the ld command - 8080 has mov instruction (as far as I can remember), why it was renamed in z80?
SirCmpwn wrote:It wasn't too difficult. I knew assembly long before I knew C
But it has taken 4 years - this is the difficult part. Keeping working during 4 years is not so easy.
SirCmpwn
Member
Member
Posts: 34
Joined: Thu Mar 06, 2014 4:57 pm

Re: KnightOS - For Texas Instruments calculators

Post by SirCmpwn »

embryo wrote:And what about smartphones? Are all those Blackberries and Androids used in high school? And desktop PCs, I hope, should have very wide niche.
These calculators are required for standardized testing.
embryo wrote:
sircmpwn wrote:I've been thinking about a C interface to the kernel
If it is all about high school, then there should be Python or other scripting language. It should be simple, just like Basic.
Later on in that sentence, I mentioned that a Python-like language is planned.
embryo wrote:Interesting. The Z80 is a successor of Intel's 8080 chip. And x86 architecture also has it's roots in 8080 chip. But it seems Z80 is different because 8080 has 8-bit registers. Also about the ld command - 8080 has mov instruction (as far as I can remember), why it was renamed in z80?
I'm not certain, I haven't researched the history of these CPUs.
embryo wrote:But it has taken 4 years - this is the difficult part. Keeping working during 4 years is not so easy.
Well, I have only been working on this off and on in my spare time.
SirCmpwn
Member
Member
Posts: 34
Joined: Thu Mar 06, 2014 4:57 pm

Re: KnightOS - For Texas Instruments calculators

Post by SirCmpwn »

A friend implemented some trig in the kernel and sent me this:

Image
User avatar
Pancakes
Member
Member
Posts: 75
Joined: Mon Mar 19, 2012 1:52 pm

Re: KnightOS - For Texas Instruments calculators

Post by Pancakes »

I seen someone mention Python. But, also Lua is an option. Python is really great, but very large and Lua is likely to be ported much easier. Just a cool idea.
SirCmpwn
Member
Member
Posts: 34
Joined: Thu Mar 06, 2014 4:57 pm

Re: KnightOS - For Texas Instruments calculators

Post by SirCmpwn »

Image
User avatar
bwat
Member
Member
Posts: 359
Joined: Fri Jul 03, 2009 6:21 am

Re: KnightOS - For Texas Instruments calculators

Post by bwat »

embryo wrote:Also about the ld command - 8080 has mov instruction (as far as I can remember), why it was renamed in z80?
Because Zilog wasn't Intel. I'm not sure Intel would be happy having their instruction set copied.
Every universe of discourse has its logical structure --- S. K. Langer.
SirCmpwn
Member
Member
Posts: 34
Joined: Thu Mar 06, 2014 4:57 pm

Re: KnightOS - For Texas Instruments calculators

Post by SirCmpwn »

Wrote a file manager:

Image
Post Reply