; Copyright 2008 Castle Technology Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; This header file is autogenerated from the files maintained by the
; RISC OS allocations manager and should not be edited by anyone else.

        SUBT    Definitions relating to the basic RISCOS kernel ==> Hdr:RISCOS

OldOpt  SETA    {OPT}
        OPT     OptNoList+OptNoP1List

; SWI names are exported in two forms :
; 1)  with OS_  'OS_DoThingToOtherThing'  as N
; 2)  with XOS_ 'XOS_DoThingToOtherThing' as N + Auto_Error_SWI_bit

Auto_Error_SWI_bit_number * 17
Auto_Error_SWI_bit * 1 :SHL: Auto_Error_SWI_bit_number

SWIClass SETS   RISCOS_Kernel_0SWI_Name

        ^       RISCOS_Kernel_0SWI_Base
        AddSWI  WriteC                  ; &00
        AddSWI  WriteS                  ; &01
        AddSWI  Write0                  ; &02
        AddSWI  NewLine                 ; &03
        AddSWI  ReadC                   ; &04
        AddSWI  CLI                     ; &05
        AddSWI  Byte                    ; &06
        AddSWI  Word                    ; &07
        AddSWI  File                    ; &08
        AddSWI  Args                    ; &09
        AddSWI  BGet                    ; &0A
        AddSWI  BPut                    ; &0B
        AddSWI  GBPB                    ; &0C
        AddSWI  Find                    ; &0D
        AddSWI  ReadLine                ; &0E
        AddSWI  Control                 ; &0F
        AddSWI  GetEnv                  ; &10
        AddSWI  Exit                    ; &11
        AddSWI  SetEnv                  ; &12
        AddSWI  IntOn                   ; &13
        AddSWI  IntOff                  ; &14
        AddSWI  CallBack                ; &15
        AddSWI  EnterOS                 ; &16
        AddSWI  BreakPt                 ; &17
        AddSWI  BreakCtrl               ; &18
        AddSWI  UnusedSWI               ; &19
        AddSWI  UpdateMEMC              ; &1A
        AddSWI  SetCallBack             ; &1B
        AddSWI  Mouse                   ; &1C
        AddSWI  Heap                    ; &1D ; Our new ones start here
        AddSWI  Module                  ; &1E
        AddSWI  Claim                   ; &1F ; PMF's vector handling
        AddSWI  Release                 ; &20 ; routines
        AddSWI  ReadUnsigned            ; &21 ; Read an unsigned number
        AddSWI  GenerateEvent           ; &22
        AddSWI  ReadVarVal              ; &23 ; read variable value & type
        AddSWI  SetVarVal               ; &24 ; set  variable value & type
        AddSWI  GSInit                  ; &25
        AddSWI  GSRead                  ; &26
        AddSWI  GSTrans                 ; &27
        AddSWI  BinaryToDecimal         ; &28
        AddSWI  FSControl               ; &29
        AddSWI  ChangeDynamicArea       ; &2A
        AddSWI  GenerateError           ; &2B
        AddSWI  ReadEscapeState         ; &2C
        AddSWI  EvaluateExpression      ; &2D
        AddSWI  SpriteOp                ; &2E
        AddSWI  ReadPalette             ; &2F ; (was FontManager)
        AddSWI  ServiceCall             ; &30 ; was Claim_Release_FIQ
        AddSWI  ReadVduVariables        ; &31
        AddSWI  ReadPoint               ; &32
        AddSWI  UpCall                  ; &33
        AddSWI  CallAVector             ; &34 ; was ReadCurrentError
        AddSWI  ReadModeVariable        ; &35
        AddSWI  RemoveCursors           ; &36
        AddSWI  RestoreCursors          ; &37
        AddSWI  SWINumberToString       ; &38
        AddSWI  SWINumberFromString     ; &39
        AddSWI  ValidateAddress         ; &3A
        AddSWI  CallAfter               ; &3B
        AddSWI  CallEvery               ; &3C
        AddSWI  RemoveTickerEvent       ; &3D
        AddSWI  InstallKeyHandler       ; &3E
        AddSWI  CheckModeValid          ; &3F

