Using cpmtools to copy CP/M software to the compact flash card

3,271 views
Skip to first unread message

Christian van Enckevort

unread,
May 13, 2017, 4:39:55 PM5/13/17
to RC2014-Z80
Today I completed the paged ROM module, the 64K RAM module and the compact flash module, so I could run CP/M on my RC2014. It works great, but the installed software on the compact flash card is very minimal. Using download.com with 1ms pauses after every byte sounds a bit tedious to for transferring larger amounts of software, so I decided to use my compact flash adapter to that on my laptop. The following is a quick description of how I constructed a new image with additional CP/M software in case anybody else is interested (for linux as that is what I use):
* I used dd to copy the contents of the compact flash card to a file
   dd if=/dev/<compact flash device> of=RC21014.img
* The image consists of a concatenation of 15 8Mb disk images (A: through O:) and one 2Mb disk image. I used dd to extract the individual images, e.g. for drive C
   dd if=RC2014.img of=disk_C bs=1M skip=16 count=8
* There exists a package cpmtools that allow to copy files to and from CP/M disk images. This package ist called cpmtools. I had to add an appropriate definition of the disk format used to the configuration file /etc/cpmtools/diskdefs

diskdef rc2014
  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  os 2.2
end

diskdef rc2014boot
  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 1
  os 2.2
end

   Adding these definitions allows me to copy files to and from a disk image using cpmtools e.g.
   cpmcp -f rc2014 <disk image> <file> 0:
* After adding the files I wanted to the disk images I concatenated all disk images using cat to obtain a new compact flash image and then used dd to transfer it to the compact flash card.

This procedure worked well for me. Maybe it useful to somebody else. I think it should be possible to enhance cpmtools to understand the concatenated images on the compact flash, but I've not yet looked into that. It would be convenient to use cpmtools directly on the compact flash device.

Cheers
Christian

Sir Isaac

unread,
May 13, 2017, 7:02:29 PM5/13/17
to RC2014-Z80
Brilliant, I've been fighting with XMODEM for the last 2 days. For some reason I can't get it working. I might just have to install linux tonight :)
Thanks, 

Christian van Enckevort

unread,
May 14, 2017, 4:17:18 AM5/14/17
to RC2014-Z80
A version of cpmtools for windows is available: http://www.cpm8680.com/cpmtools/ I haven't tried it though and I do not know how to do the dd steps on Windows.

I still want to try DOWNLOAD.COM as I imagine that will be easier for small one-off transfers. We'll see how much I'll have to fight to get that working ;-)

Spencer Owen

unread,
May 14, 2017, 6:24:24 AM5/14/17
to rc201...@googlegroups.com
Hi Christian,

That is great, thanks for letting us know about this.

I had been thinking that there must be a better way.  I had also been getting bored of watching the dots slowly cross the screen when transferring various programs - but figured that was part of the retro experience :-)

More exciting for me, though, is transferring the files from compact flash to a PC.  I am playing around with creating simple programs on a CP/M RC2014, and, although they are not that useful at the moment, it worried me that I might create something good that I wanted to share with other, but not be able to.  So cpmtools looks ideal!

Thanks

Spencer


--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+unsubscribe@googlegroups.com.
To post to this group, send email to rc201...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/6dc0a854-e2e8-4515-aa25-07e4ebd5366a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Christian van Enckevort

unread,
May 14, 2017, 9:24:43 AM5/14/17
to RC2014-Z80
Hi Spencer,

definitely, cpm tools work both ways: you can copy both ways between cp/m disk images and the normal filesystem. In fact you could keep a collection of disk images and then select 16 to build a compact flash image. The only restrictions are that the first one has to be a boot disk (special first track) and the last image is only 2 Mb instead of 8 Mb. 

A lot of really nice software is available. Personally I am looking forward to playing with turbo pascal. That would be a nice way to write some programs for all of the interesting RC2014 hardware that is being developed.

Cheers,
Christian

Stephen Kelly

unread,
May 14, 2017, 6:08:21 PM5/14/17
to RC2014-Z80
Thanks for the post, Christian.

I had been looking at cpmtools on linux and windows, but I hadn't grasped the importance of the disk definitions.
It's been a long time since I used CP/M and I seem to have forgotten what little I knew.

