        SUBT    System wide declarations => &.Hdr.System

OldOpt  SETA    {OPT}
        OPT     OptNoList+OptNoP1List

; ***********************************
; ***    C h a n g e   L i s t    ***
; ***********************************

; Date       Name  Description
; ----       ----  -----------
; 29-Sep-87  NReeves Added FileCore SWI chunk
; 06-Oct-87  APT   Allocated CMOS byte bits to ROMFS
; 07-Oct-87  NReeves added WinnieSizeCMOS
; 20-Oct-87  BC    Added 'Event_Econet_Rx' (14), '_Tx' (15), and _OSProc (16)
; 27-Oct-87  APT   ReadArgs SWI
; 03-Nov-87  SKS   Added ROMCache Application SWI chunk
; 04-Nov-87  PMF   Added SmallTalk Applicn SWI chunk
; 04-Nov-87  APT   ReadRAMFsLimits SWI
; 12-Nov-87  PMF   Added One extra CMOS byte to termulator (3 now, was 2)
; 16-Nov-87  APT   Device_Vector claim and release SWIs
; 03-Dec-87  NDR   Added VersionSWI swi chunk
; 10-Dec-87  BC    Put in the ProtectionCMOS
; 16-Dec-87  BC    Added MyoLink swi chunk
; 16-Dec-87  APT   ExitAndDie SWI added
; 15-Jan-88  APT   Delink/Relink_Application and HeapSort SWIs added,
;                  ExitAndDie moved.
; 15-Jan-88  TMD   Added MouseStepCMOS
; 21-Jan-88  APT   Memory mapping SWIs added
; 26-Jan-88  SKS   Added FFTSWI and SoundSamplerSWI chunks
; 27-Jan-88  BC    Another SWI chunk allocated to Resource
; 08-Feb-88  SKS   Added FontAidPrintSWI chunk
; 09-Feb-88  SKS   Added AlliedInteractive SWI chunk,CMOS
; 11-Feb-88  SKS   Added Euclid3DSWI chunk
; 17-Feb-88  APT   Added SharedLibrary SWI
; 22-Feb-88  TMD   Added SystemSpeedCMOS
; 24-Feb-88  APT   Removed _ from SWI names
; 24-Feb-88  SKS   Added 256colourhandler SWI chunk
; 03-Mar-88  NDR   Added WimpModeCMOS (&C4)
; 07-Mar-88  APT   OS_ReadDefaultHandler
; 09-Mar-88  SKS   Added CConcepts SWI chunks
; 09-Mar-88  TMD   Added OS_SetVduVariables
; 10-Mar-88  TMD   Removed OS_SetVduVariables
; 11-Mar-88  TMD   Added IIC SWI chunk
; 12-Mar-88  NDR   Added WimpFlagsCMOS
; 15-Mar-88  APT   Added Shell SWI chunk
; 18-Mar-88  APT   Added Intelligent Interfaces SWI chunks
; 18-Mar-88  NDR   Inserted AddCallBack before ReadDefaultHandler
; 21-Mar-88  TMD   Added more monitor types
; 21-Mar-88  TMD   Added SWI OS_SetECFOrigin
; 23-Mar-88  APT   Moved Intelligent Interfaces SWI chunks
; 05-Apr-88  APT   Added DrawV
; 08-Apr-88  SKS   Added HourglassSWI chunk
; 08-Apr-88  BC    Added EconetV for progress reporting
; 08-Apr-88  TMD   Added OS_SerialOp
; 11-Apr-88  SKS   Added AMSFinesseSWI
; 12-Apr-88  DJS   Added DrawSWI
; 21-Apr-88  SKS   Added SibeliusSWI
;  4-May-88  SKS   Added FaxPack SWI
; 16-May-88  APT   Added OS_ReadSysInfo SWI
; 18-May-88  APT   Removed pre-1.20 changes.
; 18-May-88  SKS   Added CED SWI
; 19-May-88  APT   SWI OS_Confirm
; 23-May-88  TMD   Added SWI OS_ClipBox
; 26-May-88  SKS   Added DesktopCMOS byte
; 31-May-88  TMD   Changed SWI OS_ClipBox to SWI OS_ChangedBox
; 01-Jun-88  SKS   Added r13_usr, r14_usr
; 01-Jun-88  NReeves Added ADFSDirCacheCMOS
; 01-Jun-88  SKS   Added Servo SWI chunk
; 04-Jun-88  SKS   Added FileSize conversion SWIs, CRC SWI
; 09-Jun-88  NDR   Added CopyOptionsCMOS,WipeOptionCMOS,CountOptionsCMOS
; 10-Jun-88  APT   Added colour translation SWI chunk
; 13-Jun-88  APT   Added TaskModuleSWI
; 08-Jul-88  NReeves Added RamFS SWI chunk
; 08-Jul-88  SKS   Added MaxLengthDates
; 12-Jul-88  SKS   Added HindiWP SWI chunk
; 19-Jul-88  APT   Added OS_ReadDynamicArea
; 20-Jul-88  APT   Added more vectors
; 26-Jul-88  SKS   Added AutoCue SWI chunk
; 27-Jul-88  SKS   Added UnixBootCMOS
; 28-Jul-88  TMD   Added SWI OS_PrintChar
; 29-Jul-88  SKS   Added another bit in DesktopCMOS
; 01-Aug-88  SKS   Added another two bits in DesktopCMOS
; 03-Aug-88  SKS   Added UnixFS SWI chunk
; 17-Aug-88  TMD   Changed comment on MaxLengthDate
; 30-Aug-88  SKS   Added Realtime Graphics Language SWI chunk
; 06-Sep-88  SKS   Added Cadsoft SWI chunks
; 15-Sep-88  SKS   Added DigiTape SWI chunk
; 19-Sep-88  TMD   Added Resource and Wild Vision SWI chunks
; 06-Oct-88  TMD   Updated changes list to reflect above!
; 17-Oct-88  SKS   Checked IEEE488 SWI for II
; 24-Oct-88  SKS   Added Pluto SWI chunk
; 25-Oct-88  SKS   Added VEL SWI chunk
; 31-Oct-88  SKS   Moved II SWIs as someone had typed them wrong when sending
; 03-Nov-88  SKS   Added BNI SWI chunk
; 04-Nov-88  SKS   Added BrainSoft SWI chunks
; 09-Nov-88  SKS   Added WV frame grabber SWI chunk, checked TMDs alloc.
; 10-Nov-88 NRaine Removed Copy/Count/WipeOptionsCMOS
; 10-Nov-88 NRaine Added FontMaxCMOS
; 11-Nov-88  SKS   Checked VDIG SWI + added its name
; 17-Nov-88 NRaine Added FontMax1/2/3/4/5CMOS
; 21-Nov-88 NRaine Added FontMax6/7CMOS
; 21-Nov-88  SKS   Added PlutArchCMOS
; 01-Dec-88  APT   Added PMF's ABC shared library SWI chunk
; 05-Dec-88  SKS   Added Aardvark XAsm SWI chunk
; 07-Dec-88  SKS   Added another BNI SWI chunk
; 10-Jan-89  BC    Added a SWI chunk for Beebug's ISO C compiler system module
; 23-Jan-89  BC    Added a SWI chunk for John Ballance Computing's SCSI podule
; 23-Jan-89  BC    Added a SWI chunk for Simtron's Archway module
; 23-Jan-89  BC    Separated CMOS RAM allocations into Hdr.CMOS
; 25-Jan-89 NReeves added SWI chunk for SCSIFS
; 20-Feb-89  BC    Added a SWI chunk for Si-Plan Electronics Research
; 20-Feb-89  BC    Added a SWI chunk for Irlam Enterprise Limited
; 22-Feb-89  JRS   Added an Event number for MIDI
; 24-Feb-89  BC    Added a SWI chunk for Science frontiers
; 01-Mar-89  BC    Added a SWI chunk for Paul Fray Limited (ARACHNID)
; 09-Mar-89  BC    Added a SWI chunk for Mike Harrison, WatfordScannerSWI
; 13-Mar-89  BC    Added a SWI chunk for Teletext application
; 17-Mar-89  BC    Added a SWI chunk for Pineapple Software's digitiser
; 20-Mar-89  BC    Added a SWI chunk for Jamie Smith's MultiFS
; 29-Mar-89  BC    Added a SWI chunk for Graham Bartram's ACModem
;
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; 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 * 1 :SHL: 17

