Questions to floppy disk formate and implementation in RomWBW

132 views
Skip to first unread message

Laszlo Szolnoki

unread,
Jan 24, 2023, 7:36:45 AM1/24/23
to RC2014-Z80
Hello all,
I have reached my limits and need urgent help. I would like to implement some special disk formats in CPM 2.2. like this:

# robotron PC1715 SCP 624k (80*2* 16,256 8 OFS 4k DIR) 5.25"
# setfdprm /dev/fd1 ds dd ssize=256 cyl=80 sect=16 head=2 dtr=1 fm=0
diskdef scp624
  seclen 256
  tracks 160
  sectrk 16
  blocksize 2048
  maxdir 128
  skew 0
  boottrk 4
  os 2.2
  libdsk:format scp640
end
# robotron PC1715 SCP 780k (80*2* 5,1024 8 OFS 4k DIR) 5.25"
# setfdprm /dev/fd1 ds dd ssize=1024 cyl=80 sect=5 head=2 dtr=1 fm=0
diskdef scp780
  seclen 1024
  tracks 160
  sectrk 5
  blocksize 2048
  maxdir 128
  skew 0
  boottrk 4
  os 2.2
  libdsk:format scp800
end

# robotron PC1715 SCP 800k (80*2* 5,1024 0 OFS 4k DIR) 5.25"
# setfdprm /dev/fd1 ds dd ssize=1024 cyl=80 sect=5 head=2 dtr=1 fm=0
diskdef scp800
  seclen 1024
  tracks 160
  sectrk 5
  blocksize 2048
  maxdir 128
  skew 0
  boottrk 0
  os 2.2
  libdsk:format scp800
end 

Ideally, I would like to have a separate drive assigned for each of these special formats. Or alternatively some kind of overloading, if that is possible. As I read on the web, it should be possible to overload drivers in CP/M.

1. where should I start with the implementation? HBIOS should be able to handle the hardware and sector sizes. However, I don't think it can handle 1k sectors at this time. FCD_N is set to 2, for 1k it should be 3.

2. where should the number of directory entries and the location of the directory respectively the number of boot tracks be implemented? In the CBIOS?

3. how to manage the drive mapping like
A> 624k format
B> 780k format
C> 800k format

I would greatly appreciate any input and help to realize my project. 
Cheers
Laszlo

Wayne Warthen

unread,
Jan 24, 2023, 5:20:50 PM1/24/23
to RC2014-Z80
Hi Laszlo,

See below...

Yes, CP/M allows you to set a disk format when the disk is logged in (initial access basically).  This is basically done by dynamically choosing the appropriate BPB for the drive.  RomWBW does exactly this to support
using either 720K or 1.44M disks dynamically.

1. where should I start with the implementation? HBIOS should be able to handle the hardware and sector sizes. However, I don't think it can handle 1k sectors at this time. FCD_N is set to 2, for 1k it should be 3.

Floppy support under RomWBW is pretty reliable, but it is not very flexible.  The design goal was to support the typical IBM disk physical formats and it does that pretty well.  Both the HBIOS and CBIOS layers are basically hard-coded to a 512 byte sector size.  To support alternative sector sizes, quite a few changes would be required.  You have correctly identified one of the changes (modifying the FCD_N value).  However, there are many other changes like transfer lengths, buffer sizes, deblocking code, and probably a lot more.  I don't think I can give a simple set of instructions for this.
 
2. where should the number of directory entries and the location of the directory respectively the number of boot tracks be implemented? In the CBIOS?

Yes, simply changing the directory entry count and the number of boot/system tracks is solely a CBIOS concept.  You should be able to implement such changes by just modifying the existing BPB definitions.

3. how to manage the drive mapping like
A> 624k format
B> 780k format
C> 800k format

I have not looked at this code in a long time.  Basically, the number of floppy drives is determined by the fd.asm driver in HBIOS.  I think it is currently hard-coded to 2.  The mapping of the drives to CP/M drive letters is dynamic.  CBIOS uses a algorithm to do the initial mapping.  After CP/M is running, the ASSIGN command can  then be used to modify the mapping as desired.  However, the number of floppy drives cannot be modified on-the-fly. 

A much more flexible floppy driver would be a welcome enhancement to RomWBW, but is not on the roadmap at this time.  Sorry.

-Wayne

Laszlo Szolnoki

unread,
Jan 24, 2023, 5:35:59 PM1/24/23
to rc201...@googlegroups.com
Wayne,
I was afraid that there would be no direct path to a solution. I have no choice but to dig in. Thanks Laszlo

--
You received this message because you are subscribed to a topic in the Google Groups "RC2014-Z80" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rc2014-z80/aaUXlWgxafg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/2e314374-316c-44ac-826b-df8db86e5c5fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages