CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: Duke "Tape" Eiyeron on March 03, 2015, 10:41:55 AM

Title: [FiXos][C]FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 03, 2015, 10:41:55 AM
Hello everyone. I'm finally on something and that is quite good. (-_(//));

I'm on with FiXos development as we finally have something like a more-or-less working libc around there for FiXos and thus started to program something that would work a shell on a terminal.

Here's the code : FXSH (http://lab.knightsofnii.com/Eiyeron/fxsh)

Here's the technical specs at this moment :
- it can read up to 16 elements of 128 bytes (even though the VT buffer can read up to 128/256 bytes at this moment)
- it support quoting and double quoting
- built-in support : ls and cd are somewhat done. They lack some features, like cd .. but they gladly work)
- environment var management. It even pushed the libc to support them!

And here what's planned :
- no programming is currently planned but variables should be. At least to tweak things like PATH. It should be simple to parse, heh.
- As a needed feature, I'll add case switching in the VT in the kernel (TI-like, probably). At this moment, one can only write caps and I had to cheat to add a working ls as LS.
- PATH management. As for now, one could execute a program if it could reach the file, but without caps...
- neat source file structure that could be even improved.

- better argument storage. I don't know at all how I will store the arguments but I'd like to make a version without argument size or command line limits.
- Should the shell work on other *nix I'd be very happy . It works quite correctly on Cygwin!bash.

