Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Matrefeytontias on March 18, 2013, 06:14:36 am

Title: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 18, 2013, 06:14:36 am
Hey guys !

A few days ago I started working on cmdOS, a command line-based 3rd-party OS. I only do that as a training to improve my ASM skills, so I don't plan any future for it. But hey, who knows ? ;)

I started with SirCmpwn's OS starter kit, which provides LCD and flash set up, RAM unlocking and memory mapping. I also used KnightOS's fontmap and putSpriteOR routine with the agreement of SirCmpwn, but I wrote myself everything else (that means, the text routine, the interpreter, and other functions that you don't see in the screenie below).

So, for now the OS boots on a command-line, which fully supports functions with no arguments :) so if you can think of one, please tell me.

Here are the functions already available :Of course, screenie :

(http://img.removedfromgame.com/imgs/cmdOS1.gif)

Also, I don't show it in the screenie because I thought of it just after uploading the image, but the text wraps when you reach the bottom and the right edge of the screen :)

Share comments !
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: aeTIos on March 18, 2013, 06:15:34 am
Well, that's cool ^^
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Xeda112358 on March 18, 2013, 06:38:01 am
Awesome! I should really look at this OS starter kit thing >.> Would you like some routines for reading strings of numbers so the user can pass arguments? Or are you creating that yourself? :D
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 18, 2013, 06:45:42 am
No thanks, if I use others' routines it lost its interest as a training :) I'll do myself as much things as possible, I'll ask for help for the rest.
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: aeTIos on March 18, 2013, 07:10:31 am
Add a BASIC interpreter ;D
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Xeda112358 on March 18, 2013, 07:12:17 am
Yes, or add a ClrIO command (to clear the prompt screen), maybe add the '?' command for help?
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 18, 2013, 07:34:52 am
aeTIos : maybe I'll never do that :P

Xeda112358 : that's what CLS is doing o_O and for the '?' thing, I planned something for arguments when the functions will be programs, so you'll can do command -h.
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Xeda112358 on March 18, 2013, 07:59:58 am
Oh, sorry. Also, cool o.o So does this mean functions will have a 'help' field, where the function describes what it does?
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 18, 2013, 08:59:09 am
The supported options will be up to the programmer. Arguments starting with - will be copied to a certain memory area which programs will can access and use easily.
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Xeda112358 on March 18, 2013, 12:39:20 pm
Nice o.o Maybe you can make it set or reset bits as actual flags. For example, you can set IY to point to a bunch of flags, and -a would reset bit 0, +a would set bit 0. Then bit 7,(IY+0) is the 'h' flag so the program knows that its 'help' code should be called.

Since it is your OS, you can control the IY register without any harm o.o
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 18, 2013, 01:02:17 pm
I use IY register to pass buffers to functions. And with this system of flags you can't define your own - prefixed arguments. For example, that would fit if there was a fixed number of allowed - prefixed options.
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Xeda112358 on March 18, 2013, 01:11:25 pm
Oh, I see. Do you store the input string in RAM somewhere? For example, do you have "func -h" stored somewhere in RAM as you type? If so, you can just pass a pointer to the arguments in HL or something. So your interpreter reads "func ", and as soon as it hits the end of the input or a space, it searches for the function, and passes a pointer to whatever follows. This way, each function completely handles its own inputs, like stings and file names. (This is how I did it in FileSyst, too.)
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 18, 2013, 01:43:14 pm
That's exactly what I'm doing :)
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Sorunome on March 18, 2013, 07:26:10 pm
Nice, now make it moar awesome than 2.55mp but still let it be mathprinting stuff..../me runs
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 19, 2013, 12:47:30 pm
Update ! :D

After long hours of work, I've finally got backspace erasing working !

(http://img.removedfromgame.com/imgs/cmdOS2.gif)

You can't imagine how frustrating it was for me XD
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 21, 2013, 01:26:02 pm
Update !

Got the argument parsing work :)

