        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!

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; 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 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
; ???
DebuggerSWI     #       1       ; 14 40380
; "Debugger"
SCSIDriverSWI   #       1       ; 15 403C0
; 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"
IntellInterf16BitPIOSWI # 1     ; 24 40600
; "II16BitPIO"
IntellInterf12BitADCSWI # 1     ; 25 40640
; "II12BitADC"
IntellInterfRS423SWI    # 1     ; 26 40680
; "IIRS423"
HourglassSWI            # 1     ; 27 406C0
; "Hourglass"
DrawSWI                 # 1     ; 28 40700
; "Draw"
ColourTransSWI          # 1     ; 29 40740
; "ColourTrans"
RamFSSWI                # 1     ; 30 40780
; "RamFS"
UnixFSSWI               # 1     ; 31 407C0
; "UnixFS"
DigiTapeSWI             # 1     ; 32 40800
; "DigiTape"

; Allocation of Application SWI Chunks 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
; ???
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"
SharedLibrarySWI        #       1       ; 26    80680 - PLG use
; "SharedLibrary"
Minerva256ColourHandlerSWI #    1       ; 27    806C0 - Minerva
; "Colours"
CConceptsWordProcSWI    #       1       ; 28    80700
; "CCWord"
CConceptsDrawProgSWI    #       1       ; 29    80740
; "CCDraw"
AMSFinesseSWI           #       1       ; 30    80780
; "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"
WildVision01SWI         #       1       ; 42    80A80 - Wild Vision
; ???

; 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

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; CMOS RAM allocation

ReadCMOS        * &A1   ; The OS_Byte call to read CMOS
WriteCMOS       * &A2   ; The OS_Byte call to write CMOS

NetStnCMOS      * &00   ; One byte
NetFSIDCMOS     * &01   ; Two bytes
NetPSIDCMOS     * &03   ; Two bytes
FileLangCMOS    * &05   ; One byte
FrugalCMOS      * &06   ; Two bytes
EDITCMOS        * &08   ; One byte
TelcomCMOS      * &09   ; One byte
MODETVCMOS      * &0A   ; One byte
StartCMOS       * &0B   ; One byte
KeyDelCMOS      * &0C   ; One byte
KeyRepCMOS      * &0D   ; One byte
PigCMOS         * &0E   ; One byte
PSITCMOS        * &0F   ; One byte
DBTBCMOS        * &10   ; One byte
ANFSCMOS        * &11   ; One byte

UserCMOS        * &1E   ; Sixteen bytes for the user

FreeCMOS        * &2E   ; Third Party Software houses
                ^ FreeCMOS
AshdownCMOS     # 1     ; &2E     one byte for Ashdown software Ltd.
TermulatorCMOS  # 3     ; &2F-&31 three bytes for termulator
AlliedInterCMOS # 2     ; &32-&33 two bytes for Allied Interactive Ltd.

 [ @ > &50
 ! 1,"Third party CMOS allocation overflowed"
 ]

                 ^ &50
UnixCMOS         # 32   ; See MTaunton for allocation details

                 ^ &70  ; &70-&EF now being allocated ... sign here!
PoduleCMOS       # 4*4  ; &70 Four bytes to each of four podules
YearCMOS         # 2    ; &80 Two bytes of year info (HEX)
MonthCMOS        # 1    ; &82 The last month we were in (HEX)
LeapCMOS         # 1    ; &83 we've-had-the-29th-of-feb-this-year-already flag
TutuCMOS         # 1    ; &84 For nefarious porpoises
VduCMOS          # 1    ; &85
SyncBit * 1             ; Composite sync or not
ModeExtraBit * 2
MonitorTypeBits * &3C   ; 4 bits - 0 => normal; 1 => multisync; 2 => hires mono
MonitorTypeShift * 2
MonitorType0 * &00
MonitorType1 * &04
MonitorType2 * &08
MonitorType3 * &0C
MonitorType4 * &10
MonitorType5 * &14
MonitorType6 * &18
MonitorType7 * &1C
MonitorType8 * &20
MonitorType9 * &24
MonitorTypeA * &28
MonitorTypeB * &2C
MonitorTypeC * &30
MonitorTypeD * &34
MonitorTypeE * &38
MonitorTypeF * &3C

