Discussion:
CPMImage
(too old to reply)
nathanael
2024-03-09 09:59:43 UTC
Permalink
As a fan of WinImge for MS-DOS floppy disk images, I've wanted to see a
similar GUI front-end for cpmtools for years. So I decided to create
one. It's still in progress, and many of the features are still buggy,
so I'm not announcing it yet.

However, one feature WinImage has is the ability to make an image
bootable by loading boot code into the boot sector of the floppy image.

I'm wondering how feasible a similar feature would be with CP/M images
-- being able to save off the system tracks to, or overlay them from a
.bin file.

What considerations might there be?
Alan Laughton
2024-03-09 13:21:44 UTC
Permalink
Post by nathanael
As a fan of WinImge for MS-DOS floppy disk images, I've wanted to see a
similar GUI front-end for cpmtools for years. So I decided to create
one. It's still in progress, and many of the features are still buggy,
so I'm not announcing it yet.
However, one feature WinImage has is the ability to make an image
bootable by loading boot code into the boot sector of the floppy image.
I'm wondering how feasible a similar feature would be with CP/M images
-- being able to save off the system tracks to, or overlay them from a
.bin file.
What considerations might there be?
The ability to make an image bootable by loading boot code into the boot
sector of the floppy image would be a great feature, I look forward to
its development.
Nick
2024-03-10 21:33:42 UTC
Permalink
Post by Alan Laughton
Post by nathanael
As a fan of WinImge for MS-DOS floppy disk images, I've wanted to see
a similar GUI front-end for cpmtools for years. So I decided to create
one. It's still in progress, and many of the features are still buggy,
so I'm not announcing it yet.
However, one feature WinImage has is the ability to make an image
bootable by loading boot code into the boot sector of the floppy image.
I'm wondering how feasible a similar feature would be with CP/M images
-- being able to save off the system tracks to, or overlay them from a
.bin file.
What considerations might there be?
The ability to make an image bootable by loading boot code into the boot
sector of the floppy image would be a great feature, I look forward to
its development.
I've used this Windows version -
http://star.gmobb.jp/koji/cgi/wiki.cgi?page=CpmtoolsGUI

If you are looking for features to add, how about the ability to create
empty disk images? mkfs.cpm does this, but unlike mkfs.vfat you need to
create an empty container file before you create the image (dd,
fallocate...).
nathanael
2024-03-11 00:44:29 UTC
Permalink
Post by Nick
If you are looking for features to add, how about the ability to create
empty disk images?
Already done. Thanks for the suggestion.

Features I've already implemented:

Create new image

File handling
....Import
....Export
....Delete
....Rename

File viewer
....text and hex viewer
....search
....handles SQ and CR
....hex dump of currently open image

Features on my To-Do
....Look inside LBRs
....Drag and drop
....translate problematic chars in filenames
....Overlay CP/M system

Other functionality:
Scans your diskdefs for all supported formats

--Nathanael
nathanael
2024-03-11 00:52:39 UTC
Permalink
Post by Nick
I've used this Windows version -
http://star.gmobb.jp/koji/cgi/wiki.cgi?page=CpmtoolsGUI
Interesting. I wasn't aware of this. Looks like I'll find some great
ideas there. Thanks.

--Nathanael - *HUMONGOUS* CP/M
Nick
2024-03-11 20:29:14 UTC
Permalink
Post by nathanael
Post by Nick
I've used this Windows version -
http://star.gmobb.jp/koji/cgi/wiki.cgi?page=CpmtoolsGUI
Interesting. I wasn't aware of this. Looks like I'll find some great
ideas there. Thanks.
--Nathanael - *HUMONGOUS* CP/M
If you've every played with the Z80-MBC2, V20-MBC, 68k-MBC then it's
referenced in J4F's docs.
nathanael
2024-03-09 23:45:36 UTC
Permalink
Post by nathanael
I'm wondering how feasible a similar feature would be with CP/M images
-- being able to save off the system tracks to, or overlay them from a
.bin file.
What considerations might there be?
As a first stab at this (I'll worry about coding for exceptions later):

CP/M resides in tracks 0 and 1 of a floppy disk. Does this mean the CP/M
system will always start at offset 0 of a floppy image?

Then I have to figure out how many bytes in a track. I'm assuming that
in the diskdef definitions seclen is the length in bytes of one sector
and that sectrk is the number of sectors per track. So I just need to
grab (seclen * sectrk * 2) bytes starting with offset 0 from the image.

Am I totally off?

I really don't have any images of bootable disks in various formats to
play around with. Can anyone supply some?

Nathanael
Jack Strangio
2024-03-11 00:31:03 UTC
Permalink
Post by nathanael
CP/M resides in tracks 0 and 1 of a floppy disk. Does this mean the CP/M
system will always start at offset 0 of a floppy image?
Yes. But .....

The problem with CP/M is that there are so many floppy disk formats out
there. Theoretically you're right.

The overall format is that the first sector or two will be the bootstrap
sectors followed by all the sectors of the CP/M systemin order. *

Except ....

You get hit by both the disk-format's foibles and the manufacturer's whims.
So you have two basic questions:

Where is the second track of the system tracks (track 1)?

What format (desity, sector-sizes) is that second track written in?


The first track (track 0) on side 0 will *usually* be single-density on an
8" floppy, followed by:

maybe a double-density, larger-size set of sectors on track 1, side 0.

maybe a double-density, larger-size set of sectors on track 0, side 1

maybe a single-density, statndard sector size on track 0, side 1.

and so on. (And I have mentioned anything about skew, yet)

And that's just the 8" disks. Which actually *do* happen to have an IBM
format layout that many software manufacturers do use for distributing their
software. Harware manuafctuers, not so much

5" floppies have a completely different set of sector-sizes, formats, and
skew factors. There never was any 'standard' 5" flopy format IIRC.


The easiest way to look at it is to take *your* CP/M sysem disks and work
out which particular format a particular system-boot floppy is using. And
then make a backup image of that. You may need to write a specific software
tool for that specific job.

And then do the same thing with all of your system disks, making sure you label
the image-types extremely well.

* Don't even *think* about storing the sector-sequence of the 5" North Star
CP/M system disks in your brain. Or even the layout in RAM.That way lies
madness.

Regards,

Jack
--
They call me 007 at work:
0 Motivation
0 Skills
7 Smoke Breaks
nathanael
2024-03-11 00:57:02 UTC
Permalink
Post by Jack Strangio
Post by nathanael
CP/M resides in tracks 0 and 1 of a floppy disk. Does this mean the CP/M
system will always start at offset 0 of a floppy image?
Yes. But .....
The problem with CP/M is that there are so many floppy disk formats out
there. Theoretically you're right.
Thanks for the input. I'm aware this could be an exercise in futility
and won't be an easy feature to get right. I'll start with the general
case and then start coding for the exceptions (of which there is an
endless number, I'm sure). I may in the end decide this feature isn't
worth the work.

--Nathanael *HUMONGOUS* CP/M
Fritz
2024-03-10 20:51:39 UTC
Permalink
Post by nathanael
As a fan of WinImge for MS-DOS floppy disk images, I've wanted to see a
similar GUI front-end for cpmtools for years. So I decided to create
one. It's still in progress, and many of the features are still buggy,
so I'm not announcing it yet.
However, one feature WinImage has is the ability to make an image
bootable by loading boot code into the boot sector of the floppy image.
I'm wondering how feasible a similar feature would be with CP/M images
-- being able to save off the system tracks to, or overlay them from a
.bin file.
What considerations might there be?
Please look there:


https://github.com/ProgrammingHobby/CPM_Image-File_Explorer/releases/tag/0.0.9.4
--
-- Fritz
Fritz
2024-03-10 20:53:35 UTC
Permalink
Post by Fritz
https://github.com/ProgrammingHobby/CPM_Image-File_Explorer/releases/tag/0.0.9.4
corrected link:


https://github.com/ProgrammingHobby/CPM_Image-File_Explorer
--
-- Fritz
nathanael
2024-03-11 01:00:11 UTC
Permalink
Guess I should have mentioned: I'm coding this in Python/tkinter because
it's cross-platform and that's what I know. I'm aware that might be a
turn-off to some.
nathanael
2024-03-11 02:11:06 UTC
Permalink
Illegal char translation.

Scanning through the SIG/M collection, I see these special characters in
filenames:

- / & @ $ +

Under Linux, - + @ aren't problematic (I don't know about Windows),
while by long-standing tradition the slash (/) is translated to underscore.

That leaves the ampersand and dollar sign.

Any suggestions?
yeti
2024-03-11 02:59:16 UTC
Permalink
Why are these (except '/') problematic "in Linux"?

$ touch -- '-&@$+'
$ ls -l
total 0
-rw-r--r-- 1 yeti yeti 0 Mar 11 02:41 '-&@$+'
$ rm -v '-&@$+'
rm: invalid option -- '&'
Try 'rm ./'-&@$+'' to remove the file '-&@$+'.
Try 'rm --help' for more information.
$ rm -v -- '-&@$+'
removed '-&@$+'

The shell may have problems misreading '-' and expevting an option, '$'
expansion may expand "$SOMETHHING" to unwanted things and misreading '&'
for sending a command into the background may happen in some cased, but
quoted properly I don't see a problem. All this can be handled by an
experienced shell user.

C(++)'s file operations will make far less problems with those chars,
IIRC there really only '/' and '\0' should be forbidden.

So it is not a Linux problem, it is a shell problem.

( Am I overlooking something? It's really late here. *sigh!* )
--
I do not bite, I just want to play.
yeti
2024-03-11 03:00:26 UTC
Permalink
$ touch -- '-&@$+'
$ ls -l
total 0
-rw-r--r-- 1 yeti yeti 0 Mar 11 02:41 '-&@$+'
$ rm -v '-&@$+'
rm: invalid option -- '&'
Try 'rm ./'-&@$+'' to remove the file '-&@$+'.
Try 'rm --help' for more information.
$ rm -v -- '-&@$+'
removed '-&@$+'

The shell may have problems misreading '-' and expevting an option, '$'
expansion may expand "$SOMETHHING" to unwanted things and misreading '&'
for sending a command into the background may happen in some cased, but
quoted properly I don't see a problem. All this can be handled by an
experienced shell user.

C(++)'s file operations will make far less problems with those chars,
IIRC there really only '/' and '\0' should be forbidden.

So it is not a Linux problem, it is a shell problem.

( Am I overlooking something? It's really late here. *sigh!* )
--
I do not bite, I just want to play.
yeti
2024-03-11 03:01:08 UTC
Permalink
$ touch -- '-&@$+'
$ ls -l
total 0
-rw-r--r-- 1 yeti yeti 0 Mar 11 02:41 '-&@$+'
$ rm -v '-&@$+'
rm: invalid option -- '&'
Try 'rm ./'-&@$+'' to remove the file '-&@$+'.
Try 'rm --help' for more information.
$ rm -v -- '-&@$+'
removed '-&@$+'

The shell may have problems misreading '-' and expecting an option, '$'
expansion may expand "$SOMETHHING" to unwanted things and misreading '&'
for sending a command into the background may happen in some cased, but
quoted properly I don't see a problem. All this can be handled by an
experienced shell user.

C(++)'s file operations will make far less problems with those chars,
IIRC there really only '/' and '\0' should be forbidden.

So it is not a Linux problem, it is a shell problem.

( Am I overlooking something? It's really late here. *sigh!* )
--
I do not bite, I just want to play.
yeti
2024-03-11 03:03:33 UTC
Permalink
$ touch -- '-&@$+'
$ ls -l
total 0
-rw-r--r-- 1 yeti yeti 0 Mar 11 02:41 '-&@$+'
$ rm -v '-&@$+'
rm: invalid option -- '&'
Try 'rm ./'-&@$+'' to remove the file '-&@$+'.
Try 'rm --help' for more information.
$ rm -v -- '-&@$+'
removed '-&@$+'

The shell may have problems misreading '-' and expecting an option, '$'
expansion may expand "$SOMETHHING" to unwanted things and misreading '&'
for sending a command into the background may happen in some cases, but
quoted properly I don't see a problem. All this can be handled by an
experienced shell user.

C(++)'s file operations will make far less problems with those chars,
IIRC there really only '/' and '\0' should be forbidden.

So it is not a Linux problem, it is a shell problem.

( Am I overlooking something? It's really late here. *sigh!* )
--
I do not bite, I just want to play.
nathanael
2024-03-11 03:38:00 UTC
Permalink
Post by yeti
So it is not a Linux problem, it is a shell problem.
True, but I do do a lot of work in BASH shells. But I also have to deal
with DOS, Windows and MacOS, so I need to find a solution compatible
with all of the above.

Also the translation should be reversible so the original CP/M filename
can be recovered. That restricts me to chars illegal under CP/M to avoid
filename collisions and ambiguity.

I've looked through the SIG/M collection, and the only (potentially)
problematic chars I've seen are - / & @ $ +

- @ and + are not, I think, problematic under other OSes, leaving / &
and $ to deal with.

/ has traditionally been translated to _. I'm considering mapping & to %
and $ to =. Depending on which source I believe % and = are illegal
under CP/M but not problematic under DOS, Windows or Linux, so I think
that'll work.
Mark
2024-03-12 22:04:34 UTC
Permalink
Post by nathanael
Post by yeti
So it is not a Linux problem, it is a shell problem.
True, but I do do a lot of work in BASH shells. But I also have to deal
with DOS, Windows and MacOS, so I need to find a solution compatible
with all of the above.
Also the translation should be reversible so the original CP/M filename
can be recovered. That restricts me to chars illegal under CP/M to avoid
filename collisions and ambiguity.
I've looked through the SIG/M collection, and the only (potentially)
and $ to deal with.
/ has traditionally been translated to _. I'm considering mapping & to %
and $ to =. Depending on which source I believe % and = are illegal
under CP/M but not problematic under DOS, Windows or Linux, so I think
that'll work.
Under windows there is an extra dimension to consider. Certain filenames
are illegal under Windows but valid under CP/M. If want to copy files with
these names to/from CP/M you will have a problem. They are
CON, PRN, AUX, NUL
COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9
LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9
The problem appears whatever the extension. To handle these you will need
some form of escaping mechanism to allow them to be generated.

For Windows the list of of problematic characters is also larger
/ \ | " < > :

CP/M 2 has a slightly different set of illegal chars from CP/M 3
CP/M 2 space < > ; : = ? * _
CP/M 3 space < > , ; : = ? * [ ] |

Note . is only allowed once

A solution I have used before is to use ; as an escaping character to
allow character encoding e.g.
CP/M Windows
/ ;[
\ ;]
| ;!
etc.
Illegal names are mapped in one of two ways dependent on whether there is
an extension e.g.
CON CON;
CON.XX CON;.XX

An alternative escape would be _ which is invalid in CP/M 2 but valid in
CP/M 3

An additional problem can occur in that CP/M assumes but doesn't force
upper case filenames. With MBASIC it is relatively easy to create a lower
case filename.

Mark

nathanael
2024-03-11 16:26:01 UTC
Permalink
It's definitely still alpha quality, with lots of bugs. But if anyone
wants to kick the tires, I could use help debugging it.

https://github.com/NCJECulver/cpmimage/tree/master

It requires the following:

python (developed with python3)
tkinter
cpmtools
Mark Ogden's mlbr
Loading...