KernelWS 68.9 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
; 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    > Kernel WorkSpace

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
; 15-Jun-94  AMcC  Renamed file (was VickySpace)
;                  The following values are 'exported' to PublicWS:
;                        Name:                     Used by:
;                        ----------------------------------
;                        BgEcfOraEor               SprExtend
;                        FgEcfOraEor               SprExtend
;                        BranchToSWIExit           TaskWindow
;                        CannotReset               FileCore
;                        DomainId                  FileSwitch
;                        ESC_Status                ADFS, DeviceFS
;                        IRQsema                   Draw, MsgTrans
;                        LatchBSoftCopy            ADFS, Parallel
;                        MEMC_CR_SoftCopy          ADFS
;                        RedirectInHandle          TaskWindow
;                        RedirectOutHandle         TaskWindow
;                        ScratchSpace              ADFS, Colours, Draw, FileCore
;                                                  FileSwitch, FontManager, NetFiler
;                        SoundDMABufferSize        Sound0
;                        SoundDMABuffers           Sound0
;                        SoundWorkSpace            Portable, Sound1, Sound2, Voices
;                        SVCSTK                    FileSwitch
;                        SvcTable                  TaskWindow, Wimp
;                        SysHeapStart              FileSwitch
;                        VduDriverWorkSpace        SprExtend
;
; 31-Oct-94  AMcC/RM/WT  Added CLine_Softcopy for Morris monitor id
; 03-Nov-94  AMcC        Export ScreenBlankFlag and ScreenBlankDPMSState
;                        (for DPMSUtils: part of RISC OS releases 3.50 and 3.60)
Neil Turton's avatar
Neil Turton committed
197
; 28-Mar-95  JRH         Added NVRamSize and RTCFitted, conditioned on E2ROMSupport
Neil Turton's avatar
Neil Turton committed
198
; 06-Feb-95  SMC         Increased SVC stack size to 12K.
Neil Turton's avatar
Neil Turton committed
199 200 201 202 203 204 205 206 207
; 18-Jan-96  JRH         Removed CLine_Softcopy cos not needed
; 06-Feb-96  SMC         Increased DefIRQ1Vspace for IRQC registers
; amg 6/12/96 Renaissance. Merge in changes below from 3.70 version. Make changes conditional.
; 07-Feb-95  WT          Added LCD_Active for LCD/CRT dynamic switching support
; 07-Feb-95  WT          Added VStartSoftCopy for dual-panel LCD support
; 18-May-95  WT          Added LCD_Inverted for LCD inversion (well, surprise surprise!)
; 05-Dec-95  WT          Added ProcessorType and ProcessorFlags (1 byte each)
; amg 07/12/96 Renaissance. Shifted ResetType (which is a public export) so it'll
;              stay in the same place.
Kevin Bracey's avatar
Kevin Bracey committed
208
; 21-Jul-98  NDT         Added PixelRate.  Moved KernelModeSelector to make space.
209
; 19-Oct-99  KJB         Moved IOSystemType into SkippedTables.
Neil Turton's avatar
Neil Turton committed
210 211 212 213 214 215
;
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Memory map:

; Dynamic area node format

216
                  ^     0
217
DANode_Link       #     4               ; points to next node (in address order)
218 219 220
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
221 222
DANode_Size       #     4               ; current logical size of area (not counting holes, if Sparse/PMP area)
DANode_MaxSize    #     4               ; maximum logical size of area
223 224 225 226 227 228
DANode_Workspace  #     4               ; workspace pointer when calling handlers
DANode_Handler    #     4               ; pointer to handler routine for area
DANode_Title      #     4               ; pointer to area title
DANode_SubLink    #     4               ; next node in any disjoint sublist (currently used for Shrinkables only)
DANode_SparseHWM  #     4               ; high water mark, if Sparse area (highest base+size claimed for area)
DANode_SortLink   #     4               ; next node in alphabetically sorted list
229 230 231
DANode_PMP        #     4               ; pointer to physical memory pool - zero if not PMP or has been resized to zero
DANode_PMPSize    #     4               ; number of pages currently in phys pool
DANode_PMPMaxSize #     4               ; size of phys memory pool, in pages
232 233
DANode_NodeSize   #     0

234 235 236 237 238 239 240 241 242
; CAM entry format
                  ^     0
CAM_LogAddr       #     4               ; Logical address page is assigned to (lower address if doubly mapped, Nowhere/DuffEntry if not mapped)
CAM_PageFlags     #     4               ; DynAreaFlags_* and PageFlags_*
CAM_PMP           #     4               ; Pointer to PMP (DANode ptr) if DynAreaFlags_PMP. 0 if not.
CAM_PMPIndex      #     4               ; Index of page in PMP page list. Invalid if not in PMP.
CAM_EntrySize     #     0
CAM_EntrySizeLog2 *     4

Neil Turton's avatar
Neil Turton committed
243 244 245

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

246
 [ HiProcVecs
247
ProcVecs            * &FFFF0000
248
 |
249
ProcVecs            * &00000000
250
 ]
251 252
; Currently, zero page must be located at the processor vectors
ZeroPage            * ProcVecs
253 254

; Sort out 26/32 bit versions
255 256 257 258
SVCStackSize        *  32*1024
IRQStackSize        *   8*1024
ABTStackSize        *   8*1024
UNDStackSize        *   8*1024
259
KbuffsMaxSize       *  64*1024
260
ScreenMaxSize       * 480*1024
261
DCacheCleanSize     * 256*1024  ;should be multiple of 64k
Kevin Bracey's avatar
Kevin Bracey committed
262

263 264 265
AplWorkMaxSize      * &20000000 ; 512M - temporary (need to decide this at boot time)
RMAAddress          * AplWorkMaxSize ; temporary - run time allocate?
RMAMaxSize          * &10000000 ; 256M
266 267 268 269
SysHeapChunkAddress * RMAAddress + RMAMaxSize
SysHeapAddress      * SysHeapChunkAddress
SysHeapMaxSize      * 32:SHL:20
FreePoolAddress     * 0
270

271
IOLimit             * &BA000000 ; initial lower limit on room for IO space (DA creation may move limit up)
272
IO                  * &FA000000 ; works downwards
273
HALWorkspace        * &FA000000
274
HALWorkspaceSize    * &00100000
275 276
IRQStackAddress     * &FA100000
SVCStackAddress     * &FA200000
277 278
ABTStackAddress     * &FA300000
UNDStackAddress     * &FA400000
279
PhysicalAccess      * &FA500000
280
DCacheCleanAddress  * &FA600000 ; eg. for StrongARM, 256k of space, up to FA640000
281 282 283 284
KbuffsBaseAddress   * &FA640000 ; kernel buffers for long command lines, size KbuffsMaxSize
HALWorkspaceNCNB    * &FA6E8000 ; 32K of uncacheable HAL workspace (if requested)
L2PT                * &FA800000
L1PT                * &FAC00000
285
CursorChunkAddress  * &FAFF0000
Robert Sprowson's avatar
Robert Sprowson committed
286 287
DuffEntry           * &FAFF8000 ; No page ever mapped in here (L2PT entry always 0), also, all non mapped pages
Nowhere             * DuffEntry ; use this as their CAM entry. There is only one 'Nowhere' (synonym).
288 289
CAM                 * &FB000000
CAMspace            * CAM_EntrySize*1024*1024 ; 1M entries = enough for 4GB of RAM
290 291 292 293

