KnightOS is a free, open source operating system for Texas Instruments calculators. I've been working on it for over 4 years now. (begin nerdy stuff) It's over 25,000 lines of assembly code (which is arguably a pretty tough language to write things with), and it's built with its own toolchain, which is mostly written from scratch in C. It's a passable Unix-like enviornment with multitasking, dynamic memory management, etc (end nerdy stuff) In the past year or so, the project has picked up steam and now there are over a dozen talented people helping me out with it. Maybe some people here will want to get involved, too!

My Proof: http://www.knightos.org/reddit.txt

AMA!

Comments: 149 • Responses: 38  • Date: 

thedevilsmilkman66 karma

Um... Why?

sircmpwn73 karma

I first got into programming with TI calculators, when I had one in high school. I want to build an entirely open system that students were encouraged to hack on and toy with, which would hopefully get more people interested in coding early on. KnightOS is really interesting from a technical perspective, and it introduces programmers to concepts that I think are important to learn.

phthano6 karma

You're the Richard Stallman of Texas Instruments.

sircmpwn8 karma

A better analogy might be Linus Torvalds.

crocodilejim28 karma

Any other projects you have been working on? Or ones you would like to start?

sircmpwn38 karma

Thanks for asking! I work on a ton of open-source projects, here are a few:

I also contribute code to projects like RES and ImageMagick, but KnightOS is definitely my favorite project.

xilvar26 karma

Was there a reason you decided to stick with assembly for the whole is instead of bootstrapping to c like most other current os'es?

sircmpwn42 karma

TI calculators run on z80s. These processors have C compilers, but they don't work very well - they produce rather bloated code, and often slow code. It's unfortunately unacceptable for a kernel on such limited systems to be written in C.

jhaun14 karma

Wouldn't it have been easier to rewrite the c compiler than write an entire os in assembly?

sircmpwn26 karma

Probably not. The compilers aren't poorly written, it's just that we're really resource starved here. Hand-optimized assembly is the way to go.

the-editor18 karma

What do you do to pay the bills?

sircmpwn29 karma

Write software as a consultant.

random5guy16 karma

How long did it take you to learn how to program in assembly code? I'm working on java right now and my college offers C training, but I'm blowin through java.

sircmpwn21 karma

I'd take that C course if I were you. It took me only a few months to learn, but it took me a few years to get good at it.

random5guy12 karma

I was gonna work in learning both, and python and ruby while I was at it. Too much?

sircmpwn22 karma

You could make it work. I believe in you.

jhaun9 karma

Is there any way to go back to the calculator os after you've installed this?

sircmpwn11 karma

Yep, instructions are on the download page.

vaperjosh9 karma

The TI-82 was pretty easy to pick up and start programming with a minimum of study. Will this be as easy for end-users to code on?

sircmpwn15 karma

Easier. It's built like a Unix system and we're working on something resembling Python. It's super hackable and users are encouraged to hack it :)

vaperjosh6 karma

Is that the driving motivation? Giving something back for the next generation of coders?

edit: I mean is the programming environment your primary focus?

sircmpwn18 karma

That, and to make something that's fucking awesome.

vaperjosh8 karma

I'm picking up a TI84 in the morning and taking the rest of the day off.

sircmpwn5 karma

Great :)

EliteNova7 karma

Honestly, this is awesome. It's great to see a project being followed through - so my question is, what gave you motivation to continue developing this software?

sircmpwn4 karma

The rest of the people involved keep at it and inspire me to do so, too :)

EliteNova1 karma

Awesome, how big is your team (or people that are involved?)

teh_killer5 karma

What's your educational background?

sircmpwn11 karma

Finished high school, skipped higher education.

yanir33 karma

How old are you and why did you decide to skip higher education?

sircmpwn11 karma

I'm 21 and I skipped it because i don't consider it worthwhile for my own needs.

Temere5 karma

Will the TI Nspire series be supported?

sircmpwn8 karma

No, but we wrote an emulator that it should be possible to get running on the Nspire.

Zuxicovp5 karma

So uh, what sort of features does that is have over the stock OS in terms of the average user? And does the calculator still have all the functions that the stock OS has?

sircmpwn2 karma

It has a proper filesystem, and multitasking. The last one means that you can run several programs at once, and switch between them (you could have three graph screens and a game playing at once, for example). The filesystem means that you (will be able to) plug it into your computer and treat it like a flash drive.

bhran3 karma

has Texas Instruments ever contacted you?

sircmpwn3 karma

Nope.

bhran2 karma

would you like them to? your OS sounds like a real improvement over the existing one, and being open source I can see a future where TI starts sponsoring your team's effort for their own benefit, and every engineering student benefit.

sircmpwn3 karma

I think so, yes, but conditionally. TI hasn't always been nice to its hacking community. I would insist that KnightOS remains free and open source and that I could continue leading the project if I were to accept any kind of sponsorship from TI. We could use it, though, this project is huge and complex and it's taken 4 years so far just because I can't spend all of my time on it (and it demands a ton of time).

headdetect3 karma

Not sure if you remember me; nonetheless, what resources did you use in order to make the operating system? Also, I've always wanted to help out with KnightOS but I unfortunately fell victim to the nspire family. Any way for me to contribute (code wise)?

sircmpwn6 karma

I do remember you! And there's good news - there's work to be done for KnightOS in assembly, C, Python, JavaScript, and LaTeX (not just assembly!). You can join us on #knightos on irc.freenode.net to chat with devs and find something interesting to work on. There's even stuff to do for the Nspire ;)

Kkrazzle2 karma

Hey! This is an awesome project. I would love to work on something like this. I'm still in school but systems and low level projects like this really interesting. A few questions! Did you find the instruction set for the z80 limiting in any way and what was your debugging process like? Id imagine there arent a lot of helpful tools out there for a project like this. Thanks!