SWIClass SETS   RISCOS_Kernel_1SWI_Name

        ^       RISCOS_Kernel_1SWI_Base
        AddSWI  ChangeEnvironment       ; &40
        AddSWI  ClaimScreenMemory       ; &41
        AddSWI  ReadMonotonicTime       ; &42
        AddSWI  SubstituteArgs          ; &43
        AddSWI  PrettyPrint             ; &44
        AddSWI  Plot                    ; &45
        AddSWI  WriteN                  ; &46
        AddSWI  AddToVector             ; &47
        AddSWI  WriteEnv                ; &48
        AddSWI  ReadArgs                ; &49
        AddSWI  ReadRAMFsLimits         ; &4A
        AddSWI  ClaimDeviceVector       ; &4B
        AddSWI  ReleaseDeviceVector     ; &4C
        AddSWI  DelinkApplication       ; &4D
        AddSWI  RelinkApplication       ; &4E
        AddSWI  HeapSort                ; &4F
        AddSWI  ExitAndDie              ; &50
        AddSWI  ReadMemMapInfo          ; &51
        AddSWI  ReadMemMapEntries       ; &52
        AddSWI  SetMemMapEntries        ; &53
        AddSWI  AddCallBack             ; &54
        AddSWI  ReadDefaultHandler      ; &55
        AddSWI  SetECFOrigin            ; &56
        AddSWI  SerialOp                ; &57
        AddSWI  ReadSysInfo             ; &58
        AddSWI  Confirm                 ; &59
        AddSWI  ChangedBox              ; &5A
        AddSWI  CRC                     ; &5B
        AddSWI  ReadDynamicArea         ; &5C
        AddSWI  PrintChar               ; &5D
        AddSWI  ChangeRedirection       ; &5E
        AddSWI  RemoveCallBack          ; &5F
        AddSWI  FindMemMapEntries       ; &60
        AddSWI  SetColour               ; &61
        AddSWI  ClaimSWI                ; &62 ; In ToolkitSpt - Must be implemented
        AddSWI  ReleaseSWI              ; &63 ; OS > 3.10.
        AddSWI  Pointer                 ; &64
        AddSWI  ScreenMode              ; &65
        AddSWI  DynamicArea             ; &66
        AddSWI  AbortTrap               ; &67
        AddSWI  Memory                  ; &68
        AddSWI  ClaimProcessorVector    ; &69
        AddSWI  Reset                   ; &6A
        AddSWI  MMUControl              ; &6B
        AddSWI  ResyncTime              ; &6C
        AddSWI  PlatformFeatures        ; &6D
        AddSWI  SynchroniseCodeAreas    ; &6E
        AddSWI  CallASWI                ; &6F
        AddSWI  AMBControl              ; &70 ### Clashes with OS_SpecialControl on PPlus ###
        AddSWI  CallASWIR12             ; &71
        AddSWI  SpecialControl          ; &72 ### this was &70 in original PPlus sources ###
        AddSWI  EnterUSR32              ; &73 first used in Ursula
        AddSWI  EnterUSR26              ; &74 first used in Ursula
        AddSWI  VIDCDivider             ; &75
        AddSWI  NVMemory                ; &76
        ^       OS_NVMemory + 4
        AddSWI  Hardware                ; &7A
        AddSWI  IICOp                   ; &7B
        AddSWI  LeaveOS                 ; &7C
        AddSWI  ReadLine32              ; &7D
        AddSWI  SubstituteArgs32        ; &7E
        AddSWI  HeapSort32              ; &7F

NCORESWIS  *    OS_HeapSort32 + 1       ; There are this many kernel SWIs, 0..NCORESWIS-1

        ASSERT  @ <= &C0