IRQSTK              * IRQStackAddress + IRQStackSize
ABTSTK              * ABTStackAddress + ABTStackSize
UNDSTK              * UNDStackAddress + UNDStackSize
Neil Turton's avatar
Neil Turton committed
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421

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

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

Kevin Bracey's avatar
Kevin Bracey committed
422
HardResetVars # 0              ; Reset to here on hard reset
Neil Turton's avatar
Neil Turton committed
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
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

488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
; *** layout of a descriptor block for a display pointer shape ***

                  ^  0
PointerBlkHAL     #  0  ; fields up to private part passed to HAL
PointerWidth      #  1  ; actual (unpadded) shape width in bytes (from OS_Word 21)
PointerHeight     #  1  ; shape height in pixels
                  #  2  ; alignment padding
PointerBuffLA     #  4  ; logical address of shape buffer (up to 8 * 32 bytes)
PointerBuffPA     #  4  ; physical address of shape buffer
PointerBlkPrivate #  0  ; fields below here not used by HAL
PointerActiveX    #  1  ; active x in pixels from left
PointerActiveY    #  1  ; active y in pixels from top
                  #  2  ; alignment padding
PointerBlkSize    #  0

Neil Turton's avatar
Neil Turton committed
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585

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

586
BytesPerChar # 4        ; Bytes per 8 pixels of character
Neil Turton's avatar
Neil Turton committed
587 588
                        ; (same as BitsPerPix except in double pixel modes)

589
DisplayLineLength # 4   ; LineLength of display. May include padding from ExtraBytes control list item, so needs manual preservation during screen redirection.
Neil Turton's avatar
Neil Turton committed
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665

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
666 667 668
DisplayLog2BPP # 1
PointerXEigFactor # 1
                  # 2
Neil Turton's avatar
Neil Turton committed
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687

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)

Kevin Bracey's avatar
Kevin Bracey committed
688
ScreenEndAddr # 4       ; Logical address of screen (start of 2nd copy)
Neil Turton's avatar
Neil Turton committed
689 690 691 692 693 694 695 696 697

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

698 699 700 701 702
        ASSERT  ECFShift =  Legacy_ECFShift
        ASSERT ?ECFShift = ?Legacy_ECFShift
        ASSERT  ECFYOffset =  Legacy_ECFYOffset
        ASSERT ?ECFYOffset = ?Legacy_ECFYOffset

Neil Turton's avatar
Neil Turton committed
703 704 705 706 707 708 709 710 711 712
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

713
VIDCClockSpeed # 4      ; current VIDC clock speed in kHz (now always zero)
714

Neil Turton's avatar
Neil Turton committed
715 716
CurrentMonitorType # 4  ; initialised from configured one

Kevin Bracey's avatar
Kevin Bracey committed
717
PixelRate # 4   ; Pixel Rate in kHz
Neil Turton's avatar
Neil Turton committed
718

Ben Avison's avatar
Ben Avison committed
719 720 721 722 723
BorderL # 4             ; Size of border
BorderB # 4
BorderR # 4
BorderT # 4

Neil Turton's avatar
Neil Turton committed
724 725 726
GraphicWs # 300 ; All graphics workspace is overlaid here
EndGraphicWs # 0

Jeffrey Lee's avatar
Jeffrey Lee committed
727
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747
 ! 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   ------------------""-----------------

748
HLineAddr      # 4      ; address of exported HLine
Neil Turton's avatar
Neil Turton committed
749 750
GcolOraEorAddr # 4      ; address of FgEcfOraEor etc

751 752 753 754
BlankPalAddr  # 4       ; address of block for blank palette
FirPalAddr    # 4       ; address of block for first flash state palette
SecPalAddr    # 4       ; address of block for second flash state palette

Jeffrey Lee's avatar
Jeffrey Lee committed
755 756
CurrentGraphicsVDriver # 4 ; Current driver number

757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773
PointerShapes      # 0
PointerShape1      # 4  ; pointers to defined shapes 1 to 4
PointerShape2      # 4
PointerShape3      # 4
PointerShape4      # 4
PointerShapesH     # 0
PointerShapeH1     # 4  ; pointers to holding shapes 1 and 2 (so updates never hit shape given to HAL)
PointerShapeH2     # 4

PointerShapeBlocks # 6*PointerBlkSize ; room for the 6 shape descriptors themselves

PointerShapeLA     # 4               ; logical address of current shape buffer (owned by HAL)
PointerShapeNumber # 1               ; includes bit 7 linkage flag
                   # 3               ; alignment padding
PointerX           # 4               ; co-ordinates of pointer (not always = mouse)
PointerY           # 4

774
 [ :DEF: ShowWS
775
  ! 0, "PointerShapes @ ":CC::STR:(PointerShapes)
776
 ]
777

Jeffrey Lee's avatar
Jeffrey Lee committed
778
GraphicsVFeatures  # 4               ; features word from current driver, refreshed each mode change
779
TrueVideoPhysAddr  # 4               ; VideoPhysAddr is a lie, use this instead
Jeffrey Lee's avatar
Jeffrey Lee committed
780 781 782
MaxGraphicsVDrivers * 8
GraphicsVDrivers # MaxGraphicsVDrivers*4 ; List of drivers
                # 4*4                ; SPARE (avoiding changes of exported addresses for now)
Neil Turton's avatar
Neil Turton committed
783 784 785 786 787 788 789 790 791 792 793 794

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)

795
                 # 2*4   ; SPARE (avoiding changes of exported addresses for now)
Neil Turton's avatar
Neil Turton committed
796

797
ScreenBlankFlag # 1     ; 0 => unblanked, 1 => blanked
Neil Turton's avatar
Neil Turton committed
798

799 800
        ASSERT  ScreenBlankFlag =  Legacy_ScreenBlankFlag
        ASSERT ?ScreenBlankFlag = ?Legacy_ScreenBlankFlag
Neil Turton's avatar
Neil Turton committed
801

802 803 804 805
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)
Neil Turton's avatar
Neil Turton committed
806

807 808
        ASSERT  ScreenBlankDPMSState =  Legacy_ScreenBlankDPMSState
        ASSERT ?ScreenBlankDPMSState = ?Legacy_ScreenBlankDPMSState
Neil Turton's avatar
Neil Turton committed
809 810


Jeffrey Lee's avatar
Jeffrey Lee committed
811
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
812 813 814 815
 ! 0,"64 ":CC::STR:@
 ]
        AlignSpace 64

816 817 818
FgEcfOraEor # 4*16      ; Interleaved zgora & zgeor
        ASSERT  FgEcfOraEor =  Legacy_FgEcfOraEor
        ASSERT ?FgEcfOraEor = ?Legacy_FgEcfOraEor
Neil Turton's avatar
Neil Turton committed
819

