Disk Formats - Disk Basic Format

The different diskdrives that are available for SVI-318/328 uses 5.25" diskettes. For the most common diskdrive, SV-902, are softsectored single sided diskettes with double density 40 tracks used. The latest expansion unit, SV-605B, uses double sided diskettes. There is also a rare diskdrive, SV-912, that uses 80 tracks single sided diskettes.

First we will look at the diskette used in the SV-902 diskdrive, and how it is structured under Disk Basic. This drive uses 40 tracks single sided diskettes. The tracks a numbered from 0 (the outer track) to 39 (the inner most). Each track is devided into sectors. The sectores are initialized under Disk Basic with the machinecode program "svformat". Disk structure are as follows:

Track Sectors/Track Bytes/Sector
0 18 128
1-39 17 256

This means that the formatted capacity of a diskette is:

18 x 128 + 39 x 17 x 256 = 172 032 bytes

But in reality, only this can be used for datastorage:

36 x 17 x 256 = 156 672 bytes

Track usage

The three outer tracks (0, 1 and 2) is used for Disk Basic and track 20 for the file directory structure. The other 36 tracks (3-19 and 21-39) is used for storage of files. Each track is used for data storage, wich means that 1 to 36 files can be stored on a diskette.

Besides the physical format, a logic format must also be done. This is done with the program "format", and it initializes track 20 (the file directory).
 

Track 20 structure

The 17 sectors in track 20 is used in the following way:

Sector Description
1-13 File directory
14 Disk Allocation Table (disk information)
15-17 File Allocation Table (FAT)

 

File directory (sector 1-13)

The file directory uses 16 bytes/file. This means that each sector can hold information for 16 files. The 16 bytes that are reserved for each file are used in following way:

Byte Description
0-5 Filename (6 characters)
6-8 Filetype (3 characters)
9 Attribute and storage type
10 Pointer to FAT (the first storage track)
11-15 Reserved for future use

Normally, only sectors 1-2 and sometimes 3 are used. While sectores 4-13 are unused. The file directory is ended when a filename has the value 255 (&HFF).
Byte 9 gives the attribute and the storage type of the file, in the following way:

Bit Description
0 0 = binary (machine code), 1 = ASCII
1 Not used
2 Not used
3 Not used
4 1 = Attribute "P", wich is write protected
5 1 = Screen attribute (in combination with bit 7)
6 1 = Attribute "R", wich is control reading
7 1 = Basic

Byte 9 can in other words have the following values:

Value Description
00 Binary (machine code) file
01 ASCII file
80 Basic file
A0 Screen file
+10 Attribute "P"
+40 Attribute "R"

A write protected Basic file has the value 90 (hex) and a ASCII file that will be control read while written has the value 41 (hex).
 

Disk Allocation Table (sector 14)

The Disk Allocation Table contains information regarding the diskette.

The first byte (byte 0) of the information sector is the diskette attribute "P" and "R" found, they have the same values as the above.  The rest of the sector (byte 1-255) is taken up by any IPL command (stored in ASCII format). The IPL command instructs Disk Basic to immediately execute the program you select when the disk is booted, see the Disk Basic User's manual for more information.
 

File Allocation Table (sectors 15-17)

Sectors 15, 16 and 17 are copies of each other, and contains a copy of the File Allocation Table. For FAT are the bytes 0-39 used, that means that there are one byte for each track on the diskette. The other bytes (40-255) are not used, they just contains garbage data.

If a track is free, the represented byte in FAT has the vaule 255 (&HFF). The byte 0, 1,2 and 20 (these tracks are used for Disk Basic and the filesystem) has always the value 254 (&HFE). If large file (one that needs more than one track) is being stored in the diskette, will the byte in FAT have the value of the next track containing the file. If the track is the last used by the file, will the FAT byte have the value of &HC0 plus the number of used sectors.
 

Deleted file

When a file is deleted with the command "KILL drive:filename.type", is only the first byte of the filename changed to 0 and used bytes in FAT to 255. Other file information is not changed until that space is used again.

File directory:

  0 1 2 3 4 5 6 7 8 9 A B C D E F
