; Copyright 1996 Acorn Computers 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.
;
        SUBT    > &.Hdr.VickySpace

OldOpt  SETA    {OPT}
        OPT     OptNoList+OptNoP1List

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

; Date       Name  Description
; ----       ----  -----------
; 02-Nov-87  APT   Added module SWI hash table
; 03-Nov-87  APT   Modo-fied module SWI hash table info, removed BRKLST
; 09-Nov-87  APT   Removed ESCCNT and ESFLG
; 12-Nov-87  APT   Added IRQsema
; 13-Nov-87  APT   Added DefaultIRQ1V codespace
; 16-Nov-87  APT   PIRQ chain heads
; 18-Nov-87  APT   Reordered EvtHan, EvtHan_ws
; 19-Nov-87  APT   Moved IRQsema
; 01-Dec-87  APT   Added interruptible heap manager workspace
; 08-Dec-87  TMD   Added ECFShift, ECFYOffset
; 14-Dec-87  TMD   Added DisplayNColour, DisplayModeFlags
; 15-Dec-87  TMD   Added KeyAlphabet
; 22-Dec-87  NDR   Using ScratchSpace
; 13-Jan-88  APT   General scratchspace bash, low workspace reordering.
;                  Removed spurious 32 bytes of osbyte wspace
; 14-Jan-88  APT   *type buffer in scratchspace.
;                  MOShasFIQ byte added
; 20-Jan-88  APT   Workspace juggling for speed & space; also discarded
;                  Level0 stuff.
; 28-Jan-88  APT   MetroGnome moved to "public" location for ADFS
; 02-Feb-88  APT   FIQclaim_interlock added
; 05-Feb-88  APT   CallBack_Vector
; 09-Feb-88  APT   RAM for SWI despatch
; 17-Feb-88  TMD   Added VduSaveArea, VduSaveAreaPtr, DisplayModeNo
; 26-Feb-88  APT   NoOfCamEntries manifest
; 03-Mar-88  APT   Shrank SVC despatch
; 03-Mar-88  APT   NoOfCamEntries manifest doubled
; 07-Mar-88  TMD   Added DisplayScreenStart, VduOutputCurrentState,
;                  SpriteMaskSelect, reordered mode variables
; 07-Mar-88  APT   Made CamEntries always at &164
; 07-Mar-88  TMD   Added GCharSizes, GCharSizeX, GCharSizeY
; 08-Mar-88  TMD   Added GCharSpacing, GCharSpaceX, GCharSpaceY
; 08-Mar-88  TMD   Moved GCharSizes..GCharSpaceY into first 1K of workspace
; 15-Mar-88  TMD   Added HLineAddr
; 18-Mar-88  TMD   Added DisplayXWindLimit, DisplayYWindLimit,
;                   DisplayXEigFactor, DisplayYEigFactor, PointerXEigFactor
; 18-Mar-88  APT   Setting variables scratchspace use revised.
; 21-Mar-88  TMD   Removed CursorIndex
; 22-Mar-88  TMD   Added TCharSizeX,TCharSizeY,TCharSpaceX,TCharSpaceY
; 29-Mar-88  TMD   Added GcolOraEorAddr
; 31-Mar-88  TMD   Removed WsFontPtr
; 07-Apr-88  SKS   Added HeapSort use of ScratchSpace
; 14-Apr-88  TMD   Added SerialFlags
; 28-Apr-88  TMD   Added XONXOFFChar
;  5-May-88  APT   Added MemorySpeed
; 18-May-88  APT   Added CannotReset sema at &107, removed pre-1.20 changes.
; 24-May-88  TMD   Added ClipBoxEnable, ClipBoxLCol..ClipBoxTRow, moved in
;                   ScrLoaSpriteCB, ScrLoaBuffer, SrcSavCommon
; 24-May-88  TMD   Flood fill uses ScratchSpace
; 01-Jun-88  TMD   Added AlignSpace for ClipBoxCoords
; 03-Jun-88  BCSKS Make Keyboard buffer into a useful part of the system
;                  Also PrinterBufferSize
; 09-Jun-88  DJS   Draw uses ScratchSpace
; 09-Jun-88  BC    Gave Econet some private debungling space
; 11-Jun-88  SKS   Align IRQ stack to make STMFD not cross two MEMC bdy's
;                  Made info condit'l on AsmArf; someone had commented it out!
; 15-Jun-88  SKS   Added two more instructions in SWIDespatch area
;                  Moved SLVK definition into kernel; it's not public
; 16-Jun-88  SKS   Added 3 more instructions in SWIDespatch area + nailed
;                  SvcTable address for compatibility
; 22-Jun-88  SKS   Moved MEMC_CR_SoftCopy into pubic ws
; 19-Jul-88  APT   Added UpCall handler stuff
; 20-Jul-88  SKS   Added above entry
;                  Amended comment about overlaid workspace in vdu
; 15-Aug-88  SKS   Inserted DomainId at FF8 (set by Wimp on task swap, used by
;                  FileSwitch to tag resources)
; 27-Sep-89  JSR   Added ColourTrans to users of scratch space
; 24-Oct-89  TMD   Added CamEntriesForBigMachines, CamEntriesPointer
; 26-Oct-89  TMD   Added MaxCamEntry, removed NoOfCamEntries symbol
; 27-Oct-89  TMD   Added VIDCClockSpeed
; 09-Nov-89  TMD   Added ResetIndirection
; 15-Jan-91  TMD   Added ROMModuleChain
; 04-Feb-91  DDV   Added DeviceFS as user of ScratchSpace.
; 04-Feb-91  DDV   Added ColourTrans use of ScratchSpace to build diff tables.
; 06-Mar-91  TMD   Added IOSystemType
; 07-Mar-91  LVR   ADFS uses scratch space for floppy formatting
; 07-Mar-91  TMD   Added MonitorLeadType
; 08-Mar-91  TMD   Added PrinterBufferAddr, PrinterBufferSize
; 11-Apr-91  TMD   Added SerialInHandle, SerialOutHandle
; 24-Apr-91  TMD   Added UniqueMachineID
; 09-Jun-91  RM    Added KernelMessagesBlock,ErrorSemaphore and MOSConvertBuffer
; 26-Jul-91  JSR   Extend GeneralMOSBuffer by 4 bytes to make it a valid
;                       length for the default error handler's error buffer
; 19-Aug-91  JSR   Added *If to list of GeneralMOSBuffer users
; 22-Aug-91  TMD   Reduced ErrorSemaphore to a byte, added PortableFlag
; 25-Aug-91  DDV   Updated to indicate correct usage of scratch space by ColourTrans
; 09-Jan-92  DDV   Added FgPattern, BgPattern and indicate use of ScratchSpace by OS_SetColour
; 20-Jan-92  TMD   OS_SetColour no longer uses ScratchSpace
; 17-Feb-92  ECN   Added CLibWord and RISCOSLibWord
; 02-Apr-92  TMD   Added ScreenBlankFlag
; 27-Jul-92  TMD   Create Victoria specific version
; 28-Jul-92  TMD   Moved RAMDiscAddress
; 29-Jul-92  TMD   Moved SpriteSpaceAddress
; 30-Jul-92  TMD   Moved FontCacheAddress
; 31-Jul-92  TMD   Moved ScreenEndAdr from source.vdudecl, and moved actual address!
; 03-Aug-92  TMD   Added PhysRam (moved from hdr:System)
; 24-Aug-92  TMD   Added AbortIndirection
; 26-Aug-92  TMD   Added PreVeneerRegDump
; 02-Sep-92  TMD   Added FirPalAddr, SecPalAddr
; 10-Sep-92  DDV   Added new Vdu Variables for new text expansion buffer
; 17-Sep-92  DDV   Moved NColour into the word initialised VDU workspace
; 17-Sep-92  DDV   Two new colour words added for text foreground and background.
; 27-Jan-93  TMD   Moved RMA to new position
; 29-Jan-93  TMD   Put RMA back to old position (you can't branch to above 32M!)
; 01-Feb-93  TMD   Added PhysRamTable
; 02-Feb-93  TMD   Added VInitSoftCopy and VEndSoftCopy
; 03-Feb-93  TMD   Added PhysRamTableEnd
; 04-Feb-93  TMD   Added extra slot in PhysRamTable (in case soft-loaded OS splits a bank)
; 08-Feb-93  TMD   Added VRAMWidth variable, and extra symbols for skipped bits
; 24-Feb-93  TMD   Changed VRAMPhysAddr to VideoPhysAddr, and split off VideoSize from VRAMSize, to allow for
;                   DRAM-only systems
; 05-Mar-93  TMD   Added CMOSRAMCache
; 19-Apr-93  TMD   Added DAList, AppSpaceDANode and DANode offset symbols
; 26-Apr-93  TMD   Added FreePoolAddress, FreePoolMaxSize, FreePoolSize
; 29-Apr-93  TMD   Changed FontCacheAddress, SpriteSpaceAddress, RAMDiscAddress and FreePoolAddress
;                   in order to make way for L2PT, which is moving above 64M
; 10-May-93  TMD   Added SoftCamMapSize
; 11-May-93  TMD   Moved SoftCamMapSize into area that's not zapped in clearing all memory routine
; 12-May-93  TMD   Added FreePoolDANode, removed FreePoolSize
; 20-May-93  TMD   Moved AplWorkSize into AppSpaceDANode
; 27-May-93  TMD   Added VideoBandwidth
; 04-Jun-93  TMD   Added CurrentMonitorType
; 09-Jun-93  TMD   Added CamMapCorruptDebugBlock
; 07-Jul-93  TMD   Increased FreePoolMaxSize to 64M (had to reduce RAMDiscMaxSize to 48M and
;                   move FreePoolAddress down to do this)
; 15-Jul-93  TMD   Added KernelModeSelector
; 26-Jul-93  SMC   Moved DefaultIRQ1V (had to accommodate IRQs for IOMD DMA)
; 04-Aug-93  TMD   Added L2PTSize, removed FreePoolMaxSize
; 14-Aug-93  TMD   Removed SpriteSpaceAddress, shuffled things down
; 16-Aug-93  TMD   Removed RAMDiscAddress, shuffled things down
; 17-Aug-93  TMD   Removed FontCacheAddress, shuffled things down
;                  Corrected maximum size of system heap to 2M-8K.
;                  Added node (in bottom 32K) for system heap.
; 25-Aug-93  SMC   Added processor vector table at ProcVec_Start
;                  Added ProcVecPreVeneers
; 02-Sep-93  SMC   Moved RMA to &02100000 and changed application space size to 28M.
; 03-Sep-93  TMD   Moved InitKbdWs into SkippedTables (was at start of screen originally)
; 07-Oct-93  TMD   Put in OldMemoryMap option so I can still use it
; 07-Oct-93  TMD   Added ScreenBlankDPMSState, HSWRSoftCopy, VSWRSoftCopy
; 10-Dec-93  BC    Added RawMachineID
; 13-Dec-93  BC    Removed UniqueMachineID
; 14-Jan-94  TMD   Added CDASemaphore
; 18-Jan-94  TMD   Added MMUControlSoftCopy
;
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Memory map:

; Dynamic area node format

                ^       0

DANode_Link     #       4               ; points to next node
DANode_Number   #       4               ; number of this area
DANode_Base     #       4               ; base address of area (points in middle of doubly-mapped areas)
DANode_Flags    #       4               ; various flags
DANode_Size     #       4               ; current size of area
DANode_MaxSize  #       4               ; maximum size of area
DANode_Workspace #      4               ; workspace pointer when calling handlers
DANode_Handler  #       4               ; pointer to handler routine for area
DANode_Title    #       4               ; pointer to area title (variable length)
DANode_NodeSize #       0

; The addresses below are only temporary; eventually most of them will be allocated at run time (we hope!)

 [ :DEF: OldMemoryMap
AplWorkMaxSize      * &01000000 ; 16M
RMAAddress          * &01800000
RMAMaxSize          * &00400000 ; 4M
 |
AplWorkMaxSize      * &01C00000 ; 28M
RMAAddress          * &02100000
RMAMaxSize          * &00B00000 ; 11M
 ]

SysHeapChunkAddress * &01C00000
SysHeapMaxSize      * &00200000-8*1024 ; 2M - 8K

CursorChunkAddress  * &01F00000 ; Fixed size 32K

ScreenEndAdr        * &05000000 ; was &02000000
ScreenMaxSize       * 480*1024

; FontCacheAddress    * &06000000 ; was &01E00000       ; now dynamic
; FontCacheMaxSize    * &01000000 ; 16M

; SpriteSpaceAddress  * &08000000 ; was &01400000       ; now dynamic
; SpriteSpaceMaxSize  * &01000000 ; 16M

; RAMDiscAddress      * &07000000 ; was &01000000       ; now dynamic
; RAMDiscMaxSize      * &03000000 ; 48M

FreePoolAddress     * &06000000 ; may still go lower!

PhysRam         *     &05000000

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; system variables

        ^  0,R12

OSBYTEFirstVar  #  0

ByteVars  #  0                 ; The main osbyte variables, accessed
                               ; via calls &A6 to &FF

VarStart  #  2                 ; &A6,&A7
ROMPtr    #  2                 ; &A8,&A9
ROMInfo   #  2                 ; &AA,&AB
KBTran    #  2                 ; &AC,&AD
VDUvars   #  2                 ; &AE,&AF

CFStime   #  1                 ; &B0
InputStream #  1               ; &B1
KeyBdSema #  1                 ; &B2

ROMPollSema #  1               ; &B3
OSHWM     #  1                 ; &B4

RS423mode #  1                 ; &B5
NoIgnore  #  1                 ; &B6
CFSRFS    #  1                 ; &B7
VULAcopy  #  2                 ; &B8,&B9

ROMatBRK  #  1                 ; &BA
BASICROM  #  1                 ; &BB

ADCchanel #  1                 ; &BC
ADCmaxchn #  1                 ; &BD
ADCconv   #  1                 ; &BE

RS423use     #  1              ; &BF
RS423conflag #  1              ; &C0

FlashCount # 1                 ; &C1
SpacPeriod # 1                 ; &C2
MarkPeriod # 1                 ; &C3

KeyRepDelay # 1                ; &C4
KeyRepRate  # 1                ; &C5

ExecFileH   # 1                ; &C6
SpoolFileH  # 1                ; &C7

ESCBREAK    # 1                ; &C8 (200)

KeyBdDisable # 1               ; &C9
KeyBdStatus  # 1               ; &CA

RS423HandShake # 1             ; &CB
RS423InputSupr # 1             ; &CC
RS423CFSFlag   # 1             ; &CD

EconetOScall # 1               ; &CE
EconetOSrdch # 1               ; &CF
EconetOSwrch # 1               ; &D0

SpeechSupr # 1                 ; &D1
SoundSupr # 1                  ; &D2

BELLchannel # 1                ; &D3
BELLinfo    # 1                ; &D4
BELLfreq    # 1                ; &D5
BELLdur     # 1                ; &D6

StartMessSupr # 1              ; &D7

SoftKeyLen # 1                 ; &D8

PageModeLineCount # 1          ; &D9

VDUqueueItems # 1              ; &DA

TABch # 1                      ; &DB
ESCch # 1                      ; &DC

IPbufferCh # 4                 ; &DD,&DE,&DF,&E0
RedKeyCh   # 4                 ; &E1,&E2,&E3,&E4

ESCaction  # 1                 ; &E5
ESCeffect  # 1                 ; &E6

u6522IRQ # 1                   ; &E7
s6850IRQ # 1                   ; &E8
s6522IRQ # 1                   ; &E9

TubeFlag # 1                   ; &EA

SpeechFlag # 1                 ; &EB

WrchDest # 1                   ; &EC
CurEdit  # 1                   ; &ED

SoftResetVars # 0              ; Reset to here on soft reset

KeyBase # 1                    ; &EE
Shadow # 1                     ; &EF
Country # 1                    ; &F0

UserFlag # 1                   ; &F1

SerULAreg # 1                  ; &F2

TimerState # 1                 ; &F3

SoftKeyConsist # 1             ; &F4

PrinterDrivType   # 1          ; &F5
PrinterIgnore     # 1          ; &F6

HardResetVars # 0              ; Reset to here on hard reset

BREAKvector # 3                ; &F7,&F8,&F9

MemDriver  # 1                 ; &FA - where the VDU drivers write to
MemDisplay # 1                 ; &FB - where we display from

LangROM # 1                    ; &FC

LastBREAK # 1                  ; &FD

KeyOpt # 1                     ; &FE

StartOptions # 1               ; &FF

PowerOnResetVars # 0           ; Reset to here on power-on reset

; These two can dovetail in here to use up 2 bytes before the AlignSpace!

SerialInHandle # 1              ; Handle for serial input stream  (0 if not open currently)
SerialOutHandle # 1             ; Handle for serial output stream (-----------""----------)

        AlignSpace

EventSemaphores # 32            ; One byte for each of 32 events

TimerAlpha # 8                  ; As used by time (bottom 5 bytes)
TimerBeta  # 8                  ; ................................
; both aligned to word boundaries

RealTime # 8                    ; 5-byte fast real-time

PrinterActive # 4               ; Handle/active flag for printer (word aligned)

IntervalTimer # 5               ; Up Counter synchronous with TIME.
; Event generated when Zero is reached
; bottom byte aligned to word boundary

SecondsTime # 1 ; the soft copy (centi-)seconds of the RTC
CentiTime   # 1 ; """"""""""""""""""""""""""""""""""""""""

FlashState # 1 ; which flash colours are we using

SecondsDirty # 1                ; the dirty flag for start up!

MinTick # 1                     ; the minutes odd/even state

DCDDSRCopy # 1                  ; copy of ACIA bits to check for change

TVVertical # 1                  ; *TV first parameter

TVInterlace # 1                 ; *TV second parameter

CentiCounter # 1                ; Counter for VDU CTRL timing

Alphabet # 1                    ; Current alphabet number

Keyboard # 1                    ; Current keyboard number

KeyAlphabet # 1                 ; Alphabet associated with current keyboard

                GBLS    PrinterPrefix
PrinterPrefix   SETS    "PrinterType$"

PrinterTypeName #       6 + :LEN: (PrinterPrefix)

        AlignSpace

SerialFlags # 4                 ; New serial flags

XONXOFFChar # 1                 ; Character to send before rest (0 if none)

        AlignSpace

OSBYTEVarSize * @-OSBYTEFirstVar

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

; End of variables' space


; ***********************************
; ***  Main Vdu Driver Workspace  ***
; ***********************************

        ^ 0

FgEcf  # 4 * 8  ; Foreground Ecf, set by GCOL(a,0-127)
BgEcf  # 4 * 8  ; Background Ecf, set by GCOL(a,128-255)
GPLFMD # 4      ; Foreground action, set by GCOL(a,0-127)
GPLBMD # 4      ; Background action, set by GCOL(a,128-255)
GFCOL  # 4      ; Foreground colour, set by GCOL(a,0-127)
GBCOL  # 4      ; Background colour, set by GCOL(a,128-255)

GWLCol # 4      ; Graphics window left column  --
GWBRow # 4      ; Graphics window bottom row     |
GWRCol # 4      ; Graphics window right column   |
GWTRow # 4      ; Graphics window top row      --

qqqPad   # 3
QQ       # 17   ;Queue - QQ+1 is on a word boundary
QOffset  # 4    ;Value to add to VDUqueueItems to point to next queue posn.
JVec     # 4    ;Jump vector to internal routines

; Start of MODE table workspace

ScreenSize # 4  ; number of bytes needed for this mode (assumed 1st in list)

XWindLimit # 4  ; Maximum value of GWRCol (internal representation)

; LineLength must be immediately after YWindLimit

YWindLimit # 4  ; Maximum value of GWTRow (internal representation)

LineLength # 4  ; Length of one pixel row in bytes

NColour # 4     ; Number of colours minus 1

; End of word mode variables

YShftFactor # 4 ; Number of places to shift YCoord in address generation after
                ; multiplying by 5, holds
                ; 7,6,5 or 4 for 8,4,2 or 1 bits per pixel (640x256 mode) or
                ; 6,5,4 or 3 for 8,4,2 or 1 bits per pixel (320x256 mode).

ModeFlags # 4   ; Bit 0 => non-graphic, Bit 1 => teletext, Bit 2 => gap mode

XEigFactor # 4  ; Number of places to shift XCoord in external to internal
                ; coordinate conversion, holds
                ; 1 for 640x256 mode
                ; 2 for 320x256 mode
                ; 3 for 160x256 (BBC micro mode 2)

YEigFactor # 4  ; number of shifts to convert between internal/external Y

Log2BPC # 4     ; Log to base 2 of BytesPerChar ie (0,1,2,3,4)

Log2BPP # 4     ; Log to base 2 of BitsPerPix ie (0,1,2,3)

ECFIndex # 4    ; Index into default ECF tables

ScrRCol # 4     ; Maximum column number in this screen mode
ScrBRow # 4     ; Maximum row number in this screen mode

PalIndex # 4    ; Index into palette tables (0,1,2,3)

; End of table-initialised workspace

; Next 3 must be together in this order !

XShftFactor # 4 ; Number of places to shift XCoord in address generation,
                ; holds 2,3,4 or 5 for 8,4,2,1 bits per pixel respectivly
GColAdr # 4     ; Address of Ecf to plot - either FgEcf or BgEcf

ScreenStart # 4         ; Start address of screen (for VDU drivers)

NPix # 4        ; Number of pixels per word minus 1, holds
                ; holds 3,7,15 or 31 for 8,4,2,1 bits per pixel modes

AspectRatio # 4 ; Pixel shape : 0 square, 1 horz rect, 2 vert rect

BitsPerPix # 4  ; Bits per pixel (1,2,4,8)

BytesPerChar # 4        ; Bytes per one line of character
                        ; (same as BitsPerPix except in double pixel modes)

CursorFudgeFactor # 4   ; Factor for horizontal cursor positioning

RowMult # 4     ; Row multiplier for text manipulation

RowLength # 4   ; Bytes per text row in this mode (eg 640,1280,5120)

; The following (up to and including NewPtY) must be together in this order
; (relied upon by DefaultWindows)

TWLCol # 4      ; Text window left column  --
TWBRow # 4      ; Text window bottom row     |
TWRCol # 4      ; Text window right column   |
TWTRow # 4      ; Text window top row      --

OrgX # 4        ; Screen origin (external representation)
OrgY # 4

GCsX # 4        ; Graphics cursor (external representation)
GCsY # 4

OlderCsX # 4    ; Very old X coordinate (internal)
OlderCsY # 4    ; Very old Y coordinate (internal)

OldCsX # 4      ; Old graphics cursor (internal representation) --
OldCsY # 4      ;                                                 |
                ;                                                 |
GCsIX  # 4      ; Graphics cursor (internal representation)       |
GCsIY  # 4      ;                                                 |
                ;                                                 |
NewPtX # 4      ; Newest point (internal representation)          |
NewPtY # 4      ;                                               --

; End of together block

TForeCol # 4    ; Text foreground colour
TBackCol # 4    ; Text background colour

CursorX # 4     ; Text cursor X position ; these 3 must be in same order as ...
CursorY # 4     ; Text cursor Y position
CursorAddr # 4  ; Screen address of (output) cursor

InputCursorX # 4        ; Input cursor X position ; ... these 3
InputCursorY # 4        ; Input cursor Y position
InputCursorAddr # 4     ; Screen address of input cursor

EORtoggle # 4   ; Toggle between gap and non-gap
RowsToDo  # 4   ; in the CLS

VduStatus # 4   ; Vdu2, Window, Shadow bits (others in CursorFlags)

CBWS # 8        ; Clear block (VDU 23,8..) workspace
CBStart # 2
CBEnd # 2

CursorDesiredState # 4
CursorStartOffset # 4
CursorEndOffset # 4
CursorCounter # 4
CursorSpeed # 4
Reg10Copy # 4

CursorFill # 4  ; Word to EOR cursor ; MUST be immediately before CursorNbit

CursorNbit # 4  ; Pointer to cursor code for current mode

DisplayStart # 4        ; Start address of screen (for display)
DriverBankAddr # 4      ; Default start address for VDU drivers
DisplayBankAddr # 4     ; Default start address for display
DisplayNColour # 4      ; No. of colours -1 for displayed mode
DisplayModeFlags # 4    ; ModeFlags for displayed mode
DisplayModeNo # 4       ; ModeNo for displayed mode
DisplayScreenStart # 4  ; Where VDU outputs to when outputting to screen

DisplayXWindLimit # 4   ; Used for pointer programming
DisplayYWindLimit # 4
DisplayXEigFactor # 4
DisplayYEigFactor # 4
PointerXEigFactor # 4

Ecf1 # 8        ; The Ecf patterns
Ecf2 # 8
Ecf3 # 8
Ecf4 # 8

DotLineStyle # 8        ; Dot dash line pattern

ModeNo # 4      ; Current mode number

TFTint # 4      ; Text foreground tint          (in bits 6,7)
TBTint # 4      ; Text background tint
GFTint # 4      ; Graphics foreground tint
GBTint # 4      ; Graphics background tint

TotalScreenSize # 4     ; Amount configured for screen (in bytes)

MaxMode # 4             ; Maximum mode number allowed (20 for now)

VinitCopy # 4   ; Copy of Vinit for VDU 23;12 or 13

CursorFlags # 4 ; Silly Master cursor movement flags

CursorStack # 4 ; Bit stack of nested cursor states (0 => on, 1 => off)
                ; (bit 31 = TOS)

ECFShift # 4    ; number of bits to rotate right ECF OR and EOR masks by
ECFYOffset # 4  ; vertical offset to ECF index

WsVdu5 # 0      ; Vdu 5 workspace
WsScr # 4
WsEcfPtr # 4
; WsFontPtr # 4 ; not needed any more, kept in register
EndVerti # 4
StartMask # 4
EndMask # 4
FontOffset # 4
TempPlain # 16  ; only used for MODE 10

VIDCClockSpeed # 4      ; current VIDC clock speed in kHz

CurrentMonitorType # 4  ; initialised from configured one

KernelModeSelector # 4  ; pointer to block in system heap where
                        ; current mode selector is copied

GraphicWs # 300 ; All graphics workspace is overlaid here
EndGraphicWs # 0

 [ AssemblingArthur
 ! 0,"16 ":CC::STR:@
 ]
        AlignSpace 16

GCharSizes  # 0
GCharSizeX  # 4         ; width of VDU 5 chars in pixels
GCharSizeY  # 4         ; height of VDU 5 chars in pixels

GCharSpacing # 0
GCharSpaceX  # 4        ; horizontal spacing between VDU 5 chars in pixels
GCharSpaceY  # 4        ; vertical   ------------------""-----------------

TCharSizes  # 0
TCharSizeX  # 4         ; width of VDU 4 chars in pixels
TCharSizeY  # 4         ; height of VDU 4 chars in pixels

TCharSpacing # 0
TCharSpaceX  # 4        ; horizontal spacing between VDU 4 chars in pixels
TCharSpaceY  # 4        ; vertical   ------------------""-----------------

HLineAddr    # 4        ; address of exported HLine
GcolOraEorAddr # 4      ; address of FgEcfOraEor etc

FirPalSetting # 4*28            ; First palette settings (not used on VIDC20)
FirPalAddr * FirPalSetting      ; Address of block for first palette setting (only used on VIDC20)
SecPalSetting # 4*28            ; Second palette settings (not used on VIDC20)
SecPalAddr * SecPalSetting      ; Address of block for second palette setting (only used on VIDC20)

TextFgColour    # 4             ; Fg/Bg colour stored as a colour number, computed on VDU 18 and re-poked!
TextBgColour    # 4             ;

; In this brave new world there is a pointer to the text expansion
; buffer used for VDU 4 / 5 text plotting.

; This now lives in the system heap.

TextExpandArea # 4      ; Pointer to Text expand area (in system heap)
TextExpandArea_Size * (8*1024)

HSWRSoftCopy    #       4       ; soft copy of h.sync width register (for DPMS)
VSWRSoftCopy    #       4       ; soft copy of v.sync width register (for DPMS)

ScreenBlankFlag # 1     ; 0 => unblanked, 1 => blanked
ScreenBlankDPMSState # 1        ; 0 => just blank video
                                ; 1 => blank to stand-by (hsync off)
                                ; 2 => blank to suspend (vsync off)
                                ; 3 => blank to off (H+V off)
 [ AssemblingArthur
 ! 0,"64 ":CC::STR:@
 ]
        AlignSpace 64

FgEcfOraEor # 4*16      ; Interleaved zgora & zgeor
BgEcfOraEor # 4*16      ; Interleaved zgora & zgeor
BgEcfStore  # 4*16      ; Interleaved zgora & zgeor to store background

;Current state of pattern
LineDotCnt # 4          ; Count down to restarting pattern
LineDotPatLSW # 4       ; Current state of pattern LSWord
LineDotPatMSW # 4       ;    "      "   "     "    MSWord

DotLineLength # 4       ; Dot Pattern repeat length as given in *FX163,242,n

BBCcompatibleECFs # 4   ; 0 => BBC compatible, 1 => native

SpAreaStart # 4         ; Start of sprite area
SpChooseName # 16       ; No comment says Richard
SpChoosePtr # 4

PointerHeights # 4      ; 4 x 1 byte
PointerActiveXs # 4     ; 4 x 1 byte
PointerActiveYs # 4     ; 4 x 1 byte
PointerShapeNumber # 4  ; only bottom byte used
PointerX # 4            ; co-ordinates of pointer (not always = mouse)
PointerY # 4

VIDCControlCopy # 4     ; Soft copy of VIDC control register
VertAdjust # 4          ; offset to add to vertical VIDC registers

TeletextOffset # 4      ; Offset to current teletext flash bank

TeletextCount # 4       ; Number of vsyncs till next teletext flash

WrchNbit # 4            ; Pointer to char code for current mode

BeepBlock # 8           ; OSWORD block for VDU 7

ScreenMemoryClaimed # 1 ; NZ => memory has been claimed or is unusable

 [ AssemblingArthur
 ! 0,"16 ":CC::STR:@
 ]
     AlignSpace 16      ; Align workspace to 16 bytes

TTXDoubleCounts # 25    ; Number of double height chars on each line

 [ AssemblingArthur
 ! 0,"16 ":CC::STR:@
 ]
     AlignSpace 16      ; Align workspace to 16 bytes

RAMMaskTb # 32*4        ; Copy of MaskTb for this mode (up to 32 words)

 [ AssemblingArthur
 ! 0,"16 ":CC::STR:@
 ]
     AlignSpace 16      ; Align workspace to 16 bytes

VduOutputCurrentState # 0 ; values of R0-R3 to return from SwitchOutputToSprite
                        ; or Mask; next 4 must be in this order
SpriteMaskSelect # 4    ; value of R0 to be given to SWI OS_SpriteOp to set up
                        ; current state
VduSpriteArea # 4       ; Pointer to sprite area containing VDU output sprite
                        ; (0 if output is to screen)
VduSprite # 4           ; Pointer to VDU output sprite (0 if output to screen)

VduSaveAreaPtr # 4      ; Pointer to save area for VDU variables


 [ AssemblingArthur
 ! 0,"16,12 ":CC::STR:@
 ]
    AlignSpace 16, 12   ; Make ClipBoxCoords a valid immediate,
                        ; with ClipBoxEnable immediately before it
ClipBoxInfo # 0
ClipBoxEnable # 4       ; 0 => clip box disabled, 1 => enabled

ClipBoxCoords # 0       ; Internal coords of modified area of screen
ClipBoxLCol # 4
ClipBoxBRow # 4
ClipBoxRCol # 4
ClipBoxTRow # 4

FgPattern       # 4*8   ; foreground pattern as defined by OS_SetColour
BgPattern       # 4*8   ; background pattern as defined by OS_SetColour

 [ AssemblingArthur
 ! 0,"16 ":CC::STR:@
 ]
     AlignSpace 16      ; Align workspace to 16 bytes

TextExpand # 4*1024     ; Tim's massive text expansion table for whizzy WRCH
; TextPlain is now always hard against the end of TextExpand for this mode

TTXSoftFonts * TextExpand + 2*1024      ; Soft fonts in teletext mode

 [ AssemblingArthur
 ! 0,"64 ":CC::STR:@
 ]
     AlignSpace 64      ; Align workspace to 64 bytes

; Teletext map and copy/move buffer are overlaid

TTXMapSize      * 41*25*4       ; (&1004 bytes)
LargeCommon     # TTXMapSize    ; the largest area
TTXMap          * LargeCommon

ScrLoaSpriteCB  * LargeCommon   ; (size = SpriteCBsize + MaxSpritePaletteSize)
ScrLoaBuffer    * LargeCommon   ; (size = one pixel row)
ScrSavCommon    * LargeCommon   ; (size = SpriteAreaCBsize + SpriteCBsize
                                ;  + MaxSpritePaletteSize)

FldQueueSize    * ScratchSpaceSize
FldQueueStart   * ScratchSpace

 [ AssemblingArthur
 ! 0,"64 ":CC::STR:@
 ]
     AlignSpace 64      ; Align workspace to 64 bytes

Font # &700             ; 7 pages of (soft) font

SaveAreaSize * 12*1024-@

VduSaveArea # SaveAreaSize      ; save area for switching output to sprites

VDWSSize # 0

                ASSERT  VDWSSize <= 12 * 1024

; *****************************************************************************
;                 Space in the first 32K is allocated below
; *****************************************************************************
; Real workspace definition

; Basic kernel space - defined locations for external modules

                ^       &100
IRQ1V           #       4       ; &100

ESC_Status      #       1       ; &104
LatchBSoftCopy  #       1       ; &105
IOCControlSoftCopy #    1       ; &106
CannotReset     #       1       ; &107

IRQsema         #       4       ; &108
MetroGnome      #       4       ; &10C
MemorySpeed     #       4       ; &110

MEMC_CR_SoftCopy #      4       ; &114
ResetIndirection #      4       ; &118

; Now all internal definitions

; Up to here is initialized on reset

; Next come handler variables

MemLimit        #       4
UndHan          #       4
PAbHan          #       4
DAbHan          #       4
AdXHan          #       4

ErrHan          #       4
ErrBuf          #       4
ErrHan_ws       #       4

CallAd_ws       #       4     ; smart Rs ordering:
CallAd          #       4     ; can do LDMIA of r12, pc
CallBf          #       4

BrkAd_ws        #       4
BrkAd           #       4
BrkBf           #       4

EscHan_ws       #       4
EscHan          #       4

EvtHan_ws       #       4
EvtHan          #       4

; The next lot of workspace is in the space vacated by the small soft CAM map area
; (256 words) which is no longer adequate, so we can reuse it

JordanWS        #       0
VInitSoftCopy   #       4       ; soft copy of VInit so we can set L bit correctly
VEndSoftCopy    #       4       ; soft copy of VEnd  ------------""---------------
DAList          #       4       ; Pointer to first node on dynamic area list

                AlignSpace 16   ; skipped bit must start on 16-byte boundary

SkippedTables   #       0
PhysRamTable    #       0       ; 6 pairs of words (physaddr, size) indicating
                                ; RAM present in machine (NB normally you would need at most 5
                                ; on IOMD machines, but the extra one is if a soft-loaded ROM image
                                ; causes a bank to split
VideoPhysAddr   #       4       ; Address of video RAM (in the case of DRAM-only machines,
VideoSize       #       4       ; this is actually a chunk out of DRAM)
DRAMPhysAddrA   #       4       ; Next the DRAM - note that any banks with no memory
DRAMSizeA       #       4       ; in them will be omitted from this table, so that
DRAMPhysAddrB   #       4       ; eg DRAMPhysAddrA corresponds to the first bank with
DRAMSizeB       #       4       ; DRAM in it, not necessarily bank 0
DRAMPhysAddrC   #       4       ; If not all the slots are occupied, then
DRAMSizeC       #       4       ; the remaining entries in this table have size fields
DRAMPhysAddrD   #       4       ; of zero (and probably addresses of zero too)
DRAMSizeD       #       4
DRAMPhysAddrE   #       4
DRAMSizeE       #       4
PhysRamTableEnd #       0

VRAMSize        #       4       ; Amount of VRAM (in bytes) (may be more than 2M)
VRAMWidth       #       4       ; 0 => no VRAM, 1 => 32-bits wide, 2 => 64-bits wide
VideoBandwidth  #       4       ; video bandwidth in bytes/sec
L2PTSize        #       4       ; Amount of memory (in bytes) used for static L2PT
                                ; - this consists of fixed size first bit, plus variable size
                                ; bit for the free pool L2, which follows directly after it
SoftCamMapSize  #       4       ; Amount of memory (in bytes) used for soft CAM map
                                ; (whole number of pages)
InitKbdWs       #       12      ; Workspace for reset keyboard IRQ code

                AlignSpace 16   ; skipped bit must end on 16-byte boundary
SkippedTablesEnd #      0

CMOSRAMCache    #       240             ; Cache for CMOS RAM
AppSpaceDANode  #       DANode_NodeSize ; Dummy area node for application space (not on list)
FreePoolDANode  #       DANode_NodeSize ; Area node for free pool
SysHeapDANode   #       DANode_NodeSize ; Area node for system heap
CDASemaphore    #       4               ; Semaphore for OS_ChangeDynamicArea - non-zero => routine threaded
MMUControlSoftCopy #    4               ; Soft copy of ARM600/700 control register

AplWorkSize * AppSpaceDANode + DANode_Size

ProcVec_Start           #       0       ; Start of processor vector table
ProcVec_Branch0         #       4       ; Branch through zero
ProcVec_UndInst         #       4       ; Undefined instruction vector
ProcVec_SWI             #       4       ; SWI vector
ProcVec_PrefAb          #       4       ; Prefetch abort vector
ProcVec_DataAb          #       4       ; Data abort vector
ProcVec_AddrEx          #       4       ; Address exception vector (not useful on ARM600/700)
ProcVec_IRQ             #       4       ; IRQ vector
ProcVec_End             #       0

ProcVecPreVeneersSize   *       4*4     ; Space for preveneers for loading handler addresses from 0 page.
ProcVecPreVeneers       #       ProcVecPreVeneersSize

        ASSERT  @ <= &500               ; a convenient address to remember
                #       (&500-@)

CamMapCorruptDebugBlock #       &40     ; somewhere to dump registers in case of emergency

        ASSERT  @ <= JordanWS+256*4
                #       (JordanWS+256*4-@)  ; pad out to original size

CamEntriesPointer #     4       ; points to where CAM soft copy is
                                ; (CamEntries for machines up to 8MBytes,
                                ; CamEntriesForBigMachines for larger machines)

MaxCamEntry     #       4       ; maximum index into the cam map, ie
                                ; 511 for 16MByte machines, 383 for 12MBytes
                                ; 255 for 8MBytes, otherwise 127

RAMLIMIT        #       4

                #       4       ; dummy slot where AplWorkSize used to be

HiServ_ws       #       4
HiServ          #       4
SExitA          #       4
SExitA_ws       #       4
UpCallHan_ws    #       4
UpCallHan       #       4

ROMModuleChain  #       4               ; pointer to head of ROM module chain

; now a section that it's handy to have in simply loadable places

 [ AssemblingArthur
 ! 0,"16 ":CC::STR:@
 ]
             AlignSpace 16

KeyWorkSpaceSize   *  &200
KeyWorkSpace       #  KeyWorkSpaceSize

; The following were reordered on 26-Jul-91. Old ordering was:
; GeneralMOSBuffer
; ModuleSWI_HashTab
; Module_List
; Curr_Active_Object
; VecPtrTab
; ExceptionDump

ModuleSHT_Entries  *  16
ModuleSWI_HashTab  #  4*ModuleSHT_Entries

Module_List        #  4
Curr_Active_Object #  4

; Vector Claim & Release tables etc

VecPtrTab          #  NVECTORS * 4

ExceptionDump      #  4

; GeneralMOSBuffer: re-use with caution!
; Here's just some of the users:
; user                  use(s)
; default error handler error buffer (must be 246+4 bytes big)
; *If                   expression to be evaluated to control the *If
;                       Command line to be submited on the expression
;                         evaluating to non-zero (the THEN clause).
GeneralMOSBuffer   #  256+4

 [ AssemblingArthur
 ! 0,"16 ":CC::STR:@
 ]
            AlignSpace  16 ; Ensures we can MOV rn, #OsbyteVars if <=&1000

OsbyteVars      #       OSBYTEVarSize
 ASSERT OsbyteVars < &10000 ; Must keep in first 64K so address can be read by
                            ; (and stored in) OS_Bytes &A6,&A7. SKS

; These must be in first 4K
NBuffers        *       10
BuffInPtrs      #       4 * NBuffers
BuffOutPtrs     #       4 * NBuffers

VariableList    #       4

; Oscli stuff
OscliCBtopUID   #       4
OscliCBbotUID   #       4
OscliCBcurrend  #       4

ReturnCode      #       4
RCLimit         #       4

SpriteSize      #       4       ; saved on startup for Sprite code and RAMFS
RAMDiscSize     #       4
FontCacheSize   #       4       ; and font manager

TickNodeChain   #       4

; Workspace

EnvTime            #    5
RedirectInHandle   #    1
RedirectOutHandle  #    1
MOShasFIQ          #    1
FIQclaim_interlock #    1
CallBack_Flag      #    1
IRQ_CallBack_Flag * CallBack_Flag
IOSystemType    #       1       ; 0 => old I/O subsystem, 1 => IOEB+82C710 system, 2..255 => ?
MonitorLeadType #       1       ; some function of the monitor lead inputs, as yet undetermined

                  AlignSpace

EnvString         #     256


DUMPER            #     16 * 4

; more system workspace
Page_Size         #  4
PIRQ_Chain        #  4
PFIQasIRQ_Chain   #  4

; !!!! Free space (752 bytes) left by old IRQ despatch (new IRQ despatch
; !!!! moved as it required more space).
OldIRQ1Vspace       # 752


CallBack_Vector   #  4

; interruptible heap manager workspace

HeapSavedReg_R0     # 4
HeapSavedReg_R1     # 4
HeapSavedReg_R2     # 4
HeapSavedReg_R3     # 4
HeapSavedReg_R4     # 4
HeapSavedReg_R13    # 4
HeapReturnedReg_R0  # 4
HeapReturnedReg_R1  # 4
HeapReturnedReg_R2  # 4
HeapReturnedReg_R3  # 4
HeapReturnedReg_R4  # 4
HeapReturnedReg_R13 # 4
HeapReturnedReg_PC  # 4                 ; also acts as interlock

PrinterBufferAddr   #  4                ; holds address of printer buffer
PrinterBufferSize   #  4                ; size of printer buffer - not to be confused with PrintBuffSize
                                        ; which is the (constant) default size for the MOS's smallish buffer
RawMachineID        #  8                ; 64 bits for unique machine ID
KernelMessagesBlock #  20               ; 5 Words for messagetrans message block.
ErrorSemaphore      #  1                ; Error semaphore to avoid looping on error translation.
PortableFlag        #  1                ; Non-zero => got an error from Portable_Speed, so don't try it again

        AlignSpace

MOSConvertBuffer    #  12               ; Enough romm for 8 hex digits.
AbortIndirection    #  4                ; Pointer to list of addresses and trap routines
PreVeneerRegDump    #  17*4             ; room for r0-r15, spsr

 [ AssemblingArthur
 ! 0, "low space free ":CC::STR:(&FEC-@)
 ]
 ASSERT @ < &FEC

; Words for old tools of assorted varieties
                        ^       &FEC
; ECN 17-Feb-92
; Added RISCOSLibWord and CLibWord. The ROM RISCOSLib and CLib must continue
; to work even when they are killed since ROM apps are hard linked to the
; ROM libraries. They cannot use the private word since the block pointed
; to by this will be freed.
RISCOSLibWord           #       4
CLibWord                #       4
FPEAnchor               #       4
DomainId                #       4       ; SKS added for domain identification
Modula2_Private         #       4       ; MICK has FFC and uses it it in USR mode

VduDriverWorkSpace      #       VDWSSize
 ASSERT (VduDriverWorkSpace :AND: 63) = 0 ; For Tim (VDU5)


 [ AssemblingArthur
 ! 0, "high space free ":CC::STR:(&4000-@)
 ]

                        ^       &4000
ScratchSpaceSize        *       &4000
ScratchSpace            #       ScratchSpaceSize

 ASSERT @ <= &8000 ; Start of apl

; *****************************************************************************
; Users of ScratchSpace declare yourself here:

; NRaine: Filling a polygon uses ScratchSpace to flatten the path

; DSeal: Draw module uses ScratchSpace on fill operations (this supercedes
;   NRaine's declaration above).

; SKS: HeapSort with (r1 & 0x80000000) & ~(r1 & 0x20000000) & (r5 <= 16K)
;      uses ScratchSpace as a temp slot for data shuffling after sorting

; TMD: Flood fill uses ScratchSpace for the flood queue.

; Tidying the RMA uses ScratchSpace while all modules are dead

; GSTRANS workspace: GSINIT puts state into the workspacem and GSREAD uses it.
; DO NOT do any operations between GSINIT/GSREAD SWIS.
; SWIs called: OSWord in time var code
;              BinaryToDecimal, ReadUnsigned

; LVR: ADFS uses scratch space to format floppies on 1772 based machines

; DDV: ColourTrans uses scratch space to build palette tables when in
;      ColourTrans_SelecTable/RetrunColourNumber and also whilst generating
;      stipple pattterns.

GSVarWSpace             *       ScratchSpace

                        ^       0
GSNameBuff              #       &100
GS_Stack                #       &200
GS_StackPtr_Lim         *       &200 / 4        ; Number of words in stack.
GS_StackPtr             #       4

                        ^      @ + ScratchSpace

; Pointers for SubstituteArgs: no external calls.
; Ensure these don't overlap FileSwitch's buffers below!

MacExStartPtrs          #       44
MacExEndPtrs            #       44

; OS_CLI has a buffer for alias expansion: ReadVarVal and SubstituteArgs
;    are called while the buffer is held. Also used for module prefixes:
;    Module called twice in this case.

AliasExpansionBuffer    #       100

; *list/*type need an argument expansion buffer: ReadArgs called with it.

ArgumentBuffer           *       AliasExpansionBuffer

; EvaluateExpression space. Calls ReadUnsigned, BinaryToDecimal and ReadVarVal.

ExprWSpace              *       @

                        ^       0, R12
ExprBuff                #       &100
exprBracDif             #       2       ; keep exprSTRACC aligned
tos_op                  #       2       ; 1 byte for use as STRACC-1
ExprSVCstack            #       4
exprSTRACC              *       @ - ExprBuff + ExprWSpace

ExprStackLimit          *       exprSTRACC + &100
ExprStackStart          *       ScratchSpace + ScratchSpaceSize


; Tutu needs some for argument substitution + expansion for run/load types
; Only OS call during xform is XOS_SubstituteArgs and XOS_Heap(Claim,SysHeap)

                        ^       0 ; Offset from ScratchSpace
rav_substituted         #       256
rav_arglist             #       256

TopOfPageZero           #       0

                        ^       &8000 ; The actual top of Page Zero
EconetDebugSpace        |#|     &20 * 4 ; Thirty two words (&7F80)

                ASSERT  @ > TopOfPageZero ; Make sure we don't clash

; *****************************************************************************
; ***            Cursor, Sound DMA, SWI, and OSCLI workspace.               ***
; ***        Sits in the 32K above 31M, ie. &01F000000..&01F07FFF           ***
; ***        Has the physical address &02078000, ie. 32M + 512K - 32K       ***
; *****************************************************************************

TopOfDMAPhysRAM         *       &80000            ; OFFSET in physram
TopOfDMAWorkSpace       *       CursorChunkAddress + 32*1024
OffsetLogicalToPhysical *       TopOfDMAPhysRAM - TopOfDMAWorkSpace

                        ^       TopOfDMAWorkSpace ; Note we will be going down

; Sound

SoundWorkSpaceSize      *       &1000
SoundDMABufferSize      *       &1000
SoundEvtSize            *       &1000
SoundDMABuffers         |#|     SoundDMABufferSize * 2
SoundWorkSpace          |#|     SoundWorkSpaceSize + SoundEvtSize

; Cursor

CursorDataSize          *       &800
CursorData              |#|     CursorDataSize
CursorSoundRAM          *       CursorData
CursorSoundPhysRAM      *       CursorSoundRAM + OffsetLogicalToPhysical

; SWI despatcher

BranchToSWIExit         |#|     4
SvcTable                |#|     &400
 ASSERT SvcTable = &01F033FC ; Required for SVC table pokers, 1.20 compatible
SWIDespatch_Size        *       29*4
SWIDespatch             |#|     SWIDespatch_Size


; Buffers

KeyBuffSize             *       &100
RS423InBuffSize         *       &100
RS423OutBuffSize        *       &C0
PrintBuffSize           *       &400
Sound0BuffSize          *       4
Sound1BuffSize          *       4
Sound2BuffSize          *       4
Sound3BuffSize          *       4
SpeechBuffSize          *       4
MouseBuffSize           *       &40
KeyBuff                 |#|     KeyBuffSize
RS423InBuff             |#|     RS423InBuffSize
RS423OutBuff            |#|     RS423OutBuffSize
PrintBuff               |#|     PrintBuffSize
Sound0Buff              |#|     Sound0BuffSize
Sound1Buff              |#|     Sound1BuffSize
Sound2Buff              |#|     Sound2BuffSize
Sound3Buff              |#|     Sound3BuffSize
SpeechBuff              |#|     SpeechBuffSize
MouseBuff               |#|     MouseBuffSize

; Oscli buffering

OscliBuffSize           *       &100
OscliNoBuffs            *       16
OscliCircBuffLimit      |#|     0
OscliCircBuffStart      |#|     OscliBuffSize * OscliNoBuffs
RedirectBuff            |#|     OscliBuffSize

; Default IRQ despatch moved here as a result of IOMD having an extra
; 6 interrupts for I/O and sound DMA (this is really IOMD specific, not
; ARM600/700 specific but for the moment it is assumed that they are
; used on the same machines).
DefIRQ1Vspace           *       12*4+12*23+2*256+64     ; for size checking in MOS
DefaultIRQ1V            |#|     DefIRQ1Vspace

 [ AssemblingArthur
 ! 0, "Aligning IRQ stack from ":CC::STR:@
 ]
 [ @-7*4 :AND: 15 <> 0
                        |#|     (@-7*4):AND:15
 ]
IRQSTK                  #       0       ; Overflow will give abort
 [ AssemblingArthur
 ! 0, "IRQ stack size ":CC::STR:(IRQSTK-CursorChunkAddress)
 ]

 ASSERT @ > ( CursorChunkAddress + &1000 ) ; Check minimum stack

; *****************************************************************************
;                        High system workspace
; *****************************************************************************

                ^       SysHeapChunkAddress

                #       8*1024          ; svcstk size. Overflow will give abort
SVCSTK          #       0
SysHeapStart    #       0


        OPT     OldOpt
        END