820 821 822
BgEcfOraEor # 4*16      ; Interleaved zgora & zgeor
        ASSERT  BgEcfOraEor =  Legacy_BgEcfOraEor
        ASSERT ?BgEcfOraEor = ?Legacy_BgEcfOraEor
Neil Turton's avatar
Neil Turton committed
823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838

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

839 840 841 842 843 844 845 846 847 848 849
SWP_W # 1               ; Width & height of image to restore
SWP_H # 1
SWP_Callback # 1        ; Nonzero if palette update callback registered
SWP_Mutex # 1           ; Mutex to prevent re-entrancy
SWP_Restore # 1         ; Nonzero if restore needed in RestorePointer
SWP_Dirty # 1           ; Nonzero if need replot due to palette change
          # 2
SWP_Coords # 4          ; Coordinates of last plot
SWP_Pos # 4             ; Address to restore pixels to, 0 if not displayed
SWP_Under # 4           ; Pointer to copy of screen pixels from under the pointer
SWP_Palette # 3*4       ; Pointer colours converted to pixel values for current mode
Neil Turton's avatar
Neil Turton committed
850 851 852 853 854 855 856

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

857
CharWidth # 4           ; Width of a character in bytes (same as BytesPerChar except
858 859 860 861 862 863 864
                        ; in HiResTTX MODE 7, where characters are 16 pixels wide)
                        ; This could also be defined as (TCharSizeX<<Log2BPC)/8

TextOffset # 4          ; Byte offset into screen bank at which text window starts.
                        ; Keeps the text window centered when e.g. when mode 7 picks
                        ; a higher resolution mode than strictly necessary.

865 866 867 868 869 870 871 872 873 874 875 876 877 878 879
TTXFlags # 4            ; VDU 23,18 flags
TTXFlag_Suspend         * 1:SHL:0
TTXFlag_Conceal         * 1:SHL:1
TTXFlag_BlackEnable     * 1:SHL:2
TTXFlag_TransModeShift  * 3
TTXFlag_TransModeMask   * 3:SHL:TTXFlag_TransModeShift
                        ; bits 9-11 must be zero
TTXFlag_FgTransEOR      * 1:SHL:12
                        ; bits 13-15 must be zero
TTXFlag_BgTransEOR      * 1:SHL:16
                        ; bits 17-19 must be zero
TTXFlag_FgTransBIC      * 1:SHL:20
                        ; bits 21-23 must be zero
TTXFlag_BgTransBIC      * 1:SHL:24

Neil Turton's avatar
Neil Turton committed
880 881 882
BeepBlock # 8           ; OSWORD block for VDU 7

ScreenMemoryClaimed # 1 ; NZ => memory has been claimed or is unusable
Kevin Bracey's avatar
Kevin Bracey committed
883
ExternalFramestore # 1  ; NZ => using external framestore rather than screen memory DA
Neil Turton's avatar
Neil Turton committed
884

885
     AlignSpace
Neil Turton's avatar
Neil Turton committed
886

887 888 889 890
TTXDoubleCountsPtr # 4 ; Number of double height chars on each line
TTXMapPtr          # 4
TTXLineStartsPtr   # 4
TTXNewWorkspace    # 4 ; Temp variable to allow mode changes to fail gracefully if TTX workspace can't be allocated
Neil Turton's avatar
Neil Turton committed
891

Jeffrey Lee's avatar
Jeffrey Lee committed
892
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
893 894 895 896 897 898
 ! 0,"16 ":CC::STR:@
 ]
     AlignSpace 16      ; Align workspace to 16 bytes

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

Jeffrey Lee's avatar
Jeffrey Lee committed
899
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914
 ! 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


Jeffrey Lee's avatar
Jeffrey Lee committed
915
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931
 ! 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

932
                # 3*4   ; SPARE (avoiding changes of exported addresses for now)
Neil Turton's avatar
Neil Turton committed
933

Kevin Bracey's avatar
Kevin Bracey committed
934 935 936
KernelModeSelector # 4  ; pointer to block in system heap where
                        ; current mode selector is copied

Jeffrey Lee's avatar
Jeffrey Lee committed
937
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
938 939 940 941 942 943 944 945 946
 ! 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

Jeffrey Lee's avatar
Jeffrey Lee committed
947
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
948 949 950 951
 ! 0,"64 ":CC::STR:@
 ]
     AlignSpace 64      ; Align workspace to 64 bytes

952
; Some infrequently used buffers which can be overlaid
Neil Turton's avatar
Neil Turton committed
953

954
LargeCommon     # SpriteAreaCBsize + SpriteCBsize + MaxSpritePaletteSize ; the largest area
Neil Turton's avatar
Neil Turton committed
955 956

ScrLoaSpriteCB  * LargeCommon   ; (size = SpriteCBsize + MaxSpritePaletteSize)
957
        ASSERT ?LargeCommon >= SpriteCBsize + MaxSpritePaletteSize
Neil Turton's avatar
Neil Turton committed
958 959
ScrSavCommon    * LargeCommon   ; (size = SpriteAreaCBsize + SpriteCBsize
                                ;  + MaxSpritePaletteSize)
960
        ASSERT ?LargeCommon >= SpriteAreaCBsize + SpriteCBsize + MaxSpritePaletteSize
961
TempModeSelector * LargeCommon  ; (size = ModeSelector_MaxSize)
962
        ASSERT ?LargeCommon >= ModeSelector_MaxSize
Neil Turton's avatar
Neil Turton committed
963 964 965 966

FldQueueSize    * ScratchSpaceSize
FldQueueStart   * ScratchSpace

Jeffrey Lee's avatar
Jeffrey Lee committed
967
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
968 969 970 971 972 973 974 975 976 977 978 979 980 981
 ! 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

982 983 984 985 986 987 988 989
; IIC bus info block

               ^ 0
IICBus_Type    # 4 ; Bus type (HAL_IICType)
IICBus_Status  # 4 ; Bus status (HAL_IICMonitorTransfer)
IICBus_Device  # 4 ; Bus device (HAL_IICDevice)
IICBus_Size    # 0

Neil Turton's avatar
Neil Turton committed
990 991 992 993 994
; *****************************************************************************
;                 Space in the first 32K is allocated below
; *****************************************************************************
; Real workspace definition

995 996 997
; locations used during reset only. Not cleared by ClearPhysRAM, but
; cleared later (just before DEFHAN).

998 999 1000
; Note that these are all relative to ZeroPage!

                ^       &80             ; steer clear of FIQ code
Kevin Bracey's avatar
Kevin Bracey committed
1001 1002
InitIRQHandler  #       4               ; pointer to IRQ handler (LDR PC'ed from IRQ HW vector)
InitIRQWs       #       16              ; workspace for IRQ handler
1003 1004
InitUsedStart   #       4               ; start of used pages (L2PT etc) not to be cleared
InitUsedEnd     #       4               ; end of used pages
1005
InitUsedBlock   #       4               ; current block in PhysRamTable
1006
InitClearRamWs  #       10*4
1007 1008 1009
InitDMABlock    #       8               ; block of DMAable memory extracted from PhysRamTable
InitDMAOffset   #       4               ; offset+8 into PhysRamTable where memory was taken
InitDMAEnd      #       4               ; current DMA alloc pos
1010 1011 1012
                AlignSpace 32           ; because we clear 32 at a time
