开云体育

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

FAT without the fat, alternate SD IO


 

Planning a new Eprom for the Z80MC..

The basic plan is a tag and bag file system.? Anyone that has used NSdos
that was such a file system.? The plan s to rewrite NSDOS to use anything
but floppy (and their hard sector controller).? SD is the logical device.

So to do this I need to access the card at the sector level likely LBA.

My first pass is a handful of routines needed:
There is no on device file system assumed such as FAT16 or other
partition, or file table, or allocation table...
So the first usable block to max block (end of media!)? need to be known.
The assumption is 1 block is 512 bytes.
SD _RESET
SD_initial? ? initialize where the SD parameters are pulled from the device.
SD_Read_block
SD_write_block

The code needs to be compact so most FAT code contains unneeded functions.

I assume the SD will have wasted space as 1 or 2gb is far larger than needed.
Storage is cheap these days. Most z80 systems loaded with programs and
applications are relatively small.? ?My largest system uses 128mb CF and I
fill about 45mb of it.? Also PC readable is not required.?

Most examples found are not Z80 asm or are full FAT and most examples
are in C.? C on Z80 tends to produce large code.? A pointer or example code
would be helpful.? The ZMCV15 code has it but ts full FAT.
?

Allison


 

Hi Allison,

You can just cut the FAT out.? Under the FAT is nothing more than reading/writing LBA.

Cheers,
Josh


On Friday, December 15, 2023 at 09:43:21 p.m. EST, ajparent1/kb1gmx <kb1gmx@...> wrote:


Planning a new Eprom for the Z80MC..

The basic plan is a tag and bag file system.? Anyone that has used NSdos
that was such a file system.? The plan s to rewrite NSDOS to use anything
but floppy (and their hard sector controller).? SD is the logical device.

So to do this I need to access the card at the sector level likely LBA.

My first pass is a handful of routines needed:
There is no on device file system assumed such as FAT16 or other
partition, or file table, or allocation table...
So the first usable block to max block (end of media!)? need to be known.
The assumption is 1 block is 512 bytes.
SD _RESET
SD_initial? ? initialize where the SD parameters are pulled from the device.
SD_Read_block
SD_write_block

The code needs to be compact so most FAT code contains unneeded functions.

I assume the SD will have wasted space as 1 or 2gb is far larger than needed.
Storage is cheap these days. Most z80 systems loaded with programs and
applications are relatively small.? ?My largest system uses 128mb CF and I
fill about 45mb of it.? Also PC readable is not required.?

Most examples found are not Z80 asm or are full FAT and most examples
are in C.? C on Z80 tends to produce large code.? A pointer or example code
would be helpful.? The ZMCV15 code has it but ts full FAT.
?

Allison


 

That may be it, I really don't enjoy parsing the FAT structure.? Accessing the device on the
LBA makes more sense to me as its really just a large number of addressable blocks.? I've
done that with IDE/CF for years and its faster.? Also makes it more in common with romdisk.

With the advent of large Eproms romdisk makes having base software available.? The
32K mapping for low address space makes it easy to have the rough equivilent of 8"SSSD
disk (about 240K) for those that remember CP/M 2.2.

Now to wade through the source and make sure I captured the needed code.

NSDOS is a tag and bag DOS.? Its structure is simple.
;***
;? ?Tag-n-Bag a primitive file system for mass storage device.
;? ?
;? ?Directory size typically 4 logical blocks (256, 512)
;? ?Empty entry is all spaces or zeros
;
;? ?16 bytes per entry FILE:
;? ? ? Byte? 0-7 symbolic name 8 char (ascii 7 bit)
;? ? ? ? ? ? 8,9 disk address (starting block)
;? ? ? ? ? 10,11 number of blocks in file
;? ? ? ? ? ? ?12 file type
;? ? ? ? ? ? ? ? ? 0=undefined
;? ? ? ? ? ? ? ? ? 1=executable 14-15 start addr
;? ? ? ? ? ? ? ? ? 2=data file?
;? ? ? ? ? 14-15 type dependent, start address
;
;? ?ODS:? device is a collection of sequential blocks
;? ? ? ? ?Block Logical size is 65535 max
;? ? ? ? ?NS* floppy has a boot block at 0000h
;? ? ? ? ?Block at logical 0000h is start of directory.
;==========================================================

The base version of that had no scatter gather mechanism so the NS* system had?
a utillity to compact the disk.? ? Another weel know OS that was similar was
DEC RT-11.

Why is it interesting,,,,? Any file can be a directory.


Allison


 

My next step is to get to the base raw SD initialization and read/write.
The idea is more compact code that has no fat artifacts or code needed
to handle it as fat. to me other than a few keep out areas the 1gb sd is
just a bag of 2,097,152 (0x200000) blocks of 512 bytes.

The idea is to have a super directory (tag and bag) of smaller
CP/M sized (8mb or smaller)? "disks" that can be loaded as needed.
Each would be file system only.? ?The CP/M OS is loaded from
EProm as pseudo boot track.? The?CP/M file systems can be loaded
on the fly as its an offset and DPH/DPB that describe the media.?
SELDISK in the BIOS selects a drive (up to 16) but usual systems
limit that due to buffer space and ALLOC space (256 byte per
8MB using 4K alloc) needs. But the base number of drives can be
altered on the fly and its a minor coding task to make that a loadable
system variable rather than BIOS fixed? as done often.

By doing that it become easy to make a really large device usable.
Seems to work fine for 128 or 256mb CF.

PC comparability for the SD is not used as files needed are simply
transferred via USB-serial to Z80MC.? By treating the SD as a
non removable memory it lightens the code.? Doing that allows for a
monitor, tag and bag OS, BIOS, CP/M image (62K system) plus
extras to fit in 32K eprom.

This is a result of thinking outside of the CP/M alteration guide
and 4 floppies.


Allison