For anyone who is just using windows, there is a version of dd here http://www.chrysocome.net/downloads/dd-0.6beta3.zip 
I just unzipped the contents into the same folder as cpmtools.
I have split a few of the drives out from the big CF image on windows and I get the expected results from fsck.cpm and cpmls.

Cheers,

Stephen
Message has been deleted

Ian Justman

unread,
May 18, 2017, 6:42:38 AM5/18/17
to RC2014-Z80
I can do one better!  I created a series of entries based on the
ones in this thread along with the "offset" support that allows
cpmtools to access multiple filesystems on the same image or device.

These first two definitions are for single partitions or filesystems:


diskdef rc2014boot
  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 1
  os 2.2
end

diskdef rc2014noboot

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  os 2.2
end

The next sixteen are for each of the partitions on a 128MB CF card.
Each type's name contains the drive letter for ease of reference when
using the -f flag, e.g. "-f rc2014a" for drive A:, "-f rc2014d" for
drive D:, et cetera:

diskdef rc2014a

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 1
  os 2.2
end

diskdef rc2014b

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 512t
  os 2.2
end

diskdef rc2014c

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 1024t
  os 2.2
end

diskdef rc2014d

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 1536t
  os 2.2
end

diskdef rc2014e

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 2048t
  os 2.2
end

diskdef rc2014f

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 2560t
  os 2.2
end

diskdef rc2014g

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 3072t
  os 2.2
end

diskdef rc2014h

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 3584t
  os 2.2
end

diskdef rc2014i

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 4096t
  os 2.2
end

diskdef rc2014j

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 4608t
  os 2.2
end

diskdef rc2014k

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 5120t
  os 2.2
end

diskdef rc2014l

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 5632t
  os 2.2
end

diskdef rc2014m

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 6144t
  os 2.2
end

diskdef rc2014n

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 6656t
  os 2.2
end

diskdef rc2014o

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 7168t
  os 2.2
end

diskdef rc2014p
  seclen 512
  tracks 128

  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  offset 7680t
  os 2.2
end

I tested these mainly by accessing my CF card directly when it was connected to an
Ubuntu machine on my bench (which happened to be a VM on an ESXi hypervisor box).

Here is the environment I used:

--Ubuntu Linux 17.04 ("Zesty Zapus")
--cpmtools 2.20 (apt-get install cpmtools)

This build does not contain libdsk, but you really don't need it here.  This should
work fine under whatever environment under which you run cpmtools.

I hope this helps everyone!

--IJ.

Ian Justman

unread,
May 18, 2017, 6:46:14 AM5/18/17
to RC2014-Z80

Since the formatting in my post got a little hosed after I posted it, I'm attaching a copy of the definitions by themselves which you can then paste to your own file.

Hope this helps!

--IJ.

rc2014cf-cpmtools-diskdefs.txt

Ian Justman

unread,
May 18, 2017, 5:28:07 PM5/18/17
to RC2014-Z80
I've also tested my definitions with cpmtools for Windows as has been linked elsewhere on this thread.

There are two caveats to be aware of if you are operating on a CF card directly:

  1. You must run your command prompt as administrator.
  2. You need to find out which disk you will be using.  You can find out by doing any of the following:
    1. Go into the computer management console, then Storage->Disk Management.  Note the number of your disk.
    2. In your administrator prompt, run "diskpart", then at the dispkart prompt, type: "list disks".  Note the number of your disk.
Once you get your information, then you specify the image as "\\.\PhysicalDrive(X)" where (X) is your disk

If you operate on just an image file, whether split or combined, you do not need an administrator-level command prompt.

In all cases, you MUST either be logged into the drive and directory where you have cpmtools installed so it can see your diskdefs file.  Optionally, if you choose to keep all your images in one spot, you can keep your copy with just the RC2014-related definitions in the same directory as your images if you log into that drive and directory.  You may elect to copy the tools into that same directory to make things easier.

Attached are two examples of how to use cpmtools to operate on images and cards.  I use Win32 Image Writer to handle reading and writing of CF images under Windows.  Were I using Linux, dd and I would be besties. ;3

Hope this helps!

--IJ
cfcard-dir.png
image-dir.png

Ian Justman

unread,
May 23, 2017, 1:42:10 AM5/23/17
to RC2014-Z80
Here's another program, only this time, using diskdefs, you can directly access the CP/M filesystem under Windows as if it were an actual drive (in this case, using letter Z:), called the CP/M Callback Filesystem, or cpmcbfs.  It uses the same diskdefs file from cpmtools, and I just tried it with a CF card and it works fine.  You can download it here.