SWIClass SETS   "OS"

        ^       0                       ; Base for Arthur SWIs
        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
        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

 ASSERT @ <= &C0

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

        ^       &D0
        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
 ASSERT @ <= &100

        AddSWI  WriteI,         &100

        AddSWI  UserSWI,        &200


; Aliases for certain SWIs - please avoid using them

OS_Multiple     * OS_GBPB
XOS_Multiple    * XOS_GBPB

OS_Open         * OS_Find
XOS_Open        * XOS_Find



; Allocation of Operating System SWI Chunks

                ^       3
StringConvSWI   #       1

                ^       8       ; OS chunk allocation starts at &200
FileSwitchSWI   #       1       ; &200
IICSWI          #       1       ; &240
; "IIC"


; Allocation of System extension SWI chunks (&40000..&5FFFF) and their names

                ^       0
EconetSWI       #       1       ; 0 &40000
; "Econet"
NetFSSWI        #       1       ; 1  40040
; "NetFS"
FontSWI         #       1       ; 2  40080
; "Font"
WimpSWI         #       1       ; 3  400C0
; "Wimp"
TubeSWI         #       1       ; 4  40100
; ???
Sound0SWI       #       1       ; 5  40140
; "Sound"
Sound1SWI       #       1       ; 6  40180
; "Sound"
Sound2SWI       #       1       ; 7  401C0
; "Sound"
NetPrintSWI     #       1       ; 8  40200
; "NetPrint"
ADFSSWI         #       1       ; 9  40240
; "ADFS"
PoduleSWI       #       1       ; 10 40280
; "Podule"
ARMPCSWI        #       1       ; 11 402C0
; ???
WaveTableSWI    #       1       ; 12 40300
; "WaveSynth"
IntelligentInterfaceIEEESWI # 1 ; 13 40340 ; checked 17/10/88 SKS
; "IEEE488"
DebuggerSWI     #       1       ; 14 40380
; "Debugger"
SCSIDriverSWI   #       1       ; 15 403C0 ; Dave Fell
; I think Debugger also uses this one !
; ???
VFSSWI          #       1       ; 16 40400
; ???
VideoCommandSWI #       1       ; 17 40440
; ???
FPEmulatorSWI   #       1       ; 18 40480
; "FPEmulator"
MIDISWI         #       1       ; 19 404C0
; "MIDI"
IO_PoduleSWI    #       1       ; 20 40500
; "IO_Podule"
FileCoreSWI     #       1       ; 21 40540
; "FileCore"
VersionSWI      #       1       ; 22 40580
; "Version"
ShellSWI        #       1       ; 23 405C0
; "Shell"
wasIntellInterf16BitPIOSWI # 1  ; 24 40600
; ---
wasIntellInterf12BitADCSWI # 1  ; 25 40640
; ---
wasIntellInterfRS423SWI    # 1  ; 26 40680
; ---
HourglassSWI            # 1     ; 27 406C0 IJack
; "Hourglass"
DrawSWI                 # 1     ; 28 40700 DSeal
; "Draw"
ColourTransSWI          # 1     ; 29 40740 AThompson
; "ColourTrans"
RamFSSWI                # 1     ; 30 40780 NReeves
; "RamFS"
UnixFSSWI               # 1     ; 31 407C0 JSmith
; "UnixFS"
DigiTapeSWI             # 1     ; 32 40800
; "DigiTape"
PlutoSWI                # 1     ; 33 40840 Lendac Data Systems
; "Pluto"
VELGraphicsSWI          # 1     ; 34 40880 Video Electronics Ltd.
; "VELGraph"
BrainSoftSerParPodSWI   # 1     ; 35 408C0 BrainSoft
; "BrainSerPar"
JBComputingSCSISWI      # 1     ; 36 40900 John Ballance Computing
; "JBCSCSI"
DigitalServicesTapeSWI  # 1     ; 37 40940 Digital Services
; "DigiTape"
ScsiFsSWI               # 1     ; 38 40980 NReeves
; "SCSIFS"
SiPlanADCSWI            # 1     ; 39 409C0 Si-Plan Electronics Research
; "SiPlanADC"
SPRScanSWI              # 1     ; 40 40A00 Irlam Enterprise Ltd.
; "SPRScan"
DualUserPortSWI         # 1     ; 41 40A40 Science Frontiers
; "DualUserPort"
ArachnidSWI             # 1     ; 42 40A80 Paul Fray Limited
; "Arachnid"
WatfordScannerSWI       # 1     ; 43 40AC0 Mike Harrison
; "Scan"
PineappleColorDigitiser # 1     ; 44 40B00 Pineapple Software
; "Digitiser"
SmithBoysMultiFSSWI     # 1     ; 45 40B40 Jamie Smith
; "MultiFS"
ACModemDriverSWI        # 1     ; 46 40B80 Graham Bartram (BBC)
; "ACModem"
;

