@ GNU AS assembler header file for OSGBPB
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:49:36 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 OSGBPB_Hdr
#  define OSGBPB_Hdr

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

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

#  ifndef Get_FileSwitch
#    define Get_FileSwitch
#    include "oslib/FileSwitch.Hdr"
#  endif

@Symbols for constants
#  define OSGBPB_PrivilegeOwner 0x0
#  define OSGBPB_PrivilegePublic 0xff
#  define OSGBPB_NoMore 0xffffffff

@Symbols for structure offsets and sizes
        .struct 0
OSGBPB_Name_count              : .skip   Byte
OSGBPB_Name_c                  : .skip   Char
OSGBPB_Name                    : 
        
        .altmacro
        .macro  OSGBPB_Name_MEMBERS label
\label&_count                  : .skip   Byte
        .endm
        
        .struct 0
        OSGBPB_Name_MEMBERS OSGBPB_NameBase
OSGBPB_NameBase                : 

        .struct 0
OSGBPB_DiscName_name           : .skip   OSGBPB_Name
OSGBPB_DiscName                : 

        .struct 0
OSGBPB_DirName_reserved        : .skip   Byte
OSGBPB_DirName_name            : .skip   OSGBPB_Name
OSGBPB_DirName                 : 

        .struct 0
OSGBPB_NameList_names          : .skip   OSGBPB_Name
OSGBPB_NameList                : 

        .struct 0
OSGBPB_Info_load_addr          : .skip   Bits
OSGBPB_Info_exec_addr          : .skip   Bits
OSGBPB_Info_size               : .skip   Int
OSGBPB_Info_attr               : .skip   FileSwitch_Attr
OSGBPB_Info_obj_type           : .skip   FileSwitch_ObjectType
OSGBPB_Info_name               : .skip   Char
OSGBPB_Info                    : 
        
        .altmacro
        .macro  OSGBPB_Info_MEMBERS label
\label&_load_addr              : .skip   Bits
\label&_exec_addr              : .skip   Bits
\label&_size                   : .skip   Int
\label&_attr                   : .skip   FileSwitch_Attr
\label&_obj_type               : .skip   FileSwitch_ObjectType
        .endm
        
        .struct 0
        OSGBPB_Info_MEMBERS OSGBPB_InfoBase
OSGBPB_InfoBase                : 

        .struct 0
OSGBPB_SystemInfo_load_addr    : .skip   Bits
OSGBPB_SystemInfo_exec_addr    : .skip   Bits
OSGBPB_SystemInfo_size         : .skip   Int
OSGBPB_SystemInfo_attr         : .skip   FileSwitch_Attr
OSGBPB_SystemInfo_obj_type     : .skip   FileSwitch_ObjectType
OSGBPB_SystemInfo_sin          : .skip   Int
OSGBPB_SystemInfo_stamp        : .skip   OS_DateAndTime
OSGBPB_SystemInfo_name         : .skip   Char
OSGBPB_SystemInfo              : 
        
        .altmacro
        .macro  OSGBPB_SystemInfo_MEMBERS label
\label&_load_addr              : .skip   Bits
\label&_exec_addr              : .skip   Bits
\label&_size                   : .skip   Int
\label&_attr                   : .skip   FileSwitch_Attr
\label&_obj_type               : .skip   FileSwitch_ObjectType
\label&_sin                    : .skip   Int
\label&_stamp                  : .skip   OS_DateAndTime
        .endm
        
        .struct 0
        OSGBPB_SystemInfo_MEMBERS OSGBPB_SystemInfoBase
OSGBPB_SystemInfoBase          : 

        .struct 0
OSGBPB_InfoStamped_load_addr   : .skip   Bits
OSGBPB_InfoStamped_exec_addr   : .skip   Bits
OSGBPB_InfoStamped_size        : .skip   Int
OSGBPB_InfoStamped_attr        : .skip   FileSwitch_Attr
OSGBPB_InfoStamped_obj_type    : .skip   FileSwitch_ObjectType
OSGBPB_InfoStamped_file_type   : .skip   Bits
OSGBPB_InfoStamped_name        : .skip   Char
OSGBPB_InfoStamped             : 
        
        .altmacro
        .macro  OSGBPB_InfoStamped_MEMBERS label
\label&_load_addr              : .skip   Bits
\label&_exec_addr              : .skip   Bits
\label&_size                   : .skip   Int
\label&_attr                   : .skip   FileSwitch_Attr
\label&_obj_type               : .skip   FileSwitch_ObjectType
\label&_file_type              : .skip   Bits
        .endm
        
        .struct 0
        OSGBPB_InfoStamped_MEMBERS OSGBPB_InfoStampedBase
OSGBPB_InfoStampedBase         : 

        .struct 0
OSGBPB_StringList_names        : 
OSGBPB_StringList              : 

        .struct 0
OSGBPB_InfoList_info           : .skip   OSGBPB_Info
OSGBPB_InfoList                : 

        .struct 0
OSGBPB_SystemInfoList_info     : .skip   OSGBPB_SystemInfo
OSGBPB_SystemInfoList          : 

        .struct 0
OSGBPB_InfoStampedList_info    : .skip   OSGBPB_InfoStamped
OSGBPB_InfoStampedList         : 

        .struct 0
        .skip   Byte
OSGBPB_Privilege               : 


