开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: Where's the CPM files


 

Hi Alison,

The way I wrote CP/M BIOS on the Z80MC is to open a FAT16 File and use it like a drive.
I wanted to use the SD card in a manner that would still let the user read/write files through existing Windows file explorer.
I thought about just mapping sectors directly to CP/M but that's far too easy, wasteful and not my style.

In CP/M, access to a block is translated to 128 byte disk sectors.
The BIOS converts this to a 512 byte sector, and the cluster required, then goes FAT hopping.
The 512 byte sector is read into RAM and a pointer to the correct 128 bytes is returned.

Of course, I consider the 4 (128 sectors) as cached and new SD card reads are not required.
Writing updates the cache and simply flags a "dirty data" condition.? The next read that changes the 512 byte cache will trigger the write back to disk.
So, there is a chance that writes don't make it to disk, but since most normal programs in CP/M return to CP/M, the reading of the system sectors should satisfy clearing out the cache.

Cheers,
Josh



On Saturday, September 26, 2020, 01:57:34 p.m. EDT, ajparent1/kb1gmx <kb1gmx@...> wrote:


With care cpm explorer runs in wine.

Either case CP/M knows nothing of fat so what many do is create a
contiguous 8mb file as a container file and then find out what block
address it starts at.? Then CP/M addresses the block directly
without fat.

So CP/M will not read fat files, the file structure is very incompatible.
Its possible to run a utility that does BIOS direct DISK IO and read
FAT using a program that knows fat structure but that's only useful
to get from CP/M to FAT or FAT to CP/M.? I have that for AmproLB+
and Kaypro4/84 its called DOS.? Obvious the media must be compatible
(720K 3.5" floppy was the standard here for that) as back then SD and CF
were far in the future.? The program called DOS is on the SC CD but it
would need a great amount of work for FAT devices larger than 500mb.

SD cards do not care what file format you use.? ?If you partition it you
can have multiple CP/M partitions.? Oh CP/M does not use partition
table on that media either.? ? Use a freshly formated or new SD
(1gb is plenty large) and write a bunch of FAT files of 8MB each then use?
a program to get the starting bock address of each.? The CP/M BIOS
needs to know [when you code it, or as a default that can be changed
for B:/C:/D:... drives] what the block starting address is for a given Logical Drive.

Using linux DD is both your friend and feind.? It can write blocks to specified
addresses easily but only using great care as it can write blocks to specified?
addresses easily (oops wrong blocks or device).

Allison

Join [email protected] to automatically receive all group messages.