CPCWiki forum

General Category => Programming => Topic started by: FloppySoftware on 01:06, 23 September 21

Title: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 01:06, 23 September 21

I'm happy to announce a new release of SamaruX, my Unix-like shell for CP/M.


You will find the binaries, C source code and documentation for the new v2.07 in my GitHub repository:


https://github.com/MiguelVis/samarux (https://github.com/MiguelVis/samarux)


Its website is here:


http://floppysoftware.es/samarux.html?path=cpm_projects|samarux (http://floppysoftware.es/samarux.html?path=cpm_projects%7Csamarux)
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GUNHED on 14:00, 23 September 21
Looks good. But why to reinvent the wheel? We have all of that and more in the ZCPR System. You may know Z3Plus for CP/M Plus. If not ... it's really worth taking a look at it.


Oh, there's nothing on youtube  :o :o :o
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 15:22, 23 September 21
Quote from: GUNHED on 14:00, 23 September 21
Looks good. But why to reinvent the wheel? We have all of that and more in the ZCPR System. You may know Z3Plus for CP/M Plus. If not ... it's really worth taking a look at it.


Oh, there's nothing on youtube  :o :o :o


The obvious reply could be: why not?


But I know ZCPR and the goal is totally different compared to SamaruX.

Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: norecess on 20:21, 23 September 21
I looked at your website, it looks nice.

I'm curious, do you program everything on the real machine ? I noticed you were using SmallC + your own text editor..
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GeoffB17 on 21:10, 23 September 21
Interesting.

I've downloaded the SX.COM and this works on my (enhanced) PCW, but it does very little.   I guess that I need to download the various *.sx files?   Get them one by one?

Not clear what I need for basic functionality

The benefit of this system is that it runs on top of CP/M, and does not need any mods to the system.  The ZCPR (etc) systems need to replace the existing CP/M I understand?

I use the HiSoft ED80 text editor, which works well, I'll see how this operated within this process?

Thanks.

Geoff
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 22:38, 23 September 21
Quote from: norecess on 20:21, 23 September 21
I looked at your website, it looks nice.

I'm curious, do you program everything on the real machine ? I noticed you were using SmallC + your own text editor..


I use some generic CP/M emulators and a real Amstrad PCW when the day-by-day life permits.


When I'm in a hurry I use a fast command line CP/M emulator.

Anyway, I learned something very recently about emulators.


All of them emulate the cpu, right?


But some of them emulate also the BDOS functions while others run the real BDOS from Digital Research.

Well, trust in emulators running the real BDOS, not in the others.


I had an issue with the result from the BDOS function that returns the size of a file.


According to a on-line documentation that function returns a code in the A register.


The emulator with an emulated BDOS followed that convention.

My program followed that convention.


My program failed with a real BDOS. What?!


I read the original CP/M manuals from Digital Research.


Of course, the real BDOS was right, the on-line documentation was wrong and also the emulator.


That BDOS function did not return anything in A register in CP/M v2. It does in v3.


So, I use emulators but prefer the real OS and even better the real machine with the real OS.








Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 22:44, 23 September 21
Quote from: GeoffB17 on 21:10, 23 September 21
Interesting.

I've downloaded the SX.COM and this works on my (enhanced) PCW, but it does very little.   I guess that I need to download the various *.sx files?   Get them one by one?

Not clear what I need for basic functionality

The benefit of this system is that it runs on top of CP/M, and does not need any mods to the system.  The ZCPR (etc) systems need to replace the existing CP/M I understand?

I use the HiSoft ED80 text editor, which works well, I'll see how this operated within this process?

Thanks.

Geoff


This SX.COM release have some internal (built-in) commands but a lot are external.


Just write "builtin" and SamaruX will tell you which are.

The external commands have the ".x" extension.


The files with the ".sx" extension are batch commands, a sort of SUBMIT or shell scripts.


It's very easy to build a SX.COM with every command as internal, just by modifying the SX.C file.


I will include another SX binary like that asap.
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GeoffB17 on 23:08, 23 September 21
Hello,

Thanks for the extra info.

No problem with the commands being external, I assume it's the usual trade off between performance and TPA size.

I downloaded the SX.COM OK, but the other files don't have a visible d/l option - or am I missing something?   I'd like to get the *.x and the *.sx for now.   A better batch system would be useful.

Performance may well not be an issue if everything is loading of one of the uIDE drives?

Geoff
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GUNHED on 01:38, 24 September 21
Quote from: GeoffB17 on 21:10, 23 September 21
The benefit of this system is that it runs on top of CP/M, and does not need any mods to the system.  The ZCPR (etc) systems need to replace the existing CP/M I understand?
No, for CP/M Plus just start JETLDR.COM to get Z3Plus up. It will replace CCP and BDOS automatically and you have a wonderland. But this should be discussed in another thread.

Back to SamaruX. Looks like the key features are the Unix like appearance.  :)
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GeoffB17 on 01:45, 24 September 21
Furrther playing...