InitWsEnd       #       0

Neil Turton's avatar
Neil Turton committed
1013 1014
; Basic kernel space - defined locations for external modules

1015
                       ^       &100
Neil Turton's avatar
Neil Turton committed
1016 1017
IRQ1V                  #       4       ; &100

1018 1019 1020
ESC_Status             #       1       ; &104
        ASSERT  ESC_Status =  Legacy_ESC_Status
        ASSERT ?ESC_Status = ?Legacy_ESC_Status
Neil Turton's avatar
Neil Turton committed
1021

1022 1023 1024
LatchBSoftCopy         #       1       ; &105
        ASSERT  LatchBSoftCopy =  Legacy_LatchBSoftCopy
        ASSERT ?LatchBSoftCopy = ?Legacy_LatchBSoftCopy
Neil Turton's avatar
Neil Turton committed
1025 1026 1027

IOCControlSoftCopy     #       1       ; &106

1028 1029 1030
CannotReset            #       1       ; &107
        ASSERT  CannotReset =  Legacy_CannotReset
        ASSERT ?CannotReset = ?Legacy_CannotReset
Neil Turton's avatar
Neil Turton committed
1031

1032 1033 1034
IRQsema                #       4       ; &108
        ASSERT  IRQsema =  Legacy_IRQsema
        ASSERT ?IRQsema = ?Legacy_IRQsema
Neil Turton's avatar
Neil Turton committed
1035 1036

MetroGnome             #       4       ; &10C
1037 1038 1039
        ASSERT  MetroGnome =  Legacy_MetroGnome
        ASSERT ?MetroGnome = ?Legacy_MetroGnome

Neil Turton's avatar
Neil Turton committed
1040 1041
MemorySpeed            #       4       ; &110

1042 1043 1044
MEMC_CR_SoftCopy       #      4       ; &114
        ASSERT  MEMC_CR_SoftCopy =  Legacy_MEMC_CR_SoftCopy
        ASSERT ?MEMC_CR_SoftCopy = ?Legacy_MEMC_CR_SoftCopy
Neil Turton's avatar
Neil Turton committed
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081

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
1082 1083 1084 1085 1086 1087 1088 1089 1090 1091

Serv_SysChains          # 4          ;anchor for block handling 'system' service numbers, in range 1 to 255
Serv_UsrChains          # 4          ;anchor for block handling 'user' service numbers, > 255
Serv_AwkwardChain       # 4          ;anchor for chain handling non-compliant modules (no service table)
 [ :DEF: ShowWS
      ! 0, "Serv_SysChains        at ":CC::STR:(Serv_SysChains)
      ! 0, "Serv_UsrChains        at ":CC::STR:(Serv_UsrChains)
      ! 0, "Serv_AwkwardChain     at ":CC::STR:(Serv_AwkwardChain)
 ]

Neil Turton's avatar
Neil Turton committed
1092 1093
DAList          #       4       ; Pointer to first node on dynamic area list

Neil Turton's avatar
Neil Turton committed
1094 1095 1096

                AlignSpace 16
AMBControl_ws   #       4       ; workspace anchor word for AMBControl
1097
DynArea_ws      #       4       ; workspace anchor word for data structures to accelerate OS SWIs for dynamic areas
1098
 [ :DEF: ShowWS
1099 1100
 ! 0, "AMBControl_ws         at ":CC::STR:(AMBControl_ws)
 ! 0, "DynArea_ws            at ":CC::STR:(DynArea_ws)
1101
 ]
1102

1103 1104
Oscli_CmdHashSum        # 4          ;for hashed command lookup
Oscli_CmdHashLists      # 4          ;anchor for hashed command lists structure
1105
 [ :DEF: ShowWS
1106 1107
      ! 0, "Oscli_CmdHashSum      at ":CC::STR:(Oscli_CmdHashSum)
      ! 0, "Oscli_CmdHashLists    at ":CC::STR:(Oscli_CmdHashLists)
1108
 ]
1109

Neil Turton's avatar
Neil Turton committed
1110

1111
                AlignSpace 16   ; skipped bit must start on 16-byte boundary (ClearPhysRAM does 4 words at a time for skipped areas)
Neil Turton's avatar
Neil Turton committed
1112
SkippedTables   #       0
1113

1114 1115 1116
PhysRamTable    #       0       ; Pairs of words (physaddr, size+flags)
                                ; indicating RAM present in machine
                                ; Unused entries have size of zero
Neil Turton's avatar
Neil Turton committed
1117
VideoPhysAddr   #       4       ; Address of video RAM (in the case of DRAM-only machines,
1118 1119 1120 1121
VideoSizeFlags  #       4       ; this is actually a chunk out of DRAM)
DRAMPhysAddrA   #       4       ; Next the DRAM
DRAMSizeFlagsA  #       4
                #       8 * 16  ; Space for 17 DRAM banks + 1 VRAM bank total
Neil Turton's avatar
Neil Turton committed
1122
PhysRamTableEnd #       0
1123 1124
DRAMPhysTableSize *     (PhysRamTableEnd-DRAMPhysAddrA) / 8

1125
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
1126
 ! 0, "VideoPhysAddr held at  ":CC::STR:(VideoPhysAddr)
1127
 ]
Neil Turton's avatar
Neil Turton committed
1128

1129
L2PTUsed        #       4       ; Amount of memory used for L2PT
Neil Turton's avatar
Neil Turton committed
1130 1131
SoftCamMapSize  #       4       ; Amount of memory (in bytes) used for soft CAM map
                                ; (whole number of pages)
1132

1133
                AlignSpace
1134
HAL_StartFlags  #       4
1135 1136
HAL_Descriptor  #       4
HAL_Workspace   #       4
1137
HAL_WsSize      #       4
1138

1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152
ICache_Info              #  0
ICache_NSets             #  4
ICache_Size              #  4
ICache_LineLen           #  1
ICache_Associativity     #  1

Cache_Type               #  1
Cache_Flags              #  1

DCache_Info              #  0
DCache_NSets             #  4
DCache_Size              #  4
DCache_LineLen           #  1
DCache_Associativity     #  1
1153 1154 1155

ProcessorArch            #  1
ProcessorType            #  1   ; Processor type (handles 600 series onwards)
1156 1157 1158 1159 1160 1161

DCache_CleanBaseAddress  #  0   ; word used either for IndexBit or CleanBaseAddress
DCache_IndexBit          #  4
DCache_CleanNextAddress  #  0   ; word used either for IndexSegStart or CleanNextAddress
DCache_IndexSegStart     #  4
DCache_RangeThreshold    #  4
1162 1163 1164 1165 1166 1167
                AlignSpace
ProcessorFlags           #  4    ; Processor flags (IMB, Arch4 etc)
 [ :DEF: ShowWS
 ! 0, "ProcessorType  at  ":CC::STR:(ProcessorType)
 ! 0, "ProcessorFlags at  ":CC::STR:(ProcessorFlags)
 ]
1168 1169 1170

                AlignSpace

