@ GNU AS assembler header file for FileSwitch
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:44:51 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 21 Aug 1995

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@ GNU General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef FileSwitch_Hdr
#  define FileSwitch_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

@Symbols for constants
#  define Error_FileSwitchNoClaim 0x400
#  define Error_BadFSControlReason 0x401
#  define Error_BadOSFileReason 0x402
#  define Error_BadOSArgsReason 0x403
#  define Error_BadOSGBPBReason 0x404
#  define Error_BadModeForOSFind 0x405
#  define Error_NoRoomForTransient 0x406
#  define Error_ExecAddrNotInCode 0x407
#  define Error_ExecAddrTooLow 0x408
#  define Error_UnknownActionType 0x409
#  define Error_TooManyLevels 0x40a
#  define Error_NoSelectedFilingSystem 0x40b
#  define Error_CantRemoveFSByNumber 0x40c
#  define Error_UnalignedFSEntry 0x40d
#  define Error_UnsupportedFSEntry 0x40e
#  define Error_FSNotSpecial 0x40f
#  define Error_CoreNotReadable 0x410
#  define Error_CoreNotWriteable 0x411
#  define Error_BadBufferSizeForStream 0x412
#  define Error_NotOpenForReading 0x413
#  define Error_NotEnoughStackForFSEntry 0x414
#  define Error_NothingToCopy 0x415
#  define Error_NothingToDelete 0x416
#  define Error_FileSwitchCantBeKilledWhilstThreaded 0x417
#  define Error_InvalidErrorBlock 0x418
#  define Error_FSFileTooBig 0x419
#  define Error_CantRMFasterFileSwitch 0x41a
#  define Error_InconsistentHandleSet 0x41b
#  define Error_IsAFile 0x41c
#  define Error_BadFileType 0x41d
#  define Error_LibrarySomewhereElse 0x41e
#  define Error_PathIsSelfContradictory 0x41f
#  define Error_WasntDollarAfterDisc 0x420
#  define Error_NotEnoughMemoryForWildcardResolution 0x421
#  define Error_NotEnoughStackForWildcardResolution 0x422
#  define Error_DirWantedFileFound 0x423
#  define Error_NotFound 0x424
#  define Error_MultipartPathUsed 0x425
#  define Error_RecursivePath 0x426
#  define Error_MultiFSDoesNotSupportGBPB11 0x427
#  define Error_FileSwitchDataLost 0x428
#  define Error_TooManyErrorLookups 0x429
#  define Error_MessageFileBusy 0x42a
#  define Error_PartitionBusy 0x42b
#  define FileSwitch_FSNumberNone 0x0
#  define FileSwitch_FSNumberROMFS 0x3
#  define FileSwitch_FSNumberNETFS 0x5
#  define FileSwitch_FSNumberADFS 0x8
#  define FileSwitch_FSNumberNETPRINT 0xc
#  define FileSwitch_FSNumberNull 0xd
#  define FileSwitch_FSNumberPrinter 0xe
#  define FileSwitch_FSNumberSerial 0xf
#  define FileSwitch_FSNumberVDU 0x11
#  define FileSwitch_FSNumberRAWVDU 0x12
#  define FileSwitch_FSNumberKBD 0x13
#  define FileSwitch_FSNumberRAWKBD 0x14
#  define FileSwitch_FSNumberDESKFS 0x15
#  define FileSwitch_FSNumberRAMFS 0x17
#  define FileSwitch_FSNumberRISCIXFS 0x18
#  define FileSwitch_FSNumberStreamer 0x19
#  define FileSwitch_FSNumberSCSIFS 0x1a
#  define FileSwitch_FSNumberDigitiser 0x1b
#  define FileSwitch_FSNumberScanner 0x1c
#  define FileSwitch_FSNumberMULTIFS 0x1d
#  define FileSwitch_FSNumberNFS 0x21
#  define FileSwitch_FSNumberCDFS 0x25
#  define FileSwitch_FSNumberDOSFS 0x2b
#  define FileSwitch_FSNumberRESOURCEFS 0x2e
#  define FileSwitch_FSNumberPIPEFS 0x2f
#  define FileSwitch_FSNumberDEVICEFS 0x35
#  define FileSwitch_FSNumberParallel 0x36
#  define FileSwitch_FSNumberSPARKFS 0x42
#  define FileSwitch_FSNumberPCCARDFS 0x59
#  define FileSwitch_FSNumberMEMFS 0x5b
#  define FileSwitch_FSNumberSHAREFS 0x63
#  define FileSwitch_FSNumberLANMAN 0x66
#  define FileSwitch_FSNumberOMNIPRINT 0x68
#  define FileSwitch_FSNumberRSDFS 0x6c
#  define FileSwitch_FSNumber 0xff
#  define FileSwitch_FSOpenFileLimit 0xff00
#  define FileSwitch_FSReadOnly 0x10000
#  define FileSwitch_HasExtraFlags 0x20000
#  define FileSwitch_NoFileEntries 0x40000
#  define FileSwitch_NoSaveEntry 0x80000
#  define FileSwitch_NoLoadEntry 0x100000
#  define FileSwitch_ImplicitDirectories 0x200000
#  define FileSwitch_NeedsURDAndLib 0x400000
#  define FileSwitch_SupportsImage 0x800000
#  define FileSwitch_Reserved 0x1000000
#  define FileSwitch_SupportsFileInfo 0x2000000
#  define FileSwitch_SupportsStampNamed 0x4000000
#  define FileSwitch_NeedsFlush 0x8000000
#  define FileSwitch_NeedsCreate 0x10000000
#  define FileSwitch_SupportsEmptyNames 0x20000000
#  define FileSwitch_Interactive 0x40000000
#  define FileSwitch_SupportsSpecial 0x80000000
#  define FileSwitch_SupportsDirChange 0x1
#  define FileSwitch_NeedsCat 0x2
#  define FileSwitch_NeedsEx 0x4
#  define FileSwitch_SupportsIOCtl 0x8
#  define FileSwitch_NotFound 0x0
#  define FileSwitch_IsFile 0x1
#  define FileSwitch_IsDir 0x2
#  define FileSwitch_IsImage 0x3
#  define FileSwitch_AttrOwnerRead 0x1
#  define FileSwitch_AttrOwnerWrite 0x2
#  define FileSwitch_AttrOwnerSpecial 0x4
#  define FileSwitch_AttrOwnerLocked 0x8
#  define FileSwitch_AttrWorldRead 0x10
#  define FileSwitch_AttrWorldWrite 0x20
#  define FileSwitch_AttrWorldSpecial 0x40
#  define FileSwitch_AttrWorldLocked 0x80
#  define Error_NotSupported 0xf8
#  define Error_FSWriteOnly 0xfa
#  define Error_FSReadOnly 0xfc

