RISCOS.com

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

 

ADFS


Introduction and Overview

Logical block addressing (LBA)

Logical block addressing (or LBA) is a method of disc addressing for IDE discs, which is superseding the old Cylinder-head-sector (or CHS) method of disc addressing. The LBA method has been introduced by hard drive manufacturers because the CHS method would not work under MS-DOS for drives greater than 528 MB; so LBA is typically only used with these larger discs, and smaller discs continue to use CHS.

From RISC OS 3.6 onwards, ADFS supports IDE discs that use LBA. It recognises an LBA disc by a flag in the hardware dependant parameters of the boot block, which is set appropriately by formatting software such as HForm. The flag is at offset &1BA in the boot block; if bit 0 is set, the disc uses LBA.

The main advantage gained from the use of LBA is faster conversion of disc addresses. The disc address that FileCore passes to the low-level entry points of ADFS is a sector offset into the disc (which is the same as the LBA), with a drive number in the top bits. Converting to LBA just involves masking out the drive number, whereas converting to CHS requires two divisions by numbers which are only known at run-time. Since ADFS converts disc addresses during IRQ handling, using LBA improves IRQ latency.

Changes to existing SWIs

ADFS_DiscOp

ADFS does not support reason code 3 for all hard discs. It also does not support bit 4 of the option bits (ie the 'use alternate defect list' bit).

New SWIs

Three new SWIs have been introduced in RISC OS 3.6:

  • ADFS_LockIDE locks/unlocks the IDE bus.
  • ADFS_SectorDiscOp calls FileCore_SectorOp; it hence provides the same functionality as ADFS_DiscOp, save that it uses sector addresses rather than byte addresses.
  • ADFS_FreeSpace64 calls FileCore_FreeSpace64; it hence provides the same functionality as ADFS_FreeSpace, but uses 64 bit values rather than 32 bit ones.

SWI Calls


ADFS_SectorDiscOp
(SWI &4024D)

Calls FileCore_SectorOp

On entry

See FileCore_SectorOp

On exit

See FileCore_SectorOp

Interrupts

Interrupt status is undefined
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

Not defined

Use

This SWI calls FileCore_SectorOp, after first setting R8 to point to the FileCore instantiation private word for ADFS.

ADFS does not support reason code 3 for all hard discs. It also does not support bit 4 of the option bits (ie the 'use alternate defect list' bit).

This call is functionally identical to FileCore_SectorOp.

Related SWIs

FileCore_SectorOp, ADFS_DiscOp

Related vectors

None


ADFS_LockIDE
(SWI &40251)

Locks/unlocks the IDE bus

On entry

R0 = flags:
bit 0 clear => UNLOCK IDE BUS_ SET => lock IDE bus
all other bits reserved (must be zero)

On exit

R0 preserved

Interrupts

Interrupt status is undefined
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

Not defined

Use

This call locks/unlocks the IDE bus. An error is generated (&1080A, 'Driver in use') if the bus is already locked when you attempt to lock it.

When attempting to lock in the background, you should not attempt to loop, repeatedly locking, since the process in control of the lock could be a foreground process. Instead, you should be schedule a retry for a later time.

Related SWIs

None

Related vectors

None


ADFS_FreeSpace64
(SWI &40252)

Calls FileCore_FreeSpace64

On entry

See FileCore_FreeSpace64

On exit

See FileCore_FreeSpace64

Interrupts

Interrupt status is undefined
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

Not defined

Use

This SWI calls FileCore_FreeSpace64, after first setting R8 to point to the FileCore instantiation private word for ADFS.

This call is functionally identical to FileCore_FreeSpace64.

Related SWIs

FileCore_FreeSpace64, ADFS_FreeSpace

Related vectors

None

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