IMD 1.17: 11/11/2014 14:55:55 82VKXBVERDOS C* VERSADOS/RMS68K OBJECT 4.4 SN=48634 16 OF 22  BT16\82VKXBVERDOS 0420¿:-,3SRequest Disconnect ÿUnknown SDLC Response ÿ24éééé G1SSCT ASREL' NTS SSCT SAF%(…System Service Control Task+2pOUTTERM NSSCT pNTSSERV .JF3"$ & (Aú0<NAg.H瀀 |`6 DATAB˜³ÈnúF3Nu,HOî€ OCîaêHîŠB®¢~Aî¦1|ÿÿCè"!IB¨Aè^QÏÿèaà~F3Aî1|ÿÿCè"!IB¨AèJQÏÿè~AîF1|ÿÿB¨Aè"QÏÿðpýNAIî„*LF3 -g (@,gì+lB¬&lkJ,fž f|ÿÿ`Ä F3gH瀀 |`H&l ÿÿgp Aú(Cú4°gAè³ÈnôH瀀 |`F3 (Nû.NTS2.SSCr)m+L`ÿZaô |d0<NA`ÿ>€F3 oH瀀 |`ÂAú åˆÑðüNФ¤¤šš¤€F3 oH瀀 |`‚Aú åˆÑðüNÐŠŠŠØØŠ&L€F3 oH瀀 |`@Aú åˆÑðüNÐ"""öÿÿþÐÿÿþÐ+F3°+gtadfÿ "úÿ0< I0ÛQÈÿü|ÿÿal`þVaºfþæ0< J4ÛQÈÿüI3|ÿÿ(HB,aBýrajgeô`”g |ÿÿ`þ ƒgðÔ&L`ŒalfI3þ˜0< J"K4ÙQÈÿü!k !k!k !k|ÿÿ(HB,aBý ageôF3`,g |ÿÿ`ý°a€`ý¨ÔfýÔJ,gýÌ`ÿ LCîÎ$I$üSSCT$ü PF3.B$ü. ER4üR $:ÖÂraÜÂraÔÂraÌÂraÄÂra¼Âra´I3Âra¬`DCúbEú "<CaBüf$:†EîÎ$Â$Â$ Kra‚Âr azAèÂrI3@apÂrajÂr adü ¼ CîÎ" ’‰RaBü|ÿÿ`üÔSSCT Error- Code F3STS BCT R E C # R TH RH Data èaaF3SAfîNu o^0ÀNu0<NA~Aî¦ (ÿÿf ¼B(1|Bh!|I3<aaBûxAè^QÏÿÒNuCî„ )g"@`öB¨#HNu~Eî *ÿÿf Bj"jI3B€NuEêJQÏÿæpÿNupJ.™f)@¼ Bª%|( JažaBûNu/JF3g ÿgDü`/ |è0<NA _DüLßNu~EîF *ÿÿfBjB€NuEê3"QÏÿêpÿNu4é8M1TRANSSCN ASREL' NTS TRANSSCNSAG2(…TRANSPORT LAYER - SCAN USER QUEUE³2pNWLNKBQ pNWSETDC pTRADTXQ pTRABTOU pSBGTUSQ pNWDQHD pLCTBEG pNATBEG pNNTBEG pNWLSTC pNWLODSC JTRAMOVB ÚJTRASCAN pNWSIGNAL pSBPTFRBF *¾J3„ &nT + g=|HNs 9(gX&@IúN +g*@|#aA Îgì`<|#aA Äf4$kJ3H B«B«"F«ë B«aA ž#ë(`¦†aA Šf*$y(B‡J*F3€ f( $H( ga `ÿda:`ÿ^&x Gëÿô +g&*@'mB­-fÞI3 ­ aB ÿ2- gÌNsHçôJjgfJjf^CêJk°B€)S€Àü&*xI3€@ GõJ«g+f+ g0 JaB þØ`p)áH+ )áIKë$-I3 g*B°mfð²mfê- fÄg )fžaB þŽ-6f +"g+@8I3  @'h"B¨í6aB þfLß/NuHçôCêpÀü&*x Gõ*k *— gJjF3 f¦* * Aí< g @²( fô´( fî`ÿ:B Ší6* fgRmO3 H`ÿj JaB ýð­ g,/ (m$ìì+l$gí  UaB ýÂaB ý¾(_F3 `ÿT"<ÿ`"<ÿ`"<ÿ*x Cêp1² QÈÿø3A B‘¼ ÑÑ>3 ||Bi|#B)BiBjBª5|4-G `þ24éé éAG1TRANSSUB ASREL' NTS TRANSSUBSAHW(…TRANSPORT LAYER - MOVE DATAÊ2JTRACTOLC XJTRACTOLL JTRADTXQ pSBSDLCKL JTRABTOU lpSBPTXMQ JSNDBIU $pLCTBEG pNATBEG pNNTBEG pDBUFSZ pTRAMOVB pNWLNKPB pNWSIGNAL pSBPTFRBF pSBGTFRML *ôF3 / 0-gÆ f¾(m 2-*-f°- fZ fœ U,F3 gAì pN@`| ì`8*,,, h6pN@`Nq`Ú+F,B€08 ]@"I3€ XAÒ¬SƒÀ;A*aB ÿpgkí aj(_Nuí “m*$HCê IB€08 ¼ F3 B)mmBi><- f>ÑRmgú+l0í |B)F3 Bi, g éí XˆY€XG3m\ˆ]€°­0mÑ -0­ Þ@"mF3 ,"ä‰$B` ÙQÉÿü`ÙQÊÿüÑ­,‘­0J’g/a¸$_-gÿ8`4-I3 ga€`Bì­  UaB þd­+l gí- ga4`F3 ìa\`þ6aT(_Nu- f4 fî+l,+l0X­,Y­0B€08 U@I3 "Ò¬ƒÀfr;A*aB ýèg nþxí $H“m*- f|"li B-F3 J-fi Bm( ) f 2)Aóÿ;A( -0Aê.‡ nB‡-(ÁF3  ¾x b ÁA`þ¬í B‡>8  € A`þm AêB€08 F3 B‡BjB* 2-(g0ÁT‡U€°­0mþ` -0èÿþB* `þNGíB¬ +g&@F3 `ö'LNu&x B­Gëÿô +g&@`ö'MNu5G-f| BjB* mL3@ -gG ¾- f / aB ü¨*_Nu JaB üžfNup N@/ -6gÆ-6gF3 ¼(m8- 6g<$m8 ¾jg€`ÿÿaÐJ€oâ0< m@&-D(¶€F3 l(„™­DÙ¬,äŽD` ÙQÎÿü`ÙQÌÿüJ€g|fí 6+H@L3€ g,­ 6­ 6a¨ì UaB úà­ 6ga `þ> JaB úÊ`þ4(_NuF3 /$m< JaýNu/ « g +fJS ë `ë AëaB ùÈB¬!LF3 (_$@"L'jg*ë `"/ « gÊ +gÄ$L"@'igë  kzI3! ,) h6pN@`Nqé|  k(IaB ù\(J`° F*x  ª!j!j @3 !j éê k(IaB ù&pÀü&Aõ h(JaB ù(_Nu4éééé ééé' SDLC ROOT AGgg–bbSYSCMD CDxx \bbMACROS SI‰‰bbOVERVIEWSIŽŽU¦bbBEGSDLC ROëëbbBUFMGT ROôôbbBUFMGTX ROýýbbDLTRACE RObbEXORDLC RObbIBFMGT RObbPORTAIO RO!!bbPORTAV4 RO**bb**ˆSDLC.ROOT.AG*!‰TTL‡SDLCDRIVER,GENERICSECTION'* Arguments substituted via SYSGEN are;**„VERSION-Versionnumber*„REVISIO-Revisionnumber#*„REVDATE-Dateoflatestrevision%*„CHIPTYP-MPUtype-68000or680107*„STATION-Stationtype-1(Primary)or2(Secondary)<*„IFRMBCT-I_framebytecountsincluded-1(Yes)or0(No)E*„RES7201-BoardcontainingtheNEC7201-02(VM02)or400(MVME400)* ‰OPT‡MEX,CRE VER†EQU‡\VERSIONŒVERSIONNUMBER/REV†EQU‡\REVISIOŒREVISIONNUMBERWITHINVERSION /CHIPTYPEEQU‡\CHIPTYPŒMPUTYPE(68000OR68010) 8STATION‚EQU‡\STATIONŒSTATIONTYPE(PRIMARYORSECONDARY)#PRIMARY‚EQU‡1“PRIMARYSTATIONVALUE&SECONDAREQU‡2“SECONDARYSTATIONVALUE 4IFRMBCT‚EQU‡\IFRMBCTŒSEND/RCVBYTECOUNTONI_FRAMES YES†EQU‡1NO‡EQU‡0 0RES7201‚EQU‡\RES7201ŒNEC7201RESIDENTBOARDTYPE* 02 = VM02, or 400 = MVME400 ‰IFEQ†CHIPTYPE-68000 ‹OPT‡P=68000‹IFEQ†STATION-PRIMARY/SDLCPRI†IDNT†VER,REVƒ68000SDLCPRIMARYSTATION:TTL‡68000PRIMARYSTATION(Copyright1982/3MotorolaInc)‹ENDC‹IFEQ†STATION-SECONDAR1SDLCSEC†IDNT†VER,REVƒ68000SDLCSECONDARYSTATION‰XDEF†SDLCRCST,USRACK,SDLCQU,SDLCTTMOUT,SDLCPR,SBSDLCFL,SDLCFL*‰XDEF†INT7201,INT7201A,PWR,SDLCKL,SBSDLCKL*0‰XREF†SBGTFRIR,SBPTFRBF,SBPTFRML,SBPTUSQ,SDLCPCB‰IFEQ†CHIPTYPE-68000 ‹XREF†SBRQPA‰ENDC‰XREF†TRACFLAG,DLTRACE*‰IFEQ†STATION-PRIMARY‹INCLUDEƒSDLCPRI.POLLQ.SI‰ENDC‰IFEQ†STATION-SECONDARY‹INCLUDEƒSDLCSEC.PWRUP.SI‰ENDC‰INCLUDEƒSDLCPRI.INT7201.SI‰INCLUDEƒSDLCPRI.TRANSMIT.SI‰INCLUDEƒSDLCPRI.RECEIVE.SI‰IFEQ†STATION-PRIMARY‹INCLUDEƒSDLCPRI.FRMCNT.SI‰ENDC‰IFEQ†STATION-SECONDARY‹INCLUDEƒSDLCSEC.FRMCNT.SI‰ENDC‰INCLUDEƒSDLCPRI.SUBRTN.SI‰ENDéC‚******************************************************************‚*SDLC.SYSCMD.CD1‚*„SYSGENCommandFileforSDLCdrivergeneration‚*4‚*„CreateanSDLCdriverforaspecificenvironment.‚*‚*„Argumentsare:*‚*‡Arg1=Mnemonic-legalmnemonicsare:‚* ‚*‘"GMADPRI"-GMprimarysystem"‚*‘"GMADSEC"-GMsecondarysystem$‚*‘"HDS4PRI"-HDS400primarysystem&‚*‘"HDS4SEC"-HDS400secondarysystem$‚*‘"VME10PRI"-VME/10primarysystem‚*:‚*‡Arg2=Overalllistingfile/device.‚Listingishandled‚*‘bydriverchainfile.‚*K‚*Eachtimemaintenanceisperformed,thefollowingthreeargumentsshould1‚*beupdated:REVDATE-Dateoflatestrevision, ‚*VERSION-Versionnumber,and‚*REVISIO-Revisionnumber.‚*/‚REVDATEƒ="09/07/83"ƒ*Dateoflatestrevision‚VERSIONƒ=3Œ*Versionnumber‚REVISIOƒ=7Œ*Revisionnumber ‚*‚&LF‡=0ŒLegalmnemonicflag ‚IFEQˆ"\1"‰,"GMADPRI"…&LF‡=1…STATIONƒ=1‰Primarystation…CHIPTYPƒ="68000"…RES7201ƒ=02ˆVM02…SUBSˆSDLC.ROOT.AG3…ASM‰SDLC.ROOT.AG,SDLC.GMADPRI.RO,&.SYSGEN.TF;Z=100 …=COPY‡&.SYSGEN.TF,&.SYSASM.LS;A$…=COPY‡&.SYSGEN.TF,SDLC.GMADPRI.LS;Y‚ENDC‚IFEQˆ"\1"‰,"GMADSEC"…&LF‡=1…STATIONƒ=2‰Secondarystation…CHIPTYPƒ="68000"…RES7201ƒ=02ˆVM02…SUBSˆSDLC.ROOT.AG3…ASM‰SDLC.ROOT.AG,SDLC.GMADSEC.RO,&.SYSGEN.TF;Z=100 …=COPY‡&.SYSGEN.TF,&.SYSASM.LS;A$…=COPY‡&.SYSGEN.TF,SDLC.GMADSEC.LS;Y‚ENDC‚IFEQˆ"\1"‰,"HDS4PRI"…&LF‡=1…STATIONƒ=1‰Primarystation…CHIPTYPƒ="68000"…RES7201ƒ=02ˆVM02…SUBSˆSDLC.ROOT.AG3…ASM‰SDLC.ROOT.AG,SDLC.HDS4PRI.RO,&.SYSGEN.TF;Z=100 …=COPY‡&.SYSGEN.TF,&.SYSASM.LS;A$…=COPY‡&.SYSGEN.TF,SDLC.HDS4PRI.LS;Y‚ENDC‚IFEQˆ"\1"‰,"HDS4SEC"…&LF‡=1…STATIONƒ=2‰Secondarystation…CHIPTYPƒ="68000"…RES7201ƒ=02ˆVM02…SUBSˆSDLC.ROOT.AG3…ASM‰SDLC.ROOT.AG,SDLC.HDS4SEC.RO,&.SYSGEN.TF;Z=100 …=COPY‡&.SYSGEN.TF,&.SYSASM.LS;A$…=COPY‡&.SYSGEN.TF,SDLC.HDS4SEC.LS;Y‚ENDC‚IFEQˆ"\1"‰,"VME10PRI"…&LF‡=1…STATIONƒ=1‰Primarystation…CHIPTYPƒ="68010" pJy…RES7201ƒ=400‡MVME400…SUBSˆSDLC.ROOT.AG1…ASM‰SDLC.ROOT.AG,SDLC.VME10.RO,&.SYSGEN.TF;Z=100 …=COPY‡&.SYSGEN.TF,&.SYSASM.LS;A"…=COPY‡&.SYSGEN.TF,SDLC.VME10.LS;Y‚ENDC ‚IFEQˆ\&LF6…MSG‰"\1"isaninvalidmnemonic.Legalmnemonicsare:;…MSG‰"GMADPRI","GMADSEC","HDS4PRI","HDS4SEC",or"VME10PRI".…MSG‰Pleasererunsysgenwithpropermnemonic.…ABORT‡‚ENDC 3‚IFRMBCTƒ=1Œ*SendandReceiveI_FrameByteCounts ‚*ENDOFSDLC.SYSCMD.CDC‚******************************************************************‚END‰ééééé******************************** BEGINNING OF SDLC.MACROS.AI ******************************** RTS2RTE‚MACRO‰IFEQ†CHIPTYPE-680101‹MOVE.W„(A7),-(A7)ˆCREATE:0(A7)=PC(HighWord)1‹MOVE.W„4(A7),2(A7)‡.......2(A7)=PC(LowWord).‹CLR.W…4(A7).......4(A7)=VOR(ShortStack)‰ENDC6‰MOVE.W„SR,-(A7)ŒPushSRsowecanRTEratherthanRTS‰ENDM ************************** END OF SDLC.MACROS.AI **************************ééééé é6* ****************************************************6* * BEGINNING OF FILE 'FIX:48.SDLC.OVERVIEW.AI' *1**DateRevised:September7,1983,EdSkinner†***²*2**Note:Thisisa"generated"file.‚Updatesto„*3**theseintroductorynotesshouldbeappliedto„*2**SDLC.OVERVIEW.PR-Seeadescriptionofthis…***containedherein. ***²*6* ******************************************************** 1 Introduction*C*†TheMotorolaSynchronousDataLinkControl(referredto‚simply‚asG*SDLC)‚is‚a‚componentoftheNetworkServicesfacilityavailableunder * VERSAdos.B*†TheSDLCimplementationprovidesa‚communications‚circuit‚driverI*usingtheNEC7201deviceinthebit-orientedprotocolmode.‚FramelevelI*commandsarehighlysimilartothoseinIBM'sSDLC.‚SupportisprovidedG*for‚the‚remote‚loadinganddumpingofstations,multi-dropaswellasJ* point to point configurations, with circuit speeds of up to 57,600 baud. Š“—›Ÿ£§&«¯³·»¿ÃÇËÏÓ×Ûß E*†BecauseofthemanyconfigurationswithinwhichthisimplementationI*mustfunction,operationislimitedtohalf-duplexonly(atthe‚present* time).***"* 2 Overview of System Preparation*D*†The‚SDLCimplementationexistsasapermanentlyresidentextensionF*ofthesystem'sexecutive(RMS68K).‚Assuch,itis‚"link"ed‚with‚theE*executive‚such‚that‚a‚single‚loadmoduleexistscontainingboththeE*executiveandtheSDLCdriver.‚Additionally,‚in‚those‚systems‚whereD*Network‚Services‚(NTS)‚executes‚on‚the‚sameprocessor,it(NetworkE* Services) will be similarly "link"ed and loaded with the executive.D*†Generallyspeaking,aversionoftheSDLCdriverisfirst‚producedH*which‚is"customized"forthetargetsystem.‚TheparameterswhichmakeG*agivenimplementationuniqueincludethetypeof‚processor‚(68000‚orH*68010),‚the‚residenceofNetworkServices(on-boardoroff-board),theD*typeofboarduponwhich‚the‚communications‚device‚(an‚NEC7201)‚isG*located,‚and‚the‚addressofthevariousregistersofthatdevice,andC* whether the implementation is for a primary or secondary station.C*†GenerationoftheSDLCdriverisfacilitatedbychain‚files‚which?*"customize"ƒtheƒgeneric‚driver‚for‚one‚of‚the‚specific‚targetB*environments.‚This‚"customized"‚version‚(an‚object‚file)‚is‚thenA*combined‚with‚other‚modules‚(such‚as‚the‚RMS68K‚kernel,‚NetworkA*Services,andsoon)‚to‚create‚a‚single‚load‚module.ƒThis‚final4* preparation is outside the scope of this document.B*†For‚the‚GMAD‚system,theprimarystationsoftwarerunsonaVM02J* board, with Network Services executing on a tightly coupled Exormacs MPUH*board.ƒAsharedmemoryfacilityisusedforthecommunicationsbetween* Network Services and SDLC.D*†Similarly,thesecondaryGMADstationsoftwarealsorunsona‚VM02I*board,‚exceptthatitsNetworkServicesison-board,andaconsiderably=* simpler shared memory area is used for inter-communication.>*†Preparationof‚the‚HDS-400‚Primary‚and‚Secondary‚stations‚is* similar to the GMAD stations.C*†The‚VME/10‚PrimarystationforanHDS-400runsonaVME/10systemD*usinganMC68010MPUand‚MVME400‚board‚(which‚contains‚the‚NEC7201 * device).* *** 3 SDLC Driver Preparation*@*†The‚first‚step,‚is‚to‚prepareacopyoftheinformationalfileJ* (what you are currently reading) for inclusion into the assembly stream.F*Note‚that‚this‚preparation‚needbedoneonlyiftheSDLC.OVERVIEW.PRH*inputfilehasbeenupdated.‚WhenseveralversionsofSDLCdrivers‚areB*to‚be‚generated,‚the‚OVERVIEW.CF‚(SDLC.OVERVIEW.CF)‚need‚only‚beH*executedbeforegeneratingthefirstversion.‚Oncethishasbeen‚done,J* several different versions of the SDLC driver may be generated, re-using* the overview file./*†Anexampleofcreatingthisoverviewfileis;*†=USE48.SDLC*†=OVERVIEW.CF)*‹=/*CREATEOVERVIEW.AIFROMOVERVIEW.PR1*‹=101.USERLIB.PROSEOVERVIEW.PR,OVERVIEW.LS;Z=64*‹Version:dd-mmmm-yy*‹Noerrorsdetected.*‹=DELOVERVIEW.AI#*‹DELETEDFIX:0048.SDLC.OVERVIEW.AI*‹=EOVERVIEW.LS,OVERVIEW.AI;L*‹VERSAdosEDITOR‚RELEASE‚x.y*‹COPYRIGHTBYMOTOROLA19zz&*Ž(Exampleoutputdeletedforbrevity) *‹EDITDONE*‹=ENDE*†Thenextoneormorestepsconsistofgeneratingversion(s)ofSDLCG*as‚required‚forthetargetsystem.‚SDLCmaybegeneratedasaprimaryE*orsecondarystation,andfortheMC68000‚or‚MC68010‚processor.ƒTheE*chain‚file‚which‚performs‚thisis&.CONFIG.CF.‚ItisalwaysinvokedI*withtwoarguments.‚Thefirstargumentspecifiestheconfiguration,theI*secondargumentspecifiestheoveralllistingfileordevice.‚ThefirstE*argumentnamesforvarious‚SDLC‚configurations‚are:‚HDS-400‚PrimaryF*Station‚("HDS4PRI"),‚HDS-400‚Secondary‚Station("HDS4SEC"),GMADDMSJ* (Primary) Station ("GMADPRI"), GMAD PMS (Secondary) Station ("GMADSEC"),/* and VME/10 HDS-400 Primary Station ("VME10").B*†The‚chain‚file‚producesobjectandlistingfilesappropriatefor"* the specified system as follows;*0* +--------------+--------------+--------------+!*!‚Argument„!„Object„!ƒListing„!0* +--------------+--------------+--------------+)*!‚"HDS4PRI"ƒ!‚HDS4PRI.RO‚!‚HDS4PRI.LS‚!)*!‚"HDS4SEC"ƒ!‚HDS4SEC.RO‚!‚HDS4SEC.LS‚!)*!‚"GMADPRI"ƒ!‚GMADPRI.RO‚!‚GMADPRI.LS‚!)*!‚"GMADSEC"ƒ!‚GMADSEC.RO‚!‚GMADSEC.LS‚!&*!‚"VME10PRI"‚!‚VME10.RO„!‚VME10.LS„!0* +--------------+--------------+--------------+** 4 Required Files*B*†Thefollowingfilesaretheminimumsetrequired‚to‚generate‚all* versions of the SDLC driver;F*&.SYSGEN.CF‚-‚The‚user‚invokedchainfileproducingSDLCfortheall*†SDLCimplementations.G*SDLC.SYSCMD.CD-TheSYSGENcommandfileusedinthe‚preparation‚of‚a*†versionoftheSDLCdriver,F*SDLC.ROOT.AG‚-‚The‚file‚"assembled"toproduceaversionoftheSDLCE*†driver,asdirectedbyparametersspecifiedbytheuser,andbythe*†SYSCMD.CDcommandfile,G*SDLC.OVERVIEW.CF‚-‚The‚chainfilewhichcausesSDLC.OVERVIEW.AItobe7*†createdfromSDLC.OVERVIEW.PRviathePROSEfacility,9*SDLC.OVERVIEW.PRƒ-ƒTheƒ"prose"ƒinput„file,„processed„by3*†SDLC.OVERVIEW.CF,whichcreatesSDLC.OVERVIEW.AI,G*SDLC.OVERVIEW.AI‚-‚Created‚fromSDLC.OVERVIEW.PRbySDLC.OVERVIEW.CF,B*†thisfilepresentsagrossoverviewofthe‚implementation,‚and‚a'*†listofknownproblemsand/orerrors,0* 9995.&.NEC7201.EQ - Defines NEC7201 Symbolics,2* 9995.&.STR.EQ - Defines RMS68K Kernel Symbolics,3* SDLCPRI.TEMPLTS.EQ - Defines SDLC Control Blocks,;* MVME400.EQUATES.AI - Defines the MVME400 board Symbolics,A* SDLC.MACROS.AI - Defines miscellaneous macros required by SDLC,F*SDLCPRI.POLLQ.AI‚-‚Primary‚Station,‚External(User)Interfaces,SDLC(*†StartUpLogic,andPollingAlgorithm,D*SDLCPRI.INT7201.AI-‚Primary‚Station,‚Transmitter‚Flush‚Logic,‚and*†NEC7201InterruptDispatcher,;* SDLCPRI.TRANSMIT.AI - Primary Station Transmitter Driver,7* SDLCPRI.RECEIVE.AI - Primary Station Receiver Driver,4* SDLCPRI.FRMCNT.AI - Primary Station Frame Handler,)* SDLCPRI.SUBRTN.AI - Common Subroutines,H*SDLCSEC.PWRUP.AI‚-‚SecondaryStation,External(User)Interfaces,SDLC5*†StartUpLogic,andPo llingResponseAlgorithm,andD*SDLCSEC.FRMCNT.AI-Secondary‚Station‚Frame‚Handler,‚and‚Link‚Mode*†FiniteStateMachine.**** 5 Primary Station Files*@*†Thefollowingfilescomprisetheprimarystation'sgeneration;* SLDC.ROOT.AG,* SDLC.OVERVIEW.AI,* 9995.&.NEC7201.EQ,* 9995.&.STR.EQ,* SDLCPRI.TEMPLTS.EQ,* SDLC.MACROS.AI,* MVME400.EQUATES.AI,* SDLCPRI.POLLQ.AI,* SDLCPRI.INT7201.AI,* SDLCPRI.TRANSMIT.AI,* SDLCPRI.RECEIVE.AI,* SDLCPRI.FRMCNT.AI, and* SDLCPRI.SUBRTN.AI.**** 6 Secondary Station Files*B*†Thefollowingfilescomprisethesecondarystation'sgeneration;* SLDC.ROOT.AG* SDLC.OVERVIEW.AI,* 9995.&.NEC7201.EQ,* 9995.&.STR.EQ,* SDLCPRI.TEMPLTS.EQ,* SDLC.MACROS.AI,* MVME400.EQUATES.AI,* SDLCSEC.PWRUP.AI,* SDLCPRI.INT7201.AI,* SDLCPRI.RECEIVE.AI,* SDLCSEC.FRMCNT.AI,* SDLCPRI.TRANSMIT.AI, and* SDLCPRI.SUBRTN.AI.**** 7 ROM-based Version Files*9*†ThefileswhichcompriseSDLCROMarecurrentlyunknown.**** 8 Primary Data Flows*>*†The‚primary‚data‚flow‚into‚SDLC‚is‚viatheSBPTXMQandPTXMQI*functionswhicharelocatedinthebuffermanagementmodule(BUFMGT‚andH*BUFMGTX).ƒThesefunctionsenqueueatransmitbuffertotheappropriateI*SecondaryControlBlock(SCB)wheretheSDLCdriverwillfinditat‚theF*proper‚time.ƒIn‚theprimarystation,theSBPTXMQandPTXMQfunctionsH*"awaken"SDLCeachtimeabufferisenqueuedbycallingthe‚SDLC‚entryF*point‚SDLCQUSB‚or‚SDLCQUfunction.‚Inthesecondarystation,SDLCis?*not‚"awakened"‚when‚a‚buffer‚is‚enqueued.ƒIn‚anƒEXORMACS/VM02J* configuration, buffers are passed from the EXORMACS to the VM02 thru the* VM02 request queue.>*†Theprimarydataflowfrom‚SDLC‚is‚via‚the‚SBPTUSQ‚and‚PTUSQI*functions‚whicharelocatedinthebuffermanagementmodule(BUFMGTandG*BUFMGTX).‚WhenSDLChasreceivedanerrorfreetransmission‚(which‚isB*not‚an‚internally‚used‚SDLC‚control‚frame),‚the‚SBPTUSQorPTUSQD*functioniscalledandthereceived‚buffer‚is‚enqueued‚to‚the‚userI*queue.‚InanEXORMACS/VM02configuration,theuserqueuepassesbuffers * from the VM02 to the EXORMACS.C*†Ingeneral,allinformationframes(I_frames)‚contain‚applicationH*program‚data,‚supervisoryframes(S_frames)areusedinternallybytheI*variousSDLCstationsonalink,andun-numbered(U_frames)areused‚to* control the mode of the link.C*†It‚is‚veryimportanttonotethatU_framesarenever"created"orI*"consumed"bytheSDLCmodule:‚TheyarealwaysinitiatedandterminatedE*outside‚of‚SDLC.ƒ"Hand-shake"‚proceduresexistbetweenSDLCandtheH*U_framecreatorandconsumertoassistinthesynchronization‚of‚these* two processes.**** 9 Entry Points*C*†External‚entry‚pointsareprovidedwithintheSDLCimplementation* for the following conditions;*@* +----------+------+------------------------+-----+-----+-----+8*!Entry„!Type!InputDescription†!Pri!Sec!ROM!@* +----------+------+------------------------+-----+-----+-----+;*!PWRUP„!Subr!StartSDLCOperationƒ!Yes!Yes!Yes!2*!PWR†!Intr!NEC7201A-SideIntr„!‚?‚!‚?‚!‚?‚!<*!INT7201‚!Intr!NEC7201B-SideIntr„!Yes!Yes!Yes!=*!INT7201A!Intr!NEC7201A-SideIntr„!Yes!Yes!Yes!+*!SDLCQXMT!Subr!Unknown!‚?‚!‚?‚!‚?‚!>*!SDLCQUSB!Subr!SendTrafficEnqueued‚!Yes!No‚!Yes!<*!SDLCQUƒ!Trap!SendTrafficEnqueued‚!Yes!No‚!Yes!?*!SBUSRACK!Subr!AckSIM,DISC,orSNRM!No‚!Yes!Yes!=*!USRACKƒ!Trap!AckSIM,DISC,orSNRM!No‚!Yes!Yes!>*!SDLCTMOU!Subr!ReceiveTimerExpired‚!Yes!Yes!No‚!>*!SDLCTTMO!Trap!ReceiveTimerExpired‚!Yes!Yes!No‚!:*!SDLCKLƒ!Trap!TerminateOperation„!Yes!Yes!No‚!<*!SBSDLCKL!Subr!TerminateOperation„!Yes!Yes!No‚!9*!SDLCPRSB!Subr!50mSecondTickˆ!Yes!Yes!***!7*!SDLCPRƒ!Trap!50mSecondTickˆ!Yes!Yes!***!=*!SDLCFLƒ!T rap!FlushAllSendTraffic!Yes!Yes!No‚!?*!SBSDLCFL!Subr!FlushAllSendTraffic!Yes!Yes!No‚!<*!SDLCRCST!Trap!Buffer(s)NowExist„!No‚!Yes!Yes!<*!SBSDLCRC!Subr!Buffer(s)NowExist„!No‚!Yes!Yes!@* +----------+------+------------------------+-----+-----+-----+*F****SDLCROMexecuteswithouttheaidof"timers",‚and‚so‚these‚entry,* points are never used in actual operation.***'* 10 Support Functions and/or Variables*C*†Externally‚defined‚routineswhichareusedbythisimplementation* are;I*SBGTFRIR-FOREGROUND(interrupthandler)USEONLY,getonebuffer‚fromE*†thefreepoolregardlessofthelowwatermarkandhowmanybuffers *†remain,1* DLTRACE - add an entry to the SDLC trace table,.* SBPTFRBF - return a buffer to the free pool,2* SBPTFRML - return many buffers to the free pool,1* SBPTUSQ - put a buffer into the user queue, andF*SBRQPA-(RMS68Kkernelentrypoint)request‚a‚periodic‚activation‚-B*†Note‚that‚theuseofthisfunctionisbeingphasedout.‚ExistingD*†versions(basedontheMC68000MPU)continuetousethis‚function,;*†andƒthereforeƒrequireƒLINK'ing‚with‚the‚associated‚RMS68KC*†functions.‚Newerversions(basedontheMC68010MPU)willuse‚theE*†TRAP#0instructiontoaccessthesamefunction,andsodonotneed'*†tobeLINK'edwiththeRMS68KKernel.:* Additionally, various RMS68K functions are used by SDLC.*C*†Externallydefinedsymbolicvariablesusedby‚this‚implementation* are;D* NECCTL_A - address of the NEC7201 device control register, Port A,D* NTCCTL_B - address of the NEC7201 device control register, Port B,A* NECDAT_A - address of the NEC7201 device data register, Port A,A* NECDAT_B - address of the NEC7201 device data register, Port B,5* SDLCPCB - pointer to the Primary Control Block, and2* TRACFLAG - trace wanted (least significant bit).**** 11 Known Problems*@*†The‚following‚paragraphs‚detail‚the‚"known"problemswhichareD*eitherthoughttobewithin‚this‚SDLC‚implementation,‚or‚that‚haveI*significantbearingonSDLC'sperformance.‚Theorderofpresentationof'* these problems is of no significance.*G*ThruputImprovement-Theoverallsystemthruputcould‚be‚improved‚byE*†addingatransmissiontoasecondarysystemafterreceivingtraffic@*†fromit.‚Presently,whena‚secondary‚station‚transmits‚inboundC*†traffic,‚it‚mustwaitforthenextpollbeforeit"findsout"howA*†manyframestheprimarystationreceived.‚During‚this‚period‚of6*†time,ƒseveralƒbuffersƒmayƒbeƒtiedƒup‚waiting‚for‚theC*†acknowledgement.‚IftheprimarystationweretotransmitanRR‚orA*†RNR‚(without‚the‚poll‚bit)afterreceivingthefinalbitfroma<*†secondary‚(assuming‚that‚informationƒframesƒwereƒreceived,E*†otherwisetheextratransmissionisextraneous),thenthesecondary<*†station‚would‚immediately‚know‚how‚many‚of‚its‚frames‚wereA*†successfully‚received‚by‚theprimarystation.‚Thischangewould?*†haveasignificantimpact‚during‚the‚upload‚process‚where‚the7*†secondaryƒstationƒonlyƒhasƒfourƒbuffersƒto‚play‚with.A*†Unfortunately,NetworkServicesappearstobe‚unable‚to‚keep‚up>*†with‚the‚current‚upload‚rate,‚and‚this‚proposedchangewould?*†significantlyaccelerate‚the‚upload‚thruput‚thereby‚causing‚a+*†resourceshortageintheprimarystation.J* Architectural Problem - Use of the Low Water Mark facility of the buffer?*†poolisincorrect.ƒGenerally‚speaking,‚routines‚which‚consumeE*†systembuffersshouldbesubjecttotheLowWaterMark,whilethose@*†whichreturnbufferstothepool,‚or‚that‚initiate‚some‚actionC*†which‚will‚causebufferstobereturnedtothepoolshouldnotbeA*†subjecttotheLowWaterMark.‚Presently,thereare‚a‚couple‚of@*†exceptions‚to‚these‚guidelines.ƒSpecifically,theSDLCtraffic>*†receiveroutinesarenotsubject‚to‚the‚Low‚Water‚Mark:ƒThey;*†shouldƒbe.ƒThe‚NTS‚functions‚which‚perform‚the‚connect ionE*†tear-down(disconnect,etc)aresubjecttotheLowWaterMark:They>*†should‚not‚be.ƒBecause‚of‚these‚"mis-architected"functions,C*†dead-locksituationsoccurwhenanodereceivestoa‚traffic‚loadB*†which‚exceeds‚itsthruput.‚Allbuffersareconsumedwithreceive@*†traffic,andnobuffersare‚left‚to‚send‚application-level,‚orE*†definiteresponsetrafficwhichwoulduncommitsomeofthereceived *†buffers.C*PerformanceProblem-‚The‚primary‚station‚is‚not‚re-enabling‚it'sE*†receiversoonenoughbetweensuccessivereceptionswhenthesendingC*†secondarystationisrunninginitsROMversionandis‚sending‚an>*†upload.ƒThe‚primary‚receives‚the‚first‚andthirdinformation>*†frames,butmissesthe‚second‚one.ƒThis‚results‚in‚excessive*†uploaddurations.G*Unknown‚Cause‚-‚A"Receivebufferoverrun"erroroccursapproximatelyE*†everyfourframeswhenreceivinganuploadfromasecondarystationB*†running‚in‚it'sROMversion.‚ThisproblemismostlikelyrelatedA*†tothepreceedingproblem.‚However,thesequence‚of‚events‚that=*†lead‚to‚the‚receive‚buffer‚overrun‚error‚areamystery:‚TheC*†secondarystationshouldnotbesendingover-length‚messages,‚and@*†error‚recovery‚in‚the‚primary‚shouldpreventothererrorsfrom*†"turninginto"thiserror.F*UnknownCause-Asecondarystationisapparently‚getting‚stuck‚in‚a@*†Frame‚Reject‚state‚thereby‚preventing‚thatstation(only)from*†completingarestart.I*UnknownCause-Cessationofdown-loadduringstressperiodsrequires‚a?*†reboot‚of‚the‚entire‚system.ƒThissituationisrare,andonlyE*†occurswhenoneormoreuploadsareinprogressatthesametimeas@*†downloads.ƒA‚"dead-lock"‚situation‚occurswhereallthesystemA*†buffersareinuse,andanotherbufferisneeded‚to‚free‚up‚anyB*†buffers.ƒThere‚maybeotherproblemswhichappeartobethesameA*†asthedead-locksituation.‚Thismaybean‚overall‚buffer‚usageB*†problem,‚or‚an‚NTSproblemratherthanaspecificprobleminthe*†SDLCimplementation.E*ArchitecturalProblem-Ifasecondary‚fails‚(or‚is‚manually‚reset)A*†while‚a‚download‚is‚inprogresstothatsecondary,thestateofC*†thatstationasrecordedintheprimaryoccasionally‚prevents‚theC*†flushing‚oftraffic.‚Thiscausesalargenumberofsystembuffers>*†tobetiedupforanextendedperiod(conceivably,forever).H*ArchitecturalProblem-Thedownload(andupload)processes‚contain‚noE*†datarateregulatingmechanismsandtend,therefore,todriveotherA*†partsofthesystemintoerrorrecovery‚situations‚by‚placing‚aB*†severe‚load‚onthesystemunnecessarily.‚DuetothedifficultiesD*†incorrectingthisproblem,nopracticalsolutionappearsto‚existA*†at‚this‚time.ƒ(These"difficulties"includetheneedtototallyD*†revamphowuploadsanddownloadsareperformedacrossall‚products-*†currentlyusingNetworkServicesandSDLC.)D*Unknown‚Cause‚-‚An‚excessive‚retransmission‚errorisoccuringona8*†download‚information‚block.„Theƒblockƒshouldƒhaveƒbeen>*†acknowledged‚by‚the‚loaded‚secondary,‚or‚it‚shouldhavebeen@*†flushedupondownloadcompletion.‚Either‚of‚these‚events‚would?*†prevent‚the‚excessive‚retransmission‚error‚which‚isoccuring.?*†Thereis,ostensibly,noproblemwith‚this.ƒBut‚the‚system‚is'*†indicatingsomeerror,nonetheless.F*Unknown‚Cause‚-‚Apparently‚amessageisoccasionallybeingdiscarded>*†erroneouslyduring‚the‚download‚and/or‚restart‚process.ƒThisD*†causes‚theaffectedsecondarystationtobeunabletocompleteitsA*†restartandrequiresthemanualresettingof‚that‚station.ƒThis<*†problemƒmayƒbe‚related‚to‚the‚aforementioned‚architectural%*†difficultiesconcerninglinkreset.@*Architectural‚Problem‚-‚The‚"cooperation"‚between‚SDLCƒandƒNTSC*†concerning‚link‚resetand/orrestartisfaultyduetoanumberofC*†problemsinthearchitectureofthisarea.‚The"problems"lead‚to1*†dead-lockand/orpoorperformancefairlyoften .D*Architectual‚Difficulty‚-‚RMS68K‚handling‚of‚setdateandtimemay>*†resultin‚several‚seconds‚of‚computation‚with‚all‚interruptsC*†masked.ƒNTS/SDLC"feels"thisbymissingtransmission(s)fromtheC*†primarystation,andloosingcontactforseveralseconds.‚As‚thisE*†onlyoccurswhenasecondarystationisre-starting,theproblemisD*†minortheproblemisconsideredtobean"annoyance"ratherthan‚a=*†"problem".ƒCorrection‚of‚this‚problem‚may‚be‚implementedbyE*†changingthealgorithmwithinRMS68Kand/orbyrevampingthe"powerD*†on"/"poweroff"decisioncriteriawithinSDLC.‚RegardlessoftheC*†RMS68Kchanges,theSDLC'sup/downcriteriashouldbe‚revamped‚as@*†the‚present‚implementation‚is‚crude‚and"over-reacts"tominor*†transgressions.G*HardwareProblem-Ifasecondary(ortheprimary)‚station‚fails‚suchC*†that‚it‚isunabletoperformaresetofthecommunicationsdeviceD*†(NEC7201),andthefailureoccursatatimewhenthatstation‚hasA*†its‚transmitter‚enabled,‚the‚communicationscircuitwillbe"in?*†use"foranindefinateperiodand‚no‚stations‚will‚be‚able‚to=*†communicate.ƒThis‚situation‚will‚continue‚until‚the‚failingC*†stationisidentifiedanddisconnectedfromthecircuit.‚The‚mostD*†expeditious‚methodforresolvingthisproblemisto1)verifythatE*†itisoccuring-alinemonitorwilldisplayacontinuousstreamofC*†data‚on‚thecircuit-normallythesamebyteoverandoveragain,E*†andthento2)begindisconnectingsecondarystationsoneatatimeC*†until‚thelinemonitorindicatesacessationofthispattern.‚TheB*†continuoustransmissionwillceasewhenthe‚offending‚station‚isD*†disconnected.‚Alternatively,secondarystationsmaybepoweredoff@*†ratherthanbeingdisconnected.‚This‚condition‚(of‚a‚secondaryE*†"hogging"thecircuit)isverydifficulttoidentifyintheprimaryD*†station'ssoftware,anditisuncertainifanyautomatic‚procedureC*†can‚be‚initiatedbytheprimarytoresolvethissituationevenif%*†itcoulddeterminethatitexisted.*0* **********************************************0* * END OF FILE 'FIX:48.SDLC.OVERVIEW.AI' *0* **********************************************ééE1BEGSDLC ASREL' SDLC BEGSDLC SAQ(…Beginning of SDLC segment2IBEGSDLC )3 `þ4éééé éééãI1BUFMGT ASREL' SDLC BUFMGT SAQ(…BUFFER MANAGEMENT SUBROUTINESó2pUSERQHD pUSERQND pSDLCPCB ISBPTFRML ISBGTUSQ pSDLCQUSB ISBPTUSQ ¼ISBPTXMQ 6IGTFRBF LpFQBCNT IGTFRIR IPTFRBF âIGTFRML žpFQLWM IPTFRML pNATBEG IGTUSQ IPTUSQ ¶\2IPTXMQ 0pFREEQHD ISBGTFRBF RISBGTFRIR ISBPTFRBF èISBGTFRML ¤)JF3 P@ a@×Ns@ç||Sy(nk|&y(#Ó(F×B“FßNuRy(F×B/&|ÿÿÿÿF3 J FßNua@×Ns@ç||09(°y(o"Sy(k y(#Ð(F×BFßNuRy(F×B/F3 |ÿÿÿÿFßNua@×Ns@çB/BgB§JAoÿý`ašf| —.ˆRoQÉÿì| _F3 2n |ÿÿÿÿFßNua@×Ns@ç±ügÿý| ¹(#È(Ry(Fß |ÿÿÿÿNua@×NsF3€  @J€g aÂ`ô |ÿÿÿÿNua@×Ns@çB€±ügÿý( "y("iD ÿg°gF3 ÓüXJfò|FßNuBhB( B( Bi|$iJ©fEé#H$ˆI3Š BiF×aB þ\| |ÿÿÿÿFßNua@×Ns@ç gÿýB|$y( fEù(#È($ˆF3  Fß 9(g @pÀü&Að hpN@ |ÿÿÿÿNua@×Ns@ç|| 9(g @#Ð&3 (fB¹(F×BFßNuF×B/ |ÿÿÿÿFßNu4éééìI1BUFMGTX ASREL' SDLC BUFMGTX SAR (…BUFFER MANAGEMENT SUBROUTINESö2pUSERQHD pUSERQND pSDLCPCB ISBPTFRML  pSYSPOFF pSDLCQXMT ISBGTUSQ LpSDLCQUSB ISBPTUSQ ÂISBPTXMQ *IGTFRBF ¢pFQBCNT IGTFRIR IPTFRBF †IGTFRML @pFQLWM pMEMOFF IPTFRML pNATBEG …2IGTUSQ FIPTUSQ ¼IPTXMQ $pFREEQHD pFREEQND ISBGTFRBF ¨ISBGTFRIR ISBPTFRBF ŒISBGTFRML F)ºF3P a@×Ns@ç/ |"x J¸ fÿýFï|Jé kòfÿýSi n kF|B© F3B  &i —ü€×ø Ófÿý#S © gÿýFïB“B«B«B« "_FßNuRi F3 fÿý© gÿýFïB/&|ÿÿÿÿ"_FßNua@×Ns@ç|/ "x Fï|JéF3…"„ kòfÿý0) °i oPSi nk@B©  i ‘ü€Ñø Ðfÿý#P © gF3 ÿýFïBB¨B¨B¨ "_ FßNuRi fÿý© gÿýFïB/ |ÿÿÿÿ"_FßNuF3 a@×Ns@çB/BgB§JAoÿý`aÿNf| —.ˆRoQÉÿê| _2n |ÿÿF3 ÿÿFßNua@×Ns@ç/ ±ügÿý"x BFï|Jé kòfÿý © gÿý‘øF3… P€ Ñü€#H J© fJi fÿý‘ü€#H Ri oÿý© gÿýFï"_ |ÿÿI3 ÿÿFßNua@×Ns  @J€g aÿt`ò |ÿÿÿÿNua@×Ns@ç±ügÿýJ¸ gaB ýÂF3@ |FßNuB€( "x "iD ÿg°gÓüXJfò|FßNuBhB( B(I3 Bi|$iJ©fEé#H$ˆBiF×aB ýV| |ÿÿÿÿFßNua@×F3E$ Ns@ç gÿý"x BF×|Jé kôfÿý ) g@$@Õø ‘ø $ˆ#H © gÿýF3  F× 8 g @pÀü&Að hpN@ |ÿÿÿÿFßNu‘ø #H Ñü€#H © gF3„ ÿýF×`¼a@×Ns@ç|"x F×|Jé kôfÿý ) €J€g, @Ñø JfB©@3‚@ Ðfÿý#P © gÿýF×BFßNu© gÿýF× |ÿÿÿÿB/FßNu4ééõI1DLTRACE ASREL' SDLC DLTRACE SAS#(…TRACE INTERRUPTS ON DATA LINKA2pSDLCPCB pNECCTL_A pNECCTL_B IDLTRACE pTRACEBEG )@<3@@@ $y($R4ï$ï4À$ñù(ù(Eê"y(µémEé"Š"y(Nu4éééééééþ,1EXORDLC ASREL' SDLC EXORDLC SAS5(…}2JSBSDLCFL $pSYSPOFF JSBSDLCKL 8JSBUSRACK JSDLCQXMT .JSDLCQUSB ’pMEMOFF pV2RQHD pSBGTFRBF *”H3 .,<¡aA ög <ÿT—` 1GFa Nu.,<¢`Ú|a NuB‡,<£F3 `Æ/ " y(B‘ù(Jé kúCé  €J€g"@Óù( fô"ˆ"y(© ` /×3 "Ÿ‘"_NuNu4ééééééM1IBUFMGT ASREL' SDLC IBFMGT SAT(…BUFFER MANAGEMENT INIT SUBROUTINE 2pSZDBUF HSBINFRBF ( (3 BB€0:A ú@$HÑÀ³Èm$ˆRA`ò•ÀB’Nu4ééééééé  D1PORTAIO ASREL' SDLC PORTAIO SAT4(…PASS INERRUPT ON TO HDIO 2IPORTAIO pNECCTL_A ):>3 9(f )Ofp$qNÒ$o/iT"iX)ÿÿgäH€LßNu4éééééééN1PORTAV4 ASREL' SDLC PORTAV4 SATW(…MVME400, PASS INTERRUPT ON TO HDIO 2IPORTAIO pNECCTL_A )$(3 $iX€$iTBgHz@çNÒ9(fìLßNs4ééééé  éé"' TEST OUTTERM RO77bbG1OUTTERM ASREL' TEST OUTTERM SAU!(…Put Message out to terminal2NOUTTERM .*03AÖ!I !J0¼1|1|B¨Bh B¨NBNu4ééééééé/  ' VM02 VEC7201 AGDDbbSTRSDLC ROMMbb**ˆVM02.VEC7201.AG* ŠSECTION8 ŠXDEFƒVEC7201=VEC7201ƒEQU„\V2G1IR6‹*NEC7201usestheGroup1,IRQ6vector%ŠNOP—MusthavecodetosatisfylinkerŠENDééééééé<91STRSDLC ASREL' STRSDLC SAU%(…Start up SDLCx2pPORTAIO pSYSTYPE pVEC7201 pINT7201 pINT7201A pBEGSDLC pPWRUP pTRACFLAG pTRACEBEG HSTRSDLC (8H3@ :A þgNu&lAú pN@` `ÔHDIO*H0<"m6Eé "FIX:48.SDLCSEC.FRMCNT.AI' *5***************************************************** I* NOTE: I THINK THIS PROCEDURE (TRANSEQ) IS ALWAYS THE WRONG THING TO DO!@*‡WEWILLRE-USETHEFIRSTBUFFERINTHERECEIVEQUEUE.‚ISTHEREE*‡ALWAYSONETHERE?‚ISITOKTORE-INITIALIZEITSBYTECOUNT,STATUS,3*‡ERROR,RETRYCOUNT,ANDSECONDARYSTATIONNUMBER?L* This situation (reaching the end of the transmit queue without sending the;*‡finalbitshouldoccuronlyasaresultofaFLUSHorder.* ED SKINNER, MARCH 3, 1983 &‰FAIL†501‡TRANSEQISVERY,VERYWRONG! *TRANSEQ‚EQU‡*‰TRANSMIT(ENDOFQUEUE)EXIT/‰MOVE.L„SDPRCV(A5),A2TRANSMITAN"RR"RESPONSE ‰CMPA.L„#0,A2‰CRASH.EQ‚*+1‡DIEIFNOBUFFER! ‰MOVE.B„#SDDRRR+$10,SDDCMD(A2)*‰BRA.L…VCTINIT6‚* &TRANSPB‚EQU‡*‰TRANSMIT(POLLBIT)EXIT@‰MOVE.L„SDPRCV(A5),A3TxMITTEDAPOLLBIT,GETINTORECEIVEMODE‰BRA.L…SDLCRC02‚* ‰PAGE%TRANSUF‚EQU‡*‰TRANSMITUNDERFLOWEXIT‰MOVE.B„#NCW0RG1,NECCTL_B„*#‰MOVE.B„#NCW1IRD+NCW1STV,NECCTL_B*9‰MOVE.B„#SDPBFC,SDPBSY(A5)SETSDLCBUSYINFRAMECONTROL‰ADD.W…#1,SDSHCTOF(A4)…3/2/83'‰BTST.B„#0,SDDCMD(A3)IFIELDTxMITTED?‰IFˆTHEN.S)‹SUB.B…#2,SDSVSC(A4)YES,FIXUPVsCOUNT‹AND.B…#$0E,SDSVSC(A4)6‹SUB.B…#1,SDSUKT(A4)Andnumberofun-ack'dframesout‰ENDI/‰TST.L…SDSTHD(A4)DIDANSDLCFLUSHJUSTOCCUR?‰IFˆTHEN.S/‹MOVE.L„SDPRCV(A5),A2Yes,sendan"RR"command‹MOVE.B„#SDDRRR+$10,SDDCMD(A2)3‹MOVE.B„#SDPTRQ,SDPTXF(A5)(sendingfromrcvqueue)‹BRA.L…VCTINIT6‰ENDI1‰TST.B…SDDRTC(A3)No,shallwetrysendingagain?<‰BEQ.S…TRANSPBƒCountiszero,sowe'lltryagainwhenpolled@‰SUB.B…#1,SDDRTC(A3)Countisn'tzeroyet,decrementoneattempt=‰BNE.S…TRANSPBƒandresend(whenpolled)ifcountnotzeroyet?* Fall-thru to next page when the retransmission count expires.‰PAGE4* Note: We fall-thru to here from the previous page. h5q3y<=‰<‘K™B¡Q©M±?¹4* The retry count has expired for a transmit buffer.=* Return it to the originator after marking it as unsendable.F* Then, fix up the transmit queue by linking the buffer just after the.*‡unsendableonetothebufferjustbeforeit.?* For example, if the transmit queue currently looks like this;'*†A-->B-->C,whereBisunsendable.:* Then we fix up the transmit queue so it looks like this;*†A-------->C.K* The fix-up is accomplished by looking for a buffer that points to the oneO* we just got rid of, and then storing the "next" buffer's address (as returned3* to us by SOMESEND) into its forward link pointer.3‰MOVE.B„#SDDSSTE,SDDSTS+1(A3)Markitasunsendable6‰MOVE.L„A3,A1…A1=A(Unsendablebuffer-forSOMESEND)>‰MOVE.L„A3,A2…A2=A(Unsendablebuffer-forWHILEclauseuse)6‰BSR.L…SOMESEND‚PasstheUnsendablebuffertotheuser7‰MOVE.L„A1,A3…A3=A(Nextbufferinthetransmitqueue)?‰LEA‡SDSTHD-SDDLNK(A4),A1Findbufferbeforetheunsendableone?‰WHILE.LƒSDDLNK(A1)A2DO.SPointingtounsendablebuffer?/‹MOVE.L„SDDLNK(A1),A1‡No,ontothenextbuffer‰ENDW@‰MOVE.L„A3,SDDLNK(A1)yes,store"next"into"beforeunsendable"<‰BRA.S…TRANSPBƒAlldonewithclean-up,goseewhattodonow ‰PAGE'RECEITO‚EQU‡*‰RECEIVETIMEOUTOCCURRED‰MOVE.B„#SDDSSRT,SDDSTS+1(A3)‰ADD.W…#1,SDSHCRTP(A4)…3/2/83 ‰BRA.S…HSKP0 /RECEIEE‚EQU‡*‰RECEIVEEXCESSIVEERRORSOCCURRED‰MOVE.B„#SDDSSRE,SDDSTS+1(A3)‰ADD.W…#1,SDSHCREX(A4)…3/2/83 *ˆBRA.S…HSKP0 &RECEILB‚EQU‡*‰RECEIVE,NOBUFFERSLEFT +RECEIFB‚EQU‡*‰RECEIVEDAFINALBITRESPONSE ***ˆENDOFARCVSEQUENCE,SHUTRECEIVEROFF* HSKP0„MOVE.B„#NCW0RG1,NECCTL_B„*#‰MOVE.B„#NCW1IRD+NCW1STV,NECCTL_B*‰MOVE.B„#NCW0RG3,NECCTL_B„*#‰MOVE.B„#NCW3BT8+NCW3AUE,NEC  CTL_B„*‰ADD.W…#1,SDSHCROF(A4)…3/2/83&‰BSR.L…SOMETOCLRCLEARRECEIVETIMEOUT&* A5 = PRIMARY CONTROL BLOCK'S ADDRESS(* A4 = SECONDARY CONTROL BLOCK'S ADDRESS‰MOVE.L„SDPRCV(A5),A2#* A2 = CURRENT RCV BUFFER'S ADDRESS9‰MOVE.B„#SDPBFC,SDPBSY(A5)SETSDLCBUSYINFRAMECONTROL,‰MOVE.W„#$2500,SRLOWER68000INTERRUPTMASK,‰BSR.L…SBXIDQ„CHECKFOR"XID"ONTxMITQUEUE* Fall-thru to the next page‰PAGE7* NOTE: WE MAY FALL-THRU TO HERE FROM THE PREVIOUS PAGE **ˆSDLCFRAMECONTROLPROCEDURES*9HSKP1„MOVE.L„A2,SDPRCV(A5)SAVENEWHEADOFRECEIVEQUEUE!‰IF.B†SDDSTS+1(A2)#0THEN.S‹CLR.L…D0ˆNoRCVerrors,‹MOVE.B„SDSCST(A4),D0 ‹SUB.B…#1,D0 ‹ASL.L…#2,D08‹JMP.S…RCVVCT(PC,D0.W)TocurrentstateifnoRCVerrors,RCVVCT…BRA.L…VCTINITƒToINITIALIZATIONSTATE+‹BRA.L…VCTINIBƒToINITIALIZATIONBUSYSTATE$‹BRA.L…VCTDISCƒToDISCONNECTEDSTATE&‹BRA.L…VCTNRM„ToNORMALRESPONSESTATE‹BRA.L…VCTBSY„ToBUSYSTATE$‹BRA.L…VCTFRMRƒToFRAMEREJECTSTATE‰ENDI‰MOVE.L„A2,A1…RcvErrors,5‰BSR.L…SOMESEND‚TelltheApplicationProgramaboutit ‰MOVE.L„A1,A20‰BSR.L…SOMEFREE‚*FREEANYOTHERRECEIVEBUFFERS+‰BRA.L…SDLCRC01‚*GOBACKINTORECEIVEMODE‰PAGE *$*ˆINITIALIZATIONSTATEFRAMECONTROL*2VCTINIT‚MOVE.B„#SDSCIBSY,SDSCST(A4)"SIM"COMMAND?‰CMP.B…#SDDCSIM,SDDRSP(A2)‰BEQ.S…VCTINIT3,‰MOVE.B„#SDSCIM,SDSCST(A4)NO,POLLBITSET?‰BTST.B„#$4,SDDRSP(A2)‰IFˆTHEN.S5‹MOVE.B„#SDSCIM,SDSCST(A4)Yes,Senda"RIM"Response‹MOVE.B„#SDDRRIM,SDDCMD(A2))VCTINIT6ƒCLR.W…SDDBCT(A2)INITBYTECOUNT%VCTINIT7ƒCLR.W…SDDSTS(A2)INITSTATUS"‹CLR.B…SDDRTC(A2)INITRETRYCOUNT!‹CLR.B…SDDERR(A2)INITSDLCERROR,‹MOVE.B„SDSSEC(A4),SDDSEC(A2)INITSTATION#4‹MOVE.L„A2,SDPRCV(A5)SAVENEWHEADOFRECEIVEQUEUE ‹MOVE.L„A2,A3$‹BRA.L…TRANSMTƒTRANSMITTHERESPONSE‰ENDIFREEQUEUE‰BSR.L…SOMEDISPOSE ‰MOVE.L„A1,A26‰MOVE.L„A1,D0…Anymorereceivebuffersafterthatone?;‰BNE.L…HSKP1…Yes,loopbackupandseewhatthenextoneis;‰BRA.L…SDLCRC01‚No,justgoturnthereceiverbackonagain :VCTINIT2MOVE.B„#SDSCRDM,SDSCST(A4)SETDISCONNECTEDSTATEGVCTINIT3TST.W…SDDBCT(A2)DATAFIELDON"SIM""SNRM"OR"DISC"COMMAND?=‰BNE.L…FRMRPI„Yes,heshouldn'thavedonethat!(GoFRMRhim)<‰BSR.L…SBGTFRIR‚NO,Getabufferforsendinga"UA"response‰IFˆTHEN.S2‹BSR.L…SOMEFREE‚NOBUFFERS,Sodon'tsendanything@‹BRA.L…SDLCRC01‚(Makelikewedidn'treceivehiscommandatall)‰ENDI6‰CLR.B…SDSVRC(A4)Nodatafield,it'savalidcommand,-‰CLR.B…SDSVSC(A4)resetourVrandVscounts,1‰MOVE.L„A2,A1…andtelltheuserwhathashappened‰BSR.L…SOMESEND'‰MOVE.L„A3,A2…thensenda"UA"response‰MOVE.B„#SDDRUA,SDDCMD(A2)*@‰MOVE.B„#SDPTRN,SDPTXF(A5)*SETTxMITFLAGASIF"RNR"TxMITTEDJ* NOTE: THIS WILL CAUSE RECEIVED I-FRAMES TO BE IGNORED UNTIL AN "RNR" CAN?* BE TRANSMITTED BECAUSE WE ARE IN THE BUSY OR INIT BUSY STATE.M* WE HAVE PASSED A RECEIVED SNRM ON TO THE "USER" IN OUR MACHINE, AND HE MUST(* ACKNOWLEDGE IT BEFORE WE CAN CONTINUE.‰BRA.S…VCTINIT6‚* ‰PAGE *)*ˆINITIALIZATIONBUSYSTATEFRAMECONTROL*+VCTINIB‚BTST.B„#$4,SDDRSP(A2)POLLBITSET?2‰BEQ.S…VCTINIT1‚*NO,FREEBUFFER,GOINTORECEIVEF‰MOVE.B‚#SDDRRNR+$10,SDDCMD(A2)YES,BUILD&TRANSMITA"RNR"RESPONSE‰BRA.S…VCTINIT6‚* ‰PAGE **ˆBUSYSTATEFRAMECONTROL**VCTBSYƒBTST.B„#$4,SDDRSP(A2)POLLBITSET?2‰BEQ.L…VCTINIT1‚*NO,FREEBUFFER,GOINTORECEIVEF‰MOVE.B‚#SDDRRNR+$10,SDDCMD(A2)YES,BUILD&TRANSMITA"RNR"RESPONSE‰BRA.L…VCTINIT6ƒ* ‰PAGE *"*ˆFRAMEREJECTSTATEFRAMECONTROL*+VCTFRMR‚BTST.B„#$4,SDDRSP(A2)POLLBITSET?2‰BEQ.L…VCTINIT1‚*NO,FREEBUFFER,GOINTORECEIVEC‰MOVE.B„#SDSCIBSY,SDSCST(A4)YES,"SIM","DISC",OR"SNRM"COMMAND?‰CMP.B…#SDDCSIM,SDDRSP(A2)*‰BEQ.L…VCTINIT3‚*‰CMP.B…#SDDCDISC,SDDRSP(A2)*‰BEQ.L…VCTINIT2‚*‰MOVE.B„#SDSCBSY,SDSCST(A4)*‰CMP.B…#SDDCSNRM,SDDRSP(A2)*‰BEQ.L…VCTINIT3‚*4‰BRA.S…FRMRS  P„NO,BUILD&TRANSMITA"FRMR"RESPONSE ‰PAGE E* FRAME REJECTS WILL BE TRANSMITTED BY A SECONDARY STATION FOR ANY OF* THE FOLLOWING REASONS;K* 1) INVALID COMMAND - IN DISC OR NRM STATE, RECEIVE AN XID, AND HAVE NEVER*–TRANSMITTEDANXID,OR2*–INNRMANDRECEIVEAN"UNKNOWN"SDLCCOMMAND,OR2*–INFRAMEREJECTSTATEANDRECEIVEANYOTHERTHAN*–ASIM,DISC,ORSNRMCOMMAND.J* 2) PROHIBITED I-FIELD - RECEIVED AN I-FIELD ON A COMMAND WHICH IS A SIM,*–SNRM,DISC,RR,RNR,ORREJ.G* 3) BUFFER OVERRUN - RECEIVE AN OTHERWISE "GOOD" FRAME WHICH IS LONGER*–THANABUFFER.H* 4) INVALID Nr COUNT - RECEIVED AN Nr VALUE (IN EITHER A SUPERVISORY OR2*–ANINFORMATIONFRAME)WHICHACKNOWLEDGESAFRAME*–WEHAVENOTTRANSMITTED. **ˆCREATE"FRaMeReject"DATA*4FRMRICƒMOVE.B„#$01,SDPFRB+2(A5)‚INVALIDCOMMANDFRMR)‰CMP.B…#SDSCRDM,SDSCST(A4)INDISCSTATE?,‰BEQ.L…VCTDISC1‚*IFYES,SEND"DM"RESPONSE‰BRA.S…FRMRGN„NO,SEND"FRMR" 7FRMRPIƒMOVE.B„#$03,SDPFRB+2(A5)ƒPROHIBITEDIFIELDFRMR‰BRA.S…FRMRGN„* 3FRMRBOƒMOVE.B„#$04,SDPFRB+2(A5)ƒBUFFEROVERRUNFRMR‰BRA.S…FRMRGN„* 5FRMRNRƒMOVE.B„#$08,SDPFRB+2(A5)ƒINVALIDNRCOUNTFRMR*BFRMRGNƒMOVE.B„SDDRSP(A2),SDPFRB(A5)OFFENDINGCOMMAND->FRMRDATA=‰MOVE.B„SDSVSC(A4),D0CURRENT"NR"&"NS"COUNTS->FRMRDATA‰OR.B†SDSVRC(A4),D0‡*‰AND.B…#$EE,D0ƒ*‰MOVE.B„D0,SDPFRB+1(A5)(‰BSR.L…SOMEFREE‚FREEALLRECEIVEBUFFERS"‰BSR.L…SBGTFRIR‚FETCHANEWBUFFER6‰BGT.L…SDLCRC01‚OUTIFTHEREAREABSOLUTELYNOBUFFERS2* GOT ONE, DON'T CARE IF IT'S THE LAST ONE OR NOT.‰MOVE.L„A3,A2…*DFRMRSPƒMOVE.B„#SDSCRFR,SDSCST(A4)BUILD&TRANSMITA"FRMR"RESPONSE‰MOVE.B„#SDDRFRMR,SDDCMD(A2)*'‰MOVE.W„#3,SDDBCT(A2)*INITBYTECOUNT)‰MOVE.L„SDPFRB(A5),SDDDAT(A2)*INITDATA‰BRA.L…VCTINIT7‚* ‰PAGE * *ˆDISCONNECTSTATEFRAMECONTROL*+VCTDISC‚BTST.B„#$4,SDDRSP(A2)POLLBITSET?2‰BEQ.L…VCTINIT1‚*NO,FREEBUFFER,GOINTORECEIVEC‰MOVE.B„#SDSCIBSY,SDSCST(A4)YES,"SIM","DISC",OR"SNRM"COMMAND?‰CMP.B…#SDDCSIM,SDDRSP(A2)*‰BEQ.L…VCTINIT3‚*‰CMP.B…#SDDCDISC,SDDRSP(A2)*‰BEQ.L…VCTINIT2‚*‰MOVE.B„#SDSCBSY,SDSCST(A4)*‰CMP.B…#SDDCSNRM,SDDRSP(A2)*‰BEQ.L…VCTINIT3‚*.‰MOVE.B„#SDSCRDM,SDSCST(A4)NO,"XID"COMMAND?‰CMP.B…#SDDCXID,SDDRSP(A2)*‰BEQ.S…XIDRSP„*/‰CMP.B…#SDDCTEST,SDDRSP(A2)NO,"TEST"COMMAND?‰BEQ.S…TESTRSP‚*GVCTDISC1MOVE.B„#SDDRDM,SDDCMD(A2)‚NO,BUILD&TRANSMITA"DM"RESPONSE‰BRA.L…VCTINIT6‚* ‰PAGE **ˆTRANSMITA"TEST"RESPONSE*%TESTRSP‚MOVE.B„#SDDCTEST,SDDCMD(A2)*‰BRA.L…VCTINIT7‚* ‰PAGE J***************************************************************************<*‚SUBROUTINE:‚"SBXIDQ"CHECKFORAN"XID"ONTHETxMITQUEUE*2*‚ENTER:ŠA4.L=ADDRESSOFSECONDARYCONTROLBLOCK)*’A5.L=ADDRESSOFPRIMARYCONTROLBLOCK*!*‚REGISTERSUSED:ƒ01234567*’DU*’AUUƒUPPƒS *¢|_stack*K*************************************************************************** 9SBXIDQƒMOVE.L„SDSTHD(A4),A3"XID"REPONSEONTxMITQUEUE?6‰IF.L†A3#0AND.BSDDCMD(A3)#SDDCXIDTHEN.S8‹MOVE.L„SDDLNK(A3),SDSTHD(A4)TAKE"XID"OFFTxMITQUEUE‹IF.L†SDPXID(A5)#0THEN.S5MOVE.L„SDPXID(A5),A1…DISPOSEOFTHEOLD"XID"BUFFERBSR.L…SOMEDISPOSE‹ENDI/‹MOVE.L„A3,SDPXID(A5)NEW"XID"RESPONSEBUFFER‰ENDI‰RTS ‰PAGE *&*ˆTRANSMITAN"XID"OR"FRMR"RESPONSE*2XIDRSPƒBSR.S…SBXIDQ„CHECKFOR"XID"ONTxMITQUEUE,‰MOVE.L„SDPXID(A5),D0"XID"RESPONSEBUFFER?&‰BEQ.L…FRMRIC„*IFNO,INVALIDCOMMAND,‰BSR.L…SBGTFRIR‚FETCHARCVBUFFERFORLATER‰IFˆTHEN.S1‹BSR.L…SOMEFREE‚NOBUFFERS,JUSTSTAYINRCVMODE‹BRA.L…SDLCRC01‰ENDI‰MOVE.L„A3,SDPRCV(A5)*0‰MOVE.L„A2,A1…SENDTHE"XID"COMMANDTOTHEUSER‰BSR.L…SOMESEND‚*,‰MOVE.L„SDPXID(A5),A3PREPARE"XID"RESPONSE‰CLR.W…SDDSTS(A3)*STATUS!‰CLR.B…SDDRTC(A3)*RETRYCOUNTER‰CLR.B…SDDERR(A3)*ERROR)‰MOVE.B„SDSSEC(A4),SDDSEC(A3)*STATION#%‰MOVE.B„#SDDCXID,SDDCMD(A3)*COMMAND1‰BRA.L…TRANSMTƒTRANSMITTH  E"XID"&GOTORECEIVE ‰PAGE *%*ˆNORMALRESPONSE‚STATEFRAMECONTROL*/VCTNRMƒMOVE.L„SDSTHD(A4),A3‡HEADOFTxMITQUEUE*VCTNRM02CLR.L…D0ˆISCOMMANDAN"I"FIELD?‰MOVE.B„SDDRSP(A2),D0 ‰BTST.L„#0,D0#‰BEQ.L…DSPNR1„YES,OUTIF"I"FRAME0‰BTST.L„#1,D0…NO,"RR","RNR",OR"REJ"COMMAND?0‰BEQ.S…DSPNR…YES,OUTIFRR,RNR,ORREJCOMMAND‰BTST.L„#4,D0…NO,POLLBITSET?‰BEQ.S…VCTNRM06C‰MOVE.B„#SDSCIBSY,SDSCST(A4)YES,"SIM","DISC",OR"SNRM"COMMAND?‰CMP.B…#SDDCSIM,D0‰BEQ.L…VCTINIT3‰CMP.B…#SDDCDISC,D0‰IF.B†D0#SDDCDISCTHEN.S<‹CMP.B…#SDPTXQ,SDPTXF(A5)"DISC",TxMITTEDFROMTxMITQUEUE?‹BNE.L…VCTINIT26‹CMP.B…#SDDRRD,SDDCMD(A3)YES,WAS"RD"LASTRESPONSE?‹BNE.L…VCTINIT2K* NOTE: THE "RD" RESPONSE WILL BE LEFT ON THE TRANSMIT QUEUE UNTIL A "DISC"F*COMMANDISRECEIVED.‚THE"RD"CAMEFROMA"USER"WITHINOURMACHINE.&‹MOVE.L„A3,A1…YES,DISPOSEOFTHE"RD"‹BSR.L…SOMEDISPOSE-‹MOVE.L„A1,SDSTHD(A4)NEWHEADOFTxMITQUEUE‹BRA.L…VCTINIT2‰ENDI‰MOVE.B„#SDSCBSY,SDSCST(A4)*‰CMP.B…#SDDCSNRM,D0*‰BEQ.L…VCTINIT3‚*.‰MOVE.B„#SDSCNRM,SDSCST(A4)NO,"XID"COMMAND?‰CMP.B…#SDDCXID,D0*‰BEQ.L…XIDRSP„*'‰CMP.B…#SDDCTEST,D0NO,"TEST"COMMAND?‰BEQ.L…TESTRSP‚*!‰AND.B…#$EF,D0‚NO,CLEARPOLLBIT)VCTNRM06CMP.B…#SDDCUI,D0ISCOMMAND"UI"‰BEQ.L…RSPUI…*%‰BRA.L…FRMRIC„*IGIVEUPIFITISN'T ‰PAGE ADSPNR„TST.W…SDDBCT(A2)DATAFIELDON"RR""RNR"OR"REJ"COMMAND?$‰BNE.L…FRMRPI„*IFYES,FRAMEREJECT**ˆTESTFORAVALIDNrCOUNT*DSPNR1ƒCLR.L…D0 ‰CLR.L…D1 ‰CLR.L…D2$‰MOVE.B„SDDRSP(A2),D0FETCHNrCOUNT‰LSR.B…#5,D0…*$‰MOVE.B„SDSVSC(A4),D1FETCHVsCOUNT‰LSR.B…#1,D1…*-‰MOVE.B„SDSUKT(A4),D2FETCH#TxMITTEDFRAMES ‰BEQ.S…DSPNR2„*FRAMESTxMITTED?>‰CMP.L…#0,A3…ALLXMITFRAMESGONE(RESULTOFAFLUSH)?3/21/831‰BEQ.S…DSPNR2„YES,SAMEASIFNOI_FRAMES3/21/833‰BTST.B„#0,SDDCMD(A3)NO,"I"FRAMEONTxMITQUEUE?‰BNE.S…DSPNR2„**1‰MOVE.B„SDDCMD(A3),D1*YES,GETNsCOUNTFROMIT‰LSR.B…#1,D1…**‰ADD.B…D2,D1…**‰AND.B…#7,D1…**DSPNR2ƒWHILE.BƒD0D1DO.S‹SUB.B…#1,D1…NEXTVsCOUNT ‹AND.B…#7,D1#‹SUB.B…#1,D2…ALLVsCOUNTSCHECKED?#‹BMI.L…FRMRNR„YES,INVALIDNrCOUNT‰ENDW* Fall-thru to the next page‰PAGE3* NOTE: WE FALL-THRU TO HERE FROM THE PREVIOUS PAGE *"*ˆDISPOSEOFTXMITBUFFERSTONR-1*%‰CLR.L…D1ˆFETCHNrCOUNTFROMCOMMAND‰MOVE.B„SDDRSP(A2),D1*‰LSR.B„#4,D1…*‰AND.B…#$0E,D1ƒ*‰MOVE.B„D1,SDSVSC(A4)*Vs=Nr ‰MOVE.L„A3,D0…TxMITQUEUEEMPTY?‰BEQ.L…DSPRC1„YES,OUT>DSPNR4ƒCMP.B…#SDPTXQ,SDPTXF(A5)NO,TxMITTEDFROMTxMITQUEUE?‰BNE.L…DSPRC1„*&‰CLR.L…D0ˆYES,TXMITTEDAUIRESPONSE?‰MOVE.B„SDDCMD(A3),D0*‰AND.B…#$EF,D0ƒ*‰IF.B†D0#SDDCUITHEN.S‹BTST.L„#0,D0…IFIELD? ‹BNE.L…DCRTX8‹TST.B…SDSUKT(A4)YES,UNACKNOWLEDGEDIFRAMESTxMITTED? ‹BEQ.L…DSPRC1‹AND.B…#$0E,D0ƒYES,Nr=Ns?‹IF.B†D1D0THEN.S4MOVE.B„SDDRSP(A2),D0YES,isresponseRR,RNR,REJ?AND.B…#$03,D0ƒ*CMP.B…#1,D0…*BNE.S…DSPUI…*-BTST.B„#4,SDDRSP(A2)andpoll/finalbitset?BNE.S…DSPUI…*+MOVE.L„A2,A1…NO,DISPOSEOFRECEIVEBUFFERBSR.L…SOMEDISPOSE*%MOVE.L„A1,A2…ENDOFRECEIVEBUFFERS?MOVE.L„A1,D0…*BEQ.S…DSPUI…**BRA.L…VCTNRM02‚NO,TESTBUFFER'SRESPONSE‹ENDI‰ENDI)‰MOVE.L„A3,A1…NO,DISPOSEOFTxMITBUFFER!‰BTST.B„#4,SDDCMD(A3)POLL/FINAL?‰IFˆTHEN.S‹BSR.L…SOMEDISPOSENO ‹MOVE.L„A1,A3‹SUB.B…#1,SDSUKT(A4) ‹BRA.S…DSPNR4‰ELSE.S7‹BSR.L…SOMEDISPOSEYES,ALSODISPOSEOFRECEIVEBUFFERS ‹MOVE.L„A1,A34‹CLR.B…SDSUKT(A4)CLEARUNACKNOWLEDGEDIFRAMECOUNT ‹BRA.L…DSPRC1‰ENDI ‰PAGE *,*ˆAUI(UNNUMBEREDIFIELD)COMMANDOCCURRED*=RSPUI„MOVE.L„A2,A1…SENDRECEIVEBUFFERTOAPPLICATIONPROGRAM‰BSR.L…SOMESEND%‰MOVE.L„A1,A2…ENDOFRECEIVEBUFFERS? ‰MOVE.L„A1,D0 ‰BEQ.S…DSPUI*‰BRA.L…VCTNRM02‚NO,TESTBUFFER'SRESPONSE ‰PAGE **ˆDISPOSEOFUITXMITBUFFERS*9DSPUI„CMP.B…#SDPTXQ,SDPTXF(A5)TxMITTEDFROMTxMITQUEUE?‰BNE.L…DSPRC1„*&‰MOVE.L„A3,D0…YES,ENDO  FTxMITQUEUE?‰BEQ.L…DSPRC1„*%‰CLR.L…D1ˆNO,TXMITTEDAUIRESPONSE?‰MOVE.B„SDDCMD(A3),D1*‰AND.B…#$EF,D1ƒ*‰CMP.B…#SDDCUI,D1*‰BNE.S…DCRTX…**‰MOVE.L„A3,A1…YES,DISPOSEOFTXMITBUFFER‰BTST.B„#4,SDDCMD(A3)*‰IFˆTHEN.S>‹BSR.L…SOMEDISPOSEPOLL/FINALSET,ALSODISPOSEOFRCVBUFFERS ‹MOVE.L„A1,A3 ‹BRA.S…DSPRC1‰ENDI#‰BSR.L…SOMEDISPOSEPOLL/FINALCLEAR ‰MOVE.L„A1,A3 ‰BRA.S…DSPUI ‰PAGE **ˆDECREMENTTxMITRETRYCOUNTS*DCRTX„MOVE.L„A3,A1…*‰MOVE.B„SDSUKT(A4),D1+DCRTX2ƒMOVE.L„A3,D0…ALLTxMITBUFFERSGONE?‰BEQ.S…DCRTX5„*"‰BTST.B„#0,SDDCMD(A3)NO,IFIELD?‰IFˆTHEN.S*‹TST.B…D1ˆYES,UNACKNOWLEDGEDCOUNTCLEAR?‹BEQ.S…DCRTX5„YES,OUT ‹SUB.B…#1,D1‰ENDI7‰TST.B…SDDRTC(A3)NO,DECREMENTRETRYCOUNTIFNON-ZERO ‰BEQ.S…DCRTX4*‰SUB.B…#1,SDDRTC(A3)DECREMENTRETRYCOUNT‰BNE.S…DCRTX4„EXPIRED??‰MOVE.L„A3,A1…YES,SENDTHISTxMITBUFFERTOAPPLPGMASUNSENT>‰MOVE.B„#SDDSSTE,SDDSTS+1(A3)SETRETRYCOUNTEREXPIREDSTATUS$‰BTST.B„#$4,SDDCMD(A3)POLLBITSET?‰IFˆTHEN.S&‹BSR.L…SOMESEND‚YES,LASTTXMITBUFFER4‹CLR.B…SDSUKT(A4)CLEARUNACKNOWLEDGEDIFRAMECOUNT ‹BRA.S…DCRTX5‰ENDI"‰BTST.B„#0,SDDCMD(A3)NO,IFIELD?‰IFˆTHEN.S#‹SUB.B…#1,SDSUKT(A4)YES,FIXCOUNT‰ENDI‰BSR.L…SOMESEND%‰MOVE.L„A1,A3…FETCHNEXTTxMITBUFFER ‰BRA.S…DCRTX2 .DCRTX4ƒCLR.B…SDDERR(A3)CLEARSDLCERRORFIELD$‰BTST.B„#$4,SDDCMD(A3)POLLBITSET?‰IFˆTHEN.S1‹MOVE.L„SDDLNK(A3),A3No,FETCHNEXTTxMITBUFFER ‹BRA.S…DCRTX2‰ENDI!* Fall-Thru if poll/final bit set ‰PAGE +DCRTX5ƒMOVE.L„A1,A3ƒNEWHEADOFTxMITQUEUE**ˆDISPOSEOFRCVBUFFERS*3DSPRC1ƒMOVE.L„A3,SDSTHD(A4)NEWHEADOFTxMITQUEUE.‰MOVE.L„A2,D0…ALLRECEIVEBUFFERSDISPOSEDOF? ‰BEQ.S…SELTX4‰CMP.B…#SDDERBO,SDDERR(A2)NO,BUFFEROVERRUNERROR? ‰BEQ.L…FRMRBO0‰TST.B…SDDERR(A2)NO,SOMEOTHERSDLCRCVERROR? ‰BNE.S…SELTX2/‰MOVE.B„SDDRSP(A2),D0ISCOMMAND‚UIORIFIELD?‰AND.B…#$EF,D0‰IF.B†D0#SDDCUITHEN.S ‹BTST.L„#0,D0 ‹BNE.S…SELTX2„OUTIFNOTI-FRAME‰ENDI;‰MOVE.L„A2,A1…UIORI-FRAME,SENDITTOAPPLICATIONPROGRAM‰BTST.B„#4,SDDRSP(A2)‰IFˆTHEN.S!‹BSR.L…SOMESEND‚FINALBITNOTSET ‹MOVE.L„A1,A2 ‹BRA.S…DSPRC1‰ELSE.S5‹BSR.L…SOMESEND‚*YES,ALSOFREEALLRCVBUFFERSLEFT$‹MOVE.L„A1,A2…FALL-THRUTONEXTPAGE‰ENDI ‰PAGE :* WARNING: WE MAY FALL-THRU TO HERE FROM THE PREVIOUS PAGE*%*ˆFETCHABUFFER&TRANSMITSOMETHING*)SELTX„BSR.L…SOMEFREE‚FREEANYOLDBUFFERS"‰BSR.L…SBGTFRIR‚FETCHANEWBUFFER3‰BGT.L…SDLCRC01‚OUTIFABSOLUTELYNOBUFFERSATALL‰IFˆTHEN.S* GOT THE VERY LAST BUFFER/‹MOVE.L„A3,SDPRCV(A5)NEWHEADOFRECEIVEQUEUE ‹MOVE.L„A3,A21‹MOVE.B„#SDDRRNR+$10,SDDCMD(A2)TRANSMITAN"RNR"3‹MOVE.B„#SDPTRQ,SDPTXF(A5)TxMITTINGFROMRCVQUEUE‹BRA.L…VCTINIT6‰ENDI3‰MOVE.L„A3,SDPRCV(A5)NO,NEWHEADOFRECEIVEQUEUE-‰MOVE.L„A3,A2…USENEWBUFFERTOTRANSMITFROM‰MOVE.B„#$10,SDDRSP(A2)**ˆSELECTARESPONSETOTRANSMIT*+SELTX2ƒBTST.B„#$4,SDDRSP(A2)FINALBITSET?‰IFˆTHEN.S(‹MOVE.L„A2,A1…NO,DISPOSEOFTHISBUFFER‹BSR.L…SOMEDISPOSE ‹MOVE.L„A1,A2 ‹BRA.L…DSPRC1‰ENDI5‰MOVE.L„A2,SDPRCV(A5)ONLY1BUFFERLEFTINRCVQUEUE‰MOVE.B„SDDRSP(A2),D0?‰AND.B…#$1F,D0ƒWerewesentanRNRcommand?orhavenotraffic?9‰IF.B†D0#SDDRRNR+$10OR.LSDSTHD(A4)#0THEN.S9‹MOVE.B„#SDDRRR+$10,SDDCMD(A2)Yes,sendan"RR"response3‹MOVE.B„#SDPTRQ,SDPTXF(A5)(sendingfromrcvqueue)‹BRA.L…VCTINIT6‰ENDI‰MOVE.L„SDSTHD(A4),A3‰MOVE.B„#SDPTXQ,SDPTXF(A5)#‰BTST.B„#0,SDDCMD(A0)YES,IFIELD?‰IFˆTHEN.S:‹CLR.B…SDSUKT(A4)YES,CLEARUNACKNOWLEDGEDTRANSMITCOUNT‰ENDI‰BRA.L…TRANSMT ‰PAGEG* When a "flush" occurs, after all transmit frames have been discarded,H* and when, at the moment of the flush, we are transmitting one of theseH* frames, an abort is transmitted and the transmitter turned off (by theE*flushprocedure).‚Immediatelyafterdoingthat,webranchtoSDLCRQ* to d ecide what to do next.I* In a secondary station, we simply exit because we will wait to see whatK* the primary wants us to do next (presumably he will poll us fairly soon). SDLCRQƒSDLRSRG‰RTE /***********************************************/* END OF FILE 'FIX:48.SDLCSEC.FRMCNT.AI' */***********************************************ééééééé4****************************************************4* BEGINNING OF FILE 'FIX:48.SDLCSEC.PWRUP.AI' *4**************************************************** M*NOTE:ATSTARTUP,OURCURRENTSTATEIS"DISCONNECTMODE".‚THESTARTER-UPPERE*‡(WHO?)STORES#SDSCRDMINTOSDSCSTTHEREBYASSERTINGTHISSTATE.‚WEE*‡AREINTHISSTATEWHENTHEPWRUPSUBROUTINEISCALLED,WHICHISTHE&*‡FIRSTCALLTOTHESDLCDRIVERLOGIC. SDLRSRG‚MACRO2‰MOVEM.Lƒ(A7)+,A0-A6/D0-D2RESTORESAVEDREGISTERS‰ENDM SDLSVRG‚MACRO‰MOVEM.LƒA0-A6/D0-D2,-(A7)‰ENDM‰PAGE H*************************************************************************Æ*D*SUBROUTINE:‚"PWRUP"INITIALIZETHENEC7201CHIPATPOWERUPTIME„*#*REGISTERSUSED:ƒ01234567¤* *‘DUUU®**‘AUUUƒP…S¤**Æ*H************************************************************************ ‰NEXTWB,PWRUP„MOVE.B„#NCW0RCN,NECCTL_B„CHANNELRESET‰MOVE.B„#NCW0RG2,NECCTL_A)‰MOVE.B„#NCW2RTS+NCW2PRI+NCW2BIN,NECCTL_A*‰MOVE.B„#NCW0RG2,NECCTL_B„INTERRUPTVECTOR‰MOVE.B„#0,NECCTL_B‰MOVE.B„#NCW0RG4,NECCTL_B„MODE)‰MOVE.B„#NCW4C01+NCW4SDL+NCW4SME,NECCTL_B#‰MOVE.B„#NCW0RG7,NECCTL_B„SDLCFLAG‰MOVE.B„#SDLCFLAG,NECCTL_B3‰MOVE.B„#NCW0RG3,NECCTL_B„ENABLEAUTOENABLEOFCTS!‰MOVE.B„#NCW3BT8+NCW3AUE,NECCTL_B‰IFEQ†RES7201-400‹MOVE.W„SR,-(A7)!‹ORI.W…#$0700,SRŠMaskInterrupts!5‹MOVE.L„#MVME400,A0ˆA0=AddressoftheMVME400board'‹BCLR.B„#REGSELEC,CTLPIA_A(A0)SetDDRAA‹MOVE.B„#WRT_LED+WRT_SEL,DATPIA_A(A0)tooutputmid-twobitsonly:‹BSET.B„#REGSELEC,CTLPIA_A(A0)SwitchnowtoDataRegonA=‹BSET.B„#WRT_SEL,DATPIA_A(A0)SelectbaudratejumpersPort2(‹MOVE.B„DATPIA_A(A0),D0andreadthemin6‹ANDI.W„#$07,D0‹AND'ingoffallbutthebaudratebitsB‹MOVE.B„V400BAUD(PC,D0.W ),D0andgetthe4-bitcorrespondingvalue3‹MOVE.B„D0,-(A7)Šsavingitonthestacktemporarily,‹BCLR.B„#REGSELEC,CTLPIA_B(A0)Now,setDDRB2‹MOVE.B„#%11111111,DATPIA_B(A0)toallbitsoutput:‹BSET.B„#REGSELEC,CTLPIA_B(A0)SwitchnowtoDataRegonBÁ5ÊLÒKÚIâ;‹MOVE.B„DATPIA_B(A0),D0andreadthecurrent4-bitsettings.‹ANDI.B„#RATE1MSK,D0dropoutPort2'ssetting;‹OR.B†(A7)+,D0andORinthenewvaluewefiguredoutaboveB‹MOVE.B„D0,DATPIA_B(A0)andoutputthenewrate(Port1unchanged)#‹MOVE.W„(A7)+,SRŠUnmaskInterrupts!‰ENDC,‰LEA‡SDLCPR(PC),A0‡Addressof"SDLCPR"->A0‰MOVE.L„#TIMCNST,A1‰MOVE.W„#$4005,D19‰MOVE.L„#DLC1,D2ŒRequestaPeriodic,RecurringActivation‰IFEQ†CHIPTYPE-68000 ‹TR0.RQPA‰ENDC‰IFNE†CHIPTYPE-68000 ‹TR0$.RQPA‰ENDC3‰BRA.S…HOPOVER(MUSTBE2BYTEINSTRUCTION)‚2/24/831‰ILLEGALDIEIFSBRQPARETURNSANYERROR!ˆ2/24/83 5HOPOVER‚BRA.L…SBSDLCRCSTŠGoturnonthereceivernow! ‰IFEQ†RES7201-400"V400BAUDƒDC.B†15,14,13,12,10,7,5,2‰ENDC *3*„ThisisadummyroutinetosatisfyXREFinBUFMGT*‰XDEF†SDLCQXMT )SDLCQXMTILLEGALDie,shouldnotbeused! ‰PAGE ‰SECTIONƒ9H*************************************************************************Æ*0*ˆTRAP:‚"SDLCQU"‚TRAPSERVICEROUTINEFORSDLC*0*™ABUFFERHASBEENENQUEUEDFORTRANSMISSION.*,*™INTHESECONDARYSTATION,WEDON'TCARE.…**ˆSUBROUTINE:‚"SDLCQUSB"§**Æ**Æ*#*REGISTERSUSED:ƒ01234567¤**‘D´**‘AS¤* *¡|__stackœ**Æ*H************************************************************************ 'SDLCQUƒBSR.S…SDLCQUSB‚DOTHESUBROUTINE=‰MOVE.W„SR,0(A7)‚REPLACESRONSTACKTOGIVEPROPERCCRETURN‰RTE‘ANDRETURN 2SDLCQUSBRTS‘JustReturn,Wedon'tcareaboutthis ‰PAGE H*************************************************************************Æ*4*ˆTRAP:‚"SDLCTTMOUT"‚TRAPSERVICEROUTINEFORSDLCŒ*,*THISROUTINEISENTEREDWHENTHERECEIVE**TIMEOUTEXPIRESš**ˆSUBROUTINE:‚"SDLCTMOUT"¦**Æ**Æ*#*REGISTERSUSED:ƒ01234567¤**‘D´**‘AS¤* *¡|__stackœ**Æ*H************************************************************************ SDLCTMOUT‚RTS2RTE%SDLCTTMOUTSDLSVRGSAVEALLUSERREGS‰MOVE.L„SDLCPCB,A6RESTOREREGS‰MOVEM.LƒSDPRRTA0(A6),A0-A6‰ADD.W…#1,SDSHCRTO(A4)…3/2/83‰BRA.L…RECEITOƒRECEIVETIMEOUT ‰PAGE H*************************************************************************Æ*8*ˆTRAP:‚"SDLCPR"‚TRAPSERVICEROUTINEWHICHISENTEREDˆ*%*™WHENTHEPERIODICTIMERRUNSDOWNŒ**ˆSUBROUTINE:‚"SDLCPRSB"§**Æ**Æ*#*REGISTERSUSED:ƒ01234567¤**‘D´**‘AS¤*H************************************************************************ SDLCPRSB RTS2RTE!SDLCPRƒSDLSVRGŽSAVEALLREGISTERS2‰MOVE.L„SDLCPCB,A5AREWEBUSYWAITINGFORBUFERS?$‰IF.B†SDPBSY(A5)#SDPBWBTHEN.S‹SDLRSRGŽNO,RETURN‹RTE‰ENDI8‰BRA.S…SDLCRC01‚YES,GOGETONEANDTURNONTHERECEIVER‰PAGE H*************************************************************************Æ*0*ˆTRAP:‚"SDLCKL"ƒTRAPSERVICEROUTINEFORSDLC*&*šTHISROUTINEEFFECTIVELYKILLSTHEŠ*.*šSDLCLINKANDCANCELSPERIODICACTIVATIONS‚**ˆSUBROUTINE:‚"SBSDLCKL"§**Æ*#*REGISTERSUSED:ƒ01234567¤* *‘DƒUU®**‘AS¤* *¡|__stackœ**Æ*H************************************************************************ 9SDLCKLƒBSR.S…SBSDLCKL‚TRAPENTRYPOINT,DOTHESUBROUTINE9‰MOVE.W„SR,0(A7)‚REPLACESRONSTACKSOWEGIVEPROPERCC‰RTE‘ANDRETURN /SBSDLCKLMOVE.W„SR,-(A7)‚SUBROUTINEENTRYPOINT!‰ORI.W…#$0700,SRMASKTOLEVEL7!1‰MOVE.B„#NCW0RCN,NECCTL_BCHANNELRESET7201CHIP'‰BSR.L…SOMETOCLRTURNOFFRECEIVETIMER‰MOVE.W„#$8005,D1;‰MOVE.L„#DLC1,D2‚DiscontinueRecurringPeriodicActivations‰IFEQ†CHIPTYPE-68000 ‹TR0.RQPA‰E NDC‰IFNE†CHIPTYPE-68000 ‹TR0$.RQPA‰ENDC‰BRA.S…SDLCKLEX)‰ILLEGALDIEIFSBRQPARETURNSANYERROR! 6SDLCKLEXMOVE.W„(A7)+,SR‚RESTOREPRIORINTERRUPTLEVEL‰RTS‘ANDRETURN ‰PAGE H*************************************************************************Æ*<*ˆSUBROUTINE:‚"SBUSRACK"‚USERACKNOWLEDGESRECEIPTOFSDLC„*!*¡"SIM""DISC"OR"SNRM"FRAMESˆ**ˆTRAP:ˆ"USRACK"©**Æ*&*ˆENTER:‚D0.B="SDDCSIM"=>ACKSIM›**•="SDDCDISC"=>ACKDISC™**•="SDDCSNRM"=>ACKSNRM™**Æ**Æ*#*ˆREGISTERSUSED:ƒ01234567**˜DP«* *˜AUS**š|‚|Š|_stack–**š|‚|____________preserved’**š|_______________used—**Æ**Æ*H************************************************************************ 9USRACKƒBSR.S…SBUSRACK‚TRAPENTRYPOINT,DOTHESUBROUTINE5‰MOVE.W„SR,0(A7)‚REPLACESRONSTACKGIVINGPROPERCC‰RTE‘ANDRETURN @SBUSRACKMOVE.L„SDLCPCB,A0FETCHSECONDARYCONTROLBLOCKADDRESS‰MOVE.L„SDPFSEC(A0),A0‰IF.B†D0#SDDCSIMTHEN.S2‹MOVE.B„#SDSCRDM,SDSCST(A0)IFSIM,SETDISCSTATE‰ELSE.S‹IF.B†D0#SDDCDISCTHEN.S3MOVE.B„#SDSCRDM,SDSCST(A0)IFDISC,SETDISCSTATE‹ELSE.SIF.B†D0#SDDCSNRMTHEN.S2MOVE.B„#SDSCNRM,SDSCST(A0)IFSNRM,SETNRMSTATEELSE.S%‘ILLEGALOTHERWISE,ILLEGALACK,DIE!ENDI‹ENDI‰ENDI‰RTS ‰PAGE H*************************************************************************Æ*2*ˆTRAP:‚"SDLCRCST"‚TRAPSERVICEROUTINEFORSDLCŽ*)*™THISROUTINEFETCHESARECEIVEBUFFERˆ**™ANDSTARTSUPTHERECEIVER“**ˆSUBROUTINE:‚"SBSDLCRCST"¥**Æ**Æ*#*REGISTERSUSED:ƒ01234567¤**‘D´**‘AS¤* *¡|__stackœ**Æ*H************************************************************************ SBSDLCRCST RTS2RTE#SDLCRCSTSDLSVRGSAVEALLUSERREGS>SDLCRC01MOVE.L„SDLCPCB,A5PRIMARYCONTROLBLOCKADDRESS->A5<‰MOVE.L„SDPFSEC(A5),A4SECONDARYCONTROLBLOCKADDRESS->A4)‰CLR.L…SDPRCV(A5)CLEARHEADOFRCVQUEUE ‰MOVE.W„SR,D0‰AND.W…#$0700,D0%‰CMP.W…#$0500,D0ATLEASTLEVELFIVE?‰IF.W†#$0500D0THEN.S‹MOVE.W„SR,D0…NO,‹AND.W…#$F8FF,D0.‹OR.W†#$0500,D0RAISETOINTERRUPTLEVELFIVE!-‹MOVE.W„D0,SR…(OLDSRANDLEVELAREONSTACK)‰ENDI-‰MOVE.B„#SDPBNB,SDPBSY(A5)SETSSDLCNOTBUSY$‰BSR.L…SBGTFRIR‚GETARECEIVEBUFFER‰IFˆTHEN.S8‹MOVE.B„#SDPBWB,SDPBSY(A5)NONEAVAILABLE,SLEEPAWHILE‹SDLRSRG‹RTE‰ENDIBSDLCRC02MOVE.L„A3,SDPRCV(A5)LINKRCVBUFFERTOHEADOFRCVQUEUE-‰MOVE.W„SDPRLG(A5),SDDBCT(A3)INITBYTECOUNT‰CLR.W…SDDSTS(A3)INITSTATUS!‰CLR.B…SDDERR(A3)INITSDLCERROR,‰MOVE.B„SDSSEC(A4),SDDSEC(A3)STATIONNUMBER#‰BRA.L…RECEIVEƒGOINTORECEIVEMODE .**********************************************.* END OF FILE 'FIX:48.SDLCSEC.PWRUP.AI' *.**********************************************éééé éé' GEN IBUFQ AGööbbIDLCP AGÿÿLbbILOADP AGbbINETP AGbbINET LG+bbINETNOL LG##4bbINETV2 LG,,1bbLOADV2 LG55bb**ˆGEN.IBUFQ.AG*0IBUFQ„IDNT†1,0ƒINITPARAMSFORBUFFERMANAGEMENT ‰SECTIONƒ8*$*ˆCOPYRIGHTED1982BYMOTOROLA,INC.*F***********************************************************************Ä*3*„InitializationParametersforBufferManagement‘**Ä*F*********************************************************************** ‰XDEF†NUMBUF5NUMBUFƒDC.W†\NUMBUFƒNunberofbuffersinBufferQueue ‰XDEF†SZDBUF4SZDBUFƒDC.W†\SZDBUFƒSizeofdataareaineachbuffer ‰XDEF†FQULWM4FQULWMƒDC.W†\FQULWMƒFreeQueueUser'sLowWaterMark‰ENDéééééî**ˆGEN.IDLCP.AG*1IDLCP…IDNTƒ1,0InitializationparametersforSDLC*‰NOLIST*‰INCLUDE9995.INET.INET.EQ*‰LISTŠNOLISTŠINCLUDE9995.INET.INET.EQŠLIST ŠSECTION8*$*ˆCOPYRIGHTED1982BYMOTOROLA,INC.*F************************** *********************************************Ä*?*„InitializationParametersforSynchronousDataLinkControl…**Ä*F*********************************************************************** STAFLG„SET„0 ŠXDEFƒSTATION STATIONƒEQU„*ŠIFC„'\STATION','PRIMARY'&DC.B‚0StationIDflag,0forprimary STAFLG‡SETƒ1ŠENDCŠIFC„'\STATION','SECONDARY'*DC.B‚1StationIDflag,<>0forsecondary STAFLG‡SETƒ2ŠENDC ŠIFEQƒSTAFLG5FAIL‚100ƒSTATIONmustequal'PRIMARY'or'SECONDARY'ŠENDC ŠIFNEƒSTAFLG*STAFLG‡SET‚STAFLG-1…0=PRIMARY,1=SECONDARYŠENDC* ŠXDEFƒSYSTYPE7SYSTYPEƒDC.Bƒ\SYSTYPE‹Systemtype(NOLINK,LINKMAIN,...)* ŠXDEFƒMAXSEC ŠIFEQƒSTAFLGBMAXSEC‡DC.Wƒ\MAXSEC…Max#secondarystations(iflocalisprimary) XDEFƒFSSTN0FSSTNˆDC.Bƒ\FSSTNFirstSecondaryStationNumber XDEFƒSSINC-SSINCˆDC.Bƒ\SSINCSecondaryStationINCrementŠENDC ŠIFNEƒSTAFLG5MAXSEC‡DC.Wƒ1’Iflocalstationissecondary,MAXSEC=1 XDEFƒFSSTN FSSTNˆDC.Bƒ0 XDEFƒSSINC SSINCˆDC.Bƒ0ŠENDC ŠXDEFƒDLBR%DLBR†DC.Wƒ\DLBRŽDataLink'sBaudRate ŠXDEFƒTXRTRY(TXRTRY„DC.Bƒ\TXRTRYŒTransmitRetryCount ŠXDEFƒRCRTRY'RCRTRY„DC.Bƒ\RCRTRYŒReceiveRetryCount ŠXDEFƒMXOBF3MXOBF…DC.Bƒ\MXOBFMaximumNumberofOutboundFrames ŠXDEFƒRCTOV3RCTOV…DC.Wƒ\RCTOVReceiveTimeoutValue(1=50Msec) ŠXDEFƒRTRDLY+RTRDLY„DC.Wƒ\RTRDLYŒRetryDelay(1=50Msec) ŠXDEFƒTXDLY,TXDLY…DC.Wƒ\TXDLYTransmitDelay(1=50Msec) ŠXDEFƒPFDLY4PFDLY…DC.Wƒ\PFDLYPollPoweredOffDelay(1=50Msec) ŠXDEFƒPNDLY3PNDLY…DC.Wƒ\PNDLYPollPoweredOnDelay(1=50Msec) ŠXDEFƒTXPDS$TXPDS…DC.Bƒ\TXPDS#ofTransmitPadsŠEND÷M**ˆGEN.ILOADP.AG*(ILOADP„IDNTƒ1,0Init.equatesforLOADV2 ŠSECTION8*$* COPYRIGHTED 1982 BY MOTOROLA, INC.*#* Initialization equates for LOADV2* ŠXDEFƒV2OFF'V2OFF…EQU„\V2OFFOffsetforVM02memory ŠXDEFƒV2SYSP0V2SYSP„EQU„\V2SYSPŒAddressforVM02SYSPARarea.ŠENDéééééé **ˆGEN.INETP.AG*/INETP„IDNT†1,0ƒINITPARAMSFORNETWORKSERVICES ‰SECTIONƒ8*$*ˆCOPYRIGHTED1982BYMOTOROLA,INC.*F***********************************************************************Ä*0*„InitializationParametersforNetworkServices*Ä*F*********************************************************************** ‰XDEF†MAXLNAUFMAXLNAU‚DC.W†\MAXLNAU‚Max#NetworkAddressableUnitsatlocalstation ‰XDEF†MAXNAMEGMAXNAME‚DC.W†\MAXNAME‚Max#NetworkNames(ifprimary-maxinnetwork) ‰XDEF†MAXCONN/MAXCONN‚DC.W†\MAXCONN‚Max#LogicalConnections ‰XDEF†OPERDEVOPERDEV‚DC.L†0‰ENDééééé =/*=/*†GEN.INET.LG=/*.=/* Link chain file run at sysgen time to link=/*D=/* Sysgen parameter LINKLS = \LINKLS = file/device to which to send=/* the linker listing=/*"=LINK ,&.INET.LO,&.SYSGEN.TF;HMIXS TASK INET,$AATTR SDPSEG SDLC(R):9,10,2 $0000 SEG SSCT:14,0 SEG INET(R):8DEF DLCBLDCB,$0000DEF SBINFRBF,$0000DEF STRSDLC,$0000INPUT…SDLC.BEGSDLC.ROINˆSDLC.BUFMGTX.ROINˆSDLC.EXORDLC.ROINˆNTS.NTSREQ.ROINˆNTS.NTCREQP.ROINˆNTS.NWCREQ.ROINˆNTS.TRANSSUB.ROINˆNTS.TRANSSCN.ROINˆNTS.SSCT.ROINˆNTS.NWCTPRI.ROIN‡TEST.OUTTERM.ROINˆNTS.NTSSERV.ROINŠ&.SYSPAR.ROIN…M68000.INET.ROINˆGEN.INETP.ROINˆGEN.IDLCP.ROINˆGEN.IBUFQ.ROINˆGEN.ILOADP.ROIN‡INET.NTBLDTB.ROIN…M68000.SRSN.ROIN‡INET.NWTEST.ROIN‡INET.GETSTA.ROINPUT„INET.OUTTERMS.ROLIB 0.&.UTILIB.ROEND=/*=ENDéé éé,=/*=/*†GEN.INETNOL.LG=/*.=/* Link chain file run at sysgen time to link=/*D=/* Sysgen parameter LINKLS = \LINKLS = file/device to which to send=/* the linker listing=/*$=LINK ,&.INETNOL.LO,&.SYSGEN.TF;HMIX TASK INET,$AATTR SDPSEG SDLC:9,10,2 SEG SSCT:14,0 SEG &INT:8DEF PORTAIO,$0000DEF NECDAT_A,$F70011DEF NECDAT_B,$F70013DEF NECCTL_A,$F70015DEF NECCTL_B,$F70017INPUT…SDLC.BEGSDLC.ROINˆSDLC.BUFMGTX.ROINˆSDLC.SDLCPRI.ROINˆSDLC.DLTRACE.ROIN 9999.M68XXX.EXRQPA.ROIN‚9999.M6840.RDTIMER.ROIN‰NTS.NTSREQ.ROIN‰NTS.NTCREQP.ROIN‰NTS.NWCREQ.ROIN‰NTS.TRANSSUB.ROIN‰NTS.TRANSSCN.ROIN‰NTS.SSCT.ROIN‰NTS.NWCTPRI.ROINˆTEST.OUTTERM.ROIN‰NTS.NTSSERV.ROIN‹&.SYSPAR.ROIN†M68000.INET.ROIN‰GEN.IDLCP.ROIN‰GEN.INETP.ROIN‰GEN.IBUFQ.ROIN‰GEN.ILOADP.ROINˆINET.IPSDLC.ROINˆINET.GETSTA.ROINˆSDLC.IBFMGT.ROINˆINET.NTBLDTB.ROIN†M68000.SRSN.ROINˆINET.NWTEST.ROINˆVM02.STRSDLC.ROINˆVM02.VEC7201.ROINPUT…INET.OUTTERMS.ROLIB 0.&.UTILIB.ROEND=/*=ENDééé5=/*=/*†GEN.INETV2.LG=/*.=/* Link chain file run at sysgen time to link=/*D=/* Sysgen parameter LINKLS = \LINKLS = file/device to which to send=/* the linker listing=/*%=LINK ,VM02.INET.LO,&.SYSGEN.TF;SHMIX TASK INET,$AATTR SDPSEG SDLC:9,10,2 \V2BSTR SEG SSCT:14,0 SEG &INT:8DEFƒNECDAT_A,$F70011DEFƒNECDAT_B,$F70013DEFƒNECCTL_A,$F70015DEFƒNECCTL_B,$F70017DEFƒMAXCONN,$8000DEFƒMAXLNAU,$8000DEFƒMAXNAME,$8000DEFƒNTBLDTB,$8000DEFƒNTSREQ,$0000DEFƒNWCT,$0000DEFƒOUTTERMS,$0000DEFƒSSCT,$0000DEFƒTRASCAN,$0000INPUT‡9999.M68XXX.EXRQPA.ROINPUT‡9999.M6840.RDTIMER.ROINPUT‡SDLC.BEGSDLC.ROINPUT‡SDLC.BUFMGTX.ROINPUT‡SDLC.PORTAIO.ROINPUT‡SDLC.SDLCPRI.ROINPUT‡SDLC.DLTRACE.ROINPUT„&.SYSPAR.ROINPUT„M68000.INET.ROINPUT„GEN.IDLCP.ROINPUT„GEN.IBUFQ.ROINPUT„GEN.ILOADP.ROINPUT„INET.IPSDLC.ROINPUT„SDLC.IBFMGT.ROINPUT„M68000.SRSN.ROINPUT„INET.NWTEST.ROINPUT„VM02.STRSDLC.ROINPUT„VM02.VEC7201.ROINPUT„INET.GETSTA.ROLIB 0.&.UTILIB.RO END=/*=ENDééé$2=/*=/*†GEN.LOADV2.LG=/*.=/* Link chain file run at sysgen time to link=/*D=/* Sysgen parameter LINKLS = \LINKLS = file/device to which to send=/* the linker listing=/*%=LINK ,&.LOADV2.LO,&.SYSGEN.TF;HAMIXSSEG SEG0:0,8,14INPUT &.SYSPAR.ROINPUT INET.LOADV2.ROINPUT GEN.ILOADP.ROLIB 0.&.UTILIB.ROEND=/*=ENDéééééé-' NETVM02 INT LGBB bb =/*=/*†&..SYSINIT.LG=/*=/*=LINK ,INIT.LO,SYSGEN.TF;HAMIXSSEG .INT:8 \PCINPUT ROGEN.ROINPUT &.INITDAT.ROINPUT 9999.C13O15.SYSPAR.ROEND=/*=ENDééééééé: ' SDLCPRI FRMCNT SIOO5ÊbbINT7201 SIˆˆ+bbPOLLQ SI¹¹.cbbRECEIVE SIêê5žbbSUBRTN SI## bbTRANSMITSIDDLbb‰PAGE4****************************************************5* BEGINNING OF FILE 'FIX:48.SDLCPRI.FRMCNT.AI' *4**************************************************** 9TRANSEQ‚EQU‡*‰EndofXmtQueuereached,P/FbitNOTsent!‰MOVE.B„#NCW0EOI,N ECCTL_A8‰MOVE.B„#NCW0RG1,NECCTL_B„DisableTransmitterInterrupts!‰MOVE.B„#NCW1IRD+NCW1STV,NECCTL_B9‰MOVE.B„#SDPBFC,SDPBSY(A5)SETSDLCBUSYINFRAMECONTROL‰ADD.W…#1,SDSHCTOF(A4)…3/2/83‰MOVE.L„SDSTHD(A4),A3‰MOVE.L„SDPRCV(A5),A2 ‰BSR.L…SOMEFREEFREERCVBUFFERS ‰LEA‡0,A2*-‰CLR.B…SDSPWR(A4)ASSUMEDEVICEISPOWEREDUP0‰BRA.L…DSPUI…DISPOSEOFANYTxMITTED"UI"FRAMES .TRANSPB‚BRA.L…RECEIVEƒTRANSMIT(POLLBIT)EXIT ‰PAGE %TRANSUF‚EQU‡*‰TRANSMITUNDERFLOWEXIT8‰MOVE.B„#NCW0RG1,NECCTL_B„DisableTransmitterInterrupts!‰MOVE.B„#NCW1IRD+NCW1STV,NECCTL_B9‰MOVE.B„#SDPBFC,SDPBSY(A5)SETSDLCBUSYINFRAMECONTROL'‰BTST.B„#0,SDDCMD(A3)IFIELDTxMITTED?‰IFˆTHEN.S*‹SUB.B…#2,SDSVSC(A4)YES,FIXUPVsCOUNTS‹AND.B…#$0E,SDSVSC(A4)‹SUB.B…#1,SDSUKT(A4)‰ENDI)‰TST.L…SDSTHD(A4)Didaflushjustoccur?(‰BEQ.S…TRANSUF3‚Yes,gosendan"RR"now&‰TST.B…SDDRTC(A3)No,anyretrycount?2‰BEQ.L…TRANSMTƒNo,retrysendingforeverandever!>‰SUB.B…#1,SDDRTC(A3)Yes,countoneattempttosendthebuffer7‰BNE.L…TRANSMTƒandgore-senditifcountnotexhausted4* The retry count has expired for a transmit buffer.=* Return it to the originator after marking it as unsendable.F* Then, fix up the transmit queue by linking the buffer just after the.*‡unsendableonetothebufferjustbeforeit.?* For example, if the transmit queue currently looks like this;'*†A-->B-->C,whereBisunsendable.:* Then we fix up the transmit queue so it looks like this;*†A-------->C.K* The fix-up is accomplished by looking for a buffer that points to the oneO* we just got rid of, and then storing the "next" buffer's address (as returned3* to us by SOMESEND) into its forward link pointer.G1P@X@`NhOpJx33‰MOVE.B„#SDDSSTE,SDDSTS+1(A3)Markitasunsendable6‰MOVE.L„A3,A1…A1=A(Unsendablebuffer-forSOMESEND)>‰MOVE.L„A3,A2…A2=A(Unsendablebuffer-forWHILEclauseuse)6‰BSR.L…SOMESEND‚PasstheUnsendablebuffertotheuser7‰MOVE.L„A1,A3…A3=A(Nextbufferinthetransmitqueue)?‰LEA‡SDSTHD-SDDLNK(A4),A1Findbufferbeforetheunsendableone?‰WHILE.LƒSDDLNK(A1)A2DO.SPointingtounsendablebuffer?/‹MOVE.L„SDDLNK(A1),A1‡No,ontothenextbuffer‰ENDW@‰MOVE.L„A3,SDDLNK(A1)yes,store"next"into"beforeunsendable"8‰BNE.L…TRANSMTƒGosendthenextoneifsomething'sthereETRANSUF3MOVE.L„SDPRCV(A5),A3Otherwise,sendan"RR"commandinstead‰BRA.L…SDLCPR5B ‰PAGE /RECEIEE‚EQU‡*‰RECEIVEEXCESSIVEERRORSOCCURRED‰MOVE.B„#SDDSSRE,SDDSTS+1(A3)‰ADD.W…#1,SDSHCREX(A4) ‰BRA.S…HSKP2 ‰PAGE 'RECEITO‚EQU‡*‰RECEIVETIMEOUTOCCURRED‰MOVE.B„#SDDERTO,SDDERR(A3)‰ADD.W…#1,SDSHCRTP(A4) +RECEIFB‚EQU‡*‰RECEIVEDAFINALBITRESPONSE *RECEILB‚EQU‡*‰RECEIVEDEPLETEDBUFFERPOOL ***ˆENDOFARCVSEQUENCE,SHUTRECEIVEROFF*HSKP2„MOVE.B„#NCW0RG1,NECCTL_B!‰MOVE.B„#NCW1IRD+NCW1STV,NECCTL_B‰MOVE.B„#NCW0RG3,NECCTL_B!‰MOVE.B„#NCW3BT8+NCW3AUE,NECCTL_B‰ADD.W…#1,SDSHCROF(A4)…3/2/83&‰BSR.L…SOMETOCLRCLEARRECEIVETIMEOUT‰MOVE.L„SDSTHD(A4),A3‰MOVE.L„SDPRCV(A5),A2&* A5 = PRIMARY CONTROL BLOCK'S ADDRESS(* A4 = SECONDARY CONTROL BLOCK'S ADDRESS%* A3 = CURRENT TXMIT BUFFER'S ADDRESS#* A2 = CURRENT RCV BUFFER'S ADDRESS * Fall-thru to the next page‰PAGE3* NOTE: WE FALL-THRU TO HERE FROM THE PREVIOUS PAGE **ˆSDLCFRAMECONTROLPROCEDURES*9‰MOVE.B„#SDPBFC,SDPBSY(A5)SETSDLCBUSYINFRAMECONTROL,‰MOVE.W„#$2500,SRLOWER68000INTERRUPTMASK@‰CLR.B…SDSTXF(A4)ASSUMENOT(RNRSENT&GOODRSPRCV'D)2/24/83 %‰IF.B†SDDRSP(A2)#SDDRRIMTHEN.S5‹OR.B†#SDDSRIM,SDDSTS(A2)IFRIM,THENSETRIMSTATUS‰ELSE.S$‹IF.B…SDDRSP(A2)#SDDRDMTHEN.S5OR.B†#SDDSRDM,SDDSTS(A2)IFRDM,THENSETRDMSTATUS‹ELSE.S $IF.B†SDDRSP(A2)#SDDRRDTHEN.S3OR.B†#SDDSRRD,SDDSTS(A2)IFRD,THENSETRDSTATUSENDI‹ENDI‰ENDI.‰MOVE.B„SDDERR(A2),D0Verybaderrorreceived?‰IFˆTHEN.S4‹IF.B†D0#SDDENNRAND.BD0#SDDEIFUTHEN.S-BRA.L…INVRSP„Yes,can'ttellwhatitis,out‹ENDI‰ENDI7‰CLR.B…SDSPWR(A4)No,It'seitherOK,orjustsortabad‰MOVE.B„#SDSCNRM,SDSCST(A4)$‰IF.B†SDPTXF(A5)#SDPTRNTHEN.S<‹MOVE.B„#SDSTRN,SDSTXF(A4)SentRNRorRR,assertgoodreply‰ENDI ‰PAGE+HSKP9„IF.B†SDDRSP(A2)#SDDRFRMRTHEN.SA*ŠSecondariessendFrameRejectforanyofthefollowingreasons;*Œ1-Invalidcommand,?*InDISCorNRMstate,andRcvXIDbutdon'thaveonetosend,/*InNRMstateandRcvan"unknown"command,or6*InFRMRstateandRcvotherthanSIM,DISC,orSNRM,*Œ2-ProhibitedI_field,7*RcvanI_fieldonaSIM,SNRM,DISC,RR,RNR,orREJ,*Œ3-BufferOverrun,<*Rcvanotherwisegoodframewhichislongerthanabuffer,*Œ4-InvalidNrCount,>*RcvanNrcountwhichacknowledgesanframehe'sneversent.2‹OR.B†#SDDSFRM,SDDSTS(A2)SETFRMROCCURREDSTATUS.‹MOVE.L„A2,A1SENDFRMRTOAPPLICATIONPROGRAM‹BSR.L…SOMESEND ‹MOVE.L„A1,A2$‹BSR.L…SOMEFREEFREEALLRCVBUFFERS)‹BRA.L…DCRTXDECREMENTTxMITRETRYCOUNTS‰ENDI‰CLR.L…D0ˆNO,ISRESPONSEUI?‰MOVE.B„SDDRSP(A2),D0‰AND.B…#$EF,D0‰IF.B†D0#SDDCUITHEN.S8‹MOVE.L„A2,A1…SENDRECEIVEBUFFERTOAPPLICATIONPROGRAM‹BSR.L…SOMESEND%‹MOVE.L„A1,A2…ENDOFRECEIVEBUFFERS? ‹MOVE.L„A1,D0 ‹BEQ.L…DSPUI'‹BRA.L…HSKP9…NO,TESTBUFFER'SRESPONSE‰ENDI!‰AND‡#$0F,D0ƒNO,ISRESPONSERNR?‰IF.B†D0#SDDRRNRTHEN.S6‹MOVE.B„#SDSCBSY,SDSCST(A4)YES,SETREMOTEBUSYSTATE ‹BRA.L…DSPNR‰ENDI!‰CMP.B…#SDDRRR,D0ISRESPONSERR?‰BEQ.L…DSPNR…* '‰CMP.B…#SDDRREJ,D0NO,ISRESPONSEREJ?‰BEQ.L…DSPNR…* $‰BTST.L„#$0,D0„NO,ISITANIFIELD?!‰BEQ.L…DSPNR1„YES,CHECKNrCOUNT *‰MOVE.L„A3,D0…NO,ANYTHINGINTxMITQUEUE?‰BEQ.L…DSPRC1„*<‰CMP.B…#SDPTXQ,SDPTXF(A5)DIDWETxMITFROMTHETxMITQUEUE?‰BNE.L…DSPRC1„* ‰PAGE%‰IF.B†SDDCMD(A3)#SDDCSIMTHEN.S$‹IF.B†SDDRSP(A2)#SDDRUATHEN.S)MOVE.B„#SDSCRDM,SDSCST(A4)RDM-->STATECLR.B…SDSVRC(A4)0-->VrCLR.B…SDSVSC(A4)0-->Vs BRA.L…OKRSP‹ELSE.S BRA.L…INVRSP‹ENDI‰ENDI&‰IF.B†SDDCMD(A3)#SDDCSNRMTHEN.S$‹IF.B†SDDRSP(A2)#SDDRUATHEN.S)MOVE.B„#SDSCNRM,SDSCST(A4)NRM-->STATECLR.B…SDSVRC(A4)0-->VrCLR.B…SDSVSC(A4)0-->Vs BRA.L…OKRSP‹ELSE.S BRA.L…INVRSP‹ENDI‰ENDI&‰IF.B†SDDCMD(A3)#SDDCDISCTHEN.S$‹IF.B†SDDRSP(A2)#SDDRUATHEN.S)MOVE.B„#SDSCRDM,SDSCST(A4)RDM-->STATE BRA.L…OKRSP‹ELSE.S BRA.L…INVRSP‹ENDI‰ENDI#‰IF.B†SDDCMD(A3)#SDDCXIDOR.B!“SDDCMD(A3)#SDDCTESTTHEN.S‹MOVE.B„SDDCMD(A3),D0‹IF.B†D0SDDRSP(A2)THEN.S9MOVE.L„A3,A1…Ifresponse=command,discardxmitbuffer,BSR.L…SOMEDISPOSEMOVE.L„A1,SDSTHD(A4).MOVE.L„A2,A1…PasstheresponsetoapplicationBSR.L…SOMESEND MOVE.L„A1,A2BSR.L…SOMEFREE2BRA.L…SDLCRQ„andselectnextstationtotalkwith‹ELSE.S BRA.L…INVRSP‹ENDI‰ENDI0‰BRA.L…DSPUI…AllothersgotoDSPUIforhandling‰PAGE /* May fall-thru to here from the previous page! ADSPNR„TST.W…SDDBCT(A2)DATAFIELDON"RR""RNR"OR"REJ"COMMAND?(‰BNE.L…INVRSP„*IFYES,INVALIDRESPONSE**ˆTESTFORAVALIDNrCOUNT*DSPNR1ƒCLR.L…D0 ‰CLR.L…D1 ‰CLR.L…D2$‰MOVE.B„SDDRSP(A2),D0FETCHNrCOUNT‰LSR.B…#5,D0…*$‰MOVE.B„SDSVSC(A4),D1FETCHVsCOUNT‰LSR.B…#1,D1…*-‰MOVE.B„SDSUKT(A4),D2FETCH#TxMITTEDFRAMES ‰BEQ.S…DSPNR2„*FRAMESTxMITTED?9‰CMP.L…#0,A3…XMITI_FRMSGONEJUSTAFTERAPURGE?3/21/836‰BEQ.S…DSPNR2„YES,SAMEASIFNOI_FRAMESSENT3/21/833‰BTST.B„#0,SDDCMD(A3)NO,"I"FRAMEONTxMITQUEUE? ‰BNE.S…DSPNR2/‰MOVE.B„SDDCMD(A3),D1YES,GETNsCOUNTFROMIT ‰LSR.B…#1,D1 ‰ADD.B…D2,D1 ‰AND.B…#7,D1DSPNR2ƒWHILE.BƒD0D1DO.S‹SUB.B…#1,D1…NEXTVsCOUNT ‹AND.B…#7,D1 #‹SUB.B…#1,D2…ALLVsCOUNTSCHECKED?#‹BMI.L…INVRSP„YES,INVALIDNrCOUNT‰ENDW* Fall-thru to the next page‰PAGE3* NOTE: WE FALL-THRU TO HERE FROM THE PREVIOUS PAGE *"*ˆDISPOSEOFTXMITBUFFERSTONR-1*&‰CLR.L…D1‰FETCHNrCOUNTFROMRESPONSE‰MOVE.B„SDDRSP(A2),D1 ‰LSR.B…#4,D1‰AND.B…#$0E,D1‰MOVE.B„D1,SDSVSC(A4)Vs=Nr&‰MOVE.L„A3,D0…ANYTHINGINTxMITQUEUE? ‰BEQ.L…DSPRC1'DSPNR3A‚CLR.L…D0ˆTXMITTEDAUICOMMAND?‰MOVE.B„SDDCMD(A3),D0‰AND.B…#$EF,D0‰IF.B†D0#SDDCUITHEN.S‹BTST.L„#0,D0…IFIELD? ‹BNE.L…DCRTX8‹TST.B…SDSUKT(A4)YES,UNACKNOWLEDGEDIFRAMESTxMITTED? ‹BEQ.L…DSPRC1‹AND.B…#$0E,D0ƒYES,Nr=Ns? ‹CMP.B…D1,D0‹IF.B†D1D0THEN.S8MOVE.B„SDDRSP(A2),D0Nr=Ns,ISRESPONSERR,RNR,REJ?AND.B…#$03,D0 CMP.B…#1,D0 BNE.S…DSPUI,MOVE.L„A2,A1…YES,DISPOSEOFRECEIVEBUFFERBSR.L…SOMEDISPOSE%MOVE.L„A1,A2…ENDOFRECEIVEBUFFERS? MOVE.L„A1,D0,BNE.L…HSKP9…No,goseewhatthenextoneis>CMP.B…#SDPTXQ,SDPTXF(A5)Yes,didwesendfromthexmtqueue?'BNE.L…DSPRC1„No,gofinishcleaningup6BRA.S…DSPUI…Yes,discardanytransmitted"UI"buffers‹ENDI‰ENDI/‰MOVE.L„A3,A1…Nr<>Ns,DISPOSEOFTxMITBUFFER‰BTST.B„#4,SDDCMD(A3)‰IFˆTHEN.S.‹BSR.L…SOMEDISPOSEYES,DISPOSEOFRCVBUFFERS ‹MOVE.L„A1,A34‹CLR.B…SDSUKT(A4)CLEARUNACKNOWLEDGEDIFRAMECOUNT ‹BRA.L…DSPRC1‰ELSE.S‹BSR.L…SOMEDISPOSE ‹MOVE.L„A1,A3‹SUB.B…#1,SDSUKT(A4)‹BRA.S…DSPNR3A‰ENDI ‰PAGE*"*ˆANINVALIDRESPONSEWASRECEIVED*DINVRSPƒMOVE.B„#$FF,SDSPWR(A4)„LET'SASSUMETHEDEVICEISPOWEREDOFF**ˆDISPOSEOFUITXMITBUFFERS*&DSPUI„MOVE.L„A3,D0…ENDOFTxMITQUEUE?‰BEQ.L…DSPRC1„Yes,out ‰CLR.L…D1ˆNo,‰MOVE.B„SDDCMD(A3),D1‰AND.B…#$EF,D1+‰CMP.B…#SDDCUI,D1DidwesendaUIcommand? ‰BNE.S…DCRTX*‰MOVE.L„A3,A1…YES,DISPOSEOFTXMITBUFFER)‰BTST.B„#4,SDDCMD(A3)Poll/finalbitset?‰IFˆTHEN.S‹BSR.L…SOMEDISPOSENo ‹MOVE.L„A1,A3 ‹BRA.S…DSPUI‰ENDI7‰BSR.L…SOMEDISPOSEYes,alsodisposeofreceivebuffers ‰MOVE.L„A1,A3 ‰BRA.S…DSPRC1 ‰PAGE**ˆDECREMENTTxMITRETRYCOUNTS*DCRTX„MOVE.L„A3,A1…*‰MOVE.B„SDSUKT(A4),D1**DCRTX2ƒCMP.L…#0,A3…ALLTxMITBUFFERSGONE? ‰BEQ.S…DCRTX5"‰BTST.B„#0,SDDCMD(A3)NO,IFIELD?‰IFˆTHEN.S*‹TST.B…D1ˆYES,UNACKNOWLEDGEDCOUNTCLEAR? ‹BEQ.S…DCRTX5‹SUB.B…#1,D1…YES,DECREMENTIT‰ENDI7‰TST.B…SDDRTC(A3)NO,DECREMENTRETRYCOUNTIFNON-ZERO ‰BEQ.S…DCRTX4*‰SUB.B…#1,SDDRTC(A3)DECREMENTRETRYCOUNT‰BNE.S…DCRTX4„EXPIRED??‰MOVE.L„A3,A1…YES,SENDTHISTxMITBUFFERTOAPPLPGMASUNSENT>‰MOVE.B„#SDDSSTE,SDDSTS+1(A3)‚SETRETRYCOUNTEREXPIREDSTATUS$‰BTST.B„#$4,SDDCMD(A3)‚POLLBITSET?‰IFˆTHEN.S&‹BSR.L…SOMESENDYES,LASTTXMITBUFFER4‹CLR.B…SDSUKT(A4)CLEARUNACKNOWLEDGEDIFRAMECOUNT ‹BRA.S…DCRTX5‰ENDI"‰BTST.B„#0,SDDCMD(A3)NO,IFIELD?‰IFˆTHEN.S2‹SUB.B…#1,SDSUKT(A4)YES,FIXUNACKNOWLEDGEDCOUNT‰ENDI‰BSR.L…SOMESEND%‰MOVE.L„A1,A3FETCHNEXTTxMITBUFFER ‰BRA.S…DCRTX2 )DCRTX4ƒCLR.B…SDDERR(A3)CLEARERRORFIELD$‰BTST.B„#$4,SDDCMD(A3)POLLBITSET? ‰BNE.S…DCRTX5-‰MOVE.L„SDDLNK(A3),A3FETCHNEXTTxMITBUFFER ‰BRA.S…DCRTX2 +DCRTX5ƒMOVE.L„A1,A3ƒNEWHEADOFTxMITQUEUE*ˆBRA.S…DSPRC1„FALL-THRU ‰PAGE:* WARNING: WE MAY FALL-THRU TO HERE FROM THE PREVIOUS PAGE**ˆDISPOSEOFRCVBUFFERS*3DSPRC1ƒMOVE.L„A3,SDSTHD(A4)NEWHEADOFTxMITQUEUE.‰MOVE.L„A2,D0…ALLRECEIVEBUFFERSDISPOSEDOF?‰BEQ.L…SDLCRQ„*‰MOVE.B„SDDERR(A2),D0‰IFˆTHEN.S4‹IF.B†D0#SDDENNRAND.BD0#SDDEIFUTHEN.S?MOVE.B„#$FF,SDSPWR(A4)Baderror,assumestationisturnedoff‹ENDI)‹TST.B…SDDSTS+1(A2)REPORTERRORTOUSER?‹BNE.S…DSPRC3„Yes,gotellhim+‹BRA.S…DSPRC5„NO,JUSTFREETHERCVBUFFERS‰ENDIC‰MOVE.B„SDDRSP(A2),D0ISRESPONSEFRMR,RD,DM,RIM,UIORIFIELD?‰AND.B…#$EF,D0ƒ*‰CMP.B…#SDDCUI,D0*‰BEQ.S…DSPRC3„*‰CMP.B…#SDDRRD,SDDRSP(A2)*‰BEQ.S…DSPRC3„*‰CMP.B…#SDDRDM,SDDRSP(A2)*‰BEQ.S…DSPRC3„*‰CMP.B…#SDDRRIM,SDDRSP(A2) ‰BEQ.S…DSPRC3‰CMP.B…#SDDRFRMR,SDDRSP(A2)  ‰BEQ.S…DSPRC3 ‰BTST.L„#0,D0 ‰BNE.S…DSPRC5CDSPRC3ƒMOVE.L„A2,A1…YES,SENDRECEIVEBUFFERTOAPPLICATIONPROGRAM$‰BTST.B„#4,SDDRSP(A2)‚Finalbitset?‰IFˆTHEN.S‹BSR.L…SOMESEND‚NO ‹MOVE.L„A1,A2 ‹BRA.S…DSPRC1‰ENDI3‰BSR.L…SOMESEND‚YES,ALSOFREEALLRCVBUFFERSLEFT ‰MOVE.L„A1,A2*DSPRC5ƒBSR.L…SOMEFREE‚FREEALLRCVBUFFERS0‰BRA.S…SDLCRQ„SELECTNEXTSDLCSECONDARYSTATION ‰PAGE*(*ˆTHERESPONSEWASVALIDFORTHECOMMAND**OKRSP„MOVE.L„A3,A1…DISPOSEOFTXMITBUFFER‰BSR.L…SOMEDISPOSE*‰MOVE.L„A1,SDSTHD(A4)*‰BSR.L…SOMEFREE*=*ˆBRA.S…SDLCRQ„Fallthruandselectnextstationtotalkwith ‰PAGE8* Warning: May fall-thru to here from the previous page!*#*ˆSETTHESTATION'SPOLLDELAYTIME*%SDLCRQƒIF.B†SDSPWR(A4)#0THEN.S‹IF.L‡SDSTHD(A4)#0THEN.S#0THEN.S?MOVE.W„SDSTPF(A4),SDSCTD(A4)Down,notfc,usePowerOffDelay‹ELSE.S:MOVE.W„SDSTRT(A4),SDSCTD(A4)Down,tfc,useRe-XmitDelay‹ENDI‰ENDI+‰MOVE.L„A4,A0…SELECTNEXTSECONDARYSTATION‰BRA.L…SDLCSN1 .**********************************************/* END OF FILE 'FIX:48.SDLCPRI.FRMCNT.AI' *.**********************************************éé‰PAGE6******************************************************6* BEGINNING OF FILE 'FIX:48.SDLCPRI.INT7201.AI' *6****************************************************** INTRSRG‚MACROD‰MOVEM.Lƒ(A7)+,A1-A2/D0RestoreRegistersUsedbyInterruptHandlers‰ENDM INTSVRG‚MACROA‰MOVEM.LƒA1-A2/D0,-(A7)SaveRegistersUsedbyInterruptHandlers‰ENDM H*************************************************************************Æ*9*ˆSUBROUTINE:‚"SBSDLCFL"‚FLUSH(PURGE)ATRANSMITQUEUE‡**ˆTRAP:ˆ"SDLCFL"©*.*ˆENTER:‚D1.B=SDLCSTATIONNUMBERTOFLUSH“**ˆRETURN:CCR³**‘ZsetBUFFERSWEREFLUSHED›*%*‘NsetILLEGALSDLCSTATIONNUMBER”*#*ˆREGISTERSUSED:ƒ01234567**˜DƒP©* *˜AUU‹S**œ|‹|_stack–**œ|_____________used—**Æ*H************************************************************************ SBSDLCFL RTS2RTE5SDLCFLƒBSR.L…FINDSCBƒFindtheSecondaryControlBlock‰IFˆTHEN.L?‹ANDI.B„#$F7,1(A7)ReturnNegativeClear(Legalstationnumber)0‹ORI.B…#$04,1(A7)AndZeroSet(BuffersFlushed)+‹ORI.W…#$700,SRSCBFound,MASKINTERRUPTS!(‹ADD.W…#1,SDSHCFLS(A1)Counttheflushes/‹MOVE.L„SDSTHD(A1),A0Findhistransmitbuffers)‹MOVE.L„A2,-(A7)ProtectA2whiletracing‹BSR.L…GETRACEGetatracerow‹IFˆTHEN.SE**********************************************************************TraceEntryFormat°*E**********************************************************************Ã*#*‚+0Ž+4Ž+8‚+9‚+10…+12+13+14+15‚*E* +---------------+---------------+---+---+-------+---+---+---+---+ *6*!†PC‡!A(1stBuffer)!#!S!ƒ0ƒ!C!R!D0!D1!*E* +---------------+---------------+---+---+-------+---+---+---+---+ **Ã**PC=ProgramCounter,­*A*A(1stBuffer)=Addressofthefirstbufferbeingflushed,or…*1*‘Zerowhennobuffer(s)is(are)beingflushed,…**#=Station'sNumber,­* *S=Station'sCurrentState,¦**0=Unused,·*7*C=WhenA(1stBuffer)<>0,Buffer'sCommandByte,* €7‰8‘ ™0¡1©8*R=WhenA(1stBuffer)<>0,Buffer'sResponseByte,Ž*9*D0=WhenA(1stBuffer)<>0,Buffer's1stDataByte,*9*D1=WhenA(1stBuffer)<>0,Buffer's2ndDataByte.**Ã*E*********************************************************************PEA‡*(PC)Ifwegetone,then)MOVE.L„(A7)+,0(A2)traceourPCaddress,MOVE.L„A0,4(A2)A(1stBuffer),)MOVE.B„SDSSEC(A1),8(A2)Stationaddress,9MOVE.B„SDSCST(A1),9(A2)Hiscurrentstate(asinIOWA?),&CLR.W…10(A2)(Zerofillunusedbytes)IF.L†#0A0THEN.S/MOVE.B„SDDCMD(A0),12(A2)1stBuffer'sCommand,#MOVE.B„SDDRSP(A0),13(A2)Response,#MOVE.B„SDDDAT+0(A0),14(A2)andtwo.MOVE.B„SDDDAT+1(A0),15(A2)......databytesELSE.S-CLR.L…12(A2)Butifnobuffers,storezeroesENDI‹ENDI)‹MOVE.L„(A7)+,A2RecoverA2aftertracing‹IF.L†#0A0THEN.S-CLR.L…SDSTHD(A1)Makeallbuffersdisappear,.BSR.L…SBPTFRML‚(returnthemtothefreepool)‹ENDI'‹MOVE.L„A1,A0…A0=A(SCBbeingflushed)‹MOVE.L„SDLCPCB,A1A1=A(PCB)?‹IF.B†#SDPBTXSDPBSY(A1)AND.LA0SDPRRTA4(A1)THEN.S$IF.B†#SDPTXQSDPTXF(A1)THEN.S;MOVE.B„#NCW0SAB,NECCTL_BXmt'goneoftheflushedbuffers,'MOVE.B„#NCW0RG1,NECCTL_BAbortit,and6MOVE.B„#NCW1IRD+NCW1STV,NECCTL_Bturnoffeverything!MOVEM.LƒA0-A6/D0-D2,-(A7)MOVE.L„SDLCPCB,A64MOVEM.LƒSDPRRTA0(A6),A0-A6Restoredriver'scontextADD.W…#1,SDSHCTOF(A4)MOVE.L„SDPRCV(A5),A2,BSR.L…SOMEFREE†ReleaseRcvBfrtofreepoolLEA‡0,A2ŠNoRcv"MOVE.L„A2,A3‰......orXmtBuffer0MOVE.B„#$FF,SDSPWR(A4)andmarkstationasDOWN$BRA.L…SDLCRQˆNowgoresetitstimerENDI‹ENDI‰ELSE.S?‹ANDI.B„#$FB,1(A7)ReturnZeroClear(Bufferswerenotflushed);‹ORI.B…#$08,1(A7)AndNegativeSet(Illegalstationnumber)‰ENDI‰RTE‘(UN-MASKSINTERRUPTS) ‰PAGE!* OVERVIEW OF INTERRUPT VECTORING -* SIGNIFICANT CONTROL BLOCK AND AREA SETTINGS M* 1) The low-memory (0..3FF) interrupt vector which the NEC7201 uses contains)*„theaddressoftheINT7201routine,andO* 2) The SDLC Primary Control Block (PCB) contains eight vectors, four for eachI*„sideoftheNEC7201.‚B-sidevectors(0..3)inthePCBaremaintainedbyI*„theSDLCdriver.‚A-sidevectors(4..7)areallthesamehowever,eitherE*„pointingtoINT7201AortoPORTAIO.‚INT7201AisusedwhennoA-sideB*„driverexists,PORTAIOisusedwhenanA-sidedriverispresent. * NEC7201 INTERRUPT VECTOR NOTES J* When no interrupt is pending in the NEC7201, the interrupt vector numberM*register(2B)"rests"atvector7.‚Notethatvector7isforA-sideSpecialM*ReceiveConditionInterrupts.‚Thedifferencebetweena"resting"and"real"L* interrupt vector in register 2B is indicated in the A-side register 0, bitJ*number1:‚Wherethisbitisset(1),aninterruptispending.‚WherethisO* bit is clear (0), no interrupt was pending, and the interrupt vector "rests".H* (Note that register 2B must be read before the pending bit is tested.) * INTERRUPT PROCESSING SEQUENCE L* When something interrupts using the low-memory interrupt vector designatedL*astheNEC7201svector,theMPUvectorstotheINT7201routine.‚There,theO* 7201's internal interrupt vector number is read from register 2B, and controlM* is passed via the corresponding vector in the SDLC PCB (note that vector #7@* will be used when the 7201 does not have a pending interrupt).O* Where a B-side interrupt was present (vector 0..3), we go to an SDLC routine.K* Where an A-side vector (4..7) was presented, we go to INT7201 or PORTAIO.J* For A-side interrupts, if no A-side driver has overwritten vectors 4..7,G* we go to INT7201A and acknowledge the interrupt, making it "go away".L* If an A-side driver exists, we go to PORTAIO w hich checks the pending flagL* in the 7201's A-side register 0, and thereby determines whether or not the* 7201 has a pending interrupt.N* Where a pending interrupt exists (must be an A-side interrupt), PORTAIO usesM* two SDLC PCB pointers to store the interrupt vector number as read from theN* 7201 (PORTAIO will right justify the vector in some cases), and then to jumpL*tosomeotheraddress.‚(TheA-sidedriverhasstoredthesetwoaddresses.)O* Where no pending interrupt exists (i.e., the interrupt vector number read wasO* 4..7 [should have been #7, by the way], and the interrupt pending flag in theN* 7201's register 0 on the A-side was clear), the PORTAIO routine "assumes" anO* External Status change interrupt for the B-side (SDLC), and forces processing?* to the current SDLC External Status interrupt handling state.L*This"assumed"ExternalStatusinterruptisquestionable.‚Aswedon'tknowM* who interrupted (it is not the NEC7201), it is unclear what to do about it.‰PAGEH*************************************************************************Æ*9*ˆI.S.R.:‚"INT7201"‚NEC7201InterruptServiceRoutine‡**Æ*#*REGISTERSUSED:ƒ01234567¤**‘D´**‘AS¤* *¡|__stackœ**Æ*<*ˆVectorsthroughPrimaryControlBlock'sIndirectVectors†*6*ˆOffsetbyNEC7201'sStatusAffectsVectorRegisterŒ**Æ*3*ˆSavesRegistersD0.L,A1.L,&A2.LontheStack*+*˜A1.L=AddressofPrimaryControlBlock‡**Æ*H************************************************************************ "INT7201‚INTSVRG—SAVEREGSONSTACK,‰CLR.W…D0’ReadtheNEC7201'sVectorRegister‰MOVE.B„#NCW0RG2,NECCTL_B‰MOVE.B„NECCTL_B,D01‰MOVE.L„SDLCPCB,A1Š(A1=A(PrimaryControlBlock)0*ˆBTST†#0,TRACFLAG+1‡Shouldinterruptbetraced?*ˆIFˆTHEN.S!*ŠBSR‡DLTRACETracetheinterrupt*ˆENDIB‰MOVE.L„SDPVCT(A1,D0.W),A2‚FindoutWhereToGoforthisInterrupt‰JMP‡(A2)AndGoThere! ‰PAGE I**************************************************************************Ç*'*ˆINT7201A-A-SideInterruptHandlerœ**Ç*H*AnA-SideInterrupthasoccurred,orsomethingotherthananNEC7201‚*I* interrupt has brought us here (in which case the NEC7201 has given us *F*vector#7).‚Eitherway,wedon'twantthenastylittlesucker.‚So,‚*H*iftheNEC7201reallydidcausetheinterrupt,weacknowledgeitand‚*H*therebymaketheinterruptgoaway.‚Otherwise,wesimplyexitinthe*G*hopethatwhateverbroughtusherewon'tdoitagain(aswehavenoƒ*F*ideawhatweshoulddoaboutitsincewedon'tknowwhat"it"is)!„**Ç*I************************************************************************* @INT7201ABTST.B„#1,NECCTL_A‰Isaninterruptpendinginthe7201?1‰IFˆTHEN.S‰Yes,seewhatflavorofinterrupt9‹IF.W†D0#16THEN.SOnTransmitterEmptyInterrupts,;MOVE.B„#NCW0RTI,NECCTL_AƒResetTransmitterEmptyInterrupt‹ELSE.S7IF.W†D0#20THEN.SOnExternalStatusInterrupts,9MOVE.B„#NCW0REX,NECCTL_AƒResetExternalStatusInterruptELSE.S8IF.W†D0#24THEN.SOnReceiveCharacterInterrupts/‘TST.B…NECDAT_AŒReadtheChar(ClearstheIntr)ELSE.S5*Otherwise,onSpecialReceiveConditionInterrupts,7‘MOVE.B„#NCW0ERR,NECCTL_AƒResetError(ClearstheIntr)ENDIENDI‹ENDI?‹MOVE.B„#NCW0EOI,NECCTL_AƒWhatever,maketheinterruptgoaway!‰ENDI4*ˆBRA.S…INTEXITAndgoexitfromhandlinginterrupts)* Fall-thru to the Interrupt Exit Routine APWR†EQU‡INT7201A‚OnPowerUp,ResetAnyPendingA-SideInterrupts ‰PAGE H*************************************************************************Æ*.*ˆ"INTEXIT"-NEC7201InterruptExitRoutine”**Æ*:*ˆNOTE:Allinterrupthandlingproceduresmustcomehereˆ**ˆuponcompletion.®**Æ*:*ˆChecksfor"another"pendinginterruptintheNEC7201.ˆ*:*ˆIfpresent,wevectorthruthePrimaryControlBlock'sˆ*?*ˆIndirectVectorasindicatedbythe7201'sVectorRegister.ƒ*>*ˆIfno"other"interruptispending ,registersarerestored„*?*ˆfromthestack,andanRTEisexecutedtherebyreturningtoƒ**ˆtheinterruptedprocess.¦**Æ*;*ˆAssumesRegistersD0.L,A1.L,&A2.LstillontheStack‡**Æ*H************************************************************************ ?* Warning: We may "fall-thru" to here from the preceeding page. INTEXIT‚CLR.W…D0‰MOVE.B„#NCW0RG2,NECCTL_B9‰MOVE.B„NECCTL_B,D0‰Readthe7201'sVectorRegister,then9‰BTST.B„#1,NECCTL_A‰IfInterruptPendingFlagIsNowSet,4‰IFˆTHEN.S‰Then"another"InterruptisPresent.8‹MOVE.L„SDLCPCB,A1ŠSo,SetA1=A(PrimaryControlBlock)0*ŠBTST†#0,TRACFLAG+1‡Shouldinterruptbetraced?*ŠIFˆTHEN.S!*ŒBSR‡DLTRACETracetheinterrupt*ŠENDI:‹MOVE.L„SDPVCT(A1,D0.W),A2‚Regardless,Fetch"WhereToGo")‹JMP‡(A2)AndGoHandlethenewInterrupt-‰ENDIšButifno"other"Interruptispresent,#‰INTRSRG—ThenRestoretheRegisters'‰RTE›AndResumetheInterruptedProcess 0************************************************0* END OF FILE 'FIX:48.SDLCPRI.INT7201.AI' *0************************************************éééé4****************************************************4* BEGINNING OF FILE 'FIX:48.SDLCPRI.POLLQ.AI' *4**************************************************** SDLRSRG‚MACRO2‰MOVEM.Lƒ(A7)+,A0-A6/D0-D2RESTORESAVEDREGISTERS‰ENDM SDLSVRG‚MACRO‰MOVEM.LƒA0-A6/D0-D2,-(A7)*‰ENDM ‰SECTIONƒ9‰PAGEH*************************************************************************Æ*D*SUBROUTINE:‚"PWRUP"INITIALIZETHENEC7201CHIPATPOWERUPTIME„**Æ*+*ENTER:‚A4.L=ADDRESSOFSDLC'SSEGMENT**Æ*#*REGISTERSUSED:ƒ01234567¤* *‘DUU°**‘AUUUƒP…S¤* *¡|__stackœ**Æ*H************************************************************************ ‰NEXTWB,PWRUP„MOVE.B„#NCW0RCN,NECCTL_BƒCHANNELRESET‰MOVE.B„#NCW0RG2,NECCTL_A)‰MOVE.B„#NCW2RTS+NCW2PRI+NCW2BIN,NECCTL_A*‰MOVE.B„#NCW0RG2,NECCTL_BƒINTERRUPTVECTOR‰MOVE.B„#0,NECCTL_B‰MOVE.B„#NCW0RG4,NECCTL_BƒMODE)‰MOVE.B„#NCW4C01+NCW4SDL+NCW4SME,NECCTL_B#‰MOVE.B„#NCW0RG7,NECCTL_BƒSDLCFLAG‰MOVE.B„#SDLCFLAG,NECCTL_B3‰MOVE.B„#NCW0RG3,NECCTL_BƒENABLEAUTOENABLEOFCTS!‰MOVE.B„#NCW3BT8+NCW3AUE,NECCTL_B‰IFEQ†RES7201-400‹MOVE.W„SR,-(A7)!‹ORI.W…#$0700,SRŠMaskInterrupts!5‹MOVE.L„#MVME400,A0ˆA0=AddressoftheMVME400board'‹BCLR.B„#REGSELEC,CTLPIA_A(A0)SetDDRAA‹MOVE.B„#WRT_LED+WRT_SEL,DATPIA_A(A0)tooutputmid-twobitsonly:‹BSET.B„#REGSELEC,CTLPIA_A(A0)SwitchnowtoDataRegonA=‹BSET.B„#WRT_SEL,DATPIA_A(A0)SelectbaudratejumpersPort2(‹MOVE.B„DATPIA_A(A0),D0andreadthemin6‹ANDI.W„#$07,D0‹AND'ingoffallbutthebaudratebitsB‹MOVE.B„V400BAUD(PC,D0.W),D0andgetthe4-bitcorrespondingvalue3‹MOVE.B„D0,-(A7)Šsavingitonthestacktemporarily,‹BCLR.B„#REGSELEC,CTLPIA_B(A0)Now,setDDRB2‹MOVE.B„#%11111111,DATPIA_B(A0)toall bitsoutput:‹BSET.B„#REGSELEC,CTLPIA_B(A0)SwitchnowtoDataRegonB;‹MOVE.B„DATPIA_B(A0),D0andreadthecurrent4-bitsettings.‹ANDI.B„#RATE1MSK,D0dropoutPort2'ssetting;‹OR.B†(A7)+,D0andORinthenewvaluewefiguredoutabove±8ºKÂIÊ0Ò;Ú-B‹MOVE.B„D0,DATPIA_B(A0)andoutputthenewrate(Port1unchanged)#‹MOVE.W„(A7)+,SRŠUnmaskInterrupts!‰ENDC,‰LEA‡SDLCPR(PC),A0†FETCHADDRESSOF"SDLCPR"‰MOVE.L„#TIMCNST,A1'‰MOVE.W„#$4005,D1INTERRUPTLEVEL->D1‰MOVE.L„#DLC1,D2ŒI.D.#->D2‰IFEQ†CHIPTYPE-68000 ‹TR0.RQPA‰ENDC‰IFNE†CHIPTYPE-68000 ‹TR0$.RQPA‰ENDC3‰RTS‘RETURN(MUSTBEA2BYTEINSTRUCTION!)‚2/24/831‰ILLEGALDIEIFSBRQPARETURNSANYERROR!ˆ2/24/83 ‰IFEQ†RES7201-400"V400BAUDƒDC.B†15,14,13,12,10,7,5,2‰ENDC *3*„ThisisadummyroutinetosatisfyXREFinBUFMGT*‰XDEF†SDLCQXMT SDLCQXMT RTS‰PAGEH*************************************************************************Æ*9*ˆTRAP:‚"SDLCRCST"THISROUTINEISA"DUMMY"TOPROVIDEˆ*'*šCOMPATABILITYFORBUFFERMANAGEMENT‰**ˆSUBROUTINE:‚"SBSDLCRCST"¥**Æ*#*REGISTERSUSED:ƒ01234567¤**‘D´**‘AS¤* *¡|__stackœ**Æ*H************************************************************************ =SDLCRCSTBSR.S…SBSDLCRCSTTRAPENTRYPOINT,DOTHESUBROUTINE+‰MOVE.W„SR,0(A7)‚REPLACETHECONDITIONCODE"‰RTE‘SOWEGIVEPROPERRETURNCODE +SBSDLCRCSTILLEGAL‹Die,shouldnotbeused!‰PAGEH*************************************************************************Æ*0*ˆTRAP:‚"USRACK"ƒTRAPSERVICEROUTINEFORSDLC**ˆSUBROUTINE:‚"SBUSRACK"§**Æ*#*REGISTERSUSED:ƒ01234567¤**‘D´**‘AS¤* *¡|__stackœ**Æ*H************************************************************************ 9USRACKƒBSR.S…SBUSRACK‚TRAPENTRYPOINT,DOTHESUBROUTINE+‰MOVE.W„SR,0(A7)‚REPLACETHECONDITIONCODE"‰RTE‘SOWEGIVEPROPERRETURNCODE )SBUSRACKILLEGALDie,shouldnotbeused!‰PAGEH*************************************************************************Æ*0*ˆTRAP:‚"SDLCKL"ƒTRAPSERVICEROUTINEFORSDLC*&*šTHISROUTINEEFFECTIVELYKILLSTHEŠ*.*šSDLCLINKANDCANCELSPERIODICACTIVATIONS‚**ˆSUBROUTINE:‚"SBSDLCKL"§**Æ*#*REGISTERSUSED:ƒ01234567¤* *‘DƒUU®**‘AS¤* *¡|__stackœ**Æ*H************************************************************************ 9SDLCKLƒBSR.S…SBSDLCKL‚TRAPENTRYPOINT,DOTHESUBROUTINE+‰MOVE.W„SR,0(A7)‚REPLACETHECONDITIONCODE&‰RTE‘SOWEGIVETHEPROPERRETURNCODE @SBSDLCKLMOVE.B„#NCW0RCN,NECCTL_BCHANNELRESETTHENEC7201CHIP2‰MOVE.W„#$8005,D1DISCONTINUEPERIODICACTIVATIONS‰MOVE.L„#DLC1,D2‚*‰IFEQ†CHIPTYPE-68000 ‹TR0.RQPA‰ENDC‰IFNE†CHIPTYPE-68000 ‹TR0$.RQPA‰ENDC.‰RTS‘OK,RETURN(MUSTBEA2BYTEINSTRUCTION)1‰ILLEGALDIEIFSBRQPARETURNSANYERROR!ˆ2/24/83‰PAGEH*************************************************************************Æ*0*ˆTRAP:‚"SDLCQU"‚TRAPSERVICEROUTINEFORSDLC*+*™THISROUTINECHECKSTRANSMITQUEUESFOR†*0*™DATATOTRANSMITBETWEENPERIODICACTIVATIONS**ˆSUBROUTINE:‚"SDLCQUSB"§**Æ**Æ*#*REGISTERSUSED:ƒ01234567¤**‘D´**‘AS¤* *¡|__stackœ**Æ*H************************************************************************ SDLCQUSB RTS2RTESDLCQUƒSDLSVRG‰MOVE.L„SDLCPCB,A5‰ADD.W…#1,SDPHCQUS(A5) ‰MOVE.W„SR,D0%‰AND.W…#$0700,D0‹ATLEASTATLEVEL5?‰IF.W†D0#$0500THEN.S ‹MOVE.W„SR,D0‹AND.W…#$F8FF,D0‹No,-‹OR.W†#$0500,D0‹assertwearenowatlevel5!.‹MOVE.W„D0,SR(oldSRandintrlevelonstack)‰ENDI‰BRA.S…SDLCPR3‰PAGEH*************************************************************************Æ*4*ˆTRAP:‚"SDLCTTMOUT"‚TRAPSERVICEROUTINEFORSDLCŒ*,*THISROUTINEISENTEREDWHENTHERECEIVE**TIMEOUTEXPIRESš**ˆSUBROUTINE:‚"SDLCTMO UT"¦**Æ**Æ*#*REGISTERSUSED:ƒ01234567¤**‘D´**‘AS¤* *¡|__stackœ**Æ*H************************************************************************ SDLCTMOUT‚RTS2RTE%SDLCTTMOUTSDLSVRGSAVEALLUSERREGS+‰MOVE.L„SDLCPCB,A6RESTOREREGSFROMP.C.B.‰MOVEM.LƒSDPRRTA0(A6),A0-A6‰ADD.W…#1,SDSHCRTO(A4)…3/2/83‰BRA.L…RECEITOƒRECEIVETIMEOUT ‰PAGE H*************************************************************************Æ*>*ˆTRAP:‚"SDLCPR"‚TRAPROUTINEWHICHISENTEREDWHENPERIODIC‚**™TIMERRUNSDOWNž**ˆSUBROUTINE:‚"SDLCPRSB"§**Æ*0*ˆENTER:‚D0.L=#INTERVALSWHICHHAVEELAPSED‘**D1.L=ACTIVATIONI.D. **Æ*C*WARNING:‚THISSECTIONOFCODERUNSATINTERRUPTLEVELFIVE(5).…*C*HOWEVER,WHENWEENTERHEREAFTERCOMPLETINGATRANSACTIONWITH†*F*ASECONDARYSTATION,WEAREAT"FUNNYLEVEL5"-I.E.,WESUFFEREDƒ*E*ALEVELSIX(6)INTERRUPT,HANDLEDIT,ANDTHENLOWEREDTHELEVEL„*E*TOFIVE.‚ASARESULT,WEMAYHAVEINTERRUPTEDOURSELVES.‚FORTHIS‚*G*REASON,THEVARIABLE"SDPBSY"ISUSEDTOALLOWACCESSTOTHE"START‚*D*NEWWORK"PORTIONSOFTHISIMPLEMENTATION.‚WHENTHISVARIABLEIS„*E*SETTO"NOTBUSY",THENANDONLYTHENCANWELOOKFORNEWWORKTO„*G*BEINITIATED.‚WHENWEARENOT"NOTBUSY"(I.E.,WEAREBUSYSENDING*E*ORRECEIVING,ORWHATEVER)WECANONLYDECREMENTTHETIMERVALUES„*F*INTHESECONDARYCONTROLBLOCKS,ANDNOMORE.‚LASTLY,BECAUSEEVEN‚*D*THISCOULDBE"INTERRUPTED"BYOURSELVES,WEMUSTHANDLEATIMER…*G*VALUEWHICHGOESTOLESSTHANZERO(I.E.,WECOMMITTEDTODECREMENT‚*H* A TIMER, WERE INTERRUPTED AND ZEROED THAT COUNTER, AND THEN RETURNED *2*TOSUBTRACTONE,LEAVINGTHATCOUNTNEGATIVE).—**Æ**EDSKINNER,MARCH2,1983¬**Æ*H************************************************************************ SDLCPRSB RTS2RTESDLCPRƒSDLSVRG‰MOVE.L„#0,A1…SETUPREGISTERS‰MOVE.L„SDLCPCB,A5*‰MOVE.L„SDPFSEC(A5),A0†**<*ˆDECREMENTTHECURRENTTIMEDELAYOFALLSECONDARYSTATIONS$*‰ANDSELECTTHE1STONETHAT'SZERO* ‰WHILE.BƒSDSSEC(A0)#0DO.S‹IF.W†SDSCTD(A0)#0THEN.S2SUB.W…D0,SDSCTD(A0)Timer:=Timer-Elapsed_Time‹ENDI<‹ADD.L…#SDSLNG,A0ThuslyupdateALLSecondaryControlBlocks‰ENDW* Fall-thru to the next page‰PAGE:* NOTE: MAY BE FALLING-THRU TO HERE FROM THE PREVIOUS PAGE F* NOTE: ENTER HERE FROM SDLCQUSB - SOMEONE HAS ENQUEUED AN XMIT BUFFER FSDLCPR3‚MOVE.L„SDPFSEC(A5),A0AreweNOT"NOTBUSY"(ie,arewebusy?)$‰IF.B†SDPBSY(A5)#SDPBNBTHEN.S‹SDLRSRGYes,exit‹RTE‰ENDI‰PAGE*1*ˆSELECTTHE1STSCBWHOSETIMEDELAYISNOWZERO*?SDLCSLƒWHILE.BƒSDSSEC(A0)#0AND.WSDSCTD(A0)#0DO.S,SDLCSN1„ADD.L…#SDSLNG,A0AdvancetonextSCB‰ENDW‰IF.B†SDSSEC(A0)#0THEN.S<‹MOVE.B„#SDPBNB,SDPBSY(A5)Endoflist,setSDLCtoNOTBUSY‹SDLRSRGAndexit‹RTE‰ENDI‰MOVE.L„A0,A4…A4=A(SCB)(‰MOVE.B„#SDPBFC,SDPBSY(A5)setSDLCBUSY* Fall-Thru to next page‰PAGE7* WARNING: MAY FALL-THRU TO HERE FROM THE PREVIOUS PAGE*0* A4 = CURRENT SECONDARY'S CONTROL BLOCK ADDRESS.* A5 = CURRENT PRIMARY'S CONTROL BLOCK ADDRESS*.*ˆASECONDARYCONTROLBLOCKHASBEENSELECTED,*ˆDeterminewhattosend.*3‰CMP.B…#SDSCBSY,SDSCST(A4)SECONDARYINBUSYSTATE?‰BEQ.S…SDLCPR5ƒ*)‰TST.L…SDSTHD(A4)NO,SOMETHINGTOTXMIT?‰BNE.S…SDLCPR6ƒ*=SDLCPR5‚BSR.L…SBGTFRIR‚NO,FETCHARCVBUFFER&TXMITAN"RR"-‰BEQ.S…SDLCPR5B‚GOTONEANDIT'SNOTTHELAST‰IFˆTHEN.S6‹MOVE.B„#SDPBNB,SDPBSY(A5)Didn'tgetone,goNOTBUSY‹SDLRSRGAndexit‹RTE‰ENDI!* GOT ONE, BUT IT'S THE VERY LASTASDLCPR5AMOVE.B„#SDDRRNR+$10,SDDCMD(A3)YES,SETAN"RNR"COMMAND‰BRA.S…SDLCPR5C #*ˆA3=BUFFERCONTROLBLOCKADDRESS;SDLCPR5BMOVE.B„#SDDRRR+$10,SDDCMD(A3)SENDAN"RR"COMMAND?SDLCPR5CMOVE.L„A3,SDPRCV(A5)‚*(TxMITFROMTHERECEIVEBUFFER)‰MOVE.B„#SDPTRQ,SDPTXF(A5)***‰MOVE.W„SDPRLG(A5),SDDBCT(A3)*BYTECOUNT‰C LR.W…SDDSTS(A3)*STATUS‰CLR.B…SDDERR(A3)*SDLCERROR$‰CLR.B…SDDRTC(A3)*SDLCRETRYCOUNT.‰MOVE.B„SDSSEC(A4),SDDSEC(A3)*STATIONNUMBER‰BRA.L…TRANSMTƒ**‰PAGEH* NOTE: ED SKINNER, 2/24/83 - WHEN WE HAVE A "SNRM" TO SEND, WE ACTUALLYI*PERFORMTHEFOLLOWING:‚1)TRANSMITA"RNR"COMMANDANDRECEIVEA"GOOD"H*RESPONSE.‚THISISDONESOTHEREMOTESTATIONWILLKNOWHOWMANYOFHISH* INFORMATION FRAMES THAT WE HAVE RECEIVED, THEREBY AVOIDING DUPLICATIONH*OFFRAMES.‚WEMUSTGETA"GOOD"RESPONSETOTHERNRBEFORESENDINGTHEH* SNRM SO THAT WE KNOW HE GOT THE RNR OK, AND THEREFORE NOW KNOWS OUR NrI*VALUE.‚(BYA"GOOD"RESPONSE,IMEANARECEIVEDREPLYOFANYKINDWHICHJ* WAS RECEIVED WITHOUT ANY ERRORS - DOES AN Ns ERROR COUNT? I DON'T KNOW!)D* ONCE WE'VE RECEIVED A "GOOD" REPLY, WE CAN THEN TRANSMIT THE SNRM. 6SDLCPR6‚MOVE.L„SDSTHD(A4),A3WEHAVESOMETHINGTOTXMT3‰CMP.B…#SDDCSNRM,SDDCMD(A3)"SNRM"COMMAND?Ž9/14/82&‰BNE.S…SDLCPR6C‚*BRANCHIFNOš9/14/829‰CMP.B…#SDSTRN,SDSTXF(A4)YES,TXMITTEDAN"RNR"?ˆ2/23/83'‰BEQ.S…SDLCPR6C‚*BRANCHIFYES™9/14/82?‰BSR.L…SBGTFRIR‚NO,FETCHARCVBUFFER&TXMITAN"RNR"9/14/825‰BEQ.S…SDLCPR5A‚GOTONEANDIT'SNOTTHELAST‹9/14/82‰IFˆTHEN.S6‹MOVE.B„#SDPBNB,SDPBSY(A5)Didn'tgetone,goNOTBUSY‹SDLRSRGAndexit‹RTE‰ENDI"* WE JUST GOT THE VERY LAST BUFFER)‰BRA.S…SDLCPR5A‚TRANSMITAN"RNR"—9/14/82 "SDLCPR6CMOVE.B„#SDPTXQ,SDPTXF(A5)‰MOVE.L„A3,-(A7),‰BSR.L…SBGTFRIR‚Getabuffertoreceiveinto‰IFˆTHEN.S:‹MOVE.W„SDPRLG(A5),SDDBCT(A3)Ok,Prepareitforlateruse‹CLR.W…SDDSTS(A3)STATUS‹CLR.B…SDDERR(A3)SDLCERROR‹MOVE.L„A3,SDPRCV(A5)‹MOVE.L„(A7)+,A3)‹BTST.B„#0,SDDCMD(A3)IFrametobesent?‹IFˆTHEN.S4CLR.B…SDSUKT(A4)Yes,zerothenumberofframesout‹ENDI‰ELSE.S.‹MOVE.L„(A7)+,A0Absolutelynobuffersatall,-‹MOVE.B„#SDPBNB,SDPBSY(A5)SetSDLCnotbusy,‹SDLRSRGAndexit‹RTE‰ENDI$‰BRA.L…TRANSMTƒGostarttransmitting .**********************************************.* END OF FILE 'FIX:48.SDLCPRI.POLLQ.AI' *.**********************************************é‰PAGE6******************************************************6* BEGINNING OF FILE 'FIX:48.SDLCPRI.RECEIVE.AI' *6****************************************************** H*************************************************************************'*ˆMODULE:‚"RECEIVE"RECEIVESDLCFRAMES*-*ˆENTER:‚A5.L=PRIMARYCONTROLBLOCKADDRESS(*A4.L=SECONDARYCONTROLBLOCKADDRESS*9*ˆENTRYASSUMESA0-A6/D0-D7HAVEBEENPUSHEDONTHESTACK5*–ANDENTRYWASTHROUGHEXCEPTION(TRAPORINTERRUPT)*>*ˆEXIT:‚"RECEIFB"‚SDLCRESPONSEWITHFINALBITSETCAUSEDEXIT'*"RECEITO"‚RECEIVETIMEOUTCAUSEDEXIT3*"RECEILB"‚THEFREEQUEUEHASONLYONEBUFFERLEFT9*"RECEIEE"‚ANEXCESSIVENUMBEROFRCVERRORSCAUSEDEXIT*!*ˆREGISTERSUSED:ƒ01234567*˜DU*˜AUUUUPPƒS* |ƒ|ƒ|__stack* |ƒ|______preserved* |__________used*#*ˆEXITSTOEXTERNALLYDEFINEDLABEL&*ŽWITHA0-A6/D0-D7PUSHEDONTHESTACK&*ŽANDASSUMESFINALEXITWILLBE"RTE"*H************************************************************************ ?RECEIVE‚MOVE.B„#SDPBRC,SDPBSY(A5)‚Markusasbusyreceivingnow ‰ADD.W…#1,SDSHCRCV(A4)…3/2/83 <‰LEA‡RCVSTSEI(PC),A0…andsetinterruptvectorsforreceiving‰MOVE.L„A0,SDPVCT2(A5)‰LEA‡RCVST1(PC),A0‰MOVE.L„A0,SDPVCT3(A5)‰LEA‡RCVSTS(PC),A0‰MOVE.L„A0,SDPVCT4(A5) 5‰MOVE.L„SDPRCV(A5),A3‡Findthebuffertoreceiveinto6‰LEA‡SDDDAT(A3),A2‡A2=A(dataareawithinthebuffer)(‰MOVE.L„#0,A1(ZerothehighwordofA1)‰MOVE.W„SDPRLG(A5),A1‡an d6‰MOVE.W„A1,SDDBCT(A3)‹storemaximumbytecount‚2/24/83:‰MOVE.B„SDSRRT(A4),SDSCSE(A4)Initializetheerrorcounter.‰CLR.B…SDDERR(A3)ŠCleartheerrorflagŠ2/24/83B‰MOVEM.LƒA0-A6,SDPRRTA0(A5)‚Saveregsforinterrupthandlersusage9‰MOVE.W„#-1,SDPRBCT(A5)…makethecountfield"bad"„3/8/83 ‰OR.W†#$700,SRŒMaskinterrupts2‰MOVE.B„#NCW0RG6,NECCTL_B„Loadthestationaddress0‰MOVE.B„SDSSEC(A4),NECCTL_B‚Weareinterestedin;‰MOVE.B„#NCW0REX+NCW0RG1,NECCTL_BEXT&RCVCHARINTENABLEâ:ëBóKûG4 :#)‰MOVE.B„#NCW1IRX+NCW1EXI+NCW1STV,NECCTL_B$‰MOVE.B„#NCW0RG3,NECCTL_B„RCVENABLE;W3TOTAL‚EQU‡NCW3BT8+NCW3AUE+NCW3EHU+NCW3CRC+NCW3ADS+NCW3RXE‰MOVE.B„#W3TOTAL,NECCTL_B!‰MOVE.B„#NCW0RG5,NECCTL_B„SETDTR‰MOVE.B„#NCW5DTR,NECCTL_B5‰MOVE.B„#NCW0RTX,NECCTL_B„ENABLEINTONNEXTRCVCHAR!‰MOVE.B„#NCW0RTC+NCW0REX,NECCTL_B '‰BSR.L…SOMETOUT‚TRIGGERRECEIVETIMEOUT ‰SDLRSRG—Restoreallregisters,‰INTSVRG—Thensaveonlythe"interrupt"ones‰BRA.L…INTEXIT ‰PAGE*#* External Status Interrupt Handler*I*NOTE:‚THISSTATEISUSEDWHENANEXTERNALSTATUSINTERRUPTOCCURSPRIORB*ˆTORECEIVINGTHEFIRSTCHARACTEROFARECEIVEFRAME.‚DURINGTHISF*ˆPERIOD(BEFOREWEBEGINRECEIVINGAFRAME)WEIGNOREEXTERNALSTATUSE*ˆINTERRUPTS.‚WEDON'TCAREABOUTRECEIVEABORTSAND/ORCLEARTOSENDC*ˆAND/ORDATACARRIERDETECTSTATECHANGESWHENWEARENOTACTUALLY*ˆRECEIVINGAFRAME. 1RCVSTSEIMOVE.B„NECCTL_B,D0ŠGETTHECHIP'SSTATUS*œIGNORERECEIVEABORT,*œHUNTMODECHANGES,*œCLEARTOSENDCHANGES,AND*œDATACARRIERDETECTCHANGES./‰MOVE.B„#NCW0REX,NECCTL_BRESETEXTERNALSTATUS.‰MOVE.B„#NCW0EOI,NECCTL_AANDENDOFINTERRUPT‰BRA.L…INTEXIT‰PAGE*#* External Status Interrupt Handler**1*ˆVECTOREDSTATETOPROCESSEXT/STATUSINTERRUPTS*%RCVSTEƒMOVE.B„NECCTL_B,D0SDLCABORT?‰BTST.L„#7,D0…*‰BNE.S…RCVSTE1ƒ*,‰BTST.L„#3,D0…NO,DataCarrierDetectDROPPED?‰BEQ.S…RCVSTE2ƒ*4‰MOVE.B„#NCW0REX,NECCTL_BNO,RESETINTERRUPT&EXIT‰MOVE.B„#NCW0EOI,NECCTL_A*‰BRA.L…INTEXIT‡* 7RCVSTE1‚MOVE.B„#NCW0REX,NECCTL_B„RESETINTERRUPT&EXIT‰MOVE.B„#NCW0EOI,NECCTL_A*3RCVSTE1AINTRSRG“LET'SSAVEALLTHEUSERS'REGSNOW ‰SDLSVRG“*‰MOVE.L„SDLCPCB,A6RESTOREREGS‰MOVEM.LƒSDPRRTA0(A6),A0-A6*3‰MOVE.B„#SDDEABT,SDDERR(A3)„SETSDLCABORTOCCURRED‰ADD.W…#1,SDSHCRAB(A4)…3/2/83‰BRA.L…RCVSTSF*   7RCVSTE2‚MOVE.B„#NCW0REX,NECCTL_B„RESETINTERRUPT&EXIT‰MOVE.B„#NCW0EOI,NECCTL_A*+‰INTRSRG“LET'SSAVEALLTHEUSERS'REGSNOW ‰SDLSVRG“*‰MOVE.L„SDLCPCB,A6RESTOREREGS‰MOVEM.LƒSDPRRTA0(A6),A0-A6*<‰MOVE.B„#SDDEABT,SDDERR(A3)„ASSUMEANABORTOCCURREDƒ2/24/83‰ADD.W…#1,SDSHCRDD(A4)…3/2/83‰BRA.L…RCVSTSE* ‰PAGE *%* Receive Character Interrupt Handler**2*ˆVECTOREDSTATETOPROCESS1STRCVCHARAVAILABLE*THEN.S0‹MOVE.L„SDPRRTA2(A1),A2…MoremaybereceivedOK,5‹MOVE.B„NECDAT_B,(A2)+‡Storereceivedbyteintobuffe2‹MOVE.L„A2,SDPRRTA2(A1)…Saveupdateddataaddress.‰ELSE.S9‹LEA‡RCVST4(PC),A2‡Bufferisfull,betterby1stFCSbyte<‹MOVE.L„A2,SDPVCT3(A1)†UseBUFFEROVERRUNvectorifrcvmore2‹MOVE.B„NECDAT_B,D0Šanddiscard1stFCSbyte(hope‰ENDI‰MOVE.B„#NCW0EOI,NECCTL_A‰BRA.L…INTEXIT ‰PAGE *%* Receive Character Interrupt Handler**+*ˆVECTOREDSTATETOPROCESSOVERRUNBUFFERS*2RCVST4ƒMOVE.L„SDPRRTA3(A1),A2BUFFEROVERRUNERROR‰MOVE.B„#SDDERBO,SDDERR(A2)1‰MOVE.B„NECDAT_B,D0REMOVECHARACTERFROMNEC7201‰MOVE.L„SDPRRTA4(A1),A2…3/2/83‰ADD.W…#1,SDSHCROB(A2)…3/2/83‰MOVE.B„#NCW0EOI,NECCTL_A‰BRA.L…INTEXIT ‰PAGE *-* Special Receive Condition Interrupt Handler**2*ˆVECTOREDSTATETOPROCESSSPECIALRCVCONDITIONS*?RCVSTSƒMOVE.B„NECDAT_B,D0‚REMOVE2NDCRCCHARACTERFROMNEC7201+‰INTRSRG“LET'SSAVEALLTHEUSERS'REGSNOW‰SDLSVRG‰MOVE.L„SDLCPCB,A6RESTOREREGS‰MOVEM.LƒSDPRRTA0(A6),A0-A64‰MOVE.B„#NCW0RG1,NECCTL_BGetRegister1Information‰MOVE.B„NECCTL_B,D03‰MOVE.B„#NCW0ERR,NECCTL_B(resetspecialinterrupt)!‰MOVE.B„#NCW0RTC+NCW0RTX,NECCTL_B‰MOVE.B„#NCW0EOI,NECCTL_A )‰MOVE.L„A2,-(A7)ŒProtectA2whiletracing‰BSR.L…GETRACEGetatracerow‰IFˆTHEN.SE**********************************************************************TraceEntryFormat°*E**********************************************************************Ã*'*‚+0Ž+4Ž+8‚+9‚+10+11+12+13+14+15‚*E* +---------------+---------------+---+---+---+---+---+---+---+---+ *:*!†PC‡!A(RcvBuffer)!#!S!C!R!D0!D1!E!R1!*E* +---------------+---------------+---+---+---+---+---+---+---+---+ **Ã**PC=ProgramCounter,­*8*A(RcvBuffer)=Addressofthebufferjustreceived,Ž**#=Station'sNumber,­* *S=Station'sCurrentState,¦**C=Buffer'sCommandByte,¨**R=Buffer'sResponseByte,§* *D0=Buffer's1stDataByte,¦* *D1=Buffer's2ndDataByte,¦*!*E=Buffer'sErrorCodeByte,¥*(*R1=NEC7201ReadRegisterOneByte.ž**Ã*E*********************************************************************,‹PEA‡*(PC)Ifwegetatracerow,thentrace#‹MOVE.L„(A7)+,0(A2)‰ourPCaddress,‹MOVE.L„A3,4(A2)ŒA(RcvBuffer),)‹MOVE.B„SDSSEC(A4),8(A2)„Stationaddress,+‹MOVE.B„SDSCST(A4),9(A2)„Hiscurrentstate,0‹MOVE.B„SDDCMD(A3),10(A2)ƒCommandByte(ifany),(‹MOVE.B„SDDRSP(A3),11(A2)ƒResponseByte,%‹MOVE.B„SDDDAT+0(A3),12(A2)Firstand.‹MOVE.B„SDDDAT+1(A3),13(A2)Seconddatabytes,.‹MOVE.B„SDDERR(A3),14(A2)ƒErrorcodebyte,and-‹MOVE.B„D0,15(A2)‹Register1fromtheNEC7201‰ENDI)‰MOVE.L„(A7)+,A2ŒRecoverA2aftertracing $‰BTST.L„#7,D0…EndofFramedetected?‰BEQ.S…RCVSTSA‰BTST.L„#6,D0…Yes,FCSerror?‰IFˆTHEN.S=‹MOVE.B„#SDDECRC,SDDERR(A3)Yes,posttheerrorinthebuffer‹ADD.W…#1,SDSHCRCR(A4)…3/2/83‰ENDI&RCVSTSA‚BTST.L „#5,D0…receiveroverrun?‰IFˆTHEN.S6‹MOVE.B„#SDDERCU,SDDERR(A3)Yes,postitinthebuffer‹ADD.W…#1,SDSHCROR(A4)…3/2/83‰ENDI,‰CMP.B…#SDDERTO,SDDERR(A3)Receivetime-out?0‰BEQ.L…RECEITOYes,departfromherecompletely!,‰TST.B…SDDERR(A3)ŠAnyerrordetectedsofar?‰IFˆTHEN.S/‹CMP.B…#SDDERBO,SDDERR(A3)Yes,frametoolong?1‹BNE.L…RCVSTSENo,justignorethereceivedframe(‹TST.B…SDSCSE(A4)ŠYes,anyretriesleft?-‹BNE.L…RCVSTSE’Yes,ignorethereceivedframe7* When a Buffer Overrun occurs and no retries are left,J* the overlength frame is passed to the application with the error posted.L* This allows someone to complain about these "big" frames we are receiving.‰ENDI9‰MOVE.W„A1,D0…Calculatehowmanybytesareinthebuffer,5‰ADD.W…#1,D0…Addingonefor1stFCScharacteroverrun‰SUB.W…D0,SDDBCT(A3)C‰CMP.W…#-1,SDDBCT(A3)Istheframetooshort?(LT32bits?)8/27/82‰IFˆTHEN.S8‹MOVE.B„#SDDEIFU,SDDERR(A3)Yes,posttheerror‰10/13/82‹ADD.W…#1,SDSHCR32(A4)…3/2/83‹BRA.L…RCVSTSF©10/13/82‰ENDI,‰BTST.B„#0,SDDRSP(A3)‚No,wasitanIframe?$‰BNE.S…RCVSTSDƒOutifnotanIframe‰IFEQ†IFRMBCT-YES3‹MOVE.W„SDPRBCT(A5),D0‚IFrame'sLengthasClaimed?‹CMP.W…SDDBCT(A3),D0‹BNE.S…RCVSTSB6ˆNo,branch‰ENDC=‰CMP.B…#SDPTRN,SDPTXF(A5)‚Yes,didwejustsendanRNRframe?0‰BNE.S…RCVSTSB3ŒNo,it'sOKtorcvIframesthenHRCVSTSB6MOVE.B„#SDDEIFU,SDDERR(A3)Yes,stationshouldn'thavesentit!‰ADD.W…#1,SDSHCRLN(A4)…3/2/83‰BRA.S…RCVSTSB4 ARCVSTSB3MOVE.B„SDDRSP(A3),D0‡NO,DOESVr=Nsinreceivedframe? ‰ASL.B…#4,D0‰AND.B…#$E0,D0‰CMP.B…SDSVRC(A4),D0‰BEQ.S…RCVSTSC:RCVSTSB5MOVE.B„#SDDENNR,SDDERR(A3)NO,SETVr<>NsERROR‰ADD.W…#1,SDSHCRNR(A4)…3/2/83ARCVSTSB4BTST.B„#4,SDDRSP(A3)‡Isthereceivedpoll/finalbitset?‰BEQ.S…RCVSTSE-‰BRA.L…RECEIFBYES,EXIT(RECEIVEDFINALBIT) 5RCVSTSC‚ADD.B…#$20,SDSVRC(A4)…Vr=Ns,soVr=Vr+1‰AND.B…#$E0,SDSVRC(A4)@RCVSTSD‚BTST.B„#4,SDDRSP(A3)‡Isthereceivedpoll/finalbitset?‰BEQ.S…RCVSTSD1-‰BRA.L…RECEIFBYES,EXIT(RECEIVEDFINALBIT) A2 ‰ADD.L…A3,A2#‰MOVE.L„#0,A1…BUFFER'SLENGTH->A1‰MOVE.W„SDPRLG(A5),A1 ‰MOVE.W„A1,SDDBCT(A3)BYTECOUNT"‰CLR.B…SDDERR(A3)„CLEARSDLCERROR%‰MOVEM.LƒA0-A6,SDPRRTA0(A5)SAVEREGS2‰LEA‡RCVST1(PC),A0‡VECTOREDSTATEFOR1STRCVCHAR‰MOVE.L„A0,SDPVCT3(A5)*‰LEA‡RCVSTSEI(PC),A0…ANDIGNOREEXTSTATUS‰MOVE.L„A0,SDPVCT2(A5)7‰MOVE.W„#-1,SDPRBCT(A5)…MAKECOUNTFIELDINVALID†3/8/83‰ADD.W…#1,SDSHCRRS(A4)…3/2/835‰MOVE.B„#NCW0RG3,NECCTL_BƒRe-enablehuntmode2/10/83H MOVE.B #NCW3BT8+NCW3AUE+NCW3EHU+NCW3CRC+NCW3ADS+NCW3RXE,NECCTL_B 2/10/8'‰BSR.L…SOMETOUT‚TRIGGERRECEIVETIMEOUT$‰SDLRSRG—Restoreallregisters,then'‰INTSVRG—Saveonlythe"interrupt"ones ‰BRA.L…INTEXIT 0************************************************0* END OF FILE 'FIX:48.SDLCPRI.RECEIVE.AI' *0************************************************éé‰PAGE5*****************************************************5* BEGINNING OF FILE 'FIX:48.SDLCPRI.SUBRTN.AI' *5*****************************************************   J***************************************************************************È*6*‚SUBROUTINE:‚"SOMETOUT"‚TRIGGERTHERECEIVETIMEOUT’**È*1*‚ENTER:A4.L=SECONDARYCONTROLBLOCKADDRESS™**È**È*#*‚REGISTERSUSED:ƒ01234567¥* *’DUUU¯* *’AUU…P…S¥**”|‡|…|_stackž**”|‡|_______preservedš**”|_______________usedŸ**È*J************************************************************************** 7SOMETOUTLEA‡SDLCTTMOUT(PC),A0ƒACTIVATIONADDRESS->A0'‰CLR.L…D0’TIMEINTERVAL(INMSEC)->A1‰MOVE.W„SDSTOC(A4),D0‡*‰BEQ.S…SOMETOU1Œ*‰MULU.W„#TIMCNST,D0‰*‰MOVE.W„D0,A1*'‰MOVE.W„#$0006,D1‹INTERRUPTLEVEL->D1‰MOVE.L„#DLC2,D2ŒI.D.#->D2‰IFEQ†CHIPTYPE-68000 ‹TR0.RQPA‰ENDC‰IFNE†CHIPTYPE-68000 ‹TR0$.RQPA‰ENDC3SOMETOU1RTS›(MUSTBEA2BYTEINSTRUCTION)2/24/831‰ILLEGALDIEIFSBRQPARETURNSANYERROR!ˆ2/24/83 ‰PAGE J***************************************************************************È*5*‚SUBROUTINE:‚"SOMETOCLR"‚CLEARTHERECEIVETIMEOUT“**È**È**È*#*‚REGISTERSUSED:ƒ01234567¥* *’DUUU¯* *’AUU‹S¥**”||_stackž**”|_______________usedŸ**È*J************************************************************************** 8SOMETOCLRLEA†SDLCTTMOUT(PC),A0ƒACTIVATIONADDRESS->A0'‰CLR.L…D0’TIMEINTERVAL(INMSEC)->D1‰MOVE.W„SDSTOC(A4),D0‡*‰BEQ.S…SOMECLR1Œ*‰MULU.W„#TIMCNST,D0‰*‰MOVE.W„D0,A1*'‰MOVE.W„#$8006,D1‹INTERRUPTLEVEL->D1‰MOVE.L„#DLC2,D2‹I.D.#->D2‰IFEQ†CHIPTYPE-68000 ‹TR0.RQPA‰ENDC‰IFNE†CHIPTYPE-68000 ‹TR0$.RQPA‰ENDC3SOMECLR1RTS›(MUSTBEA2BYTEINSTRUCTION)2/24/831‰ILLEGALDIEIFSBRQPARETURNSANYERROR!ˆ2/24/83 ‰PAGE J***************************************************************************È*1*‚SUBROUTINE:‚"SOMEDISPOSE"DISPOSEOFABUFFER˜*N$Q,A4+*È*.*‚ENTER:A1.L=ADDRESSOFBUFFERTODISPOSEœ*(*‰A5.L=PRIMARYCONTROLBLOCKADDRESS›**È*;*‚RETURN:A1.L=ADDRESSOFLINKFIELDOFDISPOSEDBUFFER**È*#*‚REGISTERSUSED:ƒ01234567¥**’Dµ* *’AUR‡PƒS¥**”||‡|ƒ|_stackž**”||‡|_____preservedš**”||_____________returned›**”|_______________usedŸ**È*J************************************************************************** #SOMEDISPOSE MOVE.L SDDLNK(A1),-(A7) ‰MOVE.L„A1,A0‰BSR.L…SBPTFRBF‰MOVE.L„(A7)+,A1‰RTS ‰PAGE J***************************************************************************È*?*‚SUBROUTINE:‚"SOMESEND"‚SENDABUFFERTOAPPLICATIONPROGRAM‰**È*+*‚ENTER:A1.L=ADDRESSOFBUFFERTOSENDŸ*(*‰A5.L=PRIMARYCONTROLBLOCKADDRESS›**È*7*‚RETURN:A1.L=ADDRESSOFLINKFIELDOFSENTBUFFER“**È*#*‚REGISTERSUSED:ƒ01234567¥**’DU³* *’AUR‡PƒS¥* *–|‡|ƒ|¥**–|‡|ƒ|_stackž**–|‡|_____preservedš**–|_____________returned›**È*J******************** ****************************************************** SOMESENDMOVE.L„SDDLNK(A1),-(A7) ‰MOVE.L„A1,A0‰MOVE.L„A2,-(A7)‰BSR.L…SBPTUSQ‰MOVE.L„(A7)+,A2‰MOVE.L„(A7)+,A1‰RTS ‰PAGE J***************************************************************************È*F*‚SUBROUTINE:‚"SOMEFREE"FREETHELINKOFRCVBUFFERSTOBUFFERPOOLƒ**È*5*‚ENTER:A2.L=ADDRESSOFFIRSTRCVBUFFERTOFREE•*(*‰A5.L=PRIMARYCONTROLBLOCKADDRESS›**È*#*‚REGISTERSUSED:ƒ01234567¥**’DU³* *’AUƒP…PƒS¥**”|‰|ƒ|_stackž**”|‰|_____preservedš**”|_______________usedŸ**È*J************************************************************************** SOMEFREEMOVE.L„A2,A0‰BSR.L…SBPTFRML‰RTS ‰PAGE J***************************************************************************È*8*‚SUBROUTINE:‚"FINDSCB"FindaSecondaryControlBlock‘**È*D*‚ENTER:D1.B=SecondaryStationAddress,or$FF(GlobalAddress)†*7*Note:WheretheGlobalAddressisused,theaddress…*3*–ofthe1stSecondaryControlBlockisreturned.ƒ**È*4*‚RETURN:Negative=0(Plus)-SCBFound,seeA1,–*** A1=A(SCB-SecondaryControlBlock),‚*>*ŠNegative=1(Minus)-SCBNotFound,A1isindeterminite.„**È*#*‚REGISTERSUSED:ƒ01234567¥**’DP³* *’A|R‹S¥**”||‹|_stackž**”||_____________returned›**”|_______________preservedš**È*J************************************************************************** ‰XDEF†FINDSCB >FLYPAPEREQU‡$FFFFFFFF‹Fly-Paper,causesAddressErrorifused 8FINDSCB‚MOVE.L„SDLCPCB,A1ŠViathePrimaryControlBlock,8‰MOVE.L„SDPFSEC(A1),A1†FindtheaddressofthefirstSCB‰IF.B†D1#$FFTHEN.S9‹WHILE.BƒSDSSEC(A1)#0AND.BSDSSEC(A1)D1DO.S&ADDA.L„#SDSLNG,A1ŠAdvancetonextSCB‹ENDW‰ENDI‰IF.B†SDSSEC(A1)#0THEN.S0‹MOVE.L„#FLYPAPER,A1ˆNotFound,A1=BugCatcher ‹ORI.B…#$08,CCRŒAndNegative=1‰ELSE.S1‹ANDI.B„#$F7,CCRŒFound,Negative=0,A1=A(SCB)‰ENDI‰RTS ‰PAGE J***************************************************************************È*1*‚SUBROUTINE:‚"GETRACE"GetaTraceRowAddress˜**È**‚ENTER:NoArguments³**È*A*‚RETURN:Carry=0(CarryClear)-TraceRowAddressReturned,‰**¤A2=A(TraceRow),’*%*¤(Thetraceflagisonandatraceƒ**¥areaexists),–*3*ŠCarry=1(CarrySet)-ƒNoTraceRowAvailable,**¤A2=#$FFFFFFFF,”*%*¤(Eitherthetraceflagisoff,orƒ**¥notraceareaexists).**È*H*‚Note:Thesixteenbytesfrom0(A2)thru15(A2)areavailableforany‚*B*ˆtraceinformation(whenthe"NotEqual"returnoccurs).‚Common*B*ˆusageistostorethecurrentPCvalueat0(A2).L,identifying‚*B*ˆtheprocedurewhichistracing,followedbyprocedurespecific‚**ˆtraceinformation.®**È**‚ExampleUsage:¸*+*ŠMOVE.L„A2,-(A7)ŒProtectA2ifnecessary‰*!*ŠBSR.L…GETRACEGetatracerow‘*)*ŠIFˆTHEN.S‰Ifarowisavailable,Š* *ŒPEA‡*(PC)­***ŒMOVE.L„(A7)+,0(A2)‰StoremyPCaddress‹**ŒMOVE.B„x,4(A2)«**ŒMOVE.B„y,5(A2)«*)*ŒMOVE.L„z,6(A2)Storesomeinformationˆ**ŒMOVE.L„a,10(A2)ª*.*ŒMOVE.W„b,14(A2)Œ-DoNotExceed15(A2).B-„**ŠENDIº*0*ŠMOVE.L„(A7)+,A2ŒandrecoverA2(if"pushed")„**È*J************************************************************************** ‰XREF†TRACEBEG GETRACE‚MOVE.L„TRACEBEG,A2‰BTST.B„#0,TRACFLAG+1 ‰IFˆAND.LA2#0THEN.S‹MOVEM.LƒA3-A4,-(A7)0‹MOVE.L„A2,A3A3=A(Tracecontrol&tracearea)‹MOVE.W„SR,-(A7) ‹ORI.W…#$0700,SR‹MASKINTERRUPTS ‹MOVE.L„0(A3),A2ŒGetA(NextRow)%‹LEA‡16(A2),A4‹FigureA(NewNextRow)‹IF.L†A44(A3)THEN.S.LEA‡8(A3),A4ŠResettobeginningwhenpastend MOVE.L„A4,A2LEA‡16(A2),A4‹ENDI4‹MOVE.L„A4,0(A3)ŒStorenewA(NextRow)fornexttime"‹MOVE.W„(A7)+,SRŒUNMASKINTERRUPTS)‹LEA‡15(A2),A4‹Seeifa"FullRow"exists‹IF.L†A44(A3)THEN.S,ANDI.Bƒ#$FE,CCRandassertRowExistsifOK‹ELSE.S3MOVE.Lƒ#FLYPAPER,A2‰otherwise,A2=#$FFFFFFFFandORI.B„#$01,CCR˜NoRowExists‹ENDI‹MOVEM.Lƒ(A7)+,A3-A4‰ELSE.S .‹MOVE.L„#FLYPAPER,A2ˆelse,A2=#$FFFFFFFFand‹ORI.B…#$01,CCR’NoRowExists‰ENDI‰RTS /***********************************************/* END OF FILE 'FIX:48.SDLCPRI.SUBRTN.AI' */***********************************************ééé‰PAGE7*******************************************************7* BEGINNING OF FILE 'FIX:48.SDLCPRI.TRANSMIT.AI' *7******************************************************* H*************************************************************************(*ˆMODULE:‚"TRANSMT"TRANSMITSDLCFRAMES*-*ˆENTER:‚A5.L=PRIMARYCONTROLBLOCKADDRESS(*A4.L=SECONDARYCONTROLBLOCKADDRESS%*A3.L=BUFFERCONTROLBLOCKADDRESS9*ˆENTRYASSUMESA0-A6/D0-D7HAVEBEENPUSHEDONTHESTACK5*–ANDENTRYWASTHROUGHEXCEPTION(TRAPORINTERRUPT)2*ˆEXIT:‚"TRANSUF"‚ATRANSMITUNDERFLOWCAUSEDEXIT-*"TRANSEQ"‚ENDOFTRANSMITQUEUECAUSEDEXIT6*"TRANSPB"‚SDLCCOMMANDWITHPOLLBITSETCAUSEDEXIT!*ˆREGISTERSUSED:ƒ01234567*˜DU*˜AUUUUPPƒS* |ƒ|ƒ|_stack* |ƒ|_____preserved* |_________used#*ˆEXITSTOEXTERNALLYDEFINEDLABEL&*ŽWITHA0-A6/D0-D7PUSHEDONTHESTACK&*ŽANDASSUMESFINALEXITWILLBE"RTE"*H************************************************************************E* NOTE: ALL INFORMATION FRAMES HAVE THEIR LENGTHS TRANSMITTED AS WELLA*ASTHEIRDATA.‚THELENGTHISSENTASTHEFIRSTTWOBYTESOFTHE* INFORMATION FIELD AS FOLLOWS;N*
H*THERECEIVINGSTATIONMUST,OFCOURSE,EXPECTTHIS.‚THELENGTHISSENTM* AS THE NEC7201 HAS THE NASTY TENDENCY TO SEND THE FRAME CHECK SEQUENCE WHENN*ATRANSMITTERUNDERRUNOCCURS.‚IFWEDOTHISBYACCIDENT,THENWEMUSTBEGINL* SENDING AN ABORT WITHIN THREE CHARACTER TIMES (TWO FCS CHARACTERS PLUS THEL*ENDINGFLAG)FORTHERECEIVINGSTATIONTOKNOWTHATWEGOOFED.‚IFFORSOMEH* REASON WE DON'T INITIATE THE ABORT IN TIME, WITHOUT THE DATA COUNT THEK* RECEIVING STATION WOULD HAVE NO WAY OF KNOWING THAT THE FRAME HE HAS JUSTM*RECEIVEDISNOGOOD.‚THERECEIVERHANDLESTHIS"BADLENGTH"FRAMEJUSTLIKE>* ANY OTHER ERRONEOUS FRAME - HE IGNORES THE FRAME COMPLETELY. :TRANSMT‚MOVE.B„#SDPBTX,SDPBSY(A5)‚Setusbusytransmitting<+E9MU8]>e6mJuE}>…‰ADD.W…#1,SDSHCTXM(A4)…3/2/83‰OR.W†#$700,SRŒMaskInterrupts!<‰MOVE.B„#NCW0REX+NCW0RG1,NECCTL_BResetanypendingExternalB‰MOVE.B„#NCW1EXI+NCW1STV,NECCTL_BEnableonlyExtStatus(notXmtr)‰MOVE.B„#NCW0RG5,NECCTL_B9‰MOVE.B„#NCW5DTR+NCW5TX8+NCW5TXE+NCW5RTS+NCW5TCE,NECCTL_B ‰PAGE C* DTR and RTS are now active, wait for CTS to become active as well ‰MOVE.B„NECCTL_B,D0.‰BTST.L„#5,D0IsCleartoSendalreadyactive?‰IFˆTHEN.S)‹LEA‡TXMSTCTS(PC),A0…No,Mustwaitforit7‹MOVE.L„A0,SDPVCT2(A5)†ExtStatustoTXMSTCTS(CTSWait)‹LEA‡TXMSTOFF(PC),A0;‹MOVE.L„A0,SDPVCT1(A5)†andXmtrEmptytoTXMSTOFF(XmtrOff)‹MOVEM.LƒA0-A6,SDPRRTA0(A5)‹SDLRSRG‹INTSVRG'‹BRA.L…INTEXITExittillCTScomestrue *#* External Status  Interrupt Handler*0TXMSTCTSƒMOVE.B„NECCTL_B,D0‰ExtStatusInterrupt,‹MOVE.B„#NCW0REX,NECCTL_B+‹MOVE.B„#NCW0EOI,NECCTL_AƒAcktheinterrupt*‹BTST.L„#5,D0IsCleartoSendnowactive?‹IFˆTHEN.S!BRA.L…INTEXIT‹No,waitsomemore‹ENDI‹INTRSRG‹SDLSVRG)‹MOVE.L„SDLCPCB,A6ŠYes,Nowwecanbegin!0‹MOVEM.LƒSDPRRTA0(A6),A0-A6‚RestoreBGRegisters‰ENDI * Fall-thru to the next page‰PAGE7* NOTE: WE MAY FALL-THRU TO HERE FROM THE PREVIOUS PAGE ‰MOVE.B„#NCW0RG1,NECCTL_B@‰MOVE.B„#NCW1TXI+NCW1EXI+NCW1STV,NECCTL_BEnableXmtrInterrupts )* Pre-frame transmission delay algorithm.+* Replaced on August 23, 1983 by Ed Skinner*D*†Whereapre-frametransmissiondelayisrequired,wesenda"null"L*frameconsistingofthespecifiednumberofbytes.‚ThisframeisaddressedH* to station $00 (there ain't no such station), and is not sent with anyJ*FCS.‚Thesetwoconditions(station$00andnoFCS)shouldguaranteethat3* no station receives this as a valid transmission.E*†Apre-frametransmissiondelayisneededforeitheroftworeasons.J* First, where Mancester encoding is used (such as in the Exormacs/HDS-400G* and GMAD Weld Monitor configurations), the Mancester chip will supplyM* Transmit Clock to the NEC7201 sometime after RTS is output (from the 7201).K* The single leading flag sent by the NEC7201 is not always received intactL*bythetargetstation.‚ThismaybeduetosomedifficultyintheMancesterJ*receiverand/orNEC7201.‚Regardless,itremainsthatthefirstcharacterM* transmitted by the NEC7201 (an SDLC Flag) is not always received correctly.C*†Secondly,apre-frametransmissiondelaymaybeusedtoallowtheM* receiving software (in the target node) additional time in which to prepare* for receiving a frame.D*†Toeffectthepre-frametransmissiondelay,aframecontaining$00I*bytesinallfieldsistransmitted.‚Asthestationaddress$00isnotaI* valid station address according to the SDLC protocol, no station should.* begin active reception of this "null" frame.F*†Oncethespecifiednumberof"null"byteshavebeentransmitted,theI* transmitter is allowed to revert to the "flagging" condition (no FCS isG*sent).‚SinceanyreceiverofthisframewillthinkthelasttwobytesH* are the FCS, and as these bytes do not contain the computed FCS, it isI* unlikely (1 chance in 65535) that it will appear to be the correct FCS.I* Additionally, since the odds of a transmission error which would changeG* the address field to some "real" station address are much more remoteF* (although no information is available in this regard, the error rateF* should be similar to that of a satellite link (1 in 10**9) or betterJ* considering the "protected" environment and circuit length), the overallF* probability of some station receiving this leading transmission as aE*validframearecomfortablyremote.‚(Besidesthat,thereasonwe'reE* sending this little sucker is because the first frame usually isn'tJ*receivedastheleadingflagismissed.‚ThismakesitevenmoreunlikelyB* that this leading pad frame might be received as a valid frame.)D*†Notethatwhenaframetransmissioncompletes,wedonotsendthisK* "leading pad" frame when more than one frame is sent in quick succession. 2TXMSTPADTST.W…SDSTPD(A4)ŠAnyleadingframedelay?‰IFˆTHEN.S1‹MOVE.W„SDSTPD(A4),A1‡Yes,A1.W=CharacterCount‹LEA‡TXMSTPNX(PC),A08‹MOVE.L„A0,SDPVCT1(A5)†XmtrIntr-->TXMSTPNX(NextPad)‹LEA‡TXMSTEI(PC),A07‹MOVE.L„A0,SDPVCT2(A5)†ExtStaIntr-->TXMSTEI(Ignore)‹MOVEM.LƒA0-A6,SDPRRTA0(A5)‹SDLRSRG‹INTSVRG9‹MOVE.B„#$00,NECDAT_B‡SendStationAddress=$00(Nobody)#‹BRA.L…INTEXITExittillXmtrEmpty ‰PAGE*%* Transmitter Empty Interrupt Handler*B* Enter here upon Transmitter Empty interrupts where the last byteE*outputisnowbeingtransmittedbytheNEC7201.‚BecausetheNEC7201J* gives us the Transmitter Empty interrupt up to one c haracter time beforeF* the character is actually needed, there is a one character "latency"E*betweenwhatweoutput,andwhattheNEC7201issending.‚Therefore,H* we actually output one more than the specified number of leading pads,H* and terminate this operation when we get the interrupt indicating thatG* the last byte output (the "extra" byte) is now being transmitted, andI* therefore, that the specified number of leading pads have, in fact, now* all been transmitted. 5TXMSTPNXƒSUB.W…#1,SDPRRTA1+2(A1)ƒSentonedelaybyte,‹IFˆTHEN.S7MOVE.B„#$00,NECDAT_B‡Sendanothertillcountexhausted*MOVE.B„#NCW0EOI,NECCTL_AƒEndofInterrupt.BRA.L…INTEXITAndexittillanotherXmtrIntr‹ENDI1‹MOVE.B„#NCW0EOI,NECCTL_AƒEndofInterrupt(Xmtr)‹INTRSRG‹SDLSVRG‹MOVE.L„SDLCPCB,A60‹MOVEM.LƒSDPRRTA0(A6),A0-A6‚RestoreBGRegisters‰ENDI%* And begin sending the "real" frame. %TXMSTNXTADD.W…#1,SDSHCTXS(A4)‡3/2/83* Fall-thru to the next page‰PAGE8* NOTE: WE WILL FALL-THRU TO HERE FROM THE PREVIOUS PAGE 7* "EMBELLISH" SDLC COMMAND WITH Nr/Ns COUNTS & POLL BIT ‰MOVE.B„SDDCMD(A3),D0‰AND.B…#$03,D0‰IF.B†D0#3THEN.S#‹MOVE.B„SDDCMD(A3),D0ƒSorIframe,‹AND.B…#$1F,D0/‹OR.B†SDSVRC(A4),D0ƒORinthecurrentVrcount. ‹BTST.L„#0,D0‹IFˆTHEN.SAND.B…#$F1,D0‰Iframe,4OR.B†SDSVSC(A4),D0ƒORinthecurrentVscountalso,(OR.B†#$10,D0‰assertthepoll/finalbit,/ADD.B…#2,SDSVSC(A4)ƒ(AdvanceVsfornexttime):AND.B…#$0E,SDSVSC(A4)ƒ(makingsureit'sonly3bitswide)3ADD.B…#1,SDSUKT(A4)ƒbumpthenumberofframesout,MOVE.B„SDSUKT(A4),D11TST.L…SDDLNK(A3)†anymoreframesafterthisone?(IFˆAND.BD1SDSMXF(A4)THEN.S9MOVE.L„SDDLNK(A3),A0ƒyes,andhaven'treachedmaxlimit,BTST.B„#0,SDDCMD(A0)IFˆTHEN.S2‘AND.B…#$EF,D0‰don'tpoll/finalifnextisIframeENDIENDI‹ELSE.SMOVE.B„D0,D1ŽIfwearesending*AND.B…#$1F,D1ŒaReceiverNotReadyframe,!IF.B†D1#SDDRRNR+$10THEN.S/MOVE.B„#SDPTRN,SDPTXF(A5)ThenassertRNRSentENDI‹ENDI7‹MOVE.B„D0,SDDCMD(A3)‡Storethecommandbytetobesent‰ENDI* Fall-thru to the next page‰PAGE8* NOTE: WE WILL FALL-THRU TO HERE FROM THE PREVIOUS PAGE 8‰LEA‡TXMST0(PC),A0‡Prepareinterruptvectorsforsending‰MOVE.L„A0,SDPVCT1(A5)<‰LEA‡TXMSTEI(PC),A0†For1stCharOut,weignoreExtStaIntrs‰MOVE.L„A0,SDPVCT2(A5) .‰LEA‡SDDDAT(A3),A2‡A2=A(dataareaofbuffer) +‰MOVE.B„SDDCMD(A3),D0‡FigureIfieldlength)‰AND.B…#$03,D0accordingtotypeofframe‰IF.B†D0#$01THEN.S<‹MOVE.W„SDDBCT(A3),A1‡IandUframesspecifyIfieldlengths‰ELSE.S2‹MOVE.W„#0,A1WhileSframesneverhaveanIfield‰ENDI C‰MOVEM.LƒA0-A6,SDPRRTA0(A5)‚Saveregsforinterrupthandlerstouse* A5 = SDPRRTA5 = A(PCB)* A4 = SDPRRTA4 = A(SCB)* A3 = SDPRRTA3 = A(Buffer)(* A2 = SDPRRTA2 = A(Data within I field)#* A1 = SDPRRTA1 = Length of I fieldG* A0 = SDPRRTA0 = Not used for anything special - just leftover garbage ‰ADD.W…#1,SDSHCTXA(A4)…3/2/83 ‰MOVE.B„SDSSEC(A4),D0‡3/3/832‰IF.B†D0SDDSEC(A3)AND.BD0#$FFTHEN.S$‹ILLEGAL—Dieifbadstationaddress!‰ENDI* Fall-thru to the next page‰PAGE8* NOTE: WE WILL FALL-THRU TO HERE FROM THE PREVIOUS PAGE )‰MOVE.L„A2,-(A7)ŒProtectA2whiletracing‰BSR.L…GETRACEGetatracerow‰IFˆTHEN.SE**********************************************************************TraceEntryFormat°*E**********************************************************************Ã*'*‚+0Ž+4Ž+8‚+9‚+10+11+12+13+14+15‚*E* +---------------+---------------+---+---+---+---+---+---+---+---+ *:*!†PC‡!A(XmtBuffer)!#!S!U!C!RC!D0!D1!0!*E* +---------------+---------------+---+---+---+---+---+---+---+---+ **Ã**PC=ProgramCounter,­*<*A(XmtBuffer)=Addressofthebuffertobetransmitted,Š**#=Station'sNumber,­* *S=Station'sCurrentState,¦*/*U=Station'sCurrentUnacknow ledgedCount,—**C=Buffer'sCommandByte,¨**RC=Buffer'sRetryCount,¨* *D0=Buffer's1stDataByte,¦* *D0=Buffer's2ndDataByte,¦**0=Unused.·**Ã*E*********************************************************************,‹PEA‡*(PC)Ifwegetatracerow,thentrace#‹MOVE.L„(A7)+,0(A2)‰ourPCaddress, ‹MOVE.L„A3,4(A2)ŒA(Xmitbuffer),)‹MOVE.B„SDSSEC(A4),8(A2)„StationAddress,+‹MOVE.B„SDSCST(A4),9(A2)„Hiscurrentstate,7‹MOVE.B„SDSUKT(A4),10(A2)ƒCurrentunacknowledgedcount,'‹MOVE.B„SDDCMD(A3),11(A2)ƒCommandbyte,&‹MOVE.B„SDDRTC(A3),12(A2)ƒRetryCount,%‹MOVE.B„SDDDAT+0(A3),13(A2)andfirst4‹MOVE.B„SDDDAT+1(A3),14(A2)........twodatabytes$‹CLR.B…15(A2)Ž(Zerotheunusedbyte)‰ENDI)‰MOVE.L„(A7)+,A2ŒRecoverA2aftertracing ?‰MOVE.B„#NCW0RTG,NECCTL_B„Resetthetransmitter'sFCSgeneratorB‰MOVE.B„SDDSEC(A3),NECDAT_B‚Outputthesecondarystation'saddress=‰MOVE.B„#NCW0RTU,NECCTL_B„EnableFCStransmissiononUnderrun ‰SDLRSRG—Recoverallregisters,,‰INTSVRG—Makestacklooklikeinterruptregs4‰BRA.L…INTEXITAndgoseeifaninterruptispending‰PAGE *%* Transmitter Empty Interrupt Handler*,*ˆVECTOREDSTATETOTxMITSDLCCOMMANDFIELD*ATXMST0ƒMOVE.B„NECCTL_B,D0‰Sincewe'vebeenignoringExtStaIntrs,2‰BTST.L„#6,D0Wenowcheckforanearlierunderrun,‰BNE.L…TXMSTE1Iftrue,gosendanAbortnow"‰MOVE.L„SDPRRTA3(A1),A2…Otherwise,2‰MOVE.B„SDDCMD(A2),NECDAT_BSendthecommandfield‰IFEQ†IFRMBCT-YES6‹BTST.B„#0,SDDCMD(A2)‡WherewearesendinganIframe,‹BNE.S…TXMST012‹LEA‡TXMSTL1(PC),A2†WeSenda"Length"Fieldfirst‹BRA.S…TXMST02‰ENDCATXMST01‚LEA‡TXMST1(PC),A2‡SetUptheNextXmtrEmptyIntrHandlerTXMST02‚MOVE.L„A2,SDPVCT1(A1)1‰LEA‡TXMSTE(PC),A2‡Andfromnowon,wecareabout1‰MOVE.L„A2,SDPVCT2(A1)†ExternalStatusInterrupts‰MOVE.B„#NCW0EOI,NECCTL_A‰BRA.L…INTEXIT ‰PAGE ‰IFEQ†IFRMBCT-YES*%* Transmitter Empty Interrupt Handler**/*ˆVECTOREDSTATETOTxMITSDLCLENGTHFIELD#1*7TXMSTL1‚MOVE.L„SDPRRTA3(A1),A2OUTPUTSDLCLENGTHFIELD‰MOVE.B„SDDBCT(A2),NECDAT_B‚*+‰LEA‡TXMSTL2(PC),A2†SETNEXTVECTOREDSTATE‰MOVE.L„A2,SDPVCT1(A1)†*‰MOVE.B„#NCW0EOI,NECCTL_A‰BRA.L…INTEXIT ‰PAGE *%* Transmitter Empty Interrupt Handler**/*ˆVECTOREDSTATETOTxMITSDLCLENGTHFIELD#2*7TXMSTL2‚MOVE.L„SDPRRTA3(A1),A2OUTPUTSDLCLENGTHFIELD"‰MOVE.B„SDDBCT+1(A2),NECDAT_B*œ10*‰LEA‡TXMST1(PC),A2‡SETNEXTVECTOREDSTATE‰MOVE.L„A2,SDPVCT1(A1)†*‰MOVE.B„#NCW0EOI,NECCTL_A„*10‰BRA.L…INTEXIT‡*‚ENDC ‰PAGE *#* External Status Interrupt Handler**4*ˆVECTOREDSTATETOPROCESSSTATUSCHANGEINTERRUPTS*!TXMSTEƒMOVE.B„NECCTL_B,D0‰GETRR0‰BTST.L„#6,D0UNDERRUN?(‰BNE.S…TXMSTE1YES,HURRYANDSENDABORTTXMSTE0‚BTST.L„#5,D0CTSDROP?%‰BEQ.S…TXMSTE1YES,XMTRDYING,ABORT'‰BRA.S…TXMSTE2NO,IGNORETHEINTERRUPT 3TXMSTE1‚MOVE.B„#NCW0SAB,NECCTL_BƒSENDANSDLCABORT‰MOVE.L„SDPRRTA4(A1),A2‰ADD.W…#1,SDSHCTUN(A2)4‰MOVE.L„SDPRRTA3(A1),A2…RESTOREBUFFERCONTROLBLOCK0‰MOVE.B„#SDDETXU,SDDERR(A2)TxMITUNDERRUNERROR*‰MOVE.B„#NCW0REX,NECCTL_BƒRESETINTERRUPTS‰MOVE.B„#NCW0EOI,NECCTL_A‰INTRSRG—SAVEALLUSER'SREGS‰SDLSVRG‰MOVE.L„SDLCPCB,A5ŠRESTOREREGS‰MOVEM.LƒSDPRRTA3(A5),A3-A5(‰BRA.L…TRANSUFEXIT(TRANSMITUNDERFLOW) ETXMSTE2‚MOVE.B„#NCW0REX,NECCTL_BƒIgnoretheExternalStatusInterrupt‰MOVE.B„#NCW0EOI,NECCTL_A‰BRA.L…INTEXIT ‰PAGE *%* Transmitter Empty Interrupt Handler**0*ˆVECTOREDSTATETOTxMITSDLCINFORMATIONFIELD*>TXMST1ƒSUB.W…#1,SDPRRTA1+2(A1)ƒDecrementnumberofbytestogo‰IFˆTHEN.S/‹MOVE.L„SDPRRTA2(A1),A2…If"more"bytesremain,5‹MOVE.B„(A2)+,NECDAT_B‡Outputthenextdatabyte,and7‹MOVE.L„A2,SDPRRTA2(A1)…Savedatapointerfornexttime‰ELSE.S9‹LEA‡TXMSTOFF(PC),A2…Whendone,preparetosendFCSbytes/‹MOVE.L„A2,SDPVCT1(A1)†(XmtrIntrnotexpected)0‹LEA‡TXMST2(PC),A2‡andExpectanExternalStatus&‹M OVE.L„A2,SDPVCT2(A1)†interruptnext,9‹MOVE.B„#NCW0RTI,NECCTL_BƒAndmaketheXmtrEmptygoaway‰ENDI6‰MOVE.B„#NCW0EOI,NECCTL_AƒEitherway,EndofInterrupt‰BRA.L…INTEXIT ‰PAGE *#* External Status Interrupt Handler* *ˆVECTOREDSTATETOTRANSMITCRC*0TXMST2ƒMOVE.B„NECCTL_B,D0‰GettheChip'sStatus,(‰BTST.L„#6,D0IsitsendingtheFCSnow?$‰BEQ.L…TXMSTE0No,gocheckCTSfall5‰LEA‡TXMSTEI(PC),A2†Yes,ChipisnowsendingtheFCS.3‰MOVE.L„A2,SDPVCT2(A1)†IgnoreUnderrunsfromnowon‰MOVE.B„#NCW0REX,NECCTL_B‰MOVE.B„#NCW0EOI,NECCTL_AƒAnd2‰LEA‡TXMST3(PC),A2‡SetupforXmtrEmptyInterrupt,‰MOVE.L„A2,SDPVCT1(A1)†TotakeustoTXMST3.4‰BRA.L…INTEXIT(OccurswhenFCSsendingiscomplete) ‰PAGE *%* Transmitter Empty Interrupt Handler*(*ˆVECTOREDSTATEAFTERCRCHASBEENSENT* TXMST3ƒINTRSRG—SAVEALLREGSNOW‰SDLSVRG‰MOVE.L„SDLCPCB,A6RESTOREREGS‰MOVEM.LƒSDPRRTA0(A6),A0-A6.‰BTST.B„#4,SDDCMD(A3)‡POLLBITSETINCOMMAND?‰BNE.S…TXMST3AYes,Seebelow‰MOVE.B„#NCW0EOI,NECCTL_AƒNo,6‰MOVE.L„SDDLNK(A3),A3‡Istheresomethingelsetosend? ‰MOVE.L„A3,D04‰BNE.L…TXMSTPADŽYup,gosendit(withleadingdelay)'‰ADD.W…#1,SDSHCTNP(A4)…No,donesending+‰BRA.L…TRANSEQGofigureoutwhattodonow ‰PAGE J* WHEN WE ARE READY TO SHUT DOWN THE TRANSMITTER, WE MUST DELAY FOR 11 BITJ* TIMES TO ALLOW THE ENDING FLAG TO LEAVE THE SHIFT REGISTER (8 BIT TIMES)L* AND TO PASS THRU OTHER HARDWARE (SUCH AS THE MANCESTER ENCODER WHICH NEEDSJ*3MOREBITTIMES).‚SINCEWECANNOTMEASUREINDIVIDUALBITTIMES,WEWAITL* A TOTAL OF 16 BIT TIMES BY SENDING TWO "PAD" CHARACTERS CONSISTING OF $00.M* THIS VALUE IS USED AS NO SECONDARIES HAVE THIS ADDRESS AND, THEREFORE, NONEK*OFTHEMWILLSTARTTORECEIVETHISINFORMATION.‚ADDITIONALLY,WETURNTHEM* TRANSMITTER OFF AFTER THE LAST ONE IS OUT WITHOUT SENDING ANY FCS SEQUENCE.K* TURNING THE TRANSMITTER OFF, IF SOMEONE IS RECEIVING AT THAT TIME, CAUSESI* THE LINE TO GO TO A MARKING STATE WHICH WILL CAUSE THEM TO DETECT FIRSTI*ARECEIVEABORT,ANDTHENAMARKING(IDLE)LINE.‚FROMTHESEINDICATIONSF* WE ARE ASSURED THAT NO STATION WILL RECEIVE THESE TRAILING PADS AS A+*VALIDFRAME.ƒEDSKINNER,MARCH2,1983... /TXMST3A‚MOVE.B„#$00,NECDAT_BOUTPUTANULLCHAR*‰LEA‡TXMST4(PC),A0‡SETNEXTVECTOREDSTATE‰MOVE.L„A0,SDPVCT1(A5)‰MOVE.B„#NCW0EOI,NECCTL_A&‰SDLRSRG—Restorefullsetofregisters$‰INTSVRG—Andstacktheinterruptset4‰BRA.L…INTEXITAndgoseeifanotherinterruptpends ‰PAGE *%* Transmitter Empty Interrupt Handler***ˆOUTPUT2NDNULLCHAR*-TXMST4ƒMOVE.B„#$00,NECDAT_BOUTPUTAPADNULL*‰LEA‡TXMST5(PC),A2‡SETNEXTVECTOREDSTATE‰MOVE.L„A2,SDPVCT1(A1)‰MOVE.B„#NCW0EOI,NECCTL_A‰BRA.L…INTEXIT ‰PAGE *%* Transmitter Empty Interrupt Handler**E*ˆTxMITSHUTDOWNWITHPOLLBITSETINCOMMAND(NOTNECESSARILY!E.S.)*=TXMST5ƒMOVE.B„#NCW0EOI,NECCTL_ALETSSAVEALLTHEUSER'SREGSTXMENDƒINTRSRG‰SDLSVRG‰MOVE.L„SDLCPCB,A6RESTOREREGS‰MOVEM.LƒSDPRRTA0(A6),A0-A6‰ADD.W…#1,SDSHCTEN(A4)…3/2/83"‰BRA.L…TRANSPBƒEXIT(POLLBITSET) ‰PAGE *#* External Status Interrupt Handler**8*ˆEXTERNALSTATUSINTERRUPTHANDLERWHICHISUSEDDURING*’1)LEADINGPADTRANSMISSION,+*’2)TRANSMISSIONOFTHEADDRESSFIELD,AND*’3)TRAILINGPADTRANSMISSION.@*ˆINALLTHREECASES,"UNDERRUN"INDICATIONSAREIGNOREDASWELL=*ˆASALLOTHERCONDITIONSEXCEPTFORAFALLOFCLEARTOSEND.*0TXMSTEI‚MOVE.B„NECCTL_B,D0‰GETTHECHIP'SSTATUS/‰MOVE.B„#NCW0REX,NECCTL_BƒRESETEXTERNALSTATUS.‰MOVE.B„#NCW0EOI,NECCTL_AƒANDENDOFINTERRUPT‰MOVE.L„SDPRRTA4(A1),A2…3/2/83‰ADD.W…#1,SDSHCEXA(A2)…3/2/83?‰BTST.L„#5,D0…CTSfall?‚Ifyes,thenmustassumeframesentOK,=‰BEQ.S…TXMEND„We"assume"pollbitsent,andgointorcvnow.I* CTS did not drop, so we ignore the External Status Interrupt completely‰BRA.L…INTEXIT ‰PAGE *%* Transmitter Empty Interrupt Handler*F* This state is to be used when transmitter interrupts  are supposed toE*beoff,orareotherwisenotexpected.‚Ifonehappenswhileinthis-* state, the system is intentionally crashed.* 2TXMSTOFFCRASH.Tƒ*+1‘FailwithanAddressingError 1*************************************************1* END OF FILE 'FIX:48.SDLCPRI.TRANSMIT.AI' *1*************************************************ééé' IOCFAIL SA™™‘bbM600CMDSSA® ðÒbbM600CMTSSA©‹Z›bbM600DRV SA  bbM600INTLSA-ÿbbM600LIB SAFFUòbbM600SERVSA››§bbM605DRV SAÀÀ]ãbbM605LIB SA!!~bbM610DRV SA2 #¹ Ebb610LIB SA ô ô<bb0IOCFAILƒIDNTƒ1,0BoardFailMontiorTask4-28-82 ŠOPTPCS,FRSM*----------------------------------------------------------------------------*-*ˆIOCFAIL‚I/OCHANNELBOARDFAILHANDLERTASK**ˆVersion1.0‚4/27/82(C313)*<*ˆThistaskisashelltohandleboardfails,ifsodesired.:*ˆItgetsanASQtobeabletoreceiveeventsfromdrivers;*ˆwhichcanreceiveboardfailinterrupts.Itthenattaches>*ˆtoeachdriveritwantstomonitor.Theattachcallusesthe9*ˆsamedevicenameasthelevel4CCBallocatecallused.:*ˆThesedevicenamesareenteredinthistaskbytheuser.*;*ˆThistaskacceptseventsfromI/OChanneldevicedrivers.:*ˆAneventisqueuedtothistaskwheneveradevicedriver<*ˆexperiencesaboardfailinterrupt.‚Assupplied,thistask=*ˆonlyreadstheevent.‚Theusermayaddtooreliminatethis*ˆtaskaccordingtohisneeds.*N*-----------------------------------------------------------------------------* *ˆEQUATES*8NOFDEV„EQU„16‘maximumnumberofI/Ochanneldevicesthis%*§maybechangedtotheactualnumber&*§ofI/Ochanneldevicesonthesystem*"MSGLNG„EQU„10‘eventmessagelength*%QUELNG„EQU„MSGLNG*NOFDEV†queuelength*1ASQOPT„EQU„$D‘ASQoptions:don'tstackregisters,*§enableASQandASR*%GTASQ…EQU„31‘GetASQdirectivenumber-WTEVNT„EQU„36‘Waitforeventdirectivenumber)RDEVNT„EQU„34‘Readeventdirectivenumber0RTEVNT„EQU„37‘Returnfromeventdirectivenumber+TERM†EQU„15‘Terminatetaskdirectivenumber.CMR‡EQU„60‘Channelmanagementdirectivenumber**‰Eventlayout* ŠOFFSET0 EVTLNG„DS.Bƒ1’eventlength($0A)EVTCOD„DS.Bƒ1’eventcodeƒ($09) EVTDEV„DS.Lƒ1’faileddevicename5EVTADR„DS.Lƒ1’faileddevicememorymappedI/OaddressŠPAGE ŠSECTION0*+*‰Ta skCreationDateandVersionIdentifier*D‰EQU„*’startofdataŠDC.Bƒ'0428821'‰identifier**‰DeviceNameTable*6*‰THISTABLETOBEMODIFIEDFOREACHDEVICETOMONITOR**‰tablestructure:‘?šI¢ 0*‰multiple4bytefieldscontainingdevicenames8*‰last4bytefieldsettozerotoindicateendoftable*-DEVTBL„DC.Lƒ'RA41'attachtolevel4RAD1CCB ŠDC.Lƒ'RA42'ŠDC.Lƒ0’endoftable**‰misc.dataarea*7TRP1PB„DS.Bƒ22‘Trap1parameterblockusedbyallcallsŠDS.Bƒ8’Stackarea STACK…EQU„* PAGE* *‰ENTRYPOINT* *‰getanASQ*'IOCFAILƒLEA„STACK(PC),A7‡loadthestack.ŠLEA„TRP1PB(PC),A1†getparameterblockaddress"ŠMOVE.LA1,A0ŽsaveitforthecallŠCLR.L‚(A1)+ŽtasknameŠCLR.L‚(A1)+Žsession%ŠMOVE.B#ASQOPT,(A1)+†settheoptions$ŠMOVE.B#MSGLNG,(A1)+†messagelength"ŠMOVE.L#QUELNG,(A1)+†queuelength"ŠLEA„IOCASR(PC),A2†GetASRaddressŠMOVE.LA2,(A1)+‹ASRaddressŠCLR.W‚(A1)notused*ŠMOVE.L#GTASQ,D0ŠgetASQdirectivenumberŠTRAPƒ#1‘getanASQ(ŠBNE.S‚ERRORŽbranchifanerrorreturned*.*‰attachtoalldeviceslistedindevicetable"*‰thesearethedevicestomonitor*+ŠLEA„DEVTBL(PC),A2†getdevicetableaddress-IOCATT„TST.L‚(A2)adevicelefttoattachto?(ŠBEQ.S‚IOCWAITŒbranchifnodevicesleft-ŠMOVE.LA0,A1ŽrestoreparameterblockaddressŠMOVE.B#3,(A1)+‹attachcodeŠCLR.B‚(A1)+Žnotused'ŠMOVE.W#1,(A1)+‹setqueueeventoption9ŠMOVE.L(A2)+,(A1)+ˆsetdevicenamefromthedevicetable(ŠMOVE.W#MSGLNG,(A1)+†setmessagelengthŠCLR.L‚(A1)+ŽusedefaultASRŠCLR.L‚(A1)+Žnotused3ŠMOVE.L#CMR,D0ŒchannelmanagementdirectivenumberŠTRAPƒ#1‘dotheattach*ŠBRA„IOCATTgoseeifanotherattachtodo**‰waitforanevent*9IOCWAITƒMOVE.L#WTEVNT,D0‰waitforeventdirectivenumberŠTRAPƒ#1‘dothewait**‰USERCODEMAYBEADDEDHERE*#ŠBRA„IOCWAITŒgowaitfornexteventŠPAGE*"*‰IOCASR„readtheeventandreturn*“registersarenotstacked* IOCASR„EQU„*5ŠLEA„TRP1PB(PC),A0†Gettrap1parameterblockaddress.ŠMOVE.L#RDEVNT,D0‰readeventdirectivenumberŠTRAPƒ#1‘readtheevent(ŠBNE.S‚ERRORŽbranchifanerrorreturned**‰theeventisnowatTRP1PB*‰USERCODEMAYBEADDEDHERE*%ŠMOVE.L#1,A0ŽreturnwithASRenabled5ŠMOVE.L#RTEVNT,D0‰returnfromeventdirectivenumberŠTRAPƒ#1‘returnfromthisevent*2*‰terminatethistaskifreceiveanytrap1errors*5ERROR…MOVE.L#TERM,D0‹terminatetaskdirectivenumberŠTRAPƒ#1‘dothetermination ŠEND„IOCFAIL éééé éé‰TTL‡5.‚CommandServiceSection‰PAGE*š5.‚CommandServiceSection*G*‡Recall‚againthatCMRviewsanI/Odriver(suchastheA/Ddriver)asL*‚acollectionofthreemajorsubroutines.‚Onesubroutine,whichhasalreadyJ*‚been‚presented‚for‚theA/Ddriver,isusedatchannel-allocationtimetoG*‚initializetheI/Odevice(s)onthechannel‚that‚is‚served‚by‚the‚I/OF*‚driver‚and‚to‚perform‚any‚other‚initialization‚stepsthatthedriverL*‚requires.‚AnothersubroutineisusedforrespondingtoanI/OcommandthatK*‚was‚ultimately‚generatedbyausertask,andthethirdsubroutineisusedK*‚torespondtoaninterruptfromadeviceonthechannelthatis‚served‚by*‚theI/Odriver.*D*‡This‚section‚of‚the‚listingfortheRMS68KA/DdrivercontainstheI*‚command-processingsubroutinethatiscalledbyCMR‚when‚CMR‚receives‚aI*‚command‚to‚perform‚anI/OtransactionwiththeA/Ddriver.‚ThissectionM*‚alsoincludesseveralsubsidiaryroutinesthatareusedbytheA/Ddriver's'ª¯³·»¿Ã"ÇËÏÓ×Ûßãçëïó÷ûÿ'    *‚command-processingsubroutine.!‰TTL‡5.1.‚CommandSwitchingTable*‰PAGE*™5.1.‚CommandSwitchingTable*F*‡Thisswitchingtableisusedbythecommand-processing‚subroutine‚toK*‚route‚control‚totheparticularroutinethatrespondstothecommandthatH*‚hasbeenreceived.‚TheCMD_CODE(i.e.,command-code)‚field‚in‚the‚IOCBH*‚specifies‚the‚particular‚command‚that‚isrequested,andwesearchthisL*‚switchingtabletofindamatchforthegivenCMD_CODEvalue.‚IfwefindaJ*‚match‚for‚the‚CMD_CODEvalue,wetransfercontroltotheroutinethatisL*‚specifiedintheswitchingtableforthegivenCMD_CODEvalue.‚Ifwedon'tJ*‚find‚the‚given‚CMD_CODEvalueintheswitchingtable,wereturnastatusH*‚codetotelltheusertaskthattheCMD_CODEvalue‚is‚invalid.ƒIn‚this(*‚case,ofcourse,weabortthecommand.*D*‡Each‚entry‚in‚thecommandswitchingtablecontainstwofields.‚TheH*‚firstfieldcontainsa16-bitunsigned‚relative‚offset‚that‚yields‚theK*‚address‚of‚theroutinethatrespondstothegivencommand,andthesecondJ*‚fieldcontainsthe16-bitCMD_CODEvalueforthecommand.‚Theend‚of‚theI*‚switching‚table‚is‚marked‚byazerosentinelwordinthepositionofan*‚offsetvalue.*A*‡Noticethatweusea‚relative‚offset‚instead‚of‚using‚an‚actualK*‚address.‚Thisapproachhastwoadvantages.‚ThefirstadvantageisthatbyK*‚usinganoffsetwecaneasilywriteposition-independentcode.‚The‚secondJ*‚advantage‚is‚that‚wecansavememorybyusinga16-bitoffsetinsteadof%*‚usingalong-wordabsoluteaddress.*B*‡TheA/Ddriversearchesthis‚switching‚table‚by‚using‚a‚straightG*‚linear‚search.ƒA‚straight‚linear‚searchturnsouttobefasterthanaL*‚binarysearchbecausethetableistooshorttojustifytheadded‚overheadF*‚of‚binary‚searching.ƒIf‚the‚table‚everexpandstocontain25ormoreL*‚entries,abinarysearchshouldbeconsidered.‚ForatablewithfewerthanH*‚25‚entries,‚however,‚a‚linear‚searchisgenerallyfasterthanabinaryI*‚search.‚Maximumspeedwithalinearsearchcanbeachieved‚if‚the‚tableI*‚entries‚are‚ordered‚with‚theentriesthatareusedmostoftenappearingL*‚nearestthebeginningoft hetable.‚Sincetheswitchingtableissoshort,M*‚though,thetableentriesareorderedlogicallyinsteadofbeingorderedby!*‚usagetoachievemaximumspeed.*B*‡ThevalidCMD_CODEvaluesfor‚the‚A/D‚driver‚are‚the‚consecutiveH*‚integers‚from‚zero‚through‚four,‚sowecouldeasilyuseadirecttableL*‚lookupapproachinsteadofsearchingtheswitchingtable.‚However,atableL*‚search‚ismoregeneralthanadirecttablelookup,soweusethesearchto(*‚ensureflexibilityforfuturechanges.  ?CMDSWIT‚DC.W…OPEN_CMD-*-4‹TheopencommandtellstheA/Ddriver0‰DC.W…OPEN‘to‚open‚thespecifiedA/Dmeasurement%*¦channel(s)fortherequestingtask. *Â(Continued)-‰PAGEš#######################################1‰DC.W…MEAS_S-*-4The‚single-endedƒmeasureƒcommand9‰DC.W…MEASURE+SINGLE‡tells‚the‚A/D‚drivertomakezeroor)*¦moresingle-endedmeasurementsfromthe#*¦specifiedmeasurementchannel(s). 1‰DC.W…MEAS_D-*-4Theƒdifferentialƒmeasure‚command7‰DC.W…MEASURE+DIFF‰tellstheA/Ddriverto‚make‚zero‚or)*¦moredifferentialmeasurementsfromthe)*¦specifieddifferentialchannelpair(s). 8‰DC.W…STOP_CMD-*-4‹ThestopcommandtellstheA/Ddriver2‰DC.W…STOP‘toterminatethemeasurecommand(s),if#*¦any,ƒthat‚are‚presently‚using‚the%*¦specified‚measurement‚channel(s)ƒor*¦differentialchannelpair(s). 2‰DC.W…CLOSECMD-*-4‹Theƒclose‚command‚tells‚the‚A/D0‰DC.W…CLOSEdrivertocloseall‚of‚the‚specified)*¦measurementchannel(s)andtomakethem#*¦availableforusebyothertasks. -‰DC.W…0–Thiszerosentinelwordinthenormal'*¦position‚of‚anoffsetvaluemarksthe%*¦endofthecommandswitchingtable.1‰TTL‡5.2.‚SubroutineCOMMANDS(CommandProcessor)‰PAGE.*‘5.2.‚SubroutineCOMMANDS(CommandProcessor)*H*‡SubroutineCOMMANDSiscalledfromCMRwheneverCMRreceivesacommandJ*‚fromausertasktoinitiateanI/OtransactionwiththeA/D‚driver.ƒAnyM*‚commandthatinvokessubroutineCOMMANDSintheA/DdriverisconsideredtoI*‚beacommandthatinitiatesanI/Otransactionwith‚the‚driver,‚so,‚forL*‚example,‚acommandtoopenorcloseameasurementchannelisconsideredtoM*‚beacommandtoinitiateanI/OtransactionwiththeA/DdrivereventhoughH*‚such‚a‚command‚doesn't‚result‚directlyinanI/OoperationwithanA/D*‚board.*E*‡UponentrytosubroutineCOMMANDSregisterA2‚contains‚the‚physicalH*‚memory‚address‚of‚the‚CMR‚parameterblockforthecommand,registerA5L*‚containsthephysicalmemoryaddressoftheA/Dchannel'sCCB,register‚A6L*‚contains‚thephysicalmemoryaddressoftheTCBthatgovernsthetaskthatI*‚invokedCMR,andtheprocessorisinsupervisor‚mode‚at‚interrupt‚levelI*‚zero.ƒThe‚following‚diagramgraphicallysummarizestheentryconditions;*‚forsubroutineCOMMANDSinthecaseofatypicalcommand.**2*TypicalEntryConditionsforSubroutineCOMMANDS*1*‰+-----------+‰+----------+‰+------------------+<*‚A2--->|CMR‡|-------->|User…|-------->|‚InputBuffer1‚|/*‰|Parameter|‰|Task'sƒ|‰+------------------+*‰|Block…|‰|I/O†|„.Ž.*‰+-----------+‰|Command‚|„.Ž.*Ÿ|Block„|„.Ž.*Ÿ|Š|*Ÿ|Š|‰+------------------+ *Ÿ|Š|-------->|‚InputBuffern‚|#*Ÿ+----------+‰+------------------+**´Note:‚Inputbuffers.*‰+-----------+‰+----------+‰are‚used‚only‚for:*‚A5--->|CCB‡|-------->|MVME-600|‰theMEASUREcommand./*‰|(Channel‚|‰|Memory-‚|‰Theyarenotpresent,*‰|Controlƒ|‰|Mappedƒ|‰forothercommands.*‰|Block)„|‰|I/OArea|*‰+-----------+‰+----------+***‰+-----------+*‚A6--->|TCB‡| *‰|(Task…| *‰|Controlƒ| *‰|Block)„|*‰+-----------+**E*‡UponreturnfromsubroutineCOMMANDSregisterA6‚must‚be‚preserved.K*‚In‚fact,‚asastandardpracticethroughouttheentireoperatingsystemwe*‰PAGEJ*‚alwaysmaintainA6asapointertotheTCBforthetask‚that‚called‚uponI*‚the‚operating‚ system‚toperformanoperation.‚IfasystemcrashsomehowJ*‚occurs,registerA6canprovideacluetotheenvironmentat‚the‚time‚of *‚thecrash.*G*‡Besides‚preservingregisterA6,subroutineCOMMANDSmustputastatusG*‚codeintoD0.B(i.e.,the‚least-significant‚byte‚of‚register‚D0)‚uponI*‚return‚to‚the‚callingroutine.‚IfsubroutineCOMMANDSprocessestheI/OK*‚requestwithoutfindinganyerrors,thesubroutinereturnscontrol‚to‚theK*‚calling‚routinewithD0.B=0toindicatethatalliswell.‚IfsubroutineM*‚COMMANDSdiscoversanerror,however,thesubroutinereturnscontroltotheF*‚calling‚routine‚with‚a‚nonzero‚error‚code‚inD0.BtoindicatethataI*‚problemhasbeenencountered.‚SubroutineCOMMANDSuses‚a‚unique‚nonzeroM*‚errorcodeforeachparticularerrorthatthesubroutinecandetect,sotheI*‚usercandeterminetheexactnatureofaproblem‚by‚examining‚the‚errorJ*‚code‚that‚subroutineCOMMANDSreturnsinD0.B.‚AcompletelistofallofM*‚theerrorcodesandtheirmeaningsisavailableelsewhereinthelistingof*‚theA/Ddriver.*H*‡AzerostatuscodeinD0.BindicatesonlythatsubroutineCOMMANDShasK*‚processedtheusertask'sI/Orequestwithoutdetectinganyerrors,‚and‚aL*‚zero‚statuscodedoesnotnecessarilyindicatethattheI/OactivitiesforK*‚theI/Orequesthavebeencompletedwithoutanyerrors.‚SomeI/O‚requestsM*‚causesubroutineCOMMANDStosetupsequencesofI/OoperationsthataretoK*‚beperformedoveranextendedperiodoftime.‚Incaseslikethese,a‚zeroL*‚status‚codethatisreturnedinD0.BbysubroutineCOMMANDSindicatesonlyF*‚thatthesubroutinehasprocessedthe‚I/O‚request‚and‚has‚set‚up‚theI*‚sequences‚of‚I/O‚operationswithoutdetectinganyerrors.‚AzerostatusK*‚codeinsuchacasedoesnotindicatethatanyoftheI/O‚operations‚haveH*‚been‚completed‚successfully,‚and‚the‚I/Ooperationscouldcauseerrors *‚laterwhentheyareperformed.*C*‡Besidesreturningastatuscode‚in‚D0.B,‚subroutine‚COMMANDS‚alsoI*‚returns‚the‚same‚status‚codeinthestatusfieldoftheusertask'sI/OH*‚commandblock.‚TheI/Ocommandblockisthe‚parameter‚block‚that‚tellsL*‚subroutine‚COMMANDSexactlywhattheusertaskwantsthedrivertodo,andL*‚thelayoutoftheI/Ocommandblockisdefinedelsewhereinthelisting‚of*‚theA/Ddriver.*C*‡In‚addition‚to‚preserving‚A6‚andreturningastatuscodeinD0.B,M*‚subroutineCOMMANDSmust,ofcourse,preservetheSPandthesystembyteofH*‚the‚SR.ƒAll‚other‚registersmaybemodifieduponreturntothecalling *‚routine.*F*‡SubroutineCOMMANDSperformsthecommontasksthatare‚necessary‚forH*‚all‚command‚routines,‚and‚then‚thesubroutineusesacommandswitchingL*‚tabletodirectcontroltotheindividualroutinethatprocessesthe‚givenE*‚command.ƒIf‚the‚command-code‚value‚in‚the‚I/Ocommandblockdoesn'tI*‚designateavalidcommand,subroutineCOMMANDSreturns‚an‚error‚code‚inM*‚D0.B(andinthestatusfieldoftheusertask'sI/Ocommandblock)totell,*‚theusertaskthatthecommandisinvalid.*‰PAGEG*‡Thetablebelowsummarizesthegeneralusageofregistersinthe‚partC*‚of‚subroutine‚COMMANDS‚that‚is‚common‚to‚all‚command‚routines.‚InM*‚particular,thefinalvaluesthatareshownbelowareintheregisterswhenE*‚control‚branches‚from‚the‚common‚part‚of‚subroutine‚COMMANDStothe4*‚individualroutinethathandlesthegivencommand.*F*‚#&A6=LOC(TCBofthetaskthatinvokedCMR).„#=Entrycondition.-*‚#&A5=LOC(CCB).¡&=Preservedonreturn.#*†A4=LOC(CMD_CODEfieldinIOCB).*†A3=LOC(DUPETBL).?*‚#ƒA2=LOC(CMRParameterBlock)initially.‚ThenLOC(MSBDATA).6*†A1=LOC(CNFIELDinIOCB)iftheIOCBhasaCNFIELD.*†A0=Scratch.* *†D6.L=0.D*†D5.L=NumberofwordsinIOCBafterCMD_CODEfield.‚AlsoinD4.L.D*†D4.L=Numberofwordsi nIOCBafterCMD_CODEfield.‚CopyofD5.L. *†D3.L=0.*†D2.L=Scratch.C*†D1.L=Scratch.‚Controloffsetforthechannelbeinginitialized.+*†D0.B=STATNSNG(fortheMEAS_Scommand).**B*‡Theindividualcommand-processing‚routines‚all‚use‚a‚common‚exitG*‚routine‚to‚ensure‚a‚uniform‚return‚conditionforsubroutineCOMMANDS.J*‚SubroutineCOMMANDSpreservesA6,A5,theSP,andthesystem‚byte‚of‚theJ*‚SR,‚and‚the‚subroutinereturnsitsstatuscodeinD0.BandinthestatusE*‚fieldoftheusertask's‚I/O‚command‚block.ƒAll‚other‚registers‚areK*‚subject‚to‚modificationandmaycontainmeaninglessvaluesuponreturnto*‚thecallingroutine.*C*‡Notewithcarethattheprocessoris‚at‚interrupt‚level‚zero‚whenM*‚subroutineCOMMANDSreceivescontrol,sosubroutineCOMMANDSandallofitsG*‚subordinateroutinesare‚subject‚to‚interrupts‚from‚the‚periodically-L*‚activated‚measurementroutineand/orfromthecompletionofanexternally-K*‚triggeredmeasurement.‚Theperiodically-activatedmeasurementroutine‚andK*‚the‚A/D‚interrupthandlermayaccessand/orchangevaluesintheCCB,andE*‚subroutineCOMMANDSmustbecarefullycodedwiththisfactinmind.  ?COMMANDSMOVE.LƒSP,SAVE_SP(A5)‰Savethe‚stack‚pointer‚so‚we‚can$*¦later‚abort‚at‚any‚level‚ofnested$*¦subroutines‚and‚easily‚restoreƒthe%*¦stack‚environment‚that‚existed‚when*¦thisroutinebeganexecution.-‰PAGEš#######################################2‰MOVE.LƒA5,A4’Set‚A4<--LOC(CCB)toindicatethat%*¦A4doesn't‚yet‚contain‚the‚physical)*¦memoryaddressoftheCMD_CODEfieldof'*¦theuser'sIOCB.‚SincetheIOCB‚can't)*¦possiblybeatthesamephysicalmemory(*¦locationwheretheCCBresides,we‚can'*¦later‚compare‚A4toA5tofindoutif)*¦A4hasbeensettocontainthephysical)*¦memoryaddressoftheCMD_CODEfieldof&*¦theuser'sIOCB.‚AslongasA4‚=‚A5,)*¦weknowthatA4doesn'tyetcontainthe&*¦addressoftheCMD_CODE‚field‚of‚the'*¦IOCB.ƒAfterA4=LOC(CMD_CODE[IOCB]),(*¦we'llbeabletouseA4toaddress‚the&*¦user's‚IOCB.ƒInparticular,we'llbe$*¦abletoaccess‚the‚IOCB‚to‚store‚a&*¦status‚code‚into‚theSTATUSfieldof *¦theIOCB. "*¨Thisstep‚and‚the‚next‚two‚steps%*¦should‚be‚done‚in‚orderwithnonew%*¦interveningsteps.ƒThe‚code‚remains(*¦sensitive‚untilA4hasbeensettoits#*¦finalvalue,LOC(CMD_CODE[IOCB]). 8‰MOVE.LƒXIOCPK(A2),D6ŠGetthephysical‚memory‚address‚of0‰MOVEQ.L‚#0,D5the‚IOCB‚for‚the‚command‚into‚A4.<‰MOVE.WƒXIOPLN(A2),D5ˆSubroutineLOGPHYconvertsthe‚logical2‰BSR†LOGPHYIOCB‚address(inD6.L)intoaphysical2‰MOVE.LƒD6,A4addressforus.‚Wemust‚call‚subrou-$*¦tine‚LOGPHY‚with‚A6‚containing‚the)*¦physicaladdressoftheTCBofthetask(*¦that‚ownstheIOCB,andwemustsetup'*¦D5.Ltospecifythelength‚(in‚bytes)(*¦oftheIOCB.‚Ifallgoeswell,subrou-)*¦tineLOGPHYreturnsthephysicalmemory*¦addressoftheIOCBinD6.L. %*¨Subroutine‚LOGPHY‚abortsprocessing$*¦iftheIOCB‚that‚we‚specify‚is‚not'*¦entirely‚within‚amemorysegmentthat)*¦belongstothetaskthatownstheIOCB.(*¦If‚thiserroroccurs,thefactthatwe(*¦setA4=A5abovewillpreventus‚from'*¦trying‚to‚storeastatuscodeintoan#*¦IOCBthatdoesn'tproperlyexist. #*¨Wemust‚execute‚one‚more‚critical(*¦step‚tosetA4toitsfinalvalue,and&*¦thenthissequence‚of‚critical‚steps*¦willbecomplete.-‰PAGEš#######################################3‰MOVEQ.L‚#0,D6’ClearD6.Lforgeneraluse,and‚then8‰MOVE.WƒD6,(A4)+initializetheSTATUSfieldoftheIOCB3LˆSET†STATUStozero.‚We'lllaterupdatetheleast-)*¦significantbyteoftheSTATUSfieldto(*¦reflecttheactualstatuscodethat‚we*¦wanttoreturntotheuser. %*¨As‚we‚cleartheSTATUSfieldofthe(*¦IOCBhere,wesimultaneouslysetA4‚to(*¦contain‚thephysicalmemoryaddressof(*¦theCMD_CODEfieldoftheIOCB.‚Nowwe&*¦can‚safely‚use‚A4withautodecrement%*¦addressing toupdate‚the‚LSB‚of‚the*¦STATUSfieldintheIOCB. "*¨Thisƒstep‚completes‚the‚critical&*¦sequenceofthreesteps‚that‚must‚be'*¦done‚in‚orderwithnointerveningnew"*¦steps.ƒNow‚we‚can‚safely‚use‚the)*¦commonexitroutinewheneverwewantto *¦exitfromsubroutineCOMMANDS. 7‰MOVEQBƒSTATCBLN,D0ŒIfthespecifiedlengthof‚the‚IOCB:‰SUBQ.Lƒ#IOCB_MIN,D5‰is‚shorter‚thantheminimumallowable4‰BLO.S„CMDEXIT2lengthforan‚IOCB,‚abort‚processing-‰LSR.L„#1,D5andƒreturnƒan‚error‚status‚code.5‰MOVE.LƒD5,D4Otherwise,setbothD5.LandD4.Lequal$*¦to‚the‚number‚of‚words‚(notbytes)(*¦remainingintheIOCBaftertheend‚of(*¦theCMD_CODEfield.‚We'lllateruseD5(*¦andD4ascounterswhenweprocess‚the(*¦remainingfields(ifany)oftheIOCB. 8‰MOVEQBƒISTACDN,D0IftheA/Dchannelisdown,goreturn7‰TST.B„AD_DOWN(A5)Šanerrorstatusto‚indicate‚that‚the5‰BNE.S„CMDEX2AŽA/D‚channelisoutofservicefornow.$*¦Although‚we‚could‚process‚OPEN‚and(*¦CLOSE‚commandsforadeadA/Dchannel,&*¦wechoosetoreject‚all‚A/D‚commands*¦forthesakeofconsistency.-‰PAGEš#######################################1‰TST.B„BAD_INT(A5)ŒIf‚we‚have‚receivedƒaƒspurious0‰BEQ.S„L9“interrupt‚fromtheA/Dconverterboard(*¦andhaven'tyetreportedit,clear‚the8‰CLR.B„BAD_INT(A5)Šbad-interrupt‚flag,‚abortthecurrent4‰MOVEQBƒSTATBINT,D0Šcommand,‚andƒreportƒtheƒspurious‚32,767‚(i.e.,‚$7FFF)&*¦because‚the‚processor‚interpretsthe(*¦valueinD2.Wasasignednumber‚here.&*¦We‚could‚easily‚avoidthispotential'*¦errorbyaddingjust‚one‚instruction,(*¦but‚theoffsetvalueinD2.Wisnotat'*¦alllikelytoexceed32,767.‚The‚size&*¦of‚the‚entire‚driver(initsinitial)*¦release)issmallerthan$500bytes,so&*¦an‚offset‚in‚excessof32,767isnot'*¦possibleunlessthedriver‚changes‚by"*¦morethananorderofmagnitude.+‰TTL†5.2.1.‚OPEN_CMDRoutine(OPENCommand)-‰PAGEš#######################################N*******************************************************************************Ì*@*ˆTheremainingpartofthisprogramisnotcommentedyet.‚Any‡*A*ˆcommentsthatexistbeyondthispointarescratchcommentsor‡**ˆpreliminarycomments.¯**Ì*N****************************************************************************** 4*ˆOPENCommand.‚ControlentersatlocationOPEN_CMD. %*†#A6=LOC(TCBofrequestingtask).*†#A5=LOC(CCB).%*†#A4=LOC(CMD_CODEfieldinIOCB).*†#A3=LOC(DUPETBL).*†#A2=LOC(MSBDATA).*†#A1=LOC(CNFIELDinIOCB)./*ˆA0=LOC(Channelblockforselectedchannel). *ˆD7.L= *†#D6.L=0.2*†#D5.L=NumberofwordsafterCMD_CODEinIOCB.2*†#D4.L=NumberofwordsafterCMD_CODEinIOCB. *†#D3.L=0.*ˆD2.L=Scratch.*ˆD1.L=Scratch.*ˆD0.L=Scratch.  8L12†BSR†VALID_CNValidatenextchannelnumber,andpoint'*¦A0toitschannelblock.‚Alsoadvance'*¦A1topointtofollowingchannelnum. ‰MOVEQBƒSTATOPEN,D0'‰TST.L„TCB_ADDR(A0)‰Isitalreadyopen?,‰BNE.S„CMDEXIT2Error:‚Channelalreadyopen. 7OPEN_CMDDBRA…D5,L12Loopuntilallchannelsprocessed. ,‰BRA.S„L14’Noerrorsinanychannelnumbers.    ,L13†MOVE.Wƒ-(A1),D1Getnextchannelnumber. LˆSET†CNFIELD(‰BSR†CNLBLKADPointA0tochannelblock.9‰MOVE.LƒA6,TCB_ADDR(A0)†Openchannelforrequestingtask./L14†DBRA…D4,L13Loopuntilallchannelsopened.‰TTL†5.2.2.‚CommonExitRoutine-‰PAGEš#######################################?*ˆCommonexitroutine.‚Controlfallsinfromaboveinonecase. %*†#A6=LOC(TCBofrequestingtask).*†#A5=LOC(CCB).1*†#A4=LOC(CMD_CODEfieldinIOCB)orLOC(CCB). &*ˆSTATUSwordinIOCBiszeroalready. /CMDEXIT1MOVEQBƒISTAOK,D0ŒD0.B<--Statuscode.    ,*ˆSecondentrypointtocommonexitroutine. *†#D0.B=Statuscode. 8CMDEXIT2CMP.L„A4,A5’IfA4=A5,thenA4hasn'tyetbeen2‰BEQ.S„CMDEXIT3settocontainthephysicalmemory&*¦addressoftheCMD_CODEfieldofthe&*¦IOCB.‚Inthiscase,wehaveprobably)*¦abortedprocessingbecausetheIOCBwas(*¦improperlyspecified,andweobviously$*¦can'tstoreastatuscodeintothe"*¦STATUSfieldoftheerroneously-#*¦specifiedIOCB.‚Thecheckthatwe(*¦performherepreventsusfrommakinga&*¦wildstoreintoarandomlocationof *¦memory. 3‰MOVE.BƒD0,-(A4)Putthe8-bitstatuscodeintothe1LˆSET†STATUSleast-significantbyteoftheSTATUS(*¦wordinth  eIOCB.‚Themost-significant)*¦byteoftheSTATUSwordiszerobecause'*¦wecleareditatthebeginningofthe *¦command-processingsubroutine. DCMDEXIT3MOVE.LƒSAVE_SP(A5),SP‰Restorethestackpointer,andreturn'‰RTS›controltotheroutinethatcalled&*¦subroutineCOMMANDS.‚Thestatuscode(*¦isinD0.Basrequired.‚Noticethatwe&*¦canusethisreturnroutinetoabort&*¦processingfromanylevelwithinthe$*¦commandserviceroutinebecausewe(*¦restorethestackpointertothevalue&*¦thatithadwhensubroutineCOMMANDS$*¦beganexecutionatitsmainlevel. #*¨Ourhandlingofthestackpointer'*¦appearstoeliminatere-entrancy,but'*¦theA/Ddriverisstillre-entrantin'*¦thenecessarycontextbecausesubrou-%*¦tineCOMMANDScanneverbecalleda(*¦secondtimefromausertaskexecuting)*¦atinterruptlevelzerountilwereturn*¦controlfromthefirstcall. $*¨SubroutineCOMMANDScanacceptre-'*¦entrantcallsforanotherA/Dchannel'*¦becauseeachchannelhasitsownCCB.+‰TTL†5.2.3.‚STOP_CMDRoutine(STOPCommand)-‰PAGEš#######################################?*ˆCLOSECommandandSTOPCommand.‚Firstpartiscommontoboth. %*†#A6=LOC(TCBofrequestingtask).*†#A5=LOC(CCB).*†#A4=LOC(CMD_CODEinIOCB).*†#A3=LOC(DUPETBL).*†#A2=LOC(MSBDATA).*†#A1=LOC(CNFIELDinIOCB)./*ˆA0=LOC(Channelblockforselectedchannel). *ˆD7.L=4*†#D6.L=0.‚WesetD6.L<---1foraSTOPcommand.2*†#D5.L=NumberofwordsafterCMD_CODEinIOCB.2*†#D4.L=NumberofwordsafterCMD_CODEinIOCB. *†#D3.L=0.*ˆD2.L=Scratch.*ˆD1.L=Scratch.*ˆD0.L=Scratch. :STOP_CMDMOVEQ.L‚#-1,D6SetflagtoindicateSTOPcommand. ,‰TTL†5.2.4.‚CLOSECMDRoutine(CLOSECommand)5CLOSECMDTST.L„D5“D5=0ifnochannelsspecified.‚In/‰BNE.S„L19’thiscasewecloseallopenchannels'*¦forthistask.‚Fallthroughtomakea)*¦listofallchannelsopentothistask.  L15†EQU†(MAXCNLS-1)*CNLBLKSZ6‰LEA†CNLBLK+L15(A5),A0„PointA0tolastchannelblock.7‰MOVEQWƒMAXCNLS-1,D0‰Channelnumberoflastchanneland *¦channelcounttocontrolloop.  *ˆFirstpassthroughthechannelblock(s)oftheIOCBforboth1*ˆsingle-endedanddifferentialMEASUREcommands. %*†#A6=LOC(TCBofrequestingtask).*†#A5=LOC(CCB).*†#A4=LOC(CMD_CODEinIOCB).*†#A3=LOC(DUPETBL).@*ˆA2=LOC(Currentfieldinchannelblockforselectedchannel).**†#A1=LOC(FirstchannelblockinIOCB)./*ˆA0=LOC(Channelblockforselectedchannel). *ˆD7.L=%*ˆD6.L=Scratch.‚AddressforLOGPHY.'*ˆD5.L=ScratchƒBytecountforLOGPHY.I*†#D4.L=NumberofwordsafterbeginningoffirstchannelblockinIOCB*>0.+*†#D3.L=+0forsingle-endedmeasurement."*-1fordifferentialmeasurement.I*†#D2.L=NumberofwordsafterbeginningoffirstchannelblockinIOCB*>0.B*ˆD1.L=Scratch.‚Weuseitforchannelnumberofcurrentchannel.*ˆD0.L=Scratch.  @MEAS_LP1SUBQ.Wƒ#CHNBLKSZ/2,D2‰IftheremainingpartoftheIOCB1‰BHS.S„L23’containsenoughwordstoaccommodatea)*¦fullchannelblock,goprocessthenext*¦channelblock. :‰ADDQ.Wƒ#CHNBLKSZ/2,D2‰Ifwe'vefinishedprocessingallof3‰BEQ.S„MEAS_PS2thewordsoftheIOCB,gostartthe!*¦secondpassthroughthechannel*¦block(s)oftheIOCB. " '*¨Otherwise,wehaveanIOCBthatisn't)*¦formattedcorrectlysinceitcontainsa&*¦partialchannelblockatitsend.‚In(*¦thiscase,controlfallsintothenext'*¦routine,whichreportsanIOCBerror. AIOCB_ERRMOVEQBƒSTATIOCB,D0ŒGetthestatuscodethatindicatesan&*¦IOCBthatisn'tcorrectlyformatted.)*¦We'vefoundthatthelengthoftheIOCB&*¦doesn'tmatchupwiththepredefined&*¦IOCBtemplateforaMEASUREcommand. 6MEAS_ERRBRA†CMDEXIT2AbortprocessingfortheMEASURE'*¦command,andreporttheerrorthatis'*¦indicatedbythestatuscodeinD0.B.%*¦Controlbranchestothiserrorexit)*¦fromseveraldifferentplacestoreport*¦varioustypesoferrors. 6L23†MOVEQ.L‚#0,D6’ClearD6.Ltoindicatethatwedon't5‰BSR†VALIDATEallowthespecifiedmeasurementchannel(*¦tobepreviouslyactive,andthencall%*¦subroutineVALIDATEtovalidatethe)*¦channelnumberthatisaddressedinthe'*¦IOCBbyA1.‚SubroutineVALIDATEmakes(*¦severalvaliditychecksonthechannel'*¦number,anditabortsprocessingwith'*¦anerrorreportifitfindsanerror.(*¦IfsubroutineVALIDATEdoesn'tfindan)*¦error,itreturnsthespecifiedchannel&*¦numberinD1.W.‚Also,thesubroutine(*¦advancesA1topointtothenextfield'*¦ofthechannelblockintheIOCB,and'*¦itpointsA0totheCCBchannelblock(*¦forthespecifiedmeasurementchannel. 7‰LEA†CNL_CMPL(A0),A2ˆPointA2tothechannel-completion(*¦fieldoftheCCBchannelblockforthe&*¦specifiedmeasurementchannel.‚We'll)*¦useA2withautoincrementaddressingto)*¦accessseveralofthefieldsintheCCB*¦channelblock. %*¨We'llsavethepointertothefirst&*¦byteoftheCCBchannelblockinA0.&*¦Attheendofthefirstpassthrough&*¦thechannelblock(s)oftheIOCB,A0)*¦willpointtotheCCBchannelblockfor(*¦thelastmeasurementchannelselected,)*¦andwe'llusethatpointervalueduring)*¦thefirstiterationofthesecondpass. ‰MOVE.Wƒ(A1)+,D0 LˆSET†CHN_CMP‰MOVE.WƒD0,(A2)+LˆSET†CNL_CMPL ‰ROL.B„#7-SUBR_B,D0 ‰BPL.S„L24 1‰SUBQ.Wƒ#2,D22wordsforthesubroutineaddress.‰BLO.S„IOCB_ERR ‰MOVE.Lƒ(A1)+,D6 LˆSET†SUBRTNE6‰MOVEQ.L‚#2,D5Minimumpossiblelengthforsubroutine. ‰BSR†LOGPHY 0L24†MOVE.LƒD6,(A2)+Physicalsubroutineaddress. LˆSET†SUBRTN ‰MOVE.Lƒ(A1)+,D6 LˆSET†BUFFER‰MOVE.Wƒ(A1)+,D5 LˆSET†BUFSZ ‰BSR†LOGPHY‰MOVE.LƒD6,(A2)+LˆSET†BUF_ADDR ‰CLR.W„(A2)+LˆSET†BUF_PNTR ‰MOVEQBƒEXTTRG+PGA,D0.‰AND.W„(A1)+,D0Ignoreallbutthosetwobits.LˆSET†TRIGGAIN ‰AND.B„#MUX+CNLSEL,D1‰ADDQ.Bƒ#MUX07,D1 ‰OR.B…D1,D0 ‰MOVEQBƒMUX815+MUX07,D14‰AND.B„D3,D1D3=$FFIFDIFFERENTIAL,$00ifsingle ‰OR.B…D1,D0 ‰MOVE.BƒD0,(A2)+LˆSET†CTRL_VAL ‰ROL.B„#7-EXTTRG_B,D0‰BPL.S„MEAS_LP1 ‰ST.B…ET_FLG_S(SP) ‰TST.B„MEAS_CNT(A5)‰BEQ.S„MEAS_LP1 ‰MOVEQBƒSTATBUSY,D0‰BRA.S„MEAS_ERR4‰TTL†5.2.5.3.‚SecondPassthroughtheChannelBlocks-‰PAGEš#######################################?*ˆSecondpassthroughthechannelblock(s)oftheIOCBforboth1*ˆsingle-endedanddifferentialMEASUREcommands. %*†#A6=LOC(TCBofrequestingtask).*†#A5=LOC(CCB).*†#A4=LOC(CMD_CODEinIOCB).5*†#A3=LOC(DUPETBL).‚Availableforscratchusenow.*ˆA2=;*ˆA1=LOC(CurrentfieldofcurrentchannelblockinIOCB).E*†#A0=LOC(Channelblockforselectedchannel).‚Initiallypointsto>*CCBchannelblockforlastselectedmeasurementchannelfrom *firstpass. *ˆD7.L=*ˆD6.L=Scratch.*ˆD5.L=ScratchI*†#D4.L=NumberofwordsafterbeginningoffirstchannelblockinIOCB*>0.+*†#D3.L=+0forsingle-endedmeasurement."*-1fordifferentialmeasurement.*ˆD2.L=Scratch.B*ˆD1.L=Scratch.‚Weuseitforchannelnumberofcurrentchannel.*ˆD0.L=Scratch.  "MEAS_PS2MOVE.Bƒ(SP)+,EXT_TRIG(A5)LˆSET†ET_FLG_S‰ADDQ.Bƒ#1,MEAS_CNT(A5)8‰MOVE.Lƒ(SP)+,A1PointA1tofirstchannelblockinIOCB# LˆSET†CBADDR_S MEAS_LP2MOVE.Wƒ(A1)+,D1 LˆSET†CHN_NUM>‰MOVE.BƒD1,CNL_PTR(A0)‡Pointpreviouschannelblocktocurrent‰BSR†CNLBLKADone. ‰MOVE.Wƒ(A1)+,D0 LˆSET†CHN_CMP‰ROL.B„#7-SUBR_B,D0 ‰BPL.S„L25 +‰SUBQ.Wƒ#2,D42WORDSFORSUBROUTINEFIELD.+‰ADDQ.Lƒ#4,A14BYTESFORSUBROUTINEFIELD. L25†EQU†*L26†EQU†BUFSZ-BUFFERC‰MOVE.WƒL26(A1),BUF_SIZE(A0)Themeasurementchannelisnowactive. ‰ADDQ.Lƒ#CHNBLKSZ-BUFFER,A1 ‰SUBQ.Wƒ#CHNBLKSZ/2,D4‰BHI.S„MEAS_LP2"‰TTL†5.2.5.4.‚FinalCommandSet-Up-‰PAGEš#######################################F*ˆNowsetupthecommandvariablesinthechannelblockforthemaster*‚measurementchannel.  4‰MOVE.BƒCNL_PTR(A0),D1‡TophalfofD1.W=0already.'‰BSR†CNLBLKADPointA0totopofchain.‰LEA†CNL_PTR(A0),A2 3‰TAS.B„(A2)+Marktopofchainbysettingsignbit. LˆSET†CNL_PTR ‰MOVE.Wƒ(SP)+,(A2)+ LˆSET†COMPL_SLˆSET†CMD_CMPL ,‰MOVE.Lƒ(SP)+,A1Delta-T-->A1.‚(ForRQPA).LˆSET†DELTAT_S ‰MOVE.Wƒ(SP)+,D1 LˆSET†R_CNT_S‰MOVE.WƒD1,(A2)+ LˆSET†RPT_CNT ‰MOVE.LƒA4,(A2)+LˆSET†IOCB_ADR 1‰ST.B…(A2)+’Settheflagthatsayswehaven'tyet3LˆSET†NORQPArequestedaperiodicactivationofthe$*¦periodically-activatedmeasurement'*¦routineforthiscommand.‚We'lllater&*¦cleartheNORQPAflagifwesuccess-(*¦fullyrequestaperiodicactivationof(*¦theperiodically-activatedmeasurement*¦routineforthiscommand. 2‰MOVE.WƒSR,D0’GettheSRvalueintoD0.W,andsave6‰MOVE.WƒD0,-(SP)acopyofitonthestacksowe'llbe&*¦abletorestorethepresentSRvalue*¦later. =‰AND.W„#$FFFF-INT_MASK,D0…Cleartheinterrupt-levelbitsfrom8‰OR.W…CCBISR(A5),D0ˆtheSRvalue,andsettheinterrupt-2‰MOVE.WƒD0,SRlevelbitstotheinterruptlevelof'*¦theA/Dconverterboard.‚Thenputthe&*¦updatedSRvalueintotheSRtomask&*¦interruptsattheleveloftheboard&*¦withoutchanginganyoftheotherSR$*¦bits.‚Wetakeextrastepstoavoid&*¦changinganyoftheSRbitsthatare&*¦presentlyundefinedbecausethoseSR$*¦bitsmighthavemeaningsinfuture!*¦processorsinthe68000family. #*¨Wemustmaskinterruptsbeforewe'*¦issuetheRQPAexecutiverequest(see%*¦below)sowecanguaranteethatthe$*¦periodically-activatedmeasurement&*¦routinewon'tbeactivatedbeforewe$*¦performthefirstexectuionofthe&*¦measurementroutineourselves.‚Also,#*¦interruptsmustbemaskedwhenwe)*¦executethemeasurementroutinebecause'*¦themeasurementroutinehasnowayto*¦maskinterruptsattheboard. ‰SUBQ.Wƒ#1,D1+‰BEQ.S„L28’Repeatcount=1.ƒTheIMMEDflag *¦doesn'tmatterifRPT_CNT=1. #‰MOVE.LƒA1,D0TestDelta-T(inA1).%‰SEQ.B„(A2)‘A2remainsatLOC(IMMED). LˆSET†IMMED‰BEQ.S„L28’DeltaT=0. 1‰MOVE.LƒA0,D2D2<--LOC(CNLBLKinCCB)forRQPA.!‰LEA†MEAS_PA(PC),A0‡LOC(ROUTINE). ACTIVATEEQU†0<<15REPEATƒEQU†1<<14‰MOVEQWƒACTIVATE+REPEAT,D1‰MOVE.BƒCCBPPRIO(A5),D1‰MOVE.Lƒ#T0RQPA,D0‰TRAP…#EXECDestroysD0,D1.‰BRA.S„L27’OK. )‰MOVE.LƒD2,A0NotOK.‚LOC(CNLBLK)-->A0.*‰BSR†STOP1Stopmeasurementsjuststarted. ‰MOVEQBƒSTATRQPA,D0‰BRA.S„L29’GotoCMDEXIT2. 5L27†CLR.B„-(A2)’We'vesuccessfullyrequestedperiodic,LˆSET†NORQPAactivationoftheperiodically-(*¦activatedmeasurementroutineforthis'*¦command,socleartheNORQPAflag.‚By&*¦clearingtheNORQPAflagweindicate%*¦thatthereisaperiodicactivation)*¦activeforthiscommand,andwe'llknow'*¦tostopthatperiodicactivationwhen(*¦wecomplete(orstop)themeasurements*¦forthecommand. !‰MOVE.LƒD2,A0LOC(CNLBLKinCCB). =L28†MOVEQ.L‚#T0QEVNTT,D6‹Getthecodethatweuseforqueuing$*¦aneventfromaroutinethatisn't)*¦beingexecutedasaninterrupthandler. 1‰BSR.S„MEAS_RTNCallthemeasurementroutine.‚The&*¦measurementroutinereturnsastatus*¦valueinD0.W. #L29†MOVE.Wƒ(SP)+,SRRestoretheSR. ‰BRA†CMDEXIT2,‰TTL†5.2.5.5.‚MEAS_RTN(MeasurementRoutine)# -‰PAGEš#######################################D*ˆInterruptsmustbemaskedthroughoutthisroutine.‚Thisroutineis*ˆnotre-entrant. *†#A5=LOC(CCB).*ˆA3=LOC(BUFFER).*ˆA2=LOC(MSBDATA).*ˆA1=Scratch.#*†#A0=LOC(ChannelblockinCCB). *†#D6.L=T0QEVNTIorT0QEVNTT.*ˆD5.W=Statuscode.*ˆD4.L=ScratchinSTOP1.*ˆD3.B=ScratchinSTOP1. *ˆD2.B=CTRL_VAL(A0)initially.1*ˆD2.L=Bufferoffsetlater.‚(Tophalfiszero.)3*ˆD1.W=Measurementresult;later,channelnumber.**ˆD0.L=Scratch.‚D0.W=Statusonreturn.  MEAS_RTNMOVE.LƒCCBCHB(A5),A2 >MEAS_NXTMOVEQ.L‚#0,D1We'lldependonbyte1ofD1beingzero5‰MOVE.BƒCTLOFFST(A0),D1†bothhereandlater(atL52).9‰MOVE.BƒCTRL_VAL(A0),D2†GetCTRL_VALandkeepitinD2.B.2‰MOVE.BƒD2,CONTROL(A2,D1.W)‚Startthemeasurement. L43†EQU†8+10‘Cyclesperloop.D1.W.‰MOVE.LƒBUF_ADDR(A0),A3‰MOVEQ.L‚#0,D2‰MOVE.WƒBUF_PNTR(A0),D27‰MOVE.WƒD1,0(A3,D2.L)ˆResult-->buffer.‚WeuseD2.Lto*¦avoidsignextensionofD2.W. ‰MOVE.WƒCNL_CMPL(A0),D0‰BTST.Lƒ#SUBR_B,D0‰BEQ.S„L48’Nosubroutine. ‰MOVE.LƒSUBRTN(A0),A1‰JSR†(A1)‘Callthesubroutine. L48†ADDQ.Wƒ#2,D2‰CMP.W„BUF_SIZE(A0),D2 ‰BLO.S„L49‰MOVEQ.L‚#0,D21L49†MOVE.WƒD2,BUF_PNTR(A0)†Updatebufferpointer. *‰BSR.S„WAKEUPIssuewakeupifappropriate. ‰MOVEQ.L‚#MEAS_TYP,D2 ‰BSR.S„QEVENT ‰MOVEQ.L‚#CP_MASK,D1‰AND.B„CNL_PTR(A0),D1-‰BSR†CNLBLKADPointA0tonextchannelblock. ‰TST.B„CNL_PTR(A0)!‰BPL†MEAS_NXTNotmasterchannel.  ‰MOVEQ.L‚#0,D5Goodstatus. ‰TST.W„RPT_CNT(A0)‰BEQ.S„L50’0=infinity. ‰SUBQ.Wƒ#1,RPT_CNT(A0) ‰BEQ.S„L53 L50†TST.B„IMMED(A0)!‰BNE†MEAS_NXTRepeatimmediately.-‰BRA.S„L55’Returnwithgoodstatus.‚We'llget&*¦activatedagainbythenextperiodic *¦activation.  L51†BSR†CNLBLKAD@L52†MOVE.BƒCNL_PTR(A0),D1‡Byte1ofD1=0alreadyfromearlier. ‰BPL.S„L51 L53†MOVE.WƒCMD_CMPL(A0),D0,‰BSR.S„WAKEUPIssueawakeupifappropriate. ‰MOVEQ.L‚#CMPL_TYP,D2 ‰MOVE.WƒD5,D1 ‰BSR.S„QEVENT ‰LSR.W„#EVENT_B+1,D0 ‰BCS.S„L54 ‰MOVE.LƒIOCB_ADR(A0),A1‰MOVE.WƒD5,-(A1) LˆSET†STATUS L54†BSR.S„STOP1 L55†MOVE.WƒD5,D0‰RTS‰TTL†5.2.5.6.‚SubroutineWAKEUP-‰PAGEš#######################################*ˆSubroutineWAKEUP ;*†#A0=LOC(Channelblockforcurrentmeasurementchannel) *†#D0.W=completioncode. +*ˆWepreserveallregistersexcepttheCCR.  WAKEUPƒEQU†*WU_REGS‚REG†A0/D0‰MOVEM.L‚WU_REGS,-(SP) ‰LSR.W„#WAKEUP_B+1,D0 ‰BCC.S„L56 ‰MOVEQ.L‚#T0WAKEUP,D0‰MOVE.LƒTCB_ADDR(A0),A0 ‰TRAP…#EXEC L56†MOVEM.L‚(SP)+,WU_REGS‰RTS‰TTL†5.2.5.7.‚SubroutineQEVENT-‰PAGEš#######################################*ˆSubroutineQEVENT *†#A5=LOC(CCB).*†#A0=LOC(ChannelBlock). "*†#D6.L=ExecutiveRequestCode.*†#D2.L=Eventtype.-*†#D1.W=Statuscodeormeasurementresult.*†#D0.W=Completionoption.  QEVENTƒEQU†* !QREGS„REG†D0-D3/D5-D7/A0-A1/A3-A5‰MOVEM.L‚QREGS,-(SP) ‰MOVE.WƒD0,D3Completionoption.‰LSR.W„#EVENT_B+1,D0‰BCC.S„L59’Noeventrequested. ‰SWAP…D30‰MOVE.WƒD1,D3Statuscodeormeasurementresult. ‰ROL.W„#8,D2 L57†EQU†ELENGTH<<24L58†EQU†ECODE<<16 ‰OR.L…#L57+L58+EDRVCD,D2 ‰MOVE.LƒD6,D0$ ‰MOVE.LƒTCB_ADDR(A0),A0 ‰TRAP…#EXEC#‰NOP›Good.‚BRA.SL59inthefuture.)*ˆ—Bad.‚Fornow,justignorethat. L59†MOVEM.L‚(SP)+,QREGS‰RTS‰TTL†5.2.6.‚CommonSubroutines‰TTL†5.2.6.1.‚SubroutineSTOP-‰PAGEš#######################################6*ˆStopthemeasurementsspecifiedbytheSTOPcommand.-*ˆControlentersatSTOP2foraSTOPcommand.0*ˆControlentersatSTOP1foraMEASUREcommand.@*ˆInterruptsaremaskedattheleveloftheA/Dconverterboard. *†#A5=LOC(CCB).*ˆA3=-*†#A2=LOC(MSBDATA).‚WesetthisforSTOP1.*†#A1=LOC(lastCNFIELD)+2./*ˆA0=LOC(Channelblockforselectedchannel). *ˆD7.L=*ˆD6.L=*ˆD5.L=C*†#D4.L=NumberofwordsafterCMD_CODEinIOCB.‚Set0forSTOP1.H*†#D3.B=+0initiallytoindicatethatnoactiveMEASUREcommandshave*’beenstopped.:*Nonzerolaterifweactuallystopanactivemeasurement.;*InitiallyrandomforSTOP1.‚Weknowwe'llstopsomething.*ˆD2.L=Scratch.*ˆD1.L=Scratch.*ˆD0.L=Scratch.  6STOP1„MOVE.LƒSP,A1Topreventbuserroronaccesswith*¦-(A1). ‰MOVE.LƒCCBCHB(A5),A2*‰MOVEQ.L‚#0,D4Clearcountfornorepeats. 0L30†CLR.W„ACTIVE(A0)‹Markthischannelinactive. )‰MOVEQ.L‚#0,D1TocleartophalfofD1.W.<‰MOVE.BƒCNL_PTR(A0),D1‡Getchannelnumberofnextchannelin0‰BPL.S„L32’thisgroup.‚Branchunlessthecurrent&*¦channelisthemasterchannelofthe*¦group. 1‰MOVE.BƒD1,D3SavepointertonextchannelinD3.%*¦NoticethatD3.B<>0nowsincethe*¦signbitisset. 6‰TST.B„NORQPA(A0)Skipifthemeasurementsequencefor+‰BNE.S„L31’thiscommandwasn'tperiodically *¦activated. 3‰MOVEQ.L‚#-1,D1Bit15saysdeactivateroutine;all*¦otherbitsignored./‰MOVE.LƒA0,D2Pointertocurrentchannelblock.9‰MOVEQ.L‚#T0RQPA,D0‹CodeforRequestPeriodicActivation.,‰TRAP…#EXECRequestdeactivationofroutine.(‰NOP›Goodreturn.‚Nosuchthingasabad#*¦return,sowemergegoodandbad.*¦DestroysD0andD1.-‰PAGEš#######################################*†#D6.L=+0ifselectedchannelisnotallowedtobeactive.*-1otherwise.*ˆD5.L=*ˆD4.L=*ˆD3.L=*ˆD2.L="*ˆD1.W=ChannelNumberonreturn.*ˆD0.L=Scratch.  >VALIDATEBSR.S„VALID_CNValidatenextchannelnumberandpoint'*¦A0toitschannelblock.‚Alsoadvance*¦A1topointtonextword. ‰MOVEQBƒSTATNOPN,D08‰CMP.L„TCB_ADDR(A0),A6†Isthechannelopentothistask?#‰BNE.S„CMDEX2BŽNo.‚Reportanerror. )‰TST.L„D6“SkiptheactivetestforaSTOP‰BNE.S„L38’command. ‰MOVEQBƒSTATACTV,D04‰TST.W„ACTIVE(A0)‹Isthechannelactive(measuring)?4‰BNE.S„CMDEX2BŽYes.‚Reportanerror.‚Can'tcloseit. L38†RTS!‰TTL†5.2.6.3.‚SubroutineVALID_CN-‰PAGEš#######################################*ˆSubroutineVALID_CN *†#A5=LOC(CCB).%*†#A4=LOC(CMD_CODEfieldinIOCB).*†#A3=LOC(DUPETBL).9*†#A1=LOC(Channel-numberword).‚Incrementedonreturn.-*ˆA0=LOC(SelectedChannelBlock)onreturn. 9*ˆD1.W=ChannelNumberonreturn.‚OnentryforCNLBLKAD.*ˆD0.L=Scratch.  >VALID_CNMOVE.Wƒ(A1)+,D1GetnextchannelnumberintoD1.WandLˆSET†CNFIELDŽadvanceA1. LˆSET†CHN_NUM ‰MOVEQBƒSTAT0_95,D0‰CMP.W„#MAXCNLS-1,D1*‰BHI.S„CMDEX2BŽError:‚ChannelNumber>95. ‰MOVEQBƒSTATDUPE,D0‰TAS.B„0(A3,D1.W) LˆSET†DUPETBL6CMDEX2B‚BNE.S„CMDEX2CŽError:‚Duplicatechannelnumber. ‰TST.B„DIFF_F(A5)"‰BEQ.S„CNLBLKADSingle-endedmode. ‰MOVEQBƒSTATDIFF,D0‰BTST.Lƒ#MUX_BIT,D13‰BNE.S„CMDEX2CŽInvaliddifferentialchannelnumber. CNLBLKADLEA†CNLBLK(A5),A0‰MOVEQWƒCNLBLKSZ,D0 ‰MULU…D1,D00‰ADD.L„D0,A0PointA0toselectedchannelblock. ‰RTSH‚TTL„5.2.6.4.‚SubroutineLOGPHY(Logical-to-PhysicalAddressConversion)-‰PAGEš#######################################*ˆSubroutineLOGPHY %*†#A6=LOC(TCBofrequestingtask). B*†#D6.L=LOC(Buffer)tobeconverted.‚Logicaladdresscomingin;*­physicaladdressgoingout.%*†#D5.L=Numberofbytesinbuffer. LOGPHYƒEQU†*LOG_REGSREG†D0-D5/D7/A0‰MOVEM.L‚LOG_REGS,-(SP) ‰MOVE.WƒD6,CCR"‰BCS.S„L39’Startsatoddlocation. ‰MOVE.WƒD5,CCR(‰BCS.S„L39’Containsoddnumberofbytes. ‰TST.L„D5‰BEQ.S„L39’Length=0. ‰MOVE.LƒTCBTST(A6),A0‰MOVE.Lƒ#T0LOGPHY,D0 ‰TRAP…#EXEC.‰BRA.S„L40’ValidphysicaladdressnowinD6.L.‰NOP7L39†MOVEQBƒISTAADD,D0‹Badbufferaddressand/orlength. 8CMDEX2C‚BRA†CMDEXIT2NoticethatA4andA5havenotbeen"*¦changed.‚Thevaluesofthesetwo)*¦registersareimportantinthecommand-(*¦exitroutine,andwemustneverbranch)*¦tothecommand-exitroutinewhileA4or*¦A5ismodified. '*¨Somecodeusesthebranchinstruction(*¦hereasasteppingstonetogettothe*¦command-exitroutine. L40†MOVEM.L‚(SP)+,LOG_REGS‰RTS2‰TTL†6.‚Periodically-ActivatedMeasurementRoutine-‰PAGEš#######################################-*ˆPeriodically-activatedmeasurementroutine. $*†#D0.L=Numberoftimeintervals.*†#D1.L=LOC(Channelblock).*ˆD2.L=UsedbyMEAS_RTN.*ˆD3.L=UsedbyMEAS_RTN.*ˆD4.L=UsedbyMEAS_RTN.*ˆD5.L=UsedbyMEAS_RTN.*ˆD6.L=T0QEVNTI. "*ˆA0=savedandrestoredbyexec."*ˆA1=savedandrestoredbyexec.*ˆA2=UsedbyMEAS_RTN.*ˆA3=UsedbyMEAS_RTN.*ˆA5=LOC(CCB). 8*†#SR=MaskedattheleveloftheA/Dconverterboard.  MEAS_PA‚EQU†*PA_REGS‚REG†D2-D6/A2-A3/A5‰MOVEM.L‚PA_REGS,-(SP)/‰MOVE.LƒD1,A0A0<--LOC(Masterchannelblock). /‰MOVEQ.L‚#0,D0A0-CNLBLK-CNL_NUM(A0)*CNLBLKSZ‰MOVE.BƒCNL_NUM(A0),D0‰MULU.Wƒ#CNLBLKSZ,D0‰LEA†-CNLBLK(A0),A5‰SUB.L„D0,A5A5<--LOC(CCB). ‰TST.B„ET_WAIT(A5)% )‰BNE.S„L60’WaitingonET.‚Skipthistime. ‰MOVEQ.L‚#T0QEVNTI,D6 ‰BSR†MEAS_RTN L60†MOVEM.L‚(SP)+,PA_REGS‰RTE‰TTL†7.‚InterruptHandler-‰PAGEš#######################################*ˆInterrupthandler !*ˆD0=SavedandrestoredbyCMR.*ˆD1=UsedbyMEAS_RD.*ˆD2=UsedbyMEAS_RD.*ˆD3=UsedbyMEAS_RD.*ˆD4=UsedbyMEAS_RD.*ˆD5=UsedbyMEAS_RD. !*ˆA0=SavedandrestoredbyCMR.!*ˆA1=SavedandrestoredbyCMR.*ˆA2=UsedbyMEAS_RD.*ˆA3=UsedbyMEAS_RD.*†#A5=LOC(CCB). B*†#SR=MaskedattheinterruptleveloftheA/Dconverterboard.  INTERUPTMOVE.LƒCCBCHB(A5),A1‰TST.B„MSBDATA(A1)ŠClearsSR.C. LˆSET†INTFF_B%‰BPL.S„L63’Notourinterrupt.‚Return. ‰TST.B„ET_WAIT(A5))‰BNE.S„L61’WaitingonET.‚Goodinterrupt. ‰ST.B…BAD_INT(A5)'‰TST.B„LSBDATA(A1)ŠClearbadinterrupt. ‰BRA.S„L62 L61†EQU†*INT_REGSREG†D1-D6/A2-A3‰MOVEM.L‚INT_REGS,-(SP)‰CLR.B„ET_WAIT(A5) 5‰MOVE.LƒCBPTR(A5),A0‰Pointertoactivechannelblock.&‰MOVE.LƒA1,A2PointertoLOC(MSBDATA).‰MOVEQ.L‚#T0QEVNTI,D6 ‰BSR†MEAS_RD ‰MOVEM.L‚(SP)+,INT_REGS L62†EQU†*CARRY„EQU†1<<0‰OR.B…#CARRY,CCRL63†RTS ééé'œ ?‰TTL†MVME-600andMVME-601Analog-to-DigitalI/ODriverProgram   /*ƒVV‡VVƒMM‡MMƒEEEEEEEEE„6666666…0000000…00000007*ƒVV‡VVƒMMM…MMMƒEEEEEEEEEƒ666666666ƒ000000000ƒ000000000(*„VV…VV„MMMMƒMMMMƒEEŠ66…66ƒ00„/00ƒ00„/00)*„VV…VV„MMMMMMMMƒEEŠ66Š00ƒ//00ƒ00ƒ//005*…VVƒVV…MM‚MMM‚MMƒEEEEEEEE„66666666„00‚//00ƒ00‚//004*…VVƒVV…MMƒMƒMMƒEEEEEEEE„666666666ƒ00//‚00ƒ00//‚00&*†VVVV†MM‡MMƒEEŠ66…66ƒ00//ƒ00ƒ00//ƒ00$*†VVVV†MM‡MMƒEEŠ66…66ƒ00/„00ƒ00/„003*‡VVV‡MM‡MMƒEEEEEEEEEƒ666666666ƒ000000000ƒ000000000+*ˆVˆMM‡MMƒEEEEEEEEE„6666666…0000000…0000000   *—AAAAAŽ//ƒDDDDDDDDD*–AAAAAAAŒ//„DDDDDDDDDD*•AA…AAŠ//†DD…DD*•AA…AA‰//‡DD…DD*•AAAAAAAAAˆ//ˆDD…DD*•AAAAAAAAA‡//‰DD…DD*•AA…AA†//ŠDD…DD*•AA…AA…//‹DD…DD*•AA…AA„//‹DDDDDDDDDD*•AA…AAƒ//ŒDDDDDDDDD   4*…DDDDDDDDD„RRRRRRRR„IIIIIIƒVV‡VVƒEEEEEEEEEƒRRRRRRRR7*…DDDDDDDDDDƒRRRRRRRRRƒIIIIIIƒVV‡VVƒEEEEEEEEEƒRRRRRRRRR*†DD…DDƒRR…RR…II†VV…VV„EEŠRR…RR*†DD…DDƒRR…RR…II†VV…VV„EEŠRR…RR-*†DD…DDƒRRRRRRRRR…II‡VVƒVV…EEEEEEEE„RRRRRRRRR+*†DD…DDƒRRRRRRRR†II‡VVƒVV…EEEEEEEE„RRRRRRRR*†DD…DDƒRR‚RRˆIIˆVVVV†EEŠRR‚RR*†DD…DDƒRRƒRR‡IIˆVVVV†EEŠRRƒRR-*…DDDDDDDDDDƒRR„RR„IIIIII‡VVV‡EEEEEEEEEƒRR„RR**…DDDDDDDDD„RR…RRƒIIIIIIˆVˆEEEEEEEEEƒRR…RR        E*ˆThisprogramisre-entrantandpositionindependent,‚anditcanrunF*ƒinaROMthat‚appears‚at‚anyconvenient‚location‚inthe68000memoryB*ƒspace.„Asingle‚copyofthe‚A/D‚drivercan‚controlany‚number‚of@*ƒMVME-600andMVME-601A/Dmeasurementchannelssimultaneously.‰TTL‡TableofContents‰PAGE*ŸTableofContents*I*‚1.‚Introduction...........................„4*I*‚2.‚Options,Macros,Equates,andDataStructures‚..........ƒ10*E*†2.1.‚MiscellaneousOptionsandE% quates‚.............ƒ11E*†2.2.‚MacroDefinitions‚.....................ƒ15E*†2.3.‚CMRParameterBlock‚....................ƒ22F*†2.4.‚IOCB(I/OCommandBlock)Structure.............ƒ27*š¡Aª-²(º*Â(Ê#Ò.Ú3â3ê6ò:ú:: 9 $"$*726:)B3J8R6Z;b5j<r:z9‚6Š7?*Œ2.4.1.‚IOCBOFFSETBlock‚.................ƒ28?*Œ2.4.2.‚CMD_CODE(Command-Code)Equates‚..........ƒ38@*Œ2.4.3.‚STATUSEquates...................ƒ39*E*†2.5.‚CCB(ChannelControlBlock)Structure‚...........ƒ46*@*Œ2.5.1.‚Universally-DefinedCCBFields...........ƒ47?*Œ2.5.2.‚CCBFieldsfortheA/DDriver‚...........ƒ53*0*”2.5.2.1.‚A/DCCBFieldsRelatingtoaComplete/*žMVME-600A/DConverterBoard.......ƒ543*”2.5.2.2.‚CCBChannelBlockforanA/DMeasurement.*žChannel‚.................ƒ60*F*†2.6.‚TCB(TaskControlBlock)Structure.............ƒ74E*†2.7.‚I/OEventStructure‚....................ƒ75E*†2.8.‚MVME-600andMVME-601MemoryLayout‚............ƒ79*?*Œ2.8.1.‚Memory-MappedI/OSpace‚..............ƒ79@*Œ2.8.2.‚ControlRegister..................ƒ82?*Œ2.8.3.‚OutputDataRegisters‚...............ƒ85@*Œ2.8.4.‚Channel-NumberEquates...............ƒ87*J*‚3.‚RequiredDriverTables......................ƒ90*F*†3.1.‚A/DServiceVectorTable..................ƒ91F*†3.2.‚ParameterTableforCMRParameters.............ƒ93F*†3.3.‚RevisionTable.......................ƒ94*I*‚4.‚InitializationSection(SubroutineINITIAL)‚...........ƒ95* *Â(Continued)*‰PAGE*™TableofContents,Continued*J*‚5.‚CommandServiceSection‚.....................‚101*F*†5.1.‚CommandSwitchingTable‚..................‚102F*†5.2.‚SubroutineCOMMANDS(CommandProcessor)‚..........‚104*@*Œ5.2.1.‚OPEN_CMDRoutine(OPENCommand)‚..........‚111@*Œ5.2.2.‚CommonExitRoutine‚................‚xxx@*Œ5.2.3.‚STOP_CMDRoutine(STOPCommand)‚..........‚xxxA*Œ5.2.4.‚CLOSECMDRoutine(CLOSECommand)..........‚xxx@*Œ5.2.5.‚MEAS_DandMEAS_SRoutines(MEASURECommands)‚...‚xxx*9*”5.2.5.1.‚InitialDecodingofHeaderSection....‚xxx8*”5.2.5.2.‚FirstPassthroughtheChannelBlocks‚..‚xxx9*”5.2.5.3.‚SecondPassthroughtheChannelBlocks..‚xxx9*”5.2.5.4.‚FinalCommandSet-Up...........‚xxx9*”5.2.5.5.‚MEAS_RTN(MeasurementRoutine)......‚xxx8*”5.2.5.6.‚SubroutineWAKEUP‚............‚xxx8*”5.2.5.7.‚SubroutineQEVENT‚............‚xxx*A*Œ5.2.6.‚CommonSubroutines.................‚xxx*8*”5.2.6.1.‚SubroutineSTOP‚.............‚xxx8*”5.2.6.2.‚SubroutineVALIDATE‚...........‚xxx8*”5.2.6.3.‚SubroutineVALID_CN‚...........‚xxx1*”5.2.6.4.‚SubroutineLOGPHY(Logical-to-Physical/*žAddressConversion)‚...........‚xxx*K*‚6.‚Periodically-ActivatedMeasurementRoutine............‚xxx*J*‚7.‚InterruptHandler‚........................‚xxx*K*‚8.‚Symbol-TableConcordance.....................‚xxx‰TTL‡1.‚Introduction‰PAGE*Ÿ1.‚Introduction*H*‡Thisprogram,whichiscommonlyknownastheA/Ddriver,istheRMS68KG*‚I/O‚driver‚for‚the‚MVME-600‚analog-to-digital‚converterboardandtheK*‚MVME-601analog-to-digitalexpanderboard.‚RMS68Kisthepopularname‚forI*‚the‚Real-Time‚Multitasking‚Software‚thatformsthekernelofMotorola'sL*‚real-timeoperatingsystemforprocessorsinthe68000family,andthe‚A/DI*‚driver‚runs‚in‚sup& ervisor‚modeasanextensionoftheRMS68Kexecutive.F*‚TheA/Ddriver‚provides‚the‚device-dependent‚portion‚of‚the‚softwareG*‚interface‚for‚any‚desired‚number‚of‚MVME-600A/Dconverterboardsand*‚MVME-601A/Dexpanderboards.*G*‡TheA/Ddriveriswrittenasare-entrantprogram,andtheprogram‚isL*‚alsowrittentobepositionindependent.‚Therefore,theobjectprogramforJ*‚theA/DdrivercanbeexecutedfromaROMthatappears‚at‚any‚convenientF*‚location‚in‚the‚68000‚address‚space,‚and‚theprogramcanbeexecutedM*‚re-entrantlysothatasinglecopyoftheA/DdrivercancontrolanynumberC*‚ofMVME-600andMVME-601A/Dmeasurementchannelssimultaneously.*E*‡Besides‚readingany‚further,‚thereadershouldcarefullyreviewthe)*‚hardwareuser'smanualfor‚the‚MVME-600F*‚A/D‚converter‚board‚and‚the‚MVME-601‚A/Dexpanderboard.‚ThatmanualG*‚describesbothboardsin‚detail,‚and‚it‚provides‚complete‚informationJ*‚regarding‚the‚jumpers‚andotherhardwareoptionsthatareavailablewithF*‚theboards.‚Thehardwaremanualfor‚the‚MVME-600‚and‚the‚MVME-601‚is*‚availableasfollows:*‰PAGEG*‚MVME600AnalogInputModuleMVME601A/DExpanderModuleUser'sManual(*‚ManualNumber:‚MICROSYSTEMSMVME600/D1*'*‚MotorolaSemiconductorProducts,Inc.*‚LiteratureDistribution*‚P.O.Box20912*‚Phoenix,Arizona‚85036*‚(602)994-6561**‰PAGEG*‡Thedriverislargelytabledriven,andmanyfuturemodifications‚canF*‚be‚made‚by‚simply‚changing‚table‚entries‚orbyaddingnewentriesto*‚existingtables.*B*‡Thesubroutinesinthe‚A/D‚driver‚are‚general-purpose‚in‚nature.J*‚Instead‚of‚being‚usedtothelimitsoftheircapabilitiesinthepresentG*‚versionofthedriver,they‚are‚flexible‚enough‚to‚perform‚additionalL*‚functionsthatmaybeneededinthefuture.‚SomesubroutinesmaybecalledI*‚fromonlyoneplace,buttheyarestillcoded‚as‚subroutines‚to‚provideL*‚modularity‚oforganizationandtomaketheirfunctionseasilyavailableto!*‚futuremaintenanceprogrammers.*A*‡Insteadofusing‚a‚complicated‚and‚error-prone‚method‚of‚makingJ*‚measurements‚under‚interrupt‚control,theA/DdriverusesasimplesenseD*‚looptomake‚normal‚measurements.ƒA‚measurement‚that‚is‚made‚underJ*‚sense-loop‚control‚requires‚only38microsecondsofsense-loopoverhead,H*‚andtheoverheadthatisrequiredto‚service‚a‚single‚interrupt‚easilyH*‚exceeds‚38‚microseconds.ƒTherefore,‚thedriveractuallysavestimeandF*‚improvesthroughputbyusinga‚simple‚sense‚loop‚instead‚of‚using‚anJ*‚interrupt-driven‚scheme‚formakingmeasurements.‚TheA/Ddriverdoes,ofI*‚course,useaninterrupt-drivenschemewhenthedriver‚wants‚to‚make‚an#*‚externally-triggeredmeasurement.*E*‡To‚promote‚readability‚andmaintainability,thefollowingstandards3*‚arecarefullyobservedthroughouttheA/Ddriver.*=*ŒAllinstructionsintheA/Ddriveraretypedinupper‚case,>*‡and‚comments‚are‚always‚typed‚inamixtureofuppercaseand%*‡lowercasetomaximizereadability.*<*ŒTabstopsintheA/Ddriverareincolumns10,19,‚40,‚and=*‡42,‚and‚the‚right-hand‚margin‚isincolumn78.‚Thesametab;*‡stops‚and‚the‚same‚right-hand‚margin‚are‚used‚religiously<*‡throughout‚the‚driver‚to‚ensure‚consistent‚formatting.‚The?*‡opcodefieldstartsatthetabstopin‚column‚10,‚the‚operand*‰PAGEB*‡field‚startsatthetabstopincolumn19,andthecommentfield=*‡startsatthetabstopincolumn40.‚We‚use‚the‚tab‚stop‚in:*‡column‚42‚to‚provide‚indentation‚for‚the‚first‚line‚ofaA*‡paragraphofcodecomments.‚Pleaserefertoanysectionof‚codeA*‡anywhere‚in‚theentireprogramlistingtoseehowcodecomments*‡areformatted.*<*ŒInstructionsthroughouttheA/Ddriverare‚carefully‚coded:*‡to‚prevent‚the‚operand‚field‚of‚an‚instruction‚from‚ever>*‡extendingintothecommentfield,‚which‚begins‚in‚column‚40.A*‡Where‚necessary,‚wedefinelabelsofalocalnaturetoallowusA*‡toshortenalongoperandfield& andtherebyprevent‚the‚operandA*‡field‚fromextendingintothecommentfield.‚Bymaintainingthe?*‡strictcolumnizationof‚non-overlapping‚fields‚throughout‚theA*‡entire‚program,‚wesignificantlyimprovethereadabilityofthe *‡listing.*;*ŒThecurrentversionofMotorola's‚68000‚assembler‚doesn'tC*‡supportlocallabels,soweuselabelsoftheformLj,Ljj,Ljjj,;*‡orLjjjjwhere‚local‚labels‚would‚ordinarily‚be‚used.ƒFor=*‡example,‚a‚label‚such‚as‚L1,‚L12,L123,orL1234intheA/D=*‡driverisalwaysalocallabelwithnoglobalsignificance.*6*ŒWeusethelabel"L"‚in‚a‚rather‚special‚way.ƒWhen‚aC*‡segmentofcodeusesanaddressingmodesuchasregister-indirect>*‡addressingtoaccessa‚variable‚without‚explicitly‚using‚theB*‡variable's‚label,weplaceaSETassemblerdirectiveimmediately:*‡afterthe‚code‚segment‚to‚set‚L‚temporarily‚equal‚to‚the?*‡variable's‚label.ƒWe‚don'treallycareaboutthevalueofthe?*‡labelL,butwedocareaboutthefact‚that‚the‚SET‚assemblerC*‡directivegeneratesaconcordanceentryforthevariable'slabel.A*‡Futuremaintenanceprogrammerswillconvenientlybeable‚to‚useC*‡theconcordancelistingtofindreferencestovariablesevenwhen6*‡thevariablenamesaren'tuseddirectlyinthecode.*E*‡Someofthelabelsthatareusedinthevarious‚I/O‚data‚structuresK*‚are‚non-mnemonic,‚andafewofthelabelsinthedatastructuresareevenL*‚anti-mnemonic.‚TheselabelshavebeencreatedbyanumberofpeopleastheH*‚operating‚system‚has‚grown‚over‚theyears,andtheselabelsarenowsoG*‚firmlyentrenchedthattheycan't‚reasonably‚be‚changed.ƒAlthough‚theK*‚labels‚in‚theI/Odatastructurescan'teasilybechanged,theA/DdriverL*‚doesatleastprovidecommentstoexplainthetruemeaningsofthe‚variousG*‚fieldsoftheI/OdatastructuresastheyareusedbytheA/Ddriver.*5‰TTL‡2.‚Options,Macros,Equates,andDataStructures‰PAGE2*2.‚Options,Macros,Equates,andDataStructures*B*‡Before‚we‚get‚into‚the‚actual‚codeoftheA/Ddriver,weneedtoI*‚defineafewmiscellaneousmacrosandsomeequatesthat‚are‚used‚by‚the *‚driver.*F*‡We‚also‚needtodefinethedatastructureswithwhichtheA/DdriverL*‚works.‚ThesedatastructuresincludetheIOCB(I/OControlBlock),theCMRI*‚parameter‚block,‚the‚CCB‚(ChannelControlBlock),theTCB(TaskControlI*‚Block),theI/Omeasurementeventmessage,and‚the‚I/O‚completion‚eventJ*‚message.ƒThe‚A/DdriversharesthesedatastructureswithotherpartsofI*‚thesystemsoftware,andtheA/Ddriverdoesn'tuse‚every‚part‚of‚everyJ*‚data‚structure.ƒThedocumentationinthissectionexplainsprimarilytheF*‚partsofthedatastructuresthataresignificanttotheA/Ddriver.*E*‡Besidesusingthedatastructuresthatarementioned‚above,‚the‚A/DH*‚driver‚also‚deals‚with‚the‚memory-mappedI/OareafortheMVME-600A/DH*‚converterboardanditssubordinateMVME-601‚A/D‚expander‚boards.ƒThisH*‚section‚of‚the‚listing‚includes‚adefinitionofthatmemory-mappedI/O*‚area.+‰TTL‡2.1.‚MiscellaneousOptionsandEquates*‰PAGE(*”2.1.‚MiscellaneousOptionsandEquates*D*‡This‚section‚contains‚some‚optionsthattelltheassemblerwhatweM*‚wantittodo,andthissectionalsocontainssomemiscellaneousequatestoK*‚define‚labelsthatareusefulforthecodeintheA/Ddriver.‚TheequatesL*‚inthissectionarepresentedinalphabeticalorderforeaseof‚reference.E*‚The‚options‚must‚occur‚before‚any‚code-affecting‚or‚code-generatingL*‚statementsbecausetheoptionstelltheassemblerhowtoassemblethe‚rest*‚oftheprogram.  1‰NOFORMAT–####################################### ‰OPT†CRE,PCS /CODE…EQU†8–Thislabeldefinesthenumberof‚the(*¦program‚sectionthatcontainscodeand&*¦constants.‚Section8is‚a‚relatively"*¦arbitraryƒsection,ƒbut‚it‚is‚the&*¦sectionwherethe‚system‚expects‚(by%*¦default)toseecodeforaprogram. ?DELAY„EQU†38mic' rosecondsˆThislabeldefinestheamountoftime$*¦(in‚terms‚of‚microseconds)‚that‚is(*¦required‚foranMVME-600A/Dconverter)*¦boardtocompleteasingleA/Dmeasure-&*¦ment.ƒThe‚A/Ddriverusesthislabel(*¦whenthedriverdelaystowaitfor‚the"*¦boardƒto‚make‚a‚measurement.ƒThe'*¦drivertimeseachA/D‚measurement‚and'*¦aborts‚with‚anerroriftheA/Dboard)*¦doesn'tcompleteameasurementwithina*¦reasonableamountoftime.-‰PAGEš#######################################)EXEC…EQU†0–This‚label‚is‚used‚with‚aƒTRAP%*¦instruction‚to‚generate‚a‚trapthat *¦requestsanexecutiveservice. 8INT_MASKEQU†$0700’Thislabeldefinesabitmaskforthe#*¦interrupt-levelƒbitsƒin‚the‚68000&*¦statusregister.‚TheA/D‚driver‚uses'*¦this‚label‚whenthedriverdealswith*¦theinterrupt-levelbits. :MAXCNLS‚EQU†(1+5)*16Thislabeldefinesthemaximumnumber(*¦of‚measurementchannelsthatcanexist%*¦inasingleCMRA/D‚channel.ƒAn‚A/D'*¦channel‚must‚containoneMVME-600A/D(*¦converterboard,anditcan‚optionally%*¦contain‚as‚many‚as‚fivesubordinate(*¦MVME-601A/Dexpanderboards.‚Themain)*¦A/Dconverterboardcontains16single-&*¦endedmeasurement‚channels,‚and‚each$*¦expanderƒboard‚contributes‚16‚more$*¦single-endedmeasurementchannels. ;‰IFNE…MAXCNLS/4*4-MAXCNLS„TheA/D‚driver‚contains‚code‚that-‰FAILš[****ERROR****ERROR****ERROR****]-‰ENDCšworksundertheassumptionthatMAXCNLS&*¦is‚evenly‚divisibleby4.‚Ifsomeone$*¦ever‚changes‚something‚thatƒcauses'*¦MAXCNLS‚not‚tobeevenlydivisibleby(*¦4,thestatementthatis‚conditionally(*¦skipped‚herewillgenerateanassembly&*¦errortoalertthe‚programmer‚to‚the$*¦failure.ƒBy‚using‚the‚assemblerto'*¦performthischeck,wecanbe‚sure‚of$*¦finding‚the‚error‚at‚assembly‚time)*¦insteadoffindingitlaterasaresult#*¦ofadifficultdebuggingsession.-‰PAGEš#######################################0MHZ†EQU†100”Thislabeldefinesthemaximum‚clock&*¦rate‚(in‚terms‚ofmegahertz)thatis(*¦expectedfora68000microprocessor‚in&*¦the‚near‚future.‚TheA/Ddriveruses)*¦thislabelwhenittimesameasurement,&*¦and‚we‚want‚MHZtobehighenoughto(*¦insureanadequatetimedelaywith‚the'*¦fastest‚foreseeable68000.‚Ifweever&*¦startgetting68000‚systems‚that‚can(*¦run‚withclockspeedsinexcessof100(*¦megahertz,wemustadjustthevalue‚of'*¦this‚labelupward.‚Ontheotherhand,)*¦avalueforMHZthatislargerthanthe"*¦actualƒspeedƒof‚the‚system‚clock(*¦doesn'tpresentanyproblems.‚Alarger%*¦MHZ‚value‚simply‚means‚thattheA/D(*¦driverdelayslongerinaSTOP‚command'*¦and‚before‚itabortsameasurementin)*¦thecaseofanA/Dconverterboardthat%*¦has‚gone‚bad.ƒSincetheextradelay&*¦occursonlyin‚conjunction‚with‚STOP)*¦commandsandwithboardfailures,itis)*¦notlikelytobeanoticeablefactorin*¦actualpractice. /SAFETYƒEQU†2–This‚label‚defines‚asafetyfactor(*¦thattheA/Ddriveruseswhenit‚times&*¦out‚a‚measurement.‚Bydelayingtwice%*¦aslongas‚should‚be‚necessary,‚the(*¦A/D‚driverprovidesanextramarginof'*¦safetythatwillforestall‚the‚advent'*¦of‚timing‚errorsuntiltimingchanges(*¦exceedthelimitofthesafetyfactor.-‰PAGEš#######################################4T0LOGPHYEQU†8–Theselabelsdefineexecutive-request7T0QEVNTIEQU†24“codesthatareusedwhentheA/Ddriver7T0QEVNTTEQU†23“makesexecutiverequestsviaTRAP#EXEC3T0RQPAƒEQU†34“callstotheexecutive.‚The‚executive6T0WAKEUPEQU†22“requests‚andtheirfunctionsarefully#*¦documented‚in‚theƒstandardƒRMS68K%*¦documentation‚package.ƒBriefly,‚the)*¦functionsoftheseparticularexecutive*¦requestsareasfollows: $*¨T0LOGPHY‚converts‚a‚logicalmemory)*¦addressintoaphysicalmemoryaddress.)*¦Addressconversionisnecessarybecause(*¦tasksuselogicalmemory-mapped‚memory(*¦addresses‚whereastheA/Ddriver,like(*¦therestoftheoperatingsystem,‚uses#*¦actualphysicalmemoryaddresses. '*¨T0QEVNTIqueue' saneventmessagefrom(*¦aninterrupthandlertoatask.‚Please$*¦noteƒthatƒa‚periodically-activated#*¦routine‚such‚asƒtheƒperiodically-&*¦activated‚A/D‚measurement‚routineis(*¦consideredtobeaninterrupthandler. '*¨T0QEVNTTqueuesaneventmessagefrom'*¦a‚task-level‚process(suchastheA/D)*¦driver'scommand-processingsubroutine)"*¦toƒa‚task.ƒThe‚driver's‚command-(*¦processingsubroutineisconsidered‚to'*¦be‚a‚task-levelprocessbecauseitis$*¦invokeddirectly‚as‚a‚result‚of‚an'*¦executive‚request‚fromataskinstead#*¦ofbeinginvokedbyaninterrupt. '*¨T0RQPArequestsaperiodicactivation'*¦of‚a‚specifiedroutineataspecified'*¦interruptlevel.‚TheT0RQPA‚executive(*¦request‚canalsobeusedtodeactivate$*¦a‚routine‚that‚has‚previously‚been$*¦activated.ƒThe‚A/D‚driver‚usesthe&*¦T0RQPAexecutive‚request‚to‚activate"*¦and„deactivateƒtheƒperiodically-$*¦activatedA/Dmeasurementroutine. %*¨T0WAKEUPwakesupa‚specified‚task."*¦TheƒA/Dƒdriver‚uses‚the‚T0WAKEUP%*¦executiverequestto‚wake‚up‚a‚user'*¦task‚when‚theusertaskhasaskedthe(*¦drivertowakeitupatthe‚completion)*¦ofsomemeasurementorsomesequenceof*¦measurements.‰TTL‡2.2.‚MacroDefinitions‰PAGE*œ2.2.‚MacroDefinitions*G*‡This‚sectioncontainsthedefinitionsofseveralmacrosthatmightbeL*‚usefulintheA/Ddriver.‚Foreaseofreferencethemacrosinthissection&*‚arepresentedinalphabeticalorder.*C*‡Macros‚are‚occasionally‚useful‚for‚modifyingsomeofthebuilt-in#*‚characteristicsoftheassembler.-‰PAGEš#######################################0ADDIA„MACRO›This‚macroisusefulwhenwewantto#*¦add‚an‚immediate‚value‚to‚an‚"*¦register.„Ifƒthe‚immediate‚value#*¦happensto‚be‚in‚the‚range‚from‚1(*¦through‚8,thismacrogeneratesaone-!*¦word‚ADDQ.Lƒinstruction.„Ifƒthe(*¦immediate‚valueisoutofrangeforan(*¦ADDQ.Linstructionbutissmall‚enough)*¦toberepresentedcorrectlyina16-bit&*¦two's-complement‚number‚system,‚this"*¦macroƒgeneratesƒaƒtwo-word‚ADD.W)*¦instructionknowingthatsignextension)*¦willoccuratexecutiontimetoaddthe)*¦correct32-bitvaluetotheentire(*¦register.‚Otherwise,thismacrogener-&*¦atesathree-wordADD.Linstruction. '*¨Byusingthismacrowecanbeassured$*¦ofƒgenerating‚the‚shortest‚correct'*¦instruction,andthemacro‚will‚still%*¦function‚correctly‚if‚the‚immediate(*¦valuehappenstochangeasaresult‚of#*¦futureƒprogramƒmodifications.ƒThe$*¦ADDIAmacroisinvokedasfollows. !*¦[