Hope this helps!

--IJ.

Spencer Owen

unread,
May 30, 2017, 4:31:41 PM5/30/17
to rc201...@googlegroups.com
Thanks Ian and everyone else that has contributed to this thread.

I've finally had a chance to try things out on my Windows laptop.  I didn't get too far with cpmtools, although I think I probably skipped over a couple of bits.  However, cpmcbfs works great :-)

as a tl;dr guide for others,
Download and install cpmcbfs from http://www.nyangau.org/cpmcbfs/cpmcbfs.htm and reboot
Download Ians rc2014cf-diskdefs.txt from earlier in this thread and append the copy & paste the text to the end of diskdefs in your c:\cpmcbfs folder
Plug in your CF card
Run cpmcbfs -i ? 
Identify your CF drive.  Mine was \\.\PhysicalDrive1
Run cpmcbfs -f rc2014c -i \\.\PhysicalDrive1
(change rc2014c to any drive from rc2014a - rc2014p)

Cheers

Spencer


--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+unsubscribe@googlegroups.com.
To post to this group, send email to rc201...@googlegroups.com.

Jim80686

unread,
May 31, 2017, 11:01:50 PM5/31/17
to RC2014-Z80
Spencer - what version of windows are you using?

When I try this, Win10 gives me a raspberry with, "Exception: A volume has been accessed for which a file system driver is required that has not yet been loaded."

   <*> Jim

Ian Justman

unread,
Jun 1, 2017, 1:45:01 AM6/1/17
to RC2014-Z80
There are several steps that need to be taken to install that driver before you can use cpmcbfs.  To do that, you need to do the following:
  1. Once you've installed cpmcbfs, start up a command prompt as administrator.
  2. Run cpmcbfs --install to install the driver.
  3. Reboot.
You should then be able to run cpmcbfs as Spencer documented above.

Note you only need to do this procedure once.

Hope this helps.

--IJ.

Spencer Owen

unread,
Jun 1, 2017, 5:26:57 AM6/1/17
to rc201...@googlegroups.com
Hi Jim,

Yes, it's Windows 10 that I used too.  For me, it "just worked"tm, so I haven't done any troubleshooting.

As Ian points out below, you need to run the command prompt window as Admin, and reboot when prompted.

Spencer

--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+unsubscribe@googlegroups.com.
To post to this group, send email to rc201...@googlegroups.com.

StephenA

unread,
Jul 19, 2018, 3:11:52 AM7/19/18
to RC2014-Z80


On Friday, May 19, 2017 at 7:28:07 AM UTC+10, Ian Justman wrote:


Hope this helps!

--IJ

Yes! Yes it does.

Works a charm.

Thank-you to both Christian and Ian for showing the way.

For those following, My distro 64bit Xubuntu (Ubuntu 18.04 LTS). All instructions this thread "just work".




Andy Nicol

unread,
Oct 31, 2019, 8:12:09 PM10/31/19
to RC2014-Z80
Hi all,

I seem to have reinvented the wheel by discovering cpmtools and configuring disk definitions to be able to read/write the CF card before Spencer kindly pointed me to this page. There are some subtle differences between my diskdefs and the ones published here, which may bear some checking out. Also it may help someone to see how it's all worked out. Firstly, here's what I did:


- append this to /etc/cpmtools/diskdefs
# 8MB drives on RC2014
diskdef rc2014a
  seclen 128
  tracks 512
  sectrk 128
  blocksize 4096
  maxdir 512
  skew 0

  boottrk 1
  os 2.2
end
diskdef rc2014b
  seclen 128
  tracks 512
  sectrk 128
  blocksize 4096
  maxdir 512
  skew 0
  boottrk 0
  os 2.2
  offset 512trk
end
diskdef rc2014c
  seclen 128
  tracks 512
  sectrk 128
  blocksize 4096
  maxdir 512
  skew 0
  boottrk 0
  os 2.2
  offset 1024trk
end
diskdef rc2014d
  seclen 128
  tracks 512
  sectrk 128
  blocksize 4096
  maxdir 512
  skew 0
  boottrk 0
  os 2.2
  offset 1536trk
end
diskdef rc2014e
  seclen 128
  tracks 512
  sectrk 128
  blocksize 4096
  maxdir 512
  skew 0
  boottrk 0
  os 2.2
  offset 2048trk