sircmpwn2 karma

The z80 has a generous instruction set which isn't too limiting. It's got support for a lot of nice things that are less common on 8 bit CPUs, like good bit manipulation.

For debugging I've mostly used emulators. On the 84+ CSE, however, there were no emulators when I got started. I couldn't even get the screen to turn on at first and I ended up wiring an LED into the link port and making it blink to communicate debugging information to the outside world.

Last_Gigolo2 karma

Can we see these operating systems in action ?

sircmpwn2 karma

There's an emulator on the home page that's running the latest version. It's a bit buggy, though!

sarahbau2 karma

How hard would it be to get it working for a TI-86? It has the same CPU as the 83+, and more RAM, but a non-upgradeable 256k ROM, which I think is probably a barrier here.

sircmpwn1 karma

Impossible. You hit the nail right on the head.

hubspot2 karma

What are your favorite chrome extensions and websites other than reddit?

sircmpwn2 karma

I use Firefox and I also like Hacker News.

CryptoEra2 karma

Hi there, is it possible to create bitcoin key pairs (public and private) with this OS running on the calculator? And is it also possible to create QR codes that represent the bitcoin key pairs?

sircmpwn1 karma

Is it possible? Yes. Is it feasible? Not really.

CryptoEra2 karma

Hrmm, I dont think you understand how great this would be. This would make a pretty sweet offline bitcoin QR code, key generator. But it sounds like it might be quite a hassle?

sircmpwn1 karma

The system is too slow to do cryptography at any sort of reasonable speed. We can verify signatures fairly quickly, but not much else. On top of that, you'd have to write your crypto code in assembly.

quadrplax2 karma

Is the OS in color for the TI84+CSE and if not is it planned to be?

sircmpwn1 karma

Somewhat. It has a legacy mode for compatability that simulates the monochrome screen, but programmers are able to use color mode instead.

habash19861 karma

Thanks for posting this, actually, it's very motivating, have to ask: 1-How & where did you start learning assembly? and good resources? 2-How did you learn writing OSes? also any good resources you recommend? 3-Is writing an OS for calculator is different than writing an OS for PCs?

sircmpwn1 karma

  1. http://tutorials.eeems.ca/ASMin28Days/lesson/toc.html, years ago
  2. I just wrote one and learned as I went along
  3. I haven't written an OS for PCs so I can't say for sure.

55249891 karma

[deleted]

sircmpwn1 karma

You probably won't find it practical unless you have a specific constraint that demands it (like I do). Learning it, however, can be very valuable to come to a deeper understanding with how your computer works. I suggest you do so.

Chto_takoye_osen1 karma

Hello, Sircmpwn,

I used to do a lot of programming on the ti-84 back when I was in high school however I did mine internally on the programming function built into the calculator itself. I got pretty deep into it, when I switched to the 89, and was the only one at my school capable of writing codes for various functional computations. I got as far as developing my own programs for different things subjects (calculus and physics) where each had a custom UI that would provide a set of available functions and each one could be selected for which unit you're solving for (teachers loathed me but some asked for my help to write code for approved test-helper formulas).


Basically my question is this: How does coding on the computer directly for the TI differ from coding within the TI itself and how can I get into coding on the computer

Added question if you have the time: How does the language differ from the different versions of TI, 87, 89, 93, and is it difficult to learn others if I started on the 89?

Thanks !


Edit: editing

sircmpwn3 karma

Coding "on the metal" is a lot different. You're probably referring to TI-Basic, which you can author directly on the calculator. TI-Basic is a simple language with simple constraints. On the other hand, you write code that runs on the metal in assembly, which is a simple language with much tighter constraints. You can pick it up, though. I can't really offer suggestions for programming on the stock OS, but I can offer you some resources for programming on KnightOS.

As for the differences between models: we use the same codebase on all of the models we support. They all use the same z80 CPU and have only minor differences to consider. However, not all TI models use the z80 or have similar enough designs. We don't support the TI-89, for example, which uses a totally different technical design.

kumquat_juice1 karma

1) What do you have planned for future development?

2) Can it handle Doom?

sircmpwn2 karma

  1. A bunch of technical stuff - a virtual filesystem, USB host support, and if I'm lucky a TCP/IP stack. For students, I'm hoping to have complete feature parity with the stock OS in the next couple of years, but that's not really my line of work - I'm a kernel guy. I'm lucky to have a bunch of people helping with the userspace that can help realize that goal.
  2. Not yet, but it will ;)

[deleted]1 karma

[deleted]

sircmpwn3 karma

Eternally651 karma

Better you than me, friend.

sircmpwn2 karma

Eh, it's not so bad once you get used to it. We wrote the toolchain in C, though (I wrote my own assembler and a bunch of other tools that help compile the OS).

You can read the code here if you like.

totallynotahologram1 karma

Why is the calculator so expensive

Also how should I start coding assembly (I know there's no point), I'm on a debian variant.

sircmpwn1 karma

Because TI has a monopoly.

You can start writing assembly for calculators by installing our WIP SDK and genkfs, then heading over to our documentation.

wykedcomputergirl1 karma

What, may I ask, does your OS do for a calculator? I have a TI 84 plus and it does pretty much everything I need it to, except surf the web but it doesn't have the memory for that and has a black and white screen and it would be terribly awkward to view websites. So please explain why I would need a different OS on my calculator.

sircmpwn1 karma

The features are described on the home page: http://www.knightos.org, along with an emulator so you can see for yourself. To quote the download page, though: "KnightOS isn't done, and you may be underwhelmed."

batman_hardcorefan-1 karma

[deleted]

sircmpwn2 karma

No? I don't see how it could.