DDStatusTest:
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 = {
StackedStatusToWord:
PROC
[ s: DragOpsCross.StackedStatusWord, sense: {normal, complemented} ← normal ]
RETURNS [ w: DragOpsCross.Word ] = TRUSTED
{w ← LOOPHOLE[s]; IF sense = complemented THEN w ← DragOpsCrossUtils.DragNot[w]};
GenSetL:
PROC
RETURNS [
cycleL: Label ] = {
cycleL ← GenLabelHere[];
drLIQB[StackedStatusToWord[[lBase: 0FFH], complemented]];
GetEldestStatus[];
drAND[];
drOR[];
SetEldestStatus[];
drRETN[]};
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
SetL: Label = GenSetL[];
Start: Label = GenLabel[];
FillTrap[ResetTrap, Start ];
Start
SetLabel[ Start ]; -- gets here from reset in kernel mode with traps off
Do L tests
drLIB[04H];
drLFC[UseLabel16[SetL]]; drLIB[0FH]; drSRn[reg0]; drLRn[reg0]; drDIS[]; drASL[0];
drLIB[08H];
drLFC[UseLabel16[SetL]]; drLIB[0FH]; drSRn[reg0]; drLRn[reg0]; drDIS[]; drASL[0];
drLIB[10H];
drLFC[UseLabel16[SetL]]; drLIB[0FH]; drSRn[reg0]; drLRn[reg0]; drDIS[]; drASL[0];
drLIB[20H];
drLFC[UseLabel16[SetL]]; drLIB[0FH]; drSRn[reg0]; drLRn[reg0]; drDIS[]; drASL[0];
End of test
Halt[0FFFFH]};
-- end of test
END.