; "Here's the cockup ...
                        ^ &08600
II16BitPIOSWI           # 1     ; 536 48600 Intelligent Interfaces
; "II16BitPIO"
II12BitADCSWI           # 1     ; 537 48640 Intelligent Interfaces
; "II12BitADC"
IIRS423SWI              # 1     ; 538 48680 Intelligent Interfaces
; "IIRS423"

 ASSERT @ < 1 :SHL: 17

; Allocation of Application SWI chunks (&80000..&9FFFF) and their names

                        ^       0
MailSWI                 #       1       ; 0     80000
; ???
NetMonitorSWI           #       1       ; 1     80040
; "NetMonitor"
ComputerConceptsSWI     #       1       ; 2     80080
; ???
MinervaSystemDeltaSWI   #       1       ; 3     800C0
; ???
ResourceNH01SWI         #       1       ; 4     80100
; "VIP"
PrintSWI                #       1       ; 5     80140
; ???
EdinburghSWProductsSWI  #       1       ; 6     80180
; ???
ClaresSWI1              #       1       ; 7     801C0
; ???
ClaresSWI2              #       1       ; 8     80200
; ???
ClaresSWI3              #       1       ; 9     80240
; ???
ClaresSWI4              #       1       ; 10    80280
; ???
FrameGrabberSWI         #       1       ; 11    802C0 Watford (Mike Harrison)
; "Vdig"
MinervaRAMmanager       #       1       ; 12    80300
; ???
MinervaSystemGamma      #       1       ; 13    80340
; ???
MinervaSystemSigma      #       1       ; 14    80380
; ???
MinervaInternalUtils    #       1       ; 15    803C0
; ???
PCEmulationSWI          #       1       ; 16    80400
; ???
ROMCacheSWI             #       1       ; 17    80440
; "ROMCache"
SmallTalkSWI            #       1       ; 18    80480
; ???
MyoLinkSWI              #       1       ; 19    804C0 - L van Someren
; ???
SoundSamplerSWI         #       1       ; 20    80500 - DFell
; "Sampler"
FFTSWI                  #       1       ; 21    80540 - DFell
; ???
ResourceNH02SWI         #       1       ; 22    80580
; "VIPF"
FontAidPrintSWI         #       1       ; 23    805C0 - CJE Micros
; "FontAid"
AlliedInteractiveSWI    #       1       ; 24    80600
; "AIIV"
Euclid3DSWI             #       1       ; 25    80640 - Ace Computing
; "Euclid"
CSharedLibrarySWI       #       1       ; 26    80680 - PLG use
; "SharedLibrary"
Minerva256ColourHandlerSWI #    1       ; 27    806C0 - Minerva
; "Colours"
CCWordProcSWI           #       1       ; 28    80700 - Computer Concepts
; "CCWord"
CCDrawProgSWI           #       1       ; 29    80740 - Computer Concepts
; "CCDraw"
FinesseSWI              #       1       ; 30    80780 - AMS
; "Finesse"
SibeliusSWI             #       1       ; 31    807C0
; "Sibelius"
FaxPackSWI              #       1       ; 32    80800
; "FAXPack"
CEDSWI                  #       1       ; 33    80840 - Cambridge Elec. Design
; "CED"
ServoSWI                #       1       ; 34    80880 - Jansons
; "Servo"
TaskModuleSWI           #       1       ; 35    808C0
; "TaskModule" - just for message numbers really!
HindiWordProcSWI        #       1       ; 36    80900 - Southall ITEC
; "HindiWP"
AutoCueSWI              #       1       ; 37    80940 - Capricorn Consultants
; "AutoCue"
RealTimeGLSWI           #       1       ; 38    80980 - Silicon Vision Ltd.
; "RTGL"
CadsoftSWI1             #       1       ; 39    809C0 - Cadsoft
; "CAD"
CadsoftSWI2             #       1       ; 40    80A00 - Cadsoft
; "CAD"
ResourceNH03SWI         #       1       ; 41    80A40 - Resource
; "Playback"
WVAToDAndDToASWI        #       1       ; 42    80A80 - Wild Vision
; "WVAIO"
BNISWI                  #       1       ; 43    80AC0 - Burden Neurological Inst.
; "BNIProg"
BrainSoftUtilSWI        #       1       ; 44    80B00 - BrainSoft
; "BrainUtil"
WVFrameGrabberSWI       #       1       ; 45    80B40 - Wild Vision
; "WVFGRAB"
ABCSharedLibSWI         #       1       ; 46    80B80 - Paul Fellows
; "ABCLib"
BASICXAsmSWI            #       1       ; 47    80BC0 - Aardvark Software
; "AardXAsm"
BNI2SWI                 #       1       ; 48    80C00 - Burden Neurological Inst.
; "BNILab"
MinBinarySWI            #       1       ; 49    80C40 - Minerva
; "MinBinary"
MinAssemblerSWI         #       1       ; 50    80C80 - Minerva
; "MinAssembler"
BeebugISOCSWI           #       1       ; 51    80CC0 - Beebug's ISO C module
; "BeebugISOC"
ArchwaySWI              #       1       ; 52    80D00 - Simtron's Archway
; "Archway"
TeleTextSWI             #       1       ; 53    80D40 - Acorn's Teletext jobbie
; "Teletext"

 ASSERT @ < 1 :SHL: 17