end

- read CF card (assumes SDB is the drive, you must check this for your machine. 253008 is the size reported by the driver in dmesg. Slave is an arbitrary file name)
sudo dd if=/dev/sdb count=253008 of=slave

- add z80 assembler to drive E
cpmcp -f rc2014e slave ~/rc2014/Software/Z80-asm/Z80ASMSLR/Z80ASM.COM 0:

- check the file has been written
cpmls -f rc2014e slave

- update CF card (dd needs sudo to read/write to a block disk device on Linux, very wisely in my opinion because you could wreck a HDD if you get the wrong drive ID)
sudo dd if=slave of=/dev/sdb count=253008

Now you will see that my  values for seclen and  sectrk differ from those previously published. It may not matter, I'm not sure. My justification for the figures I chose is as follows:

seclen is the sector length which on CP/M is fixed at 128 bytes.
I computed sectrk based on pulling the disk tables from the CP/M boot image on the CF card as follows:

DPB (Disk Parameter Block, all figures in hex)

001730 00 06 fc 80 00 05 1f 01 fb 07 ff 01 f0 00 00 00  >................<
001740 01 00 80 00 05 1f 01 ff 07 ff 01 f0 00 00 00 00  >................<
001750 00 80 00 05 1f 01 ff 01 ff 01 f0 00 00 00 00 00  >................<


1733: 8000 05 1f 01 fb07 ff01 f0 00 0000 0100
1742: 8000 05 1f 01 ff07 ff01 f0 00 0000 0000
1751: 8000 05 1f 01 ff01 ff01 f0 00 0000 0000
 
for DPB at address 11733:
SPT = 0080 (128d sectors per track)
BSH = 05 (5d)
BLM = 1f (31d)
EXM = 01 (1d)
DSM = 07fb
DRM = 01ff
AL0 = F0
AL1 = 00
CKS = 0000
OFF = 0001 (1d reserved tracks at the start of the logical disk)

The offset of 1 cylinder for the first DPB corresponds to 128 bytes per sector * 128 sectors per track, ie 16 KB which correctly brings me to the start of the directory.
Telling cpmtools that the sector size is 512 and number of sectors is 32  comes to the same product so those figures get us correctly over the system image. I suppose that's what you would need if you had a physical implementation of a 512 byte-per-sector drive, whereas I've used the values that CP/M would see after deblocking - is that correct?

