// SysDefs.D -- OS definitions for users
// Copyright Xerox Corporation 1979, 1981
// Last modified October 27, 1981  4:56 PM by Boggs

manifest
[
nOsVersion = 20
nOsVersionCompatible = 16

// finish codes
fcOK = 0
fcAbort = 1
]

//----------------------------------------------------------------------------
structure EVM:		// Event message.  0 terminates
//----------------------------------------------------------------------------
[
type bit 12
length bit 4
]

manifest		// registered event types
[
eventBooted = 1		// boot button hit or BootFrom(...)
eventAboutToDie = 2
eventInstall = 3	// install this core image
eventRFC = 4
eventInLd = 5		// call InLd(eventBody, eventBody)
eventCallSubsys = 6	// no string => call the Ftp hidden inside the OS
eventExecuteCode = 7	// execute body of event as BCPL procedure
]

//----------------------------------------------------------------------------
structure UPE:		// User Parameters. 0 terminates
//----------------------------------------------------------------------------
[
type bit 12
length bit 4
]

manifest
[
globalSwitches = 1	// From Executive: body is ASCII codes (1 per word)
openStreams = 2		// Interpretation is private, but type is public
privateType = 4000b	// Start assigning private types here

lUserParams = 16
lInLdMessage = 19
]

//----------------------------------------------------------------------------
manifest		// Junta level names
//----------------------------------------------------------------------------
[
levBasic = 0		// Basic level (Swat, finish)
levBuffer = 1		// Keyboard item buffer
levFilePointers = 2
levBcpl = 3		// BCPL runtime support
levStatics = 4
levBFSbase = 5
levBFSwrite = 6
levAlloc = 7
levStreams = 8
levScan = 14
levDirectory = 9
levKeyboard = 10
levDisplay = 11
levMain = 12
// levCompat used to be 13 -- deimplemented as of OS16, March 79

levTotal = 12		// Most capable level
]

//----------------------------------------------------------------------------
structure KBTRANS:
//----------------------------------------------------------------------------
[
Transition word  = 	// First word ne 0 => some key transitioned:
   [
   GoingDown bit	// True if keyIndex descending
   GoingUp bit
   KeyIndex bit 14	// Index of moving key if any
   ]
KeyState word 5		// Table of key state after transition
CursorX	word		// Present location of cursor
CursorY	word
]

//----------------------------------------------------------------------------
structure KBKEY:
//----------------------------------------------------------------------------
[
Letter bit		// True if char is a letter (use for lock interp)
ShiftCode bit 7		// Ascii code to use if shift is on
NormCode bit 8		// Ascii code to use otherwise
]

//----------------------------------------------------------------------------
structure OsBUF:
//----------------------------------------------------------------------------
[
First word		// -> first word of ring buffer
Last word		// -> last word of ring buffer+1
In word			// -> place to put next item
Out word		// -> next item to take
]

//----------------------------------------------------------------------------
structure FRAME:	// A BCPL stack frame
//----------------------------------------------------------------------------
[
callersFrame word	// -> callers frame
savedPC word		// return address
temp word		// used by get frame
extraArguments word	// 3rd arg or frame offset of arg vec if numargs>3
formals↑0,100 word
]