//gobc.bcpl
//new gobbler for sil files
get "sysdefs.d"
get "gob.defs"
external
[
BoardA
BoardB
BoardC
BoardD
BoardE
BoardF
BoardG
BoardH
BoardI
BoardJ
BoardK
BoardL
BoardM
BoardN
BoardO
BoardP
BoardQ
BoardR
BoardS
BoardT
BoardU
BoardV
BoardW
BoardX
BoardY
BoardZ
SendUsedICs
]
static
[
noroute = false //turns off routing
maxn //maximum values for n and alph in a board location
maxalph
dts
termx
termy
]
static //initialized to point to board specific procedures by SetUpBoardType
[
GetSVCoords//(svlet,svindex,cv)
GetSVindex//(pinchar,bl,boardpinnumber) returns index of closest svolt pin
SVoltReq//vector of space required for SVolt source pins provided by SetUpBoardPins
NetHasSVolt//(string) returns netcharacter if special, else 0
LegalBloc //(boardlocation) returns true if board location is legal
ChiptoPinPos //(boardloc,chippin) returns board pin number given chip locator
GetEpinCoords //(pin,cv) x in cv!0, y in cv!1 - coordinates are in .025" increments
GetCpinCoords //(pin,cv) x in cv!0, y in cv!1 - coordinates are in .025" increments
GetICcoords //(alph,num,pin,cv) x in cv!0, y in cv!1 - coordinates are in .025" increments
AddPotentialTerms //() if the board has special terminator positions, this function adds them
//to the Boardvec list (or checks that user defined ones are really terms). If they are
//not assigned, they will not be printed out by SendUsedICs
FindBestTerm //(x,y) returns a pointer to the best terminator pin to use for the signal
//at the given coordinates
SetUpTerms //() allows construction of the data structure of your choice before FindBestTerm is called
TableZeroString //string to cause stitchwelder to be zeroed
GetBoardPins //(boardloc) returns max number of pins at this position
]
let SetUpBoardType(char) be //Takes alpha switch and sets up board specific procedures
[
let bp = selecton char into
[
case $A: BoardA
case $B: BoardB
case $C: BoardC
case $D: BoardD
case $E: BoardE
case $F: BoardF
case $G: BoardG
case $H: BoardH
case $I: BoardI
case $J: BoardJ
case $K: BoardK
case $L: BoardL
case $M: BoardM
case $N: BoardN
case $O: BoardO
case $P: BoardP
case $Q: BoardQ
case $R: BoardR
case $S: BoardS
case $T: BoardT
case $U: BoardU
case $V: BoardV
case $W: BoardW
case $X: BoardX
case $Y: BoardY
case $Z: BoardZ
]
if bp eq 0 then [ CallSwat("Bad Board Type Switch"); finish ]
bp()
]
and ErrCfn(x,cv) be
[
WSS(ErFile,"*nAttempt to assign Cpin on board without any")
cv!0 = 0
cv!1 = 1
]
and ErrTfn() = valof
[
WSS(ErFile,"*nTerminator assignment attempted for board with no terminators")
resultis 0
]
and Nullfn() = valof
[
resultis 0
]
and SendUsedICs() be
[
for alph = 0 to maxalph do for n = 1 to maxn do
[
let bl = (26*n)+alph
let bp = Boardvec!bl
if bp eq 0 then loop
let bpins = GetBoardPins(bl) //there are as many positions as there
//are spaces on the board
let used = false
for i = 1 to bpins do
if bp>>icdesc.pinptr↑i ne 0 then [ used = true; break ]
unless used then loop
let pv = vec 100; pv!0 = 0
AppendC($*n,pv)
AppendBL(bl,pv)
AppendS(": ",pv)
AppendS(lv((bp>>icdesc.stp)>>strec.st),pv)
AppendC($:,pv)
let sepc = $*s
for i = 1 to bpins do
[
if bp>>icdesc.pinptr↑i ne 0 then loop
AppendC(sepc,pv); sepc = $,
AppendN(i,pv)
]
WSS(OutFile,pv)
]
WSS(OutFile,"*n@")
WSS(OutFile,TableZeroString)
]
and ErrBL(st,bl) be
[
let v = vec 50; v!0=0
AppendS(st,v)
AppendBL(bl,v)
WSS(ErFile,v)
]
and ErrN(st,num) be
[
let v = vec 50; v!0 = 0
AppendS(st,v)
AppendN(num,v)
WSS(ErFile,v)
]
and GetBoardPinsT(boardloc) = valof
[
resultis 16
]
and LegalBlocT(bloc) = valof
[
let al = bloc rem 26 //letter
let num = bloc/26 //number
if (al gr maxalph)%(num gr maxn) then resultis false
resultis true //bloc is legal
]
and ChiptoPinPosT(boardloc,chippin) = valof
[
let tp = Boardvec!boardloc
let ictype = tp>>icdesc.ictype
if ictype eq termtype then resultis chippin //terminators always have 8 pins
let maxpins = tp>>icdesc.npins //max pins for chip
let mbpins = GetBoardPins(boardloc)
//this function handles all types of dip packages (2 rows)
//which are plugged in with the chip orientation the same as the
//orientation intended for the board
test chippin gr maxpins/2
ifso resultis mbpins-(maxpins-chippin)
ifnot resultis chippin
]