\def\pinbar#1{$\overline{\hbox{#1}}$} divert(-1) define(`pinsep__',0.16) define(`pinlen__',0.22) define(`notdia_',0.08) define(`chipwid_',0.96) define(`icpin_', `Pin`$3': line `$1' pinlen__ from `$2' "{\scriptsize `$3'}" above {"sp_{\scriptsize `$4'}sp_" at last line.start ifelse(`$1',left,l,r)just}') define(`nicpin_',`move to `$2' {"sp_{\scriptsize `$4'}sp_" at Here ifelse(`$1',left,l,r)just} `$1'; circle diam notdia_ Pin`$3': line `$1' pinlen__-0.08 "{\scriptsize `$3'}" above ') define(`pinloop_',`ifelse(eval(`$1'<=`$2'),1,dnl `$7'`icpin_(`$3',Chip.ifelse(`$3',left,sw,se)+(0,eval(`$4'+`$1')*pinsep__), eval(`$5'`$1'),`$6'`$1') pinloop_(incr(`$1'), `$2',`$3',`$4',`$5',`$6',`$7')') ') define(`ic6502',`[ Chip: box wid chipwid_ ht 24*pinsep__ "6502" at Chip.sw below ljust icpin_(left, Chip.sw+(0,pinsep__), 21,V\hbox{\tiny SS}) icpin_(left, Chip.sw+(0,2*pinsep__), 1,V\hbox{\tiny SS}) icpin_(left, Chip.sw+(0,4*pinsep__), 34,R/\pinbar{W}) pinloop_(0,7,left,6,33-,D) nicpin_(left, Chip.sw+(0,15*pinsep__), 40,\pinbar{RESET}) icpin_(left, Chip.sw+(0,17*pinsep__), 7,SYNC) nicpin_(left, Chip.sw+(0,19*pinsep__), 6,\pinbar{NMI}) icpin_(left, Chip.sw+(0,21*pinsep__), 2,RDY) icpin_(left, Chip.sw+(0,22*pinsep__), 38,SO) icpin_(left, Chip.sw+(0,23*pinsep__), 8,V\hbox{\tiny CC}) icpin_(right, Chip.se+(0,pinsep__), 39,{\large$\phi$}\hbox{\tiny 1}(in)) icpin_(right, Chip.se+(0,4*pinsep__), 37,{\large$\phi$}\hbox{\tiny 2}(out)) pinloop_(0,11,right,6,9+,A) pinloop_(12,15,right,6,10+,A) nicpin_(right,Chip.se+(0,23*pinsep__), 4,\pinbar{IRQ}) move to Chip.e+(pinsep__,0) ]') define(`ic6116',`[ Chip: box wid chipwid_ ht 15*pinsep__ "6116" at Chip.sw below ljust icpin_(left, Chip.sw+(0,pinsep__), 12,GND) nicpin_(left, Chip.sw+(0,2*pinsep__), 18,\pinbar{CS}) pinloop_(0,2,left,4,9+,D) pinloop_(3,7,left,4,10+,D) icpin_(left, Chip.sw+(0,13*pinsep__), 21,R/\pinbar{W}) icpin_(left, Chip.sw+(0,14*pinsep__), 24,V\hbox{\tiny CC}) nicpin_(right,Chip.se+(0,pinsep__), 20,\pinbar{OE}) pinloop_(0,7,right,3,8-,A) pinloop_(8,9,right,3,31-,A) icpin_(right, Chip.se+(0,13*pinsep__),19,A10) move to Chip.e+(pinsep__,0) ]') define(`ic6522',`[ Chip: box wid chipwid_ ht 24*pinsep__ "6522" at Chip.sw below ljust icpin_(left, Chip.sw+(0, pinsep__), 1,V\hbox{\tiny SS}) icpin_(left, Chip.sw+(0,3*pinsep__), 24,CS1) icpin_(left, Chip.sw+(0,4*pinsep__), 25,{\large$\phi$}) nicpin_(left, Chip.sw+(0,5*pinsep__), 23,\pinbar{CS2}) icpin_(left, Chip.sw+(0,7*pinsep__), 38,RS0(A0)) icpin_(left, Chip.sw+(0,8*pinsep__), 37,RS1(A1)) icpin_(left, Chip.sw+(0,9*pinsep__), 36,RS2(A2)) icpin_(left, Chip.sw+(0,10*pinsep__),35,RS3(A3)) pinloop_(0,7,left,12,33-,D) icpin_(left, Chip.sw+(0,21*pinsep__),22,R/\pinbar{W}) nicpin_(left, Chip.sw+(0,22*pinsep__),21,\pinbar{IRQ}) icpin_(left, Chip.sw+(0,23*pinsep__),20,V\hbox{\tiny CC}) pinloop_(0,7,right,1,10+,PB) pinloop_(1,2,right,8,17+,CB) pinloop_(0,7,right,12,2+,PA) pinloop_(1,2,right,19,41-,CA) nicpin_(right,Chip.se+(0,23*pinsep__),34,\pinbar{RESET}) move to Chip.e+(pinsep__,0) ]') define(`ic74LS138',`[ Chip: box wid chipwid_ ht 11*pinsep__ "74LS138" at Chip.sw below ljust icpin_(left, Chip.sw+(0, pinsep__),8,GND) nicpin_(left, Chip.sw+(0,2*pinsep__),4,\pinbar{G2a}) nicpin_(left, Chip.sw+(0,3*pinsep__),5,\pinbar{G2b}) icpin_(left, Chip.sw+(0,5*pinsep__),1,A) icpin_(left, Chip.sw+(0,6*pinsep__),2,B) icpin_(left, Chip.sw+(0,7*pinsep__),3,C) icpin_(left, Chip.sw+(0,9*pinsep__),6,G1) icpin_(left, Chip.sw+(0,10*pinsep__),16,V\hbox{\tiny CC}) pinloop_(0,6,right,2,15-,Y,n) nicpin_(right,Chip.se+(0,9*pinsep__),7,Y7) move to Chip.e+(pinsep__,0) ]') define(`dimen_',1.5) define(`elen_',0.42/0.5*dimen_) define(`ebar_',`thinlines_ box ht_ dimen_/5 wid_ dimen_/5/3 thicklines_ ') define(`ebbar_',`box fill_(0) ht_ dimen_/5 wid_ dimen_/5/4') define(`buscon_',`line to rvec_(dimen_/3,0); ebbar_') divert