RISCOS.com

www.riscos.com Technical Support:
Programmer's Reference Manual

 

Free


Introduction and Overview

This module enables an interactive free space display from the desktop.

Any filing system that wishes to display an interactive free space display should register with this module. In doing so, the filing system provides the address of a routine that accepts a variety of reason codes, each of which provides support for this module.

When the Free entry is selected from the filing system's menu, its desktop filer should issue the command:

*ShowFree -fs fs_name device

This module will then display the free space left.

The Free module is not available in RISC OS 2.

SWI calls


Free_Register
(SWI &444C0)

Provides an interactive free space display for a filing system

On entry

R0 = filing system number
R1 = address of routine to call to get free space info
R2 = R12 on entry to the above routine

On exit

Registers preserved

Interrupts

Interrupts are enabled
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

SWI is not re-entrant

Use

This call adds the filing system to the list of filing systems known by the Free module. The Free module automatically deals with the following filing systems: ADFS, RamFS, NetFS, NFS, SCSIFS.

R1 contains the address of the entry point for a set of support routines, which the Free module uses to help it to provide an interactive free space display for the filing system. The entry point is called in User mode, with the Free module's private stack, the top of which contains the return address. You cannot assume the depth of this stack, and should not use it save to pull the return address. Alternatives are:

  • Construct a new stack.
  • Call the SWI OS_EnterOS to get the SVC mode stack, do the work and then return to User mode before returning.
  • Use a SWI to do all the work: for example, you might use OS_FSControl 49 (get free space) for reason code 2.

The routine should exit using the instruction:

LDMIA r13!, {pc}

The entry point may be called with the following reason codes:

Reason code 0 - NoOp
On entry

--

On exit

--

Details

This entry point is a No Op, and you should just return with all registers preserved.

Reason code 1 - Get device name
On entry

R0 = 1
R1 = filing system number
R2 = pointer to buffer
R3 = pointer to device name / ID

On exit

R0 = length of name
R1-R3 preserved

Details

This entry point is called to get the name of a device. You should place the device name in the buffer pointed to by R2, and the length of the name in R0.

Reason code 2 - Get free space for device
On entry

R0 = 2
R1 = filing system number
R2 = pointer to 3 word buffer
R3 = pointer to device name / ID

On exit

R0 - R3 preserved

Details

This entry point is called to get the free space for a device. You should fill in the buffer pointed to by R2 with the following information:

Offset Meaning
0 total size of device (0 if unchanged from last time read)
4 free space on device
8 used space on device
Reason code 3 - Compare device
On entry

R0 = 3
R1 = filing system number
R2 = pointer to filename
R3 = pointer to device ID
R6 = pointer to special field

On exit

R0 - R3, R6 preserved
Z set if R2 & R6 result in a file on the device pointed to by R3

Details

This entry point is called to compare a device ID with a filename and special field. This call can simply return with Z set if the filing system is a fast filing system (eg RAMFS).

Related SWIs

Free_DeRegister

Related vectors

None


Free_DeRegister
(SWI &444C1)

Removes the filing system from the list of filing systems known by the Free module

On entry

R0 = filing system number
R1 = address of routine (as passed to Free_Register)
R2 = R12 value (as passed to Free_Register)

On exit

R0 preserved

Interrupts

Interrupts are enabled
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

SWI is not re-entrant

Use

This call removes the filing system from the list of filing systems known by the Free module.

Related SWIs

Free_Register

Related vectors

None

* Commands


*ShowFree

Shows within a desktop window the amount of free space on a device

Syntax

*ShowFree -fs fs_name device

Parameters

fs_name - name of the filing system used to access the device

device - name of the device for which to show free space

Use

*ShowFree shows within a desktop window the amount of free space on a device. It is used by desktop filers such as ADFSFiler

This command will only work on filing systems registered using the SWI Free_Register.

Example

*ShowFree -fs adfs HardDisc4

Related commands

None

Related SWIs

Free_Register, Free_DeRegister

Related vectors

None

This edition Copyright © 3QD Developments Ltd 2015
Last Edit: Tue,03 Nov 2015