slac | bold people. visionary science. real impact. · 2011. 9. 22. · careful re&ders viii...

33
SLl: COftPUT1TIOI GBOUP Stanford, California CGTll 10. 190 Septe.ber 1977 1 Short Monograph Wherein Are Revealed the !ysteries and Secrets Of Building Bardware and writing Software so that s.all Coapoters at SLAC Can Bar.onionsly Co •• unicate with the Triplex. Leonard Shostek Co.putation Research Group Stanford Linear Accelerator Center P.o. Box 43'9, !/S 88 Stanford, California 94305 Working Do not quote, ci!.;!, al·l.'jt;·X:h·.t, or rcprod;Jc:! .. \':;:1:"1'J; p;i·:.ij of ;;;") ------_ .................... .". ..............

Upload: others

Post on 28-Jan-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

  • SLl: COftPUT1TIOI GBOUP Stanford, California

    CGTll 10. 190 Septe.ber 1977

    1 Short Monograph Wherein Are Revealed the !ysteries and Secrets

    Of Building Bardware and writing Software so that

    s.all Coapoters at SLAC Can Bar.onionsly

    Co •• unicate with the

    Triplex.

    Leonard Shostek Co.putation Research Group

    Stanford Linear Accelerator Center P.o. Box 43'9, !/S 88

    Stanford, California 94305

    Working P;:~pcr Do not quote, ci!.;!, al·l.'jt;·X:h·.t, or rcprod;Jc:! .. \':;:1:"1'J; p;i·:.ij per~b~ion of ;;;") c..·":;1~,"d5). ------_ .................... .". ..............

  • (1)

    (2,

    (3.

    (5.

    COIT!HTS

    Introduction •••••••••••••••••••••••••••••••••••••••••• 1

    -PIRr I - The Bardware • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • 3

    (I, The cables and Signals •••••••••••••••••••••••••• 3

    (B)

    (C'

    The Data

    Physical

    • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •

    DeYices ••••••••••••••••••••••••••••••••

    PIRT II - The Software ••••••••••••••••••••••••••••••••

    9

    10

    12

    (1) The Si.ple Case - lcting Is 1 Ter.inal •••••••••• 12

    (8) The Protocols ("Do We Use Fu~l Duplex?") •••••••• 14

    (C) Downloading Prograas to the Be.ote Co.puter ••••• 16

    APPENDII I - ISCII/EBCDIC Translation ••••••••••••••••• 21

    APPEIDIX II - Sa.ple 8080 Proqraa ••••••••••••••••••••• 26

  • Ona of the easiest vays to connect a reaote coapat.er to tile SL1C Triplex is to .ake the re.ote co.puter look like a WILBUR tar.inal. This approach has a nuaber of sigDificaD~ aaY~ntaqes, 1llclud1Dq;

    (1) The hardware is standard and already exists on aany saall co.pater sfsteas.

    (2) The software required on the reaot.e co.pater is very slaple to write.

    (3) 10 syste. software support is required on the Triplex.

    (4) The reaote co.pater bas access WfLBUR, and 08'YL on the Triplex. interact with the co.pater can be 'ILBUR exacfiles or in aDY language Oa'YL. Co •• unication with batch jobs SII is also possible.

    There are, however, soae disadYantaqes:

    (1' Transaission rate is liaited.

    to !tILTEI, Prograas to written in

    supported by running on

    (2) WYLBUR ports are liaited on the Triplex.

    (3) There is no direct coa.unication with batch jobs running OD SIB or SYC.

    (4' The perfor.ance of "ILTEH/VYLBUB/OaVYL under sastained full-speed co •• unicatioa with coaputers instead of people aay beco.e an issue.

    (5) There is presently no -transparent" .ode of transaission, so sendiDq arbitrary binary data requires 90ae software encoding ana decoding.

    leYertbeless, .any such connections haye been .ade and it is likely that this .ethod vill continue to be popular even after the establi~.ent of a network specifically oriented toward reaote coaputer coa.anication. This note describes how such connections can be .ade, and discusses the software Deede~ for the aost co •• only used function: downloading progrs.s fro. the Triplex to the re.ote co.pater.

  • 2

    . This docuaent has been written pri.arily for osers of the SL1: !riplex, wbich consists of ~WO IB! 370/168s and aft IBM 363/91. Careful re&ders viII discoyer. hoveyer, .nch inf)raati3B and folklore about serial asynchronoQs co •• anication which 18 applicable to other systeas and coaputers. The diseussioD vi11 be releyaat for c •• ote co.pa~ers of all sizes, bat the orientation is towards the saa1l .icroco.pa~er systea. !he softvare eKaaples will be 3f general use, but the details .111 be th3se for the IITBL 8080 alcroprocessor.

    At the tiae of this vrltiag, all IILBOI lines at SL1: are c~~aecte4 to 18B co •• unicatioDs controllers (3705/2702), and oal, the facilities of those de.ices (as used at SL1C, are discussed. 1 new DIe PDP-11 co.aaDicatioDs controller is being installed which as, eye~tuall, proyide .ore services to reaotel, coaaected teraiDals and co.paters.

  • 3

    (1) The Cables and Sigoals

    WYLBUR co •• uDlcates vitb aost teralnals osinq a st!ndard serial asynchronous line discipline. (It is actuallf !ILrEI which does the ter.iDal I/O OD bebalf of IILBOI ~r ORYIL. bat for this discussion WILBOB viII represent whoeyer OD the rriplex is talkiDi to the teralmal.) laanating fro. the botto. of one of taa red boxes vhich .ake up the Triplex is ~ collection of 2S-wire cables. each of which corresponds to a terainal. The ela~trical characteristics of this interf~ce haye been stsadardlzed by the Electronic Industries Association lnd are referred t~ as the "15-232" Standard [1].

    It is to this cable that the .icrocoapgter .nst be sttached if it wishes to loot lite a ter.imal. In so.e cases a pair of a~ie.s (!odulatorlDeaodulators) are placed between the rrlplex ani the alcrocoapoter, but the siqnals froa the .odea at the ai:roco.puter ena vil1 look just the saae as if the aode. pair vere not there. Rodeas, which at low speeds usually use a fraguency shift keying (PSK) fora of Pft aodulation, are used if it is lnconYenieDt or iapossible to trans.it DC signals. Any trlAs.issi3D oyer the phone sfste., for exaaple, requires aoleas. (See Figure 1.)

    only a few of the 25 vires in the "standard" are needed in our clDfiguratioD. In fact, coaaections are usually used:

    RS-232 cable only 5 circuit

    (1) Serial data froa friplex to aleroco.pater

    (2) Serial data froa aier~eoapQter to Triplex

    (3, "I I! RBBE" fro. aieroco.pater to Triplex

    (4) "HE IS THERE" fro. Triplex to .ieroco.puter

    (5) Electrical ground.

    There is, unfortgn~telJ, a c~nsiderable aaount of c~nfus1on wit~ regard to which pins and si,nals on the 25-pin connector are to be used in yarious configurations. This results fro. s~.e aabiquity in the Standard which has allowed terainal and aolea .anufacturers to prodace inconsistent product~, Fortunately there are only t.~ connector types (Bale and female, anI two basic pin Duaberinqs, so that eyen if fOU .Qst res~rt to trLal-and-error there &re onl, foar possibilities!

  • r--I I I I I I L--

    --- - -------------rhe frlplex

    (IB! 310/168,

    • • I I I C3 •• onicatiGDS Controller I I I I (IBII 3705) I I I ~.----------.-------------------'

    I I

    15-232 --> I I I , --.

    I I I 1I04e. I I I , .

    I I I I

  • 5

    The tvo standard 85-232 pin nu.berinqs viII be called "tar.inal-like" aad ".odea-like" aceordinq to vhat see.s to aicee vito ay readiDg of tke Staadard. In aDst cases f~u (the .i=roco.pater oWDer, vill be supplying a "ter.iD~I-like" calAector vhich viII be plagged into ~he ".odea-like· cable coaaected to the !riplex. rke f~llo.inq table shows .kat pins are used for each Du.bering scheae:

    Trans.itted data Beceiyed data "I II! liRE" "BE IS THBBS" Ground

    Tet·j.1l11=11~!!

    pin 2 pia 3 pill 20 pins 5,6,8 pia 7

    pin 3 pin 2 pins 5,6,8 pin 20 pin 1

    In all cases, the aicroprocessor is expected to proYide the "rraDsaitled data" aDd nI 1ft HBBE" signals, and look at tbe ·aa=eiyed data" and "HE IS THIBE" signals.

    Pins 5, 6, and 8 are treated as a group because they all hsya si.ilar .aanlngs (sae the table later,. lot all devices, hOVByer, proyide or look at all three pins. fo be ~o the safe sile, you should supply all three if they are four 'I lK HER!' piBS, aod look at 8 if they are your 'HB IS fUBRS' pins.

    The total connection of Triplex to .iecoco.pater will claarly work only if a ·aodea-like" deyice on one end is c~!nected to a -terainal-like" deyice OD the other end. The c!ble fro. the friplex's Co •• uniea~ioDs Controller is -tarainal-like", as is the cable fro. .ost (bat n3t all, ter.ioals. For that reaSOR, the "extension" cable fro. the co.pater building to other SL1C sites is al.ost always "twisted" in the following va,:

    End_'1 !!lL!l

    Pin 2 to Pin 3 Pin 3 to Pin 2 Pin 20 to Pins 5, 6, 8 Pins 5. 6, 8 to Pin 20 Pin 1 to Pin 7

    This .akes the re.ote end of the cable "aodea-like" into .hi~h the "ter.inal-like" ter.inal can be directly plugged.

    lote that anf cable which is Dot twisted in this I!nn@r • aDf nor.al extension is ·.odea-lite" on one end and "tarainal-like- on the other end, regardless of the sex of the c~2Dectors. lny cable which bas a tvist can be considered ".~ie.-like" on both ends. Dr "ter.inal-like" on both ends. In order for a sequence of cables and connectors to work properly, e~ch interface aust consist of a ".odea-lite" connector mated vith a "terainal-like" connector.

  • r------------------- -------------------------------, I I I TRIPLEX CO!RUBIClrIOIS CORTROLLBR I I I L___________________ ~

    I I I I

    r • I ! I I r

    t= • J "1'!RIIIIAL-LIl{B" -> I !I I ) ,-_.I } I } Short I } Adapter I } Cable

    r---. ) "KODIK-LIKE" --> I !! I )

    L---I ) r •

    "fER!IIAL-LIKI" ---> I F I i--.... ~_L __ ._, , , I llf. lRBOR I I TER!IlflL I • I

    Pigure 2 Two typical hardwired cODnections

    6

  • 7

    The re.ote end of the cable fro. the co.puter building is fealIe, which interfaces directly with a ter.inal which has its ova cable with a a.le connector on the end (like the Tektronix 4013). Terainals .hic~ haye a connector .oonted on the ter.inal b~lf usasllf haye a feaale connector, aad require aale-to-.ale ad~pters to connect with the rriplex cables. (See Fiqore 2.) In qeaeral, because of aabigult1es in the Standard, there is very low correlation between the sex of the connector and whether it 1s wired "tera1nal-likeR or -aodea-Ilke".

    The aoral of this coaplicated story is that if foa intend t~ use one of the Bor.al hardwired cables which haye been iastalled by SelP, you should be prepared to supply a .ale 25-pin connector wired to look "teratnal-like" according to the ab~ye definition. In sna.ary, -terainal-like" .eans that you seBd data on pia 2, receive data OD pin 3, announce yoar presence ~n pin 20, and check Triplex status on pin 8.

    The rriplex supplies the nHE IS ~BER!" signal whenever IfLBDS (or at least BIL!!I) is running. You aay ignore it, or use it to know when it is hopeless to atteapt co •• unication. It expects Joar "1 lS BEIB" signal to be present wheneyer yoa wish to start a session ~nd throughout the tiae that you are coaaunicating. If Jour "I 1ft HERE" signal drops for 28 seconds (or eyen less) during a session WYLBUR vill initi~te an aataaatic logoff.

    The signal leyels on the cables are not rrL coapatible. The leyels are called "a art" (less than -3 volts) which is the nor.al rest state, and "space" (.~re than +3 volts) which is the s:tiye state. For the control signals (nIl" fRERR", "RE IS !BlaB") the "space" state is the affiraatiYe. For data lines DegltiYe logic is used, so -aark" is a 1. The following table su •• arizes the convention:

    Volta.ge Data Control

    r!~BI

    < -3 1

    OFF

    2f!g

    > +3' o OR

    The BS-232 drivers .ust be capable of driving a 31 to 71 oha, 2500 pf non-inductive load to a -aark" level between -15 anI ~5, and a .space· level between +5 and +15. Both drivers au! receivers aost be sble to withstand shorts or potentials to 25 yolts and never sink or source .ore than 0.5 aaps. rhere are a Doaber of coa.erciallf available les which convert between XXL lerels and 85-232 levels and obey all the require.ents of the stsndard. 50.e exaaples are the Rational D51488/DS1489, rr 15150175154, and Signetics 8T15/8T16. Ilso note th~t aost ai=roco.puter .anufacturers haye 85-232 interface boards aY~ilable.

  • 8

    For reference purp~ses, the following table is a co.plete list of the 15-232 pin assignaents. The co1uan labeled "Direction" contaias "T-)S- for signals which go fro. -teraiaal-like" d •• ices to ·.odea-llke" devices, and "!->r" for sl~aals whicb go t •• other waf.

    lUI

    AA 1 Bi T-)! 2 BB I-)! 3 Cl T-)S _ CB B->! 5 CC B-)r 6 18 7 CP B-)T 8

    9 10 11

    scr B->r 12 seB I-)r 13 S8l T-)! l' DB 1-)' 15 SBB ft-)r 16 DD I-)T 17

    18 SCA T-)! 19 CD T-)! 20 CG 8-)T 21 CB ft-)T 22 CR/CI 23 Dl T-)! 24

    25

    RU£ILiRtion

    Protect! •• Groand Trans.itted Data leceiYed Data Re~oest to Send (IrS) Clear to Send Data Set Ready (DSR) Signal Ground Becei.ed Line Signal Detect

    (Carrier IDaicator, CI, ••• reserved for testing ••• reseryed for testing ••• unassigDad Secoadary Rcyd Line Signal Detect Secondary Clear to Send Secondary Transaitted Data Transaitter Clock Secondary leceiYed Data ReceiYer clock ••• unassigned Secondary Request to Send Data Terainal Beady (DrR, Signal Quality Detector Rinq Indicator (HI, Baud Rate Selector !ransaitter Clock ••• unassigned

  • 9

    (B) The Da ta

    The inforaatioD seot oyer the trans.it and receiYe data limes 1s ASCII, not the EBCDIC code used internally in the friplex. Bach character begins with a single ·st~rt" zero-bit, thlt is, ·the 110e changes fro. ~lHI to SPACR for one bit. ti.e (1/2400th of a second f,r 2400 bau4). Following the "stsrt" bit are the 7 lSCII data bits starting with the least significant bit. The next bit is an eyea parity bit, which is either a 0 or a 1 so that the total nuaber of 1-bits (not including the start bit or the follo.la, st~p bit) is eyen. The last bit sent for elch character 1s the ·stop. 1-bit, that is, the line retarns to .~rk for one bit tiae. rhe aext character aay be sent i •• ediately after the stop bit, or there aay be an arbitrarily 10a9 delay bet.e •• characters with the line held in the idle .ark (1) state.

    To saaaarize, a siogle character consists of:

    1 start bit (a 0) 1 data bits, startlnq .1~h the leAI~ significant 1 eyen parity bit 1 stop bit fa 1)

    For exa.ple, a single capital ",ft (bex 4E in ASCII, 1001110 in binary) sent OD an otherwise idle line would result in the following sequence of bits, where ti.e increases fro. left to ri~ht:

    111 1 1 100 1 1 100 1 0 1 1 1 111

    S D D D D D D D P 5 t a a a a a a a a t a t t t t t t t r 0 r a a a a a a a i p t I I t

    I1 y

    An older convention, required by aechanical teletypes but D3t supp~r~ed by the !riplex, dictated that each character be followed by at least tWJ stop bits instead of just one. If tvo st3P bits are sent when only one is expected, nothing bad viiI happen (except that trans.18s1oB will be slowed, because the se~~nd stop bit is indistinguishable fro. an idle line. If one st,p bit is sent bat tvo stop bits are required before the CDlracter is considered valid, then there viiI be a proble. when cb~racters are transaitted at the aaxiaa. rate. The rriplex semds and expects one stop bit at all speeds.

  • 10

    (The one/tvo stop bit convention ezplains why the baud rate is Dot always ten tiaes the oharacter rate. with ODe stop bit thare are a total of 10 transaitted bits for each character, so th~t. for exaaple. a 2400 baud liDe vill transait at 240 chlracters per second (cps). rhe older teletype syste.s used t.o stop bits. so it re~uired a 110 baud liDe in order to trsas.it their speedy 10 cps.)

    late that there is nothing in the specification of the haraware that deter.iDes wbat the baud rate is. In a3st cases the baud rate aQst be agreed apoD in advance by both sides in tae co.auDication. aDd their bit clock freqgeDCies .Qst be reasonably close. The definition of "reasonable" depend. on the te:anigues used to ietect aad receive characters, but in general cl~ck freqaency differences of up to 41 can be tolerated without err~rs. !ost of t~e friplez ~ardvired cables are preset to send and receive at 2400 baud (2'0 cps), although 1200 baud and 300 bSGd is also ayailable. ftost connections using a04ea5 ron at 300 baud (30 cps) • there is li.ited ayallability of lines wbi:a, using additional signals in the cable, can trans.it at arbitrary baud rates up to 6400. When the PDP11 front end be~Qaes operational om the Triplez (soaetiae in late 1917) speeds up to 9600 baud will be ayallable.

    There is one specisl condition on the serial d~ta line which 1s not the trans.lsstoD of a character. This is called a "break- or "attention- signal, and consists of a transition froa the idle !lBK state to the SPACB state for about 200 ailliseconds (independent of the baud rate), then return to BIRI. It is .ostly ased to interrupt WILBOR trans.issions and it is higaly desirable that yoa be able to send it.

    1 vord of caution: the cODYeatioDs I haye been d1scuss1nq are for ISCII (teletfpe-lite) lines only. !he IBN 2741 is not AS:11. It is, surprisingly, Dot even EBCDI,C. It uses a 6-b1t cole called PTTC vhich requires special shift characters for the full character set, and is rather .ore difficult to interface to (aad .uch slover) than the rTf lines.

    (e) Phrsical Deyices

    The hardware to be used for interfacinq vit~ ifLBOB clearly varies depending OD situation. laong the p~ssibilities are:

    a aicroc:>apoter the particular

    (1) Ose aDY teletype port on the aicroco.puter. tou probably vill tbea need at least tvo such ports: one for the IILBOR connection aDd one for the local ter.inal.

    (2, Baild aD BS-232 coapatible interface. this reqGires a psrsllel/serial CODYerter (one LSI Ie called a "OIRr" ,~ OaiYersal AsynchronoQs ReceiYer/Transaitter, and rTL to 8S-232 lewal conYerters.

  • 11

    (3) If yoa are already iD~erfacin9 with Cl!l:, there exist ClSlC .odales that c~nnect directly to 85-232 cables. (For axsap!e, see WYL.CG.LJS.DOC'Cl!ACORT describiDq SLAC a040le '135-222. »

    Sod •• s are ga.erally required only if ~he dis~ance between the co.puters is large, or if the cables are routed through areas with significant electrical noise. It is difficult to spacify precisely .hen aod.as v111 be necessary, but at 2400 baQd distances ap to 0.5 Ka should not be a proble. without a .01e.. Hlgh~r speeds dictate siaorter cables. The Standard is, of course, extre.ely conservative; it recoa.eDds cables shorter th~n 15 aeters, but peraits longer cables proyided that the resulting load capacitance see. by the driver is less thso 2500 pf. Por long lines it is a good idea to .ate both the trans.it and receive data lines (pins 2 aDd 3, be half of ~ twisted pair, with the other half of each pair being a ground wire (pin 1).

    rhe standard SL1C aodeas as of ~his writing are 300 band deyices which use the standard FSI (Rfrequency shift keyingR) ea:oding used by Bell Syste. 1031 80de.8. They can be used either oyer the Doraal phone slstea or (less coa.only) by directly wiring the re.ote .ode. to the Triplex .ode ••

    There are two differeat versions of ~hese aode.s, called W3riginateW and wanswer", depending on which frequencies are usad to trans.it and v~ich to receiYe. The convention is that the Triplex .04ea5 are the "answer" type, and fOU .ost use the WoriginateW type. !he aore expensive aode.s have a switch which allows you to be either one.

    FSK is a siaple encoding sche.e which uses tvo different tones to represent the two logic sta~es. The followi09 table Sh3WS the frequency assignaeats (in Hertz) used by the lOlA-type .01e.8:

    Trans.it ReeeiYe

    Bark

    1270 2225

    Space

    1070 2025

    Bark

    2225 1270

    Space

    2025 1070

    81~her-speed .odeas generally use .ore sophisticated encodinq selle.es.

  • 12

    (1) THB SIBPLB CISE - Acting Is 1 Terainal

    The software needed 1a the aicrocoapater for a siaple coa.ection to IILBoa - as a noraal ~er.inal - is indeed quite siaple. rhere are four indepeadent deyices inYolYed: the local tefboard, the local display (printer or CR~', the serial line receiver, and the serial 1188 transaitter. The scheae to _ate a Bor.al terainal is siapl, to send receiYed characters to the local display, and send keyboard characters to both the local display (if not alread, done by aechanical hardware) and to the trsDsaitter. 10 extra line protocol need be obserwed. It is this s1aplicity that accounts for auch of the appeal of a IILBUR cODDectioD for aicrocoaputers.

    There are a two other iteas that should be in the local s~ft.are to aake it a proper terainal. (1) the keyboard should ha.e a distlnquisked key which viii cause a -break- to be trsDsaitted over the line. ReceiYed breaks can slaply be iqaored. (2) lDf DC1 cbaracters (hex 11 in ASCII, also called 101) received fro. the line should Dot be printed or CSDse any cursor positioning. (~ore about this la~er.)

    The software for this siaple ter.inal can be described in a stylized aLGOL-llke laoquage as f~llo.s:

    LOOP IF keyboard_char fHEI BEGII

    CALL Kltll (char) CALL DI5PL1Y(char) CALL IftIT(claar) EID

    IP keyboard_breAk_key THE. BIGIN CALL 511DBRI EJD

    IF received_char rBEI BEGIH CALL RCY (char) IF char ~= DC1 THEN CALL DISPL1Y(char) EHD

    a!P!lT

    This is, of course, a ·polling· progral; no interrupts are used. While acceptable for siap1e dedicated systeas, an ioterrupt-driyen structure is often necessary for .ore co.plicated syste.s which aust perfora other tasks at the sa.e tiae.

  • 13

    The subroutines used here (and in the other examples) are:

    KEIII(cbar) sets ·char" to the ASCII waine of the ke, pressed on the keyboard. This call is yalid only if the predicate "keyboard_char" is true, which vill then be set false by this subroutine until the next key is pressed.

    BCY(char) sets ·char" to the lSCII yalue of the character receiYed froa the serial line. This call is yalid only if the predicate ftreceiyed_char- is true, which will then be set false by this subroutine until the next character co.es in.

    DISPLlt(char) displays the ASCII charac~er .char" on the local display dey ice. It is nice if special characters lite carriaqe return, backspace, bell, linefeed, etc., do what they are supposed to.

    XBI!(ckar) trans.its the ASCII character "char" over the

    SIIDBIK

    serial line with proper (eyen) parity.

    transaits a break (200 .sec. serial l1ne.

    "space") over the

    "keyboard_break_key" 1s true if the special ker being used as break/attention has been pressed. If there is no such special key, you can use so.e other ASCII key which otherwise has liaited appeal; IOL and DEL are good candidates because they are often unshifted keys and are not needed with WILBUR.

    The caaracter code used iaternally in the Triplex is 8-bit EB:DIC, and WYLBUR autoaatically translates between that and the 7-bit lSCII used al.~st uDiversally for terainals. In .ost cases Jon can igDore the details of that translation, since it praseryes the identity of al.~st all DOD-control characters. a •• a.ber, howeyer, that no~ all (less than half, in fact) of the 256 EBCDIC characters can be translated to unique ASCII cbAracters when being transaitted by the Triplex, and not even all the 128 ASCII characters can be sent to the Triplex. The iap~rtant consequence is that bia~rJ data aost be encoded before being sent in either direction. (See section II-C., Details of the EBCDI:/ASCII translstion are giYen in Appendix I.

  • (Bt THE PBOTJCOLS

    or

    Doe8 The Triplex Use Pull Duplex?

    unfortunately. the answer is either .yes" or depending on what IOU think you .ean by "full duplex".

    14

    As fsr as the hardware 1s concerned, full duplex aeans that it 1s possible to trans.it in both directions at the saae tiae, i.a. both the trans.it and receiYe lines can be used siaultaneously_ Onder this strict definition, the SL1C !riplex terainals could indeed use full dup1ex if the Triplex software vere to tate adYantage of it.

    Another CO •• OD use of the tera "full duplex" is to .eaa a sfste. where the c~aracters typed at the ter.inal are not displared bf the ter.in~l as they are sent to the co.puter. It is the responsibility of the re.ote co.pater to echo back the characters if it intends the typist to see what he is typing. Onder this interpretation, the SLAC Triplex does not use full duplex since it aoes not echo typed characters back to the tarainal. If characters are to be displayed as they are typed, it aust be done either by the terainal itself or by haYinq the local aodea echo back whatever is sent to it by the terminal.

    strictly speaking, hoveyer, "half-duplex· is a sJste. where the control circuits "request to send· aDd ·clear to send" are used to negotiate the direction of transaissloD. 1'he 'rriplex does BOT use these signsls for this purpose and hence is not truly half-daplez.

    To further co.plicate .atters, the full-duplex hardware's ability to trans.it in both directions si.ultaneously is used onlr in one yerJ special circa.stance: when the trans.1ss1on in ona direction is to be interrupted by a break sent in the other direction. At all other ti.es, WILBUR expects trans.18sioB only in one direction or the other, aDd characters sent at other tiaes vil1 cause errors or be a1stakenly interpreted as break signals.

    The best sa •• ary of this confusing situation is th~t although the hardware is .ired to be full doplar, it il allelt always used by the software as if it were half duplex.

  • 15

    It is. happily. rather easy to keep track of which 4irec,tion the transaissioD 1s valid by watching for certain special control characters. Ihea '!LBOR wishes to indicate that it has stQPped sendiog and the terainal is to trans.it, it sends a DCl (101) character. !he ter.inal a.y then send exactly one line of characters (~ 11ae 1s 160 or fever characters) ter.inated by anJ one of three conditions: (1) a carriage return ch~racter (~.x OD 1a ASCII), or (2) an BOT character (hex 0' in lSCII), or (3) a break siqaal. IYLBOR then is free to trsas.it as aanJ lines as it wishes, and will aqain send a DCl whan it wishes the ter.ina! to transait. lote that if the lines seat by the .icrocoaputer are to be put into the .!LBOR active file, ther should be no longer th~n 133 characters.

    lfter sending ODe of the three ending conditions, no chlracters shoald be sent to IYLBOI uatil the next DC1 has been re:eived. lny characters which are seat to IfLBUR before receiYing the DC1 will either be ignored or be interpreted as a bre~t~ An explicit break aa, be sent as an interrupt signal, but eyen then the DCl should be receiYed bafore sendiag ch.racters. lot. that of the three ending conditions, the carriage return is the "noraal" .ay of ending the transaission of a line. Both the BOT character and the break signal are iDterpreted as the "attention" teraination described in the WfLBOR .anual.

    If the aicrocoaputer is having an auto.atic dialogae with WILBDI, that is, without hoaan participation for each tr~nsaction, then it is necessary to follow these protocols so th~t characters are not sent to 'fLBOB when it is not prepared to accept thea. It is not necessary to keep track of the direction of the trans.ission if the aicrocoaputer is only being usal as a terainal, since tile person at the keyboard vll1 know when to type br context. IYen in this case, however, watching for the control characters can be used to iapleaant so.e yery helpful fea~Qres such as (1, -type-ahead" buffering of co •• ands to be sent to IILBOR, anG (2) retransaission of characters already sent to WILBOR but igDored because WILBUR interrupted with a break and a .essaqe.

    There is one exception to the state.ent that the triplex does not echo back characters which are sent to it. When it re=e1yes 4 carriage retorn, WILBUR v1l1 i.aediately send back aaDther carriaqe retarn followed by a linefeed (hex ODOl in lS;1I). It expects that local display of the CR has returned the prilltiDq aeclaanis. to the left edge but not adyanced the paper: hence it seBels the liaefeed. The local 11croCOlpatar software should ba written so that (1, 1 carriaqe return received when the carriage is at the left aarqin causes no action. and (2) a linefeed is the only character which advances the "paper".

  • 16

    (:, DOIILOIDIIG PIOGRl~S TO THE REftOTE COKPOTER

    the section describes an exa.ple of the software necessary to transfer a block of data - a co. piled proqra., for eKa.ple -fr,a IfLBOB to a alcroco.puter attached as a VILBoR ter.inal.

    There is a standard foraat for coapiled aicroco.puter prograas .hich originated with the I.~EL 8008 asseabler and is used at SL1C by asseablers for the IITEL 8008, 8080, and 87'8, the ZILOG zao, IOTOIOLl 6800, and SIGIBTICS 2650 alcroprocessors. It can, of course, be used for arbitrary data as vell as co. piled progra.s.

    The data file consists of one or .ore records of teKt, each corresponding to one or .ore bytes to be loaded into consecutive lo:ations in the .lcroc3.putet's aeaory. (1 call thea "records· rath~r than -lines· or "text lines· to avoid confusion with ·sarial line" .eaning the hardware connection.) the records are aa:Dded in hexadeciaal; the only characters which occur ~re 0 to 9 ~Dd I to P, and eacb characters therefore contains foor bits of infor.ation. fhe for.at is:

    where

    LL

    1111

    Tf

    LLllll'~DD •••• DDCC

    is the le.9th, in bytes, of the data being sent.

    is the address in the aicrocoaputerfs .eaory of where the data is to be stored.

    is a Duabar indicating the ·type- of data. It is al.ost ~lwars zero; non-zero yalues are used for special records. The use of these special recoris has Dot ,et been staDdardized, although so •• proposals haye been aade [2].

    DD •••• DD is the data being sent. There should be twice as .any D's as the value of the LL field, since LL is the length in by~es and tvo D's are necessary to specify each byte.

    CC is the checksua used to check for trans.ission errors. CC is coaputed so that the sua of all the bytes represented by all the hexadeci.al pairs in the striD9 (fro. £L throQqh CC) 1111 be zero lodolo 256. (See the proqra. belov.)

    For exa.ple, the follovla9 record would cause the data 01234561891BCDBF to be stored startinq at location 5555:

    0855550001234S61891BCDBF8!

  • 17

    Sending a file froa WILBUR tl the aicrocoaputer requires (1. soa8 special character seqaence be ased to infora the ai=rocoaputer that data records are coaing, and (2) soae aech&nisa for the aicrocoapater to infora IILBul if the record wss receiYed correctly, or if it aoat be retransaitted. The IILBua eKecfile IIL.CG.ICS.tIB'lL01D uses t~e following conyentions to accoapllsb the traDsalssioD:

    (1) It sends tbe sequence ESC ETB (bas 1B17 in ISCII) at the start of each record of the data file.

    (2) It sends the sequence BSC DC1 (hex 1B11 in AS:II) to ask if the preY10usi records(s, vere successfully receiYea and placad ~n aeaory. If so, it expects to receiYe the t.o cbarac~ers 01 followed by a carriage return, and vill proceed vith aore records of the file. If anything otber than 01 is sent, it retransaits the records(s,.

    The two hex digits sent in response to ESC DC1 should coastitote a status byte indicatinq what errors occurred. 1 re~sonable procedure for .aintaining that byte within the aicrocoaputer is the following:

    (1, lfter se.ding the current yalne of the status byte in response to ESC DC1, the status byte should be cleared to zero.

    (2) If a correctly for.atted data record is receiyed which can be successfully lo~ded into a.aory, the low-order bit of t~e status byte should be Died on.

    (3, If any error is detected in a data record - character parity. invalid foraat, incorrect checksua, bad address, etc. - soae bit or bits other than the lov-order bit of the status byte should be Oled on.

    This procedure 1s fairly su~e to quarantee that the data is being correctly loaded.

    The following prograa sketch is an exaaple of how the pr~gra.a in the llicrocoapater aight be organized to work a.s a ter.inal wbich can load data into its local ae.or, using' the ab~ye cOByentions.

    LOJP: CALL GEfCH1R(char, "Get a character" IF char=ESC THEI BEGIN ·start of escape sequence"

    CALL GETCB11(char) "Get 2nd character" IP char=DC1 THEN BEGI. "BSC-DC1: send status.

    CALL IftIf( lSCII8!I(status/16») "1st hex digit-CALL I!IT( lSCIIBBI(ftOD(status,16))) "2nd diqit" status = 0 "Reset the status" CALL f!Ir(Ca, "Send a carriage rtn" END

  • Gl~O

    BIlli:

    P1Bli:

    18

    ELSBIP charalTB TREK BEGII "BSC-ETS: load data"

    liD LOOP

    checksua=O "Zero the chectsua- ~ CILL HIIII(length) "Get the length" CILL BBIIJ(biqhaddress) "Get the address in 2 parts" CALL HIIII(lovaddress) address • 256.h19~address+lo.addr.ss CALL BIIII(trpe) "Get the type" IP tJP~O GOTO LOOP "Ignore non-zero record type" WRILI leDgth)O BIGI. "Loop for all data bytes"

    CALL BEIIN(data) "Get a byte" a.aory(address) = data "Put the data in ae.or," status = status OR 1 "Tarn on the low bit" address = address+1 "'ext aeaor, address" lengt. = length-l "CoDtinue for all data-BID

    CALL BBIII(cbeck) "Get the chectsu.-IF checksua,=O TBBI status=status 01 02 "Cbksua err" BID

    status = status OR 40 -Bad hex digit" Goro LOOP status = status OR 80 "Parity error" GOrO LOOP

    HIIII: PBlCEDUBB(byte) BEGII "Bead two hex diqits· CALL GltteRll (x) CALL HBICONYERT(x, CILL GRTeSIR(y) CALL BEICO'VER~(y) byte = 16*x+y chects •• = checksua+byte RITOBI liD

    BII:ONYEIT: PROCBDQR!(val) BIGI. ·Conyert a hex char to binary· IF val>a'O' lID Yal='I' IBD Yal

  • 19

    GBr:Bli: PBOCEDOBB(a, BEGI. -Get a received character" LOJP "!eanwhile service the keyboard R

    IP keyboard_char THEN BEGIN CALL I(£YII(z) CALL DISPLA t (z) ClLL XII! (z) BID

    IP keyboard_break_key rHE! BBGI. CALL SEIDBIl{ EID

    IF received_char THBI BBGII ClLL BC' (z)

    REPEAT END

    IF parity_error GO!O PIERR IF z ~= DC1 THER CALL DISPLlt(z) BEfORI BID

    Hote that the routine HBICONYEBT branches to the label ERBJB when it finds an inyalid hex digit. After settinq an error bit in the "status· byte, ERROR then aborts the subroutine calls that led to HEIeO"!I! by resaaing the outer loop_ If subroutine call return addresses baye been pushed onto a finite stack, the stack aost be purged of the return addresses ~t that point.

    The proqra. described above .ay detect so.e errors too late t3 prevent data froa being loaded into aeaory incorrectly. For eKl.ple, a tvo-bit error in the address which preserves correct parity vill allo. data to be loaded at the incorrect ~ddress, and the error v111 not be detected until the checksua is receiYed. 1 aiaiiar tvo-bit error in the length field, or a co.pletely dropped or added character in the data field, aay allow incorrect data to be teaporarily stored. xo avoid such .ishaps, the progra. could save the receiYed record in ~ buffer and not load any data into ae.ory until the checksu. has been verified. In practice, the probability of errors not detected by incorrect parity has been low enough to .ake such precantion nallecessar,.

    Appendix II contains a listing of a prograa which iapie.ents a teletype eaalator and loader for the INTEL 8080. A source copy of the progcaa is in WYL.CG.LJS.LIB'fTYL01D " CAT.

  • 20

    {1] "Interface Between Data fer_inal Bquipaent and Data C, •• unicatioD Bquip.ent Eaployinq Serial Bin~ry Data Interchange-, Ell Standard as-232-C, Electronic Industries Association, Washington DC, August 1969.

    (2] P.G. Poraaniat ("OSTEI, Inc.) ·Proposal for Standard Z8D code", Dr. Dobb's Journal of Co.pater calisthenics & Orthodontia (10 tlddinq!" ~arch 1977, p10-11.

  • ) ) )

    APP~NDIX I - EBCDIC/ASCII Translation

    The tables which follow give the detailed translation between ASCII and EBCDIC for all data transferred between the Triplex and remote computers. The translation qenerally attempts to provide equivalent qraphics for printable characters. and equivalent function for control characters. The translation is the same as that qiven in the IBM System/37B Reference Summary, form GX2S-l85B (the successor to the infamous Wqreen card").

    There are seven characters (marked with '*' in the tables> which receive special treatment by the Triplex and are explained in notes followinq the tables, those characters are RT, CAN, CR, BS, NUL, DEL, and EOT. In addition, the DCl character is r..ormally used to siqlla1 the end. of transmission from the Triplex, as described in section II-B. Also note that the proper EBCDIC character with 'fhich to end a line is NL ( "newline"), not CR.

    EBCDIC-TO-ASCII TRANSLATE TABLE

    EBCDIC ASCII EBCDIC ASCII

    *Sf6 ~lUL BS NUL 216 D5 .11 SOH Bl. SOH CN'l'RL-a 21 50S .12 STX B2 STX CNTRL-b 22 FS .13 ETX B3 ETX CNTRL-c 23 164 PF 24 BYP

    *165 HT 189 HT CNTRL-i (TAB) 25 LF BA LF CNTRL-J (LlNEFEED) .16 LC 26 ETB 3.7 ETB CNTRL-",

    *187 DEL 7F DEL ( RUBOUT) 27 ESC IB ESC CNTRL-[ .18 28 189 29 SA SMM 2A SM .0'B VT .0'B VT CNTRL-k 2B CU2 BC FF Be FF CNTRL-l 2C

    *SO CR 2D ENQ B5 ENa CN'r.RL-e SE SO HE SO CNTRL-n 2E ACK B6 ACK CNTRL-f SF 51 SF 51 CNTRL-o 2F BEL B7 BEL CNTRL-q (BELL) IS DLE 18 DLE CNTRL-p 3.1 11 DCl l~ DCl CNTRL-q 31 12 DC2 12 DC2 CNTRL-r 32 SYN 16 SYN CNTRL-v 13 TM 13 DC3 CNTRL-s 33 14 RES 34 PN 15 NL mBA CR,LF 35 RS

    *16 BS Be BS CNTRL-h (BACKSPACE) 36 UC 17 IL *37 EOT B4 EOT CNTRL-d

    *18 CAN 38 19 EM 19 EM CNTRL-y 39 lA CC 3A IB CUl 3B CU3 IC IFS le F5 CNTRL-\ 3C DC4 14 DC4 CNTRL-t ID IGS 11) GS CNTRL-] 3D NAlt 15 NAK CNTRL-u lE IRS lE RS CNTRL_A 3E IF IUS IF US CNTRL-_ 3F SUB lA SUB CNTRL-z

    f\)

    ~

  • EBCDIC ASCII EBCDIC ASCII

    4.0' Sp 20 Sp SPACE, BLANle 78 41 71 42 72 43 73 44 74 45 75 46 76 47 77 48 78 49 79 616 ACCENT GRAVE (REVERSE APOSTROPHE) 4A '" 5E '" CENT-SIGN, CARET, UP-ARROW 7A 3A : COLON 4B 2E . PERIOD 7B • 23 • POUND-SIGN, NUMBER-SIGN, SHARP 4C < 3C < LESS-THAN 7C @ 4.0 @ AT-SIGN 4D ( 28 ( LEFT-PAREN 7D

    , 27 , APOSTROPHE, SINGLE QUOTE 4E + 2B + PLUS 7E 3D EQUAL-SIGN 4F I 7C I VERTICAL BAR 7F 22 QUOTATION-MARK, DOUBLE QUOTE 5.0' & 26 & AMPERSAND 8.0' 51 81 a 61 a 52 82 b 62 b 53 83 c 63 c 54 84 d 64 d 55 85 e 65 e 56 86 f 66 f 57 87 9' 67 9' 58 88 h 68 h 59 89 1 69 ! SA ! 2~ I EXCLAMATION POINT 8A-SB $ 24 $ DOLLAR SIGN 8B ( 7B ( LEFT BRACE SC ., 2A ., ASTERISK 8e SD 29 RIGHT PAREN 8D 5E 3B SEMI-COLON 8E 5F 7E TILDE, NOT-SIGN SF 6.0' 2D MINUS-SIGN 9B 61 I 2F I SLASH 91 J 6A J 62 92 k 6B k 63 93 1 6C 1 64 94 m 6D m 65 95 n 6E n 66 96 0 6F 0 67 97 p 7.0' p 68 98 q 71 q 69 99 r 72 r 6A 9A 6B , 2C , COMMA 9B ) 7D ) RIGHT BRACE 6C % 25 % PERCENT-SIGN. 9C 6D SF UNDERSCORE, BACK ARROWI 9D 6E > 3E > GREATER-THAN 9E 6F ? 3F ? QUESTION-MARK 9F

    I\) I\)

    ) ) )

  • ) ) )

    EBCDIC ASCII EBCDIC ASCII

    AS DH Al DI J 4A J A2 s 73 s D2 K 4B K A3 t 74 t D3 L 4C L A4 u 75 u D4 M 4D M AS v 76 v D5 N 4E N A6 w 77 w D6 0 4F 0 A7 x 78 x D7 P 511 P AS Y 79 Y D8 0 51 0 A9 2 7A z D9 R 52 AA DA AB DB AC DC AD 5B [ LEFT BRACKET:' DD AE DE AF DF BS Ell \ 5C \ BACK-SLASH Bl E1 B2 E2 S S 53 S B3 E3 T 54 T B4 E4 U 55 U B5 E5 V 56 V B6 E6 W 57 W B7 E7 X 58 X B8 E8 Y 59 Y B9 E9 Z SA Z BA EA BB EB BC EC BD ] 5D ] RIGHT BRACKET ED BE EE BF EF CB FH 11 311 11 Cl A 4J. A Fl 1 31 1 C2 B 42 B F2 2 32 2 C3 C 43 C F3 3 33 3 C4 D 44 D F4 4 34 4 C5 E 45 E F5 5 35 5 C6 F 46 F F6 6 36 6 07 G 47 G F7 7 37 7 CS H 48 H FS 8 38 8 C9 I 49 I F9 9 39 9 CA FA CS FB CC FC CD FD CE FE CF FF

    NOTES

    ( 1) All characters for which no translation 1.s listed are translated to an ASCII pound-siqn (.>. (2) Tab (RT) and Newline (NL) characters may be followed by a delay to allow for the motion of mechanical

    printers. No characters are sent during the delay; the line is s~ply in the idle (MARK) state. The f\) amount of delay can be controlled by the WYLBUR "SET RI" and "SET TIlt commands. LA)

    (3) Sequences of blanks may be changed to tab characters if nSET FASTLIST" is in effect and tabs have been set by WYLBUR.

  • ASCII EBCDIC

    *Bg NUL B1 SOH 81 SOH 112 STX 82 S'l'X 113 ETX 83 E'l'X

    *B4 EOT B5 ENO 2D ENO B6 ACK 2E ACK 117 BEL 2F BEL

    *B8 BS 16 BS *169 HT 85 HT

    I6A LF 25 LF .0'B VT .0'B V'l' IIC FF file FF

    *16D CR .0'E SO BE SO BF SI .0'F 51 1.0' DLE 1.0' DLE 11 DCI 11 DCI 12 DC2 12 DC2 13 DC3 13 Tl.f 14 DC4 3C DC4 15 NAK 3D NAK 16 SYN 32 SYN 17 ETB 26 E'l'B

    *18 CAN 19 EM 19 EM 1A SUB 3F SUB IB ESC 27 ESC 1C FS lC IFS 1D GS 1D IG5 IE RS IE IRS IF US IF IUS

    )

    ASCII-TO-EBCDIC TRANSLATE TABLE

    ASCII EBCDIC

    216 Sp 4.0' Sp CN'l'RL-a 21 t SA • CN'l'RL-b 22 II 7F II Ctl'l'RL-c 23 • 78 • CN'l'RL-d 24 $ SB $ CN'l'RL-e 25 % 6C % CN'l'RL-f 26 & S8 & CNTRL-q (BELL) 27 , 7D , CN'l'RL-h (BACKSPACE) 28 { 4D ( CNTRL-i (TAB) 29 ) 5D ) CNTRL-J (LINEFEED) 2A * SC * CN'l'RL-k 2B + 4E + CN'l'RL-1 2C 6B CN'l'RL-m (CARRIAGE RETURN) 2D 60 CN'l'RL-n 2E . 4B CNTRL-o 2F / 61 I CNTRL-p 3.0' 0 F0 fd CNTRL-q 31 1 FI 1 CNTRL-r 32 2 F2 2 CNTRL-s 33 3 F3 3 CNTRL-t 34 4 F4 4 CN'l'RL-u 35 5 F5 5 CNTRL-v 36 6 F6 6 CNTRL-w 37 7 F7 7 CNTRL-x 38 8 Fa 8 CN'l'RL-y 39 9 F9 9 CN'l'RL-z 3A 7A CN'l'RL-[ 3B J 5E J CNTRL-\ 3C < 4C < CNTRL-] 3D 7E CNTRL-A. 3E > 6E > CN'l'RL-_ 3F ? 6F ?

    )

    SPACE, BLANl{ EXCLAMATION POINT QUOTATION-MARK, DOUBLE OUOTE POUND-SIGN, NUMBER-SIGN, SHARP DOLLAR SIGN PERCENT-SIGN AMPERSAND APOSTROPHE, SINGLE OUOTE LEFT-PAREN RIGHT PAREN ASTERISK PLUS COl1MA MINUS-SIGN PERIOD SLASH

    COLON SEMI-COLON LESS-THAN EOU~..L-SIGN GREATER-THAN onES TION-tvlARR

    )

    f\) .,J:::-

  • )

    ASCII

    4.9' @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4A J 4B K 4C L 4D lo!l 4E N 4F 0 58 P 51 0 52 53 5 54 T 55 U 56 V 57 W 58 X 59 Y 5A Z 5B [ 5C \ 5D J 5E A-5F

    NOTES

    EBCDIC

    7C @ Cl A C2 B C3 C Col D C5 E C6 F C7 G C8 H C9 I Dl J D2 K D3 L D4 M D5 N D6 0 D7 P D8 0 D9 R E2 5 E3 T E4 U E5 V E6 W E7 X E8 Y E9 Z AD [ E.0' \ BD - ] 4A A-6D

    AT-SIGN

    LEFT BRACKET:' BACK-SLASH RIGHT BRACKET CENT-SIGN, CARET, UP-ARROW UNDERSCORE, BACK ARROW

    )

    ASCII

    6B 61 a 62 b 63 c 64 d 65 e 66 f 67 9 68 h 69 i 6A J 6B k 6C 1 6D m 6E n 6F 0 7B p 71 q 72 r 73 s 74 t 75 u 76 v 77 w 78 x 79 y 7A z 7B ( 7C I 7D ) 7E

    *7F DEL

    EBCDIC

    79 81 a 82 b 83 c 84 d 85 e 86 f 87 9 88 h 89 i 91 J 92 k 93 1 94 m 95 n 96 0 97 p 98 q 99 r A2 s A3 t A4 u A5 v A6 w A7 x A8 y A9 z 8B ( 4F I 9B ) 5F

    )

    ACCENT GRAVE (REVERSE APOSTROPHE)

    LEFT BRACE VERTICAL BAR RIGHT BRACE TILDE, NOT-SIGN

    ( RUBOUT)

    (1) ~e tabLe assumes that 'SET UPLOW' is in effect. If 'SET UPPER' is in effect, lower-case letters a-z are translated by WYLBUR into upper case letters.A-Z.

    (2) Carriage return (CR) and End~Of-Text (EOT) indicate normal: and abnormal ter.mination of the current line, respectively. In response to a CR, WYLBUR will transmit· a CR and a LF; in response to EOT, WYLBUR ~ill transmit three asterisks ('***') followed by a CR and a LF.

    (3) Backspaoe (BS) will logically erase the previous character if 'SET NO BACK , is in effect. If 'set back' is in effect, Backspace will. be translated by WYLBUR to the EBCDIC Backspace.

    (4) Cancel ( CAN) will loqically erase the previous character regardless of whether "SET RACK" is in effect.

    (5) Tab characters (HT) may be sent only if tabs have been set in WYLBUR and there is a valid loqical tab stop remaining on the current line. The HT will be replaced by enough blanks to move the loqical cursor to the next tab stop. Tab characters sent when not allowed will ellcit the WYLBUR reponse I\) "UNSET 'rABS - RETYPE". \J1

    (6) Both N~ and DEL are ignored when sent to WYLBUR.

  • APPENDIX II

    1616/81685

    161691616/8

    gS9R1B2

    )

    8H816/81685 TERMINAL EMULATOR. AND PROGRAM LOADER

    119181816 189181616

    B91iI162

    JJBfJ8B JJJ6164S BJ6Blg SgBf18 SSaBl

    1539 *******************************************.*.***.****.**.***.**** •• *** 15416 • * 1541 * TERMINAL EMULATOR AND PROGRAM LOADER * 1542 * FOR THE INTEL 816816/81885 MICROPROCESSORS * 1543 * * 1544 * This proqram simulates a TTY-like terminal cODDllunj.cation * 1545 * with the SLAC Triplex, and watches for special escape * 1546 * characters that indicate that data is to be loaded into * 1547 * the local 816818/81885 memory. This proqram can be found in * 1548 * the WYLBUR file WYL.CG.LJS.LIB#TTYLOAD. * 1549 * * 15518 * The fo11owinq primitive routine must be supplied: * 1551 * * 1552 * XMIT Transmit the ASCII character in "Aft over the * 1553 * serial line with correct parity. * 1554 * * 1555 * DISPLAY Display the ASCII character in nA" on the local * 1556 * display device. * 1557 * * 1558 * SENDBRK Transmit a break (21618 millisecond space) over the * 1559 * serial line. * 15616 * * 1561 * RCV Check if the serial line receiver has a character. * 1562 * If SO, return with "NZ" set and the character in * 1563 * "Aft. If no character, return with HZ" set. * 1564 * If any line errors occur (parity error, etc.) * 1565 * return with "C" setJ otherwise "NC" should be set. * 1566 * * 1567 * KEYIN Check the local keyboard for characters. * 1568 * Return with the character in "A" and "NZ" set. * 1569 * If no character is ready, return with "Z" set. * 15718 * * 1571 * All of these routine are expected to destroy no registers * 1572 * except "Aft. * 1573 * * 1574 * L. Shustek, 6/28/77 * 1575 • 7/168/77 (stack-restore error exit) * 1576 * 9/24/77 (iqnore non-zero record types) * 1577 * * 1578 **********************************************************************. 1579 • 15816 1582 STKPTR 1584 1585 STATUS 1587 1588 *

    ORG DS

    DS

    X' 916B18' 2

    1

    1589 * STATUS BYTE BIT FLAGS 15918 * 1591 STRCVERR EOU 1593 STHEXERR EQU 1595 STCHKERR EQU 1597 STMEMERR EOU 1599 STLOADED EOU

    X'8S' X'4S' X'lS' X'ff8 ' X'Bl'

    .)

    (Some RAM location) SAVED STACK POINTER

    STATUS BYTE

    RECEIVED CHARACTER ERROR BAD HEX DIGIT BAD CHECKSUM BAD MEMORY LOCATION· LOADED OK

    )

    6. 7. 8. 9.

    lB. 11. 12. 13. 14. 15. 16. 17. 18. 19. 211. 21. 22. 23. 24. 25. 26. 27. 28. 29. 316. 31. 32. 33. 34. 35. 36. 'In. 38. 39. 4B. 41. 42. 43. 44. 45. 46. -!7. 48.

    49.

    5.9'. 51. 520 53. 54. 55. ro 56. 0'\ 57.

  • ) ) )

    8.8"S.8'/8.8'85 TERMINAL EM'O'LA'rOR AND PROGRAM LOADER

    16.8'2 * 59. 16.8'3 * INITIALIZATION 69J. 16.8'4 * 61.

    1618916.8'3 SSSBS 16S5 ORG X1 SSSS' 62. 8/68S.8'/6 21SSJ6B 16S7 LODI HL,S 63. BB8fi1B3 39 1689 ADD HL,SP GET THE CURRENT STACK POINTER 64. SBSSB4 22.8'S9B 1611 ST HL,STKPTR SAVE IT TO RESTORE IF ERRORS 65.

    1613 * 66. 1614 * THE MAIN LOOP 6" • 1615 * 68. 1616 * 69.

    SBSSB7 CDSCBB 1617 LOOP CALL GETCHAR GET A CHARACTER 7H. BXJSf1SA FE1B 1619 Cl~lPI @ESC 71. BSSSgc C2B7SS 1621 JMP NZ,LOOP NOT AN ESCAPE: JUST,,'LooP 72. SgSSSp CDSCSS 1623 CALL GETCHAR GET THE CHARACTER AFTER ESCAPE 73. ssaS12 FEll 1625 CMPI @DCl 74. SS8.0'14 C22ASB 1627 JMP NZ,NOTDC1 75.

    1629 * 76. 163S * ESC-DCl SEND' STATUS TO WYLBUR 77. 1631 * 7S.

    BBSS17 3A0'29B 1632 LD A, STATUS 79. B0SBIA CDBBS.0' 1634 CALL SEIIDHEX SEND STATUS AS 2 HEX DIGITS 8.0'. .0SS.0ID 3E.0'D 1636 LODI A,@CR SEND A CARRIAGE RETURN 81, BBS.01F CnB981 163S CALL XMIT 82. BS8.8'22 3EgS 164.0 LODI A,B CLEAR THE STATUS BYTE 83. .0118.024 32fi129.0' 1642 5'1' A, STATUS 34. .014S1127 C3117S.0' 1644 JMP LOOP 85 ..

    1646 * 86. B.0'SB2A FE17 1647 NOTDC1 CMPI @ETB 87. BBSfl2C C2B7S.0' 1649 JMP NZ,LOOP (OTHER EsC-X PAIRS ARE NOT SPECIAL) 38.

    1651 * 99. 1652 * ESC-ETB LOAD'" INTO MEMORY 98. 1653 * 91.

    BBSlb2F 161618 1654 LODI D,II D WILL BE THE CHECKSUM 9~. BBSS31 CDCASB 1656 CALL HEXINP GET THE LENGTH BYTE 93. B6SS34 5F 165S LOD E,A E WILL BE THE LENGTH 94. B.8'SB35 CDCAS.0 16618 CALL HEXINP GET THE HIGH BYTE OF THE ADDRESS 95. BSaS38 67 1662 LOD H,A SAVE IT 96. 8118.039 CDCAS.0' 1664 CALL HEXINP GET THE LOW BYTE OF THE ADDRESS 97. BIISII3C 6F 1666 LOD L,A HL NOW HAS TfIE LOAD. AnDRES 5 9a. RJIlJSB3D CDCAS.0' 166S CALL HEXINP GET TYPE BYTE 99. RJB8B4B B7 1678 lOR A IS TYPE ZERO? 19B. Sf481141 C2.8'7SRJ 1672 JMP NZ,LOOP NO - IGNOaE THIS RECORD 1.0'1. .03SB44 3E2A 1674 LODI A, '*' DISPLAY A STAR JUST TO SHOW THAT 1.0'2. gBSI!J46 FF 1676 CALL DISPLAY WE KNOW WE ARE TO LOAD MEMOP.Y. 193.

    167S * 10'4. I!JIJSflJ47 7B 1679 LOADLOOP LOD A,E GET THE LENGTH 10"5. S0"S1648 B7 1681 lOR A TESt.[' IT 10'6. S8S.8'49 CA628B 16S3 JMP Z,LOADCHK ZERO: DONE lEI7 • g8SB4C CDCASB 16S5 CALL HEXINP GET A DATA BYTE 188. I!1WSB4E' 77 16S7 S'l' A,(HL) *** THE BIG STORE *** 1.0'9. Bf!JaftJ5fi1 46 16S9 LOD B,M CHECR TIIAT IT WENT IN (IE NOT ROM 11.0'. 181118.0'51 B8 1691 CMP B OR NON-EXISTENT MEMORY) 111. fj8SB52 C2778B 1693 JMP NZ,ERRMEM BAD ••• 112. ~ 911181655 3Ag29f4 1695 LD A, STATUS OTHE~IISE TURN ON 113.

  • SBSB/SB85 TERMINAL EMULATOR AND PROGRAM LOADER

    •• 8858 F6B1 1697 IORI STLOADED fljBSB5A 320'29.0 1699 ST A, STATUS •• 8115D 23 17111 I~ HI. .0'.0'8.0'5E 1D 17.0'3 DEC E .0'BSII5F C347SS 17.8'5 JMP LOAD LOOP

    17.8'7 * .0'.8'SB62 CDCAS.0' 17.8'S LOADCHlC CALL HEXINP .0'BS.8'65 7A 171.0' LOD A,D BB8.8'66 B7 1712 lOR A B.0'SI167 C272aB 1714 J.r~P NZ,ERRCfIK .0'BS.8'6A C3B7S.0 1716 JMP LOOP

    1719 * 172.0' * ERRORS 1721 *

    B8SB6D B64B 1722 ERRHEX LODI B,STHEXERR .0'BSB6E' C37ESB 1724 JMP ERRS TORE .0'IJaB72 B61.0" 1726 ERRCHK LODI B,STCHKERR S8SB74 C37Ea.0' 172S JMP ERRS TORE flJ.0'S.0'77 .0"6ga 17318 ERRMEM LODI B, STl~EMERR BBS.0'79 C37ES.0' 1732 JMP ERRS TORE .0'SS.0'7C 1868.0" 1734 ERRLINE LODI B,STRCVERR

    1736 ." B8S117E 3AfJ29g 1737 ERRSTORE LD A, STATUS BIiJSBSl BS 1739 lOR B B1I8.0"82 32829B 1741 ST A, STATUS Bf6Sf!JS5 2A!iJJiJ9.0' 1743 LD HL,STKPTR II.0S1188 F9 1745 LOD SP,HL II11SIIS9 C31J7SB 1747 J.r~ LOOP

    "'\

    ) )

    TRE "LOADED OK" STATUS BIT

    IKCREMEN~ THE ADDRESS DECREMENT THE LENGTH AND CONT lNUE

    GET THE CHECKSUM BYTE IS THE CHECKSUM ZERO?

    NO ••• YES: LOADING WAS SUCCESSFUL

    BAD HEX CHARACTER

    BAD CHECKSUM

    BAD MEMORY LOCATION

    RECEIVED CHARACTER ERROR

    'OR' ERROR BIT INTO STATUS BYTE

    RESTORE THE ORIGINAL STACK POINTER

    )

    114. 115. 116 • 117 • 118 . 119. 12.0' . 121 . 122. 123. 124.

    126. 127. 12S. 129. 13.0' • 131 . 132. 133. 134. 135. 136. 137. 133. 139. 14JiJ • 141. 1·12.

    f\) (X)

  • ) ) )

    888B/8B85 TERMINAL EMULA!OR AND PROGRAM LOADER

    IIB8B8C CDBF81

    1lI1lI8BSF CA9AS8 IlIl1l8S!) 2 DA 7 C S8 SBSB95 FEll I?JB81?J97 C8 gg8J498 FF 1?J1iJ8B99 C9

    IlIBSI?J9A E7 IlIIlISS9B CA8CSI?J 1lI88149E FEgS IlIBSBAiJ CAAASJ:J gJJSBA3 CD.0'9S1 gIJSSA6 FF BliJSSA7 C38CSJ:J

    g!6SI6AA CD16Sl BB816AD C38C8B

    17514 *********************************************************************** 1751 * * 1752 * GETCHAR: GET A CHARACTER FROM THE SERIAL LINE RECEIVER * 1753 * AND ECHO IT THE.T.BE LOCAL DISPLAY. * 1754 * * 1755 * WHILE w.AITING FOR Ca~RACTERS, PROCESS ANY ACTIVITY FRO~ * 1756 * 'l'HE LOCAL KEYBOARD DEVICE. THE "NULL" KEY ON TJfE KEYBOARD * 1757 * IS USED AS THE ATTENTION KEY TO INDICATE THAT A BREAK * 1758 * IS TO BE SENT TO tNLBUR. * 1759 * * 176B * ANY ERROR CAUSES LOADING TO BE IMMEDIATELY TERMINATED * 1761 * BY JUMPING TO THE MAIN LOOP APTER RECORDING THE ERROR * 1762 * AND RESTORING THE STACK POINTER * 1763 * * 1764 * DESTROYS: A * 1765 * * 1766 *********************************************************************** 1767 GETCRAR CALL RCV CHECK FOR A CHARACTER 1769 * 17714 1772 1774 1776 1778 178B 1782 * 1783 GETCHRB 1785 1787 1789 1791 1793 1795 1797 *

    JMP JMP CMPI RET CALL RET

    CALL JMP Cl-iPI JMP CALL CALL Jl4P

    Z,GETCHKB C,ERRLINE @DCl Z DISPLAY

    KEYIN Z,GETCHAR @NUL Z,GETCHBRK XMIT DISPLAY GETCHAR

    1798 GETCHBRK CALL SENDBRK 18Bg JMP GETCHAR

    NONE - CHECK KEYBOARD ERROR: STOP LOADING GOT A CHAR. IS IT DC1 (XON>? YES - RETURN WITHOUT ECHOING OTHERWISE ECHO IT AND THEN RETURN

    CHECK FOR A KEYBOARD CHAR NONE - KEEP WAITING IS IT NULL? YES: GO SEND A BREAK NO: TRANSMIT THE CJL~RACTER AND DISPLAY IT LOCALLY AND KEEP ~mITING POR A LINE

    SEND A BREAK (2SJ:J MS. SPACE) AND KEEP LOOPING

    IT.

    CHAR.

    :;

    144. 145. 146. 147. 148. 149. 1511. 151. 152. 153. 154. 155. 156. 157. 15S. 159. 16.9'. 161. 162. 163. 164. 165. 166. 167. 168. 169. 17IJ. 171. 172. 1'/3. 174. 175. 176. 177. 178. 179.

    f\) \0

  • 816SB/8BS5 TERMI~ EMULATOR AND PROGRAM LOADER

    BB8BB16 F5 SBSI!r31 971879787 .0'.0'S.0'B5 CDBDSB 8.0'S.0'B8 F1 .0'IlISIJB9 CDBDSS J!J.0'8.0'BC C9

    .0'.cJ8.0BD E6.0'F

    .0'.0'S.0BF FEBA

    .0'0'S.0C1 3F gBSBC2 CE3.0' .0'.0'SSC4 27 .0'.0'S0C5 cnB9S1 .0'BSi1CS E'F .0'BS.0'C9 C9

    IlJBS9CA C5 1lJ1J8R1CB CD8CS0' .0'PJSIJCE COE3S0' .0.0'S001 B7 fd7H1 187 .0'.0'S0D5 47 .0'gSBD6 COSCS.0" gfJSP.JD9 CDE38.0' .0'PJSf1DC 8.0' fdBS8DD 47 .0'fJSSDE S2 BBSHDF 57 .0BSf!JEB 78 .0'8af!JE1 Cl RlJ21af1E2 C9

    )

    18S3 *********************************************************************** 1884 * * 18B5 ~ SENDHEX: TRANSMIT itA" AS. 2 HEX DIGITS * lS86 * * 1887 * DESTROYS ONLY "A·~. * lSBS * * lS89 *********************************************************************** lS1B SENDHEX PUSH AF SAVE IT lS12 ROT L,4 SWAP BYTE HALVES 1814 CALL DUMPNIBL OUTPUT 1ST 4 BITS lS16 POP AF RETRIEVE IT 1818 CALL DUMPNIBL AND OUTPUT 2ND 4 BITS lS28 RET 1822 * lS23 DUMPNIBL AND! X'BF' 1825 CMPI 19 1827 CMC, 1829 ADCI 'B' 1831 DAA, 1833 CALL XMIT 1835 CALL DISPLAY 1837 RET 1839 *

    ISOLATE A HEX DIGIT CONVERT IT TO ASCII .0'-9, A-F (THIS TRICKINESS IS DUE TO JEZ$CG)

    (CLEVER, EH ~lHAT?) TRANSl4.1 TIT DISPLAY IT LOCALI.Y

    1848 *********************************************************************** 1841 * * 1842 * HEXINP: GET TWO HEX CHARACTERS FROM THE LINE AND RETURN' * 1843 * THE BIIlARY VALUE IN "A". * 1844 * UPDATE THE CHECKSUM IN REGISTER D. * 1845 * * 1846 * DESTROYS ONLY A. * 1847 * * 1848 *********************************************************************** 1849 HEXINP PUSH Be SAVE BC 1851 CALL GETCHAR RECEIVE A CHAa~CTER 1853 CALL HEXCONV CONVERT FROM HEX TO BINARY 1855 ROT L,4 SHIFT TO UPPER 4 BITS 1857 LOD B,A AND SAVE THEM 1859 CALL GETCHAR GET THE 2ND ca~RACTER 1861 CALL HEXCONV CONVERT FROM HEX 1863 ADD B COMBINE WITH HIGH-ORDER BITS 1865 LOD B,A SAVE TilE COMPLETE BYTE 1867 ADD D UPDATE THE CHECRSU,U 1869 LOD D,A 1871 LOD A,B 1873 POP BC 1875 RET

    )

    RESTORE THE BYTE TO "Aft RESTORE BC RETURN

    )

    lSI. 182. 183. 184. lS5. 186. 167. 188. lS9 • 19.0'. 191 • 192. 193. 194. 195. 196 • 197. 198 • 199 • 2PJIiI. 231. 2.0'2. 2g3. 2.0'4. 2.0'5. 2JJ6. 287. 2gB. 20'9. 21g. 211. 212. 213. 214 • 215 • 216 • 217. 218. 219. 22. o

    "

  • ) ) )

    8.0'88/81185 '.l'ERMIDL EMULATOR AIm PROGRAM. LOADER

    1878 *********************************************************************** 1879 * * 188.0 * HEXCONV: CONVERT THE ASCII CHARACTER IN "An TO THE * 1881 * EOUIVALENT HEX DIGIT. * 1882 * IF NOT HEX, ABORT TO MAIN LOOP. * 1883 * * 1884 * DESTROYS If An (ONLY IF HEX) * 1885 * * 1886 **************************************H********************************

    16BSI6E3 D5 1887 HEXCOJ!.W PUSH DE BII8HE4 57 1889 LOD D,A SAVE THE CHAR SII8BE5 FE3.0' 1891 CMPI I B' .0'W8BE7 FA6D8B lS93 JMP S,ERRHEX SMALLER THAll B S.0'SBEA FE3A 1895 CMPI ' : . : IS 9 PLUS 1 .0'IISBEC FAB581 1897 JMP 5,HEXOK IT IS A DIGIT .0'.8I1EF FE41 1899 CMPI lA' CHECK FOR UPPERCASE A-F •• 8.0'1'1 FA6D8.0' 19B1 JMP 5,ERRHEX TOO SMALL; NO GOOD •• 8.0'1'4 FE47 1UJ3 CMPI IG' 1I.81JF6 FU381 19.85 JMP 5,LET"rER IS IT ••• .0'.8161'9 FE61 19.0'7 CMPI la' HOW ABOUT LOWERCASE A-F? 1I.8BFB FA6D8B 19.0'9 JMP 5,ERRHEX TOO SMALL fj~S9PE E'E67 1911 Cl·lPI Iq' SBS1fdiJ F26DSJJ 1913 ,JMP NS,ERRHEX TOO BIG B8S1.0'3 C6119 1915 LETTER ADDI 9 FIXUP LETTER VALUES .0'11810'5 E6BF 1917 HEXOR AND I X 'fiJF I AND CHOP OFF HIGH-ORDER BITS SB81flJ7 D1 1919 POP DE S831g8 C9 1921 RET

    1923 *

    22S. 229. 23.0'. 231. 232. 233. 234. 235. 236. 237. 238. 239. 24.0'. 24,1. 242. 24.3. 244. 245. 246. 247. 248. 249. 25.0' • 251. 252. 253. 254. 255.

    ,...... f-l 0:» CIl W IT I-' '-./

    ..