1171
MMU_PPLTrans             #  4
Kevin Bracey's avatar
Kevin Bracey committed
1172
MMU_PCBTrans             #  4
1173
MMU_PPLAccess            #  4
Kevin Bracey's avatar
Kevin Bracey committed
1174

1175
Proc_Cache_CleanInvalidateAll     #       4
Jeffrey Lee's avatar
Jeffrey Lee committed
1176
Proc_Cache_CleanInvalidateRange   #       4
1177
Proc_Cache_CleanAll               #       4
1178
Proc_Cache_CleanRange             #       4
1179
Proc_Cache_InvalidateAll          #       4
1180
Proc_Cache_InvalidateRange        #       4
1181
Proc_Cache_RangeThreshold         #       4
1182
Proc_Cache_Examine                #       4
1183 1184
Proc_ICache_InvalidateAll         #       4
Proc_ICache_InvalidateRange       #       4
1185 1186
Proc_TLB_InvalidateAll            #       4
Proc_TLB_InvalidateEntry          #       4
1187 1188 1189 1190 1191 1192
Proc_DSB_ReadWrite                #       4
Proc_DSB_Write                    #       4
Proc_DSB_Read                     #       4
Proc_DMB_ReadWrite                #       4
Proc_DMB_Write                    #       4
Proc_DMB_Read                     #       4
1193 1194
Proc_IMB_Full                     #       4
Proc_IMB_Range                    #       4
1195
Proc_IMB_List                     #       4
1196 1197 1198 1199 1200 1201
Proc_MMU_Changing                 #       4
Proc_MMU_ChangingEntry            #       4
Proc_MMU_ChangingUncached         #       4
Proc_MMU_ChangingUncachedEntry    #       4
Proc_MMU_ChangingEntries          #       4
Proc_MMU_ChangingUncachedEntries  #       4
1202

1203
Cache_Lx_Info                     #       4       ; Cache level ID register
1204 1205 1206
Cache_Lx_MaxLevel                 *       2       ; Current machines have max of 2 cache levels
Cache_Lx_DTable                   #       4*Cache_Lx_MaxLevel ; Data/unified cache layout for all supported levels
Cache_Lx_ITable                   #       4*Cache_Lx_MaxLevel ; Instruction cache layout for all supported levels
1207
Cache_HALDevice                   #       4       ; Pointer to any HAL cache device we're using
Neil Turton's avatar
Neil Turton committed
1208 1209


1210 1211 1212
IOAllocPtr      #       4               ; current lowpoint of mapped I/O space (also upper limit on DAs)
IOAllocLimit    #       4               ; current lowest allowed I/O space (DA creation may move this up)

Neil Turton's avatar
Neil Turton committed
1213

1214
  [ :DEF: ShowWS
1215
        ! 0, "Free space before DebuggerSpace = ":CC::STR:(&300-@)
1216
 ]
1217

1218 1219
        ASSERT  @ <= &300
                        #       (&300-@)
1220
 [ :LNOT: HiProcVecs
1221 1222 1223 1224
; Note that this is currently located within the skipped region, even though it
; doesn't need to be. It was just an easy way of adding the IIC bus info to the
; region. The debugger will initialise DebuggerSpace on startup, so it doesn't
; matter that it doesn't get cleared during the main RAM clear.
1225 1226 1227 1228 1229 1230 1231 1232 1233
DebuggerSpace           #       16*8    ; Debugger module needs some zero page
DebuggerSpace_Size      *       ?DebuggerSpace

        ASSERT  DebuggerSpace =  Legacy_DebuggerSpace
        ASSERT ?DebuggerSpace = ?Legacy_DebuggerSpace
 |
DebuggerSpace           *       &2000   ; Debugger gets a page all to itself!
DebuggerSpace_Size      *       &1000
 ]
Kevin Bracey's avatar
Kevin Bracey committed
1234

1235
IICBus_Count       *    5 ; 5 buses is enough for all current machines
1236 1237
IICBus_Base        #    IICBus_Size*IICBus_Count

1238 1239
PageTable_PageFlags #   4               ; Page flags used for page tables. L2PT uses this directly, L1PT adds in PageFlags_Unavailable.

1240
                AlignSpace 16   ; skipped bit must end on 16-byte boundary (ClearPhysRAM does 4 words at a time for skipped areas)
1241 1242
SkippedTablesEnd #      0

Dan Ellis's avatar
Dan Ellis committed
1243
; NVRAM support
Kevin Bracey's avatar
Kevin Bracey committed
1244

Kevin Bracey's avatar
Kevin Bracey committed
1245 1246
NVRamSize          #    1               ; Size of NVRam (E2ROM & CMOS) fitted in 256byte units
NVRamBase          #    1               ; Base of NVRam
1247
NVRamSpeed         #    1               ; Clock hold time in 0.5us units
Kevin Bracey's avatar
Kevin Bracey committed
1248 1249
NVRamPageSize      #    1               ; Page size for writing (log2)
NVRamWriteSize     #    1               ; Size of writable region (256byte units)
Kevin Bracey's avatar
Kevin Bracey committed
1250

Kevin Bracey's avatar
Kevin Bracey committed
1251 1252
                   AlignSpace

Kevin Bracey's avatar
Kevin Bracey committed
1253

Kevin Bracey's avatar
Kevin Bracey committed
1254 1255 1256 1257
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
1258
MMUControlSoftCopy #    4               ; Soft copy of ARM control register
1259
IRQMax             #    4               ; from HAL_IRQMax
Ben Avison's avatar
Ben Avison committed
1260 1261
DeviceCount     #       4       ; size of our table of devices in the system heap
DeviceTable     #       4       ; pointer to table
1262

1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275
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       ; not used (was Address exception vector on 26-bit-only ARMs)
ProcVec_IRQ             #       4       ; IRQ vector
ProcVec_End             #       0

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

1276 1277
AplWorkSize * AppSpaceDANode + DANode_Size

1278 1279
ExtendedROMFooter # 4 ; Pointer to the extended ROM footer structure. 0 if not initialised, -1 if not found.

1280 1281
CPUFeatures # 2*4

1282
 [ :DEF: ShowWS
1283
        ! 0, "Free space after EnvString = ":CC::STR:(&500-@)
1284
 ]
Kevin Bracey's avatar
Kevin Bracey committed
1285

Neil Turton's avatar
Neil Turton committed
1286 1287 1288 1289 1290
        ASSERT  @ <= &500               ; a convenient address to remember
                #       (&500-@)

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

1291
 [ :DEF: ShowWS
1292
        ! 0, "Free space after CamMap debug block = ":CC::STR:((JordanWS+256*4)-@)
1293
 ]
Kevin Bracey's avatar
Kevin Bracey committed
1294

Neil Turton's avatar
Neil Turton committed
1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307
        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

1308
ROMPhysAddr     #       4
Neil Turton's avatar
Neil Turton committed
1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320

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

Jeffrey Lee's avatar
Jeffrey Lee committed
1321
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
1322 1323 1324 1325 1326 1327
 ! 0,"16 ":CC::STR:@
 ]
             AlignSpace 16