Now determined that it's the .sx files that don't have an option to download, but the .x files will do so.   I'll assume that the text files have the problem, any binary ones will download OK?

Copied through some of the .x files, and thied how things operate.   Things seem to work OK with C: and J:, so no problems with the uIDE etc.  Certainly seem faster with the uIDE than direct floppy.   Both seem OK though.

Tried to get the redirect to work.   Tried ls c0: >m0:dir.txt and this seemed to try to do what it was supposed to do, no result appeared on the screen, but I get an Error - Bad File Name message.

Also tried cpm ed80 test.txt which correctly went into ed80, all fine, but on exit while test.txt was created I got a prompt showing
sx -r profrst.sx which is nothing that I'd entered - maybe this is a temp bat file that the cpm process has created?   But should it show in this way?

Anyway, looking VERY interesting.   Useful to be able to mix the 'unix' and the cpm commands.

More playing...

Geoff
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GUNHED on 01:46, 24 September 21
Maybe it could be a good idea to make DSK files for PcW and CPC.
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 08:10, 24 September 21
Quote from: GeoffB17 on 23:08, 23 September 21
Hello,

Thanks for the extra info.

No problem with the commands being external, I assume it's the usual trade off between performance and TPA size.

I downloaded the SX.COM OK, but the other files don't have a visible d/l option - or am I missing something?   I'd like to get the *.x and the *.sx for now.   A better batch system would be useful.

Performance may well not be an issue if everything is loading of one of the uIDE drives?

Geoff


You can download the entire repository, there is a button for that in GitHub.
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 08:27, 24 September 21
Quote from: GeoffB17 on 01:45, 24 September 21
Furrther playing...

Now determined that it's the .sx files that don't have an option to download, but the .x files will do so.   I'll assume that the text files have the problem, any binary ones will download OK?

Copied through some of the .x files, and thied how things operate.   Things seem to work OK with C: and J:, so no problems with the uIDE etc.  Certainly seem faster with the uIDE than direct floppy.   Both seem OK though.

Tried to get the redirect to work.   Tried ls c0: >m0:dir.txt and this seemed to try to do what it was supposed to do, no result appeared on the screen, but I get an Error - Bad File Name message.

Also tried cpm ed80 test.txt which correctly went into ed80, all fine, but on exit while test.txt was created I got a prompt showing
sx -r profrst.sx which is nothing that I'd entered - maybe this is a temp bat file that the cpm process has created?   But should it show in this way?

Anyway, looking VERY interesting.   Useful to be able to mix the 'unix' and the cpm commands.

More playing...

Geoff


You must type one or more spaces between the redirection symbol (< > >> |):


ls *:txt > files.lst


Regarding profrst.sx, is the expected behaviour. SamaruX try to save the current state before running a CP/M command in that file.  It's a batch file interpreted when returning to SamaruX.


Anyway there are some limitations / issues as CP/M does not provide a good BDOS "running another program and comeback".


Under CP/M 2 there is the $$$.SUB trick that does not work well and under CP/M 3 we have BDOS fn Chain to program but it have its own issues as well.


By the way, Samarux has a manual.txt extracted from the samarux.man file.


But in the shell you can run the man command to get help.


For the man command itself:


man man


For - ie the cat command:


man cat


Or the man topics list:


man | more


Have fun.




Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 08:33, 24 September 21
Quote from: GUNHED on 01:38, 24 September 21

Back to SamaruX. Looks like the key features are the Unix like appearance.  :)


Unix-like behaviour.


Another one is being able to execute just a SamaruX command directly from the CP/M CCP like:


A>SX LS -AL *.TXT | MORE


For the rest RTFM if you are really interested.  :P :P



Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: m_dr_m on 15:30, 29 September 21
Amazing project and very neat site.
Piping and scripting, wow!


Does it have auto-completion like Symbos shell?


By the way, how does MESCC compare with SDCC and LLVM-Z80?
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 20:15, 29 September 21
Quote from: m_dr_m on 15:30, 29 September 21
Amazing project and very neat site.
Piping and scripting, wow!


Does it have auto-completion like Symbos shell?


By the way, how does MESCC compare with SDCC and LLVM-Z80?


The shell does not have autocompletion yet. It will.


MESCC is a derived native Small C compiler, so it compares really bad with crosscompilers but does the job.
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GUNHED on 23:13, 29 September 21
Quote from: FloppySoftware on 08:33, 24 September 21
For the rest RTFM if you are really interested.  :P :P
It's always a great idea to Read The FutureOS Manual.  ;D
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: DoctorCPC on 09:42, 30 September 21
your Amstrad PCW projects are great. i shared this links at turkish Retro Computers forums. and i will share this information at my CPCUserClub web site. really great Amstrad PCW projects. I love Amstrad CPC, Amstrad PCW and Amstrad NC
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 10:32, 30 September 21
Quote from: DoctorCPC on 09:42, 30 September 21
your Amstrad PCW projects are great. i shared this links at turkish Retro Computers forums. and i will share this information at my CPCUserClub web site. really great Amstrad PCW projects. I love Amstrad CPC, Amstrad PCW and Amstrad NC


