{
ENABLE
UNWIND => {
ShutupMicrocode[];
[]← SafeStorage.SetCollectionInterval[oldGC];
Process.SetPriority[Process.priorityNormal];
succeeded ← FALSE;
FlushQueue[];
};
InitializeRCBChain:
PROC [
bitmap:
LONG
POINTER,
words:
CARDINAL,
lines:
CARDINAL,
fMargin:
CARDINAL ← 0,
sMargin:
INTEGER ← 2700,
sRepeat, fRepeat:
INTEGER ← 0,
sReverse, fReverse:
BOOLEAN ←
FALSE,
fMosaic:
BOOLEAN ←
FALSE,
sSkip:
CARDINAL ← 0,
bitsPerSample: [0..bitsPerWord] ← 1,
invert:
BOOL ←
FALSE] ~
TRUSTED {
InitializeRCB[rcb: tailRCB];
InitializeCCB[ccb: tailCCB, halftoneCtl: [invertMask: ~invert]];
InitializeRCB[
rcb: mainRCB,
next: tailRCB,
bitmap: bitmap,
activeWordsPerLine: words,
wordsPerLine: words*(sSkip+1),
lines: lines,
fMargin: fMargin,
sRepeat: sRepeat,
fRepeat: fRepeat,
sReverse: sReverse,
fReverse: fReverse,
mosaic: fMosaic,
bitsPerSample: bitsPerSample
];
InitializeCCB[
ccb: mainCCB,
next: tailCCB,
lines: lines,
halftoneCtl: [invertMask: ~invert]
];
IF sMargin > 0
THEN {
InitializeRCB[rcb: leadRCB, next: mainRCB, lines: sMargin];
InitializeCCB[ccb: leadCCB, next: mainCCB, lines: sMargin, halftoneCtl: [invertMask: ~invert]];
mrb.rcb[A] ← leadRCB;
mrb.ccb ← leadCCB;
}
ELSE {mrb.rcb[A] ← mainRCB; mrb.ccb ← mainCCB};
};
i: VM.Interval ← VM.SimpleAllocate[1];
leadRCB: RCBPointer ← LOOPHOLE[VM.AddressForPageNumber[i.page]];
i2: VM.Interval ← VM.SimpleAllocate[1];
mainRCB: RCBPointer ← LOOPHOLE[VM.AddressForPageNumber[i2.page]];
i3: VM.Interval ← VM.SimpleAllocate[1];
tailRCB: RCBPointer ← LOOPHOLE[VM.AddressForPageNumber[i3.page]];
i4: VM.Interval ← VM.SimpleAllocate[1];
leadCCB: CCBPointer ← LOOPHOLE[VM.AddressForPageNumber[i4.page]];
i5: VM.Interval ← VM.SimpleAllocate[1];
mainCCB: CCBPointer ← LOOPHOLE[VM.AddressForPageNumber[i5.page]];
i6: VM.Interval ← VM.SimpleAllocate[1];
tailCCB: CCBPointer ← LOOPHOLE[VM.AddressForPageNumber[i6.page]];
ib: VM.Interval ← VM.SimpleAllocate[2 * hardwareScanlinePages];
zeros: LONG POINTER ← VM.AddressForPageNumber[ib.page];
repCnt: INTEGER ← currentParameters.sRepeat;
copyCnt: INT ← 0;
VM.Pin[ib];
PrincOpsUtils.LongZero[zeros, 2 * hardwareScanlineWords]; -- fill the scan line with zeros
VM.Pin[i]; VM.Pin[i2]; VM.Pin[i3]; VM.Pin[i4]; VM.Pin[i5]; VM.Pin[i6];
InitializeRCBChain[bitmap: zeros, words: hardwareScanlineWords, lines: 2, sMargin: 0];
ResetMicrocode[];
SetUpForRosClock[];
SetUpForRealLineSync[];
[] ← StartMicrocode[mrb];
Process.Pause[Process.MsecToTicks[1000]]; -- wait for microcode to transfer data
ShutupMicrocode[];
zeros ← NIL;
InitializeRCBChain[
bitmap: ImagerSample.GetBase[sampleMap].word,
words: ImagerSample.GetBitsPerLine[sampleMap]/PrincOps.bitsPerWord,
lines: ImagerSample.GetSize[sampleMap].s/(currentParameters.sSkip+1),
fMargin: currentParameters.fMargin,
sMargin: currentParameters.sMargin,
sRepeat: repCnt,
fRepeat: currentParameters.fRepeat,
sReverse: currentParameters.sReverse,
fReverse: currentParameters.fReverse,
sSkip: currentParameters.sSkip,
fMosaic: currentParameters.fMosaic,
bitsPerSample: ImagerSample.GetBitsPerSample[sampleMap]
];
[] ← SafeStorage.SetCollectionInterval[LAST[INT]/4];
Process.SetPriority[Process.priorityForeground];
FOR timer:
INT ← 0, timer+1
DO
IF GetPageSync[] THEN EXIT;
Process.CheckForAbort[];
ENDLOOP;
[] ← StartMicrocode[mrb];
Process.SetPriority[Process.priorityNormal];
[] ← SafeStorage.SetCollectionInterval[oldGC];
Process.CheckForAbort[];
FOR timer:
INT ← 0, timer+1
DO
IF NOT GetPageSync[] THEN EXIT;
Process.CheckForAbort[];
Process.Yield[];
ENDLOOP;
ShutupMicrocode[];
VM.Unpin[i]; VM.Unpin[i2]; VM.Unpin[i3]; VM.Unpin[i4]; VM.Unpin[i5]; VM.Unpin[i6];
VM.Unpin[ib];
VM.Free[i]; VM.Free[i2]; VM.Free[i3]; VM.Free[i4]; VM.Free[i5]; VM.Free[i6];
VM.Free[ib];
mrb.rcb[A] ← leadRCB ← mainRCB ← tailRCB ← NIL;
mrb.ccb ← leadCCB ← mainCCB ← tailCCB ← NIL;
};