; > &.Hdr.NewSpace

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

; Date       Name  Description
; ----       ----  -----------
;  4-Feb-87  SKS   Added GenErrorFlag
;  9-Feb-87  APT     "   CurrentErrorBuffer, removed RMTempWSpace
; 16-Feb-87  APT   Added sound workspace bits
; 19-Feb-87  RCM   Added spChoosePtr
; 24-Feb-87  BC    Complete revision
; 25-Feb-87  APT   HelpBuffer, HelpBufferSize
; 27-Feb-87  TMD   Added MapCursorAddr
;  2-Mar-87  TMD   Removed MapCursorAddr, added TeletextOffset, TeletextCount
; 10-Mar-87  APT   Various mods performed : above 2 TMD revisions added, also
;                  Memory map data added
;                  SpriteSize,RAMDiscSize,SysHeapStart added
;                  system workspace molested
; 12-Mar-87  APT   SysHeapDesc, BuffPtr, MHHPD removed
;                  CurrentErrorBuffer removed
; 13-Mar-87  TMD   Removed TextPlain, added teletext workspace
; 16-Mar-87  TMD   GWLCol,GWRCol,GWTRow,GWBRow moved out of mode-variable area
; 18-Mar-87  TMD   Mode variables re-mangled
; 19-Mar-87  TMD   Mode variables re-re-mangled
; 24-Mar-87  TMD   Added CursorStack
; 25-Mar-87  TMD   Moved TotalScreenSize to be in first 1K of VDWS
; 25-Mar-87  TMD   Added WrchNbit
; 25-Mar-87  SKS   Conditionalled IRQ stack message
;  3-Apr-87  DF    Sound Workspace internal rearrangement
;  9-Apr-87  TMD   Added MaxMode, VDU workspace reformatted, SaveR13 removed
; 28-Apr-87  TMD   Added CentiCounter
; 28-Apr-87  APT     "   TickNodeChain
;  5-May-87  TMD   Added SoftResetVars, HardResetVars, PowerOnResetVars
;  8-May-87  TMD   Added BeepBlock
; 12-May-87  APT   EnvString.
; 13-May-87  APT   Major hack of low 32k, to rationalise handlers
; 14-May-87  TMD   Extended PrinterActive to a word (is a handle now!)
; 18-May-87  TMD   Added PrinterTypeName
; 18-May-87  APT   Subtle modifications to handler variables
; 18-May-87  SKS   Added EnvTime as alias for START (nicer)
; 19-May-87  TMD   Added ScreenMemoryClaimed
; 21-May-87  APT   MetroGnome variable added
; 22-May-87  SKS   Aligned OsbyteVars to always be immediate value if < &1000
; 27-May-87  TMD   Added Alphabet, Keyboard
; 28-May-87  APT   Added ExceptionDump, removed superfluous vector stuff
; 24-Jul-87  APT   Added Page_Size
;  6-Aug-87  TMD   Merged new vdu workspace
; 10-Aug-87  SKS   Using scratchspace
; 11-Aug-87  TMD   Added CursorNbit
; 11-Aug-87  SKS   Using more scratchspace
; 13-Aug-87  APT   ConfigScreenSize redundant
; 01-Sep-87  TMD   Transferred new vdu workspace arrangement from Hdr.WorkSpace
; 14-Sep-87  SKS   Nailed OSByte vars to the floor (at &0400) as it needs to
;                  be used by external things
; 15-Sep-87  SKS   Unpegged OSByte vars a little
; 22-Sep-87  SKS   FileSwitch scratchspace use redefined

; Memory map :
CursorChunkAddress  * 31*1024*1024
SysHeapChunkAddress * 28*1024*1024
RMAAddress          * 24*1024*1024
SpriteSpaceAddress  * 20*1024*1024
RAMDiscAddress      * 16*1024*1024

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

        # 3 :AND: (OSBYTEFirstVar-@)    ; Align it

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

        GBLS    PrinterPrefix
PrinterPrefix SETS "PrinterType$"

PrinterTypeName # 6 + :LEN: (PrinterPrefix)

        # 3 :AND: (OSBYTEFirstVar-@)    ; Align it

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)

LineLength # 4  ; Length of one pixel row in bytes

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

; YShftFactor must be immediately after YWindLimit

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

; 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

NColour # 4     ; Number of colours minus 1

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

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)

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

CursorIndex # 4 ; Index into CursorFudgeFactor table

ECFIndex # 4    ; Index into default ECF tables

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

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

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

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)

WsVdu5 # 0      ; Vdu 5 workspace
WsScr # 4
WsEcfPtr # 4
WsFontPtr # 4
EndVerti # 4
StartMask # 4
EndMask # 4
FontOffset # 4
TempPlain # 16  ; only used for MODE 10

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

FirPalSetting # 4*28    ; First palette settings
SecPalSetting # 4*28    ; Second palette settings

        # 63 :AND: (-@) ; Align workspace to 64 bytes (for Tim)

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

        # 15 :AND: (-@) ; Align workspace to 16 bytes

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

        # 15 :AND: (-@) ; Align workspace to 16 bytes

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

        # 15 :AND: (-@) ; 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

        # 63 :AND: (-@) ; Align workspace to 64 bytes (for CMBuffer)

; Teletext map, flood queue and copy/move buffer are overlaid

