// P R I N T I N I T // errors 1100 // get "Spruce.d" get "Orbit.d" // outgoing procedures external [ PrintInit ] // incoming procedures external [ SpruceError; SpruceCondition //FLOAT FLDI FTR; FCM; FLD; FML; FDV //SPRUCEML MulDiv // SprucePrintRes PrintSetParameters ROSStatus //OS Zero MoveBlock StartIO CallSwat ] // incoming statics external [ ResolutionS ResolutionB ScanLengthInches PaperSpeedInches ScanMarginAdjust BitMarginAdjust DutyCycle Facets PolygonRatio printerDevice Debug Func // Set here, based on above values AdapterScales BitClock MotorSpeed LineSyncDelay PageSyncDelay VideoGate scanTicks signalBand nVisibleBands nLeadingBands nTrailingBands FA ] // File-wide structure and manifest declarations. manifest RTC=430b // ~~ should be manifest, after correct value known static gateWidener = 2 // Procedures // PrintInit // directive=0 ... standard // directive=1 ... power on // directive=2 ... power off let PrintInit(directive) be [ // Parameters of printer mentioned in Orbit writeup: // Paper speed: PaperSpeedInches (inches/second * 100) // Duty cycle: d (percent) // ScanLength: ScanLengthInches (inches*10) // Facets: f // (Code assumes 24 clocks/polygon revolution) let d,f,r=DutyCycle, Facets, PolygonRatio let printerSimple = printerDevice eq printerSequoia let density = (printerDevice eq printerPuffin)?2,1 //orbit doubles scan lines for puffin let v = vec 20 Func = (v+1)&(-2) // For Orbit microcode control table let machineSerial = ROSStatus(11) // ~~ interim version differentiation if (printerDevice eq printerDover) & ( machineSerial ge SerialDoverHesso) do [ d = 90; f = 12; r = 12 ] /// belongs in installation ~~~~~~~~~~~~~ // Decide which adapter we are using: let Tadapter=true // if printerDevice eq printerDurango then Tadapter=false // Parameters of the adapter mentioned in the writeup. // bcMax: MHz // crystalClock: 250 or 125 (units of 100 KHz) let bcMax,crystalClock=20,125 unless Tadapter then bcMax,crystalClock=60,250 // Parameters relating to choice of band position on page: nLeadingBands=4 // selecton printerDevice into [ // case printerDurango: 0 // default: 4 // ] nTrailingBands=2 // selecton printerDevice into [ // case printerDurango: 0 // default: 2 // ] // Now do some calculations: // Scan ticks (see SprucePrint) for "laser on test" scanTicks = MulDiv(106, 1000, (ResolutionS*density/10)*(PaperSpeedInches/100)) lshift 6 // Motor speed settings FLDI(1, ResolutionS*density) // scaled by 10 FLDI(2, PaperSpeedInches) // scaled by 100 FML(1, 2) FLDI(2, f) FDV(1, 2) Op10(1, -3) //AC1=MotorRPS (eliminate scale factors) FLDI(2, crystalClock) Op10(2, 5) FDV(2, 1) FLDI(3, r*256) //r * 2**8 FDV(2, 3) //AC2= (4096-MotorSpeed)/Scale(MotorScale) let motorScale=7 [ FLDI(3, 1 lshift motorScale) FML(3, 2) FLDI(4, 4096) if FCM(3, 4) ls 0 then break motorScale=motorScale-1 ] repeat MotorSpeed=4096-FTR(3) //BitClock calculation FLDI(2, ScanLengthInches) FLDI(3, ResolutionB) FML(2, 3) //AC2 = Bh*100 FLD(3, 2) FLDI(4, 4) FDV(3, 4) Op10(3, -2) BitClock=4096-FTR(3) //Now for BitRate (in MHz) FLDI(3, d) FDV(2, 3) FML(2, 1) FLDI(3, f) FML(2, 3) Op10(2, -6) //AC2 = BitRate (MHz) FLDI(3, 10); FML(3, 2) if FTR(3) gr 230 then SpruceCondition(1100,ECFileTerminate) let bitScale=7 [ FLDI(3, 1 lshift bitScale) FLDI(4, bcMax) FML(3, 4) FDV(3, 2) let a=FTR(3) if a ls 256 then break bitScale=bitScale-1 ] repeat // set up actual adapter argument here, because both PrintSetParameters() and Print() use it AdapterScales = adSetScales + bitScale lshift 9 + motorScale lshift 6 // Adapters with serial numbers less than SerialLineMod count the Scan delay with // a signal 1/4 the rate of the line counter; later adapters use the line counter directly // Line delay is still figured in terms of 1/4 the rate of the bit clock LineSyncDelay=4096-BitMarginAdjust/4 PageSyncDelay=4096-(ScanMarginAdjust*density)/(machineSerial