• ImHuman

  • by magicaros

Commodore computers where humanly understandable in their whole, who today still know his computer as intimately as we know our commies? That's why i love C= ! beside Retro is the new hype :p


C64 CP/M Disk Format Decripted

This is a deep analysis of how a C64 CP/M and DOS/65 disks works.

First off to understand how the CP/M disk format of the C64 works, we need to understand how Commodore DOS work. See CP/M was designed with the Commodore 1541 IEC single drive or the Commodore 4040 IEEE-488 Dual Drive. Both of wich use GCR and ZBR encoding (Zone bit recording) therefore storing more physical sectors on the outer tracks than on the inner ones 

a single sided disk has 35 Tracks divided into 4 zones; Track 1 to 17 have 21 sectors, Track 18 to 24 have 19 sectors, Track 25 to 30 have 18 sectors and Finaly Track 31 to 35 have 17 sectors. Track 18 hold the Directory and BAM  (Block Availability Map) . (NB: sectors are known as blocks in Commodore terminology)

Commodore sectors (Blocks) are 256 bytes; however CP/M logical sectors are 1Kb so 1 CP/M sector = 4 Blocks

CP/M on the C64 use a second layer of logical formating over the Commodore DOS format. and never use past sector 17 on  any track, Track 1 sector 0 hold the commodore DOS file "CPM" used a bootstrap to boot into CP/M; the rest of Track 1 up to sector 17 and Track 2 up to sector 17 are system track and containt the BIOS, BDOS and CCP; Track 3 up to sector 7 is the CP/M directory (see Picture Below)

CP/M disk IMG


  • CP/M bootstrap
  • CP/M System Reserved Tracks
  • Directory
  • user files space
  • Commodore DIR & BAM
  • Unused (and Zeroed Sectors)
  • * Denote an allocated sector on the Commodore DOS side of thing.

When Analysing a DOS/65 disk things get a bit more complicated However...

For thoses not in the know, DOS/65 is Richard A. Leary CP/M like operating system for 6502 systems. Originaly designed for S-100 systems but ported to the C64 and mostly using the same disk scheme as the C64 CP/M.

more info can be found at http://www.z80.eu/dos65.html

Please Note: "DOS/65 software and documentation are provided as shareware for non-profit, educational, or private use. Any other use is prohibited without approval of Richard A. Leary."

DOS/65 Disk Map Legends:

  • DOS65 bootstrap (Track 6 Sector 17)
  • CP/M System Reserved Tracks
  • START (Track 9 sector 17 & Track 10 sector 20) scratched file
  • START1 (Track 9 sector 17) scratched file crosslinked with START
  • START2 (Track 9 sector 18) scratched file
  • START3 (Track 9 sector 19) scratched file
  • SYSTEM scratched file
  • Directory
  • user files space
  • Commodore DIR & BAM
  • Unused but not zeroed unlike CP/M disk 
  • * Denote an allocated sector on the Commodore DOS side of thing.

behavours sugest however that the scratched files where used to bring the system up for the first time, after bootstraping with DOS65 wich is located track 6 sector 17 and not Track 1 sector 0 like CPM the system load from the CP/M System Reserved Tracks. that cause a problem to make bootable disk by copying system Tracks with C64 CP/M utilities COPY as track 6 sector 17 is not copied this way only System Track and BAM are. Solution might be copy the one sector from basic with U1 & U2 disk commands as loading the bootstrap from master disk and putting the "semi bootable" disk in it's place before typing RUN is combersume. Scratch "dos65" from BAM copy, just load "dos65" form master disk and save it back to the copy in c64 basic

So what do i learn?

C64 disks are 170kb and CP/M or DOS/65 only use 136Kb out of them; there is 86 sectors on CP/M or 85 sectors on DOS/65 that are allocated but unused thoses could be freed for Commodore Basic usage.

Testing around i found out that the bare minimum operation to make a C64 disk recognized by the CP/M or DOS/65 was to just format in under basic and fill the CP/M Directory Tracks with hexadecimal value E5 (very unsafe), Block Allocate all the CP/M used sectors on top off that make a safe CP/M hybrid disk with 86 Blocks free for Commodore Basic and you could probably reclaim the same 86 Blocks or 85 Blocks for DOS/65 with the Block Free disk command.

Such a disk would then look like this:

My Disk CP/M

or like this in case of DOS/65:

My Disk DOS/65

UPDATE: It works...

 Free Unused Block in BASIC

Hybrid Disk Proof of Concept

Leave a Comment

You must be signed-in to post comments.


Goog 1/8/2021

Awesome stuff! Thanks for sharing :)