KeyWorkSpaceSize   *  &200
KeyWorkSpace       #  KeyWorkSpaceSize
1328
 [ :DEF: ShowWS
1329
      ! 0, "KeyWorkSpace          at ":CC::STR:(KeyWorkSpace)
1330
 ]
Neil Turton's avatar
Neil Turton committed
1331 1332 1333 1334 1335 1336 1337 1338 1339

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

1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351
; SWI hash table moved to OldIRQ1Vspace on 12-Nov-97, for Ursula (wider hashing)
;
; !!!! Free Space
;
  [ ChocolateSysHeap
ChocolateBlockArrays  #  0
ChocolateCBBlocks     #  4            ; -> array of quick access blocks for Callback
ChocolateSVBlocks     #  4            ; -> array of quick access blocks for software vectors
ChocolateTKBlocks     #  4            ; -> array of quick access blocks for tickers
ChocolateMRBlocks     #  4            ; -> array of blocks for ROM module nodes (reduces no. of individual blocks in heap)
ChocolateMABlocks     #  4            ; -> array of blocks for active module nodes (reduces no. of individual blocks in heap)
ChocolateMSBlocks     #  4            ; -> array of blocks for module SWI hash nodes (reduces no. of individual blocks in heap)
1352
 [ :DEF: ShowWS
1353 1354 1355 1356 1357 1358
      ! 0, "ChocolateCBBlocks     at ":CC::STR:(ChocolateCBBlocks)
      ! 0, "ChocolateSVBlocks     at ":CC::STR:(ChocolateSVBlocks)
      ! 0, "ChocolateTKBlocks     at ":CC::STR:(ChocolateTKBlocks)
      ! 0, "ChocolateMRBlocks     at ":CC::STR:(ChocolateMRBlocks)
      ! 0, "ChocolateMABlocks     at ":CC::STR:(ChocolateMABlocks)
      ! 0, "ChocolateMSBlocks     at ":CC::STR:(ChocolateMSBlocks)
1359
 ]
1360

1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371
; !!!! Free Space (40 bytes)
OldSWIHashspace    #  10*4
  |
; !!!! Free Space (64 bytes)
OldSWIHashspace    #  16*4
  ]

;
;was:
;ModuleSHT_Entries  *  16
;ModuleSWI_HashTab  #  4*ModuleSHT_Entries
Neil Turton's avatar
Neil Turton committed
1372 1373

Module_List        #  4
1374
 [ :DEF: ShowWS
1375
      ! 0, "Module_List           at ":CC::STR:(Module_List)
1376
 ]
1377

Neil Turton's avatar
Neil Turton committed
1378 1379 1380 1381 1382 1383 1384 1385
Curr_Active_Object #  4

; Vector Claim & Release tables etc

VecPtrTab          #  NVECTORS * 4

ExceptionDump      #  4

1386
OldGeneralMOSBuffer # 256+4      ;spare
Neil Turton's avatar
Neil Turton committed
1387

Jeffrey Lee's avatar
Jeffrey Lee committed
1388
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411
 ! 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

Kevin Bracey's avatar
Kevin Bracey committed
1412
SpriteSize      #       4       ; saved on startup for Sprite code
Neil Turton's avatar
Neil Turton committed
1413 1414 1415

TickNodeChain   #       4

Kevin Bracey's avatar
Kevin Bracey committed
1416 1417 1418
PIRQ_Chain      #       4
PFIQasIRQ_Chain #       4

Neil Turton's avatar
Neil Turton committed
1419 1420 1421 1422
; Workspace

EnvTime            #    5

1423 1424 1425
RedirectInHandle   #    1
        ASSERT  RedirectInHandle =  Legacy_RedirectInHandle
        ASSERT ?RedirectInHandle = ?Legacy_RedirectInHandle
Neil Turton's avatar
Neil Turton committed
1426

1427 1428 1429
RedirectOutHandle  #    1
        ASSERT  RedirectOutHandle =  Legacy_RedirectOutHandle
        ASSERT ?RedirectOutHandle = ?Legacy_RedirectOutHandle
Neil Turton's avatar
Neil Turton committed
1430 1431 1432 1433 1434

MOShasFIQ          #    1
FIQclaim_interlock #    1
CallBack_Flag      #    1
IRQ_CallBack_Flag * CallBack_Flag
Robert Sprowson's avatar
Robert Sprowson committed
1435 1436
MonitorLeadType    #    1       ; some function of the monitor lead inputs, as yet undetermined
MentionCMOSReset   #    1       ; non zero reports CMOS resets prior to the start banner
Neil Turton's avatar
Neil Turton committed
1437

Kevin Bracey's avatar
Kevin Bracey committed
1438
                AlignSpace
Neil Turton's avatar
Neil Turton committed
1439

Kevin Bracey's avatar
Kevin Bracey committed
1440
DUMPER          #       17 * 4  ; now 17 words for 32-bit
Neil Turton's avatar
Neil Turton committed
1441

Kevin Bracey's avatar
Kevin Bracey committed
1442 1443
                #       4       ; PxxxIRQ_Chain used to be here
Page_Size       #       4
Kevin Bracey's avatar
Kevin Bracey committed
1444
CMOSRAMCache    #       256
Neil Turton's avatar
Neil Turton committed
1445

1446 1447 1448 1449 1450 1451 1452 1453
; Was Free space (752 bytes) left by old IRQ despatch (new IRQ despatch moved as it required more space).
; Re-used for various purposes on 12-Nov-97, for Ursula
;
      ASSERT @ = &C34                            ;if fails, may need to rearrange padding to sort hash table alignment
;
ModuleSHT_Entries  *  128
ModuleSHT_Padding0 #  12                         ;spare, so that SWI hashtable is aligned for easy immediate address load
ModuleSWI_HashTab  #  4*ModuleSHT_Entries
1454
 [ :DEF: ShowWS
1455
      ! 0, "ModuleSWI_HashTab     at ":CC::STR:(ModuleSWI_HashTab)
1456
 ]
1457 1458
;
SysVars_StickyPointers # (10+1)*4                ;used if ChocolateSysVars is TRUE (1 dummy pointer for 0 size)
1459
 [ :DEF: ShowWS
1460
      ! 0, "SysVars_StickyPtrs    at ":CC::STR:(SysVars_StickyPointers)
1461
 ]
1462 1463
;
Abort32_dumparea   # 6*4          ;info for OS_ReadSysInfo 7 - 32-bit PSR, fault address, 32-bit PC (room for two copies)
1464
 [ :DEF: ShowWS
1465
      ! 0, "Abort32_dumparea      at ":CC::STR:(Abort32_dumparea)
1466
 ]
1467 1468 1469
;
Help_guard         # 4            ;for *help, guard against foreground re-entrancy (multiple taskwindows)
Help_msgdescr      # 4*4          ;for *help, 4 words MessageTrans descriptor
1470
 [ :DEF: ShowWS
1471
      ! 0, "Help_guard            at ":CC::STR:(Help_guard)
1472
 ]
1473 1474
;
PCI_status         # 4            ;bit 0 = 1 if PCI exists or 0 if PCI does not exist, bits 1..31 reserved (0)
1475
 [ :DEF: ShowWS
1476
      ! 0, "PCI_status            at ":CC::STR:(PCI_status)
1477
 ]