@Symbols for structure offsets and sizes
        .struct 0
        .skip   Byte
FileSwitch_FSNo                : 

        .struct 0
        .skip   Bits
FileSwitch_FSInfo              : 

        .struct 0
        .skip   Bits
FileSwitch_FSExtraInfo         : 

        .struct 0
        .skip   Int
FileSwitch_ObjectType          : 

        .struct 0
        .skip   Bits
FileSwitch_Attr                : 

        .struct 0
FileSwitch_InfoWords_date_and_time: .skip   OS_DateAndTime
        .struct 0
FileSwitch_InfoWords_addrs_exec_addr: .skip   Bits
FileSwitch_InfoWords_addrs_load_addr: .skip   Bits
FileSwitch_InfoWords           : 


@Symbols for SWI's and SWI reason codes
#  define BGetV 0xa
   @Entry
   @  R1 = file (OS_F)
   @  R9 = &A
   @Exit
   @  R0 = c (Char)

#  define BGetVW 0xa
   @Entry
   @  R1 = file (OS_FW)
   @  R9 = &A
   @Exit
   @  R0 = c (Char)

#  define BPutV 0xb
   @Entry
   @  R0 = c (Char)
   @  R1 = file (OS_F)
   @  R9 = &B

#  define BPutVW 0xb
   @Entry
   @  R0 = c (Char)
   @  R1 = file (OS_FW)
   @  R9 = &B

.set XOS_BGet,0x2000a
.set OS_BGet,0xa
   @Entry
   @  R1 = file (OS_F)
   @Exit
   @  R0 = c (Char)

.set XOS_BGetW,0x2000a
.set OS_BGetW,0xa
   @Entry
   @  R1 = file (OS_FW)
   @Exit
   @  R0 = c (Char)

.set XOS_BPut,0x2000b
.set OS_BPut,0xb
   @Entry
   @  R0 = c (Char)
   @  R1 = file (OS_F)

.set XOS_BPutW,0x2000b
.set OS_BPutW,0xb
   @Entry
   @  R0 = c (Char)
   @  R1 = file (OS_FW)

#  define Service_StartUpFS 0x12
   @Entry
   @  R1 = &12
   @  R2 = fs_no (FileSwitch_FSNo)

#  define Service_FSRedeclare 0x40
   @Entry
   @  R1 = &40

#  define Service_CloseFile 0x68
   @Entry
   @  R1 = &68
   @  R2 -> file_name (String)
   @  R3 = count (Int)
   @Exit
   @  R3 = count_out (Int)

#  define Service_UKCompression 0xb7

#  define Service_UKCompressionUnsqueeze 0x0
   @Entry
   @  R0 = &0
   @  R1 = &B7
   @  R2 = load_addr (Bits)
   @  R3 = size (Int)
   @  R4 = exec_addr (Bits)
   @  R5 -> filename (String)
   @Exit
   @  R1 = unclaimed (Bool)
   @  R3 = size_out (Int)
   @  R4 = new_exec_addr (Bits)

#  define Service_UKCompressionPatch 0x1
   @Entry
   @  R0 = &1
   @  R1 = &B7
   @  R2 = load_addr (Bits)
   @  R3 = size (Int)
   @  R4 = exec_addr (Bits)
   @  R5 -> filename (String)
   @Exit
   @  R1 = unclaimed (Bool)
   @  R3 = size_out (Int)
   @  R4 = new_exec_addr (Bits)

#  define Service_UKCompressionNonAIF 0x2
   @Entry
   @  R0 = &2
   @  R1 = &B7
   @  R2 = &8000
   @  R3 = size (Int)
   @  R4 = exec_addr (Bits)
   @  R5 -> filename (String)
   @  R6 -> header (data)
   @  R7 -> args (String)
   @Exit
   @  R1 = unclaimed (Bool)
   @  R3 = size_out (Int)
   @  R4 = new_exec_addr (Bits)

#  define Service_UKCompression26BitOn32Bit 0x3
   @Entry
   @  R0 = &3
   @  R1 = &B7
   @  R2 = &8000
   @  R3 = size (Int)
   @  R4 = exec_addr (Bits)
   @  R5 -> filename (String)
   @  R6 -> header (data)
   @  R7 -> args (String)
   @Exit
   @  R1 = unclaimed (Bool)
   @  R3 = size_out (Int)
   @  R4 = new_exec_addr (Bits)

#  define Service_UKCompressionDebugger 0x4
   @Entry
   @  R0 = &4
   @  R1 = &B7
   @  R2 = &8000
   @  R3 = size (Int)
   @  R4 = exec_addr (Bits)
   @  R5 -> filename (String)
   @Exit
   @  R1 = unclaimed (Bool)

#endif
