//routeaub.bcpl
// Board-specific Route routines for the Dorado Main Logic Board
// last modified by E. McCreight, February 2, 1979 5:50 PM
// all co-ordinates are described with respect to the bottom or
// wiring side of the board. LevelTransform fixes these as necessary.
get "route.defs"
static [ maxICs = 300; boardInterfaceVersion = interfaceVersion ]
let DeclareInitialNets(BuildTWNet, BuildTermNet, BuildConnector) be
[
BuildConnector("E", 122, EPinPos)
BuildConnector("C", 122, CPinPos)
BuildTWNet("GND", 128, GNDPinPos)
BuildTWNet("VCC", 144, VCCPinPos)
]
and ZeroTablePoint(point) = selecton point into
[
case 0: "AU" // board type
case 1: "C62"
case 2: "E1"
case 3: "E61"
case 4: "C122"
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 = 396-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
[
if (pin ls 1) % (pin gr 122) then resultis illegal
pin = pin-1
let pinRow = pin rem 61
let pinCol = pin/61
if pinRow eq 57 then resultis illegal
@py = 396-4*pinCol
@px = 252-4*pinRow
resultis absolute
]
and CPinPos(icinst, pin, px, py) = valof
[
if (pin ls 1) % (pin gr 122) then resultis illegal
pin = pin-1
let pinRow = pin rem 61
let pinCol = pin/61
if pinRow eq 57 then resultis illegal
@py = 4-4*pinCol
@px = 252-4*pinRow
resultis absolute
]
and GNDPinPos(icinst, pin, px, py, pInfo; numargs na) = valof
[
DefaultArgs(lv na, -4, lv na)
@pInfo = noDisconnect+noReconnect+TopLevel
if pin le 0 then resultis illegal
if pin le 128 then
[
pin=pin-1
let GndCol = pin/8
let GndRow = pin rem 8
@px = 240-32*GndRow
@py = 28+24*GndCol
resultis absolute
]
resultis illegal
]
and VCCPinPos(icinst, pin, px, py, pInfo; numargs na) = valof
[
DefaultArgs(lv na, -4, lv na)
@pInfo = noDisconnect+noReconnect+BottomLevel
if pin le 0 then resultis illegal
if pin le 144 then
[
pin=pin-1
let VccCol = pin/9
let VccRow = pin rem 9
@px = 256-32*VccRow
@py = 28+24*VccCol
resultis absolute
]
resultis illegal
]
and FindCoordFromString(s, px, py, vop1, hop1; numargs na) = valof
[ // vop1 is the "vertical offset" from pin 1, that is, the offset along the 0.1"
// spacing; hop1 is the "horizontal offset" from pin 1. In a standard 16-pin
// DIP, for pin 2 vop1=4 and hop1=0, and for pin 16, vop1=0 and hop1=12. For
// this board, vop1 grows in the -x direction, and hop1 grows in the +y direction.
DefaultArgs(lv na, -3, 0, 0)
let next = 1
let alph = s>>str.char↑next
if alph eq $# then [ next = next+1; alph = s>>str.char↑next ]
if (alph ls $a) % (alph gr $z) then resultis illegal
let col = alph-$a
next = next+1
while s>>str.char↑next eq alph then
[
col = col+26
next = next+1
]
let row = 0
for i=next to s>>str.length do
[
let c = s>>str.char↑i
if (c ls $0) % (c gr $9) then resultis illegal
row = 10*row+(c-$0)
]
row = row-1
unless OffsetLegal(col, 1, 0, 31)&OffsetLegal(row, 1, 0, 68) do
resultis illegal
@py = 12+12*col+hop1
@px = 268-4*row-vop1
resultis absolute
]
and FindIndexFromCoord(x, y, picclass, pPinNo; numargs na) = valof
[
manifest
[
firstEPin = 1
firstGNDPin = firstEPin+240
firstVCCPin = firstGNDPin+128
firstDipPin = firstVCCPin+144
firstUnusedPin = firstDipPin+2176
]
if x eq -1 & y eq -1 then resultis firstUnusedPin
DefaultArgs(lv na, -2, lv na, lv na)
unless OffsetLegal(x, 4, 0, 67)&OffsetLegal(y, 4, 0, 99) do resultis 0
x = x/4
y = y/4
if y le 1 % y ge 98 then // ..cable or edge pin
[
unless OffsetLegal(x, 1, 3, 63) do resultis 0
let yRepeat = y rem 96
x = x-3
if x eq 3 then resultis 0 // pins 58 and 119 are missing
if x gr 3 then x = x-1
resultis 60*yRepeat+x+firstEPin
]
y = y-3
if y rem 3 eq 0 then // ..Dip socket pin
[
let yRepeat = y/3
resultis 68*yRepeat+x+firstDipPin
]
y = y-4
if y rem 6 ne 0 % x rem 4 ne 0 then resultis 0
let yRepeat = y/6
if x rem 8 eq 0 then // ..VCC pin
[
@picclass = MustFindNamee("VCC", typeIcclass)
@pPinNo = 9*yRepeat+(72-x)/8
resultis 9*yRepeat+(x/8)+firstVCCPin
]
// otherwise, must be a GND pin
x = x-4
@picclass = MustFindNamee("GND", typeIcclass)
@pPinNo = 8*yRepeat+(64-x)/8
resultis 8*yRepeat+(x/8)+firstGNDPin
]