// SysDefs.D -- OS definitions for users

// Last modified December 27, 1978  12:16 AM by Boggs

manifest
[
nOsVersion = 16
nOsVersionCompatible = 16

// *****  F I N I S H    C O D E S  *****
fcOK = 0
fcAbort = 1
]

// *****  E V E N T   T Y P E S  *****

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

manifest		//registered event types
[
eventBooted = 1
eventAboutToDie = 2
eventInstall = 3
eventRFC = 4
eventInLd = 5
eventCallSubsys = 6
eventEFTP = 7
]

// *****  U S E R   P A R A M S   F O R M A T  *****

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

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

lUserParams = 16
lInLdMessage = 19
]

// *****  J U N T A   L E V E L   N A M E S  *****

//----------------------------------------------------------------------------
manifest
//----------------------------------------------------------------------------
[
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
levDirectory = 9
levKeyboard = 10
levDisplay = 11
levMain = 12

levTotal = 12		//Most capable level
]

// ***** K E Y B O A R D *****

//----------------------------------------------------------------------------
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	//Code to use if shift is on
NormCode bit 8	//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
]

// ***** B C P L   F R A M E S *****

//----------------------------------------------------------------------------
structure FRAME:
//----------------------------------------------------------------------------
[
callersFrame word
savedPC word
temp word
extraArguments word
formals ↑0,100 word
]