@Symbols for SWI's and SWI reason codes
.set XOS_GBPB,0x2000c
.set OS_GBPB,0xc

#  define OSGBPB_WriteAt 0x1
   @Entry
   @  R0 = &1
   @  R1 = file (OS_F)
   @  R2 -> data (data)
   @  R3 = size (Int)
   @  R4 = ptr (Int)
   @Exit
   @  R2 corrupted
   @  R3 = unwritten (Int)
   @  R4 corrupted

#  define OSGBPB_WriteAtW 0x1
   @Entry
   @  R0 = &1
   @  R1 = file (OS_FW)
   @  R2 -> data (data)
   @  R3 = size (Int)
   @  R4 = ptr (Int)
   @Exit
   @  R2 corrupted
   @  R3 = unwritten (Int)
   @  R4 corrupted

#  define OSGBPB_Write 0x2
   @Entry
   @  R0 = &2
   @  R1 = file (OS_F)
   @  R2 -> data (data)
   @  R3 = size (Int)
   @Exit
   @  R2 corrupted
   @  R3 = unwritten (Int)
   @  R4 corrupted

#  define OSGBPB_WriteW 0x2
   @Entry
   @  R0 = &2
   @  R1 = file (OS_FW)
   @  R2 -> data (data)
   @  R3 = size (Int)
   @Exit
   @  R2 corrupted
   @  R3 = unwritten (Int)
   @  R4 corrupted

#  define OSGBPB_ReadAt 0x3
   @Entry
   @  R0 = &3
   @  R1 = file (OS_F)
   @  R2 = buffer (pointer to data)
   @  R3 = size (Int)
   @  R4 = ptr (Int)
   @Exit
   @  R2 corrupted
   @  R3 = unread (Int)
   @  R4 corrupted

#  define OSGBPB_ReadAtW 0x3
   @Entry
   @  R0 = &3
   @  R1 = file (OS_FW)
   @  R2 = buffer (pointer to data)
   @  R3 = size (Int)
   @  R4 = ptr (Int)
   @Exit
   @  R2 corrupted
   @  R3 = unread (Int)
   @  R4 corrupted

#  define OSGBPB_Read 0x4
   @Entry
   @  R0 = &4
   @  R1 = file (OS_F)
   @  R2 = buffer (pointer to data)
   @  R3 = size (Int)
   @Exit
   @  R2 corrupted
   @  R3 = unread (Int)
   @  R4 corrupted

#  define OSGBPB_ReadW 0x4
   @Entry
   @  R0 = &4
   @  R1 = file (OS_FW)
   @  R2 = buffer (pointer to data)
   @  R3 = size (Int)
   @Exit
   @  R2 corrupted
   @  R3 = unread (Int)
   @  R4 corrupted

#  define OSGBPB_ReadDiscName 0x5
   @Entry
   @  R0 = &5
   @  R2 = disc_name (pointer to OSGBPB_DiscName)

#  define OSGBPB_ReadCSDName 0x6
   @Entry
   @  R0 = &6
   @  R2 = csd_name (pointer to OSGBPB_DirName)

#  define OSGBPB_ReadLibName 0x7
   @Entry
   @  R0 = &7
   @  R2 = lib_name (pointer to OSGBPB_DirName)

#  define OSGBPB_CSDEntries 0x8
   @Entry
   @  R0 = &8
   @  R2 = name_list (pointer to OSGBPB_NameList)
   @  R3 = count (Int)
   @  R4 = context (Int)
   @Exit
   @  R3 = unread (Int)
   @  R4 = context_out (Int)

#  define OSGBPB_DirEntries 0x9
   @Entry
   @  R0 = &9
   @  R1 -> dir_name (String)
   @  R2 = name_list (pointer to OSGBPB_StringList)
   @  R3 = count (Int)
   @  R4 = context (Int)
   @  R5 = size (Int)
   @  R6 -> entries (String)
   @Exit
   @  R3 = read_count (Int)
   @  R4 = context_out (Int)

#  define OSGBPB_DirEntriesInfo 0xa
   @Entry
   @  R0 = &A
   @  R1 -> dir_name (String)
   @  R2 = info_list (pointer to OSGBPB_InfoList)
   @  R3 = count (Int)
   @  R4 = context (Int)
   @  R5 = size (Int)
   @  R6 -> entries (String)
   @Exit
   @  R3 = read_count (Int)
   @  R4 = context_out (Int)

#  define OSGBPB_DirEntriesSystemInfo 0xb
   @Entry
   @  R0 = &B
   @  R1 -> dir_name (String)
   @  R2 = info_list (pointer to OSGBPB_SystemInfoList)
   @  R3 = count (Int)
   @  R4 = context (Int)
   @  R5 = size (Int)
   @  R6 -> entries (String)
   @Exit
   @  R3 = read_count (Int)
   @  R4 = context_out (Int)

#  define OSGBPB_DirEntriesInfoStamped 0xc
   @Entry
   @  R0 = &C
   @  R1 -> dir_name (String)
   @  R2 = info_list (pointer to OSGBPB_InfoStampedList)
   @  R3 = count (Int)
   @  R4 = context (Int)
   @  R5 = size (Int)
   @  R6 -> entries (String)
   @Exit
   @  R3 = read_count (Int)
   @  R4 = context_out (Int)

#  define GBPBV 0xc

#endif