Incidentally the block size is deduced from the values of BSH and BLM, from the CP/M manual (http://www.cpm.z80.de/manuals/NorthStarCPM22Manual.pdf) this gives 4096 bytes. Possible values are:

(3, 7) => 1024
(4, 15) => 2048
(5, 31) => 4096
(6, 63) => 8192
(7, 127) =>16384

This may be going over old ground for many of you, but hopefully someone will find it of value.

Also worthy of note is the Z80pack CP/M emulator, which is where I discovered cpmtools. This allowed me to run a virtual CP/M machine and to import files using cpmtools. For anyone unwilling or unable to build a physical micro, it's not a bad alternative.


Douglas Miller

unread,
Oct 31, 2019, 8:27:00 PM10/31/19
to RC2014-Z80
I'll throw this out there in case it is of value. I made some modifications to cpmtools a few years ago (and have not been able to get those fed back to the right person for integration) so that a diskdef can be passed directly to cpmtools, rather than having to be in a diskdefs file. I did this for use with my simulators since they support a wide range of floppy formats as well as harddisk images with custom partitioning. I use a wrapper script on the cpmtools that looks at the image and builds ad-hoc the appropriate diskdef (based on partition number, for HDD or CF), then passes that on the commandline to cpmtools, relieving me of having to remember what image was what format, and also from creating more diskdefs entries for every harddisk (or CF) partitioning scheme I create.

Does anyone know the official owner? I'm maintaining mine at https://github.com/durgadas311/cpmtools.git, and it is based on version 2.20. That is a fork off http://www.moria.de/~michael/cpmtools/.

Alan Cox

unread,
Oct 31, 2019, 8:31:40 PM10/31/19
to rc201...@googlegroups.com
> Does anyone know the official owner? I'm maintaining mine at https://github.com/durgadas311/cpmtools.git, and it is based on version 2.20. That is a fork off http://www.moria.de/~michael/cpmtools/.

The Linux distributions at least seem to think that the moria.de
version is definitive :
mic...@moria.de

shadow 338

unread,
Nov 15, 2021, 10:22:10 PM11/15/21
to RC2014-Z80
Does anyone know if the methods listed here also apply to SD's? I have a SC126 computer with the SD adapter (SC303) however I'm still testing cpmtools under linux but so far no I had no luck. Whenever I try to copy a file I get the following:

$ sudo cpmcp -f rc2014e /dev/sdd unarc.com 0:
cpmcp: can not create 00unarc.com: directory full

(tested multiple diskdefs at this point)

cheers.

Richard Deane

unread,
Nov 16, 2021, 6:39:23 AM11/16/21
to rc201...@googlegroups.com
I think the problem is that you cannot write directly to the physical media from cpmtools.

You need to use a tool such as DD, Win32diskimager, Raspberry PI Imager, on mac - Apple Pi Baker, to read the SD or CF into a file, use cpmtools on the file, then write the image file back to the CF or SD media.

Richard


--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/3b05b93c-b0c4-473f-9afe-9645fdedff77n%40googlegroups.com.

Douglas Miller

unread,
Nov 16, 2021, 7:53:42 AM11/16/21
to RC2014-Z80
I would expect that directly accessing the block device ("/dev/sdd") would work, but maybe check that "sdd" is the correct device to use (is there a partition table on the SD card? I'm not sure if the SC126 ROM you're using supports partition tables (MSDOS MBR).

Perhaps cpmtools is also getting confused by the ambiguous reference to "unarc.com" - maybe try "./unarc.com" so that cpmtools fully understands that it is a host file, not a CP/M file.

Might help to try and read the directory first, too, just to confirm that you are accessing what you think you are. I always do a "cpmls -d ..." first and make sure it is a valid CP/M image and is the "disk" I intend to use.

Alan Cox

unread,
Nov 16, 2021, 8:11:17 AM11/16/21
to rc201...@googlegroups.com
On Tue, 16 Nov 2021 at 03:22, shadow 338 <henrique...@gmail.com> wrote:
Does anyone know if the methods listed here also apply to SD's? I have a SC126 computer with the SD adapter (SC303) however I'm still testing cpmtools under linux but so far no I had no luck. Whenever I try to copy a file I get the following:

$ sudo cpmcp -f rc2014e /dev/sdd unarc.com 0:
cpmcp: can not create 00unarc.com: directory full

(tested multiple diskdefs at this point)

For Linux at least they do. However you may need to figure out which of the diskdefs you need and if your disk is partitioned (if so you'll want to use the relevant partition name instead). Also is it already formatted and working in ROMWBW - if it is then test with cpmls and also copying a file *from* the device and checking it is valid on the Linux end. Otherwise you may end up corrupting the SD card and having to recreate the file systems.

Depending upon the disk geometry and putting the info in the BIOS only was unfortunately one of CP/M's great mistakes compared with other period OS.

Alan

Wayne Warthen

unread,
Nov 16, 2021, 12:44:33 PM11/16/21
to RC2014-Z80
You need to use mkfs.cpm first to prepare the directory area before using cpmcp.

-Wayne

shadow 338

unread,
Nov 16, 2021, 2:36:36 PM11/16/21
to RC2014-Z80
The SD card has no partition and I prepared it using mkfs.cpm. I even ran 'CRLDIR' on all drives from the SC126 computer before starting testing copying files (just in case).
The SD card works great within the SC126 under CP/M in the sense that I can copy to/from the SD.

The confusing part is this:

After some more testing, I was able to copy a file directly to the SD with cpmtools under linux:

$ sudo cpmcp -f rc2014a /dev/sdd unarc.doc 0:unarc.doc

$ sudo cpmls -f rc2014a /dev/sdd
0:
foo.com
unarc.com
unarc.doc

(these are all files that I copied as a test from my computer to the SD (/dev/sdd) )

The issue that I'm seeing is that when I plug the SD back on the SC computer and boot CP/M run a 'dir' on all drives (C-J), all drives are empty.
Those 3 files cannot be found on any of the 8 available drives.

I even went further and did all this not using the device directly (/dev/sdd) but using an image that I created with 'dd'.
I'm able to add files to this SD image file and list the files, however once I re-image the SD with this new image and boot CP/M, again the files are not there. All drives are empty.


It may be that my 'diskdefs' is still not right but how this mapping is done e.g. '0:' '1:' '2:' and the letter drives under CP/M?

Douglas Miller

unread,
Nov 16, 2021, 2:43:05 PM11/16/21
to RC2014-Z80
It is sounding more like the diskdefs are not quite right. You might need to share what you're using for diskdefs, and even a portion of the disk image.

In cpmtools, things like "0:" designate user number, not partition or drive number. For multi-drive (partitioned) disk images, the format (e.g. "rc2014a") would specify the partition offset, so you'd have different formats for each partition.

Wayne Warthen

unread,
Nov 16, 2021, 2:51:44 PM11/16/21
to RC2014-Z80
On Tuesday, November 16, 2021 at 11:36:36 AM UTC-8 henrique...@gmail.com wrote:

$ sudo cpmcp -f rc2014a /dev/sdd unarc.doc 0:unarc.doc

$ sudo cpmls -f rc2014a /dev/sdd
0:
foo.com
unarc.com
unarc.doc

Definitely the wrong disk definition.  The rc2014x definitions are for Grant Searle's disk setup.  I assume you are using RomWBW since it was distributed with the SC 1216.  You want the ones like this:

wbw_hd0
wbw_hd1
wbw_hd2
etc.

-Wayne

 

shadow 338

unread,
Nov 16, 2021, 4:10:29 PM11/16/21
to RC2014-Z80
correct, I'm using RomWBW and the SD card is 32GB big which I guess it does not matter how big it is as from the CP/M you always get 8x 8MB drives. (correct me if I'm wrong here).

I'm wondering if there is any place that we can start from when it comes down to figure the correct disk definitions. 
But let's say for the sake of simplicity, I want to set the diskdefs file just to handle 1 drive (8MB) and not deal with offset's for the subsequent drives, I still need to figure all these fields:

  seclen
  tracks
  sectrk
  blocksize
  maxdir
  skew
  boottrk

I'm wondering if there is a tool in linux that can help figure out this.

Wayne Warthen

unread,
Nov 16, 2021, 4:23:10 PM11/16/21
to RC2014-Z80
Just take a look at the "diskdefs" file in the /Source/Images directory of the RomWBW distribution.  You will find the entries for the first 4 slices of a RomWBW hard disk there.  It is the wbw_hd0, wbw_hd1, etc. series.  You could create entries for the slices beyond the first 4 by looking at how the numbers are incremented between the 4 entries provided.  It is pretty straightforward to create more entries based on the existing ones.

RomWBW will generally assign the first 8 slices of a disk to drive letters at startup.  However, you can use the ASSIGN command to remap the slices and get access to as many as 256 slices.  Obviously, you can only have as many slices assigned at one time as you have driver letters in CP/M (A:-P:).

-Wayne

shadow 338

unread,
Nov 16, 2021, 4:48:37 PM11/16/21
to RC2014-Z80
That worked! thanks Wayne.

## Linux side:
$ sudo mkfs.cpm -f wbw_hd0 /dev/sdd

$ sudo cpmcp -f wbw_hd0 /dev/sdd mandel.com 0:mandel.com

$ sudo cpmls -f wbw_hd0 /dev/sdd
0:
mandel.com


## SC126 (CP/M):

B>dir c:
C: MANDEL   COM

Wayne Warthen

unread,
Nov 16, 2021, 5:34:39 PM11/16/21
to RC2014-Z80
On Tuesday, November 16, 2021 at 1:48:37 PM UTC-8 henrique...@gmail.com wrote:
That worked! thanks Wayne.

No problem.  Glad you got it working. 

shadow 338

unread,
Nov 16, 2021, 10:23:11 PM11/16/21
to RC2014-Z80
Attached my diskdefs file that gives me 8MB drives (from C to J) on a SD card under RomWBW HBIOS v3.0 (SC126 computer)

Adding test files to all 8 drives:
$ for i in {c..j}; do sudo cpmcp -f sd_$i /dev/sdd foo_$i 0:foo_$i; done

List files under CP/M:

B>DIR C:
C: FOO_C
   
B>DIR D:
D: FOO_D 
    
B>DIR E:
E: FOO_E 
    
B>DIR F:
F: FOO_F 
    
B>DIR G:
G: FOO_G 
    
B>DIR H:
H: FOO_H      
B>DIR I:
I: FOO_I  
   
B>DIR J:
J: FOO_J 
diskdefs

Guido Lehwalder

unread,
Apr 9, 2022, 5:11:43 AM4/9/22
to RC2014-Z80
While trying to use cpmtools for a .cf image of the RC2014-Emulation on a Raspberry Pico (its named RC2040) I did try the diskdefs from this thread for a .img that does contain 8MB drives for A: to O: and 2MB for P: 

Directorys has been listed fine, but while copying a file from/to the image I did get only bad binarys :(

The problem was that the diskdefs from this thread have been configured for a .img file and the .cf file
(IDE disk format) of the RC2014 emualtion does add a 1K (1024 bytes) header that holds meta-data and the virtual identify block.

So when using cpmtoos with the .cf we have a 1K offset in the binary data :(

In the diskdefs of this thread there was a offset of 512 Tracks (512trk) used between each partition in the .img file. To include the size of the .cf header I had the idea to switch from Tracks to Sectors in the offset, because the Sector-Lenth (seclen) is 512 bytes and if we add 2 additional sectors to each offset for the drives we could get the "pointer" to the right place.

If we assume a drive number of 0 for A: through 15 for P: I used the following formula to calculate the offset:
header 1024 bytes = compares to 2 x seclen/sectors of 512 bytes
offset from one partition to another = 512 tracks = x32 sectors = 16384 sectors  
offset for drivename a: - p: = 2 sectors header + ( partno (a:0-p:15) x (512 tracks x 32 sectrk)

That will us give the following values for the dirves rc2040a - rc2040p (formerly rc2014a - rc2014p):
rc2040a   offset  2sec
rc2040b   offset  16386sec
rc2040c   offset  32770sec
rc2040d   offset  49154sec
rc2040e   offset  65538sec
rc2040f   offset  81922sec
rc2040g   offset  98306sec
rc2040h   offset  114690sec
rc2040i   offset  131074sec
rc2040j   offset  147458sec
rc2040k   offset  163842sec
rc2040l   offset  180226sec
rc2040m   offset  196610sec
rc2040n   offset  212994sec
rc2040o   offset  229378sec
rc2040p   offset  245762sec

So I added these offsets to my new diskdef-file and did try some commands on the 128MB .cf file which I do use with the RC2040-Emulation - and it did work fine :)

As attachment you will find my version of the file - maybe this will help also some other RC2014-emulation projects for better accessing a .cf file ;)

Sample entrys:

# rc2040 a = BOOT
diskdef rc2040a

  seclen 512
  tracks 512
  sectrk 32
  blocksize 4096
  maxdir 512
# rc2040 B = BOOT
  boottrk 1
# rc2040a ( 2 + 0 x( 512 x 32 ) =  2
  offset 2sec
  os 2.2
end

...

diskdef rc2040p
  seclen 512
  tracks 128

  sectrk 32
  blocksize 4096
  maxdir 512
  boottrk 0
  # Offset of next partition
  # rc2040p ( 2 + 15 x( 512 x 32 ) =  245762
  offset 245762 sec
  os 2.2
end
rc2040cf-cpmtools-diskdefs.zip

Wayne Warthen

unread,
Apr 9, 2022, 4:23:39 PM4/9/22
to RC2014-Z80
Hi Guido,

In the interest of avoiding any frustration for others, I want to remind everyone that the disk layouts used by RomWBW and the Grant Searle CP/M are different.  In the prior posts in this thread, some refer to RomWBW and some refer to the Grant Searle CP/M.  Looking at your definitions, they appear to be based on the Grant Searle CP/M (which is fine).

Regardless, the way you accommodated the 1K header used by the emulator makes sense and the technique itself is appropriate regardless.

My only point is that when dealing with cpmtools, it is critical that your definitions match your system.  In the RC2014 world, this mostly means being aware of whether you are using RomWBW or Grant Searle's disk layout.

Thanks,

Wayne

Guido Lehwalder

unread,
Apr 9, 2022, 4:41:23 PM4/9/22
to RC2014-Z80
Hi Wayne,
OK - I didnt know about RomWBW - I did see it only in the last messages of this thread.
I was refering to the diskdefs-zip file from
<irj****m...@gmail.com> 18.05.2017, 13:46:14
in this thread - and yes they are in Grant Searle's disk layout for a 128MB .cf/.dsk image

Sorry for the RomWBW-Users :( but I dont know if they also got a problem with a header
on their image-files.
Reply all
Reply to author
Forward
0 new messages