(http://img.removedfromgame.com/imgs/cmdOS3.gif)

I planned command input like this : when you input a command, you can specify two kinds of parameters, classic and special. A special parameter is the minus character - followed by one letter, and a classic parameter is at least one letter, A to Z, or one number, 0 to 9. Special parameters will be copied to another memory area than classic parameters so they'll be easier to handle by user programs.

As I said sonner, each and every command will be a program stored in the filesystem (currently working on it) and which will be ran with the given arguments, if any. So, the OS itself will be a tiny command-line which can run programs, a filesystem, and many, many functions for the programmers to use in their programs.

The main interest of this OS is that I try to make it use as little RAM as possible, so there will be a great free space for user programs. Also, I try to provide as many routines as possible to make user programs as small as possible, allowing for even more features in each.
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 23, 2013, 05:19:15 am
I made a GitHub repository, for those who wants to test the OS or to see the source code : https://github.com/matrefeytontias/cmdOS
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Dapianokid on March 23, 2013, 01:38:06 pm
So, ultimately, the programs could theoretically be paraphrased in TIBASIC as

prgmFunction1
prgmFunction2
prgmFunction3
... and so on, like writing a program entirely out of bcalls?
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 23, 2013, 04:47:19 pm
No, don't misunderstand programs and inline commands. Programs are actual ASM programs, written and compiled on a PC, sent to the calc and then executed in the command line as functions.

For example, if mario happens to be written for cmdOS, you'd do >> mario in the command line to run it.
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: DJ Omnimaga on March 23, 2013, 05:57:32 pm
INteresting. If this comes to fruition, will it eventually support programs like Axe Parser and math tools so that people who want to code, for example, can use something different than ASM and those who need regular math tools for class can install them as add-in?

Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 23, 2013, 06:17:23 pm
I think you misunderstood the main goal of the OS :P

What I want to achieve while writing this OS is to provide an easy-to-use development environment, with a lot of available RAM, functions etc. In fact, it's an empty OS which only wait for ASM programmers to feature it. You want a math program ? Do it and share it ! :P
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Dapianokid on March 23, 2013, 06:25:26 pm
Well GlassOS is too difficult for me to understand because of it's C nature. Maybe this OS will be better for me :)
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: chickendude on March 23, 2013, 10:20:59 pm
It sounds pretty cool. Where are programs run from? Is there a gbuf or some area(s) dedicated to saferam? Or is the RAM always completely free (ie programs will always be in archive)?
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Deep Toaster on March 24, 2013, 12:17:52 am
Looking a bit like UNIX shell now, nice work!

Looks like a fun project. I've wanted to make an OS for practice too, but never got around to it. Thanks for reminding me :D
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 27, 2013, 09:50:46 am
Update :)

File system is here (but in RAM for now) ! Plus the FILEINFO command to retrieve some info from the filename given as argument :) I also made a findVar routine, which is equivalent to TI-OS's _checkFindSym (used in the command). For now, the file is hard-coded using Wabbit's debugger but I'll make an editor for those who wants to program in hexadecimal on-calc ;)

(http://img.removedfromgame.com/imgs/cmdOS4.gif)

Btw, as it's been requested on IRC, I join the zip of the full current source and executable.
Title: Re: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: TheNlightenedOne on March 27, 2013, 03:08:38 pm
/me lost
Looks awesome!
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Sorunome on March 27, 2013, 04:09:41 pm
yeah, that is looking awesome :D/me lost too
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: persalteas on March 28, 2013, 05:33:32 am
To thank Sircmpwn to have given you his font, you should explain him how to make a filesystem like that...
I'm not sure that he is comfortable with that...
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 28, 2013, 05:35:58 am
Are you kidding ? XD

KnightOS's filesystem is 1000 times better than mine, only to mention that it's fully in archive.
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: persalteas on March 28, 2013, 05:37:11 am
There is one ? The last version I have of KnightOS doesn't have a filesystem...
I thought he was making one... and that he had difficulties.
Title: Re: [z80] cmdOS, a 3rd-party OS written from scratch
Post by: Matrefeytontias on March 28, 2013, 05:38:25 am
He is having difficulties, due to the use of flash only for storage.