// routepclb3.bcpl

// Board-specific Route routines for the PC version of the
// Dorado Main Logic Board

// part 3 of 3

// last modified by E. McCreight, July 14, 1981 6:40 PM

get "route.defs"

external [ Pin1of16 ]

static [ boardInterfaceVersion = interfaceVersion ]


let ComputePCCoords(px, py, isMils) be
[
unless isMils do
[
@px = 25*@px
@py = 25*@py
]

// The board in standard orientation with the component side visible,
// has a01 at top left and l01 at top
// right, and is described with y increasing upward and x increasing
// to the right and the 0,0 origin at bottom left off the board. This
// means that pin 1 of an IC is located at the max-x, max-y value
// compared with any other pin of that IC.

@px = 1100+@px
// offset the x co-ordinate by 1.1 inches
@py = 14400-@py
// reverse the y co-ordinate and offset 14.4 inches

// Location a01 pin 1 is now at x=2000, y=14000

if (@px rem 50) ne 0 % (@py rem 50) ne 0 then
CallSwat("Pin not on 50-mil grid")
]

and OtherPCHoles(isPrototype,PrintPCSite) be
[
let x,y = nil,nil
let s = vec 6

if isPrototype
then
[
for x=0 to 599 by 2 do for y=0 to 599 by 2 do
if FindIndexFromCoord(x,y) ne 0 then
[
let class,pin = empty,0
FindIndexFromCoord(x, y, lv class, lv pin)
PrintPCSite(x, y, y le 4 % y ge 520) // must drill edge fingers
]

// describe the via sites

FindCoordFromString("a01", lv x, lv y, 4*3, 4*-2)
for row = 0 to 1 do for col = 0 to 112 do
PrintPCSite(x+4*col, y+4*row, false) // along the top

for row=1 to 23 by 2 do
[
ExpandTemplate(s, "f$D", row)
FindCoordFromString(s, lv x, lv y, 4*-3, 0)
for subrow = 0 to 9 do for col = 0 to 2 do
PrintPCSite(x+4*col, y+4*subrow, false) // down the center
]

for row=1 to 24 do for col=$a to $g by ($g-$a) do
[
ExpandTemplate(s, "$C$D", col, row)
FindCoordFromString(s, lv x, lv y, 4*9, 4*1)
for subcol = 0 to 57 do
PrintPCSite(x+4*subcol, y, false) // under the DIP’s
]

for row=1 to 23 by 2 do
[
ExpandTemplate(s, "l$D", row)
FindCoordFromString(s, lv x, lv y, 4*-3, 4*3)
PrintPCSite(x,y, true, "VDD")
// VDD strip feed-thru holes

ExpandTemplate(s, "a$D", row)
FindCoordFromString(s, lv x, lv y, 4*10, 4*4+2)
PrintPCSite(x,y, true, "VTT")
// VTT strip feed-thru holes
]

let xmin,ymin,xmax,ymax = nil,nil,nil,nil
FindCoordFromString("a01", lv xmin, lv ymin, 4*15, 4*-4)
FindCoordFromString("l24", lv xmax, lv ymax, 4*-5, 4*4+2)

for col=0 to 1 do
for row=0 to 1 do
[
let x = col eq 0? xmin, xmax
let y = row eq 0? ymin, ymax
for holeRow = 0 to 1 do
for holeCol = 0 to (x eq xmin? 4,2) do
PrintPCSite(x+holeCol*4, y+holeRow*4, true,
((x eq xmin)? ((y eq ymin)? "VTT", "VEE"),
((y eq ymin)? "VDD", "VCC")))
// power bus feed-thru holes
]

for row=0 to 4 do
[
PrintPCSite(xmin-6, ymin+22+row*120, true, "TOOLING")
PrintPCSite(xmax+4, ymin+22+row*120, true, "TOOLING")
]
]
]