SoftcardDataExchUtilImpl.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Ch Le Cocq, September 1, 1988
Christian Le Cocq October 6, 1988 1:32:51 pm PDT
Christophe Cuenod September 12, 1988 5:59:31 pm PDT
Various low level hacks on 6085 <-> Sparc communication
DIRECTORY
IO,
SoftcardDataExchImpl,
SoftcardUtil;
SoftcardDataExchUtilImpl: CEDAR PROGRAM
IMPORTS IO, SoftcardDataExchImpl, SoftcardUtil
SHARES SoftcardDataExchImpl
~ BEGIN OPEN SoftcardDataExchImpl;
Dump
Dump: PUBLIC PROC [s: IO.STREAM, showContent: BOOLEANTRUE] ~ {
Description of the procedure.
IO.PutRope[s, "6085 "];
DumpZone[data.myZone, s, showContent];
IO.PutRope[s, "Sparc "];
DumpZone[data.hisZone, s, showContent];
};
DumpZone: PUBLIC PROC [z: Zone, s: IO.STREAM, showContent: BOOLEANTRUE] ~ TRUSTED {
Description of the procedure.
r: REF TEXTNEW[TEXT[2048]];
IO.PutF[s, "Zone: %x\n", IO.card[z.a]];
IO.PutF[s, "lastWritten: %d\n", [cardinal[SoftcardUtil.GetCard32[[z.a+lastWritten]]]]];
IO.PutF[s, "lastRed : %d\n", [cardinal[SoftcardUtil.GetCard32[[z.a+lastRed]]]]];
FOR i: CARD32 IN [0..maxHeaders) DO
hr: HeaderRec ← GetHeaderRec[z, i];
IO.PutF[s, "msg #%d: ", IO.card[i]];
IO.PutF[s, "b: %d, l: %d, t:%d, d1: %d, d2: %d\n", IO.card[hr.b], IO.card[hr.size], IO.card[hr.type], IO.card[hr.data1], IO.card[hr.data2]];
IF showContent AND hr.size>0 THEN {
bufHead, bufTail: Block;
r.length ← hr.size;
bufHead ← hr.b;
bufTail ← IF bufHead+hr.size>bufSize THEN hr.size-bufSize+bufHead ELSE bufHead+hr.size;
IF bufHead<=bufTail THEN {
SoftcardUtil.CopyFrom[r, 0, hr.size, [z+buffer+bufHead/2]];
}
ELSE {
SoftcardUtil.CopyFrom[r, 0, bufSize-bufHead, [z+buffer+bufHead/2]];
SoftcardUtil.CopyFrom[r, bufSize-bufHead, bufTail, [z+buffer]];
};
IO.PutF[s, "\t\t Contents: %g\n", IO.text[r]];
};
ENDLOOP;
};
END.