0 46
F
49
I
52
R
53
S
54
T
20
 
47
G
44
D
20
 
80
basic
13
fat ptr
         
1 44
D
45
E
4D
M
4F
O
20
 
20
 
20
 
20
 
20
 
00
bin
15
fat ptr
         
2
 
                             

FAT:

  0 1 2 3 4 5 6 7 8 9 A B C D E F
0 FE FE FE                          
1       C3 FE 16 C8                  
2                                

The first file, the Basic file FIRST.GD, uses 3 sectors of track 19 (&H13). The other file, binary file DEMO, uses the whole track 21 (&H15) and 8 sectors of track 22 (&H16).
 

Logical formatting

Now it's easy to understand what the program "format" does. First is the file directory track 13 intialized, all the bytes are set to the value 255 (&HFF). After that is the Disk Allocation Table filled with 0. Finally is first 40 bytes of the File Allocation Table (all 3 tracks) set to 255, except for the bytes 0, 1, 2 and 20 wich are set to 254 (&HFE).
 

CP/M Formats

 

Track usage

 

Logical and Physical sector

 

Disk usage

 

Cluster numbering

 

Storage capacity

 

STAT command

 

File directory

 

Transfer a file from Disk Basic to CP/M

  1. Start your SVI with Disk Basic
  2. Format a new diskette
  3. Load the program you want to transfer
  4. Save the program twice in ASCII format on the newelly formatted diskette:
    SAVE "1:a",A
    SAVE "1:b",A
    This means that "b" will be located above the directory track in track order. This makes i a bit easier.
  5. Check what tracks/sectors that are being used by "b"
  6. Copy track to track:
    COPY 1;(3,9) FROM 1;(21,1)-(22,3)
  7. Caculate directory data for CP/M:
    Number of sectors (in 256 bytes groups)    17+3 = 20
    Number of poster (in 128 bytes groups)    2x20 = 40 = 28H
    Number of klasar (in 8 bytes groups = 1k for 605A)    5
    Number of klasar (in 16 bytes groups = 2k for 605A)    3
  8. Change data directelly on the diskette:

     
  9. Start CP/M and verify that your files are there. Star with DIR and continue with TYPE.

CP/M Format

Disk Name: Spectravideo SV-328 DS 
Type: 5 1/4 Total usable space: 326k bytes

Sector information: 
- 256 bytes/sector; 17 per track; numbered 1 to 17 (Side 2 numbered 1 to 17)
- Disk is filled all first side, then second side 
- System tracks are formatted differently than data tracks.

Logical Layout:
- Allocation unit size is 2048 bytes; 163 AU's per disk
- Directory starts at logical track 3;
has 64 entries and occupies 8 sectors or 1 AU's

Standard disk parameter table entry (values in HEX):
22 00 04 0F 01 A2 00 3F 00 80 00 10 00 03 00 01 01 

Same format as Rank Xerox 820-II

The format

The format of track 0 is FM encoded and the other tracks are MFM encoded. The data architecture of the MFM tracks are IBM System 34:

No of bytes Hex Value of Bytes Description
50 4E Gap 1
12 60 Sync Field
3 F5 ID adress mark
1 FE ID mark
1 xx Track
1 xx Head no.
1 xx Sector
1 01 Sector length ID
1 F7 CRC generate 2 bytes
22 4E Gap 2
12 00 Sync field
3 F5 Data address mark
1 FB Data mark
256 E5 Data
1 F7 CRC generate 2 bytes
32 4E Gap 2 between sectors

The data architecture of the FM tracks are IBM 3740:

No of bytes Hex Value of Bytes Description
40 FF (or 00)  
6 00  
1 FC Index mark
26 FF (or 00)  
6 00  
1 FE ID address mark
1 xx Track number
1 00 or 01 Side number
1 1 thru 1A Sector number
1 00  
1 F7 2 CRC's written
11 FF (or 00)  
6 00  
1 FB Data address written
128 E5 Data
1 E7 2 CRC's written
27 FF (or 00)  
247 FF (or 00)  

This arcticle was written by Hans Magnusson and published in NSVK's (The Nordic SpectraVideo Club) newspaper SpectraView.