Thanks a lot!
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 10:35, 30 September 21
Quote from: GUNHED on 23:13, 29 September 21
It's always a great idea to Read The FutureOS Manual.  ;D


Of course everything goes around your OS.  :picard:
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GUNHED on 15:06, 30 September 21
Quote from: FloppySoftware on 10:35, 30 September 21

Of course everything goes around your OS.  :picard:


Do you have any kind of humor? If not please don't tell me RTFM, because that's offensive.


Actually I posted here a bit, because I wanted to support your work. But your behaviour is not acceptable. So for future do your stuff alone.
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 15:21, 30 September 21
Quote from: GUNHED on 15:06, 30 September 21

Do you have any kind of humor? If not please don't tell me RTFM, because that's offensive.


Actually I posted here a bit, because I wanted to support your work. But your behaviour is not acceptable. So for future do your stuff alone.


Oh, sorry then, it was not my aim to offense anyone.


Anyway we know each other even if you were using another nickname some time ago.


So don't tell me anything about bad behaviour.
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GUNHED on 19:16, 30 September 21
Sorry accepted. BTW: Yes, I had another nickname back the day. I got banned for using "RTFM". But now it's today. Let's do things better.  :)
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: redbox on 19:28, 30 September 21
Quote from: GUNHED on 19:16, 30 September 21Sorry accepted

Whats the german for "gall"?  As in "I can't believe the gall of this guy"?  Frechheit?
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: BSC on 19:53, 30 September 21
Seems like the new version "TFM" is asking for a second ban! Here comes FloppySoftware, telling us about his awesome project, which is actually useful, mind you! And also along comes inescapable "TFM", spitting his useless gibberish and insulting the OP for his own lack of humour. Please give us a break!  :picard2:
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GeoffB17 on 19:59, 01 October 21
Still playing with this.   Still very interesting, I'm sure it will have a number of uses.

I've now d/l most of the external commands (*.x) files, but had to do them one-by-one.   Not a big deal.

Wondered what the df (disk free) command would do with the uIDE system, there's a problem here.   Not a big deal, but still.

df c: d: e: f:  gives:

c: 1588KB  (12704 recs)
d: 5396KB (-22363 recs)
e: 8136KB (-449 recs)
f: 4196KB ((-31968 recs)

The bytes free figures are OK, the records free numbers are not - I think a signed integer should be a long int?   Will be OK for PCW std floppy disks of course.  Correction, a standard int, but unsigned, would be just enough!

Tried the ls -l command on my c: drive, which has quite a few files on.   Took a long time, but produced a nice listing.   Sorted, which no doubt added to the time.   Interesting to see that the listing shows actual file sizes, i.e. not based on block size, so a number of files that would normally have all been 4k showed as 1k, 2k or 3k.   Maybe this added to the time taken as well?

LOTS more playing to do yet.


Thanks.

Geoff
Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: FloppySoftware on 04:16, 12 October 21
Quote from: GeoffB17 on 19:59, 01 October 21
Wondered what the df (disk free) command would do with the uIDE system, there's a problem here.   Not a big deal, but still.

df c: d: e: f:  gives:

c: 1588KB  (12704 recs)
d: 5396KB (-22363 recs)
e: 8136KB (-449 recs)
f: 4196KB ((-31968 recs)

The bytes free figures are OK, the records free numbers are not - I think a signed integer should be a long int?   Will be OK for PCW std floppy disks of course.  Correction, a standard int, but unsigned, would be just enough!


My fault. I'm using %d instead of %u in printf:


unsigned int recs;


...


printf("%c: %4d KB (%5d recs.) free\n", 'A' + drv, recs / 8, recs);



I have fixed the issue and uploaded a new df.x command file to the repository.

By the way, I have uploaded today to the repository another build of SamaruX with every command as built-in: SX2.COM.

Thanks for checking and reporting!



Title: Re: SamaruX: Unix-like shell for CP/M.
Post by: GeoffB17 on 01:05, 19 October 21
Thanks for this.

I've just got the new version of df.x, and yes, this looks much better.

I just now guess that if I'd thought about it, I could have tried to 'patch' your original file.   I assume that the code for printf is in the main module, and df.x has just the template as in effect text, so if I used a binary editor I could have changed the %d to %u, assuming the overall process doesn't include any sort of chk.

I note you say you've done SX2, but I'll not bother with that as I'm using the uIDE (so the external commands load fine) and I'm more intersted in experimenting with using cpm xxx commands so I'd rather keep SX smaller.

Did you ever see the WHM (Write Hand Man) system, which has a similar structure although with a different basis.   here there's a memory resident main module which provides a pop-up menu for the 'external' options.   Again, this works much better via the uIDE system, even more so as some options create/edit small data files (editor, diary, etc) and normally the resultant file would be on M: and you need to remember to save the files to disk - this is not necessary with the uIDE!

Geoff
Powered by SMFPacks Menu Editor Mod