SoftcardDataExchUtilImpl.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Ch Le Cocq, September 1, 1988
Christian Le Cocq November 22, 1988 12:52:06 pm PST
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];
};
dumpAbLimit: NAT ← 128;
DumpZone: PUBLIC PROC [z: Zone, s: IO.STREAM, showContent: BOOLEANTRUE] ~ TRUSTED {
Description of the procedure.
r: REF TEXTNEW[TEXT[32*1024-1]];
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]];
};
IF r.length<dumpAbLimit THEN IO.PutF[s, "\t\t Content: %g\n", IO.text[r]]
ELSE {
totalLength: CARD ← r.length;
r.length ← 48;
IO.PutF[s, "\t\t Ab. content: %g /.../ ", IO.text[r]];
FOR i: CARD32 IN [totalLength-24..totalLength) DO
IO.PutChar[s, r[i]];
ENDLOOP;
IO.PutChar[s, '\n];
};
};
ENDLOOP;
};
END.