Acorn CP/M Formats

discuss PC<>Acorn file transfer issues & the use of FDC, XFER, Omniflop/disk etc.
Post Reply
Coeus
Posts: 1081
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Acorn CP/M Formats

Post by Coeus » Fri Jun 15, 2018 10:55 am

For Linux there is cpmtools which enables working with CP/M discs from a variety of CP/M systems. In order to adapt to the disc format of various different CP/M systems it uses a definition file so, for example:

Code: Select all

diskdef ibm-3740
  seclen 128
  tracks 77
  sectrk 26
  blocksize 1024
  maxdir 64
  skew 6
  boottrk 2
  os 2.2
end
I'd like to write the correct definition of Acorn CP/M discs, though already I think I may need two entries: one for a boot disc and one for a data disc. I found this on mdfs.net (http://mdfs.net/Docs/Comp/Disk/Format/CPMLayouts):

Code: Select all

AcornCPM
--------
Always 400K
00000000: System, usually starts with "AcornCP"
00001E00: DIRECTORY area - 128 entries, occupies blocks 0,1
00002E00: DATA area - starts at block 2
with logical-to-physical sector deblocking and skewing
blocks are 2048 bytes
This entry does not provide enough information by itself so I thought I'd look at one of the disc image files in a hex editor. Looking at cmp2.dsd (a data disc) I see:

Code: Select all

00000000 - 41 63 6F 72 6E 20 43 50 43 50 4D 44 49 53 43 A4 Acorn CPCPMDISC.
00000010 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000020 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000030 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000040 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000050 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000060 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000070 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000080 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000090 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000A0 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000B0 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000C0 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000D0 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000E0 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000F0 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000100 - 2F 4D 20 20 00 08 03 20 00 00 00 00 00 1E 30 02 /M  ... ......0.
00000110 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
The fact there is a gap and then more information starts at 0100 suggests a possible sector size of 256. Later on I can see the start of the directory:

Code: Select all

00001E00 - 00 43 4F 53 55 42 53 20 20 42 41 53 00 00 00 23 .COSUBS  BAS...#
00001E10 - 02 03 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001E20 - 00 43 4F 4D 50 4D 45 4E 55 44 41 54 00 00 00 01 .COMPMENUDAT....
00001E30 - 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001E40 - 00 53 59 4D 45 4E 55 20 20 30 31 20 00 00 00 02 .SYMENU  01 ....
00001E50 - 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001E60 - 00 53 59 4D 45 4E 55 20 20 30 32 20 00 00 00 02 .SYMENU  02 ....
00001E70 - 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001E80 - 00 44 53 4D 45 4E 55 20 20 44 41 54 00 00 00 04 .DSMENU  DAT....
00001E90 - 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001EA0 - 00 44 50 4D 45 4E 55 20 20 44 41 54 00 00 00 03 .DPMENU  DAT....
00001EB0 - 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001EC0 - 00 44 4E 4D 45 4E 55 20 20 44 41 54 00 00 00 0F .DNMENU  DAT....
00001ED0 - 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001EE0 - 00 4D 45 4E 55 20 20 20 20 42 41 53 00 00 00 59 .MENU    BAS...Y
00001EF0 - 0B 0C 0D 0E 0F 10 00 00 00 00 00 00 00 00 00 00 ................
00001F00 - 00 44 41 59 43 41 53 48 20 42 41 53 00 00 00 04 .DAYCASH BAS....
00001F10 - 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001F20 - 00 44 41 59 43 41 53 48 32 42 41 53 00 00 00 0B .DAYCASH2BAS....
00001F30 - 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001F40 - 00 44 41 59 43 41 53 48 33 42 41 53 00 00 00 49 .DAYCASH3BAS...I
00001F50 - 13 14 15 16 17 00 00 00 00 00 00 00 00 00 00 00 ................
00001F60 - 00 44 41 59 43 41 53 48 50 42 41 53 00 00 00 04 .DAYCASHPBAS....
00001F70 - 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001F80 - 00 44 41 59 43 52 45 44 20 42 41 53 00 00 00 08 .DAYCRED BAS....
00001F90 - 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001FA0 - 00 44 41 59 43 52 45 44 50 42 41 53 00 00 00 08 .DAYCREDPBAS....
00001FB0 - 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001FC0 - 00 44 41 59 43 52 49 4E 20 42 41 53 00 00 00 14 .DAYCRIN BAS....
00001FD0 - 1B 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001FE0 - 00 44 41 59 43 52 49 4E 32 42 41 53 00 00 00 32 .DAYCRIN2BAS...2
00001FF0 - 1D 1E 1F 20 00 00 00 00 00 00 00 00 00 00 00 00 ... ............
00002000 - E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 ................
00002010 - E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 ................
00002020 - E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 ................
00002030 - E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 ................
but as you can see, there is then a gap, filled with empty, formatted space. In this case, though the size of the first part of the directory is 512 bytes, then there is a gap of 512 bytes, then another 512 bytes of directory entries, then another gap of 512 bytes etc:

