AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
The current scheme for error returns from FileCore modules is as follows:

     bit 31-30

R0      0 0 :     bits 8-29 clear
           bits 0-7 error number
R0      1 0 :     bits 24-29 disc error number
           bits 21-23 drive number
           bits 0-20 disc byte address / 256
R0      0 1:     R0 is an error pointer, once bit 30 is cleared.
R0      1 1:     bits 0-29 point to a two-word block:
           offset 0: 
                 bits 0-7 disc error number
                 bits 8-29 clear
           offset 4: 
                 bits 0-28 disc sector number
                 bits 29-31 drive number

This whole scheme is predicated on addresses having their top bits clear.

For the new scheme, this is changed to use the least significant bits to
distinguish the types:

     bit 1-0

R0      0 0 :      R0 is an error pointer (for R0 < 256 R0 = BBC style error number)

R0      0 1 :      R0 (once bit 0 cleared) points to a three-word block:
           offset 0: 
                 bits 0-7   drive number
                 bits 8-15  disc error number
                 bits 16-31 clear
           offset 4:
                 64-bit disc address

R0      1 X :      reserved for future use


Clearly, this scheme is not compatible with the existing one, but the two forms
can easily be mechanically converted between.

However, if you wish your module to work with older versions of FileCore, you
must return old-style errors when running with such a version. These versions
can be distinguished by calling FileCore_Features after registering. If no
error is returned, and bit 0 of R0 is on exit, you are running on a new
FileCore, and should return the new error codes. Otherwise, you should return
the old error codes - this can be easily be dealt with by using new-style
errors throughout the core of your module, and putting a small conversion
veneer on the error exit cases from your entry points.

Note that the same error codes are used in the process error word of
background transfer scatter lists; these should also use either the old or new
scheme appropriately.

If you are returning new-style errors, you must also store the most
significant 30 bits of the block pointer in the background transfer process
status word (ie. bits 29-0 of process status correspond to bits 31-2 of the
address of the scatter list entry corresponding to an error).

[sh-index] Back to list of manuals