The Free module provides two SWIs which enable any filing system to provide a RISC OS 3 style free space display:
Free_Register (&444c0)
In:
R0 = filing system number.
R1 = address of routine to call to get free space information
R2 = R12 value on entry to above routine
Out:
Registers preserved.
The routine pointed to by R1 will be called in USR mode, with the return address already pushed on the stack.
Since the routine is executed in USR mode, you should not use the provided stack, if you need any stack space, you will need to allocate it yourself. (It is safe to assume that the stack will be deep enough to hold the entry registers).
The routine will be called with the following reason codes in R0:
NoOp (0)
In:
R0 =0
Out:
-
This should just return to the caller.
GetDeviceName (1)
In:
R0 = 1
R1 = filing system number
R2 = pointer to buffer
R3 = pointer to device name / id.
Out:
R0 = length of name
[R2] name to use in window.
This reason code is used to find the name to use in the window. For example it is used on ADFS drives to convert the drive number to the disc name.
GetFreeSpace (2)
In:
R0 = 2
R1 = filing system number
R2 = pointer to 3 word buffer
R3 = pointer to device name / id.
Out:
R0-R3 preserved.
[R2] Total size of device (0 if unchanged from last call)
[R2+4] Free space on device
[R2+8] Used space on device
CompareDevice (3)
In:
R0 = 3
R1 = filing system number
R2 = pointer to file name
R3 = pointer to device name / id
R6 = pointer to special field
Out:
R0-R3,R6 preserved.
Z set if R2 & R6 result in a file on the device pointed to by R3.
This call can simply return with Z set if the filing system (e.g. RAMFS) is a fast one (i.e. if the time to process reason call 2 is less than that required to process this call).
Free_DeRegister (&444c1)
In:
R0 = filing system number
R1 = address of routine
R2 = R12 value on entry to above routine
Out:
Registers preserved.
This is used to remove the support after it has been registered with Free_Register.