1478 1479 1480 1481
IOMD_NoInterrupt          # 4     ;no. of irq devices for extant IOMD
IOMD_DefaultIRQ1Vcode     # 4     ;default irq code start address (ROM) for extant IOMD
IOMD_DefaultIRQ1Vcode_end # 4     ;default irq code end address (ROM)
IOMD_Devices              # 4     ;default irq devices table address (ROM)
1482
 [ :DEF: ShowWS
1483
      ! 0, "IOMD_NoInterrupt      at ":CC::STR:(IOMD_NoInterrupt)
1484
 ]
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499
;
  [ mjsSysHeapNodesTrace
mjsSHNodesTrace_ws # 0
mjsSHNT_hcl_total  # 4    ;total calls to ClaimSysHeapNode
mjsSHNT_hfr_total  # 4    ;total calls to FreeSysHeapNode
mjsSHNT_hop_total  # 4    ;total calls to DoSysHeapOpWithExpansion
mjsSHNT_ohc_total  # 4    ;total calls to OS_Heap for SysHeap claim
mjsSHNT_ohf_total  # 4    ;total calls to OS_Heap for SysHeap free
mjsSHNT_ohx_total  # 4    ;total calls to OS_Heap for SysHeap expand or shrink
mjsSHNT_vcs_total  # 4    ;total SysVar ClaimVNode calls that picked up a sticky node
mjsSHNT_vch_total  # 4    ;total SysVar ClaimVNode calls that went to the heap for a node
mjsSHNT_vxs_total  # 4    ;total SysVar ExpandOrShrinkVNode calls that tried to do sticky change
mjsSHNT_vxh_total  # 4    ;total SysVar ExpandOrShrinkVNode calls that went to the heap
mjsSHNT_vfs_total  # 4    ;total SysVar FreeVNode calls that stuck
mjsSHNT_vfh_total  # 4    ;total SysVar FreeVNode calls that dropped a node to the heap
1500
 [ :DEF: ShowWS
1501 1502 1503 1504
      ! 0, ""
      ! 0, "**WARNING** compiling in code to trace some SysHeap node statistics (mjsSysHeapNodesTrace TRUE)"
      ! 0, ""
      ! 0, "mjsSHNodesTrace_ws    at ":CC::STR:(mjsSHNodesTrace_ws)
1505
 ]
1506 1507 1508 1509 1510 1511 1512 1513 1514 1515
ModuleSHT_Padding1 #  752-12-4*ModuleSHT_Entries-11*4-6*4-5*4-4-4*4-12*4 ;spare
  |
ModuleSHT_Padding1 #  752-12-4*ModuleSHT_Entries-11*4-6*4-5*4-4-4*4      ;spare
  ]
;
      ASSERT @ = &C34 + 752
;
;was:
;OldIRQ1Vspace       # 752

Neil Turton's avatar
Neil Turton committed
1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532

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
Kevin Bracey's avatar
Kevin Bracey committed
1533
HeapReturnedReg_PSR # 4                 ; also acts as interlock
Neil Turton's avatar
Neil Turton committed
1534 1535 1536 1537 1538 1539 1540 1541

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.
PortableFlags       #  1                ;
Jeffrey Lee's avatar
Jeffrey Lee committed
1542
PowerSave * &80                         ; Gets set in PortableFlags when we've switched to slow speed
Neil Turton's avatar
Neil Turton committed
1543 1544 1545 1546 1547 1548 1549

        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

1550 1551 1552 1553
 [ CacheCommonErrors
CachedErrorBlocks   #  4                ; pointer to sysheap node holding the error block cache
 ]

Jeffrey Lee's avatar
Jeffrey Lee committed
1554
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
1555 1556 1557 1558 1559 1560 1561 1562 1563
 ! 0, "low space free ":CC::STR:(&FE8-@)
 ]
 ASSERT @ < &FE8

; Words for old tools of assorted varieties
; Don't move the following as their positions are assumed by other modules

                        ^       &FE8
CLibCounter             #       1               ; Counter for Shared C Library tmpnam function
1564 1565
        ASSERT  CLibCounter =  Legacy_CLibCounter
        ASSERT ?CLibCounter = ?Legacy_CLibCounter
Neil Turton's avatar
Neil Turton committed
1566 1567 1568 1569 1570 1571 1572 1573 1574

        AlignSpace

; 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
1575 1576 1577
        ASSERT  RISCOSLibWord =  Legacy_RISCOSLibWord
        ASSERT ?RISCOSLibWord = ?Legacy_RISCOSLibWord

Neil Turton's avatar
Neil Turton committed
1578
CLibWord                #       4
1579 1580 1581
        ASSERT  CLibWord =  Legacy_CLibWord
        ASSERT ?CLibWord = ?Legacy_CLibWord

Neil Turton's avatar
Neil Turton committed
1582
FPEAnchor               #       4
1583 1584
        ASSERT  FPEAnchor =  Legacy_FPEAnchor
        ASSERT ?FPEAnchor = ?Legacy_FPEAnchor
Neil Turton's avatar
Neil Turton committed
1585

1586 1587 1588
DomainId                #       4       ; SKS added for domain identification
        ASSERT  DomainId =  Legacy_DomainId
        ASSERT ?DomainId = ?Legacy_DomainId
Neil Turton's avatar
Neil Turton committed
1589 1590 1591

Modula2_Private         #       4       ; MICK has FFC and uses it it in USR mode

1592 1593 1594
VduDriverWorkSpace      #       VDWSSize
        ASSERT  VduDriverWorkSpace =  Legacy_VduDriverWorkSpace
        ASSERT ?VduDriverWorkSpace = ?Legacy_VduDriverWorkSpace
Neil Turton's avatar
Neil Turton committed
1595 1596 1597 1598

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


Jeffrey Lee's avatar
Jeffrey Lee committed
1599
 [ :DEF: ShowWS
Neil Turton's avatar
Neil Turton committed
1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637
 ! 0, "high space free ":CC::STR:(&4000-@)
 ]

                        ^       &4000
ScratchSpaceSize        *       &4000

Export_ScratchSpace            #       ScratchSpaceSize
        ASSERT  Export_ScratchSpace =  ScratchSpace
        ASSERT ?Export_ScratchSpace = ?ScratchSpace

 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

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

                        ^       0
GSNameBuff              #       &100
GS_Stack                #       &200
GS_StackPtr_Lim         *       &200 / 4        ; Number of words in stack.
GS_StackPtr             #       4
Jeffrey Lee's avatar
Jeffrey Lee committed
1638
GSVarWSpace_Size        #       0
Neil Turton's avatar
Neil Turton committed
1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651

                        ^      @ + 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.

1652
OldAliasExpansionBuffer #       100     ;spare, mjs: shouldn't this have been &100 ??!??
Neil Turton's avatar
Neil Turton committed
1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663


; EvaluateExpression space. Calls ReadUnsigned, BinaryToDecimal and ReadVarVal.

ExprWSpace              *       @

                        ^       0, R12
exprBracDif             #       2       ; keep exprSTRACC aligned
tos_op                  #       2       ; 1 byte for use as STRACC-1
ExprSVCstack            #       4

