Not quite related to Unix but CP/M file structure...


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Not quite related to Unix but CP/M file structure...
# 1  
Old 12-04-2007
Not quite related to Unix but CP/M file structure...

I'm not sure where to post this but I'm having some trouble with the directories in CP/M... I'm sorry about the length but I'm totally confused... I've seen that the directory entry in CP/M contains the following:

1 byte User Code
8 bytes Filename
3 bytes File extension
1 byte Extension
2 bytes reserved
16 bytes Disk block numbers

First of all, what are those 2 bytes reserved for? Will that be used if the file occupies a large number of blocks thus supporting as an extension to that 1 byte "Extension field"? Secondly I don't understand how this works... Is it stored something like this?

1 | FileA | exe | 1 | --- | 1 2 3 4 5 6 7 8 9 ... 16 |
1 | FileA | exe | 2 | --- | 17 18 19 ...............33 |
...
...

I read that the Extension field is used to keep track of the order of the storage as to which blocks come first. The disk block numbers point to blocks of size 1 KB... So what is the largest disk that the CP/M could support anyways? Was it just a floppy disk or something? What happens if I choose a block size more than 1KB say 512 KB or something? I did a rough calculation messing with other parameters and got some 2048 GB which I think is just too huge to be true... I could've even made the block size as 1 MB but what is the limiting factor here?

Last edited by Legend986; 12-04-2007 at 08:42 PM..
# 2  
Old 12-04-2007
The first byte is E5 if the file is deleted, this stems from the original formatting chips that filled blank disks with E5 (single-density) double-density were filled with F6.

When the entry is read into memory this first byte holds the disk number.

The whole thing is 32 bytes long and has room for 16 blocks to be recorded, if the file exceeds that length then another directory entry is added.

I'm a bit rusty but CPM groups sectors into allocation units, but a directory entry must still be able to say exactly how many 128 byte sectors it refers to.

Apparently those two reserved bytes are truely not used.

But I think you are missing a sector count.

0 db user type
1-8 db file name
9-11 db file type
12 db extent
13-14 db not used
15 db sector count
16-31 allocation map

So a disk can have a maximum of 256 allocation units, which may contain 2^N 128 byte sectors.

CPM is really designed for floppies, originally single sided, single density 8" disks.

Two pieces of information are not held on the disk.....

1. The starting sector, eg typically the operation system is held outside of the file format just in the sectors at the start of the disk.

2. The interleave map, as CPM is designed for 128 byte sectors and todays floppies use 512 byte sectors, a single real sector will contain multiple CPM sectors. Also, there is a translation from logical sector to real sector to allow the computer to process one sector while the disk is turning to the next one. Eg sectors may be ordered......

1 3 5 7 2 4 6 8


http://delivery.acm.org/10.1145/1000...FTOKEN=6184618
# 3  
Old 12-04-2007
Aha... That paper was wonderful... Smilie Thanks a lot... Now I understand the real reason behind that classification... But even then, what dictates the fact that "CP/M can support only disks as large as a floppy?" The paper just discusses taking into account a disk with 102,400 bytes divided into 800 128-byte CP/M sectors.

Ok the disk allocation map, as the paper says, contains 16 1-byte address pointers. The following is a paragraph from the paper itself:

Quote:
bytes. The technique CP/M uses is to cluster sectors groups of 8 sectors each (see Figure 4). so that there into are a maximum of 100 groups per disk and the address pointers represent group numbers. (On larger disks,CP/M simply uses larger clusters in each group.) Group number 0 includes sectors l-8 of track 3. group 1 includes sectors 9-16 of track 3, group 2 includes sectors 17-20 of track 3 and sectors l-4 of track 4. and so on.
The paper clearly says that there are 16 1-byte address pointers and each represents one group => there are 16 groups and a group includes 8 sectors => 128 sectors in total. But there are 800 sectors... Smilie I know I'm missing something but I don't understand what I'm missing....
# 4  
Old 12-04-2007
Quote:
Originally Posted by Legend986
I know I'm missing something but I don't understand what I'm missing....
clusters!