SWIClass SETS   RISCOS_StringConversionSWI_Name

        ^       RISCOS_StringConversionSWI_Base
        AddSWI  ConvertStandardDateAndTime ; &C0
        AddSWI  ConvertDateAndTime         ; &C1

        ^       RISCOS_StringConversionSWI_Base + &10
        AddSWI  ConvertHex1             ; &D0
        AddSWI  ConvertHex2             ; &D1
        AddSWI  ConvertHex4             ; &D2
        AddSWI  ConvertHex6             ; &D3
        AddSWI  ConvertHex8             ; &D4
        AddSWI  ConvertCardinal1        ; &D5
        AddSWI  ConvertCardinal2        ; &D6
        AddSWI  ConvertCardinal3        ; &D7
        AddSWI  ConvertCardinal4        ; &D8
        AddSWI  ConvertInteger1         ; &D9
        AddSWI  ConvertInteger2         ; &DA
        AddSWI  ConvertInteger3         ; &DB
        AddSWI  ConvertInteger4         ; &DC
        AddSWI  ConvertBinary1          ; &DD
        AddSWI  ConvertBinary2          ; &DE
        AddSWI  ConvertBinary3          ; &DF
        AddSWI  ConvertBinary4          ; &E0
        AddSWI  ConvertSpacedCardinal1  ; &E1
        AddSWI  ConvertSpacedCardinal2  ; &E2
        AddSWI  ConvertSpacedCardinal3  ; &E3
        AddSWI  ConvertSpacedCardinal4  ; &E4
        AddSWI  ConvertSpacedInteger1   ; &E5
        AddSWI  ConvertSpacedInteger2   ; &E6
        AddSWI  ConvertSpacedInteger3   ; &E7
        AddSWI  ConvertSpacedInteger4   ; &E8
        AddSWI  ConvertFixedNetStation  ; &E9
        AddSWI  ConvertNetStation       ; &EA
        AddSWI  ConvertFixedFileSize    ; &EB
        AddSWI  ConvertFileSize         ; &EC
        AddSWI  ConvertVariform         ; &ED

        ASSERT  @ <= &100

SWIClass SETS   RISCOS_WriteCharacter_0SWI_Name

        ^       RISCOS_WriteCharacter_0SWI_Base
        AddSWI  WriteI                  ; &100-&1FF

        ; RISC OS Specific register synonyms

Error   RN      r0                      ; Error return pointer

wp      RN      r12                     ; Workspace Pointer
WP      RN      r12
WsPtr   RN      r12

sp_irq  RN      r13_irq                 ; Note there is no definition
sp_svc  RN      r13_svc                 ; for sp_usr or sp_fiq.
stack   RN      r13                     ; Stack Pointer
Stack   RN      r13
STACK   RN      r13

        ; Vector numbers

UserV   *       &00
ErrorV  *       &01
IrqV    *       &02
WrchV   *       &03
RdchV   *       &04                     ; --,
CliV    *       &05                     ;   |
ByteV   *       &06                     ;   |
WordV   *       &07                     ;   |
FileV   *       &08                     ;   |
ArgsV   *       &09                     ;   } These numbers correspond
BGetV   *       &0A                     ;   } to the SWI numbers
BPutV   *       &0B                     ;   |
GBPBV   *       &0C                     ;   |
FindV   *       &0D                     ;   |
ReadLineV *     &0E                     ; --'
FSCV    *       &0F
EventV  *       &10
UPTV    *       &11
NETV    *       &12
KEYV    *       &13
INSV    *       &14
REMV    *       &15
CNPV    *       &16                     ; Count/Purge Buffer V
UKVDU23V *      &17                     ; VDU23 (decimal)
UKSWIV  *       &18                     ; Unknown SWI numbers
UKPLOTV *       &19                     ; VDU25 (decimal)
MouseV  *       &1A                     ; The mouse SWI vectors along here
VDUXV   *       &1B                     ; The kernel calls this vector instead of
                                        ; the VDU if bit 5 of wrch destination set
TickerV *       &1C                     ; 100Hz pacemaker
UpCallV *       &1D                     ; The 'can you deal with this before I go bang' vector.
ChangeEnvironmentV * &1E                ; vectors along here when changing any handlers,
                                        ; so debuggers etc. can stop it getting through.
SpriteV *       &1F                     ; called by SWI SpriteOp
DrawV   *       &20                     ; polygon fill vector for printers
EconetV *       &21                     ; Vector for NetFS/Econet progress reporting
ColourV *       &22                     ; for the ColourTrans module
PaletteV *      &23                     ; palette changed indication
SerialV *       &24                     ; indirection of SerialOps from kernel to Serial device drivers.
FontV   *       &25                     ; indirection of Font Manager calls prior
                                        ; to processing by Font Manager.