; User SWI chunks ... don't go here obviously !

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Register names

r0      RN      0
r1      RN      1
r2      RN      2
r3      RN      3
r4      RN      4
r5      RN      5
r6      RN      6
r7      RN      7
r8      RN      8
r9      RN      9
r10     RN      10
r11     RN      11
r12     RN      12
r13     RN      13
r14     RN      14
r15     RN      15

r13_usr RN      13
r14_usr RN      14

r10_fiq RN      10
r11_fiq RN      11
r12_fiq RN      12
r13_fiq RN      13
r14_fiq RN      14

r13_irq RN      13
r14_irq RN      14

r13_svc RN      13
r14_svc RN      14

wp      RN      r12

sp      RN      r13
; No defined sp_usr or sp_fiq - application and FIQ owner dependent
sp_irq  RN      r13_irq
sp_svc  RN      r13_svc
stack   RN      r13

lr      RN      r14
lr_usr  RN      r14_usr
lr_fiq  RN      r14_fiq
lr_irq  RN      r14_irq
lr_svc  RN      r14_svc
link    RN      r14

pc      RN      r15
psr     RN      r15


R0      RN      0
R1      RN      1
R2      RN      2
R3      RN      3
R4      RN      4
R5      RN      5
R6      RN      6
R7      RN      7
R8      RN      8
R9      RN      9
R10     RN      10
R11     RN      11
R12     RN      12
R13     RN      13
R14     RN      14
R15     RN      15