FontCMOS         # 1    ; &86
NewADFSCMOS      # 3    ; &87 Three bytes (consult Nick)
CatalogCMOS      # 2    ; &8A
ExamineCMOS      # 2    ; &8C
TwinCMOS         # 1    ; &8E
ScreenSizeCMOS   # 1    ; &8F
RAMDiscCMOS      # 1    ; &90
SysHeapCMOS      # 1    ; &91
RMASizeCMOS      # 1    ; &92
SpriteSizeCMOS   # 1    ; &93
SoundCMOS        # 1    ; &94
ABE              # 4    ; &95 4 Bytes for the BASIC Editor.
PSNameCMOS       # 5    ; &99 5 bytes for 6 char name, one byte in NetPSId + 1
FSNameCMOS       # 15   ; &9E 15 bytes for 16 char name, 1 byte in NetFSId + 1
MosROMFrugalCMOS # 4    ; &AD 32 bits for 32 modules in the system ROM
PoduleFrugalCMOS # 4    ; &B1 4 * 8 bits for modules in podules
WildCardCMOS     # 4    ; &B5 4 bytes of configured wildcard spec.
LanguageCMOS     # 1    ; &B9 1 byte configured language
CountryCMOS      # 1    ; &BA Configured country
VFSCMOS          # 1    ; &BB
Misc1CMOS        # 1    ; &BC Bottom 2 bits are ROMFS Opt4 state.
WinniSizeCMOS    # 4    ; &BD
ProtectionCMOS   # 1    ; &C1 ; Protection state
 ; Bit 0 => &81 Peek
 ; Bit 1 => &82 Poke
 ; Bit 2 => &83 JSR
 ; Bit 3 => &84 User RPC
 ; Bit 4 => &85 OS RPC
 ; Bit 5 => &86 Halt
 ; Note the two missing operations are not able to be protected against
 ; Bit 6 => &89 GetRegs
 ; Bit 7 => &8A ???
MouseStepCMOS   # 1     ; &C2 ; Mouse multiplier, signed 8 bit value
                        ; (but both 0 and 1 mean 1)
SystemSpeedCMOS # 1     ; &C3 ; Various bits for RAM/ROM speed etc
 ; Subject to review...
 ; Bits 0-3  RAM speed (0=>8MHz, 1=>10, 2=>12, 3=>14, 4=>16, others undefined,
 ;            assumed to be 8 for now)
 ; Bit  4    ROM speed (0=>200ns, 1=>200/60ns)
 ; Bit  5    Cache enable for ARM3 (0=>disable, 1=>enable)
 ; Bits 6-7  Reserved

WimpModeCMOS    # 1     ; &C4 ; initial Wimp mode on entry
WimpFlagsCMOS   # 1     ; &C5 ; global Wimp flags (for dragging etc.)
DesktopCMOS     # 1     ; &C6 ; some state for Desktop Utils
 ; Bits 0,1 = display mode (Filer)
 ;       00 = large icons
 ;       01 = small icons
 ;       10 = full info
 ;       11 = Reserved
 ; Bits 2,3 = sorting mode (Filer)
 ;       00 = sort by name
 ;       01 = sort by type
 ;       10 = sort by size
 ;       11 = sort by date
 ; Bit  4   = sorting mode (NetFiler)
 ;        0 = sort by name
 ;        1 = sort by number
 ; Bit  5   = confirm option (Filer)
 ;        0 = no confirm
 ;        1 = confirm
 ; Bit  6   = verbose option (Filer)
 ;        0 = no verbose
 ;        1 = verbose
 ; Bit 7 Reserved
ADFSDirCacheCMOS        # 1     ; &C7 0=>default
CopyOptionsCMOS         # 2     ; &C8,&C9
WipeOptionsCMOS         # 2     ; &CA,&CB
CountOptionsCMOS        # 2     ; &CC,&CD

 ASSERT @ <= &E0
UnixBootCMOS    * &E0 ; Fifteen bytes for Unix Boot CMOS (see JSmith)

 ASSERT @ <= &EF
CheckSumCMOS    * &EF ; One byte for CMOS RAM checksum

; Note that CMOS RAM ends at F0 where the clock starts

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

; 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