Code: Select all

000021F0 - E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 ................
00002200 - 00 44 41 59 43 52 49 4E 33 42 41 53 00 00 00 30 .DAYCRIN3BAS...0
00002210 - 21 22 23 00 00 00 00 00 00 00 00 00 00 00 00 00 !"#.............
00002220 - 00 44 41 59 49 20 20 20 20 42 41 53 00 00 00 2C .DAYI    BAS...,
00002230 - 24 25 26 00 00 00 00 00 00 00 00 00 00 00 00 00 $%&.............
00002240 - 00 44 41 59 49 43 4E 49 31 42 41 53 00 00 00 3B .DAYICNI1BAS...;
00002250 - 27 28 29 2A 00 00 00 00 00 00 00 00 00 00 00 00 '()*............
00002260 - 00 44 41 59 49 43 4E 49 32 42 41 53 00 00 00 0A .DAYICNI2BAS....
so this would seem to be suggesting a sector size of 512. Back to the definition file I was talking about I can set it to skip some space at the start before the directory by declaring a number of system tracks. Assuming a sector size of 512 that means I could declare one system track, but this would mean a track of 15 x 512 byte sectors which seems very high, probably beyond what the disc hardware could do. I can't split that into two tracks because 15 is not an even number.

So, does anyone have any more information on this, please?

User avatar
lurkio
Posts: 1782
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Acorn CP/M Formats

Post by lurkio » Fri Jun 15, 2018 11:28 am

Is the following post (and/or other posts in the same thread) of any help?:
:?:

User avatar
jgharston
Posts: 3248
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Acorn CP/M Formats

Post by jgharston » Fri Jun 15, 2018 2:30 pm

http://mdfs.net/Docs/Comp/Disk/Format/AcornCPM

Floppies:
256 bytes per sector (single) 512 bytes per sector (double)
10 sectors per track
tracks count up side 0, then *down* side 1
3 reserved tracks - *always* single density
128 (single) 256 (double) directory entries
1024-byte (single) or 2048 (double) disk blocks
128-byte CPM records bundled into 512-byte logical sectors
logical sectors mapped to physical sectors with:
physical=(logical*4)MOD10, physical=(logical*4)MOD10+1 (single)
unsure with double density, there's a bit missing from the document

Hard drive (disk image file):
256 bytes per sector
256 reserved bytes
1024 directory entries
128-byte CPM records bundled into 1024-byte disk blocks
128-byte CPM records bundled into 512-byte logical sectors
offset into image = logicalsector*512+256

CPMFiler demonstrates how to access Acorn CP/M floppies and disk images.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

Coeus
Posts: 1081
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Acorn CP/M Formats

Post by Coeus » Fri Jun 15, 2018 4:02 pm

Thanks everyone. The first discussion was very interesting - it was z80pack that lead me to cpmtools in the first place.

And clearly looking in mdfs.net as I originally did was a good plan, I just didn't find the right page.

I have one remaining query, though. There are some CP/M discs bundled with B-Em. I have no idea how they got there but cmp1.dsd appears to be a bootable disc, the others not. In the case of cmp1.dsd the directory starts at 3C00 whereas for the others, cpm2.dsd through to cmp7.dsd it starts at 1E00.

According to http://mdfs.net/Docs/Comp/Disk/Format/AcornCPM that would make the first disc DD and the others SD but they are all the same size - 400K - which is what I'd expect for SD.

Coeus
Posts: 1081
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Acorn CP/M Formats

Post by Coeus » Fri Jun 15, 2018 4:51 pm

To answer my own question, at least to a point, I note that B-Em detects the first of those CPM discs as "double-sided, interleaved" and the others as "doubled-sided, sequential" so it looks like the file extension is misleading. Once I de-interleave the first disc the directory starts at 1E00 just the same as the others.

User avatar
jgharston
Posts: 3248
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Acorn CP/M Formats

Post by jgharston » Fri Jun 15, 2018 6:45 pm

I've also uploaded the source for CPMFiler so you can see the comments and code structure:
http://mdfs.net/Software/CPM/Filer/

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

Post Reply