WP      RN      12
SP      RN      13
STACK   RN      13
LR      RN      14
LINK    RN      14
PC      RN      15
PSR     RN      15

Error   RN      0
WsPtr   RN      12
Stack   RN      13

; Supervisor state registers - taken from Brazil -.005 source

SPSVC   RN      13
TUBER   RN      12
SVCWK0  RN      11
SVCWK1  RN      10

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; 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 to the SWI numbers
BGetV   * &0A   ;   |
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 MOS 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

SpareVectorC * &24
SpareVectorB * &25
SpareVectorA * &26
SpareVector9 * &27
SpareVector8 * &28
SpareVector7 * &29
SpareVector6 * &2A
SpareVector5 * &2B
SpareVector4 * &2C
SpareVector3 * &2D
SpareVector2 * &2E
SpareVector1 * &2F

NVECTORS * &30 ; There are this many vectors, 0..NVECTORS-1

; Aliases for vectors - please avoid using them

OpenV   * FindV
GbPbV   * GBPBV

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ARM processor related things

N_bit   *       1 :SHL: 31              ; Processor condition flags
Z_bit   *       1 :SHL: 30
C_bit   *       1 :SHL: 29
V_bit   *       1 :SHL: 28
I_bit   *       1 :SHL: 27
F_bit   *       1 :SHL: 26

