// IfsXEmulator.decl -- definitions for IFS Extended Emulator
// Copyright Xerox Corporation 1980

// Last modified March 18, 1980  7:23 PM by Taft

//----------------------------------------------------------------------------
structure Frame:  // Normal frame
//----------------------------------------------------------------------------
[
callersFrame word
savedPC word		// -> xArgs during extended call from this frame
temp word
extraArguments word
formals↑1,1 word
]

//----------------------------------------------------------------------------
structure XFrame:  // Extended frame
//----------------------------------------------------------------------------
[
stringList word		// xArgs-relative offset of first string, if any
xArgs word		// # args in extended call from this frame
xJmp word		// XJMP n, executed upon return to this frame
xPC word		// real PC, in bank given by xJmp
stackBottom word	// -> real bottom of frame (below extension & strings)
frame word = @Frame	// regular Bcpl frame.  *** AC2 points here ***
]

manifest
[
offsetXFrame = -5	// start of XFrame relative to frame

stringList = -5		// frame-relative offsets of XFrame fields
xArgs = -4
xJmp = -3
xPC = -2
stackBottom = -1
]

//----------------------------------------------------------------------------
structure XString:  // String in extended frame
//----------------------------------------------------------------------------
[
callPC word		// PC of "JSR .+n" call to generate string
nextOffset word		// string-relative offset of next string, 0 => no more
string:			// start of string itself
   [ length byte; char↑1,1 byte ]
]

manifest
[
callPC = -2		// string-relative offsets of XString fields
nextOffset = -1
]

manifest
[
// Opcodes
XJMP0 = 64034B		// XJMP0+b switches to bank b and jumps @.+1
STA3JSRI = 66000B	// STA3JSRI x performs STA 3 1 2; JSR @x

// Extended interrupt and trap addresses (page 1)
interruptXJmp = 627B	// XJMP b -- interruptPC (500B) points here
interruptXPC = 630B	// real PC
trapXJmp = 631B		// XJMP b -- trapPC (527B) points here
trapXPC = 632B		// real PC
]