This document describes how foreign discs are identified.

History:

01-Jan-1991 JSR Update checking of sector size, sectors per track, density

                        and heads to take acount of winnies which may not
                        fill these in during mount.
                  Update fields needed to be changed to include sequence sides
                        bit and double step bit.

FileCore manages the insertion and removal of discs, and understands the mapping between disc names and the drives that they're in. To do this is makes use of services provided by image file system modules.

Service_IdentifyDisc (&69)

On entry
R1 = Service_IdentifyDisc (&69)
R2 = pointer to buffer
R3 = length of buffer
R5 = Pointer to disc record
R6 = Sector cache handle
R8 = Pointer to FileCore instance private word to use

On exit
If the format has been identified:
R1 = Service_Serviced
R2 = Filetype number for given disc format. R5 = Pointer to disc record, which has been modified R6 = New sector cache handle
R8 unchanged
Otherwise:
R1 = Service_IdentifyDisc
R5 = Pointer to disc record, which may have been modified
R6 = New sector cache handle
R8 unchanged

When this service is received and recognised, the receiving MultiFS should:

i) Check the sector size, sectors per track, density, heads and lowest numbered sector on a track to see whether these correspond to a format it understands. Note that if sector size, sectors per track, density or heads is 0 that no check should be performed as they were not supplied by the MiscOp_Mount; this should only occur on hard discs.

ii) Assuming the sector scheme is recognised the disc record should be updated with the disc size, sequence sides, double step and heads value which corresponds with the format in question (Note that heads should only be adjusted in line with the sequence sides value). When clearing the sequence sides bit from being set the heads fields should be increased by one; when setting the sequence sides bit from being clear, the heads field should be decreased by one. If the heads field was 0 no change should be made to it.

iii) Once the disc record is ready, then FileCore_DiscOp 9, cached read sectors should be used to read sectors from the disc so that they can be checked to see whether they correspond to the format in question. The R1 parameter for the DiscOp, which includes the reason, options and alternative disc record should have reason=9 (cached read sectors), options bits=2_01x0 (1 second timeout; ignore escape; scatter list optional; no alternative defect list), and the alternative disc record set to the one supplied in the service call. The disc number for the cached read sectors should be obtained from the disc address of root directory entry in the disc record, which will be set to byte 0 on the relevant disc.

iv) assuming both the sector format and sector contents are satisfactory, then the disc record should have the disc's name and DiscId filled in and the Service_IdentifyDisc claimed. The disc record, as returned, will be used in further accesses and so must have the heads and disc size correct. The DiscId should be either (i) an Id stored on the disc which changes ech time the disc is updated, or (ii) a value (eg CRC) calculated from a proportion of the disc which is likely to change when the disc is updated. Also, when a disc is identified the supplied buffer should be filled in with a 0-terminated name describing the format of the disc (eg "ADFS 800K (E)" or "DOS 720K"). If the supplied buffer's address is 0 this means there is no buffer and no description should be filled in.

v) assuming the disc wasn't identified the service should be passed on, unclaimed, with the new value for R5 if necessary.

In summary:

New FileCore_DiscOp reason 9, Cached read sectors

FileCore_DiscOp

In

R1      bits 0-3 = reason code = 9
        bits 4-7 = option bits
        bits 8-31 = bits 2-25 of pointer to alternative disc record, or zero
r2 = disc address
r3 = pointer to buffer
r4 = length in bytes
r6 = sector cache handle (start with 0 for an empty cache) r8 = pointer to FileCore instance private word

Out
R1 preserved
R2 = disc address of next byte to be transfered R3 = pointer to next buffer location to be transfered R4 = number of bytes not transfered
R6 = new sector cache handle
R8 preserved

This works similarly to read sectors, except that the sector reads are cached, errors and all, and the reads may be non-sector aligned of a non-whole number of sectors.

To initiate a cached sector read start with R6=0. To discard a cache of sector reads use

FileCore_DiscardReadSectorsCache

In
R6 = sector cache handle

Out
R6 preserved and cache discarded.

How does FileCore identify a disc?

FileCore, in theory, could make full use of the MultiFS system to identify its own discs, but, given the tight time constraints on the project, FileCore will not be split into separate parts, but will use the service call scheme to identify its discs. So, when FileCore wishes to identify a disc, if the service call is not claimed then a 'This disc's format is not recognised' error will be returned.