DDKBusTest.mesa
Don Curry February 5, 1987 0:16:16 am PST
DIRECTORY
DragOpsCross,
DragOpsCrossUtils,
HandCoding,
HandCodingPseudos,
HandCodingSupport,
Rope;
DDKBusTest: CEDAR PROGRAM
IMPORTS DragOpsCrossUtils, HandCoding, HandCodingPseudos, HandCodingSupport
= BEGIN OPEN DragOpsCrossUtils, HandCoding, HandCodingPseudos, HandCodingSupport;
instrSize:    AuxRegSpec = [aux[10]]; -- must contain the length of trapping instructns
underflowHandler: AuxRegSpec = [aux[12]];
All: PROC = {
GenLSUnderflowKernel: PROC RETURNS [ lsUnderflowKernel: Label ] = {
sLimitValue: [0..128) = 16;
UnderflowHandler must have been set.
underflowTrap: Label;
lsUnderflowKernel ← GenLabelHere[]; -- one frame on IFU stack
drLIB[sLimitValue];
drSIP[DragOpsCross.ProcessorRegister[ifuSLimit].ORD];
GetEldestPC[]; -- pops IFU stack to EU stack top
drSFC[]; -- Call caller's return PC (underflowTrap pushed onto IFU stack)
underflowTrap ← GenLabelHere[]; -- no frames on stack
drROR[c: pushDst, a: const0, b: underflowHandler];
drSFC[];
drJB[UseLabel8A[underflowTrap]]};
FillTrap: PROC [ trap: DragOpsCross.TrapIndex, label: Label ] = {
oldPC: LONG CARDINAL = GetOutputPC[];
SetOutputPC[DragOpsCrossUtils.TrapIndexToBytePC[trap]];
drJDB[UseLabel16[label]]; -- go to trap handler
SetOutputPC[oldPC]};
M A I N L I N E C O D E
LSUnderflowKernel:   Label = GenLSUnderflowKernel[];
Start:       Label = GenLabel[];
FillTrap[ResetTrap, Start ];
Start
SetLabel[ Start ]; -- gets here from reset in kernel mode with traps off
Set up EU SLimit and install IFU stack underflow service routine (kernel mode, traps off)
drLFC[UseLabel16[ LSUnderflowKernel ]];
Exercise KBus
drLIQB[ CardToWord[000000000H]];
SetEldestPC[];
GetEldestPC[];
drLIQB[ CardToWord[055555555H]];
SetEldestPC[];
GetEldestPC[];
drLIQB[ CardToWord[0FFFFFFFFH]];
SetEldestPC[];
GetEldestPC[];
drLIQB[ CardToWord[0AAAAAAAAH]];
SetEldestPC[];
GetEldestPC[];
drLIQB[ CardToWord[000000000H]];
End of test
Halt[0FFFFH]}; -- end of test
END.