// PDInternals.d -- Definitions universal to PD printing code.
// derived from PressInternals.df 2/7/83

// Parameters

manifest [
//Maximum number of pages to scan convert at once
	nPagesAtOnce=20
//Switches
	DebugSw=true
	MeterSw=false		//Do metering.
	]

// File stuff

manifest
 [				//Must be ne 0 for WindowChangeType
   FILERW=1			//Read-write
   FILERO=2			//Read only
   FILEWO=3			//Write only

   FILEBits=0			//Bit-map output file
   FILEScratch=1		//Scratch file
   FILELeftOver1=2		//Left-over files
   FILELeftOver2=3		//	"
   FILEMeter=4
   FILEPDProgram=5	//The program file for overlays
   FILEPD=1000		//The PD file !!!!!!!!

   FILEInitMax=5		//All files up to this one are to be initialized
 ]

structure F:			//"FILE" structure
 [
   Type	word			//Type of file (read only, etc.)
   Name	word			//"Name" (integer code)
   Device	word		//Device code (see DISKxxx, below)
   Pagesize word		// -- page size of device
   LogPagesize word		// -- and its log base 2
   Pagecnt	word		//Length in pages
   fp 	word 3 =
	[
	serialNumber word 2
	version word		//File ID for BFS
	]
   DAFirst	word		//If non-zero, page n is at logical
				// adr DAFirst+n.
   fmap word 0			// ISF fmap (if file is random allocated)
 ]

manifest
 [
   DISK31=0			//File resides on Model 31
   DISK31B=1			//Second model 31 disk
   DISKT80=2			//File resides on T80 or T300 disk if file ge 2
				//File=2+(drive*3)+partition
   NTridentDrives=8
   NPartitions=3
 ]

// Window Stuff

manifest
 [				//Must be ne 0 for WindowChangeType
   WINDOWNoStrategy=1		//No special windowing strategy
   WINDOWPageAhead=2		//Read on ahead.
 ]


structure block :		//Describes a buffer in core.
 [
   CoreAdr	word		//Core address of buffer.
   PN		word		//File page number in this buffer.
   Age		word		//For LRU strategy
   Status	word		//For clean,dirty
 ]

structure W :			//Window descriptor. 
 [
   spare1	word		//Leave a few here so that people who
   spare2	word		//use windows for other purposes can
   spare3	word		//define structures that have special
   spare4	word		//purpose entries here

   Base		word		//For current buffer
   Offset	word		//  "
   WhichByte	word		//=0 for left, 1 for right.
   ByteCount	word		//Bumped for each "byte" read
   File		word		//File for this window.
   Strategy	word		//Paging strategy
   BufSize	word		//Size of the buffer
   LogBufSize	word		//Log (base 2) of buffer size
   CurPN	word		//Current page number
   CurBuf	word		//Current "buffer" structure
   NumBlocks	word		//Number of available block strs.
   @block↑1,40
 ]


// Page stuff

structure PageG :		//Page Goodie block
 [
   BandWidth	word		//Number of scan-lines per band
   FirstBand	word		//Lowest used band
   LastBand	word		//Highest used band
   BitMargin	word		//Margin and
   BitWc	word		//Word count of scan lines
   BitPage	word		//File position of bits (units = 1024 words)
   ColorPass	bit 2	//for color printers: 0=black, 1=cyan, 2=magenta, 3=yellow
   feed	bit
   strip	bit
   blank	bit 12
 ]
manifest lPageG=(size PageG)/16

// Format of Bits File:
//		# page descriptions
//		..followed by PageG structures for each page

// P R I N T E R S

// Output device definitions:
manifest [
	printerDover=0
	printerSequoia=1
	printerPimlico=2
	printerPenguin=3
	printerPuffin=4
	printerSlot=5
	printerVersatec=6
	printerHg=7
	]
manifest printerOrbitLast=printerPuffin

// Directive indications
manifest [
	dirPDScan=1		//Scan convert from PD file
	dirPatterns=2		//Make test patterns
	dirPrint=4		//Print on requested device
	dirDisplay=8		//Show on screen
	]

// MicroCode Trap values

manifest [
	NoTrap=#55001		//STA 3,1,2

// Print phase
	PrintVersatecTrap=#70000
	PrintHgTrap=#70001
	]

// Metering definitions

// Meter "type" codes
manifest
 [
   METERRead=0			//Page read (FLStat)
   METERWrite=1			//Page write (FLStat)
   METEREnd=127			//Last of all....
 ]

structure METERH:
 [
   Type	byte			//Op code
   Count	byte		//Number of words (inc this one)
 ]

structure METERTimes:
 [
   TimeIn	word		//Times for a pass
   TimeOut	word
 ]