&40540 DiscOp *
entry
R1 bits 0-7 reason code and option bits, bits 8-31 if non zero are bits 2-25
of a word aligned ptr to an alternative disc record
R2 disc address
R3 RAM ptr
R4 length
R8 ->FileCore instance private word
exit
R0 IF V set error pointer else preserved
R1 preserved
R2-R4 adjusted to reflect amount transferred
&40541 Create - This creates a new instantiation of an ADFS like filng system
exit
R0 if error V set R0->error block else R0->FileCore instance private word
R1 address to call after completing background floppy op
R2 address to call after completing background winnie op
R3 address to call to release FIQ after low level op
the layout of the descriptor block is
offset length entry
0 3 bit 0 set if winnie needs FIQ bit 1 set if floppy needs FIQ bit 3 set by RAMFS to indicate big buffers not needed for data moving 3 1 filing system number 4 4 offset of filing system title from module base 8 4 offset of boot text from module base 12 4 offset of low level disc op entry from module base 16 4 offset of miscellaneous low level from module base
Calling the addresses returned in R1-R3 should be done in supervisor mode with R12 holding the value of R0 returned by this SWI. R0-R11,R13 will be preserved.
&40542 Drives *
exit
R0 default drive
R1 number of floppies
R2 number of winnies
&40543 FreeSpace *
exit
R0 if error V set r0-> error block else total free space on disc
R1 largest object than can be created
&40544 FloppyStructure * - creates a RAM image of a floppy map and root dir
by &20000000. New map onlyexit
&40545 DescribeDisc
Entry Exit R0 irrelevant IF successful 0 else see below R1 reason code Unchanged R2 disc address Incremented by amount transferredR3 RAM address (or ptr to scatter list) Incremented appropriately
R4 length in bytes Decremented by amount transferredR5 disc record describing disc
Other exit conditions
NZC preserved
V set <=> error
If error R0 returned must be one of following
R0 < &100 Internal filecore error number &100 <= R0 < 2^31 pointer to error block R0 >= 2^31 disc error bits as below b0 to b20 disc byte address / 256 b21 t0 b23 drive b24 to b29 disc error number b30 0
0 Verify R2,R4 1 Read sectors R2,R3,R4 2 Write sectors R2,R3,R4
3 Read track on floppy, Read Id on hard discs R2,R3 4 Write track R2,R3
5 Seek R2 6 Restore R2
7 Step in, floppy only 8 Step out floppy only
15 Specify, hard discs only, DESCRIPTION BELOW R2
Only reason codes 0,1,2,5,6 are essential. Seek is actually only used for park. Only reasn codes 0-2 modify R2-R4 on exit
=
((track * heads + head) * sectors_per_track + sector - x) * sectors_size + byte
x is an adjustment for defect skipping applied for reason codes 0-2 with old map hard discs, and is the number of defective sectors earlier on the disc.
bits 29 to 31
This is the drive number, 0 to 3 floppies, 4 to 7 hard discs.
R5 Disc Record
entries marked * should be 0 for old map
offset length
0 1 log to base 2 of sector size 1 1 sectors per track 2 1 heads (1 for L format floppy) 3 1 density 1/2/4 single double quad if applicable
12 4 disc address of root directory 16 4 disc size in bytes
20 2 disc id 22 10 disc name
32 4
0 1 2 0 C 0 0 0 0
| Hardware | Disc record |
|==>Defect list Specific <==| describing | | Parameters | disc |
The drivers are responsible for doing defect skipping on old format hard discs. The defect list is a word list of disc addresses in bytes of the start of sectors which are defective. These do not have drive bits set and are absolute, rather than adjusted for earlier defects. The end of the defect list is marked by &200000xx where xx is a check byte calculated as follows
entry
Ra -> list start
exit
Ra corrupt Rb check byte Rc corrupt
MOV Rb,#0 ;init checkloop
LDR Rc,[Ra],#4 ;get next entry CMPS Rc,#&20000000 ;all done ? EORCC Rb,Rc,Rb,ROR #13 BCC loop EOR Rb,Rb,Rb,LSR #16;compress word to byte EOR Rb,Rb,Rb,LSR #8 AND Rb,Rb,#&FF
&1BC-&1BF unadjusted parking disc address The boot block should also have the same check byte at the end as an old format map.
This is an optional extension to improve performance. To reduce rotational latency the protocol also provides for transfers of indeterminate length. If the background bit is set in the reason code (only possible for read sectors and write sectors) then the length given in R4 is treated as the length of the foreground part of the transfer. The drivers should return to the caller leaving a background process scheduled by interrupts from the controller when the foreground part is complete. This process should terminate when it finds an address length pair with a zero length field (background ops always use the scatter option and an exact number of sectors). The foreground process can add pairs to the list at any time and to get the maximum decoupling between the processes the drivers should update the scatter list after each sector. The drivers must be able to retry in the background.
The scatter list is extended as below
-8 Process error | Process status -4
0 1st address | 1st length 4
8 2nd address | 2nd length C
10 3rd address | 3rd length 14
etc
N Loop back marker -N |
Process error is set by the caller to 0, on an error the drivers should set this to describe the error in the format described above.
The bits in process status are
b31 process active
b30 process can be extended
other bits are reserved
Both bits are set by the caller and are cleared by the drivers. The drivers
must have IRQs disabled from updating the final pair in the list to clearing
the active bit.
A negative address of -N indicates that the drivers have reached then end of the scatter table and should get the next address length pair from the start of the scatter list N bytes earlier.
The drivers may be called with the scatter pointer (R3) not pointing to the first (address,length) pair. So to find the addresses of Process error and Process status the end of list must be searched for. From this the start of the scatter block may be calculated.
NZC preserved
V set <=> error (only Mount is allowed to give error)
exit
IF error R0 as for low level disc op, V set
R1-R5 preserved
Floppy
This asks you to read in the free space map and identify the format. The
suggested density to try first is given in the disc record. Identify the
format consits of filling in the density and for old format sector size,
sectors per track, heads, disc size and root dir.
Hard disc
This asks you to read in the boot block if it doesn't have one you will
have to fudge it
exit
R2 sequence number
R3 result flags
The sequence number is to ensure no changes are lost due to reset being pressed. Both the parent module and the file core incarnation should start with a sequence number of 0 for each drive. The parent module increments the sequence number with each change of state. If the parent module finds the entry sequence number does not match its copy it should return changed/maybe changed depending on whether the disc changed line works/doesn't work.
result flags (exactly one of b0-b3 must be set) set<=>true
b0 not changed
b1 maybe changed
b2 changed
b3 empty
b6 empty works may never return 0 after returning 1 for this drive
b7 changed works may never return 0 after returning 1 for this drive
2 Lock Drive floppy only - at least ensure drive light stays on till unlock
3 Unlock drive floppy only
4 Poll period floppy only
This call informs FileCore of the minimum period between polling for disc insertion. This is so that drive lights do not remain continously illuminated. The values are re-exported by FileCore in the up calls MediaNotPresent and MediaNotKnown. The value applies to all drives rather than a particular drive.