LarkControl.mesa
L. Stewart, December 21, 1983 3:58 pm
Last Edited by: Swinehart, June 15, 1984 1:36:08 am PDT
DIRECTORY
BasicTime USING [GMT, nullGMT],
ChoiceButtons USING [EnumTypeRef],
IO USING [STREAM],
LarkPrograms USING [Program],
MBQueue USING [Queue],
PupTypes USING [fillInPupAddress, PupAddress, PupNetID],
ReadEvalPrint USING [Handle],
Rope USING [ROPE],
RPCPkt USING [Machine],
TeleLoad USING [Advice, CoreAddress, EventProc, EventRecordObject, Handle, State8086Object, TeleLoadProc],
ViewerClasses USING[Viewer];
LarkControl: CEDAR DEFINITIONS =
BEGIN
cRUNNING: CARDINAL = 0FF00H;
cDown: CARDINAL = 0EFFFH;
Data: TYPE = REF LarkControlDataObject;
LarkControlDataObject:
TYPE =
RECORD[
mainSwitch: MainSwitchStates ← off,
mainSwitchController: ChoiceButtons.EnumTypeRef ← NIL,
out: IO.STREAM ← NIL,
mbQueue: MBQueue.Queue ← NIL,
viewer: ViewerClasses.Viewer ← NIL, -- self
larksY: INTEGER ← 0, -- y position and height of the per-lark viewer
larksH: INTEGER ← 0,
maxW: INTEGER ← 0,
buttH: INTEGER ← 0,
pleaseStop: BOOL ← FALSE,
script: ViewerClasses.Viewer ← NIL, -- typescript
eventLark: LarkIndex ← FIRST[LarkIndex],
anyEvent: BOOL ← FALSE,
net: PupTypes.PupNetID ← [173B],
larks: ARRAY LarkIndex OF LarkData ← ALL[NIL] -- per lark data
];
MainSwitchStates: TYPE = {off, manual, auto};
LarkIndex: TYPE = [100B..240B);
LarkData: TYPE = REF LarkDataObject;
Data structure for each Lark
LarkDataObject:
TYPE =
RECORD [
world: Data ← NIL, -- back pointer
address: PupTypes.PupAddress ← PupTypes.fillInPupAddress,
nameRope: Rope.ROPE ← NIL, -- pup internet name, if any
addressRope: Rope.ROPE ← NIL, -- pup internet address, in rope form
rName: Rope.ROPE ← NIL, -- typically "173#101#.lark"
userRName: Rope.ROPE ← NIL, -- typically "Stewart"
program: LarkPrograms.Program ← NIL, -- loaded program
slaveProgram: LarkPrograms.Program ← NIL, -- slave memory contents
larkMode: CHAR ← 'U,
state: TeleLoad.State8086Object, -- really should be [ALL[0]]
event: TeleLoad.EventRecordObject,
newEvent: BOOL ← FALSE,
expectEvent: BOOL ← FALSE,
expectedEventType: CARDINAL,
h: TeleLoad.Handle ← NIL,
eval: ReadEvalPrint.Handle ← NIL,
breakList: LIST OF Breakpoint ← NIL,
lastBoot: BasicTime.GMT ← BasicTime.nullGMT,
lastBootTimeValid: BOOL ← FALSE,
viewers for each Lark which need to be relabelled
userRNameViewer: ViewerClasses.Viewer ← NIL,
mode: ViewerClasses.Viewer ← NIL,
debug: ViewerClasses.Viewer ← NIL,
status: ViewerClasses.Viewer ← NIL
];
Breakpoint: TYPE = REF BreakpointObject;
BreakpointObject:
TYPE =
RECORD [
address: TeleLoad.CoreAddress,
codeByte: CARDINAL
];
ShortCoreAddress: TYPE = CARDINAL;
LoadProgram: PROC [lark: LarkData, go: BOOL, main: BOOL];
global variables
loadWindowLow: TeleLoad.CoreAddress;
loadWindowHigh: TeleLoad.CoreAddress;
routines for manipulating a lark
use for zapping and starting, always works from state
SetState: PROC [h: TeleLoad.Handle, state: TeleLoad.State8086Object, tp: TeleLoad.TeleLoadProc, print: BOOL ← TRUE] RETURNS [ok: BOOL];
fetch state block and optionally set advice
FetchState: PROC [h: TeleLoad.Handle, adv: TeleLoad.Advice ← [FALSE, FALSE, 0], print: BOOL ← TRUE] RETURNS [ok: BOOL, state: TeleLoad.State8086Object];
Print state on stream
DisplayState: PROC [s: IO.STREAM, state: TeleLoad.State8086Object, indent: NAT ← 0];
Alter a variable
SetValue: PROC [lark: LarkData, name: Rope.ROPE, value: CARDINAL, offset: NAT ← 0, print: BOOL ← FALSE] RETURNS [ok: BOOL];
Go, using appropriate technique if a beakpoint is set
LocalGo: PROC [lark: LarkData];
Return the rope reason corresponding to a particular boot code.
BootReason: PROC [reason: CARDINAL, BX: CARDINAL ← 0] RETURNS [Rope.ROPE];
Format an event listing.
DisplayEvent: PROC [lark: LarkData, event: TeleLoad.EventRecordObject, out: IO.STREAM, reasonRope: Rope.ROPE, preRope: Rope.ROPE, short: BOOL ← FALSE];
Read the state of a Lark, if possible.
PollLark: PROC [lark: LarkData, print: BOOL ← FALSE, setPointers: BOOL ← TRUE] RETURNS [reason: Rope.ROPE];
Print events in a useful way
NoteEvents: TeleLoad.EventProc;
Put the codebyte back
RepairBreakpoint: PROC [h: TeleLoad.Handle, breakpoint: Breakpoint];
Try to cause a watchdog timer boot by jumpint to the lark location Boot
BootLark: PROC [lark: LarkData];
Aquire Lark data from Grapevine
LarkGVSet: PROC [lark: LarkControl.LarkData, setMode: BOOL, setProgram: BOOL];
Reload and restart the Lark, if it seems appropriate.
ConsiderActionFurther: PROC [lark: LarkData, event: TeleLoad.EventRecordObject];
Paint the mode viewer acording to lark.larkMode.
PaintMode: PROC [lark: LarkData];
Start or stop the process that prints event notifications.
StartWatcher: PROC;
StopWatcher: PROC;
NotifyWatcher: PROC;
Return a list of LarkControl records
GetInstanceList: PROC RETURNS [LIST OF REF ANY];
Print lark and the time and the rope.
LogEntry: PROC [lark: LarkData, rope: Rope.ROPE ← NIL, endWithCR: BOOL ← FALSE];
Aquire the IO output stream for a particular Lark. If machine = [[0], [0]] then returns the LarkControl viewer log stream for some network. If machine = [[net], [0]] then returns the LarkControl viewer log stream for the given net. If machine = [[net], [host]] then returns the log stream for the given lark, which will be a debug viewer if there is one and the LarkControl viewer log stream for the given net if there is no debug viewer.
GetLogStreamProc: TYPE = PROC [machine: RPCPkt.Machine] RETURNS [log: IO.STREAM];
GetLogStream: GetLogStreamProc;
Aquire the data structure for a particular Lark.
GetLark: PROC [machine: RPCPkt.Machine] RETURNS [lark: LarkData];
Check the contents of Lark memory against the given program.
VerifyInternal: PROC [lark: LarkControl.LarkData, program: LarkPrograms.Program, startAddress, stopAddress: TeleLoad.CoreAddress];
END.
April 25, 1983 12:49 pm, LCS, created
June 21, 1983 2:41 pm, LCS, Added GetStream stuff
June 21, 1983 2:41 pm, LCS, Changed LarkIndex to 240