Page 1 of 3

Cbmsh - A Unix-like shell for the commodores

Posted: Sat Mar 16, 2013 4:41 am
by pallas
Update: cbmsh now has its own web page:

http://www.opbyte.it/cbmsh/

But this thread will continue to be the main discussion resource.

*** Original post: ***

I was looking for a unix-like shell (or of any kind) for the vic but couldn't find any.
So I thought I could make one, but I've got too many unanswered questions in my mind.
Thus I'm asking you guys for advices.

1) First of all, is it a good idea to have a unix-like shell on a vic. I say: why not!

2) If I was to make one from scratch or compile an existing one. Pretty complex topic, see the next points. I need your points of view on this, nevertheless.

3) If a new one it would need to, at least, support basic commands like ls, cp, rm, cd etc. Which language? C65, asm? My bet is some sort of C because I know the language well and it is more portable.

4) Compiling an existing one might be even more difficult than making a new one, unless I can find a shell written in C which has very little dependencies. For example, I believe most shells depend on gnu readline, so I would need to compile that first. The dream would be to have busybox for cbm :-)

5) Is anyone interested in making a community project out of this? I do not have much time to dedicate, and if I was to do it myself alone, it would take ages. Maybe a git or svn on sourceforge would be the best way to work on it.

Now don't tell me there is one already and I'm a very bad googler hahaha! :-D

Posted: Sat Mar 16, 2013 5:02 am
by rhurst
Like the one with C128 version of Super C? Love the concept as the interface to their compiler... but for VIC, it would have to at least support a RAM drive with FE3, or the like. Else, it would be a slow interface on a slow computer offering only more complexity.

Posted: Sat Mar 16, 2013 5:10 am
by Mike
The RAM drive for the FE3 is already there, even with a command channel, so rename and delete work. :)

Of course, there's always the VIC wedge, and menu-driven environments like CBM-Command, or graphic environments like VIN, but having a real command line, maybe even with 40 columns per line (so full directory entries can be displayed properly) with readable commands, capable of starting programs, would be a nice touch.

Ideally it should come as cartridge so it's already there when the VIC-20 is powered on.

Ah, daydreaming on weekends. :lol:

Re: A Unix-like shell?

Posted: Sat Mar 16, 2013 5:55 am
by KingTrode
pallas wrote:1) First of all, is it a good idea to have a unix-like shell on a vic. I say: why not!
It certainly would be nice to have something like this available.

pallas wrote:3) If a new one it would need to, at least, support basic commands like ls, cp, rm, cd etc. Which language? C65, asm? My bet is some sort of C because I know the language well and it is more portable.
Personally I would use the tool(s) that would best produce something that gets the most out the VIC / utilizes your programming skills (sacrificing portability if need be).
pallas wrote:4) Compiling an existing one might be even more difficult than making a new one, unless I can find a shell written in C which has very little dependencies. For example, I believe most shells depend on gnu readline, so I would need to compile that first. The dream would be to have busybox for cbm :-)
If you already have some good ideas for the basic shell and your comfortable with your dev tools, I would start from scratch - combined with what you have seen in other similar shells / feedback from the members here to produce a draft.
pallas wrote:5) Is anyone interested in making a community project out of this? I do not have much time to dedicate, and if I was to do it myself alone, it would take ages. Maybe a git or svn on sourceforge would be the best way to work on it.
I don't have great skills in this area but if I could help in anyway then I would certainly try.
Mike wrote:Maybe even with 40 columns per line (so full directory entries can be displayed properly) with readable commands, capable of starting programs, would be a nice touch.

Ideally it should come as cartridge so it's already there when the VIC-20 is powered on.
Would be very nice if it supported these features.


KingTrode / Jim

Posted: Sun Mar 17, 2013 2:44 pm
by Mike
To get an impression what's available today, here's an expanded list of links to utilities I hinted at in my previous post:

o VIC WEDGE (runs in *all* memory configurations!),

o Kananga's VIN20 GUI with filebrowser, and

o Plbyrd's CBM Command V2.1.

for completeness, I should also mention:

o nbla000's CBM File Browser, even though it 'lacks' directory organizing features like rename and scratch,

o Diddl's SJLOAD 07 for JiffyDOS-enabled drives (includes all SD2IEC and uIEC drives, etc.),

o Waterloo BASIC+, which has the VIC Wedge built-in (included on Mega-Cart), and

o the BASIC V4 extension cartridge.

In principle, the last one makes the disk commands of CBM BASIC V4 like DIRECTORY, RENAME, SCRATCH, etc. available as BASIC extension for the VIC-20, you can use these from the READY prompt as well, thus it's already quite near to that specification you gave above. It's just missing the 40 column support, and tools for single file and whole disk copy. ;)

Posted: Mon Mar 18, 2013 3:05 am
by pallas
Thanks Mike for the information.
I didn't have much time this weekend to work on this, but I did have a look around to see what minimal shells, written in C, are available. There are a lot, because of the use in embedded systems, network equipment etc.
There is one that is promising, it's called "sash". The source is pretty simple and is designed to work stand-alone, so it's a good candidate. It uses "make" and no other compilation tools.
Of course there is a lot of work needed:

- remove all features which are not available on the vic: process management, compression, etc.
- remove dependancies on libraries which are not provided by cc65 and other limitations (use of "double" for example).
- fix all the rest to work correctly on the vic: a lot of little things will need to be suited to the limitations of a '81 computer ;)

Next step for me is having a deeper look at cc65 and which libraries it provides.
Then, if I don't find any blocking matter, I could start cleaning up the sources and trying to compile and see what's up.
Assuming it's all ok and I have the time to do all this, I'll the upload the sources to sourceforge. But let's not dream too much for now ;)

Posted: Mon Mar 18, 2013 9:33 pm
by Schema
Wasn't there a port of Contiki to the VIC? The C64 version has a rudimentary shell.

Posted: Tue Mar 19, 2013 7:58 am
by pallas
Progress:
I was able to compile a heavily modified sash but it crashes like hell. I think it's because I'm using the svn version of cc65. I can't use the stable one because it misses some features I need.
Changing an empty loop from 0 iterations to some causes a crash, so it must be something related to the compiler.
And the snapshots + svn are currently unavailable, so I don't know if any fix has been made to the cc65 sources.
Pausing for now... :-)

Posted: Tue Mar 19, 2013 6:02 pm
by rhurst
FYI, CC65 has an active developer mail list for support. Post your loop and observations there and at least one person typically helps or resolves the matter the same day.

Posted: Thu Mar 21, 2013 5:27 am
by pallas
Turned out it was a compiler problem indeed. Reverted some svn revisions back and now, no more crashes!
Let me fix some more evident bugs and then I'll post it.
Cheers! :-)

Posted: Fri Mar 22, 2013 8:00 am
by pallas
Now it's mostly working.

What's missing:

- program execution
- fitting 16k
- "ls" options
- chdir and pwd can manage devices only, no subdirs

Image

Posted: Fri Mar 22, 2013 5:46 pm
by FD22
Genuinely impressive. Looking forward to seeing where this goes next.

Posted: Sat Mar 23, 2013 6:25 am
by Boray
But... Why would this be useful?

Posted: Sat Mar 23, 2013 7:08 am
by pallas
Boray wrote:But... Why would this be useful?
Have you ever used a Unix like shell?
Even if you find it useless, it's funny to do and pretty cool, IMHO.
Your mileage may vary ;-)

Posted: Sat Mar 23, 2013 8:16 am
by Boray
Of course I have used unix shells as well as DOS, AmigaDos etc. But I can't see much use for it on a vic-20. Would it include script execution? And would it require special programs? I mean a normal vic-20 program takes over the whole computer anyway.