// P R I N T
// errors 1700
//
//December 5, 1977: broken up into multiple files:
//PrintSlot,PrintSlow,PrintDebug
//
// Procedures to accomplish the "printing" function
//
// PrintInit(firstTime)
//Called at the beginning of the print run.
// PrintClose(finalTime)
//Called at the end of the print run.
// Print(pg, last, firstAdr, lastAdr)
//Called to print the page described by pg>>PageG.
//
//November 29, 1983 10:33 AM (Ramshaw): added second timeout
// arg to PrintError, in case problem is one that is likely to fix itself.
//March 26, 1981 4:29 PM: added test to see if anything to print on a page
//be for calling PrintSlow when its TC200 Printer
//April 19, 1979: added params to PrintInit to allow creation of
//printing queue for Puffin
get "PressInternals.df"
get "PressParams.df"
// outgoing procedures
external
[
PrintInit
PrintClose
PrintError
Print
]
// outgoing statics
//external
//[
//]
//static
//[
//]
// incoming procedures
external
[
//Printing modules
PDisplay//PrintDebug
PSLOTDisplay//SlotDebug
PSlow;VersatecRoutine;VersatecInit;VersatecClose
HgRoutine;HgInit;HgClose//PrintDiablo
PSlot;SLOTInit//PrintSlot
POrbit;POrbitInit//PrintOrbit
//PRESSML
DoubleAdd
Ugt
//OS
Zero
MoveBlock
Timer
//PRESS
PressError
DblShift
FSGet
FSPut
MulDiv
//CURSOR
CursorChar
CursorDigit
CursorToggle
]
// incoming statics
external
[
Debug
printerDevice
printerForward
nPrinterColors
UserPageStart
UserPageEnd
]
// internal statics
static
[
//Debugging stuff
printCall
]
// File-wide structure and manifest declarations.
manifest
[
RTC = #430
]
// Procedures
//Someday, may want to:
//Set up a SwatContextProc to turn off the printer
//if you fall into swat when it is running. This would be made simple
//if ucode were changed to interpret at 0 in #720 as a reset reqest.
//Then could: @#720=0; StartIO(4)
//p is a pointer to pages structure
//nPages is the number of defined pages
let PrintInit(firstTime,p,nPages,nCopies) be
[
printCall=PrintInit//%%
CursorChar($P)
CursorToggle(3)
unless Debug then switchon printerDevice into
[
case printerSlot: SLOTInit();endcase
case printerVersatec: if firstTime then VersatecInit(); endcase
case printerHg: if firstTime then HgInit();endcase
case printerPuffin:
POrbitInit(p,nPages,nCopies)
endcase
case printerDover: //endcase intentionally omitted
case printerDurango: //endcase intentionally omitted
case printerSequoia: //endcase intentionally omitted
case printerPimlico: POrbitInit();endcase
default:endcase
]
printCall=PrintInit+1//%%
]
and PrintClose(finalTime) be
[
printCall=PrintClose//%%
if (finalTime ne 0)&(Debug eq 0) then switchon printerDevice into
[
case printerVersatec: VersatecClose();endcase
case printerHg: HgClose();endcase
default:
]
printCall=PrintClose+1//%%
]
and Print(pg, last, firstAdr, lastAdr) be
[
printCall=Print//%%
CursorDigit(pg>>PageG.PageNumber)
CursorToggle(3)
CursorToggle(2)//For several copies of same page
let numBands=pg>>PageG.LastBand-pg>>PageG.FirstBand+1
if Debug then
[ if numBands gr 0 then
test printerDevice le printerDurango
then PDisplay(pg)
or PSLOTDisplay(pg)
return
]
switchon printerDevice into
[
case printerSlot:PSlot(pg, numBands, last, firstAdr, lastAdr)
endcase;
case printerVersatec:PSlow(VersatecRoutine, pg)
if numBands le 0 then return//Empty page
endcase;
case printerHg:if numBands le 0 then return//Empty page
PSlow(HgRoutine, pg)
endcase;
case printerPuffin:
if (not pg>>PageG.ColorUsed)&
(nPrinterColors ne 3)&
(pg>>PageG.ColorPass ne 0) then return
case printerDover:
case printerDurango:
case printerSequoia:
case printerPimlico:
[
let nPagesAlreadyPrinted=0
let FailureCode=nil
let stop=last%
(printerForward?(pg>>PageG.PageNumber eq UserPageEnd),
(pg>>PageG.PageNumber eq UserPageStart))
POrbit(pg,firstAdr,lastAdr,nPagesAlreadyPrinted,lv FailureCode,stop)
endcase
]
default:endcase
]
printCall=Print+1//%%
]
and PrintError(code, ms; numargs n) be
[let cursor=vec 15
MoveBlock(cursor, #431, 16)
if n ge 1 then [ CursorChar($K);CursorDigit(code)]
let timeout = @RTC + ms/37
//Wait for return key to go down and up:
until ((@#177036
) eq 0) % ((n ge 2) & (@RTC ge timeout))
do loop
while (@#177036
) eq 0 do loop
MoveBlock(#431, cursor, 16)
]