OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:30 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 58 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: KnightOS - For Texas Instruments calculators
PostPosted: Thu Mar 06, 2014 7:06 pm 
Offline
Member
Member

Joined: Thu Mar 06, 2014 4:57 pm
Posts: 34
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:
$ 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.


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Fri Mar 07, 2014 5:45 am 
SirCmpwn wrote:
KnightOS

Really nice work! Unfortunately the area where it can be used is too small. But it's a lot of work!


Top
  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Fri Mar 07, 2014 6:56 am 
Offline
Member
Member
User avatar

Joined: Fri Jul 03, 2009 6:21 am
Posts: 359
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.


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Fri Mar 07, 2014 7:09 am 
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.


Top
  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Fri Mar 07, 2014 9:57 am 
Offline
Member
Member
User avatar

Joined: Fri Jul 03, 2009 6:21 am
Posts: 359
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.


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Fri Mar 07, 2014 10:41 am 
Offline
Member
Member
User avatar

Joined: Wed Aug 21, 2013 3:53 am
Posts: 449
Location: Asia, Singapore
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)


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Fri Mar 07, 2014 11:03 am 
Offline
Member
Member

Joined: Thu Jul 05, 2012 5:12 am
Posts: 923
Location: Finland
@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.

_________________
Undefined behavior since 2012


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Fri Mar 07, 2014 12:06 pm 
Offline
Member
Member

Joined: Thu Mar 06, 2014 4:57 pm
Posts: 34
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.


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Fri Mar 07, 2014 5:06 pm 
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.


Top
  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Fri Mar 07, 2014 5:11 pm 
Offline
Member
Member

Joined: Thu Mar 06, 2014 4:57 pm
Posts: 34
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.


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Sat Mar 08, 2014 5:24 pm 
Offline
Member
Member

Joined: Thu Mar 06, 2014 4:57 pm
Posts: 34
A friend implemented some trig in the kernel and sent me this:

Image


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Sun Mar 09, 2014 12:47 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 19, 2012 1:52 pm
Posts: 75
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.


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Sun Mar 09, 2014 1:05 pm 
Offline
Member
Member

Joined: Thu Mar 06, 2014 4:57 pm
Posts: 34
Image


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Mon Mar 10, 2014 3:39 am 
Offline
Member
Member
User avatar

Joined: Fri Jul 03, 2009 6:21 am
Posts: 359
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.


Top
 Profile  
 
 Post subject: Re: KnightOS - For Texas Instruments calculators
PostPosted: Thu Mar 13, 2014 12:41 am 
Offline
Member
Member

Joined: Thu Mar 06, 2014 4:57 pm
Posts: 34
Wrote a file manager:

Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 58 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group