1664 1665
ExprStackLimit          *       @ - exprBracDif + ExprWSpace + &100   ;keep 256 buffer zone for stack overflow
ExprStackStart          *       ScratchSpace + ScratchSpaceSize
Neil Turton's avatar
Neil Turton committed
1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693


; *****************************************************************************
; ***            Cursor, Sound DMA, SWI, and OSCLI workspace.               ***
; *****************************************************************************

TopOfDMAWorkSpace       *       CursorChunkAddress + 32*1024

                        ^       TopOfDMAWorkSpace ; Note we will be going down

; Sound

SoundWorkSpaceSize      *       &1000

Export_SoundDMABufferSize  *    &1000
        ASSERT  Export_SoundDMABufferSize =  SoundDMABufferSize

SoundEvtSize            *       &1000

Export_SoundDMABuffers         |#|     SoundDMABufferSize * 2
        ASSERT  Export_SoundDMABuffers =  SoundDMABuffers
        ASSERT ?Export_SoundDMABuffers = ?SoundDMABuffers

Export_SoundWorkSpace          |#|     SoundWorkSpaceSize + SoundEvtSize
        ASSERT  Export_SoundWorkSpace =  SoundWorkSpace
        ASSERT ?Export_SoundWorkSpace = ?SoundWorkSpace

; Cursor
1694 1695 1696 1697
; mjs Sep 2000, Kernel/HAL split
; Note that cursor data memory is expected to be uncacheable, since HAL may use it
; directly for h/w DMA. This may not be true since RO 3.7, but should be sorted
; eventually for next generation RO
1698 1699 1700 1701
;
; Currently (Jan 2013) only the sound DMA buffers are mapped in uncacheable.
; This means CursorData is mapped in cacheable, despite the OS treating it as
; uncacheable.
Neil Turton's avatar
Neil Turton committed
1702

1703
CursorDataSize          *       &600            ; four defined shapes, plus 2 holding shapes
Neil Turton's avatar
Neil Turton committed
1704 1705 1706
CursorData              |#|     CursorDataSize
CursorSoundRAM          *       CursorData

1707 1708
SPARE_oldCursorSpace    |#|     &200            ; padding to avoid changing exported addresses for now

Neil Turton's avatar
Neil Turton committed
1709 1710
; SWI despatcher

1711
BranchToSWIExit         |#|     4
Neil Turton's avatar
Neil Turton committed
1712

1713
SvcTable                |#|     &400
Neil Turton's avatar
Neil Turton committed
1714

1715
 [ SupportARMT
1716
   [ ZeroPage = 0
1717
SWIDespatch_Size        *       41*4
1718
   |
1719
SWIDespatch_Size        *       42*4
1720
   ]
1721
 |
1722
SWIDespatch_Size        *       39*4    ; can save 2 instructions if no Thumb
1723
 ]
Neil Turton's avatar
Neil Turton committed
1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749
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

1750
; IRQ despatch
Neil Turton's avatar
Neil Turton committed
1751

1752
MaxInterrupts           *       192     ; 192 needed by OMAP5. Increase in future if necessary.
1753
DefIRQ1Vspace           *       12*MaxInterrupts+128
Neil Turton's avatar
Neil Turton committed
1754 1755 1756

DefaultIRQ1V            |#|     DefIRQ1Vspace

Jeffrey Lee's avatar
Jeffrey Lee committed
1757
 [ :DEF: ShowWS
1758
 ! 0, "CursorChunkAddress free ":CC::STR:(@-CursorChunkAddress)
1759
 ]
Neil Turton's avatar
Neil Turton committed
1760

1761
 ASSERT @ >= CursorChunkAddress
Neil Turton's avatar
Neil Turton committed
1762 1763 1764 1765 1766

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

1767
                ^       SVCStackAddress
Neil Turton's avatar
Neil Turton committed
1768 1769

                       #       SVCStackSize    ; svcstk size. Overflow will give abort
1770
SVCSTK                 #       0
Neil Turton's avatar
Neil Turton committed
1771

1772
SysHeapStart           *       SysHeapAddress
Neil Turton's avatar
Neil Turton committed
1773

1774 1775 1776 1777 1778 1779 1780 1781 1782

; *****************************************************************************

    ASSERT            LongCLISize >= 256+4     ;minimum size of GeneralMOSBuffer

;Kernel buffers area

                      ^  KbuffsBaseAddress

Jeffrey Lee's avatar
Jeffrey Lee committed
1783 1784 1785 1786 1787 1788 1789
; 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).
1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805
GeneralMOSBuffer      #  LongCLISize

EnvString             #  LongCLISize

AliasExpansionBuffer  #  LongCLISize
ArgumentBuffer        *  AliasExpansionBuffer

ExprBuff              #  LongCLISize
exprSTRACC            #  LongCLISize

OscliBuffSize         *  LongCLISize
OscliNoBuffs          *  16
RedirectBuff          #  OscliBuffSize
OscliCircBuffStart    #  OscliBuffSize * OscliNoBuffs
OscliCircBuffLimit    #  0

Ben Avison's avatar
Ben Avison committed
1806 1807
GSVarWSpace           #  GSVarWSpace_Size

Jeffrey Lee's avatar
Jeffrey Lee committed
1808
SysVarWorkSpace	      #  40             ; used by the sys$* variables for reading the current time into
Ben Avison's avatar
Ben Avison committed
1809

1810 1811 1812 1813 1814
ROMBuildDate          #  128
 [ UseNewFX0Error
NewFX0Error           #  64
 ]

1815 1816
HeapBackgroundError   #  256 ; For storing errors generated in the background by the forced completion of a foreground heap op

1817 1818 1819
KbuffsEnd             #  0
KbuffsSize            *  KbuffsEnd - KbuffsBaseAddress  ;size of Kernel buffers area

1820
    ASSERT            ((KbuffsSize + &FFF) :AND: &FFFFF000) <= KbuffsMaxSize
1821 1822 1823 1824

      ! 0, "Kbuffs                at ":CC::STR:(KbuffsBaseAddress)
      ! 0, "Kbuffs Size           is ":CC::STR:(KbuffsSize)

1825
    [ {FALSE}
1826 1827 1828 1829 1830 1831 1832 1833
      ! 0, "GeneralMOSBuffer      at ":CC::STR:(GeneralMOSBuffer)
      ! 0, "EnvString             at ":CC::STR:(EnvString)
      ! 0, "AliasExpansionBuffer  at ":CC::STR:(AliasExpansionBuffer)
      ! 0, "ArgumentBuffer        at ":CC::STR:(ArgumentBuffer)
      ! 0, "ExprBuff              at ":CC::STR:(ExprBuff)
      ! 0, "exprSTRACC            at ":CC::STR:(exprSTRACC)
      ! 0, "RedirectBuff          at ":CC::STR:(RedirectBuff)
      ! 0, "OscliCircBuffStart    at ":CC::STR:(OscliCircBuffStart)
1834
    ]
1835 1836


Neil Turton's avatar
Neil Turton committed
1837 1838
        OPT     OldOpt
        END