(http://www.planet-casio.com/files/forums/photo_2015-03-06_14-05-22-127232.jpg)
(http://www.planet-casio.com/files/forums/IMG_20150302_104429-127109.jpg)
Title: Re: [FiXos][C]FXSH : FiXos SHell
Post by: Snektron on March 03, 2015, 12:17:50 PM
Looks awesome :D
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 03, 2015, 04:04:42 PM
Oh thanks for the cross-post. :D Hopefully this gets this project more known in the community. :) I am glad it is still progressing. Of course I am not much into the technical stuff of it because I have no clue what that stuff does, but a custom OS would definitively be nice on this calculator series. Do you think dual-booting would be possible for people who still want to use the Casio OS for school? That said, I don't think getting a second calculator is a serious problem because you can easily get a FX-9750Gii model for $50 in North America and they are sometimes on sale. I myself plan to get one at Target if they still have any in stock because they are 25% off right now.
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 03, 2015, 05:56:36 PM
Which cross-post? This is the original post! :p

At the moment, you can only run the kernel by hotswapping the OS with the bootloader. OS overriding is not supported at all and Kris doesn't has this in mind, so yeah, don't worry about keeping Casio's OS safe.  Make care of buying a SH3 so, we don't have any SH4 in hands and thus can't program for them at all. (I would try to port the kernel for them if I had one).

Quote from: Cumred_Snektron on March 03, 2015, 12:17:50 PM
Looks awesome :D

Thanks!
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 03, 2015, 05:57:23 PM
Oh I thought this was a cross-post from Planète-Casio, since that's where FiXoS official thread is located. ???


Also are the SH4 FX-9750Gii calcs the white ones?

http://cdn.toptenreviews.com/rev/scrn/large/50058-fx-9750gii1.jpg
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 03, 2015, 05:58:33 PM
Yeah, but that project is not FiXos! :p FiXos is not really my project, I wouldn't post it in my project section.
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 03, 2015, 06:01:44 PM
Oh right, my bad, I mixed the project up with FiXoS. And I thought you were co-author of FiXoS anyway. :P



Also are the SH4 FX-9750Gii calcs the white ones?

http://cdn.toptenreviews.com/rev/scrn/large/50058-fx-9750gii1.jpg

That's what Target has, and all Canadian stores opened their doors in 2013 and 2014, so I doubt they carried stock from several years ago, but we never know.
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 03, 2015, 06:07:43 PM
I don't think so, they seems to be the equivalent to my Graph35+. Do you know which OS they're bundled with? If it's 2.02 or higher, you'll end up probably with a SH4. On Sh4 there is to "USB Power Graphic 2" under the screen but that's not for every calcs.

EDIT : If you know their prices and the price of a shipping to France, I could be interrested into getting a SH4 if that's not too expensive.
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 03, 2015, 06:13:54 PM
I don't know, because they're factory-sealed and brand new, so I won't know until I opened the calculator package, and I can't get a refund if it's the wrong calc because all Target stores in Canada are closing so they no longer accept any refund. Also the USB Power Graphics 2 thing is only in France I think, because I have never seen a FX-9750Gii with it, let alone a FX-9860GII.
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 03, 2015, 06:16:57 PM
So, heh, you have three outcomes:
- DOn't buy it
- Sh3 : YOu'll be able to fiddle with FXSH as soon as you got to how to tranfer files, the kernel, setitng file, bootloader and the shell
- SH4 : You'll have to wait until we get a decent architecture thing going on. Sorry.
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 03, 2015, 06:21:02 PM
Actually if I end up with a SH4 then it could be at my advantage, right? Because my current FX-9860G is a SH3, so by getting a SH4 9750Gii I would then have both processors. Unless your program is 9750Gii-only (which would be strange since we can flash those calcs to run 9860G OSes)?
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 03, 2015, 06:27:27 PM
Hey, but you have a fx9860! DO you have a recent OS? Can you launch addins? Have you tested FiXos yet? And no, Kris has a similar calc and I compile only for SH3, not a specific model.

EDIT : work is done on my side to make the keyboard (the calculator's keys) support switching cases. I just opted for a simple toggler : F6. I'm able now to LS various places in the FS now!

(http://www.planet-casio.com/files/forums/IMG_20150303_195708~2-127111.jpg)

EDIT 2 : Ti-like Shift(2nd)/Alpha system implemented. I need to ask the boss on how to share the keyboard state to other devices/structures. Maybe an ioctl...
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 04, 2015, 07:10:16 PM
I would prefer not using FiXoS on my 9860G yet since it's incomplete and I spent $90 on that calc. Plus I have an history of having connectivity issues with FA-124 so I am worried about being unable to get my old OS back. I got OS 2.00 atm btw. I need to upgrade :P. The extra calc I got now was bought mostly as guinea pig and stuff. I guess I'll see, though. If the new calc seems faster then I might instead use the other for guinea pig purposes.

(http://img.codewalr.us/photo_2015-03-04_14-07-11.jpg)
That is the calc in question, by the way, which I got for $37.50 before taxes



Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 04, 2015, 08:51:05 PM
FiXos is globally inoffensive (pun INTENDED), as no write on flash is done. (There is nano chance to override a bad part of the RAM backup and Casio OS would take it as normal backup to load and crash the system but with all the fiddling I did nothing happened yet)
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 06, 2015, 05:41:42 AM
Ah ok, but how do you send the Casio OS back if you want to get rid of FiXos? And what if FA-124 stops detecting the calculator?
Title: Re: [FiXos][C]FXSH : FiXos SHell
Post by: Snektron on March 06, 2015, 09:02:47 AM
but Fixos is just a shell, not? so it doesn't remove the os :P
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 06, 2015, 11:19:13 AM
Nah, FiXos is a posix-like kernel. FXSH is a shell running on top of it.

I'm currently adding manual environment variable management as FiXos doesnt' have it at thisoment. This we have almost a PWD and CD working. Almost.

EDIT : It works! It has problems (no cd .. or ls relative subfolder) but it works!

(http://www.planet-casio.com/files/forums/photo_2015-03-06_14-05-22-127232.jpg)
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 06, 2015, 03:18:20 PM
Wait, I am confused now. Does FiXoS remove the OS or not? ???
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 06, 2015, 03:45:48 PM
Let's be clear : The bootloader loads FiXos in the RAM and overrides tempoary the running system to FiXos. It does not change the ROM nor the Flash. A simple reboot and you'll get back on good old Casio OS.

At the moment, here are the cd/ls command statuses :

# These kind of commands will work
$ ls
$ ls path
$ cd # go back to / as we don't have any /home
$ cd relative/path
$ cd /absolute/path
# These commands will throw a planned error
$ ls inexsistant/folder (relative or aboslute)
$ cd inexsistant/folder (relative or aboslute)
#That won't work and I have to fix that
$ cd ..
$ cd ./machin...
$ ls existing/file (I stole the function from Kristaba and I should just add the case where I only want to list a file and not the whole folder.)

Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 06, 2015, 05:17:13 PM
Oooh I see now. That's better then. I didn't want to get rid of the Casio OS.
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 06, 2015, 05:27:16 PM
You don't really want to at this moment.

Edit : as the kernel grew to have sysctl, one can collect miscallenous informations like the kernel name, the running processes and some others things. I adapted Kristaba's uname example into a built-in and I'm porting his top example into something usable and not something that can't be stopped.
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 08, 2015, 06:42:53 PM
Eiyeron bump the topic when you have updates tho. It's easier to notice. :P

Nice, though. I can't wait to see some functionalities in action. :)
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 08, 2015, 09:05:58 PM
I don't have much to show you. It's mainly to see a working user environment. Once we'll have a decent framework running, we'll be able to show off with fun programs. I can't wait to get to fun things like programming the graphical system which will permit us to use MonochromeLib as a dynamic library or implementing better cursor movement.
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 09, 2015, 06:19:46 AM
Good luck then. :D And being able to use MonochromeLib would definitively be nice
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 09, 2015, 07:39:16 AM
It's not for now, heh, the kernels is keep growing up. We have much more important code to do, but heck, once dynamic libraries are done, it'll help a lot : lighter executables, a only version to manage, a clean system to program on (quite unstable I must say but we're trying to fix that).
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 11, 2015, 12:06:00 PM
I added three main things:
- Now the project include a init program which is executed by the kernel. Init will manage FXSH's execution and will reboot it if it was exited. It also manage a session for FXSH to make it able to pass signals to child processes.
- FXSH will trap signals and avoid getting killed by them.
- As now signals are correctly working, looping programs will be able to be stopped sending a terminal signal to them (EXIT to send ^C).

Thus, Kristaba's minimalistic top has been added as builtin and can be stopped by pressing EXIT, FXSH won't be stopped by signals which init set up correctly for them. It's a good day.
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 11, 2015, 08:39:57 PM
Ooh, a command to force exit programs stuck into an endless loop would definitively be nice. In Axe language, I sometimes found myself unable to exit programs I was debugging because of endless loops x.x
Title: Re: [FiXos][C]FXSH : FiXos SHell
Post by: Snektron on March 11, 2015, 08:41:50 PM
Maybe it's possible for someone to create an axiom with an on interrupt that force exits axe... though that would be quite a challenge xD
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 11, 2015, 08:46:04 PM
I guess this could be suggested, although I am unsure if many people here still program axioms. It also depends of if it's possible at all.
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 12, 2015, 09:06:31 AM
Hum. It's POSIX signals. A program can stil ltrap the signals and do whatever they want to do once they occur. A program can ignore them or have a callback to do something before they quit or continue.
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 12, 2015, 04:01:08 PM
Aah ok. I know nothing about that technical stuff x.x
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 12, 2015, 04:05:37 PM
Nah, it's nothing, pal!

Changes!

- Now the prompt show the current directory name and not the whole path.
- pwd has been added as built-in
- Fixed a problem with wat where it could have closed stdin, making the shell unuasble
- Fixes and cleaning

And what the hell, I made goofs around the code and have to rewrite some features I did (notably running the builts-ins in a fork.)
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 12, 2015, 04:13:05 PM
How large is it so far?
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on March 12, 2015, 04:14:04 PM
33KB, a large part (around 20KB) is taken by libc but adding new features like I added just before is only a matter of hundreds of bytes.
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on March 12, 2015, 11:25:44 PM
Aaah, not bad. :D
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on April 05, 2015, 08:13:19 AM
Updates : started programming env (dump environment vars and shuould in the future help changing them), changed the way builtins are binded in the source code to allow forking some of them and not making them run in the same process than  the shell (that helps programs like cat to stop by resetting signals for its process). Some cleaning/formatting has been done too.
Title: Re: [FiXos][C]FXSH : FiXos SHell
Post by: Snektron on April 05, 2015, 08:47:15 AM
Does this shell allow for something like screen too? or is that more OS?
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on April 05, 2015, 08:56:11 AM
No, it's more like a stripped version of sh at this moment. More work should be done to make envvar editing easier or parsing configuration from files (fopen seem borked at this moment) but it should stay easy on memory to allow more process running.

Oh and job system. Running processes in background,anyone?
Title: Re: [FiXos][C]FXSH : FiXos SHell
Post by: Snektron on April 05, 2015, 09:17:18 AM
Assum :D
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on April 06, 2015, 01:55:13 PM
Great update, Eiyeron :D

Quote from: Cumred_Snektron on April 05, 2015, 09:17:18 AM
Assum :D
What? ???
Title: Re: FXSH : FiXos SHell
Post by: matrefeytontias on April 06, 2015, 03:36:01 PM
Pretty sure that means "awesome" in the Spooderman language :P
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on April 06, 2015, 06:34:37 PM
Quote from: Cumred_Snektron on April 05, 2015, 09:17:18 AM
Assum :D
Plz, thx.
Title: Re: FXSH : FiXos SHell
Post by: Dream of Omnimaga on April 07, 2015, 06:59:47 AM
Ah ok. It's generally best to not intentionally use wrongly spelled words in serious topics, though ;)
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on April 07, 2015, 11:40:47 AM
Yeah, but I can handle that in case of too much wrong grammar. *brings Grammar Nazi Handbook*
Title: Re: FXSH : FiXos SHell
Post by: Snektron on April 07, 2015, 02:25:06 PM
Quote from: DJ Omnimaga on April 06, 2015, 01:55:13 PM
Great update, Eiyeron :D

Quote from: Cumred_Snektron on April 05, 2015, 09:17:18 AM
Assum :D
What? ???
it's indeed just a short version of "awesome" :P
Title: Re: FXSH : FiXos SHell
Post by: Duke "Tape" Eiyeron on April 07, 2015, 03:28:23 PM
But the boss is right, you should mainain a certain english level to avoid Codewalrus ending as a SMS/1337-ridded forum.