USR_mode *      2_00                    ; Processor mode bits
FIQ_mode *      2_01
IRQ_mode *      2_10
SVC_mode *      2_11

ARM_CC_Mask *   &FC000003               ; Processor condition flags + mode bits

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Useful places to hit in A500

PhysRam *       &02000000

IOC     *       &03200000
VIDC    *       &03400000
LAG     *       &03600000
CAM     *       &03800000

FloppyController    * &03310000 ; Fast, Bank 1
EconetController    * &033A0000 ; Sync, Bank 2
SerialController    * &033B0000 ; Sync, Bank 3
PrinterData         * &03350010 ; Fast, Bank 5
LatchB              * &03350018 ; Fast, Bank 5
LatchA              * &03600000 ; Fast, Bank 6

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; IOC register offsets

IOCControl * &00        ; Control register

IOCSERTX   * &04        ; Serial TX
IOCSERRX   * &04        ;        RX

IOCIRQSTAA * &10        ; IRQ A Status
IOCIRQREQA * &14        ;       Requesting
IOCIRQCLRA * &14        ;       Clear
IOCIRQMSKA * &18        ;       Mask

IOCIRQSTAB * &20        ; IRQ B Status
IOCIRQREQB * &24        ;       Requesting
IOCIRQCLRB * &24        ;       Clear
IOCIRQMSKB * &28        ;       Mask

IOCFIQSTA  * &30        ; FIQ   Status
IOCFIQREQ  * &34        ;       Requesting
IOCFIQMSK  * &38        ;       Mask

Timer0LL   * &40        ; Timer 0 Write low input latch
Timer0LH   * &44        ;         Write high input latch
Timer0GO   * &48        ;         Load count from input latch
Timer0CL   * &40        ;         Read low output latch
Timer0CH   * &44        ;         Read high output latch
Timer0LR   * &4C        ;         Load output latch from count

