LarkControl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
L. Stewart, December 21, 1983 3:58 pm
Swinehart, December 17, 1986 10:32:12 pm PST
DIRECTORY
BasicTime USING [GMT, nullGMT],
ChoiceButtons USING [EnumTypeRef],
IO USING [STREAM],
LarkPrograms USING [Program],
MBQueue USING [Queue],
Pup USING [Address, Net, nullAddress],
ReadEvalPrint USING [Handle],
Rope USING [ROPE],
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: Pup.Net ← [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: Pup.Address ← Pup.nullAddress,
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,
applicationMode: CHAR ← '\040 , -- denotes state of application for this Lark.
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 address.[net, host] = [[0], [0]] then returns the LarkControl viewer log stream for some network. If address.[net, host] = [[net], [0]] then returns the LarkControl viewer log stream for the given net. If address.[net, host] = [[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 [netAddress: Pup.Address] RETURNS [log: IO.STREAM];
GetLogStream: GetLogStreamProc;
Aquire the data structure for a particular Lark.
GetLark: PROC [address: Pup.Address] 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];
SetApplicationMode: PROC[lark: LarkData, mode: CHAR];
END.
April 25, 1983 12:49 pm, LCS, created
June 21, 1983 2:41 pm, LCS, Added GetStream stuff
May 15, 1986 5:04:15 pm PDT, LCS, Changed LarkIndex to 240, LarkControlDataObject, LarkDataObject, June
Swinehart, May 15, 1986 5:03:24 pm PDT
Cedar 6.1
changes to: DIRECTORY, GetLogStreamProc, GetLark
Swinehart, December 17, 1986 10:24:43 pm PST
Add SetApplicationMode
changes to: LarkDataObject, VerifyInternal, SetApplicationMode