TTXMapSize * 41*25*4    ; (&1004 bytes)
FldQueueSize * &1000    ; must be a power of 2 and <=TTXMapSize

TTXMap # TTXMapSize     ; the largest of the three
FldQueueStart * TTXMap  ; overlaid with TTX Map
CMBuffer      * TTXMap  ; ---------""----------

        # 63 :AND: (-@) ; Align workspace to 64 bytes

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


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
ESC_Status      #       1
LatchBSoftCopy  #       1
IOCControlSoftCopy #    1

; Internal definitions

CallBack_Flag   #       1
IRQ_CallBack_Flag * CallBack_Flag

MEMCIMAGE       #       4

; 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          #       4
CallBf          #       4
CallAd_ws       #       4
BrkAd           #       4
BrkBf           #       4
BrkAd_ws        #       4

EscHan_ws       #       4     ; smart Rs ordering
EscHan          #       4

EvtHan          #       4
EvtHan_ws       #       4
SExitA          #       4
SExitA_ws       #       4
HiServ          #       4
HiServ_ws       #       4

CamEntries      #       4 * 128 ; keep CAM entries 0-127 in here
AplWorkSize     #       4
Curr_Active_Object #    4
RAMLIMIT        #       4
Module_List     #       4

; Vector Claim & Release tables etc

VecPtrTab       #       NVECTORS * 4

ExceptionDump   #       4

            AlignSpace  16 ; Ensures we can MOV rn, #OsbyteVars if <=&1000
OsbyteVars      #       OSBYTEVarSize + 32
 ASSERT OsbyteVars < &10000 ; Must keep in first 64K so address can be read
                           ; by OSBytes A6,A7. SKS

MacroNameBuff   #       &100
MacExStartPtrs  #       44
MacExEndPtrs    #       44
MacExpErrLink   #       4

                #       15 :AND: (-@)   ; Align to 16 bytes

KeyWorkSpaceSize *      &200
KeyWorkSpace    #       KeyWorkSpaceSize

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

VariableList    #       4

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

ReturnCode        #     4
RCLimit           #     4

SpriteSize           #  4  ; saved on startup for Sprite code and RAMFS
RAMDiscSize          #  4  ; but how do they access it?
TickNodeChain        #  4
MetroGnome           #  4

; Workspace

EnvTime         #       5
START           *       EnvTime
                #       3       ; Realign, space for below offsets 
BUFFER          #       &40
ESCCNT          *       -2      ; Offsets from 'BUFFER'
ESCFLG          *       -1

DUMPER          #       16 * 4
BRKLST          #       16 * 8
STRACC          #       &E0

EnvString       #       &100    ; decent length environment string buffer

; more system workspace
Page_Size       #  4


        ASSERT  @ < &FE0

; These are defined in Brazil ; most probably don't bother us.
                        ^       &FE0
Level0_currentThread    #       4  ; FE0
Level0_freedQueue       #       4  ; FE4
Level0_centisecondTime  #       4  ; FE8
Level0_GFT              #       4  ; FEC
Level0_ForceCrash       #       4  ; FF0
Level0_FloatEmulatorWS  #       4  ; FF4 ; But this may be necessary
Level0_Inhibit_Scheduler #      4  ; FF8
Modula2_Private         #       4  ; MICK has FFC

                ASSERT  @ = &1000 ; Top of old OS work area

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

                        ^       &4000
ScratchSpace            #       0
ScratchSpaceSize        *       &4000

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Users of scratchspace declare yourself here.

; Tidying the RMA uses ScratchSpace backwards from ScratchSpace+Size

; GSTRANS,Variables workspace

GSVarWSpace             *       ScratchSpace

                        ^       0
GSNameBuff              #       &100
GS_Stack                #       &200
GS_StackPtr_Lim         *       &200 / 4        ; Number of words in stack.
GS_StackPtr             #       4
SetVarBuff              #       &100
ShowBuff                *       SetVarBuff
SettingBuff             #       &100    ; used in *set, *setmacro

; Sam's nasty workspace sharing : get 512 byte buffer for *Help
; by using SettingBuff and IFBuffer
HelpBuffer     * SettingBuff+GSVarWSpace
HelpBufferSize * 512

                        ^       @ + GSVarWSpace
IFBuffer                #       &100

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

; *****************************************************************
; ***  Cursor, Sound DMA, SWI, and OSCLI workspace.             ***
; ***  Sits in the 32K above 31Meg ie from &01F08000 downwards  ***
; ***  But has the physical address &02078000                   ***
; *****************************************************************

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
BranchToSWIExit         |#|     4
SvcTable                |#|     &400

; Buffers
KeyBuffSize             *       &20
RS423InBuffSize         *       &100
RS423OutBuffSize        *       &C0
PrintBuffSize           *       &40
Sound0BuffSize          *       &10
Sound1BuffSize          *       &10
Sound2BuffSize          *       &10
Sound3BuffSize          *       &10
SpeechBuffSize          *       &40
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

IRQSTK                  #       0

 ASSERT @ > ( TopOfDMAWorkSpace - &7000 ) ; Check minimum stack

;****************************************************************************
; High system workspace
;****************************************************************************
                                                                                                        ^       SysHeapChunkAddress
                        #       8*1024             ; svcstk size
SVCSTK                  #       0
SysHeapStart            #       0

        END