Timer1LL   * &50        ; Timer 1 Write low input latch
Timer1LH   * &54        ;         Write high input latch
Timer1GO   * &58        ;         Load count from input latch
Timer1CL   * &50        ;         Read low output latch
Timer1CH   * &54        ;         Read high output latch
Timer1LR   * &5C        ;         Load output latch from count

Timer2LL   * &60        ; Timer 2 Write low input latch
Timer2LH   * &64        ;         Write high input latch
Timer2GO   * &68        ;         Load count from input latch
Timer2CL   * &60        ;         Read low output latch
Timer2CH   * &64        ;         Read high output latch
Timer2LR   * &6C        ;         Load output latch from count

Timer3LL   * &70        ; Timer 3 Write low input latch
Timer3LH   * &74        ;         Write high input latch
Timer3GO   * &78        ;         Load count from input latch
Timer3CL   * &70        ;         Read low output latch
Timer3CH   * &74        ;         Read high output latch
Timer3LR   * &7C        ;         Load output latch from count


; Control register bits (A500 specific)

vsync_state_bit  * 1 :SHL: 7    ; ReadOnly
pack_state_bit   * 1 :SHL: 6    ; ReadOnly
sound_mute_bit   * 1 :SHL: 5    ; Read/Write
disc_changed_bit * 1 :SHL: 4    ; ???
rtc_seconds_bit  * 1 :SHL: 3    ; ReadOnly - not on A1
rtc_minutes_bit  * 1 :SHL: 2    ; ReadOnly - not on A1
i2c_clock_bit    * 1 :SHL: 1    ; Read/Write
i2c_data_bit     * 1 :SHL: 0    ; Read/Write

; IRQ register A bits (A500 specific)

force_bit  * 1 :SHL: 7  ; Force Interrupt       (FIQ owned)
timer1_bit * 1 :SHL: 6  ; Timer 1 crossing zero (event)
timer0_bit * 1 :SHL: 5  ; Timer 0 crossing zero (event)
por_bit    * 1 :SHL: 4  ; Power on RESET flag   (event)
vsync_bit  * 1 :SHL: 3  ; VFLYBK starting       (event)  IR
pack_bit   * 1 :SHL: 2  ; Printer acknowlege    (event) ~IF
ring_bit   * 1 :SHL: 1  ; Ringing indication    (level)
pbusy_bit  * 1 :SHL: 0  ; Printer busy          (level)


; IRQ register B bits (A500 specific)

serial_Rx_bit   * 1 :SHL: 7  ; Keyboard recieve full
serial_Tx_bit   * 1 :SHL: 6  ; Keyboard transmit empty
podule_IRQ_bit  * 1 :SHL: 5  ; Podule IRQ request
winnie_DRQ_bit  * 1 :SHL: 4  ; Winchester data request
winnie_IRQ_bit  * 1 :SHL: 3  ; Winchester IRQ request
serial_bit      * 1 :SHL: 2  ; 6551 IRQ request
sound_IRQ_bit   * 1 :SHL: 1  ; Sound buffer reload request
podule_FIQ_as_IRQ_bit * 1 :SHL: 0 ; Podule FIQ causing IRQ


; FIQ register bits (A500 specific)

podule_FIQ_bit  * 1 :SHL: 6  ; Podule FIQ request


; Bits in LatchB register

pstrobe_bit     * 1 :SHL: 4  ; Printer strobe

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; 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

; 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_PCEmulator        * 13    ; reserved for MS-NET by TMD 26/8/87
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

; 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

MainVars * &A6

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

MosVer   * 6            ; nice non-zero value

        GBLS MosTitle
MosTitle SETS "Tim's Arthur Operating System 0.00"
; If assembling arthur, there are better strings to use!!

NIL     * &80000000 ; An interesting value


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

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; And a handy variable or three

        GBLL    True
True    SETL    {TRUE}

        GBLL    False
False   SETL    {FALSE}

                 GBLL AssemblingArthur
AssemblingArthur SETL False

        OPT     OldOpt
        END
