// Resist.decl

// Last modified by McCreight June 25, 1984  10:21 AM

// ---------------------------------------------------------------------------
structure Pin:		// Information about IC pin
// ---------------------------------------------------------------------------
[
expectedOhmsCode byte	// code for expected resistance to power/ground
measuredOhmsCode byte	// code for measured resistance
nextPin word		// -> next pin in net
]
manifest lenPin = size Pin/16

// ---------------------------------------------------------------------------
structure IC:		// IC object, accessed by board location name
// ---------------------------------------------------------------------------
[
next word		// -> next IC in sort order
package word		// -> package type symbol
   [
   type word		// -> IC type symbol
   nPins word		// number of pins on package
   ] =
   stopPin @Pin		// stopPin.nextPin must overlay IC.nPins
pins↑1,1 @Pin		// Pin descriptions -- must immediately follow stopPin
]
manifest lenIC = offset IC.pins/16

// ---------------------------------------------------------------------------
structure Net:		// Net object, accessed by net name
// ---------------------------------------------------------------------------
[
   [
   firstPin word	// -> first pin in net
   blank word		// = 0 to terminate net
   ] =
   dummyPin @Pin	// dummyPin.nextPin must overlay Net.blank
]
manifest lenNet = size Net/16

manifest
[
// special resistance values
short = 0
open = 177776B
unknown = 177777B
openCode = 376B
unknownCode = 377B

// max number of pins on an IC
defaultMaxNPins = 26

// symbol types
stDummy = 0
stIC = 1
stICType = 2
stICPackage = 3
stNet = 4
]

// ---------------------------------------------------------------------------
structure TesterOut:	// Utility output register
// ---------------------------------------------------------------------------
[
blank bit 1
signal bit 1		// audible signal (0 = on)
channel bit 6		// ohmmeter channel number (inverted)
dac bit 8		// digital-to-analog converter (inverted)
]

// ---------------------------------------------------------------------------
structure TesterIn:	// Utility input register
// ---------------------------------------------------------------------------
[
comparator bit 1	// DAC/channel comparator (1 => DAC > channel)
switch bit 1		// foot switch (0 => depressed)
blank bit 14
]

manifest
[
// ohmmeter channel assignments
chanCal0 = 0		// 0 ohms (permanently wired, for calibration)
chanCal50 = 1		// 50 ohms
chanCal100 = 2		// 100 ohms
chanSingle = 3		// single probe
chanCal5k = 4		// 4.990k ohms
chanPin1 = 8		// 16-pin DIP, channel 1

stuffedErrorTolerance = 12  // % resistance error tolerated on stuffed board
unstuffedErrorTolerance = 7  // -- on unstuffed board
]

// ---------------------------------------------------------------------------
structure String: [ length byte; char↑1,1 byte ]
// ---------------------------------------------------------------------------

// ---------------------------------------------------------------------------
structure PermZone:	// Zone for permanent, unfreeable objects
// ---------------------------------------------------------------------------
[
Allocate word
Free word
underlyingZone word
currentBlock word
wordsLeft word
threshold word
]
manifest lenPermZone = size PermZone/16

manifest
[
permIncrement = 256
permThreshold = 16 // ~ square root of permIncrement
]