DiabloImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last Edited: Rumph, May 21, 1984 12:55:31 pm PDT
Tim Diebert: September 26, 1985 3:55:22 pm PDT
DIRECTORY
Diablo,
PrincOpsUtils USING [BITOR],
Printer USING [WritePrinter],
Rope USING [ROPE];
DiabloImpl: CEDAR PROGRAM
IMPORTS Diablo, PrincOpsUtils, Printer
EXPORTS Diablo = BEGIN OPEN Printer;
Strobe: WORD = 100000B;
Error: PUBLIC ERROR [reason: Rope.ROPE] = CODE;
PutChar: PUBLIC SAFE PROC [char: CHAR] = TRUSTED {
ENABLE UNWIND => NULL;
c: WORDLOOPHOLE[char];
timeOutCnt: CARDINAL ← 0;
IF Diablo.Fault[] THEN ERROR Error["Diablo has a fault."];
UNTIL Diablo.Ready[] DO
timeOutCnt ← timeOutCnt + 1;
IF timeOutCnt = LAST [CARDINAL] THEN ERROR Error["Diablo failed to become ready."];
ENDLOOP;
WritePrinter[c]; -- set up the data
WritePrinter[PrincOpsUtils.BITOR[c, Strobe]]; -- strobe the data
WritePrinter[c]; -- clear the strobe
};
END.