the list of "things" that are referenced in each directory entry are clusters, not sectors.

A single disk can contain a maximum of 255 clusters, where a cluster contains 2^N sectors, and a sector is 128 bytes.

If a single byte is used to indicate how many 128byte sectors are used in a cluster then depending on the algorithm you have either a max of 128 or 256 sectors per cluster, giving an absolute max disk size of ether 4Mb or 8Mb.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Query related to conversion of segy file and .su files using Seismic Unix

hi M using ubuntu 11.04....and has installed Seismic Unix on it.... I want to process some unprocessed segy data using Seismic Unix.... i have converted .segy file to .su using segyread tape=file1.seg verbose=1 endian=0 | segyclean > smallfile.su and got 3 files -smallfile.su... (0 Replies)
Discussion started by: Ankita Singla
0 Replies

2. Shell Programming and Scripting

need downloading related help...but its not related to unix

Hi All, I am trying to dowmload the zip file "zkManageCustomers.zip " but i dont have access. Can anyone help me to download this file See the below link- http://www.ibm.com/developerworks/opensource/library/wa-aj-open/index.html?ca=drs- Please help me as early as... (1 Reply)
Discussion started by: aish11
1 Replies

3. Shell Programming and Scripting

Getting the Folder Structure in Unix

Hi All, I have a compute box and I want to tar directory structure under a directory and then Deploy/untar it in a new compute box so that the directory structure will be exactly the same. I do not want any of the file to be extracted and deployed but instead only the directory structure. ... (2 Replies)
Discussion started by: filter
2 Replies

4. UNIX for Advanced & Expert Users

Unix commands Related to

Hi all, Does unix has any commands for creating BLOB and CLOB objects. Please forward me any sites or samples (2 Replies)
Discussion started by: rajeshorpu
2 Replies

5. Fedora

How is OS X related to unix

Ok, I gotta ask this question, I have just begun fundamentals of UNIX in college and have learned or heard that Mac's OS-X is a linux based os! Does this mean that unix shell commands work in OS-X? I have no experience with os-x yet. I know it's a stupid question but I gotta know! (10 Replies)
Discussion started by: boarder428
10 Replies

6. Programming

compare XML/flat file with UNIX file system structure

Before i start doing something, I wanted to know whether the approach to compare XML file with UNIX file system structure. I have a pre-configured file(contains a list of paths to executables) and i need to check against the UNIX directory structure. what are the various approches should i use ? I... (6 Replies)
Discussion started by: shafi2all
6 Replies

7. Forum Support Area for Unregistered Users & Account Problems

How to post a new thread (Regarding Unix related doubts) in Unix Forums

How to post a new thread (Regarding Unix related doubts) in Unix Forums. I registered my id but I am unable to post my Questions to Forum. Thanks & Regards, indusri (1 Reply)
Discussion started by: indusri
1 Replies

8. UNIX for Dummies Questions & Answers

What are some benefits of the UNIX hierarchical file structure?

What are some benefits of the UNIX hierarchical file structure? I am new to UNIX and researching some information about it for a class so please help if you can. Thanks. (1 Reply)
Discussion started by: 88923JJJSDK
1 Replies

9. UNIX for Dummies Questions & Answers

Unix Related

well through my 6 months education i know some unix os but i can't find one for my p3 via board can any one tell me where to find such please replay as email or private msg and thanks (3 Replies)
Discussion started by: JaMaL
3 Replies

10. UNIX for Dummies Questions & Answers

Unix/Linux Directory Structure

Does anyone know of a good Internet source that explains the directory structure of Unix/Linux?? Thanks Gregg (2 Replies)
Discussion started by: gdboling
2 Replies
Login or Register to Ask a Question