//routemwdc1.bcpl
// Board-specific Route routines for the De/Compress ECL Multi-Wire Logic Board

// Part 1 of 2, last modified by S. Tom Chang, February 5, 1979 2:15 PM

get "route.defs"

static [ maxICs = 450; boardInterfaceVersion = interfaceVersion ]

external [ Pin1of8 ] // defined elsewhere

let DeclareInitialNets(BuildTWNet, BuildTermNet, BuildConnector) be
[
BuildConnector("E", 200, EPinPos)
BuildTWNet("GND", 230, GNDPinPos)
BuildTWNet("VCC", 161, VCCPinPos)
BuildTWNet("VTT", 120, VTTPinPos)
BuildTWNet("VEE", 230, VEEPinPos)
BuildTermNet("Term100/8/Term100", 8, "Term100", 840, AutoTermPinPos,"T")
]

and ZeroTablePoint(point) = selecton point into
[
case 0: "DC" // board type
case 1: "Z-j1.8" // ????????
case 2: "Z-E96"
case 3: "Z-E3"
case 4: "Z-VCC8"
default: empty
]

and LevelTransform(level, x, y, px, py, pName, pPullComponents, pWire; numargs na) = valof
[
DefaultArgs(lv na, -1, 0, 0, lv na, lv na, lv na, lv na, lv na)
switchon level into
[
case TopLevel:
@px = x
@py = 508-y
@pName = "Component side"
@pPullComponents = true
@pWire = false
resultis true

case BottomLevel:
@px = x
@py = y
@pName = "Wiring side"
@pPullComponents = false
@pWire = true
resultis true

default: resultis false
]
]

and EPinPos(icinst, pin, px, py) = valof
[
let pve = pin rem 100
if (pin ls 1)%(pve gr 98) then resultis illegal // pins 99,100,199,200 not used
if ((pve eq 96)%(pve eq 97)%(pve eq 98)) then resultis illegal // -5.2 volts
if ((pve eq 93)%(pve eq 94)) then resultis illegal // -2 volts
let pv = pin rem 50
if ((pv eq 0)%(pv eq 1)) then resultis illegal // +5 volts
let pg = pin rem 10
if (pg eq 0) then resultis illegal // ground Epins
let pd = 99 - (pin rem 100)
@px = pd*4 - 4 + (pd le 48?0,20)
@py = 508 - ((pin - 1)/100)*4
resultis absolute
]

and VTTPinPos(icinst, pin, px, py, pInfo; numargs na) = valof
[
DefaultArgs(lv na, -4, lv na)
@pInfo = noDisconnect+noReconnect+TopLevel
if (pin le 1)%(pin eq 10) then [ @px = 408; @py = 508; resultis absolute ]
if pin le 120 then
[
pin=pin-1
let VttRow = pin/10
let VttCol = 10 - (pin rem 10)
@px = 36*VttCol + (VttCol ge 7?28,0)
@px = @px + (VttCol ge 4?4,0) + (VttCol eq 10?4,0)
@py = 42*VttRow
resultis absolute
]
resultis illegal
]

and VEEPinPos(icinst, pin, px, py, pInfo; numargs na) = valof
[
DefaultArgs(lv na, -4, lv na)
@pInfo = noDisconnect+noReconnect+TopLevel
if (pin le 1)%(pin eq 10) then [ @px = 408; @py = 508; resultis absolute ]
if pin le 230 then
[
pin=pin-1
let VeeGp = (pin+10)/20
let VeeRow = (pin/10) rem 2
let VeeCol = 10 - (pin rem 10)
@px = 36*VeeCol - 28 + (VeeCol ge 7?28,0)
@px = @px + (VeeCol ge 4?4,0) + (VeeCol eq 10?4,0)
@py = 42*VeeGp -18 + (VeeRow eq 1?0,24)
resultis absolute
]
resultis illegal
]
and GNDPinPos(icinst, pin, px, py, pInfo; numargs na) = valof
[
DefaultArgs(lv na, -4, lv na)
@pInfo = noDisconnect+noReconnect+BottomLevel
if (pin le 1)%(pin eq 10) then [ @px = 408; @py = 508; resultis absolute ]
if pin le 230 then
[
pin=pin-1
let GndGp = (pin+10)/20
let GndRow = (pin/10) rem 2
let GndCol = 10 - (pin rem 10)
@px = 36*GndCol + (GndCol ge 7?28,0)
@px = @px + (GndCol ge 4?4,0) + (GndCol eq 10?4,0)
@py = 42*GndGp + 18 - GndRow*24
resultis absolute
]
resultis illegal
]

and VCCPinPos(icinst, pin, px, py, pInfo; numargs na) = valof
[
DefaultArgs(lv na, -4, lv na)
@pInfo = noDisconnect+noReconnect+TopLevel
if (pin le 1)%(pin eq 7) then [ @px = 408; @py = 508; resultis absolute ]
if pin le 161 then
[
pin=pin-1
let VccGp = (pin+7)/14
let VccRow = (pin/7) rem 2
let VccCol = 7 - (pin rem 7)
@px = 36*VccCol + 4 + (VccCol ge 5?64,0)
@px = @px + (VccCol ge 3?40,0) + (VccCol eq 7?40,0)
@py = 42*VccGp - 18 + (VccRow eq 1?0,36)
resultis absolute
]
resultis illegal
]

and AutoTermPinPos(icinst, pin, px, py, pInfo, pinName; numargs na) = valof
[
DefaultArgs(lv na, -4, lv na, 0)
if (pin le 7)%((pin ge 64)&(pin le 70)) then
[ @px = 408; @py = 508; resultis illegal ]
if pin le 840 then
[
pin=pin-1
let package = pin/7
pin = pin rem 7
Pin1of8(package/10, package rem 10, px, py)
@px = @px-4-4*pin
if pinName ne 0 then
ExpandTemplate(pinName, "$C$D.$D", $a+(package rem 10),
30+package/10, pin+2)
resultis absolute
]
resultis illegal
]