Polski | English |
---|
Home | Guide | RSXes | Files | Functions | Versions | Releases | Users | Download |
CP/M | MEMDISK | IDEDOS |
---|
MEMDISK is designed to store files in memory areas. The memory can be fragmented, so some I2C EEPROMs can be used as one disk. It is also useful for ramdisks in banked RAM or files stored in EPROM.
The MEM/0 structure was the first idea. In the MEM/1 revision, pointers to parent was added. So now there's only one pointer needed to operate a file or directory and there's no need to remember pointers of the path elements. This simplifies e.g. deleting files or moving to another directory.
shift | contents | length in bytes | description |
---|---|---|---|
+0 | "M", "E", "M", #01 | 4 | filesystem name |
+4 | three chars followed by #00 | 4 | phisical disk name |
+8 | structure F | at least 26 | file descriptor |
+... | structure D | at least 26 | directory descriptor |
+... | structure A | at least 7 | data area descriptor |
First file desriptor (structure F) is always present. Points to first file or directory on disk, contains amount of useful free space and points to the free area chain (structures A). Also can point to parent directory - value 0 means the mount point is root. So empty disk contains the 8 bytes header, one structure F and at least one structure A.
shift | length in bytes | contents | notes for | ||
---|---|---|---|---|---|
structure F (file descriptor) |
structure D (directory descriptor) |
structure A (data area) |
|||
+0 | 4 | pointer to next structure | next file or directory in this directory | only A | |
+4 | 2 | length of this structure | from 20 to 64 | from 1 to 65535 | |
+6 | 1 | version number | #00 | #80 | data area |
+7 | 1 | flags | |||
+8 | 4 | pointer to parent structure | the directory that contains this file or directory | ||
+12 | 4 | parameter | file length | ||
+16 | 4 | pointer to child structure | only A | first entry in child directory | |
+20 | 4 | date and time | packed | ||
+24 | at least 2 | name followed by #00 | file name | directory name |
All pointer and length fields are in little Endian (the low meanig byte is first).
Example device is M24C64 - an I2C 8kB EEPROM, connected to AY-3-8912.
The pointer base is #E0A0, what means memory connected to AY (#E0 - bit 0 of port A is the SDA, bit 1 is SCL.) and of internal number #A0. The connection number #E2 is used in TC2068 computerers and means bit 4 of port A is the SDA, bit 5 is SCL. Internal number for M24C64 chips can be range #A0..#AE (only even values) and is set with E0, E1 and E2 inputs of the chip.
addr. contents description #0000 4D 45 4D 01 filesystem name "MEM/1" #0004 45 45 30 00 disk phisical name "EE0" (zero ended) #0008 F 00 00 00 00 no next directory entry (structure F starts here) #000C 19 00 entry length (#0027-#000E) #000E / 00 00 file entry with no flags set #0010 00 00 00 00 no parent structure present #0014 D3 1F 00 00 total free area length #0018 27 00 A0 E0 pointer to A structure, that starts from #0027 #001C B5 44 22 2C date and time of formatting: 2002-01-02 08:37:42 #0020 \ 45 45 44 48 53 4B 00 disk name "EEDISK" (zero ended) #0027 A 00 00 00 00 no next structures (structure A starts here) #002A D3 1F area length (#2000-#002D) #002D / FF FF FF FF FF ... empty area - #1FD3 bytes #1FFF \ FF last byte of empty area