PointerV *      &26                     ; for mouse drivers
TimeShareV *    &27                     ; SkyNet TimeShare
GraphicsV *     &2A                     ; indirection of graphics system from Kernel
UnthreadV *     &2B                     ; high-priority callbacks
SeriousErrorV * &2C                     ; an exception occurred which could only be handled by flattening the privileged mode stacks

SpareVector3 *  &2D
SpareVector2 *  &2E
SpareVector1 *  &2F

NVECTORS *      SpareVector1 + 1        ; There are this many vectors, 0..NVECTORS-1

        ; Buffer indices

Buff_Key        * 0
Buff_RS423In    * 1
Buff_RS423Out   * 2
Buff_Print      * 3
Buff_Sound0     * 4
Buff_Sound1     * 5
Buff_Sound2     * 6
Buff_Sound3     * 7
Buff_Speech     * 8
Buff_Mouse      * 9

        ; Conversions for OS_ConvertVariform in R4

                ^ 0
ConvertToHex            # 1
ConvertToCardinal       # 1
ConvertToInteger        # 1 ; Signed
ConvertToBinary         # 1
ConvertToSpacedCardinal # 1
ConvertToSpacedInteger  # 1 ; Signed
ConvertToPunctCardinal  # 1
ConvertToPunctInteger   # 1 ; Signed
ConvertToFixedFileSize  # 1
ConvertToFileSize       # 1
ConvertToIPv4           # 1
ConvertToEUI            # 1
ConvertToIPv6           # 1
ConvertToShortestIPv6   # 1 ; See RFC5952 section 4
ConvertToHexLowercase   # 1

        ; Event numbers. 0..31 available

Event_OutputEmpty       * 0
Event_InputFull         * 1
Event_CharInput         * 2
Event_ADCConvert        * 3
Event_VSync             * 4
Event_IntervalTimer     * 5
Event_Escape            * 6
Event_RS423Error        * 7
Event_Econet_UserRPC    * 8
Event_User              * 9
Event_Mouse             * 10
Event_Keyboard          * 11
Event_Sound             * 12
Event_Econet_Rx         * 14
Event_Econet_Tx         * 15
Event_Econet_OSProc     * 16    ; This is where Notify, View etc. happen
Event_MIDI              * 17    ; to notify of MIDI data being received
Event_Internet          * 19
Event_Expansion         * 21    ; was SJ. Now earmarked for use with subreason codes
Event_DeviceOverRun     * 22    ; DeviceFS to inform the world that a device has overrun
Event_PortableBMU       * 28    ; Downgrade of BMU interrupt.
; #### WARNING #### There are TWO event numbers left. Do not allocate any more
; without a really good reason.                                            amg
Event_PRISM             * 32    ; State change events from the PRISM subsystem

; Subreason codes for Event_Expansion - to be passed in R1 on the event call
                                ^ 0
Event_Expansion_SmartCard       # 0          ; ANC Rich Buckley
Event_Expansion_SCInterface     # 1          ; 1 more useful alias for above
Event_Expansion_SCTransport     # 1          ; 2

; Subreason codes for Event_Internet - to be passed in R1 on the event call
                                ^ 1
Event_Internet_SocketAsync      # 1
Event_Internet_SocketUrgent     # 1
Event_Internet_SocketBroken     # 1
Event_Internet_RevARPReply      # 1
Event_Internet_RevARPRequest    # 1

; Keyboard status bits

KBStat_PendingAlt       * &01
KBStat_ScrollLock       * &02
KBStat_NoNumLock        * &04
KBStat_ShiftEngaged     * &08
KBStat_NoCapsLock       * &10
KBStat_NoShiftLock      * &20
KBStat_CtrlEngaged      * &40
KBStat_ShiftEnable      * &80

KBStat_NoCapsLockBitNo  * 4

NIL                     * &80000000     ; An interesting value
AppSpaceStart           * &8000         ; Start of the user's world

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; From here on, due for retirement

MaxLengthDateLo *       &33EA0000       ; Wednesday, 28th September 1988
MaxLengthDateHi *       &00000041       ; 11:34:36.80 am

                 GBLL True
True             SETL {TRUE}

                 GBLL False
False            SETL {FALSE}

                 GBLL AssemblingArthur
AssemblingArthur SETL {FALSE}

        OPT     OldOpt
        END