// P D    F I L E    F O R M A T

structure LongCard:
[
	low	word
	high	word
]

structure PDH:		//Herald
[
	password	word
	version		word
	deviceCode	word
	sResolution	word
	fResolution	word
	imageSSize	word
	imageFSize	word
	bandSSize	word
	maxLoadWord	@LongCard
	copies	word
]
manifest lPDHerald=size PDH/16

manifest PDPasswd=#125252

structure Command:
[
	typ	bit 2
	com	bit 6
	rest bit 8
]

manifest [
// Types
	typImaging=2
	typControl=0
// Mask types
	maskSamplesRef=0
	maskRunGroupRef=1
	maskRectangle=2
	maskTrapezoid=3
	maskRunGroup=4
	maskSamples=5
	colorSamples=6
		imagingMax=6
// Control codes
	startImage=0
	setPriority=1
	setColorInk=2
	setColorClear=3
	setColorTile=4
	endBand=5
	endDocument=6
	storeLoad=7
	deviceCommand=8
		controlMax=8
// T types
	opaque=0
	transparent=1
]

structure SampleArray:
[
	sSize	word
	fSize	word
]

structure Tile:
[
	phase	word
	sMin	word
	fMin	word
	@SampleArray
]

structure RunGroup:
[
	sSize	word
]

structure Run:
[
	fMin	word
	lastRun bit
	fSize	bit 15
]

structure MaskRectangle:
[
	sMin	word
	sSize	word
	fMin	word
	fSize	word
]

structure MaskTrapezoid:
[
	sMin	word
	sSize	word
	fMin	word
	fSize	word
	fMinLast	word
	fSizeLast	word
]

structure MaskRunGroup:
[
	sMin	word
	@RunGroup
]

structure MaskSamples:
[
	sMin	word
	fMin	word
	@SampleArray
]

structure MaskRunGroupRef:
[
	addr	word
	sMin word
	fMin	word
]

structure MaskSamplesRef:
[
	addr	word
	sMin word
	fMin	word
]

structure ColorSamples:
[
	sMin	word
	fMin	word
	@SampleArray
]


structure StartImage:
[
	x	bit 9
	M	bit 1
	F	bit 1
	S	bit 1
	toner	bit 4
	passBands	word
	nBands	word
	fMinPage	word
	fSizePage	word
]

structure ColorTileRef:
[
	addr	@LongCard
]

structure StoreLoad:
[
	addr	@LongCard
	wordCount	word
]

manifest [
	bandMode=0
	leftOverMode=1
	noFeedSheet=0
	feedSheet=1
	noStripSheet=0
	stripSheet=1
	tonerBlack=0
	tonerCyan=1
	tonerMagenta=2
	tonerYellow=3
]