// P R I N T O R B I T H D W F N S // errors 3400,3500 get "PDInternals.d" get "Orbit.d" // outgoing procedures external [ InitializeHardware DoFunc ROSCommand AdCommand SetupAdapter AddQEntry FeedASheet AwaitPageSync ROSCheck ] // outgoing statics external [ Func ] static [ Func ] // incoming procedures external [ MoveBlock StartIO ] // incoming statics external [ printerDevice useStandardQueue nPrinterColors Debug //PRINT ORBIT debugTrail //PRINTORBITINIT BitScale MotorScale BitClock MotorSpeed LineSyncDelay PageSyncDelay VideoGate ] //internal statics static [ rosCount = 0 //P,Pimlico command count rosSyncError = false // Pimlico -- sync problem jogT1 = 10*27 jogT2 = 6*27 ] // File-wide structure and manifest declarations. manifest [ RTC=#430 ] // ROSCheck values structure CT: [ invert bit 1 failureCode bit 7 wordIndex bit 4 bitIndex bit 4 ] manifest // factors for creating table entries [ Invert = #100000 Code = 256 Word = 16 Bit = 1 ] manifest [ //P commands PResetRemoteQueue=#63010 PStartRemoteQueue=#63006 PStart3ColorVideo=#63346 PStart3ColorScan=#63246 PStart4ColorVideo=#63306 PStart4ColorScan=#63206 PAppendQueueEntry=#63020 PSetVideo=#63204 PNoPaperAction=#63003 PFeedPaper=#63203 PReleasePaper=#63103 PSinglePass=#63303 PNoColor=#63001 PSetColor6=#63201 //usually black PSetColor7=#63101 //usually cyan PSetColor9=#63041 //usually magenta PSetColor11=#63021 //usually yellow //P printSeq states (these are simply pseudo malFunction codes) Pwarmup=#301 Pstandby=#302 Pprinting=#303 Pendofrun=#304 Plowpaper=#305 Pbadfeed=#306 Pbadstrip=#307 Pclearing=#310 PmalfClear=#311 Pillegal1=#312 Pillegal2=#313 ] // ----------------------------------------- // Low-level Orbit functions. // ----------------------------------------- let InitializeHardware(stop) be [ if Debug return DoFunc(fControl, 1) //Reset Orbit switchon printerDevice into [ case printerDover: ROSCommand(adExternalCommand1); endcase case printerPimlico: case printerPuffin: ROSCommand(#60000, false) // Reset command count if stop then ROSCommand(#63040) // Stop now. rosSyncError = false ROSCommand(#60000, false) // Reset command count ROSCommand(#63050) // Read out malfunction data, clear malf. // ROSCommand(#63217) // SetPageSyncEvent to 25 endcase ] ] and DoFunc(function, arg1, arg2, arg3, arg4, arg5, nil,nil,nil,nil,nil) = valof [ compileif DebugSw then [ DebugEnter(function, arg1) ] if Debug then resultis 0 if Func eq 0 then [ Func= table [ 0;0;0;0;0;0;0;0;0;0;0;0;0;0 ] Func=(Func+1)&(-2) ] MoveBlock(Func, lv function, 11) if function eq fStatus then Func!0=fDBCWIDIn // if refreshIdle then @Func=(@Func)%#100000 // Give pointer to microcode stuff. @#720=Func // Wake up microcode StartIO(#4) // Wait for microcode to complete if function ne fSlot then while @#720 ne 0 do loop if function eq fStatus then resultis Func!9 resultis Func!8 ] and DebugEnter(a, b) be [ compileif DebugSw then [ let m=debugTrail!0 let dm=debugTrail+m dm!1=a; dm!2=b; dm!3=@RTC //Time m=m+3; if m ugr debugTrail!1 then m=1 debugTrail!0=m ] ] and ROSStatus(w) = DoFunc(fROSStatus, w*(4*256)) and ROSCommand(x, sync; numargs na) be switchon printerDevice into [ case printerPuffin: na=2;sync=1;//endcase intentionally omitted case printerPimlico: [ if na<2 then sync = 4 test x eq #60000 then rosCount=0 or if printerDevice eq printerPuffin then rosCount=(rosCount+1) rem 256 let good = true for i = 1 to sync? sync, 1 do [ DoFunc(fROSCommand, x) unless sync break let tim = @RTC; good = false while (@RTC-tim) le 25 do if rosCount eq (ROSStatus(12)Ź) then [ good = true; break ] if good then break ROSCommand(#60000, false) rosSyncError = false ] unless good do rosSyncError = true unless printerDevice eq printerPuffin do rosCount = (rosCount+1) rem 256 endcase ] default: DoFunc(fROSCommand, x) ] and AdCommand(x) be DoFunc(fROSCommand, x) // ----------------------------------------- // Initialize adapter. // ----------------------------------------- and SetupAdapter() be [ DoFunc(fControl, 1) //Reset Orbit for i=0 to 15 do //Set inkwell [ DoFunc(fXY, i lshift 12) DoFunc(fInk, -1) ] AdCommand(adBufferReset) AdCommand(adSetScales+BitScale lshift 9+MotorScale lshift 6) AdCommand(adBitClock+BitClock) AdCommand(adMotorSpeed+MotorSpeed) AdCommand(adLineSyncDelay+LineSyncDelay) AdCommand(adPageSyncDelay+PageSyncDelay) AdCommand(adVideoGate+VideoGate) // Try to empty Orbit buffers to clear them. This is to minimize // toner dumping on first (blank) page. let dump=vec 256 for i=0 to 31 do DoFunc(fReadBlock, 256, dump) ] // ----------------------------------------- // Utility functions. // ----------------------------------------- and AddQEntry(color, paperAction) be [ ROSCommand(PAppendQueueEntry) ROSCommand(PSetVideo) ROSCommand(color) ROSCommand(paperAction) ] and FeedASheet() be switchon printerDevice into [ case printerDover: ROSCommand(adExternalCommand1+1) ROSCommand(adExternalCommand1) endcase case printerSequoia: ROSCommand(60000b) ROSCommand(60001b) endcase case printerPimlico: case printerPuffin: if useStandardQueue then //Use standard 3 or 4 color queue ROSCommand((nPrinterColors eq 3? #63346,#63306)) endcase ] //Wait for page sync to equal given value. // Returns true if there was nothing unexpected and AwaitPageSync(ps) = valof [ if Debug then resultis true let tim=@RTC [ if (@RTC-tim) gr 5*27 then resultis false DoFunc(fControl, 0) //Read ROS special status (1st four bits of status word 0) let f=Func!9 if f<