// Swat.decl
// Copyright Xerox Corporation 1979, 1982
// Last modified May 6, 1982  3:39 PM by Taft

manifest
[
// swatVersion = ??	// Version number of Swat -- defined in SwatInit.bcpl
residentVersion = 25	// lowest resident version compatible
sysInOutVersion = 25	// lowest sysIn/Out version compatible

userPC = 700b		// User's state when Swat got control
userAC0 = 701b
userAC1 = 702b
userAC2 = 703b
userAC3 = 704b
userCry = 705b
dumperFlg = 706b	// 0 => Swatee created by InLd; -1 => by Dumper
userInt = 707b
lenState = userInt-userPC+1	// save 700B through 707B

generalTrap = 77400B	// General "Get me to swat" instruction
parityTrap = 77401B	// A parity error happened
callSwatTrap = 77402B	// User called CallSwat procedure
printErrorTrap = 77403B	// Print an error message from a file
screenTrap = 77404B	// Return from UserScreen ↑U
callReturnTrap = 77405B	// Return from proc called by Swat
breakPtTrap = 77406B	// Normal break point
mpBrkPtTrap = 77407B	// Mulitple proceed break point
kbdTrap = 77410B	// <Control><Left-Shift><Swat>
abortTrap = 77411B	// <Left-Shift><Swat>
teleSwatTrap = 77412B	// Be a TeleSwat Server
]

//----------------------------------------------------------------------------
structure VM:		// Virtual Memory
//----------------------------------------------------------------------------
[
fetch word		// val = Fetch(addr)
store word		// Store(addr, val)
swap word		// Swap()
cache word		// Cache(action) -- see below
print word		// Print(verbose)
destroy word		// Destroy()
type word		// disk, XMem, net
name word		// -> string
]
manifest lenVM = size VM/16

manifest
[
// virtual memory types
vmTypeDisk = 1
vmTypeCore = 2
vmTypeNet = 3

// action arguments to VMCache
vmFlush = 1		// flush dirty buffers
vmReset = 2		// mark all buffers empty (forget everything)
vmFlushReset = 3	// flush dirty buffers then forget everything
]

//----------------------------------------------------------------------------
structure String [ length byte; char↑1,1 byte ]
//----------------------------------------------------------------------------

//----------------------------------------------------------------------------
structure SERHead:	// Swat Error Report Header
//----------------------------------------------------------------------------
[
type word		// Error type
AltoVersion word	// What kind of Alto we are on.
OsVersion word		// What the version of the OS running
]

manifest
[
serTypeParity = 1	// parity error report
serTypeSoft = 2		// software error report (177403b type trap)
]

manifest
[
lenSI = 6		// must agree with SwatInsAnal.bcpl
lenMPBP = lenSI + 2
lenCodeVector = 35
numMPBP = 2
]

//----------------------------------------------------------------------------
structure SCM:		// Swat Communication Table.  567 always points here
//----------------------------------------------------------------------------
[
blank word		// contains "Jmp TrapHandler"
version word		// Version number
resumeFlag word		// non zero => jump to code vector after InLd
blank word		// (spare) pads FPs into published positions
fpSwatee word 5		// FP for Swatee
fpSwat word 5		// FP for Swat
mpbp word lenMPBP*numMPBP // Multiple proceed breakpoint table
simIns word		// double indirect pointer to SimIns routine
codeVector word lenCodeVector
]
manifest lenSCM = size SCM/16

manifest
[
versionOffset = offset SCM.version/16
codeVectorOffset = offset SCM.codeVector/16
resumeOffset = offset SCM.resumeFlag/16
swatOffset = offset SCM.fpSwat/16
swateeOffset = offset SCM.fpSwatee/16
mpbpOffset = offset SCM.mpbp/16
]

// definitions for executing code out of extended memory (xmFlag)
manifest
[
stackBottom = -1
xPC = -2
xJmp = -3
xArgs = -4
stringList = -5

xJmp0 = 64034b
xJmp1 = 64035b
xJmp2 = 64036b
xJmp3 = 64037b
xJmpInstMask = 177774b
xJmpBankMask = 3
]