IMD 1.17: 25/11/2014 13:08:10 82VKXBVERDOS D* BT21:0 68K VERSADOS/RMS68K OBJECT 4.5 (DS,DD 96 tpi 5.1/4" DISK) REVISED: 04/22/86 DISK 21 OF 24  BT21 82VKXBVERDOS 0420²b-@2H1P.X\`]h;p@xF€9ˆ8<˜: 7¨;°;¸7À:È?ÐDØLàLèBðCøA;? ‰NOLISTŠTTL…9995.&.STR.EQŠINCLUDE9995.&.STR.EQ‰NOLISTŠTTL…9995.&.TCB.EQŠINCLUDE9995.&.TCB.EQ‰NOLISTŠTTL…9995.&.IOE.EQŠINCLUDE9995.&.IOE.EQ‰NOLISTŠTTL…9995.&.NIO.EQŠINCLUDE9995.&.NIO.EQ‰NOLISTŠTTL…9995.&.LV5.EQŠINCLUDE9995.&.LV5.EQ‰NOLISTŠTTL…9995.&.TRACE.EQŠINCLUDE9995.&.TRACE.EQ‰NOLISTŠTTL…9995.&.DUALPORT.MCŠINCLUDE9995.&.DUALPORT.MC‰NOLISTŠTTL…9995.&.KILL.MCŠINCLUDE9995.&.KILL.MC‰NOLISTŠTTL…9995.&.KILLDRV.EQŠINCLUDE9995.&.KILLDRV.EQ‰LIST*1ŠTTL…VERSAdos4.5MVME331/332ICCDriverVER.3.0‰PAGE*$*Envelopebufferformat‚fortheICC* ŠOFFSET‚0.MSG‡DS.L„1‘offsettomessagepartofenvelope..FLK‡DS.L„1‘offsettoforwardlinkinenvelope.7FLNKB…EQU…*-1bytethatmakesforwardlinkoddoreven.ENVLLENƒEQU…*‘envelopelength.*4FLKFLG„EQU…0‘Ifbit0oftheforewardfieldiszero,,*£itisapointertothenextenvelope,else%*£thisistheendofthelinkedlist.*#* Message buffer format for the ICC* ŠOFFSET‚-12DCB‡DS.L„1‘DCBpartofmessageTCBP†DS.L„1‘TCBpartofmessage IOCB†DS.L„1‘IOCBpartofmessageFLNK†DS.L„1‘FLINKinmessage"CMD‡DS.B„1‘commandpartofmessage"PORT†DS.B„1‘portnumberofmessage#SAD‡DS.L„1‘startaddressofmessage"LEN‡DS.L„1‘lengthofdatatransfer"STAT†DS.B„1‘statusbyteofmessage'TERM†DS.B„1‘terminatingpartofmessage)RLEN†DS.L„1‘returnlengthpartofmessageTCMDLENƒEQU…*-DCB* * Buffered Pipe Protocol Equates*)OSLEN…EQU…12operatingsystempartlength8NOPORTSƒEQU…06numberofportstouseforcalculationof *£poolsize.,NOPGPP„EQU…02numberofpoolpagesperport.1TOTPAGES‚EQU…NOPORTS*NOPGPP„totalnumberofpages/TOTBYTES‚EQU…TOTPAGES*256†lotalnumberofbytes:NOPACKSƒEQU…(TOTBYTES/(TCMDLEN+ENVLLEN))‚numberofpackets** General equates*/ILEN†EQU…6‰lengthofconfigurationITEM+DATA.8MAXP†EQU…8‰ThisdriverassumestohandleaMVME332board3*›andthereforedevicetableswillbeallocatedfor *›8ports.;NOSSE…EQU…4‰numberofsolicitedeventpacketsoneachport.1*›Thesepacketsaresenttotheportonthefirst*›CONFIGURErequest.=MINPKT„EQU…8‰numberofpackageswhichmustbepresentinpool0*›tostartanI/Ocommand.Thisvalueischoosen2*›assomecommamdse.g.READorCONFIGUREneedsup5*›to5pakeges.Theremaining3arefortheinterrupt0*›handler,tosend'abort'commandsonreceiving *›BREAK's.ŠPAGE*'*‚EquatesfortheconfigureICCcommand*!CICCI1„EQU…1‰configureICCITEM1!CICCI2„EQU…2‰configureICCITEM2!CICCI3„EQU…3‰configureICCITEM3!CICCI4„EQU…4‰configureICCITEM4!CICCI5„EQU…5‰configureICCITEM5!CICCI6„EQU…6‰configureICCITEM6*C*‚ThisarethebitdefinitionsforSolicitedEventRecordandState*$BRKB†EQU…0‰solicitedeventBREAKbit"CTSB†EQU…1‰solicitedeventCTSbit"DCDB†EQU…2‰solicitedeventDCDbit&IR1B†EQU…8‰solicitedeventIRAT#1bit&IR2B†EQU…9‰solicitedeventIRAT#2bit*#*‚Thisarethecinfigureportitems*CPI01…EQU…1‰configurebaudrate)CPI02…EQU…2‰configurenumberofdatabits)CPI03…EQU…3‰configurenumberofstopbits$CPI04…EQU…4‰configuretypeofparity&CPI05…EQU…5‰configureDTRoutputstate&CPI06…EQU…6‰configureRTSoutputstate%CPI07…EQU…7‰configurereceiverenable(CPI08…EQU…8‰configuretransmitterenable"CPI09…EQU…9‰configurebreakenable)CPI10…EQU…10ˆconfigureDCDinputfunction)CPI11…EQU…11ˆconfigureCTSinputfunction#CPI12…EQU…12ˆconfigurereadtimeout$CPI13…EQU…13ˆconfigurewritetimeout%CPI14…EQU…14ˆconfigurebreakduration.CPI15…EQU…15ˆconfiguredeletecharacterstring-CPI16…EQU…16ˆconfigurecontrolcharacterecho2CPI17…EQU…17ˆconfigurecontrolcharacterindicator7CPI18…EQU…18ˆconfigureterminateonatleastnoofchrs$CPI19…EQU…19ˆconfigurehardcopymode!CPI20…EQU…20ˆconfigurelinewidth2CPI21…EQU…21ˆconfigureechobellorterminateread#CPI22…EQU…22ˆconfigurenullsstring CPI23…EQU…23ˆconfiguretrashTXQ CPI24…EQU…24ˆconfigureflushTXQ CPI25…EQU…25ˆconfigureflushRXQ ,CPI26…EQU…26ˆconfigurewritelineterminator%CPI27…EQU…27ˆconfigureXOFFcharacter$CPI28…EQU…28ˆconfigureXON‚character#CPI29…EQU…29ˆconfigureRXhandshake2CPI30…EQU…30ˆconfigurereadlineterminatorstring%CPI31…EQU…31ˆconfigurebellcharacter0CPI32…EQU…32ˆconfigurecancelhardcopycharacter,CPI33…EQU…33ˆconfigureanycharacterforXON*CPI34…EQU…34ˆconfigureRXQhighwatermark)CPI35…EQU…35ˆconfigureRXQlow‚watermark‰PAGE**‚ThisaretheICCcommands*CMDRD…EQU…1‰ICCreadcommandCMDWR…EQU…2‰ICCwritecommandCMDAB…EQU…3‰ICCabortcommand-CMDSSE„EQU…4‰ICCsendsolicitedeventcommand'CMDCNFIƒEQU…5‰ICCconfigureICCcommand(CMDCNFPƒEQU…6‰ICCconfigurePORTcommand)CMDCNFTƒEQU…7‰ICCconfigureTABLEcommand,CMDRQI„EQU…11ˆICCreuqestICCstatuscommand-CMDRQP„EQU…12ˆICCreuqestPORTstatuscommand.CMDRQT„EQU…13ˆICCreuqestTABLEstatuscommand%CMDRSTPƒEQU…14ˆICCresetPORTcommand%CMDSNBPƒEQU…15ˆICCsendBREAKtoPORT$CMDFRXQƒEQU…16ˆICCflushRXQcommand$CMDFTXQƒEQU…17ˆICCflushTXQcommand&CMDBT…EQU…18ˆICCbootfirmwarecommand'CMDGO…EQU…19ˆICCstartbootedfirmware!**‚ThisaretheICCportnumbers*PORT1„EQU‡1‰portnumberonePORT2„EQU‡2‰portnumbertwoPORT3„EQU‡3‰portnumberthreePORT4„EQU‡4‰portnumberfourPORT5„EQU‡5‰portnumberfivePORT6„EQU‡6‰portnumbersixPORT7„EQU‡7‰portnumbersevenPORT8„EQU‡8‰portnumbereight*)* Initial SET command equates for the ICC*!SETSTRLN‚EQU…10‰SETstringlength.SETHD…EQU…$533E†'S'andAMcodeforSETstring STRPST„EQU…$07ˆstripstatusmask?BERRB…EQU…3ŠThisbitreflectsthestatusoftheboardswatchdog *œtimer.Itiszeroontimeout.*+*ICCboardequates‚forregisterlocations.*,INTRG…EQU…0ŠOffsettoICCinterruptregister-STMSG…EQU…1ŠOffsettoICCstatus/messagebyte/INTRICCB‚EQU…1ŠInterrupttheICCwithbit0set***.CRˆEQU…$0DCR-generalterminationcharacter.BSˆEQU…$08Backspacekey.DEL‡EQU…$7FDeletekey.*4* This are the bit equates for the IOS options field*+OPT3†EQU…3‘Output/inputformatted/imagebitOPT5†EQU…5‘Suppressechobit7OPT10…EQU…10Formatted/imageinputonoutputwithinput.OPT12…EQU…12Flushtypeaheadonreadorƒ-"-)*£Cleardiscardoutputonoutputcommand.*N* This are the equates for attributes and parameters recognized in ths driver.*5RECATT„EQU…%00001111111111111=recognizedattribute!*£Transparentmodenotsupported.8UNRATT„EQU…$FFFF-RECATT†maskofnotsupportedattributes?RECPAR„EQU…%01111111111111111=allowedparameteronconfigure6UNRPAR„EQU…$FFFF-RECPAR†maskofparametersnotallowed**‚Configureequates*-TABLEN„EQU…$100ŽlengthofanICCactiontable-OKSTAT„EQU…0‘goodstatusofreturnedmessages!TIRAT…EQU…1‘tableITEMno1(RAT)!TITAT…EQU…2‘tableITEMno2(TAT)#TIIRAT„EQU…3‘tableITEMno3(IRAT)!TIRTT…EQU…4‘tableITEMno4(RTT)!TITTT…EQU…5‘tableITEMno5(TTT)!TIWAT…EQU…6‘tableITEMno6(WAT):DCDFLG„EQU…$8C+3offsettoDCDflaginrequestportstatus:CTSFLG„EQU…$90+3offsettoCTSflaginrequestportstatus**‚Structurefordevicetable.*L* A table gets allocated in the initialization section of the driver to holdN* an entry for each port on the ICC. The address of this table is saved in theO* CCB. Each entry pertains to a port and the device number is used to determine"* where in the table the entry is.* ŠOFFSET0LUBUSY„DS.B„1ŠPortbusyflags."LUCONTRƒDS.B„1ŠPortcontrolflags.6LUSTAT„DS.B„1ŠCurrentstatusofport(CSBformatused)CLUSEDONE‚DS.B„1ŠFlagtoderterminewhethersolicitedeventpackeges*œhavebeensent.@LUWIPA„DS.L„1ŠBufferaddressforinputpartofoutputwithinput-*œcommand.IsalsotoholdtheCSBaddressof*œaconfigurerequest.LURLTL„DS.L„1ŠLengthofterminationstringforreadandwrite.BCONFIG„EQU…*-IOSATWƒSetzerooffsetforconfigurationinformation.?LUCONF„DS.W„(IOSTLN-IOSATW)/2Definespacefordevicedependent&*£configuration.Thisholdstheactual*£configurationoftheport.?* The sequence of the following definition must not be changed.*2LUIRATID‚DS.W„1‘ImmediateReceiveActionTableID.)LUIRAT„DS.W„TABLEN/2ŠSpaceforthetable.'LURATIDƒDS.W„1‘ReceiveActionTableID.(LURAT…DS.W„TABLEN/2ŠSpaceforthetable.(LUTATIDƒDS.W„1‘TransmitActionTableID.(LUTAT…DS.W„TABLEN/2ŠSpaceforthetable.%LUWATIDƒDS.W„1‘WriteActionTableID.(LUWAT…DS.W„TABLEN/2ŠSpaceforthetable.#0THEN.Sifwestillhavepackets*@*ˆGetemptyenvelopefromfreeenvelopepoolforBPPstatuspipe*‰INHIBIT—Inhibitinterrupts5‰MOVE.L„FEP_O(A5),A2ˆLoadfirstfreeenvelopepointer2‰MOVE.L„(A2),FEP_O(A5)†Pointtonextfreeenvelope,‰SUBQ.L„#1,NOPK_O(A5)‡Decrementpacketcount*G*ˆGetemptymessagepacketfromfreeenvelopepoolforBPPcommandpipe*4‰MOVE.L„FMP_O(A5),A1ˆLoadfirstfreemessagepointer8‰MOVE.L„(A1),FMP_O(A5)†Pointtonextfreemessagepacket**ˆloadtaskcontrolinfohere:*8‰MOVEM.LƒD3-D5,(A1)ŠLoadDCB,IOCBandTCBintomessage.*-‰LEA‡OSLEN(A1),A1ˆPointtoICCpartofpacket*;‰MOVE.B„#1<***ƒSubroutinetolinkapacketbacktotheBPPcommandqueue.?***‡ThisroutineiscalledbytheinterruptservicepartoftheC***‡drivertorelinkasolictedeventpacketorapreviousreturned?***‡datatransferpacketwithachangedmessageparttotheBBP***‡commandqueue.***2***ƒEntryconditions:‚A0.L‚pointstotheenvelope.***–A1.L‚pointstothemessage.******ƒExitconditions:ƒNone***K****************************************************************************RE_LINK:(ŠMOVEM.LA0-A2,-(A7)‡Savesomeregisters*:ŠMOVE.B#1<THEN.SˆIfthereisanerror%‰MOVE.B„#ISTAADD,D1‰returnerrorcode‰LEA‡4(A7),A7Œadjuststack!ŠBRA.S‚NCMDCMPL‹godonormalexit‰ENDI*>ŠBTST.B#XDSNRB,LUSTAT(A6)SeewhethertheCTSlineisactive.2ŠIFTHEN.SŒIfnot,setdevicenotreadyerror(ŠMOVE.B#ISTANR,D1‰andcompletecommand. ŠLEA„4(A7),A7ŠBRA.S‚NCMDCMPLŠENDI*)‰MOVE.L„D6,A0ŒReturnbufferstartaddress)‰MOVE.L„D5,D2ŒReturnthelengthofbuffer!‰MOVE.L„A3,D5ŒReturnIOCBpointer$‰MOVE.L„A4,D3ŒReturntheDCBpointer*‰MOVE.L„CCBTASKB(A5),D4‚ReturnTCBoftask*‰RTS*L*ƒSetlogicalbufferstartaddressandlengthforoutputwithinputrequest.*DOIP:0‰MOVE.L„IOSRRN(A3),D6‡loadlogicalstartaddress.‰MOVE.L„IOSLEN(A3),D5‡loadlogicalendaddress ‰BRA‡CHECK_Bgocalculatelength‰PAGEK******************************************************************************H***†ICMDCMPL=routinethatupdatesIOCBandqueuesaneventtoindicate-***thatIOiscompletefrominterruptlevel!***-***†Entryconditions:A3.L=pointertoIOCB4***™A6.L=pointertotheentryinourdevicetable.!***™D1.B=statusofcompletedIO***™D3.L=pointertoDCB***9***†Exitconditions‚:Wecheckiftherearemorepackets.***K**************************************************************************** ICMDCMPL:5ŠMOVE.B‚D1,IOSSTA(A3)…PutcompletitionstatusinIOCB(ŠCLR.BƒLUBUSY(A6)ˆClearportbusyflags.#ŠMOVE.L‚#0,A0Donotcopytheevent$ŠJSR…I_NRM_QEVENT†Goqueuetheevent8ŠIFTHEN.SŒifsomethingwentwrongkillthesystem.)‹KILL.DRIVERM331DRV_ID,I_NRM_QVENT,A5,D3ŠENDI!ŠMOVE.L‚D7,A0GettheTCBpointer?ŠSUB.Bƒ#1,TCBIOCNT(A0)ƒanddecrementtheI/Ocountofthetask."ŠBRA…NEXT_PACK‰Seeifmorepackets K******************************************************************************L***‚EXTINTR‚isusedtoexitandindicatethatwehaveservicedtheinterrupt***?***†Exitcondition:setcarrybittoindicateinterruptserved.***K****************************************************************************EXTINTR: ‰OR.W†#1,SR™setreturncondition/‰MOVEM.Lƒ(A7)+,D1-D7/A2-A4/A6Šrestoreregisters‰RTS K******************************************************************************D***‚EXTINTR0:setreturnconditionifwedidnottaketheinterrupt!***E***†Exitcondition:resetcarrybittoindicateinterruptnotserved.***K**************************************************************************** EXTINTR0:%‰AND.W†#$FFFE,SR”setreturncondition/‰MOVEM.Lƒ(A7)+,D1-D7/A2-A4/A6Šrestoreregisters‰RTSŠPAGEK****************************************************************************** H***†NCMDCMPL=routinethatupdatesIOCBandqueuesaneventtoindicate+***thatIOiscompletefromcommandlevel!***-***†Entryconditions:A3.L=pointertoIOCB3***™A6.L=pointertoourentryinthedevicetable!***™D1.B=statusofcompletedIO***™A4.L=pointertoDCB***&***†Exitconditions‚:Weexittoexec!***K**************************************************************************** NCMDCMPL:'ŠCLR.BƒLUBUSY(A6)ˆClearportbusyflagsNCMDERR:+ŠMOVE.B‚D1,IOSSTA(A3)…UpdatestatusinIOCBŠMOVE.L‚A4,D3GetDCBpointer'ŠMOVE.L‚#0,A0Indicatenocopyofevent0ŠJSR…N_NRM_QEVENT†CallDRVLIBtoqueuetheevent8ŠIFTHEN.SŒIfsomethingwentwrongkillthesystem.)‹KILL.DRIVERM331DRV_ID,N_NRM_QVENT,A5,D3ŠENDI$ŠBRA.SƒOK_RETŒBranchtogoodreturn.ŠPAGEK******************************************************************************H***‚CMD_SENTiscalledfromthecommandservicepartofthedriverafter@***‹allnecessarycommandsforthespecificI/Orequestaresent***‹totheICC.***+***„Entryconditions:D3.L=pointertoDCB***–D4.L=pointertoTCB***–D5.L=pointertoIOCB-***–A6.L=pointertoourdecicetableentry.***:***„Exitconditions:‚clearD0toindicatesuccessfullcall***–returntoEXEC.***K**************************************************************************** CMD_SENT:5ŠMOVE.L‚D3,LUDCB(A6)†StoreDCB,TCBandIOCBpointers*ŠMOVE.L‚D5,LUIOCB(A6)…inourdevicetable.ŠMOVE.L‚D4,LUTCB(A6)(ŠMOVE.L‚D4,A0Getthetask'sTCBpointer;ŠADD.Bƒ#1,TCBIOCNT(A0)ƒandincrementoutstandingI/Ocount.,ŠBSET„#ACTIVE,LUBUSY(A6)Setportbusyflag.*G*‚ThisistheentrypointforHALTI/Orequests,asthiscallswillnot *‚incrementthetasksI/Ocount.* CMD_EXIT:@ŠMOVE.L‚CCBCHB(A5),A0…Seewhetherthebuserrorconditiononthe>ŠBTST„#BERRB,STMSG(A0)‚ICCboardistrue.Ifthebitisclear,"ŠIFTHEN.SŒtheboardisdown.5ŠCLR.BƒD0Cleartoindicatewecalltheerrorroutine#ŠBRA.SƒSET_DOWNŠfromcommandlevel.ŠELSE.S7ŠTST.BƒCCBFLAG(A5)‡IftheerrorflagintheCCBisset,,ŠIFTHEN.SŒcallalsotheerrorroutine. ŠCLR.BƒD0ŠBRA.SƒSET_DOWNŠENDIŠENDI*C*‚Thecommandserviceroutinealwaysexitsviaoneoftheselabels.*4OK_RET:ƒCLR.LƒD0Setexitconditionforgoodreturn.BAD_RET:‚EQU…*ŠRTS—ReturntoEXECŠPAGEK******************************************************************************E***ƒSET_DOWNiscalledifthedriverdetectsthattheBUS-TIMEOUTbit=***ŒoftheICCboardisclared.Thisindicatesthattheboard;***Œisdown.SET_DOWNchecksalldevicetableentriesabout<***ŒpendingI/Orequestsandsendsbackacompletitionevent!***Œindicatingthechannelerror.***G***ƒEntryconditions:D0.B=0‚ifrequestisfromcommandservicelevel8***•D0.B=FFifrequestisfrominterruptservicelevel***K**************************************************************************** SET_DOWN:ŠINHIBIT“Maskinterrupts. ?ŠMOVE.B‚#1<THEN.SŒIfthisisanoutstandingI/O,'ŠCLR.BƒLUBUSY(A6)ˆclearthebusyflags,<ŠMOVE.L‚LUIOCB(A6),A3…andwritecompletitionstatustoIOCB.ŠMOVE.B‚D1,IOSSTA(A3)8ŠMOVE.L‚LUDCB(A6),D3†GettheDCBpointerfromthetable.* ŠTST.BƒD0,ŠIFTHEN.SŒIfcalledfromcommandlevel.ŠJSR…N_NRM_QEVENT†usethisroutinefromDRVLIBŠIFTHEN.S)‹KILL.DRIVERM331DRV_ID,N_NRM_QVENT,A5,D3ŠENDIŠELSE.S2ŠJSR…I_NRM_QEVENT†elsequeuefrominterruptlevel.ŠIFTHEN.S)‹KILL.DRIVERM331DRV_ID,I_NRM_QVENT,A5,D3ŠENDIŠENDI*8ŠMOVE.L‚LUTCB(A6),A3†Nowdecrementtherequestingtask's !ŠSUB.Bƒ#1,TCBIOCNT(A3)ƒI/Ocount.ŠENDI*/ŠLEA…LULEN(A6),A6†Adjustpointertonextentry.&ŠSUB.Lƒ#1,D2Decrementdevicecounter.,ŠUNTILD2#0Šuntilalldeviceschecked.*&ŠENABLE”Settopreviousinterruptmask* ŠTST.BƒD05ŠIFTHEN.SŒWeareaktivatedfromcommandservice+ŠBRA…OK_RETŒlevel,sogotoitsexitpoint.ŠENDI*8ŠBRA…EXTINTR0ŠElseuseinterruptlevelexitandindicate-*£theinterruptasnotserved.Thisgivesthe(*£commoninterrupthandlerthechanceto.*£processfurtherboardsofthisvectorchain.‰PAGEK******************************************************************************A***‚ThisaretheroutineswhicharecalledtochangetheICCreadC***‚configurationfortherequestedportdynamically.Thechangeis7***‚alwaysfromanexistingconfigurationtoanewone.,***‚Thefollowingnamingconventionisused:I***†Thelettersinfrontoftheunderscorearethecurrentconfiguration.D***†Thelettersbehindareanabbrivationforthenewconfiguration.:***‡e.g.ƒFE_INE‚indicatestochangefromformattedechoto***–imagenoecho.***@***…Entryconditions:A0.L=pointertoReadActionTable(RAT).)***—A6.l=pointertodevicetableentry.***K************************************************************************‰*FE_FE:IE_IE:FNE_FNE:INE_INE:-ŠRTS…Nochangeofconfiguration;justreturn.*+*‚Changefromformattedechotoimageecho.E*‚Setallcharacterswhicharenotreadterminatortoreadwithecho.*FE_IE:$ŠBSR…P_NULLŒCheckpassnullsetting.)ŠMOVE.L‚A0,A1Loadbaseaddressoftable.+ŠMOVE.W‚#255,D3‹Setcountforentiretable. ŠCLR.LƒD0SettoREADCHARACTER..ŠBSR…SETTABLEŠCalltheutilityforthechange.ŠBRA…TEACHConfiguretheICC.*F*‚Changefromimageechotoformattednoechowithcheckofpassnull.*IE_FNE:)ŠBSR.SƒD_NULLŒCheckdiscardnullsetting.!*£andfallintothenextroutine.2*‚Changefromformattedechotoformattednoecho.H*‚Setallcharacterswhicharenotreadterminatortoreadwithoutecho.*FE_FNE:(ŠMOVE.L‚A0,A1Loadbaseaddressoftable*ŠMOVE.W‚#255,D3‹Setcountforentiretable2ŠMOVEQƒ#7,D0SetvalueREADCHARACTERWITHOUTECHOŠBSR…SETTABLEŠLetutilitywork.'ŠBSR…SETFKEY‹Setdefinedfunctionkeys.!ŠBRA…TEACHGotoconfiguretable.*B*‚Changefromimageechotoimagenoechowithcheckofpassnull.*FE_INE:)ŠBSR.SƒP_NULLŒChecksettingofpassnull,!*£andfallintothenextroutine.**‚Changefromimageechotoimagenoecho.H*‚Setallcharacterswhicharenotreadterminatortoreadwithoutecho.*IE_INE:(ŠMOVE.L‚A0,A1Loadbaseaddressoftable*ŠMOVE.W‚#255,D3‹Setcountforentiretable2ŠMOVEQƒ#7,D0SetvalueREADCHARACTERWITHOUTECHOŠBSR…SETTABLEŠUpdatethetable.!ŠBRA…TEACHGotoconfiguretable.*+*‚Changefromimageechotoformattedecho.J*‚Setallcontrolcharacterswhicharenotreadterminatortoreadcontrol*‚characterwithecho.*IE_FE:,ŠBSR.SƒD_NULLŒChecksettingofdiscardnull.)ŠMOVE.L‚A0,A1Loadbaseaddressoftable.0ŠMOVE.W‚#31,D3ŒSetcountforcontrolcharacters.-ŠMOVEQƒ#2,D0SetvalueREADCONTROLCHARACTER*ŠBSR…SETTABLEŠDothechangesinthetable.)ŠBSR.SƒSETFKEY‹Setdefinedfunctionkeys.ŠBRA…TEACHConfigurethetable.*F*‚Changefromimagenoechotoformattedechowithcheckofpassnull.*INE_FE:,ŠBSR.SƒD_NULLŒChecksettingofdiscardnull,!*£andfallintothenextroutine.2*‚Changefromformattednoechotoformattedecho.E*‚Setallcharacterswhicharenotreadterminatortoreadwithecho.*FNE_FE:)ŠMOVE.L‚A0,A1Loadbaseaddressoftable./ŠMOVE.W‚#31,D3ŒSetcountforallcontrolchars.1ŠMOVEQƒ#2,D0SetvalueforREADCONTROLCHARACTER(ŠBSR…SETTABLEŠChangethispartoftable.;ŠLEA…32(A0),A1‰Loadtableoffsetfornoncontrolcharacters2ŠMOVE.W‚#255-32,D3ˆSetcountforthosecharacters.&ŠCLR.LƒD0SetvalueforREADCHARACTER+ŠBSR.SƒSETTABLEŠandchangeitinthetable. )ŠBSR.SƒSETFKEY‹Setdefinedfunctionkeys.ŠBRA…TEACHConfigurethetable.*F*‚Changefromformattednoechotoimageechowithcheckofpassnull.*FNE_IE:%ŠBSR.SƒP_NULLŒCheckpassnullsetting!*£andfallintothenextroutine.**‚Changefromimagenoechotoimageecho.E*‚Setallcharacterswhicharenotreadterminatortoreadwithecho.*INE_IE:)ŠMOVE.L‚A0,A1Loadbaseaddressoftable.-ŠMOVE.W‚#255,D3‹Setcountforallcharacters.#ŠCLR.LƒD0SetvalueREADCHARACTER.!ŠBSR.SƒSETTABLEŠChangethetable.!ŠBRA.SƒTEACHConfigurethetable.*1*‚Changefromformattednoechotoimagenoecho.B*‚Setallcontrolcharacterswhicharenotreadterminatortoread*‚withoutecho.*FNE_INE:&ŠBSR.SƒP_NULLŒCheckpassnullsetting.)ŠMOVE.L‚A0,A1Loadbaseaddressoftable./ŠMOVE.W‚#31,D3ŒSetcountforcontrolcaracters.3ŠMOVEQƒ#7,D0SetvalueREADCHARACTERWITHOUTECHO.!ŠBSR.SƒSETTABLEŠChangethetable.&ŠBRA.SƒTEACHSendittotheICCboard.*1*‚Changefromimagenoechotoformattednoecho.*‚Setallfunctionkeys*INE_FNE:)ŠBSR.SƒD_NULLŒCheckdiscardnullsetting.!ŠBSR.SƒSETFKEY‹Setfunctionkeys.ŠBRA.SƒTEACHConfiguretable.ŠPAGEK******************************************************************************G***‚RoutinetoconfigurethediscardNULLfunctionforformattedreads.@***‚Itiscalledifreadoptionchangesfromimagetoformatted.******„Entryconditions:none***C***„Exitconditions‚:D7issettoFFiftheIRATtableischanged.***K****************************************************************************'D_NULL:ƒBTST„#IOAPNUL,CONFIG+IOSATW(A6)7ŠIFTHEN.SŒIfourconfigurationistopassNULL's,<ŠMOVE.B‚#6,LUIRAT(A6)…discardthemifwechangetoformatted'ŠST†D7read.D7issettoconfigurethe%ŠENDI–ImmediateReceiveActionTable.ŠRTS K******************************************************************************C***‚RoutinetoconfigurethediscardNULLfunctionforimagereads.@***‚Itiscalledifreadoptionchangesfromformattedtoimage.******„Entryconditions:none***C***„Exitconditions‚:D7issettoFFiftheIRATtableischanged.***K****************************************************************************'P_NULL:ƒBTST„#IOAPNUL,CONFIG+IOSATW(A6)7ŠIFTHEN.SŒIfourconfigurationistopassNULL's,;ŠMOVE.B‚#3,LUIRAT(A6)…readthemifwechangetoimageread.+ŠST†D7SetD7toindicateImmediateReceiveŠENDI–ActionTableischanged.ŠRTS K******************************************************************************B***ƒThissubroutineistosetthedefinedfunctionkeyswithinthe***ƒReadActionTable(RAT).***-***…Entryconditions:A0.L=pointertoRAT.)***˜A6.L=pointertodevicetableentry.***K****************************************************************************SETFKEY:6ŠMOVE.B#1,BS(A0)ŠBSandDELarealwaysusedtodelete7ŠMOVE.B#1,DEL(A0)‰thelastcharacter.Setitintable. ŠCLR.L‚D0ŠMOVE.BCONFIG+IOSRLN(A6),D08ŠIFTHEN.SŒIfareprintlinecharisdefinedinthe6ŠMOVE.B#5,(A0,D0.W)‡currentconfiguration,setitup.ŠENDIŠMOVE.BCONFIG+IOSCLC(A6),D0:ŠIFTHEN.SŒDothesameforthecancellinecharacter.ŠMOVE.B#4,(A0,D0.W)ŠENDIŠRTS K******************************************************************************@***„ThisroutineiscalledtochangereadactiondefinitionsforC***„characterswhicharenotreadterminators($08)withintheRAT.***7***…Entryconditions:A1.L=startaddressforsearch.5***˜D3.W=numberofbytestosearch(zerorelative).!***˜D0.B=newreadactionvalue.******…Exitconditions:‚none***K************************************************************************‰* SETTABLE:ŠMOVE.LA1,-(A7)8SETLOOPƒCMP.B‚#8,(A1)+‹Isthislocationreadterminator?ŠBEQ.S‚SETNEXTŒNo,trynext.+ŠMOVE.BD0,-1(A1)ŠWriteinnewreadaction.=SETNEXTƒDBRAƒD3,SETLOOP‰Repeatforgivennumberoflocations.ŠMOVE.L(A7)+,A1 ŠRTS K******************************************************************************E***ƒThisroutineistoissueaconfiguretablecalltotheICCtosetH***ƒupthechangedreadoptions.Asthisroutinegetsactivbyabranch,>***ƒthefinalRTSreturnstothelocationwhichcalledRDOPT!!***?***†Entryconditions:D7.B=iftheIRATistoconfigure,)*** ifonlytheRATistoconfigure.******†Exitconditions‚:none***K****************************************************************************TEACH: ŠTST.BƒD79ŠIFTHEN.SŒIfD7indicatesthattheIRATischanged,<ŠLEA…LUIRATID(A6),A0ƒsetthetablestartaddresstotheIRAT?ŠMOVE.L‚#(TABLEN+2)*2,D2‚table#andthelengthfortwotables.ŠELSE.S9ŠLEA„LURATID(A6),A0…ElsesetvaluestoconfiguretheRead'ŠMOVE.L#TABLEN+2,D2‡ActionTableonly.ŠENDI6ŠMOVE.B#CMDCNFT,D0ˆSetthecommandcodeandissuethe ŠBSR„LINKBPPŒrequesttotheICC.ŠRTS ŠPAGEK******************************************************************************J***ƒRDOPTisthesubroutinetohandletheIOCBoptionsforareadrequest.C***ƒThefollowingoptionsareprocessed:‚-FlushTypeAheadBuffer.***©-SupressEcho***©-ReadImage/FormattedC***ƒForechoandmode,thebyteLUCONTRfromthedevicetableentryJ***ƒcontainstheactualreadconfiguration.Avalueintherangeof0-15M***ƒisbuiltasanentryforthecasemacro.Thevalueisdefinedasfollows: ***‡Bit0‚0requestisformatted***Ž1„-"-ƒimage***‡Bit1‚0„-"-ƒecho***Ž1„-"-ƒnoecho-***‡Bit2‚0actualconfigurationisformatted***Ž1‹-"-‰image***‡Bit3‚0‹-"-‰echo***Ž1‹-"-‰noechoG***‡e.g.avalueof6meanstochangetheconfigurationfromimageecho***Œtoformattednoecho.***?***†Entryconditions:A6.L=pointertoourdevicetableentry.1***˜D5.W=readoptionsfromIOCB.Iftherequest****Ÿisoutputwithinput,theformatbit3$***Ÿmustbesetaccordingtobit10.******†Exitconditions:‚none/***˜itexitsviaoneoftheroutinesjumpedto.***K****************************************************************************RDOPT:!ŠBTSTWƒ#IOATAHD,CONFIG+IOSATW(A6):ŠIFTHEN.SŒIfweareconfiguredtousethetypeahead9ŠBTST„#OPT12,D5‰featureanthecurrentreadoptionorour:ŠIFTHEN.SŒflaginthecontrolbytetellsustoflush=ŠMOVE.L‚#CMDFRXQ,D0‡thereceivebufferbeforethewrite,send1ŠBSR…LINKBPP‹aflushRXqueuecommandtotheICC.9ŠBCLR„#FRXQFLG,LUCONTR(A6)Ineithercaseresettheflag.ŠELSE.SŠBCLR„#FRXQFLG,LUCONTR(A6)ŠIFTHEN.SŠMOVE.L‚#CMDFRXQ,D0 ŠBSR…LINKBPPŠENDIŠENDIŠENDI*/*‚nowbuildthevalueforthecasemacroinD0.*!ŠBTSTW‚#IOAECHO,CONFIG+IOSATW(A6)8ŠIFTHEN.SŒIfthenoechobitissetinthecurrent5ŠBSETƒ#OPT5,D5‹attributeword,simplysetnoechoforŠENDI–therequest.;ŠMOVE.BLUCONTR(A6),D7…Loadthecurrentreadconfiguration.$ŠCLR.L‚D0‘Cleartobuildcasevalue.ŠBTSTƒ#OPT3,D59ŠIFTHEN.SŒIftherequestisforimageread,setbit6ŠADDQ.L#1,D0Žzeroofcasevalueandthecontrolflag.ŠBSETƒ#RDIMAGE,LUCONTR(A6)/ŠELSE.S”Elseresetthecontrolflagtoindicate*ŠBCLRƒ#RDIMAGE,LUCONTR(A6)’formattedread.ŠENDIŠBTSTƒ#OPT5,D5:ŠIFTHEN.SŒIftherequestisforareadwithoutecho,7ŠADDQ.L#2,D0Žaddbitoneofcasevalueandthecontrol ŠBSETƒ#NOECHOB,LUCONTR(A6)flag.0ŠELSE.S”Elseresetcontrolflagtoindicateread%ŠBCLRƒ#NOECHOB,LUCONTR(A6)™withecho.ŠENDIŠBTSTƒ#RDIMAGE,D77ŠIFTHEN.SŒIfthelastreadwasimage,addbittwo ŠADDQ.L#4,D0Žtothecasevalue.ŠENDIŠBTSTƒ#NOECHOB,D76ŠIFTHEN.SŒIfthelastreadwaswithoutecho,add*ŠADDQ.L#8,D0Žbitthreetothecasevalue.ŠENDI1ŠLEA„LURAT(A6),A0‡PointtotheReadActionTable.,ŠCLR.BƒD7Clearforusageasflagwhetherto*£configuretheIRATornot.*.*„DothecaseusingA1andD0,thecasevalue.*>ŠCASEƒ1,0,FE_FE,FE_IE,FE_FNE,FE_INE,IE_FE,IE_IE,IE_FNE,IE_INE, =&FNE_FE,FNE_IE,FNE_FNE,FNE_INE,INE_FE,INE_IE,INE_FNE,INE_INE*ŠPAGEK******************************************************************************G***‚Thisistheroutinetoconfiguretheattributebits.AllattributesH***‚areconfiguredregardlessthecontentoftheattributemasktoavoid.***‚problemsonchangingspecifficattributes.***G***„Entryconditions:A0.L=pointertonextItementryinItemBuffer.6***–A3.L=pointertousersConfiguationStatusBlock.)***–D2.L=CurrentlengthofItembuffer.#***–D5.W=Attributestoconfigure.***:***„Exitconditions:‚D2.L=UpdatedlengthofItembuffer.***K**************************************************************************** CONF_ATTR:*!*ˆattributebit0-hardcopymode*0ŠMOVE.W‚#CPI19,(A0)+†loadhardcopymodeITEMno ŠADD.Lƒ#6,D2incrementtableLEN*ŠBTST„#IOAHCPY,D5‡seehowattributeisset&ŠIFTHEN.SŒelsedohardcopymode%ŠCLR.Lƒ(A0)+confg.forterminalmodeŠELSE.S3ŠMOVE.L‚#'<>',(A0)+‡putrequiredbracketsinbufferŠENDI !*ˆattributebit1-XON/XOFFmode ATTR1:2ŠMOVE.W‚#CPI29,(A0)+†loadhandshakecontr.ITEMno ŠADD.Lƒ#6,D2incrementtableLEN*ŠBTST„#IOAXCTL,D5‡seehowattributeissetŠIFTHEN.S(ŠMOVE.L‚#2,(A0)+ŠUsehardwarehandshake. 2ŠMOVE.W‚#CPI10,(A0)+†loadhandshakecontr.ITEMno ŠADD.Lƒ#6,D2incrementtableLEN4ŠCLR.Lƒ(A0)+SettingDCDashandshakelinesetsalso**£CTSashandshake.Butasthedefaultfor+*£CTSisstatusinput,changesofthisline*£willcausesolicitedevents.+ŠMOVE.W‚#CPI05,(A0)+†loadinitialDTRstate ŠADD.Lƒ#6,D2incrementtableLEN ŠMOVE.L‚#$FF,(A0)+ˆsettoenable +ŠMOVE.W‚#CPI06,(A0)+†loadinitialRTSstate ŠADD.Lƒ#6,D2incrementtableLEN ŠMOVE.L‚#$FF,(A0)+ˆsettoenableŠELSE.SŠMOVE.L‚#1,(A0)+ŠuseXON/XOFF2ŠMOVE.W‚#CPI10,(A0)+†loadhandshakecontr.ITEMno ŠADD.Lƒ#6,D2incrementtableLEN)ŠMOVE.L‚#$FF,(A0)+ˆuseCTSforinterruptsŠENDI *ˆattributebit2-bits/char ATTR2:+ŠMOVE.W‚#CPI02,(A0)+†loadbits/charITEMno ŠADD.Lƒ#6,D2incrementtableLEN*ŠBTST„#IOABITS,D5‡seehowattributeissetŠIFTHEN.S+ŠMOVE.L‚#8,(A0)+ŠRequestiffor8bit/char.!ŠMOVE.W‚#1<ŠMOVEM.LD2/A0,-(A7)‡elseconfigurethe8bitReadTranslationŠLEA…CRTT8B(A5),A0…TableŠMOVE.L‚#TABLEN+2,D2ŠMOVE.B‚#CMDCNFT,D0 ŠBSR…LINKBPPŠMOVEM.L(A7)+,D2/A0ŠELSE.S&ŠMOVE.L‚#7,(A0)+Šconfigure7bits/charATTR2H:ƒMOVEM.LD2/A0,-(A7)8ŠLEA…CRTT7B(A5),A0…andthe7bitReadTranslationTable.:ŠMOVE.L‚#TABLEN+2,D2†Thisisnecessaryastheboardalways;ŠMOVE.B‚#CMDCNFT,D0‡readsthecharacterswithbitsevenset)ŠBSR…LINKBPP‹ifconfiguredto7bit/char.ŠMOVEM.L(A7)+,D2/A0ŠENDI *ˆattributebit3-stopbits ATTR3:+ŠMOVE.W‚#CPI03,(A0)+†loadstopbitsITEMno ŠADD.Lƒ#6,D2incrementtableLEN*ŠBTST„#IOASTPB,D5‡seehowattributeissetŠIFTHEN.S ŠMOVE.L‚#1,(A0)+Šload1stopbitŠELSE.S!ŠMOVE.L‚#2,(A0)+Šload2stopbitsŠENDI -*ˆattributebit4-useparity/typeofparity ATTR4:/ŠMOVE.W‚#CPI04,(A0)+†loadparitycontr.ITEMno ŠADD.Lƒ#6,D2incrementtableLEN*ŠBTST„#IOAUSEP,D5‡seehowattributeissetŠIFTHEN.S ŠCLR.Lƒ(A0)+ŠELSE.S&ŠBTST„#IOAPRTY,D5‡testforoddorevenŠIFTHEN.S ŠMOVE.L‚#1,(A0)+ŠloadoddparityŠELSE.S!ŠMOVE.L‚#2,(A0)+ŠloadevenparityŠENDIŠENDI #*ˆattributebit6-localechomode ATTR6:&ŠLEA…LURATID(A6),A1„pointtoRATtable)ŠMOVE.W‚#TIRAT,(A1)+†SetupthetableID.*ŠBTST„#IOAECHO,D5‡seehowattributeissetŠIFTHEN.S/ŒBCLR.B‚#NOECHOB,LUCONTR(A6)clearnoechoflag:ŒBCLR.B‚#RDIMAGE,LUCONTR(A6)setconfiguredforimagereadŒMOVE.W‚#$0202,D05ŒFOR.WD7=#1TO#16DO.Sƒforallcontrolcharacters%ŽMOVE.WD0,(A1)+‡setcontolcharechoŒENDF4ŒFOR.WD7=#1TO#(TABLEN-32)/2DO.Sƒforallothers &ŽCLR.W‚(A1)+ŠsetrestoftabletoechoŒENDF4ŒLEA…LURAT(A6),A1„Loadthebaseaddressofthetable4ŒMOVE.B‚#1,BS(A1)‡andsetthedefaultcharactersfor)ŒMOVE.B‚#1,DEL(A1)†deletelastcharacter. '*ˆletsswitchoncontrolcharacterecho +ŒMOVE.W‚#CPI16,(A0)+†loadechoCNTLITEMno ŒADD.Lƒ#6,D2incrementtableLEN!ŒMOVE.L‚#$FF,(A0)+ˆswitchonechoŠELSE.S-ŒBSET.B‚#NOECHOB,LUCONTR(A6)…setnoechoflagŒBCLR.B‚#RDIMAGE,LUCONTR(A6)ŒMOVE.W‚#$0707,D0 ŒFOR.WD7=#1TO#TABLEN/2DO.S;ŽMOVE.W‚D0,(A1)+†Settheentiretabletoreadwithoutecho.ŒENDF (*ˆletsswitchoffcontrolcharacterecho +ŒMOVE.W‚#CPI16,(A0)+†loadechoCNTLITEMno ŒADD.Lƒ#6,D2incrementtableLEN ŒMOVE.L‚#0,(A0)+ŠswitchoffechoŠENDI #*ˆattributebit7-typeaheadmode ATTR7:+ŠMOVE.W‚#CPI25,(A0)+†loadflushRXQITEMno ŠADD.Lƒ#6,D2incrementtableLEN*ŠBTST„#IOATAHD,D5‡seehowattributeissetŠIFTHEN.S!ŠCLR.Lƒ(A0)+loadnoflushofRXQŠELSE.S$ŠMOVE.L‚#$FF,(A0)+ˆloadflushofRXQŠENDI 1*ˆattributebit8-terminateonbufferfullmode ATTR8:-ŠMOVE.W‚#CPI21,(A0)+†loadbufferfullITEMno ŠADD.Lƒ#6,D2incrementtableLEN*ŠBTST„#IOATFUL,D5seehowattributeissetŠIFTHEN.S*ŠCLR.Lƒ(A0)+terminatereadonbufferfullŠELSE.S'ŠMOVE.L‚#$FF,(A0)+ˆloadechobellvalueŠENDI *ˆattributebit9-passnulls ATTR9:-ŠLEA…LUIRATID(A6),A1ƒGetbaseaddressofIRATŠMOVE.W‚#TIIRAT,(A1)+ŠMOVE.W‚#$0303,D7ŠMOVE.W‚#TABLEN/2-1,D0@ATTR9H1ƒMOVE.W‚D7,(A1)+ŠFillentiretablewithRECEIVECHARACTERŠDBRA„D0,ATTR9H1 ŠBTST„#IOAPNUL,D5ŠIFTHEN.SŠLEA…LUIRAT(A6),A1)ŠMOVE.B‚#6,(A1)‹setIRATtodiscardnullsŠENDI '*ˆattributebit11-modemoffthehook ATTR11:;ŠBTST„#IOAMODM,D5‡Ifweareconnectedtoamodem,takecare'ŠIFTHEN.SŒaboutoffhooksetting.&ŠMOVE.W‚#CPI05,(A0)+†DTRstateITEMno ŠADD.Lƒ#6,D2incrementtableLEN*ŠBTST„#IOAOFFH,D5‡seehowattributeissetŠIFTHEN.SŠMOVE.L‚#$FF,(A0)+ˆsetDTRŠELSE.SŠCLR.Lƒ(A0)+clrDTRŠENDIŠENDI*ŠRTS ŠPAGEK******************************************************************************E***ƒThisisthetablewhichdefinestheBaudRatesusedwithVERSAdos#***ƒandsupportedbytheICCboard.***K****************************************************************************BAUDTBL:ŠDC.L„50ŠDC.L„75 ŠDC.L„110 ŠDC.L„134 ŠDC.L„150 ŠDC.L„300 ŠDC.L„600 ŠDC.L„1200 ŠDC.L„1800 ŠDC.L„2000 ŠDC.L„2400 ŠDC.L„3600 ŠDC.L„4800 ŠDC.L„7200 ŠDC.L„9600 ŠDC.L„19200 ŠDC.L„38400 ŠPAGEK******************************************************************************B***‚ThisistheroutinetoconfiguretherequestedParameters.AllD***‚parametersareprocessedregardlessthecontentoftheparameter<***‚masktoavoidproblemsonchangingaspecificparameter.***G***„Entryconditions:A0.L=pointertonextItementryinItemBuffer.6***–A3.L=pointertousersConfiguationStatusBlock.)***–D2.L=CurrentlengthofItembuffer.***:***„Exitconditions:‚D2.L=UpdatedlengthofItembuffer.***K**************************************************************************** CONF_PAR:*‰paramaterbit0-Linewidth*,ŠMOVE.W‚#CPI20,(A0)+†loadlinewidthITEMno ŠADD.Lƒ#6,D2incrementtableLEN!ŠCLR.LƒD0useasworkingregister$ŠMOVE.W‚IOSREC(A3),D0…getlinewidth)ŠMOVE.L‚D0,(A0)+Šloadlinewidthintable*&*ˆparameterbit4-XOFF/XON‚character*PAR4:+ŠLEA…LUIRAT(A6),A1…GetbaseaddressofIRAT ŠCLR.WƒD0clearworkingregister+ŠMOVE.W‚#CPI33,(A0)+†loadXON/ANYparameter0ŠMOVE.L‚#$FF,(A0)+ˆpreloadwithanycharforXON!ŠADD.Lƒ#6,D2incrementITEMcount,ŠMOVE.B‚IOSXOF(A3),D0…gettheXOFFcharacterŠIFTHEN.S1ŠMOVE.B‚#0,(A1,D0.W)†putactioncharacterinIRAT+ŠMOVE.B‚IOSXON(A3),D0…gettheXONcharacter*ŠIFTHEN.SŒelseuseanychrtoenable1ŠMOVE.B‚#1,(A1,D0.W)†putactioncharacterinIRAT'ŠCLR.Lƒ-4(A0)ŒuseXONchartoenableTXŠENDIŠENDI* .*ˆparameterbit5-breakequivalentcharacter* ŠCLR.WƒD0clearworkingregister-ŠMOVE.B‚IOSBRC(A3),D0…gettheBREAKcharacterŠIFTHEN.S1ŠMOVE.B‚#2,(A1,D0.W)†putactioncharacterinIRATŠENDI*,*ˆparameterbit6-discardoutputcharacter* ŠCLR.WƒD0clearworkingregister/ŠMOVE.B‚IOSDOP(A3),D0…gettheDISCARDcharacterŠIFTHEN.S8ŠMOVE.B‚#4,(A1,D0.W)†PutIRATEVENT#1characterinIRATŠENDI***ˆparameterbit7-reprintlinecharacter*0ŠLEA…LURAT(A6),A1†GetbaseaddressofRATtable. ŠCLR.WƒD0clearworkingregister1ŠMOVE.B‚IOSRLN(A3),D0…gettheREDISPLAYcharacterŠIFTHEN.S0ŠMOVE.B‚#5,(A1,D0.W)†putactioncharacterinRATŠENDI*)*ˆparameterbit8-cancellinecharacter* ŠCLR.WƒD0clearworkingregister.ŠMOVE.B‚IOSCLC(A3),D0…gettheCANCELcharacterŠIFTHEN.S0ŠMOVE.B‚#4,(A1,D0.W)†putactioncharacterinRATŠENDI*$*ˆparameterbit9-readterminators*,ŠMOVE.W‚#CPI30,(A0)+†readterminatorITEMno ŠADD.Lƒ#6,D2incrementtableLEN-ŠMOVE.L‚IOSEOL(A3),(A0)+‚loadreadterminatorŠLEA…LURAT(A6),A2†pointtoRAT ŠCLR.WƒD0clearworkingregister'ŠLEA…IOSRTV(A3),A1…pointtoreadstringŠFOR.BƒD7=#1TO#4DO.SŠMOVE.B‚(A1)+,D0ŠIFTHEN.S=ŠMOVE.B‚#8,(A2,D0.W)†Setallterminationchar'sforterminateŠENDI–readwithoutecho.ŠENDF*'*ˆparameterbit10-endoflinestring*;ŠLEA…LUWATID(A6),A2„GetbaseaddressofWriteActionTable."ŠMOVE.W‚#TIWAT,(A2)+†SettableID. ŠMOVE.L‚A2,A17ŠMOVE.W‚#TABLEN/2-1,D0„Filltheentiretablewithvalue)PAR10H1ƒCLR.Wƒ(A1)+WRITECHARACTERFAST.ŠDBRA„D0,PAR10H18ŠMOVE.B‚#2,CR(A2)‰$0Dneededforterminatortopassthem*£totheTransmitActionTable.>ŠLEA…LUTATID(A6),A2„GetbaseaddressofTransmitActionTable.!ŠMOVE.W‚#TITAT,(A2)+†SettableID ŠMOVE.L‚A2,A17ŠMOVE.W‚#TABLEN/2-1,D0„Fillentiretablewiththevalue'PAR10H2ƒCLR.Wƒ(A1)+TRANSMITCHARACTER.ŠDBRA„D0,PAR10H2/ŠMOVE.B‚#2,CR(A2)‰SettoinsertNULLSafterCR.*,ŠMOVE.W‚#CPI26,(A0)+†readterminatorITEMno ŠADD.Lƒ#6,D2incrementtableLEN-ŠMOVE.L‚IOSEOL(A3),(A0)+‚loadreadterminator*=ŠLEA…IOSEOL+4(A3),A2ƒPointtothebytebehindtheEOLstring. ŠCLR.LƒD0 ŠMOVE.W‚#3,D03COUNTL„TST.Bƒ-(A2)Decrementuntilfirstbyte.ŠDBNE„D0,COUNTLŠADDQ.W‚#1,D0Correctlength.-ŠMOVE.L‚D0,LURLTL(A6)…Storeitforlateruse.*#*ˆparameterbit11-baudratecode*+ŠMOVE.W‚#CPI01,(A0)+†loadbaudrateITEMno ŠADD.Lƒ#6,D2incrementtableLEN ŠCLR.LƒD0+ŠMOVE.B‚IOSBRT(A3),D0…Getthebaudratecode)ŠLSL.Lƒ#2,D0Adjustforlongwordaccess.6ŠLEA…BAUDTBL(PC),A1„Getthebaseaddressofthetable.)ŠMOVE.L‚(A1,D0.L),(A0)+ƒSetthebaudrate.*!*ˆparameterbit12-nullpadding*1ŠMOVE.W‚#CPI22,(A0)+†loadnumberofnullsITEMno ŠADD.Lƒ#6,D2incrementtableLENŠCLR.LƒD0useasworkregister-ŠMOVE.B‚IOSNLS(A3),D0…getthenumberofnulls ŠMOVE.L‚D0,(A0)+Šloadintotable*%*ˆparameterbit13-terminatorclass*/ŠTST.BƒIOSTRC(A3)ˆDowehaveaterminatorclassŠIFTHEN.S/ŠLEA…LURAT(A6),A1†GetbaseaddressofRATtable/ŠFOR.WƒD7=#0TO#$FFDO.S‚forentiretabledoŠMOVE.B‚D7,D3makeacopyŠMOVE.B‚D7,D0makeacopyŠAND.Bƒ#$0F,D3‹dropMSBs.ŠAND.BƒIOSTRC(A3),D0…andwithterminatorclass'ŠLSL.Bƒ#4,D0shiftresulttorighthalf!ŠCMP.BƒD0,D3isthisaterminatorŠIFTHEN.S9ŠMOVE.B‚#8,(A1,D7)ˆWriteTERMINATEWITHNOECHOtotable.ŠENDIŠENDFŠENDI ‰RTS ‰PAGEK******************************************************************************A***†GETLUBUFisasubroutinetogetthebaseaddressoftheentry***†inthedevicetable.***8***†Entryconditions:D1.W=portnumber‚(zerorelative)***+***†Exitconditions:A6.L=bufferpointer***˜D2.Wispreserved***K**************************************************************************** GETLUBUF:ŠMOVE.LD2,-(A7)Œsaveregister8ŠMOVE.LLUTBFP(A5),A6‡Getthebaseaddressofthetable.#ŠMOVE.W#LULEN,D2‹getthepagesize  ŠMULUƒD1,D2getthetableoffset$ŠLEA„(A6,D2.L),A6ˆpointtoourtable!ŠMOVE.L(A7)+,D2ŒrestoreregisterŠRTS‰PAGEF*** -------------------------------------------------------------- ***D***CNFGCMN‚Commonconfigureroutinewhichchecksattributesand‚******parameters.´******À***;***Inputconditions:D0.W=recognizedattributesmaskŒ***)***“D2.W=recognizedparametersmaskŒ******À***.***“A0ƒ=addressofcurrentconfiguiration…***"***“A3ƒ=addressofusersIOCB‘*** ***“A4ƒ=baseaddressofDCB“*** ***“A5ƒ=baseaddressofCCB“******À***=***Exitconditions:‚iferror:D1.B=errorcodeforIOCB‰***$***D0,D5-D7/A0-A2aredestroyed‡***)***ifinvaddressbranchtoNCMDCMPL‚***(***elsereturnerrorcodeinD1andƒ******clearzerobit•******“ifnoerror:¡***$***D0,D5-D7/A0,A2aredestroyed‡***$***A1=physicaladdressofCSB‡***"***Setzerobitfornoerror.‰******normalRTS™******À******À***F*** -------------------------------------------------------------- ****CNFGCMN:0‰MOVE.L„IOSDBP(A3),D6‡getlogicaladdressofCSB'‰MOVE.L„#IOSTLN,D5ŠgetCSBtablelength‰MOVE.L„A0,A1saveregisrer.‰MOVE.L„CCBTASKB(A5),A0…getaddressofhisTCB**‰JSR‡LOGPHYŽgoconvertlogicaltophysical*‰IFˆ†THEN.S%ŠMOVE.B‚#ISTAADD,D1‡returnerrorcodeŠLEA…4(A7),A7ŠadjuststackŠBRA…NCMDCMPLŠgoreturncommand‰ENDI‰MOVE.L„A1,A0restoreregister$‰MOVE.L„D6,A1loadCSBtablepointer*8* check illegal parameters and attributes and parameters*)‰MOVEQ…#CECCDO,D7Špreloadwitherrorcode*.‰AND.W…IOSATM(A1),D0‡findunallowedattributes ‰BNE‡BADCNFGreporterrorifany*.‰AND.W…IOSPRM(A1),D2‡findunallowedparameters ‰BNE‡BADCNFGreporterrorifany*.* check unrecognized attributes and parameters*)‰MOVEQ…#CECUAP,D7Špreloadwitherrorcode*6‰MOVE.W„#UNRATT,D0Šgetmaskofunrecognizedattributes1‰AND.W…IOSATM(A1),D0‡findunrecognizedattributes ‰BNE‡BADCNFGreporterrorifany*6ŠMOVE.W‚#UNRPAR,D0ˆgetmaskofunrecognizedattributes1‰AND.W…IOSPRM(A1),D0‡findunrecognizedattributes ‰BNE‡BADCNFGreporterrorifany*9* now copy the table pointed by A4.L to our device table!*-‰MOVE.W„IOSATM(A1),D0‡D0=hisattributemask9‰AND.W…D0,IOSATW(A1)‡zerooutattributeshedoesnotwant‰NOT.W…D0’tochange9‰AND.W…IOSATW(A0),D0‡zeroouttheattributesofminethat'‰OR.W†D0,IOSATW(A1)‡doeswanttochange*>‰MOVE.W„IOSPRM(A1),D0‡getmaskofparametershewantstochang#‰MOVEM.LƒA0-A1,-(A7)‰saveregisters1‰LEA‡IOSREC(A0),A0‡addressoffirstparam.inCCB;‰LEA‡IOSREC(A1),A1‡addressoffirstparam.inuserdatbloc)‰LEA‡PARSIZE,A2Šloadparametersizetable*E* if this is the first configure, then copy CSB to local device table*/ŠTST.BƒLUSEDONE(A6)†isthisthefirstconfigure(‰IFˆTHEN.S‰copyCSBtodevicetable*<‰MOVE.W„#(IOSTLN-IOSATW)/2-1,D0calcnumberofbytestocopy*NXTPR:#‰MOVE.W„(A1)+,(A0)+‰copyparameters‰DBRA†D0,NXTPR!‰BRA.S…CHKPRMŽgocheckparameters‰ENDINXTPRM:"‰CLR.L…D2’cleartoholdwordvalue-‰MOVE.B„(A2)+,D2Œnumberofbytesinparameter,‰BEQ.S…CHKPRMŽendoftableflaggedwithzero+‰LSR.W…#1,D0checkifbitinparametermask(‰IFˆTHEN.S‰ifnotthenskipitelse,‰SUBQ.W„#1,D2moveparameterintodatablockMOVPARM::‰MOVE.B„(A0)+,(A1)+‰copyasmanyasthesizeofsizetable‰DBRA†D2,MOVPARMŠdonextbyte‰ELSE.S#‰ADD.L…D2,A0skiptonextparameter#‰ADD.L…D2,A1skiptonextparameter‰ENDI‰BRA‡NXTPRMŽdonextparameter*CHKPRM:%‰MOVEM.Lƒ(A7)+,A0-A1‰resoreregisters+‰MOVEQ…#CECTBR,D7Šloadbaudrateerrorcode)‰CMP.B…#$10,IOSBRT(A1)…testmaxbaudrate$‰BHI.S…BADCNFGlogerroriftoohigh*'‰MOVEQ…#CECTIM,D7Šloadmodemerrorcode>‰MOVE.W„#1<#$0FTHEN.SifnoterminatorclassB‰BTSTW…#IOATFUL,IOSATW(A1)andwewearenotterminatingonbuffer6‰IFˆTHEN.S‰full,andnoreadterminators,thisis%‰TST.L…IOSRTV(A1)Šabadconfiguration‰BEQ.S…BADCNFGexit‰ENDI"‰ELSE.S˜wehaveaterminatorclass‰MOVE.B„#$0F,D2checkclass‰AND.B…D0,D2maskvalue‰LSL.B…#4,D0matchvalue‰AND.B…D0,D2mask.matchvalue‰CMP.B…D0,D2testtheclass'‰BNE.S…BADCNFGthisisabadtermclass‰ENDI*;‰BTSTW…#IOABITS,IOSATW(A1)ifweonlyhave7bits/char,but3‰IFˆTHEN.S‰theonlypossibleterminationisonB‰IF.B†IOSTRC(A1)#$0FTHEN.Sacharwithhighbitset-error7‰BTST.B„#3,IOSTRC(A1)‡testifhighbitofmachvalue=0%‰BEQ.S…OKCNFGŽtheconfigurationisOK‰ENDI*<‰MOVE.L„IOSRTV(A1),D0‡checkreadterminatorsforsomevaluesCHKNXT:‰ROL.L…#8,D0withhighbitset"‰BEQ.S…BADCNFGwedidnotfindany‰BPL.S…OKCNFGŽwedidfindone ‰CLR.B…D0‰BRA‡CHKNXTŽdonext‰ENDI*OKCNFG:/‰MOVE.B„CCBTYPE(A5),IOSCTP(A1)setchanneltype*‰MOVE.B„XDSACIA,IOSDTP(A1)‚setdevicetype<‰MOVE.B„#IODTERM,IOSDRC(A1)setdrivercodetoterminaltype/‰STˆDCBCCF(A4)Šsetflagfordefaultconfigdone#ŠCLR.BƒD2setzerobitfornoerror‰RTS*BADCNFG:2‰MOVE.B„D7,IOSCEC(A1)‡setthespecifiederrorcode*ŠMOVE.B‚#ISTACNF,D1‡loadconfigerrorcodeŠRTS‰PAGEF*************************************************************************À*** ***‚INITº***<***‡getasegmentofmemoryfromexecandformatitinto…***1***‡freeenvelopepoolandfreemessagepool.******‡doSETcommandforICC.¢***>***‡sendconfigureICCcommandtoICC(configureinterruptƒ******‡vectorandlevel.)§***-***‡polluntiltheconfigurationisdone.”******‡normalexitfromINIT.£******À***F***********************************************************************INIT:*)*ˆgetsomepagesofmemoryforfreepools*!‰MOVE.L„A5,-(A7)ŒsaveCCBpointer4‰TR0$.PAGAL#TOTPAGESŠgetsomememoryforfreepools‰BRA.S…DOENVstartifOK‰MOVE.L‚(A7)+,A5?ŠKILL.DRIVERM331DRV_ID,T0PAGAL,A5,#NO_DCBƒnomemoryavailable. ‰PAGE**ˆformatfreeenvelopepool*DOENV:$‰MOVE.L„(A7)+,A5ŒrestoreCCBpointer1‰MOVE.L„#NOPACKS,D0‰getnumberofpacketswehave8‰MOVE.L„D0,NOPK_O(A5)‡storethenumberofpacketsinCCB9‰MOVE.L„A0,FEP_O(A5)ˆstorethefreeenvelopepoolpointer ‰REPEAT*‰LEA‡ENVLLEN(A0),A0†pointtonextenvelope)‰MOVE.L„A0,-ENVLLEN(A0)…storethepointer$‰SUBQ.L„#1,D0decrementpacketcount%‰UNTIL.LƒD0#0Šcounthasexpired**ˆformatfreemessagepool*8‰MOVE.L„A0,FMP_O(A5)ˆstorethefreemessagepoolpointer3‰MOVE.L„NOPK_O(A5),D0‡getnumberofpacketswehave ‰REPEAT)‰LEA‡TCMDLEN(A0),A0†pointtonextmessage)‰MOVE.L„A0,-TCMDLEN(A0)…storethepointer$‰SUBQ.L„#1,D0decrementpacketcount%‰UNTIL.LƒD0#0Šcounthasexpired*A*ˆgetemptyenvelopefromfreeenvelopepoolforBPPcommandpipe*5‰MOVE.L„FEP_O(A5),A0ˆloadfirstfreeenvelopepointer2‰MOVE.L„(A0),FEP_O(A5)†pointtonextfreeenvelope,‰SUBQ.L„#1,NOPK_O(A5)‡decrementpacketcount,‰MOVE.B„#1<™8¡7©:±;¹BÁAÉBÑCÙ,ŠMOVE.LD0,(A0)+‹storetheconvertedaddress*B*„NowreadtheICCstatusregisterandcheckwhethertheselftestB*„isfinished.Ifanerrorconditionexists,markthechanneldown *„andexit.*1ŠMOVE.LCCBCHB(A5),A1†gettheboardsbaseaddress STEST_WAIT:'ŠMOVE.BSTMSG(A1),D1‡gettheICCstatus(ŠBCHGƒ#BERRB,D1ŠinvertthebuserrorbitŠAND.B‚#$F,D1stripBIT4-7.ŠBEQ.S‚STEST_OK‹onzeroICCselftestfinished.ŠCMP.B‚#7,D1Žif7thenICCperformsselftest.ŠBEQ.S‚STEST_WAIT4ŠBSR…INITERR‹elsesomethingwentwrong;calltosave*£addressandsetboarddown.*ˆdoSETcommand!!* STEST_OK:/‰LEA‡SETSTR_O(A5),A0…pointtoSETstringinCCB.‰MOVE.W„#SETSTRLN,D2ˆloadtheSETstinglength*‰REPEATWO0:'‰MOVE.B„STMSG(A1),D1ˆgettheICCstatus‰AND.B…#STRPST,D1ŠstripMSB's"‰CMP.B…#1,D1arewestillwaiting?‰BEQ‡WO0‘waituntilchanged!‰CMP.B…#0,D1isready?‰IFTHEN.S1ŠBSR…INITERRŽError;calltosaveaddressandmark‰ENDIšthechanneldown.2‰MOVE.B„(A0)+,STMSG(A1)…writethedatabytetoICC-‰MOVE.B„#INTRICCB,INTRG(A1)interrupttheICCWO1:'‰MOVE.B„STMSG(A1),D1ˆgettheICCstatus‰AND.B…#STRPST,D1ŠstripMSB's"‰CMP.B…#0,D1arewestillwaiting?‰BEQ‡WO1‘waituntilchanged!‰CMP.B…#1,D1isready?‰IFTHEN.S0ŠBSR…INITERRŽError;calltosaveaddressandset‰ENDIšthechanneldown.3‰CLR.B…STMSG(A1)‹Clearoutthemessage/statusbyte.-‰MOVE.B„#INTRICCB,INTRG(A1)interrupttheICC"‰SUBQ.B„#1,D2decrementloopcount .‰UNTIL.BƒD2#0Šuntilstringhasbeensent*,*ƒAllocatethememoryforourdevicetables.*!‰MOVE.L„A5,-(A7)ŒsaveCCBpointer9‰TR0$.PAGAL#LUPAGES‹getthepagesforthedevicetables.‰BRA.S…DOCNFSŽstartifOK‰MOVE.L‚(A7)+,A5?ŠKILL.DRIVERM331DRV_ID,T0PAGAL,A5,#NO_DCB‚nomemoryavailable.‰PAGEDOCNFS:$‰MOVE.L„(A7)+,A5ŒrestoreCCBpointer2‰MOVE.L„A0,LUTBFP(A5)‡Savethebaseaddressofour*¦devicetables.*2*ˆNowsendtheconfigureICCcommandtotheboard.=*ˆFirstformattheconfigureICCITEM'sintheItembufferof0*ˆport.A0.Lpointstofirstdevicetableentry.* ‰MOVE.L„A0,A24‰LEA‡LUCITAB(A0),A0†GetbaseaddressofItembuffer.*C*…UseITEM6,theHALTSAVEADDRESSfeaturefordeguggingpurposes.*,‰MOVE.W„#CICCI6,(A0)+‡loadICCconfig.ITEM6-‰LEA‡HALTSA(A5),A1‡pointtohaltsaveaddress/‰MOVE.L„#'!HTS',(A1)+‡putineyecatcherinCCB'‰MOVE.L„A1,(A0)+Œloadhaltsaveaddress*>‰MOVE.W„#CICCI4,(A0)+‡loadICCconfig.ITEM4,interruptlevel.!‰CLR.L…D1’useasworkingregister>‰MOVE.B„CCBPPRIO(A5),D1…loadinterrupthardwarelevelfromCCB)‰MOVE.L„D1,(A0)+ŒputintotheItemtable.*?‰MOVE.W„#CICCI3,(A0)+‡loadICCconfig.ITEM3,interruptvector.4‰MOVE.B„CCBVECT(A5),D1†getinterruptvectorfromCCB%‰MOVE.L„D1,(A0)+ŒputintoItemtable.*.ŠMOVE.B#CMDCNFI,D0ˆloadconfigureICCcommand2ŠMOVE.B#PORT1-1,D1ˆloadport1(weuseitsqueue)5ŠLEA„LUCITAB(A2),A0…loadthestartofconfiguretable1ŠMOVE.L#3*ILEN,D2‰loadlengthofconfiguretable*/‰BSR‡LINKBPPlinkpacketintoBPPcommandqueue*K*ƒAftertheinitializationcalltotheICCwehavetowaitforcompletitionG*ƒofthecommand.Thisisnecessarytoavoidbustimeoutsontheboard.D*ƒThesetimeoutsmayoccureifcontrolisgivenbacktotheVERSAdosG*ƒInitializerimmediatelyaftersettingthecommand.IftheInitializerF*ƒtriestoaccessanonexistingboard,theICCisnotabletogetthe0*ƒbustoreturnthestatusfortheinitcommand.C*ƒBeforeenteringthewaitloop,weusethetimetosetuptheRead**ƒTranslationTablesfor7and8bit/char.*:ŠLEA…CRTT7B(A5),A0…Getthebaseaddressofthe7bittable-ŠMOVE.W‚#TIRTT,(A0)+†andsetuptheTableID.$ŠLEA…TABLEN(A0),A0…Fillittopdown.ŠMOVE.W‚#1  27,D0?FILLTT7H:MOVE.B‚D0,-(A0)ŠFirstfilltheupperhalfwithASCII.ŠDBRA„D0,FILLTT7H*ŠMOVE.W‚#127,D0:FILLTT7L:MOVE.B‚D0,-(A0)ŠFilllowerhalfalsoeithASCII.ŠDBRA„D0,FILLTT7L*:ŠLEA…CRTT8B(A5),A0…Getthebaseaddressofthe8bittable*ŠMOVE.W‚#TIRTT,(A0)+†andsettheTableID.<ŠLEA…TABLEN(A0),A0…Fillalsotopdownwithvalueof255-0.ŠMOVE.W‚#255,D0FILLTT8:‚MOVE.B‚D0,-(A0)ŠDBRA„D0,FILLTT8*:ŠMOVE.L‚CCBCHB(A5),A1…Getthebaseaddressofthechannel.7ŠMOVE.L‚BPPS_O(A5),A0…Getthestatuspipetailpointer.AINITPOLL:BTST„#0,FLNKB(A0)†Ifthisbitiszero,thecompletition/ŠBEQ.SƒINITOKŒstatusissentbackfromtheICC.1ŠBTST„#BERRB,STMSG(A1)‚Checkthebustimeoutbit.'ŠBNE.SƒINITPOLLŠProceedwaitingifset.7ŠBSR.SƒINITERR‹Elsecalltosaveaddressandmarkdown.**0INITOK:ƒRTS—Initializationofthechannelisok,*£returntoInitializer.*D*‚Thisroutineiscalledifaerrorconditionisdetectedduringthe*‚initializationoftheboard.*INITERR:DŠMOVE.B‚#1<***‚WegetherewhentheattechedtaskIOSinvokesCMRvia***A***‚aTRAP1withaninitiateI/Oparameterblocktoprocess.Š***@***‚CMRhasalreadycheckedtheparameterblocktoensureit‹***>***‚resideswithintheaddressspaceoftheattachedtask.***A***‚IOShasalreadyvalidatedtheIOCB,exceptforthebufferŠ******‚addresstherein.³******Å***D***‚WegotherethroughaJSRfromCMR,andwillexitwitnaRTS‡***@***‚allregistershavebeensavedbyCMRandwemayusethem‹***C***‚freely.Entryisatinterruptlevel0,andweareinsuper-ˆ******‚visormode.¸******Å***F***‚Entryconditions:A2.L=phisicaladdressofCMRparameterblk…***&***”A5.L=phisicaladdressofCCB“***2***”A6.L=phisicaladdressofTCBofattached‡*** ***¶task‹***A***‚Exitconditions:‚D0.B=Statusofprocessingtherepuest.‰*******›Itisnonzer  oonlyinthecasetheˆ***/***›thedriverhasnotenoughfreepackegesƒ***.***›toporocessthegivenrequest.Inthis„***)***›casestatus$84"channelbusy"is‰***$***›returnedtotheCMRhandler.Ž******Å***%***‚DothecommonpartofCOMMAND¦******Å*******ŠdecodethefollowingIOScommands:™******Å***'***ŠIOOWINƒoutputwithinput…(0004)–******ŠIOREADƒread’(0001)–******ŠIOWRITƒwrite‘(0002)–******ŠIOHALTƒhaltI/OŽ(0110)–***$***ŠIOTBRKƒtransmitbreakˆ(0040)–***$***ŠIOSTATƒrequeststatusˆ(0140)–******ŠIOCNFGƒconfigure(0180)–***%***ŠIOCHDCƒchangedefaults‡(8002)–******Å***K***************************************************************************** Command jump table*CMDSRT:&‰DC.W†IOOWINŽoutputwithinputcommand‰DC.W†IOREADŽreadcommand‰DC.W†IOWRITŽwritecommand‰DC.W†IOHALTŽhaltI/Ocommand#‰DC.W†IOTBRKŽtransmitbreakcommand#‰DC.W†IOSTATŽrequeststatuscommand‰DC.W†IOCNFGŽconfigurecommand$‰DC.W†IOCHDCŽchangedefaultscommand**ˆCommandroutineoffsets*CMDRTS:*‰DC.W†IOOWINR-*Œoffsettocommandroutines‰DC.W†IOREADR-*‰DC.W†IOWRITR-*‰DC.W†IOHALTR-*‰DC.W†IOTBRKR-*‰DC.W†IOSTATR-*‰DC.W†IOCNFGR-*‰DC.W†IOCHDCR-*‰PAGEK******************************************************************************9***‚Thistheactualentryinthecommandserviceroutine.***K****************************************************************************CMND:)‰MOVE.L„XIOUID(A2),A4‡gettheDCBpointer* ‰CLR.L…D5’clearworkingregister0‰MOVE.L„XIOCPK(A2),D6‡loadlogicalstartaddress.‰MOVE.W„XIOPLN(A2),D5‡loadlogicalendaddress,‰MOVE.L„CCBTASKA(A5),A0…loadtheTCBaddress**‰JSR‡LOGPHYŽgoconvertlogicaltophysical*‰IFTHEN.S$‰MOVE.B„#ISTAIP,D1‰returnerrorcode‰BRA‡NCMDCMPL‹goexitdriver‰ENDI*‰MOVE.L„D6,A3getIOCBpointer*ŠTST.BƒCCBFLAG(A5)2ŠIFTHEN.SŒIfthechannelisdown,detupthe*ŠMOVE.B‚#ISTACDN,D1‡errorcodeandreturn. ŠBRA…NCMDERRŠENDI*<ŠMOVE.L‚#MINPKT,D0ˆNowcheckifwehaveenoughfreepackeges@ŠCMP.LƒNOPK_O(A5),D0…tosendallcommandswhichmaybenecessary7ŠIFTHEN.SŒtoprocesstherequest.Return"channel3ŠMOVE.B‚#XSTBSY,D0ˆbusy"totheCMRhandlerifnot. ŠBRA…BAD_RETŠENDI*1‰MOVE.L„CCBTASKA(A5),CCBTASKB(A5)maketaskA=B*'‰MOVE.W„(A3),D2getthetypeofcommand‰CLR.W…D1’useasworkregister5‰MOVE.B„DCBCDV(A4),D1‡getthedevicenumberfromDCB.*$‰LEA‡CMDSRT(PC),A0‡pointtocommandsB‰MOVE.W„#(CMDRTS-CMDSRT)/2,D3numberofcmndswehaveinthetableNXTCMD:#‰CMP.W…(A0)+,D2Œisthisthecommand ‰DBEQ†D3,NXTCMD‹loopuntilfound‰BNE.S…NOCMDifnocommandexit*%*ƒAtthispointwefoundthecommand.*6‰BSR‡GETLUBUF‰Getthedevicetableentryforthisport *£intoA6.LB‰LEA‡CMDRTS-CMDSRT-2(A0),A0getthecommandroutineoffsetpointer*‰MOVE.W„(A0),D0getcommandroutineoffset&‰JMP‡(A0,D0.W)‹jumptocommandroutine*-* We get here when we do not find the command*NOCMD:"‰MOVE.B„#ISTAIF,D1Šloaderrorcode‰BRA‡NCMDCMPLŒgoexitdriver‰PAGE F*** -------------------------------------------------------------- ******‚IOHALTR·******À***#***ˆifwehaverunningI/Othen*******Šabortcommandrunningonthisport”*** ***ˆelse´***&***ŠReturninvalidfunctionerror.˜***$***Šandqueuenormalhaltevent.š******À***F*** -------------------------------------------------------------- ****IOHALTR:F*‚InhibitinterruptssothatnoabortcanbesentbyBREAKwhichcould *‚confuseus!*‰INHIBIT•maskallinterrupts5ŠBTST„#ACTIVE,LUBUSY(A6)seeifthedeviceisactive."ŠBEQ.SƒUNSHLTNo,soitsunsolicid**‰HALTOUTSTANDINGI/O*SOLHLT:?ŠMOVE.LA3,LUHIOCB(A6)…savethehaltIOCBaddressinthedeviceŠCLR.L‚D2‘table.$ŠMOVE.B#CMDAB,D0Šloadabortcommand)ŠBSR„LINKBPPŒgolinkinBPPcommandqueue%ŠBSET.B#HLTFLG,LUCONTR(A6)flaghaltŠBTST„#LSTREAD,LUCONTR(A6)1ŠIFTHEN.SŒIftheactivecommandisawrite,BŠBSET.B#FTXQFLG,LUCONTR(A6)settheflagtoflushTX  queuebeforeŠENDI–thenextcommand.ŠENABLE”enableinteruptsŠBRA„CMD_EXIT‹exit UNSHLT:!*‚IfthereisnoI/Oinprogress:H*‚Iftheconditionexists,someonesentusaHaltI/OrequestforanI/OG*‚theythoughtwasinprogressBUTbythetimetheHaltcommandreached'*‚uswehavealreadycompletedtheI/O.*ŠENABLE”enableinterupts*4ŠMOVE.L‚A4,D3CopytheDCBpointertousedregister.ŠMOVE.B‚#ISTAIF,D1>ŠMOVE.B‚D1,IOSSTA(A3)…updatetheusershaltI/Oparameterblock+*£withthecodethatsaysInvalidFunction.*#ŠMOVE.L‚#0,A0Setnocopyofevent.*ŠJSR…N_HLT_QEVENT†Queuenormalhaltevent.ŠIFTHEN.S9‹KILL.DRIVERM331DRV_ID,N_HLT_QVENT,A5,D3‚Killiffailed.ŠENDI*ŠBRA„CMD_EXIT‹donormalexit*‰PAGEF*** -------------------------------------------------------------- ******À******ƒIOWRITR…writerequest:£***'***ŒcallIO_COMMdocommonpartI/O•******‡Ifimagewriterequest:¢***3***ŒsendthewriterequesttotheICCandexit.‰***#***‡Ifformattedwriterequest:ž***#***ŒsearchwritebufferforCR.™***+***Œsendremainingbufferifnotempty.‘***-***Œsendterminationstringifnotempty.***(***ŒIfanycommandsentBRA‚CMD_SENT“***"***Œelsequitcommandasdone.š******À***F*** -------------------------------------------------------------- ***IOWRITR:0ŠCLR.BƒD0SetregistertoindicateuseofIOSSAD2ŠBSR…IO_COMN‹andIOSEADtodescribeoutputbuffer.*ŠBTSTW‚#OPT12,IOSOPT(A3)4ŠIFTHEN.SŒIfoptionistocleardiscardoutput8ŠBCLR.B#DISCARDF,LUCONTR(A6)condition,resettheflag.ŠENDI*-ŠMOVE.L‚D2,IOSLEN(A3)…Presettransferlength.*ŠBTST.B#DISCARDF,LUCONTR(A6)2ŠIFTHEN.SŒIfweactuallydiscardtheoutput,7ŠMOVE.B#ISTAOK,D1‰quittherequestsadoneandreturn. ŠBRA„NCMDCMPLŠENDI*ŠBCLR.B‚#FTXQFLG,LUCONTR(A6)4ŠIFTHEN.SŒIfthisflagisset,sendaflushTX3ŠMOVE.B‚#CMDFTXQ,D0‡queuecommandtotheICCboard. ŠBSR…LINKBPPŠENDI*AŠBCLR„#LSTREAD,LUCONTR(A6)Cleartheflagindicatinglastcommand *¦wasread.3ŠBTSTW‚#OPT3,IOSOPT(A3)ƒFormattedorimagerequest?ŠBNE.S‚IOWRI10ŒBranchifimage.4ŠBSR„CRLOCKThisisaformattedwrite,seewhethera6ŠSUB.L‚D0,D2ŽCRisinthebuffer.Ifso,transmitonly@ŠMOVE.LD2,IOSLEN(A3)†thepartinfrontoftheCRandpresettheA*4/24/86‚BEQ.S‚IOWRI20Œtransferlength.Ifthefirstcharacterin)*£thebufferisCR,skiptransmittingthe+*£bufferandgotosendterminationstring.*/IOWRI10ƒMOVE.B‚#CMDWR,D0‰Setup'write'command1ŠBSET.B‚#WRFLG,LUBUSY(A6)Setflagwriterunning.BŠBSET.B‚#TLENGTH,LUBUSY(A6)Setflagtoobtainlengthfromreturnd *¥packet.0ŠBSR…LINKBPP‹GolinkpacketinBBPcommandqueue*3ŠBTSTWƒ#OPT3,IOSOPT(A3)‚Ifthisisanimageoutput,ŠBNE„CMD_SENT‹donormalexit**‚elsehandlelinetermination.*$ŠCLR.L‚D0‘getconfiguredlinelengthŠMOVE.WCONFIG+IOSREC(A6),D0'ŠBEQ.S‚IOWRI20Œifzero,sendEOLstring**ŠREPEAT”Seeif#ofcharssentisanexact4ŠSUB.L‚D0,D2Žmultipleoftheconfiguredlinelength. ŠUNTIL)ŠBEQ„CMD_SENT‹Yes,donotsendEOLstring*THEN.SŒterminationstringisnotzero,load4ŠLEA„CONFIG+IOSEOL(A6),A0theaddressofthestring.**4/24/86ƒBTSTƒ#WRFLG,LUBUSY(A6)<*4/24/86‚IFTHEN.SŒIfthewriterunningflagis'ntset,.*4/24/86‚BSET.B#WRFLG,LUBUSY(A6)‚thensetit.*4/24/86‚ELSE.S=ŠBSET.B#WRFRM,LUBUSY(A6)‚Elsesetflagformattedwrite.This2*4/24/86‚ENDI–indicatestwowritepackagesmustbe'*£returnedbeforewequitthisrequest.$ŠMOVE.B#CMDWR,D0Šdo'write'command0ŠBSR„LINKBPPŒgolinkpacketinBBPcommandqueue*4/24/86‚ELSE.SG*4/24/86‚BTSTƒ#WRFLG,LUBUSY(A6)‚Ifthelengthoftheterminationstring@*4/24/86‚IFTHEN.SŒiszeroandthefirstcharinbufferwas5*4/24/86‚CLR.B‚D1‘aCR,justquittherequestwithOK&*4/24/86‚BRA„NCMDCMPL‹statusandexit. *4/24/86‚ENDIŠENDI*-ŠBRA…C  MD_SENTŠRequestisprocessed,nowexit.‰PAGEF*** -------------------------------------------------------------- ******À*******‚IOOWINR†outputwithinputrequest:—***9***‡callRDOPTtoconfiguretheoptionsfortheread.ˆ***>***‡callIO_COMNtovalidatetheinputbufferandsavetheƒ***3***Œreturnedphysicalbufferaddressandlength‰******‡handlethewritepart:£***3***‡callIO_COMNtovalidatetheoutputbuffer.Ž******‡Ifimagewriterequest£***!***ŒsendtotheICCandexit.›******‡Elseformattedwrite:¤***"***ŒsearchwritebufferforCRš***+***Œsendremainingbufferifnotempty.‘***-***Œsendterminationstringifnotempty.***2***Œifanycommandsentuptothispoint,exitŠ***0***Œelseinitiatethereadcommandandexit.Œ******À***F*** -------------------------------------------------------------- ****IOOWINR:=ŠBCLR.B‚#DISCARDF,LUCONTR(A6)Eachreadclearsthecondition.6ŠBCLR„#LSTREAD,LUCONTR(A6)‚Setlastrequestwaswrite.*ŠBCLR.B‚#FTXQFLG,LUCONTR(A6)9ŠIFTHEN.SŒIftheflagisset,sendaflushTXqueue'ŠMOVE.B‚#CMDFTXQ,D0‡commandtotheICC. ŠBSR…LINKBPPŠENDI*>*„dosomeworkforthereadtosetupafterthewriteisdone.*7ŠMOVE.WIOSOPT(A3),D5†GetIOSoptionsforthisrequest.$ŠBCLRƒ#3,D5ŽClearouttheimagebit.!ŠBCLRƒ#10,D5Imageinputrequest?ŠBEQ.S‚CMDIP1No,justskip.+ŠBSETƒ#3,D5ŽIndicateimagereadwithbit3.2CMDIP1:ƒBSR„RDOPTŽConfigurerequestedreadoptions*9ŠMOVE.B‚#$FF,D0‹SetregistertoindicateIOSRRNisbuffer0ŠBSR…IO_COMN‹startaddressandIOSLENislength.?ŠMOVE.LA0,LUWIPA(A6)†Storethestartaddressandthelenthfor!ŠMOVE.LD2,LUWILEN(A6)…lateruse.*/ŠCLR.BƒD0Nowdothewritepartoftherequest.9ŠBSR…IO_COMN‹Chechthebufferandgetaddressandlength.*<ŠBSET.B#OIFLG,LUBUSY(A6)‚flagchannelforoutputwithinput)ŠBTSTW‚#OPT3,IOSOPT(A3)ƒFormattedoutput?ŠBNE.S‚IOOWI10ŒNo,it'simage.4ŠBSR„CRLOCKThisisaformattedwrite:Seewhethera6ŠSUB.L‚D0,D2ŽCRisinthebuffer.Ifso,transmitonly@*4/24/86‚BEQ.S‚IOOWI20ŒthapartinfrontoftheCR.Ifthefirst(*£charisCR,skipsendingthbufferand#*£gotoprocessterminationstring.*0IOOWI10:‚MOVE.B#CMDWR,D0ŠSetup'write'command4ŠBSET.B#WRFLG,LUBUSY(A6)‚Setflagwriteisrunning.0ŠBSR„LINKBPPŒgolinkpacketinBBPcommandqueue*1ŠBTSTW‚#OPT3,IOSOPT(A3)ƒIsthisoutputformatted?ŠBNE„CMD_SENT‹No,thenexit.*$ŠCLR.L‚D0‘getconfiguredlinelengthŠMOVE.WCONFIG+IOSREC(A6),D0'ŠBEQ.S‚IOOWI20Œifzero,sendEOLstring**ŠREPEAT”Seeif#ofcharssentisanexact4ŠSUB.L‚D0,D2Žmultipleoftheconfiguredlinelength. ŠUNTIL$ŠBEQ„CMD_SENT‹DonotsendEOLstring*IOOWI20ƒMOVE.LLURLTL(A6),D2;ŠIFTHEN.SŒIfthelengthoftheconfiguredtermination@ŠLEA„CONFIG+IOSEOL(A6),A0‚stringisnotzero,loadit'saddress.**4/24/86‚BTSTƒ#WRFLG,LUBUSY(A6)=*4/24/86‚IFTHEN.SŒIfthewriterunningflagisnotset,-*4/24/86‚BSET.B#WRFLG,LUBUSY(A6)‚setitnow.*4/24/86‚ELSE.SCŠBSET.B#WRFRM,LUBUSY(A6)‚Elsesetflagformattedwritetoindicate8*4/24/86‚ENDI–thatweexpecttworeturnedwritepackets.*%ŠMOVE.B‚#CMDWR,D0‰Set'write'command-ŠBSR…LINKBPP‹andsendtheterminationstring.*5*4//24/86ELSE.S”elsetheterminationstringiszero.?*4//24/86BTSTƒ#WRFLG,LUBUSY(A6)‚Seewhetherweissuedawrite.9*4//24/86IFTHEN.SŒNotingisrunningyet,sosetupA*4//24/86MOVE.LLUWIPA(A6),A0†areadrequesttotheICC.UsetheC*4//24/86MOVE.LLUWILEN(A6),D2…preparedbufferaddressandlength./*4//24/86MOVE.B#CMDRD,D0ŠSetthereadcommand&*4//24/86BSR„LINKBPPŒandsenditout.*4//24/86 ENDIŠENDI*ŠBRA„CMD_SENT‹Exitnormal.‰PAGEF*** -------------------------------------------------------------- ******À******IOREADR¸***5***‡callRDOPTtoconfigureoptionforthisread.Œ***2***‡callIO_COMNtovalidatetheinputbuffer.***3***‡callLINKBPPtosendtherequesttotheICCŽ******‡donormalcommandexit.¢******À***  F*** -------------------------------------------------------------- ****IOREADR: BŠBCLR.B#DISCARDF,LUCONTR(A6)Everyreadclearsdiscardcondition.:ŠBSET„#LSTREAD,LUCONTR(A6)Indicatelastrequestwasread.)ŠMOVE.WIOSOPT(A3),D5†GettheIOSoptions&ŠBSR„RDOPTŽandconfigureREADoptions.*2ŠCLR.B‚D0‘SetupregistertoforceusageofIOSSAD4ŠBSR„IO_COMNŒandIOSEADforbufferchecksandcommon*£stuff.*%ŠMOVE.B#CMDRD,D0ŠSet'read'command.3ŠBSET.B#RDFLG,LUBUSY(A6)‚Setflagreadisrunning.*0ŠBSR„LINKBPPŒGolinkpacketinBBPcommandqueue*ŠBRA„CMD_SENT‹exitfromcommand‰PAGEF*** -------------------------------------------------------------- ******À******‚IOTBRKR·***(***‰sendaSENDBREAKcommandtoICC—***;***‰theICCautomaticallystopssendingthebreakafter„******‰300ms.°******À***F*** -------------------------------------------------------------- ****IOTBRKR:+‰MOVE.B„#CMDSNBP,D0‰loadsendbreakcommand-‰BSR‡LINKBPPgolinkcommandincommandqueue!‰MOVE.W„#ISTAOK,D1ŠloadOKstatusŠBRA„NCMDCMPL‹terminate‰PAGEF*** -------------------------------------------------------------- ******À******‚IOSTATR·***<***†copyourcurrentconfigurationandthestatusofthe†*** ***†portintotheuserarea.¢******À***F*** -------------------------------------------------------------- ****IOSTATR:0‰MOVE.L„IOSDBP(A3),D6‡getlogicaladdressofCSB'‰MOVE.L„#IOSTLN,D5ŠgetCSBtablelength.‰MOVE.L„CCBTASKB(A5),A0…getaddressofhisTCB**‰JSR‡LOGPHYŽgoconvertlogicaltophysical*‰IFˆ†THEN.S%‰MOVE.B„#ISTAADD,D1‰returnerrorcode‰BRA‡NCMDCMPLŒgoreturncommand‰ENDI*$‰MOVE.L„D6,A1loadCSBtablepointer8‰MOVE.B„LUSTAT(A6),IOSDST(A1)setupthecurrentstatus./‰MOVE.B„CCBTYPE(A5),IOSCTP(A1)setchanneltype+‰MOVE.B„#XDSACIA,IOSDTP(A1)setdevicetype*‰MOVE.B„#IOD331,IOSDRC(A1)‚setdrivercode<‰MOVE.W„#RECATT,IOSATM(A1)‚setmaskofrecognizedattributes<‰MOVE.W„#RECPAR,IOSPRM(A1)‚setmaskofrecognizedparameters*9‰LEA‡LUCONF(A6),A0‡pointtoconfigurationindevicetable2‰LEA‡IOSATW(A1),A1‡pointtomaskinhisdatablock*;‰MOVE.W„#(IOSTLN-IOSATW)/2-1,D0getnumberofwordstomove*REQLOOP:‰MOVE.W„(A0)+,(A1)+‰moveaword‰DBRA†D0,REQLOOPŠdonextword*#‰MOVE.B„#ISTAOK,D1Šloadgoodstatus‰BRA‡NCMDCMPLŒexitfromcommand‰PAGEJ*** -------------------------------------------------------------------******Ä******‚IOCNFGR»***>***‡Allcurrentandnewattributesandparametersareused‡***:***‡tobuildaconfigurationitemtableandnewaction‹***<***‡tables.Thisisdonetoavoidconfigurationproblems‰***<***‡ifonlysomeattributesorparametersaretochange.‰***>***‰callCNFGCMN‚tovalidatetheattributesandparameters„*** ***‰configureallattributes£*** ***‰configureallparameters£***;***‰sendconfiguretableandconfigureportcmdstoICCˆ***+***‰sendresetportcommandtotheICC.˜***>***‰sendrequestportstatuscommandtotheICC.Whenthis…***5***‰commandisreturned,therequestisfinished.Ž***,***‰donormalexitfromcommandhandler.—******Ä***J*** -------------------------------------------------------------------****IOCNFGR:*ŠBCLR.B‚#FTXQFLG,LUCONTR(A6)*ŠIFTHEN.Siftheflagisset,......2ŠMOVE.B‚#CMDFTXQ,D0ŠqueuecommandtotheICC..... ŠBSR…LINKBPPŠENDI*8ŠLEA„CONFIG(A6),A0†Pointtocurrentconfigurationinthe*£devicetable.*@‰MOVE.L„DCBDEV+IOSWTO(A4),IOSWTO(A0)copywriteandreadtimeout<‰MOVE.L„DCBDEV+IOSRTO(A4),IOSRTO(A0)valuestodevicetable.*=ŠMOVE.W‚#1<ŠMOVE.W‚IOSATW(A3),D5…Presetthearrtibuteswordforthecall.*2ŠBSR…CONF_ATTR‰Setupconfigurationofattributes.*1ŠBSR…CONF_PARŠSetupconfigurationofparameters.*,*…NowsendthedefinedItemtabletotheICC*4ŠLEA…LUCITAB(A6),A0„LoadbaseaddressofItemtable.6ŠMOVE.B‚#CMDCNFP,D0‡SetupconfigureportItemcommand2ŠBSR…LINKBPP‹andlinkpacketinBPPcommandqueue.*'*…NowconfigurethefourActionTables.*7ŠMOVE.B‚#CMDCNFT,D0‡Setuptheconfiguretablecommand.>ŠLEA…LUIRATID(A6),A0ƒLoadthebaseaddressofthefirsttable,AŠMOVE.L‚#(TABLEN+2)*4,D2‚setthelengthtoconfigurefourtables,2ŠBSR…LINKBPP‹andlinkpacketinBPPcommandqueue.‰PAGE*<*ˆhereisthepartwerewesendsomesolicitedeventpackets>*ˆtotheICC.Thisisonlydoneifthisisthefirstconfigure<*ˆrequestforthisportafterinitializationofthechannel.*4ŠMOVE.L‚A4,D3GettheDCBaddresstoincludeitinto*£themessage.<ŠTST.BƒLUSEDONE(A6)†Ifthisisnotthefirstconfigure,skip-ŠBNE.SƒNOSEŽsendingsolicitedeventpackages.*+‰CLR.L…D2Clearregistersnotusedforthis‰CLR.L…D4command. ‰CLR.L…D5'‰MOVE.L„D5,A0ŒNobufferaddressneeded.*1‰MOVE.B„#CMDSSE,D0Šsetupsolicitedeventcommand :‰FOR.B‚D6=#1TO#NOSSEBY#1DO.Ssendsometoeachport/‰BSR‡LINKBPPlinkpacketintoBPPcommandqueue‰ENDF*&ŠST†LUSEDONE(A6)†Settoindicatedone.NOSE:*9*ˆdoaresetporttoinitializethehardwareoftheport.*/ŠMOVE.L‚CCBTASKB(A5),D4ƒSetuptheTCBaddress.*ŠMOVE.L‚(A7)+,D5ŠRestoretheIOCBaddress./ŠMOVE.B‚#CMDRSTP,D0‡loadconfigureportcommand-ŠBSR…LINKBPP‹linkpacketinBPPcommandqueue*2ŠMOVE.B‚#CMDRQP,D0ˆNowissuearequestportstatus;ŠLEA…LUCITAB(A6),A0„command.Thisreturnestheactuallevel$ŠBSR…LINKBPP‹ofthehandshakelines.*5ŠBRA…CMD_SENTŠExittherequest.theinterrupthandler*£finishesitup.‰PAGEF*** -------------------------------------------------------------- ******À******‚IOCHDCR·***4***‰callCNFGCMNtofillandvalidateusersCSB.‹***6***‰copyuserCSBtodefaultconfigurationinDCB.‰***=***‰copycurrentstatusofrequesteddevicetousersCSB.‚*******‰gotoNCMDCMPLtocompletecommand.•******À***F**********************************************************************IOCHDCR:'*ˆfirstgetourconfiguretablepointer*:ŠLEA…DCBDEV(A4),A0…GetaddressofDCBconfigurationblock.*2ŠCLR.WƒD0Indicate,thatallrecognizedattributes(ŠCLR.WƒD2andparametersmaybechanged.*3ŠBSR…CNFGCMN‹Validatetheattributesandparameters,ŠBNE…NCMDCMPLŠandexitifanerrordetected.*8ŠMOVE.B‚LUSTAT(A6),IOSDST(A1)‚Updatethecurrentstatus.6ŠLEA…IOSATW(A1),A1ŠPointtotheattributewordinboth2ŠLEA…DCBDEV+IOSATW(A4),A0ƒblocksinordertocopy.3ŠMOVE.W‚#(IOSTLN-IOSATW)/2-1,D0#ofwordstocopy. CDEFLOOP:#ŠMOVE.W‚(A1)+,(A0)+‡Dowordbyword8ŠDBRA„D0,CDEFLOOP‡untilconfigurationinDCBisupdated.*)ŠMOVE.B‚#ISTAOK,D1ˆLoadnoerrorcodeand(ŠBRA…NCMDCMPLŠquitthiscommandasdone.‰PAGEF********************************************************************** ***INTR»***C***ThisistheroutinethatcompletestheI/Orequestsstarted„***@***bythethecommandserviceroutine.Itisenteredatthe‡***F*** interrupt priority level of interrupts on this channel, and is ***E***essentiallyasubroutinetothefirstlevelinterrupthandler‚******À***A***Entryconditions:D0,A0,A1havebeensavedbyCMRandare†******“availa  ble.£******À***B***Exitconditions:ExitisalwaysviaanRTS,whichtakesus…***1***’backtoCMR.Thecarrybitisexaminedby…***3***’CMRtodeterminewhetherthedriverhandledƒ***4***’theinterruptornot,soitcanbepassedon‚******’theinterruptchain.š******À***-***‹foreachpacketinBPPstausqueuedo******À***4***ŽRemovereturnedinformationfromthemessage†***!***Žandsaveitinregisters.™******À***%***Žcasereturnpacketcommandof•******À******‰1„READ”:™******‰2„WRITE“:™*** ***‰3„SENDSOLICITEDEVENT„:™******‰4„ABORT“:™******‰5„CONFIGUREICC‹:™******‰6„CONFIGUREPORTŠ:™******‰7„CONFIGURETABLE‰:™******‰8„RESERVED:™******‰9„RESERVED:™******‰10ƒRESERVED:™******‰11ƒREQUESTICCSTATUS†:™*** ***‰12ƒREQUESTPORTSTATUS…:™***!***‰13ƒREQUESTTABLESTATUS„:™******‰14ƒRESETPORTŽ:™******‰15ƒSENDBREAKŽ:™******‰16ƒFLUSHRXQ:™******‰17ƒFLUSHTXQ:™******À***F***----------------------------------------------------------------****INTR:@ŠMOVEM.LD1-D7/A2-A4/A6,-(A7)‚Savetheregistersusedinsidethe*§interrupthandler.9ŠTST.BƒCCBFLAG(A5)‡Ifthechannelisinerror,returnand4ŠBNE…EXTINTR0Šindicateinterruptnotserved,togive'*£CMR'sinterrupthandlerthechangeto%*£passcontroltonextchannelinCCB*£interruptchain.;ŠMOVE.L‚CCBCHB(A5),A0…Nowletshavealoockintotheboards>ŠBTST„#BERRB,STMSG(A0)‚statusregistertodecidewhetherabus+ŠIFTHEN.SŒerrorortimeoutisflaged.7ŠMOVE.B‚#$FF,D0‹Ifthebitisclear,indicatewearein1ŠBRA…SET_DOWNŠinterruptlevelandcallroutineto/ŠENDI–completeallpendingrequestswitherror.*L*‚Ifwereachthispoint,theboardseemsstillalive,seewhetheritpasses*‚backastatuspacket.*>ŠMOVE.L‚BPPS_O(A5),A0…GetthestatuspipepointerandseeifaDŠBTST.B‚#FLKFLG,FLNKB(A0)bufferisreturned.Iftheaddressisodd,9ŠBNE…EXTINTR0Štheinterruptisnotfromthisboard.Exit,"*£indicatinginterruptnotserved.(ŠBRA.SƒDO_INTR‹Goandhandlethispcket.*L*‚Thisisanenrypointwherewegetafterhandlingthefirstpacket.BeforeI*‚weexittheinterrupthandler,wecheckwhetheranadditionalpacketisE*‚returned,whileweareprocessingthelastone.Ifnot,wequitthe*‚Interruptasserved.* NEXT_PACK:=ŠTST.BƒCCBFLAG(A5)‡AtthispointrepeatthecheckwhethertheŠBNE…EXTINTR‹boardisdown. 9ŠMOVE.L‚CCBCHB(A5),A0…CheckalsotheICCstatusregister.ŠBTST„#BERRB,STMSG(A0)ŠIFTHEN.S4ŠMOVE.B‚#$FF,D0‹Theboardisdownnow.TerminateallŠBRA…SET_DOWNŠpendingrequests.ŠENDI*8‰MOVE.L„BPPS_O(A5),A0…Seewhetherthereisanadditional+‰BTST.B„#FLKFLG,FLNKB(A0)messagereturned.1‰BNE‡EXTINTR‹No,exitandreporttheinterruptas *¤served.DO_INTR:;ŠMOVE.L‚MSG(A0),A1ˆGetthepointertothereturnedmessage.*0ŠGET_ON_BDA1ŽLetchangeittoonbordaddressif *£necessary.8ŠMOVE.L‚FLK(A0),D0ˆGetthepointertothenextenvelope.*$ŠGET_ON_BDD0ŽSetthemalsoonboard.*2ŠMOVE.LD0,BPPS_O(A5)†Storeitstatuspipepointer ŠCLR.W‚D5 ŠCLR.W‚D1*ŠMOVE.BCMD(A1),D5‰Getthetypeofcommand'ŠMOVE.BPORT(A1),D1ˆGettheportnumber8ŠSUBQ.B#1,D1Žandsetitzerorelativeforinternaluse.+ŠMOVE.BSTAT(A1),D0ˆGetstatusfrommessage-ŠMOVE.BTERM(A1),D4ˆGettheterminatingchar.(ŠMOVE.LSAD(A1),A2‰Getthestartaddress*/ŠGET_ON_BDA2ŽChangeittoonbordifnecessary.*)ŠMOVE.LRLEN(A1),D2ˆGetthereturnlength$ŠMOVE.LIOCB(A1),A3ˆGetIOCBpointer'ŠMOVE.LTCBP(A1),D7ˆGettheTCBpointer"ŠMOVE.LDCB(A1),D3‰GetDCBpointer*6ŠBSR„GETLUBUF‹Getthebaseaddressofthedevicetable*£entryforthisportintoA6.*A*‚Nowcalltheroutinedependingonthetypeofcommandreturned.*= CASE 4,5,RESV,READ,WRITE,ABORT,SSEVENT,CNFICC,CNFPRT,CNFTBL,F& RQICCST,RESV,RESV,RESV,RQPRTST,RQTBLST,RESETPT,SNDBRK,FLSRXQ,FLSTXQ, & RESV,RESV ŠPAGEF***----------------------------------------------------------------******À*** ***‚READº***=***†CheckwhetheraHALTI/OorBREAK  wasreceived,while…***9***†thereadwasrunning.Inthiscasefinishupthis‰******†request.²***<***†Ifthereadterminatesnormal,furtheractionmaybe†******†necessary:°***,***†-Formattedreadregardlessofecho:–***<***ˆIfthelengthoftheterminationstringisnotzero,„******Œsendittotheport; ***6***ˆelsecompletetherequestbysendinganevent.Š******†-Imagereadwithecho:£***>***ˆIfterminatedbyreadterminator,sendittotheport;‚***6***ˆelsecompletetherequestbysendinganevent.Š******†-Imagewithoutecho:¥***1***ˆCompletetherequestbysendinganevent.******À***F***----------------------------------------------------------------***READ:=ŠBCLR.B‚#RDFLG,LUBUSY(A6)Cleartheflagsindicatingreadand5ŠBCLR.B‚#OIFLG,LUBUSY(A6)outputw.inputisrunning.*=ŠMOVE.L‚D2,IOSLEN(A3)…UpdatethetransferlengthintheIOCB.* ŠTST.BƒD00ŠIFTHEN.SŒIfthereturnedstatusis>$80:7ŠBSR…INTRCMN‹Linkthepackagesbacktopools,wedonot$ŠCMP.Bƒ#$82,D0‹needthemanylonger.%ŠIFTHEN.SŒIfthestatusis$81,/ŠMOVE.B‚#ISTADO,D1ˆreportadataoverrunerror.ŠELSE.S>ŠMOVE.B‚#ISTACSM,D1‡Elsequitthecommandwithchecksumerror.ŠENDI%ŠBRA…ICMDCMPLŠFinishupthiscommand.ŠENDI*6*‚Nowhandlethepacketaccordingthereturnedstatus.*;‰CASE†4,0,RSTAT0,RSTAT1,RSTAT2,RSTATR,RSTAT4,RSTATR,RSTATR,B&ˆRSTATR,RSTATR,RSTATR,RSTATR,RSTATR,RSTAT12,RSTATR,RSTATR,RSTATR,%&ˆRSTATR,RSTATR,RSTATR,RSTATR,RSTAT20*RSTAT0::ŠMOVE.BD4,(A2,D2.L)‡Thisreadisterminatedbyoneofthe**£definedreadterminators.Movethisbyte*£intothebuffer.ŠBTST.B#RDIMAGE,LUCONTR(A6)8ŠIFTHEN.SŒIftherequestwasimageread,increment8ŠADDQ.L#1,IOSLEN(A3)†thetransferlengthtoincludetheŠENDI–terminationcharacter.*E*‚RSTAT0fallsalwaysintothenextstatusroutinetofinishcommand.7*‚RSTAT1iscalledifthereadfillstheentirebuffer.*RSTAT1:@ŠBCLR.B#HLTFLG,LUCONTR(A6)IfaHALTI/Oisreceivedbeforethe"ŠBNE„IQEVTHLT‹commandiscomplete,*£goandprocessthehalt.*DŠBCLR.B#BRKFLG,LUCONTR(A6)Ifabreakwasreceivedbeforecomplete,&ŠBNE.S‚RQEVTBRKŒgoqueueabreakevent*'ŠBRA.S‚RDONEŽGoandfinishuptheread.*3*ƒWereceivedabadstatus,bringthechanneldown.*RSTAT2:RSTATR:-ŠMOVE.B‚#$FF,D0‹Quitallpendingrequestsand(ŠBRA…SET_DOWNŠmarkthechannelinerror.*M*‚Thispartisenteredifthestatusindicates,thatthecommandwasaborted.*RSTAT4:?ŠBCLR.B#HLTFLG,LUCONTR(A6)IfitwasabortedduetoaHALTI/O+ŠBNE„IQEVTHLT‹request,reportahaltevent.'*£Elseitwasabreak,simplyfallinto*£itshandling. RQEVTBRK:0ŠBSRINTRCMNLinkthepacketsbacktothepools.(ŠMOVE.B#ISTABRK,D1ˆSetupbreakstatus,3ŠBRA„ICMDCMPL‹anddocommonexitpartofinterrupt.*F* This is the handling if the returned status indicates a data overrun* in the receive queue.*RSTAT12:*I* This is the status for the at least # of character function of the ICC.E* It should never become true, but if it happens, we handle it like a* data overrun.*RSTAT20:0ŠBSRINTRCMNLinkthepacketsbacktothepools.,ŠMOVE.B#ISTADO,D1‰Setupdataoverrunerror3ŠBRA„ICMDCMPL‹anddocommonexitpartofinterrupt.*7*‚Thisisthecommoncodeforanormalterminatedread.F*‚IfthereisanycommandtosendtotheICC,thereturnedpacketsare*‚usedtodothis.*RDONE:ŠBTSTƒ#RDIMAGE,LUCONTR(A6):ŠIFTHEN.SŒIftherequestwasformattedread,wesendEŠMOVE.LLURLTL(A6),LEN(A1)theEOLstringifit'slengthisnotzero.7ŠIFTHEN.SŒThisisdoneregardlessofechoornot.6‹BSET‚#WRFLG,LUBUSY(A6)‚Settheflagwriteisrunning.B‹LEA„CONFIG+IOSEOL(A6),A4GettheaddressoftheEOLstringinthe:‹GO_OFF_BDA4devicetable,convertittooffboardaddress/‹MOVE.LA4,SAD(A1)ˆandwriteittothemessage.0‹MOVE.B#CMDWR,CMD(A1)„Setupthewritecommand,4‹BSR„RE_LINK‹andlinkthepacketsbacktothequeue.#‹BRA„NEXT_PACK‰Seefor  nectpacket.ŠENDI.ŠELSE.S”Iftherequestwasformattedreadwith‹BTSTƒ#NOECHOB,LUCONTR(A6)echo‹IFTHEN.S4ŒTST.BSTAT(A1)Šandthereadwasterminatedduetoa;ŒIFTHEN.SŠterminationcharacter,sendthischaracter.2ŒBSET‚#WRFLG,LUBUSY(A6)‚Setflagwriteisrunning.:LEA„TERM(A1),A4†Pointtotheterminationcharacterinthe.GO_OFF_BDA4Œmessageandconverttheaddress.6MOVE.LA4,SAD(A1)‡Thisisthebuffertowriteandits!MOVE.L#1,LEN(A1)‡lengthisone.+MOVE.B#CMDWR,CMD(A1)ƒSetupwritecommand4BSR„RE_LINKŠandlinkthepacketsbacktothequeue.$BRA„NEXT_PACKˆSeeformorepackets.)ŒENDI•Weneednottoechotheterminator.‹ENDIŠENDI0ŠBSR„INTRCMNŠLinkthepacketsbacktothepools.0ŠMOVE.B#ISTAOK,D1‡Completethecommandasdone. ŠBRA„ICMDCMPL ‰PAGEF***----------------------------------------------------------------*** ***‚WRITE¹***A***„-IfaHALTI/OoraBREAKwasflaged,whilethereadwasƒ***'***ˆrunning,finishuptherequest.™***=***„-Ifthisisthefirstpacketfromaformattedwrite,‡******ˆjustexit.®***?***„-Ifthisisthelastpacketofawriteandtherequest…***;***ˆwasnotoutputwithinput,finishupthecommandby…***%***ˆqueuingacompletitionevent;›***:***†ElsesetupthereadcommandfortheICCandexit.ˆ******À***F***----------------------------------------------------------------****WRITE:*ŠBCLR.B#TLENGTH,LUBUSY(A6):ŠIFTHEN.SŒThefirstreturnedwritepacketistheone=ŠMOVE.LD2,IOSLEN(A3)†fromwhichtotakethetransferlength.ŠENDI*,ŠCASEƒ4,0,WSTAT0,WSTAT1,WSTAT2,WSTATR,WSTAT4***WSTAT0:WSTAT1:DŠBCLR.B#WRFRM,LUBUSY(A6)‚Clearthecontrolflag.Iftherequestwas6ŠBNE.S‚LNTRMŽformatted,weexpectanadditionalpacket*£beforewecomplete.1ŠBCLR.B#WRFLG,LUBUSY(A6)‚Cleatthecontrolflag.7ŠBCLR.B#HLTFLG,LUCONTR(A6)IfaHALTI/Owasrequestd.ŠBNE„IQEVTHLTŒgotohandleit.*?ŠBCLR.B#BRKFLG,LUCONTR(A6)Ifabreakwasreceived,handleit. ŠBNE.S‚WBREAK*CŠBTST.B#OIFLG,LUBUSY(A6)‚Ifthiswasanoutputwithinputrequest,.ŠBNE.S‚OWICMDgotoinitializetheinputpart.*2ŠBSR„INTRCMNŒUnlinkpacketsand‚themtofreepools,ŠMOVE.B#ISTAOK,D1‰andcompletetherequest. ŠBRA„ICMDCMPL**‚Wereceivedabadstatus:*WSTAT2:WSTATR:-ŠMOVE.B‚#$FF,D0‹Quitallpendingrequestsand$ŠBRA…SET_DOWNŠmarkthechanneldown.*3*‚Thiscodegetsactiveifthecommandisabortded.*WSTAT4:AŠBCLR.B#WRFRM,LUBUSY(A6)‚Iftherequestwasformatted,weexpect"ŠBNE.S‚LNTRMŽanadditionalpacket.*:ŠBCLR.B#WRFLG,LUBUSY(A6)‚Clearthewriteisrunningflag.?ŠBCLR.B#HLTFLG,LUCONTR(A6)IfweareabortedduetoaHALTI/O/ŠBNE.S‚IQEVTHLTŒrequest,gotoqueuetheevent.*9ŠBCLR.B#BRKFLG,LUCONTR(A6)Elseitwasareceivedbreak.;WBREAK:ƒBSR„INTRCMNUnlinkpacketand‚returninfreepools.'ŠMOVE.B#ISTABRK,D1‰Setupbreakstatus(ŠBRA„ICMDCMPLŒandfinishuptherequest.*1*‚Thiswasthefirstpacketofaformattedwrite:*LNTRM:5ŠBSR„INTRCMNŒLinkbackthepackegestothefreepools8ŠBRA„NEXT_PACKŠandseeifthereisanadditionalpacket.*?*‚Wecompletedtheoutputpartofanoutputwithinputcommand.%*‚Nowwehavetoinitializetheread.*OWICMD:1ŠBSETƒ#RDFLG,LUBUSY(A6)‚Setflagreadisrunning.+ŠMOVE.B#CMDRD,CMD(A1)…Setupreadcommand.1ŠMOVE.LLUWIPA(A6),D2†Getaddressofinputbuffer2ŠGO_OFF_BDD2ŽTranslateaddresstooffboardvalue.-ŠMOVE.LD2,SAD(A1)‰Setupthebufferaddress.AŠMOVE.LLUWILEN(A6),LEN(A1)Setupthelengthofthereadbuffer.9ŠBSR„RE_LINKŒLinkthepackagesbacktothecommandqueue.+ŠBRA„NEXT_PACKŠSeeforadditionalpackages.* IQEVTHLT:2ŠBSR„INTRCMNŒLinkthepackagesbacktofreepools.5ŠCLR.B‚LUBUSY(A6)‰Cleartheactiveflagfortheport.@ŠMOVE.LLUHIOCB(A6),A0…GettheIOCBaddressoftheHALTrequest.DŠMOVE.B#ISTAOK,IOSSTA(A0)UpdatetheusersHaltI/OstatuswithOK.4ŠMOVE.B‚#ISTATO,D1ˆSetuptimeoutstatusforrequest.ŠMOVE.B‚D1,IOSSTA(A3)…andforthequ eueevent.*#ŠMOVE.L‚#0,A0Setnocopyofevent.:ŠJSR…I_HLT_QEVENT†QueueaHALTeventfrominterruptlevel.ŠIFTHEN.S)‹KILL.DRIVERM331DRV_ID,I_HLT_QVENT,A5,D3ŠENDI*)ŠBRA…NEXT_PACK‰Seeforadditionalpacket.*ŠPAGEF***----------------------------------------------------------------******À***.***SSEVENT‚(SENDSOLICITEDEVENTCOMMAND)˜*******†MakeacopyofICCSTATEandMASK.˜***1***†RelinkthesolicitedeventpackettoICC.‘***@***†UpdatethedevicestatuswithreportedstatusofCTSand‚******†DCDline.±***+***†Decodethetypeofsolicitedevent.—***"***†Dotheappropriateaction. ******À***F***----------------------------------------------------------------****SSEVENT::ŠMOVEM.WRLEN(A1),D6-D7„Getrecordandstateofsol.event4ŠMOVE.L‚DCB(A1),D3ˆGettheDCBaddressofthisport.&ŠCLR.LƒRLEN(A1)ŠClearstateandrecord#ŠCLR.WƒSTAT(A1)ŠClearSTATandTERM*1ŠBSR…RE_LINK‹Linkthesolicitedeventpacketback*£tothecommandqueue.=*‰updatethedevicestatusbytewiththereceivedstatusfrom*‰theportreturningthisevent*ŠBTST„#CTSB,D73ŠIFTHEN.SŒSetthenotreadybitaccordingthe:ŠBCLR.B‚#XDSNRB,LUSTAT(A6)returnedstateoftheCTSline.ŠELSE.SŠBSET.B‚#XDSNRB,LUSTAT(A6)ŠENDI 1ŠBTST„#DCDB,D7ŠSettheDCDbitalsoaccordingthe/ŠIFTHEN.SŒreturnedstateoftheDCDline.ŠBCLR.B‚#XDSDCD,LUSTAT(A6)ŠELSE.SŠBSET.B‚#XDSDCD,LUSTAT(A6)ŠENDI*%*‰letsseewhatkindofeventwehave*(ŠBTST„#IR1B,D6ŠdowehaveIRAT#1event?ŠIFTHEN.S=ŠBCHG.B‚#DISCARDF,LUCONTR(A6)togglethediscsrdoutputflag.ŠENDI*"ŠBTST„#BRKB,D6ŠIfwehaveabreak,ŠBNE.SƒBREAKgoandprocessit.*-ŠBTST„#DCDB,D6ŠDowehaveDCDchangeofstateŠIFTHEN.SEŠBTSTWƒ#IOADCD,CONFIG+IOSATW(A6)Ifweareconfiguredtoreportthis,$ŠBNE.SƒBREAKhandleitlikeabreak.ŠENDI**‰BRA‡NEXT_PACKˆSeeforadditionalpackets.**‚WereceivedaBreakevent.*BREAK:?ŠBTST.B‚#WRFLG,LUBUSY(A6)Ifawriteorreadisrunningonthis-ŠBNE.SƒSOLICID‹port,thisisasolicidevent.ŠBTST.B‚#RDFLG,LUBUSY(A6) ŠBEQ.SƒUNSOL*SOLICID:<ŠBSET.B‚#BRKFLG,LUCONTR(A6)Setflagforthereasonofabort1ŠMOVE.B‚#CMDAB,D0‰andaborttherunningcommands. ŠBSR…LINKBPPAŠBSET.B‚#FTXQFLG,LUCONTR(A6)SetflagstoflushTXandRXqueues.ŠBSET.B‚#FRXQFLG,LUCONTR(A6)%ŠBRA…NEXT_PACK‰Seeforemorepackets.*UNSOL:DŠBSET.B‚#FRXQFLG,LUCONTR(A6)SetflagtoflushRXqueuebeforeread.2ŠMOVE.B‚LUSTAT(A6),D4…Getthestatusofourdevice6ŠBSET„#XDSBRK,D4ˆSetthebreakbitinthestatusbyte.!ŠLSL.Wƒ#8,D4Shifttosecondbyte(ŠMOVE.B‚#XDSACIA,D4‡Loadthedevicetype'ŠMOVE.L‚#0,A0Setnocopyoftheevent.3ŠJSR.LƒI_UNS_QEVENT†Queueunsoliciteddeviceevent.ŠIFTHEN.S)‹KILL.DRIVERM331DRV_ID,I_UNS_QVENT,A5,D3ŠENDI%ŠBRA…NEXT_PACK‰Seeformorepackeges.‰PAGEF***----------------------------------------------------------------******À*** ***ABORTº***3***†call‚INTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À***F***----------------------------------------------------------------****ABORT:3‰BSR‡INTRCMNŠUnlinkpacketand‚returninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackeges.  F***----------------------------------------------------------------******À******CNFICC:¸***3***†call‚INTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À***F***----------------------------------------------------------------****CNFICC:)‰CMP.B„#OKSTAT,STAT(A1)‚SeeifpacketOK.‰IFTHEN.S-ŠMOVE.B‚#$FF,D0‹Quitallpendingrequestsand$ŠBRA…SET_DOWNŠmarkthechanneldown.‰ENDI3‰BSR‡INTRCMNŠUnlinkpacketand‚returninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackeges.  F***----------------------------------------------------------------******À******CNFPRT:¸***3***†call‚INTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À***F***------------------------------------- ---------------------------****CNFPRT:3‰BSR‡INTRCMNŠUnlinkpacketand‚returninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackeges.  F***----------------------------------------------------------------******À******CNFTBL:¸***3***†call‚INTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À***F***----------------------------------------------------------------****CNFTBL:3‰BSR‡INTRCMNŠUnlinkpacketandreturninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackeges.  F***----------------------------------------------------------------******RQICCST:·***3***†call‚INTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À***F***----------------------------------------------------------------****RQICCST:3‰BSR‡INTRCMNŠUnlinkpacketand‚returninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackeges.  F***----------------------------------------------------------------******À******RQPRTST¸***%***†ifbadstatuskillthesystem***3***†call‚INTRCMN‚(returnpacketstofreepools)***2***†exit‚toCMDCMPL‚toquitconfigurerequest.Ž******À***F***----------------------------------------------------------------****RQPRTST:(ŠCMP.Bƒ#OKSTAT,STAT(A1)‚seeifpacketOKŠIFTHEN.SŠCMP.Bƒ#4,STAT(A1)$ŠBEQ…IQEVTHLTŠreturnsuccessfulhalt-ŠMOVE.B‚#$FF,D0‹Quitallpendingrequestsand$ŠBRA…SET_DOWNŠmarkthechanneldown.ŠENDI*3ŠBSR…INTRCMN‹Unlinkpacketand‚returninfreepools*$ŠTST.BƒCTSFLG(A2)ˆTesttheCTSstate6ŠIFTHEN.SŒandsetbitinstatusbyteaccordingly8ŠBCLR.B‚#XDSNRB,LUSTAT(A6)clearstatusbyteaccordinglyŠELSE.S6ŠBSET.B‚#XDSNRB,LUSTAT(A6)setstatusbyteaccordinglyŠENDI*$ŠTST.BƒDCDFLG(A2)ˆTesttheDCDstate6ŠIFTHEN.SŒandsetbitinstatusbyteaccordingly8ŠBCLR.B‚#XDSDCD,LUSTAT(A6)clearstatusbyteaccordinglyŠELSE.S6ŠBSET.B‚#XDSDCD,LUSTAT(A6)setstatusbyteaccordinglyŠENDI*:ŠMOVE.L‚LUWIPA(A6),A2…UpdatethedevicestatusintheCSB.ŠMOVE.B‚LUSTAT(A6),IOSDST(A2)*3ŠMOVE.B‚#ISTAOK,D1ˆQuittherequestwithOKstatus. ŠBRA…ICMDCMPL  F***----------------------------------------------------------------******À******RQTBLST:·***3***†call‚INTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À***F***----------------------------------------------------------------****RQTBLST:3‰BSR‡INTRCMNŠUnlinkpacketand‚returninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackeges.‰PAGEF***----------------------------------------------------------------******À******RESETPT¸***%***†ifbadstatuskillthesystem***3***†call‚INTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À***F***----------------------------------------------------------------****RESETPT:(‰CMP.B…#OKSTAT,STAT(A1)SeeifpacketOKŠIFTHEN.SŠCMP.Bƒ#4,STAT(A1)ŠIFTHEN.S-ŠMOVE.B‚#$FF,D0‹Quitallpendingrequestsand$ŠBRA…SET_DOWNŠmarkthechanneldown.ŠENDIŠENDI3‰BSR‡INTRCMNŠUnlinkpacketand‚returninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackages. F***----------------------------------------------------------------******À******SNDBRK:¸***3***†call‚INTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À***F***----------------------------------------------------------------****SNDBRK:3‰BSR‡INTRCMNŠUnlinkpacketand‚returninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackeges.  F***----------------------------------------------------------------******À******FLSRXQ:¸***3***†call‚INTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À***F***----------------------------------------------------------------****FLSRXQ:3‰BSR‡INTRCMNŠUnlinkpacketand‚returninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackages.  F***----------------------------------------------------------------******À******FLSTXQ:¸***3***†call‚I NTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À******À***F***----------------------------------------------------------------****FLSTXQ:3‰BSR‡INTRCMNŠUnlinkpacketand‚returninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackages.  F***----------------------------------------------------------------*** ***RESV»***3***†call‚INTRCMN‚(returnpacketstofreepools)******†exit‚toNEXT_PACK¨******À***F***----------------------------------------------------------------****RESV:/*ˆthesecommandsarenotjetimplementedbyICC 3‰BSR‡INTRCMNŠUnlinkpacketand‚returninfreepools+‰BRA‡NEXT_PACKˆSeeforadditionalpackages. E**************************************************************************–ENDOFICCDRV˜*****E*********************************************************************‰END NNNNNJ* WARNING - The MVME360 driver is NOT supported without the purchase of an(*‹MVME360board,partnumberMVME360-VX.ŠENDNNNNNN Ná5M420DRV‚IDNT45,0…VERSAdosMVME420(SASI)diskdriverNNNNNNNãêóMû*- 787#>+:3;;7C9K9S:[5c6k;sB{?ƒ2‹;“;›3£5«9³3»IÃ7Ë0Ó31‰TTL‚M420DRV:VERSAdosMVME420(SASI)diskdriverK***************************************************************************K***************************************************************************K***************************************************************************K****************************************************************************%*ˆM420DRV:‚VERSAdosSASIdiskdriver.**ˆRevisionhistory:**ˆ10/31/85‚Initialrelease.4*ˆ12/11/85‚AddedCHK_PARAMroutinecalledbyDISKlib*K***************************************************************************K***************************************************************************K***************************************************************************K***************************************************************************‰PAGE**ƒXREF'SfromDISKLIB*ŠXREF…DISK_INITŠXREF…DISK_COMMANDŠXREF…CHAN_DONE **‚Equatefilesincluded:* *‰INCLUDE‚9995.&.TCB.EQ*‰INCLUDE‚9995.&.CCB.EQ*‰INCLUDE‚9995.&.LV5.EQ*‰INCLUDE‚9995.&.IOE.EQ*‰INCLUDE‚9995.&.NIO.EQ*‰INCLUDE‚9995.&.DISKCCB.EQ*‰INCLUDE‚9995.&.DISKMEM.EQ*‰INCLUDE‚9995.&.DISK.EQ*‰INCLUDE‚9995.&.UTILITY.MC  ŠOPTCRE,PCS **‰MISCEQUATES*3DRIVES ƒEQU‡4“Totalnumberofdrivesonourchannel. **ˆBWN‡2/13/84ƒPJD‚9/18/84*1GOODCODEEQU‡0“Opcodeforformatsectoras"good"1BADCODE‚EQU‡$80‘Opcodeforformatsectoras"bad"7ALTCODE‚EQU‡$40‘Opcodeforformatsectoras"alternate"*‰NOLIST*$*‰Includethestandardequatefiles:*‰INCLUDE‚9995.&.TCB.EQ‰INCLUDE‚9995.&.CCB.EQ‰INCLUDE‚9995.&.LV5.EQ‰INCLUDE‚9995.&.IOE.EQ‰INCLUDE‚9995.&.NIO.EQ‰INCLUDE‚9995.&.UTILITY.MC ‰TTL†DISK.EQ‰LIST‰INCLUDE‚9995.&.DISK.EQ‰TTL†DISKCCB.EQ‰INCLUDE‚9995.&.DISKCCB.EQ‰TTL†M420DRV.SA‰PAGE/‰OFFSETƒDCCBDDPContinuewithchannel-dependent*¦CCBvariablespace.  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* *%%%Å%%%*B*%%%„Device-dependent,channelrelated,variablesstarthere.‰%%%* *%%%Å%%%**%%%™(CCBSPACE)¡%%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  E*ˆThefollowingsubsectionof‚thechannel-relatedpartofthedevice-H*‚dependentportion‚of‚the‚CCBisusedbytheSASIinterrupthandlerforH*‚buildinga‚commandpacketthatcanbesenttotheSASIcontroller.ƒTheM*‚variablesinthecommandpacketmustoccurintheexactorderthatisshownK*‚becausetheentirecommandpacketistreatedasanindivisibleblock.ƒTheK*‚SASIcontroller‚interpretstheindividualfieldsofthecommandpacketas#*‚shownintheillustrationsbelow.  4*‡7‚6‚5‚4‚3‚2‚1‚0‹BytezeroofaSASIcommandpacketD*…--------------------------‡containstheopcodethattellstheSASI4*‚0‚|‰Opcode‰|‡controllerwhatoperationtoperform.?*…|------------------------|‡Bits7-5ofbyteonecontainthe5*‚1‚|‚LUNƒ||‡controller-definedlogicalunitnumber,3*…|-----------|‡whichisequivalenttothechannel3*‚2‚|‰Logicalˆ|‡devicenumber.‚Bits4-0ofbyteone7*…|--‡Sector‡--|‡andallofbytestwoandthreeusually/*‚3‚|‰Number‰|‡containalogicalsectornumber.*…|------------------------|7*‚4‚|†SectorCount†|‰BytefourofaSASIcommandpacketB*…|------------------------|‡normallycontainsasectorcount,but<*‚5‚|†ControlCode†|‡bytefourisusedtocontaintheinter-B*…--------------------------‡leavefactorwhenaformatcommandis*‡^‚^›beingspecified.*‡|‚|:*‡|‚----DisabledataFinally,bytefiveofaSASIcommand;*‡|‡errorcorrection.†packetcontainsacontrolcode.‚Bit7**‡|žofthecontrolcodecanbesettodis-A*‡-------Disableretries.‡ableautomaticcontrollerretries,and)*¦bit6ofthecontrolcodecanbesetto%*¦disabledataerrorcorrection.‚Bits&*¦5-0ofthecontrolcodeareignored.‰PAGE4*‡7‚6‚5‚4‚3‚2‚1‚0‹WhentheopcodefieldofacommandC*…--------------------------‡packetspecifiestheSASIcommandthatB*‚0‚|‚Define-FormatOpcode‚|‡definestheformatforafloppydisc,@*…|------------------------|‡someoftheremainingfieldsofthe5*‚1‚|‚LUNƒ||‡commandpacketareinterpretedalittle2*…|-----------|‡differently(asdescribedbelow).*‚2‚|ˆIgnored‰|.*…|--”--|‰Thefieldthatnormallycontainsthe-*‚3‚|˜|‡logicalsectornumberisignored,andA*…|------------------------|‡thefieldthatnormallycontainsthe1*‚4‚|ˆIgnored‰|‡sectorcountisalsoignored.‚TheB*…|------------------------|‡control-codefieldisusedtospecify9*‚5‚|†ControlCode†|‡theformatthatisbeingdefinedforB*…--------------------------‡thefloppydisc.‚Bit0ofthecontrol**™^‚^‰codecanbesettospecifyadouble-)*™|‚|‰sidedfloppydisc,andbit1oftheA*‚1=DoubleDensity-----‚|‰controlcodecanbesettospecifya(*œ|‰double-densityfloppydisc.‚Bits7-2>*‚1=DoubleSided----------‰ofthecontrolcodeareignored. E*ˆThesevariablesdefinethecommandpacketthatwasdescribedabove. !‰DS.W…0”Aligntoawordboundary. 2CMDOP„DS.B…1–TheCMDOPfieldofthecommandpacket)*¦containstheopcodethattellstheSASI'*¦controllerwhatoperationtoperform.$*¦Forexample,theCMDOPfieldmight)*¦containanopcodethatspecifiesaread)*¦op eration,awriteoperation,aformat-**¦discoperation,aformat-trackoperation%*¦oradefine-formatoperation.‚Refer'*¦totheinterrupthandlerfordetails. 2CMDLSNƒDS.B…3–TheCMDLSNfieldofacommandpacket:LSNMASK‚EQU†$001FFFFFŒoftencontainsalogicalunitnumber5LUNFIELDEQU†5”andalogicalsectornumbertospecify)*¦aparticularareaofaparticulardisc.&*¦TheLSNMASKvalueisabitmaskthat$*¦indicateswhichbitsoftheCMDLSN(*¦fieldcanbeusedforalogicalsector)*¦number,andtheLUNFIELDvalueisabit)*¦numbertoindicatethatbits5-7ofthe)*¦firstbyteoftheCMDLSNfieldareused"*¦fortheLUNfield.‚TheLUNfield)*¦containsthecontroller-definedlogical)*¦unitnumber,whichisequivalenttothe*¦channeldevicenumber. 4CMDSECTSDS.B…1–TheCMDSECTSfieldcontainsasector8CMDILVƒEQU†CMDSECTScountforareadorwriteoperation,&*¦anditcontainsaninterleavefactor&*¦foraformatoperation.‚TheCMDSECTS&*¦fieldalwayscontainsthevaluezero *¦foradefine-formatoperation.‰PAGE/MAXSECTSEQU†255”Thislabeldefinesthemaximum(*¦possiblevaluethatcanbeusedinthe'*¦CMDSECTSfield.‚IfanI/Otransaction)*¦involvesmorethanMAXSECTSsectors,we(*¦mustbreakupthetransactionintotwo*¦ormoresmallertransactions. 2CMDCTRL‚DS.B…1–TheCMDCTRLfieldofaSASIcommand3NORETRY‚EQU†7”packetcontainsacontrolcode.‚Bit74NOCORRƒEQU†6”ofthecontrolcodeinanormalcommand)*¦packetcanbesettodisablecontroller(*¦retries,andbit6ofthecontrolcode'*¦inanormalcommandpacketcanbeset'*¦todisabledataerrorcorrection.‚The(*¦SASIcontrollerordinarilyignoresthe%*¦remainingbitsofthecontrolcode. >CTRLDFLTEQU†0<*%%%„Endofdevicedependent,channelrelated,variables.%%%* *%%%Å%%%**%%%•ENDOFCCBSPACE %%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  3CCBSIZEBEQU†*–CCBSIZEBdefinesthesize(inbytes)(*¦ofacompleteCCBfortheSASIdriver. %*¨CCBSIZEdefinesthesize(inpages)?L0080„EQU†CCBSIZEB+PAGESIZE-1‚ofaCCBfortheSASIdriver,andBCCBSIZE‚EQU†L0080/PAGESIZE‡EXTCCBSZdefinesthesize(inpages)of*ƒ15‚14‚13‚12ƒ11‚10ƒ9ƒ8„intheparametersmaskarenotusedbyI*‚+---+---+---+---++---+---+---+---+‚theSASIdriver,butallofthebits8*‚|‹|ƒ||ƒ|ƒ|ƒ|ƒ|‚thataredefinedforanydiscdriveare;*‚+---+---+---+---++---+---+---+---+‚showninthediagrams.*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|:*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=IOSSOFissignificant(notused).*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|1*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=IOSPSMissignificant. *„|ƒ|ƒ|ƒ|„|ƒ|>*„|ƒ|ƒ|ƒ|„|ƒ------------1=IOSSHDissignificant(notused). *„|ƒ|ƒ|ƒ|„|A*„|ƒ|ƒ|ƒ|„----------------1=IOSTRKDissignificant(notused). *„|ƒ|ƒ|ƒ|D*„|ƒ|ƒ|ƒ---------------------1=IOSPCOMissignificant(notused).*„|ƒ|ƒ|F*„|ƒ|ƒ-------------------------1=IOSSPTDissignificant(notused).*„|ƒ|G*„|ƒ-----------------------------1=IOSSRBissignificant(notused).*„|K*„---------------------------------1=IOSRWCCBissignificant(notused).  *„7ƒ6ƒ5ƒ4„3ƒ2ƒ1ƒ0$*‚+---+---+---+---++---+---+---+---+*‚|ƒ|ƒ|ƒ|ƒ||ƒ|ƒ|ƒ|ƒ|$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|/*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=IOSRECissignificant.*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|1*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=IOSRSZissignificant. *„|ƒ|ƒ|ƒ|„|ƒ|>*„|ƒ|ƒ|ƒ|„|ƒ------------1=IOSWTOissignificant(notused). *„|ƒ|ƒ|ƒ|„|@*„|ƒ|ƒ|ƒ|„----------------1=IOSRTOissignificant(notused). *„|ƒ|ƒ|ƒ|8*„|ƒ|ƒ|ƒ---------------------1=IOSSPTissignificant.*„|ƒ|ƒ|:*„|ƒ|ƒ-------------------------1=IOSHDSissignificant.*„|ƒ|<*„|ƒ-----------------------------1=IOSTRKissignificant.*„|>*„---------------------------------1=IOSILVissignificant. PAGE*%*ˆAttributesMaskfortheSASIDriver* '*¨Theindividualbitsoftheattributes&*¦wordareinterpretedasshowninthe*¦accompanyingdiagrams. !*¨Noticethatthetophalfofthe<*ƒ15‚14‚13‚12ƒ11‚10ƒ9ƒ8„attributeswordiscompletelyunusedI*‚+---+---+---+---++---+---+---+---+‚foraSASIdisc,butthetophalfof+*‚| |‚theattributeswordisstillpresent.$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|:*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=Post-read/pre-writeprecompreq'd#*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ˆ(NotusedbySASI).4*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=8"disk;0=5-1/4"disk *„|ƒ|ƒ|ƒ|„|ƒ|-*„---------------------------------Notused.  *„7ƒ6ƒ5ƒ4„3ƒ2ƒ1ƒ0$*‚+---+---+---+---++---+---+---+---+*‚|‹|ƒ||ƒ|ƒ|ƒ|ƒ|$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|<*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=Doubledata-density(MFM)onmedia.*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|9*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=Doubletrack-densityonmedia.*„|ƒ|ƒ|ƒ|„|ƒ|(Always1)6*„|ƒ|ƒ|ƒ|„|ƒ------------1=Double-sidedfloppydisc. *„|ƒ|ƒ|ƒ|„|?*„|ƒ|ƒ|ƒ|„----------------1=IBMformat;0=Motorolaformat.*„|ƒ|ƒ|ƒ|™(Always1)>*„|ƒ|ƒ|ƒ---------------------1=Rigiddisc;0=floppydisc.*„|ƒ|ƒ|G*„|ƒ|ƒ-------------------------1=Doubledata-density(MFM)ondrive.*„|ƒ|¡(NotusedbySASI).D*„|ƒ-----------------------------1=Doubletrack-densityondrive.*„|¥(NotusedbySASI).K*„---------------------------------1=Seekreq'dw/headswitchondrive.*ª(NotusedbySASI). PAGE*!*ˆMVME420memory-mappedI/Ospace* 0‰OFFSETƒ-1•ThisOFFSETblockdefinesthememory-&*¦mappedI/OspaceforaSASIchannel.&*¦TheSASIdrivercommunicatesthrou gh&*¦thismemory-mappedI/Ospacewithan&*¦MVME420SASIPeripheralAdapter,and'*¦theMVME420inturncommunicateswith*¦anSA1403DSASIcontroller. %*¨TheCCBCHBpointerthatissupposed"*¦topointtothebeginningofthe(*¦memory-mappedI/Oareaactuallypoints$*¦tobyte1ofthememory-mappedI/O(*¦area,soweuseanoffsetof-1inthe$*¦OFFSETstatementtocompensate.‚We%*¦wanttheCCBCHBpointertopointto)*¦byte1insteadofbyte0ofthememory-&*¦mappedI/Oareabecausethatcircum-)*¦stanceallowsustouse(An)addressing)*¦toaddressthefirstmeaningfulbyteof*¦theinterfacearea. $*¨TheMVME420doesnotdecodeallof$*¦thebytesinitsmemory-mappedI/O(*¦space,soanumberofthebytesinthe(*¦memory-mappedI/Ospaceareunused.‚In(*¦particular,theMVME420doesn'tdecode$*¦anybytesatevenaddresses,sowe(*¦includeunnamedDS.Bstatementsinthe(*¦codebelowtoskiptheunusedbytesat*¦evenaddresses. ,‰DS.B…1–Writingthevalue$01(i.e.,SEL)to5SELECTƒDS.B…1”theSELECTregisterselectstheSA1403D.SEL†EQU†$01’controller.‚Thecontrollermustbe%*¦selectedasthefirststepinevery&*¦I/Otransactionthatweperformwith%*¦thecontroller.‚Thedrivermustnot*¦issueaselectcommandifthe!*¦controllerisalreadyselected. %*¨TheSELECTregisterisawrite-only *¦register.‰PAGE2FLAGS„EQU†SELECT‘TheFLAGSregisterisaread-only)*¦registerthatsharesitsmemoryaddress&*¦withthewrite-onlySELECTregister.8*„7ƒ6ƒ5ƒ4„3ƒ2ƒ1ƒ0„ThebitsintheFLAGSregisterprovideI*‚+---+---+---+---++---+---+---+---+‚statusinformationabouttheSA1403D6*‚|ƒ|‡|ƒ||ƒ|ƒ|ƒ|ƒ|‚controllerasshowninthediagram.$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|<*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=Controllerrequestingcommandbyte.*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|=*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=Controllerrequestingoutputdata. *„|ƒ|ƒ|ƒ|„|ƒ|=*„|ƒ|ƒ|ƒ|„|ƒ------------1=Controllerhasinputdataready. *„|ƒ|ƒ|ƒ|„|@*„|ƒ|ƒ|ƒ|„----------------1=Controllerhasstatusbyteready. *„|ƒ|ƒ|ƒ|B*„|ƒ|ƒ|ƒ---------------------1=Controllerrequestinginterrupt.*„|ƒ|ƒ|)*„|ƒ|ƒ-------------------------…Notused.*„|ƒ|+*„|ƒ-----------------------------…Notused.*„|<*„---------------------------------1=Controllerselected.  2BITCMDƒEQU†0–Bit0oftheFLAGSregisterissetif;REQCMDƒEQU†1<*‚Performthedevice-independentinitializationbycallingthe'*‚genericroutineDISK_INITinDISKLIB.*/‰JSR†DISK_INITŒDothedevice-independentstuff.4‰IF‚‚THEN.SŽSomethingwentwrongwithDISK_INIT.‹RTS™Thechannelisdown!!‰ENDI*8*‚Performanydevice-dependentinitializationinDO_INIT*/‰BSR.L„DO_INITŽDevicedependentinitialization.‰RTS‰PAGEO******** ***********************************************************************O*********************************************************************************ˆCOMMANDSERVICEROUTINE*C*ˆThissubroutineiscalledfromCMRwhenCMRreceivesacommandtoA*ˆinitiatean‚I/Otransaction‚withadevicethatiscontrolledby?*ˆthisdriver.‚Itsfunctionisto‚processthe‚givencommand‚andB*ˆqueuethecommandtothecontroller.‚Thesefunctionsarehandled%*ˆbythegenericdiskdriverDISKLIB.*5*ˆEntry:„A2=physicaladdressofCMRparameterblock*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*5*ˆInterruptlevelis0.‚Registersmaybeusedfreely.*1*ˆRegistersusedbyDISK_COMMAND:†01234567*ªD‚********ªA‚*****P**ˆExitsto:CMRviaRTS*O*******************************************************************************O******************************************************************************* COMMANDS: *,*‚Performanydevice-dependentstuffhere...* =*‚Wehavereceivedacommand,soweknowthereissomeoneout**‚theretotalkto.‚LetDISKLIBhandleit.*&‰JSR†DISK_COMMAND‹Performthecommand.‰RTSReturntoCMR.‰PAGEO*******************************************************************************O*********************************************************************************ˆINTERRUPTPOLLINGROUTINE*B*ˆControlcancometothe‚SASIinterrupthandlerwhenCMRreceivesC*ˆaninterruptontheinterruptlevelthatisusedbytheSASIdiskC*ˆcontroller.IftheinterruptisaSASIinterrupt,theSASIdriverA*ˆhandlesit,‚andreturnstoCMRwiththeCbitsetoftheSR.‚IfA*ˆtheinterruptisnotaSASIinterrupt,‚returntoCMRwiththeC*ˆbitcleared.*#*ˆEntry:„JSRfrominterrupthandler*’A5=physicaladdressofCCB*<*ˆTheinterruptlevelisattheleveloftheSASIinterrupt.8*ˆD0,A0,A1,A5havebeensavedbyCMR.‚Thedrivermust *ˆsaveanyotherregistersused.*!*ˆRegisterusage:…01234567*™D‚**™A‚*‰P**ˆExit:…RTSbacktoCMR*O*******************************************************************************O******************************************************************************* **ˆIstheinterruptforme?**¨Time >INTERUPTMOVE.LƒCCBCHB(A5),A0ˆ16(4/0)‡PointA0‚totheMVME4201‰MOVEQ„#REQINT,D0Œ4(1/0)…memory-mappedƒI/O‚area,4‰AND.B„FLAGS(A0),D0Š8(2/0)…and‚checktheSASI‚FLAGS0‰BNE.S„SASIINT8(1/0)…register‚toseeifaSASI&‰RTS›16(3/0)…interruptispending.ƒIf$*¦--------…there‚isn'taSASIinter-$*¦52(11/0)…ruptpending,‚returnwith*³SR.C=0‚toindicatethat*³theinterrupt‚isn'tours.*³TheAND‚instructionauto-*³maticallyclearsthe‚SR.C *³bitforus.‰PAGEO********************************************************************************#*ˆSASIINTERRUPTCO-ROUTINELINKAGE*C*ˆControlreachesthispointwhenwe'vesuccessfullyidentifiedtheA*ˆinterruptasa‚SASIinterrupt.‚ThisroutineisalsocalledasaB*ˆsubroutinewhenthe‚command-processingroutinewantstoactivateB*ˆinterruptprocessing.‚WhenevertheinterrupthandleremptiestheB*ˆI/Oqueue,wedeactivateinterruptprocessing.‚Whenthecommand-B*ˆprocessingroutine‚putsanewqueueentryintoaemptyqueue,it5*ˆmustcallSASIINTtoactivateinterruptprocessing.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*PP *™A‚P*ƒPPP*=*ˆExit:…Jumptoco-routinesegmentaddressedbyINTSWTCH(A5).*O******************************************************************************* 2SASIINT‚EQU†*–WeknowwehaveaSASIinterrupt,so>EQ420„EQU†DSABLINT+LEDOFF†disabletheinterruptattheMVME420?‰MOVE.Bƒ#EQ420,CONTROL(A0)ƒSASIPeripheralAdapter.‚Thenenable<‰MOVE.WƒCCBSR(A5),SR‰68000interruptsatourinterruptlevel'*¦sothatotherinterruptsatourlevel'*¦won'tbedelayed whileweprocessour$*¦interrupt.‚Everyinterrupthandler)*¦shouldmaskitsinterruptatthesource)*¦oftheinterruptandthenquicklylower(*¦thesysteminterruptmaskbyonelevel)*¦toallowthesystemtorespondtoother#*¦interruptsthatoccuratthesame*¦prioritylevel. @EQ430„REG†A4/A3/A2/D3/D2/D1†A5,A1,A0,andD0havealreadybeen;‰MOVEM.L‚EQ430,-(SP)ŠsavedbyCMR.‚Herewesavetherestof'*¦theregistersthatweneedtouse.‚We(*¦saveonlytheregistersthatwereally%*¦needbecausewedon'twanttowaste(*¦timeorstackspace.‚Time,especially,'*¦isimportantinaninterrupthandler. <‰MOVE.LƒIOQUEUE(A5),A1‰SetA1=LOC(Drive'svariableblock).)*¦ThefirstentryoftheIOQUEUEcontains)*¦apointertothevariableblockforthe)*¦discdrivethatweshouldbeaccessing. =‰MOVE.LƒINTSWTCH(A5),A3ˆBranchtotheco-routinesegmentthat"‰JMP†(A3)‘shouldbeexecutednext. %*¨Controlwilleventuallyreturnfrom(*¦theselectedco-routinesegmenttothe&*¦INTRTNroutine,whichimplementsthe*¦returnlinkagetothesystem.‰PAGEO*********************************************************************************ˆSASIOPCODETABLE*@*ˆThistable‚containsthe‚SASI-definedopcode‚valuesfortheI/OD*ˆoperationsthatwecurrentlyusewiththeSA1403DSASIcontroller.*O******************************************************************************* 0*’---------------------------SASIOpcodevalue.*’|*’|”------IOFUNCTindexvalue.*’|”|*’V”V‰DC.B…$0A’-1=Writedisc.OPTBL„DC.B…$04“0=Formatdisc.-‰DC.B…$C0’+1=Defineformatforfloppydisc.‰DC.B…$08’+2=Readdisc. 5FTRACKƒDC.B…$06”Theopcodeforaformat-trackcommand)*¦isnotindexedbytheIOFUNCTvaluefor%*¦aformat-trackcommand.‚Theformat-$*¦trackcommandhasthesameIOFUNCT&*¦valuethatisusedforaformat-disc'*¦command,andweuniquelyidentifythe'*¦format-trackcommandbythefactthat(*¦itsIOOPTSvalueisdifferentfromthe)*¦IOOPTSvaluethatisusedforaformat-(*¦disccommand.‚Thenwecomputeapseudo'*¦IOFUNCTvaluethatindexesfromOPTBL *¦toFTRACK. !‰DS.W…0–Aligntoawordboundary. 3SENSECMDEQU†$03”ThislabeldefinestheSASIopcode(*¦valueforarequest-sensecommand.‚The$*¦SASIdriverissuesarequest-sense&*¦commandwhenevertheSASIcontroller'*¦returnsastatusvaluethatindicates$*¦anerror.‚Thecontrollerreturnsa&*¦statusvalueattheendofeveryI/O(*¦transaction,andthedriverchecksthe%*¦statusvaluetoseeifanerrorhas(*¦occurred.‚Ifanerrorhasoccurred,we)*¦issuearequest-sensecommandtoobtain'*¦detailedinformationabouttheerror. "*¨Auser'sprogramcannotdirectly&*¦generatearequest-sensecommand,so(*¦theopcodevaluefortherequest-sense)*¦commandisn'tintheSASIopcodetable.&*¦TheSASIdriverautomaticallyissues)*¦request-sensecommandsasnecessaryfor*¦erroranalysis.‰PAGEO*********************************************************************************ˆPROCESSNEXTQUEUEENTRY*E*ˆControlcomestothisco-routinesegmenttoprocessthefrontentryD*ˆoftheIOQUEUE.‚Weareguaranteedthatthequeueinnon-emptywhen *ˆcontrolcomestothisroutine.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*9*ˆExitsto:‚SendacommandpackettotheSASIcontroller.*O******************************************************************************* =PROCQUE‚LEA†CMDEND(A5),A3ŠWewanttoexaminethevariablesin(*¦thedrive'sI/Opacket,andwewantto'*¦constructacommandpacketforaSASI)*¦commandthatwillimplementpartorall&*¦ofthefunctionthatisspecifiedin$*¦thedrive'sI/Opacket.‚Thenwe'll)*¦transmitthecommandpackettotheSASI *¦controller. %*¨WestartbypointingA3tot hebyte(*¦thatimmediatelyfollowsthelastbyte(*¦ofthecommandpacketinmemory.‚We'll(*¦useautodecrementaddressingtoaccess*¦thecommandpacket.*+* MOD FOR DTC 520A SASI CONTROLLER 11/16/83*(*Modifiedforbothcontrollers„12/12/83*(‰CMP.B…#1,IOFUNCT(A1)†TESTFORCONFIGURE!‰BNE.S…PROQ1BRAIFNOTCONFIGURE-‰BTSTW…#IOASIZE,CONFGBLK+IOSATW(A1)‚8"DRIVE?‰BNE.S…PROQ1BRAIF8"DRIVE6‰LEA‡DTCCMD(A5),A3‡POINTTOCONFIGUREDRIVECMD.PCKT.‰BRA.S…L0490AŽGOSENDDATA**ENDOFMOD—11/17/83ƒ**DPROQ1„MOVE.BƒCTRLCODE(A1),-(A3)…Copythecontrol-codevaluefromthe2L1‡SET†CMDCTRLŽdrive'sI/OpacketintotheCMDCTRL%*¦fieldofthecommandpacket.‚Notice'*¦theuseoftheSETpseudoinstruction)*¦togenerateaconcordanceentryforthe&*¦CMDCTRLfieldthatismodifiedhere.‰PAGE;‰MOVE.LƒIOSCTCNT(A1),D0ˆNowusetheIOSCTCNTvaluefromthe<‰MOVE.Lƒ#MAXSECTS,D1‰drive'sI/OpackettofilltheCMDSECTS0‰CMP.L„D1,D0fieldofthecommandpacket.‚Ifthe3‰BLS.S„L0470countofremainingsectorsexceedsthe3‰MOVE.LƒD1,D0maximumnumberofsectorsthatcanbe>16,(A3)+ƒdiscdrive'sI/Opackettosetupthe;‰MOVE.BƒDRIVENUM(A1),D1†logicalsectornumberintheCMDLSN8‰LSL.B„#LUNFIELD,D1‰fieldofthecommandpacket.‚Wealso6‰OR.B…D1,-(A3)usetheDRIVENUMvaluefromthedrive's1L1‡SET†CMDLSNI/OpackettosettheLUN(Logical-#*¦Unit-Number)fieldinthecommand&*¦packet.‚NoticethattheLUNfieldin)*¦thecommandpacketoccupiesthetopfew&*¦bitsofthefirstbyteoftheCMDLSN%*¦(Logical-Sector-Number)field.‚Also'*¦noticetheuseoftheSETinstruction)*¦togenerateaconcordanceentryforthe*¦CMDLSNfield. 9‰ADD.L„D0,IOSECTOR(A1)ˆIncreasetheIOSECTORvalueinthe%*¦drive'sI/Opacketbythenumberof%*¦sectorsthatwillbeprocessedasa%*¦resultofthiscommandpacket.‚This(*¦adjustmentcausesIOSECTORtopointto)*¦thesectorthatshouldbespecifiedfor(*¦thenext(ifany)commandpacketafter *¦thisone.‰PAGE;‰MOVE.BƒIOFUNCT(A1),D0‰GettheIOFUNCTcodeintoD0.Wsowe+‰EXT.W„D0“canuseittoindexintotheSASI1‰BNE.S„L0490opcodetable.‚IftheIOFUNCTcodeis(*¦nonzero,wearen'tprocessingaformat'*¦command.‚Inthiscase,wecanusethe&*¦IOFUNCTvaluedirectly.‚Foraformat#*¦command,however,wemustdosome*¦specialprocessing. >EQ480„EQU†CONFGBLK+IOSILVˆForaformatcommandwemustinstall@‰MOVE.BƒEQ480(A1),CMDILV(A5)aninterleavevalueintotheCMDILV$*¦field,whichoverlaystheCMDSECTS'*¦fieldofthecommandpacket.‚Thereis'*¦nosectorcountforaformatcommand,'*¦butthecontrollerrequiresaninter-%*¦leavecodeinplaceoftheCMDSECTS*¦fieldforaformatcommand. 9‰CMP.W„#IOPTRK,IOOPTS(A1)…IftheIOOPTSvalueinthedisc4‰BNE.S„L0490drive'sI/Opacketindicatesthatwe're:‰MOVEQWƒFTRACK-OPTBL,D0†processingaformat-trackcommand,'*¦adjustD0.Wtoindextheformat-track!*¦entryoftheSASIopcodetable.%*¦Otherwise,D0.Walreadyindexesthe&*¦format-discentryoftheSASIopcode*¦table. #*¨WeuseasingleIOFUNCTvaluefor&*¦boththeformat-discc ommandandthe&*¦format-trackcommand.‚Wedistinguish)*¦onecommandfromtheotherbyexamining*¦theirIOOPTSvalues. FL0490„MOVE.BƒOPTBL(PC,D0.W),-(A3)ƒFinally,filltheCMDOPfieldofthe4L1‡SET†CMDOPcommandpacketfromtheproperentryof'*¦theSASIopcodetable.‚NoticethatA3&*¦nowpointstotheCMDOPfieldofthe'*¦commandpacket,sowecanuseA3with)*¦autoincrementaddressingaswesendthe(*¦commandpackettotheSASIcontroller.'*¦AlsonoticetheuseoftheSETpseudo'*¦instructiontogenerateaconcordance*¦entryfortheCMDOPfield. 6L0490AƒBSR†SENDCMDSendthecommandpackettotheSASI&*¦controllertotellthecontrollerto&*¦startprocessing.‚SubroutineSENDCMD'*¦usesA3withautoincrementaddressing(*¦tosendthecommandpackettotheSASI)*¦controller,andsubroutineSENDCMDalso'*¦assumesthatA0pointstothememory-)*¦mappedI/OareafortheSASIperipheral *¦adapter.‰PAGEO*********************************************************************************ˆREADORWRITENEXTSECTOR*B*ˆControl‚comestothetopofthis‚co-routinewhentheSASIdriverD*ˆisreadytoreadorwritethedataforthenextsectorthatshould@*ˆbetransferred.‚Controlalso‚comestothis‚routine‚immediately=*ˆafter‚anycommand‚sequence‚hasbeen‚transmitted‚to‚the‚SASI *ˆcontroller.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*1*ˆExitsto:‚Branchestointerruptreturnroutine.*O******************************************************************************* 8NEXTSECTBSR†INTRTN‘TheSASIcontrollerneedstimetodo$*¦itsjobbeforewecantransferany(*¦data,soreturncontroltothesystem.'*¦WhentheSASIcontrollerhasfinished$*¦itscurrenttask,we'llreceivean&*¦interruptthatwillcausecontrolto(*¦comebackhere.‚Theco-routinelinkage)*¦convenientlyallowsustocalltherest&*¦ofthesystemasifitweresimplya)*¦subroutinetobeexecutedwhilewehave*¦nothingbettertodo. #*¨Ifwe'vejusttransmittedawrite%*¦commandtotheSASIcontroller,the'*¦interruptshouldoccurquickly(since(*¦thecontrollershouldsoonbereadyto'*¦copyasectorofoutputdataintoits$*¦databuffer).‚However,experiments&*¦haveshownthatthecontrollerneeds'*¦enoughtimeeveninthiscasetomake(*¦itworthwhileforustoreturncontrol*¦tothesystem. %*¨Ifwe'vejusttransmittedareador'*¦formatcommandtothecontroller,the%*¦controllerwillobviouslyrequirea&*¦substantialamountoftimebeforeit*¦interruptsthesystemagain.‰PAGE9EQ530„EQU†CONFGBLK+IOSPSMˆControlreachesthisco-routine;‰MOVE.WƒEQ530(A1),D1‰segmentwhenthecontrollerinterrupts(*¦toindicatethatit'sreadytoproceed'*¦withtheI/Ooperation.‚WegetIOSPSM&*¦intoD1.W,soD1.Wnowindicatesthe!*¦logicalsectorsize(inbytes). 9‰TST.L„HALFSCTS(A1)‹Ifthenextsectortobeprocessedis2‰BEQ.S„L0535ahalfsector,dividethesectorsize2‰LSR.W„#1,D1bytwotoaccountforthefactthata>‰SUB.L„#1,HALFSCTS(A1)†halfsectorhasonlyhalfasmanybytes(*¦asanormalsector.‚Thendecrementthe(*¦countofthehalfsectorsremainingto%*¦beprocessed.‚Halfsectorsarisein'*¦trackzeroofadouble-densityfloppy(*¦discbecausethesectorsintrackzero%*¦ofadouble-densityfloppydiscare*¦recordedwithsingledensity. ‰MOVEP.L‚DATA0(A0),D0†|‚thememorymap.‚Therefore,theMOVEP.L5‰MOVE.LƒD0,(A3)+Š|‚instructionaccessesthesamedata(*§|‚registerfourconsecutivetimeswith/‰DBRA…D3,L0550Š----‚themaximumpossiblespeed. #*¨IftheSASIcontrollerhappensto$*¦sufferfromacatastrophicfailure)*¦duringthisloop,we'llgetabuserror*¦toindicatetheproblem. 4‰DBRA…D1,READDATAŒIfwehaven'tfinishedreadingthe&*¦currentsectorofdata,loopbackto(*¦readthenextchunkofLCDSCTSZbytes.$*¦ByreadingLCDSCTSZbytesandthen)*¦checkingthecontroller,wecanprevent&*¦thecarelessuserfromcausingabus*¦error. 0‰BRA.S„RWCOMMONWe'vefinishedreadinganentire(*¦sectorofinputdata,sonowgotothe#*¦commonroutinethatcompletesthe&*¦processingofasectorforbothread"*¦operationsandwriteoperations.‰PAGEO*********************************************************************************ˆWRITEASECTOROFDATA*O******************************************************************************* GWRTDATA‚MOVEQIƒSELECTED+REQWRITE,D3ƒWe'reperformingawriteoperation,4‰BSR†CHKFLAGSsochecktheSASIcontrollertoverify)*¦thatthecontrollerisreadytoreceive'*¦outputdata.‚SubroutineCHKFLAGSsets)*¦theCC.Zbitifthecontrollerisready&*¦fortheoperationindicatedinD3.B. >L0560„SNE.B„NOFINISH(A1)‹Ifthecontrollerisn'treadyforthe7‰BNE.S„READSTATproperoperation,settheNOFINISHflag%*¦andgotrytoreadthecontroller's$*¦statusreport.‚WeusetheNOFINISH'*¦flagtoindicatethatareadorwrite$*¦I/Ooperationhasfailedtofinish$*¦correctlyforsomeunknownreason. &*¨Controlcomesthroughthissamecode$*¦segmentifthecontrollerfailsto'*¦becomereadyfortheproperoperation*¦duringareadtransaction. .EQ561„EQU†4*8”Eachiterationoftheinnerloop=EQ562„EQU†LCDSCTSZ/EQ561‡belowtrans fers4*8=32databytes,=EQ563„EQU†EQ562*EQ561Šandeachiterationoftheouterloopis9‰IFNE…LCDSCTSZ-EQ563‡supposedtotransferLCDSCTSZbytes./‰FAIL…0”[****ERROR****ERROR****ERROR****]+‰ENDCšTherefore,wemustverifythat4*8is#*¦anexactdivisorofLCDSCTSZ.‚The#*¦instructionthatisconditionally&*¦assembledheregeneratesanassembly)*¦errorif4*8isnotanexactdivisorof%*¦LCDSCTSZ.‚Ifthiserroroccurs,the(*¦maintenanceprogrammerwillbealerted(*¦tochangetheinnerloopbelowtomake(*¦ittransfersomeothernumberofbytes)*¦sothatasingleiterationoftheouter#*¦loopcantransferLCDSCTSZbytes. @‰MOVEQWƒLCDSCTSZ/EQ561-1,D3„InitializeD3.Wtocontroltheinner'*¦loop.‚We'llperformenoughiterations(*¦oftheinnerlooptotransferLCDSCTSZ*¦bytesofdata.‰PAGE?L0570„MOVE.Lƒ(A3)+,D0Š----‚Eachcompleteiterationofthisloop>‰MOVEP.L‚D0,DATA0(A0)†|‚transfers4*8=32databytesfromthe(*§|‚outputbuffertotheSASIcontroller8‰MOVE.Lƒ(A3)+,D0Š|‚andweperformjustenoughiterations>‰MOVEP.L‚D0,DATA0(A0)†|‚ofthisinnerlooptotransferatotal *§|‚ofLCDSCTSZbytesduringone/‰MOVE.Lƒ(A3)+,D0Š|‚iterationoftheouterloop.‰MOVEP.L‚D0,DATA0(A0)†|#*§|„WeuseaMOVEP.Linstructionto7‰MOVE.Lƒ(A3)+,D0Š|‚transferfourconsecutivedatabytes?‰MOVEP.L‚D0,DATA0(A0)†|‚withthemaximumpossiblespeed,andwe&*§|‚replicatethecodeinthisloopto7‰MOVE.Lƒ(A3)+,D0Š|‚reducetheeffectsofloopoverhead.;‰MOVEP.L‚D0,DATA0(A0)†|‚Wecouldreplicatethecodeinthis'*§|‚loopmoretimesforevenmorespeed8‰MOVE.Lƒ(A3)+,D0Š|‚butdiminishingreturnsbegintomake=‰MOVEP.L‚D0,DATA0(A0)†|‚furtherreplicationslessattractive.*§|8‰MOVE.Lƒ(A3)+,D0Š|„TheSASIcontrolleractuallyhasjust<‰MOVEP.L‚D0,DATA0(A0)†|‚onedataregister,butthatregister'*§|‚appearsat4differentlocationsin9‰MOVE.Lƒ(A3)+,D0Š|‚thememorymap.‚Therefore,theMOVEP.L:‰MOVEP.L‚D0,DATA0(A0)†|‚instructionaccessesthesamedata%*§|‚register4consecutivetimeswith/‰DBRA…D3,L0570Š----themaximumpossiblespeed. #*¨IftheSASIcontrollerhappensto$*¦sufferfromacatastrophicfailure)*¦duringthisloop,we'llgetabuserror*¦toindicatetheproblem. 3‰DBRA…D1,WRTDATAIfwehaven'tfinishedwritingthe&*¦currentsectorofdata,loopbackto)*¦writethenextchunkofLCDSCTSZbytes.$*¦BywritingLCDSCTSZbytesandthen)*¦checkingthecontroller,wecanprevent&*¦thecarelessuserfromcausingabus*¦error. &*¨We'vefinishedtransferringasector&*¦ofoutputdata,sonowcontrolfalls(*¦intothecommonroutinethatcompletes%*¦theprocessingofasectorforboth'*¦readoperationsandwriteoperations.‰PAGEòÛ0ä8ì5ô6ü93 38@$>,@4:<3D<L5T7\2d8l<tK|F„IŒD”Eœ=¤B¬@´>¼;Ä'O********************************************************************************#*ˆCOMPLETEPROCESSINGOFREAD/WRITE*#*ˆEnteredfrom:READDATAorWRTDATA* *ˆExitsto:*O******************************************************************************* @RWCOMMONMOVE.LƒA3,IOBUFPTR(A1)ˆUpdatetheI/Obufferpointerto#*¦pointtothenextbyteoftheI/O&*¦buffer.‚Ifthere'sanothersectorof'*¦datatobetransferred,IOBUFPTRwill'*¦beusedtoaddresstheI/Obuffer.‚If'*¦thereisn'tanothersectorofdatato'*¦betransferred,we'lluseIOBUFPTRto)*¦calculatethenumberofbytesthatwere*¦actuallytransferred. :‰SUB.B„#1,CMDSECTS(A5)ˆDecrementthecountofsectorsthat4‰BHI†NEXTSECTremaintobeprocessedforthecurrent&*¦SASIcommandsequence.‚Ifwehaven't(*¦finishedprocessingallofthesectors(*¦forthecurrentSASIcommandsequence,'*¦loopbacktoprocessthenextsector. .‰TST.B„D2•We'vefinishedprocessingallofthe5‰BGT.S„RDSTAT1Žsector(s)fort hecurrentSASIcommand&*¦sequence.‚Ifwe'reperformingaread%*¦operation,goreadthecontroller's&*¦statusreport.‚Thecontrollershould#*¦havethestatusreportforaread$*¦operationreadyalmostimmediately(*¦afterthelastsectorofdatahasbeen%*¦read,sothere'snoadvantagetobe$*¦gainedbyreturningcontroltothe(*¦systemtowaitforastatus-readySASI(*¦interrupt.‚RecallthatD2.B=+1fora)*¦readtransactionandthatD2.B=-1for*¦awritetransaction. $*¨Ifwe'reperformingawriteopera-)*¦tion,fallintothetopoftheREADSTAT%*¦routine.‚Controlwillreturntothe)*¦system,andwe'llgetcontrolbackwhen&*¦astatus-readyinterruptoccurs.‚The'*¦controllerwillrequireasignificant)*¦amountoftimebeforeithasitsstatus%*¦reportreadybecauseitmustdothe(*¦physicalwritingofthelastsectorof'*¦databeforeitcanprepareitsstatus *¦report.‰PAGEO********************************************************************************!*ˆREADTHESASICONTROLLERSTATUS*O******************************************************************************* 7READSTATBSR.S„INTRTN‘Returncontroltothesystem,and)*¦waitforastatus-readySASIinterrupt.&*¦We'llgetcontrolbackwhentheSASI)*¦controllerhasitsstatusreportready. 5RDSTAT1‚BSR†GETSTATGetthestatusbitsfromtheSASI6‰BNE.S„STATERRŽcontroller'sstatusbyteintoD0.B,and(*¦reportanerrorifthestatusbitsare&*¦nonzero.‚Astatusbitthatissetin(*¦thecontroller'sstatusbyteindicates&*¦anerror.‚SubroutineGETSTATreturns$*¦theconditioncodesreflectingthe(*¦statusbitsfromtheSASIcontroller's*¦statusbyte. 6‰MOVEQIƒISTACFG,D1IftheNOFINISHflagisnonzero,we8‰TST.B„NOFINISH(A1)‰returnastatuscodeindicatingthat4‰BNE.S„SASIDONEtheactualconfigurationofthedisc(*¦doesn'tmatchtheconfigurationinthe%*¦currentconfigurationblock.‚AnI/O)*¦operationfailedtofinishproperly,so&*¦thesectorsizeonthediscprobably&*¦doesn'tmatchthesectorsizeinthe*¦configurationblock. 8‰TST.L„IOSCTCNT(A1)‹TheSASIcontrollerhassuccessfully1‰BNE†PROCQUEŽcompletedtheentireI/Otransaction(*¦thatwasspecifiedbythelastcommand(*¦sequencethatwegaveit.‚Ifthereare'*¦anysectorsremainingtobeprocessed)*¦forthecurrententryoftheI/Oqueue,'*¦loopbacktoprocessanotherchunkof*¦theentireI/Otransfer. %*¨RecallthatIOSCTCNTisalwayszero&*¦foranyI/Otransactionthatdoesn't(*¦involvethetransferofanyread/write*¦data. 9‰MOVE.BƒEOVFLAG(A1),D1‰We'venowcompletedtheentireI/O'*¦transactionthatwasspecifiedbythe$*¦commandthatgeneratedthecurrent%*¦entryoftheI/Oqueue.‚TheEOVFLAG'*¦valuethatwegetintoD1.Bherewill#*¦bereturnedtotheuserasanI/O&*¦statuscode.‚IftheI/Otransferwas'*¦truncatedtoavoidrunningbeyondthe(*¦endofthedisc,wereturntheISTAEOV'*¦statuscode.‚Otherwise,wereturnthe)*¦ISTAOKstatuscodetoindicatethatthe!*¦entireoperationwentsmoothly.‰PAGEO*********************************************************************************ˆFINISHPROCESSINGQUEUEENTRY*F*ˆControlcomesherewhenthedriverisdonewiththecurrentcommand.D*ˆWecallCHAN_DONEin‚DISKLIBtoqueuetheI/Ocompletioneventfor@*ˆus,and‚we‚removethecurrent‚entryfrom‚thequeue.‚IftheI/OD*ˆqueuehasanotherentry,‚we'llloopbackandstartprocessingthat*ˆentry.*=*ˆEntry:„D1.B=VERSAdoserrorcodeiferror,otherwisezero.9*’D2=Logicalsectornumberiferror,otherwisegarbage.)*’A1=Pointertodrive'svariableblock.*’A5=PhysicaladdressofCCB*?*ˆTheseentryconditionsarerequiredbytheCHAN_DONEroutine.*6*ˆCalls:„CHAN_DONEinthegenericdiskdriverDISKLIB.*=*ˆExit:…Branchestoprocessnextqueueentryifthereisone.0*’Fallsthroughtoidleloopifthereisn'tone.*O****************************************************************** ************* SASIDONEEQU†* 2‰JSR†CHAN_DONEŒCallthegenericdiskdrivertoset"*¦fieldsintheIOCBandqueuethe*¦eventforus. 6EQ650„REG†A1/A3/A4HereweremovethefrontentryfromA‰MOVEM.L‚IOQUEUE+4(A5),EQ650‚theI/Oqueue,andwesimultaneouslyA‰MOVEM.L‚EQ650,IOQUEUE(A5)„setA1topointtothedriveblockfor(*¦thediscdrivethatisassociatedwith$*¦thenext(ifany)entryoftheI/O%*¦queue.‚Sincethereareamaximumof(*¦fourentriesintheI/Oqueue,weneed'*¦tomovenomorethanthreeentriesto(*¦removethefirstentryfromthequeue. 6‰SUB.W„#4,IOQCNT(A5)ŠReducethequeue-countpointerto1‰BHI†PROCQUEŽaccountforthefactthatwe'vejust(*¦removedafour-byteentryfromtheI/O$*¦queue.‚Ifthereisstillanactive&*¦entryintheI/Oqueue,loopbackto"*¦startprocessingthenextentry. $*¨IftheI/Oqueueisempty,control(*¦fallsintotheco-routinesegmentthat%*¦ispotentiallyactivewhentheSASI'*¦controlleriscaughtupandshouldbe*¦idle.‰PAGEO*********************************************************************************ˆIDLELOOPROUTINE*C*ˆControlfallsintothisco-routine‚segmentwhenthe‚I/OqueuehasD*ˆbeenemptied.‚TheSASIcontrolleriscompletelycaughtupwithall?*ˆofitsrequests,‚andthe‚controller‚should‚nowbe‚idle.‚We'llB*ˆsimplyreturncontroltothe‚systemto‚idlethe‚SASI‚controller.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*D*ˆExitsto:‚Staysinloopuntilthedriverreceivesanothercommand.*O******************************************************************************* :IDLELOOPBSR.S„INTRTN‘TheI/Oqueueisempty,sowesimply%*¦returncontroltothesystem.‚We've)*¦caughtupwithalloftherequeststhat'*¦havebeensetupforprocessingunder*¦interruptcontrol. 4‰ST.B…CHANDOWN(A5)‹Ifcontrolevercomestothisco-%*¦routinesegment,wehaveaproblem.#*¦Apparently,we'vereceivedaSASI%*¦interruptwhenwehaven'tgiventhe%*¦controlleranythingtodo.‚Infact,%*¦notonlyhavewenotgiventheSASI'*¦controlleranythingtodo,wehaven't*¦evenenableditsinterrupt. #*¨It'shardtotellwhatmighthave$*¦causedthisproblem,butsomething$*¦seriousiswrong.‚WemarktheSASI&*¦channeldown,andwe'llreportitas%*¦beingdownthenexttimethesystem*¦triestoaccessit. 2‰BRA.S„IDLELOOPReturntotheidleloop.‚We'llget$*¦outofthisloopwhenevertheSASI&*¦driverreceivesanothercommandthat(*¦requiressomeactionthatmustbedone*¦underinterruptcontrol.‰PAGEO*********************************************************************************ˆRETURNFROMINTERRUPT*C*ˆThisroutineiscalledwheneverwewanttoreturncontroltoCMR;B*ˆtowaitforthenextinterruptorwhenwe'vefinishedprocessingA*ˆallcommands.‚Thisroutineisalwayscalledasasubroutine,so?*ˆthestackcontainstheaddressoftheco-routinesegmentthatD*ˆshouldbeexecutedinresponsetothenextinterrupt.ThisroutineA*ˆstoresthataddressinINTSWTCH,andenablesdatainterruptsif!*ˆthereisdatalefttotransfer.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea*’A5=physicaladdressofCCB*O******************************************************************************* DINTRTNƒMOVE.Lƒ(SP)+,INTSWTCH(A5)ƒSavetheco-routineswitchaddress. AEQ440„REG†D1/D2/D3/A2/A3/A4„Restoretheregistersthatweresaved;‰MOVEM.L‚(SP)+,EQ440Šatthestartoftheinterrupthandler. 5‰TST.W„IOQCNT(A5)IftheIOQUEUEisnon-empty,enable/‰BEQ.S„L0455SASIinterrupts.‚IftheIOQUEUEis&*§empty,however,wedon'tenableSASI?EQ450„EQU†ENABLINT+LEDOFF†interrupts,givingusanextramargin%‰MOVE.Bƒ#EQ450,CONTROL(A0)ƒofsafety. !*¨Ifourprocessinghasbeenslow)*¦becauseofhigher-leve linterrupts,the(*¦SASIcontrollermightalreadyhavethe'*¦nextinterruptpending.‚Inthiscase,(*¦theinterruptwilloccurassoonaswe(*¦enableSASIinterruptshere,andwe'll*¦havenestedSASIinterrupts. 4CARRY„EQU†1<<0“Finally,settheSR.Cbit,andreturn:L0455„OR.B…#CARRY,CCR‹controltoCMR.‚SettingtheSR.Cbit)‰RTS›indicatesthatwehaveprocessedthe *¦interrupt.‰PAGEO*********************************************************************************ˆSTATUS-ERRORROUTINE*E*ˆControlcomestothisroutinewhentheSASIcontrollerhasreportedB*ˆastatuserror.‚We'll‚interrogatethe‚controllertogetdetailedA*ˆinformation‚regarding‚theexact‚natureofthe‚error,thenwe'llD*ˆreportthe‚detailederrorclassificationtotheuserviatheerror*ˆstatuscode.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*8*ˆExitsto:‚SASIDONEroutinetoreporterrortotheuser*O******************************************************************************* ;STATERR‚LEA†CMDEND(A5),A3ŠWe'llusethesamecommandpacket3‰CLR.W„-(A3)thatweusedforthecommandthatjust5L1‡SET†CMDCTRLŽgeneratedthestatuserrorbecausethe7L1‡SET†CMDSECTSLUN(Logical-Unit-Number)fieldandthe&*¦LSN(Logical-Sector-Number)fieldof%*¦thatcommandpacketarealreadyset)*¦properlyfortheparticularpartofthe)*¦particulardiscthatwasbeingaccessed&*¦whentheerroroccurred.‚Hereweset$*¦upA3forautodecrementaddressing(*¦throughthecommandpacketintheCCB,#*¦andthenwecleartheCMDCTRLand(*¦CMDSECTSfieldsofthecommandpacket. ?‰SUBQ.Lƒ#CMDSECTS-CMDLSN,A3„SincetheLSNandLUNfieldsofthe)*¦commandpacketarealreadysetproperly&*¦forthediscthatwasbeingaccessed'*¦whentheerroroccurred,weskipover*¦thosefields. :‰MOVE.Bƒ#SENSECMD,-(A3)ˆPuttheopcodeforarequest-sense1‰BSR†SENDCMDŽcommandintotheopcodefieldofthe/L1‡SET†CMDOPcommandpacket,andusesubroutine'*¦SENDCMDtosendthecommandpacketto!*¦theSASIcontroller.‚Subroutine$*¦SENDCMDassumesthatA3issetfor&*¦autoincrementingthroughthecommand%*¦packet,andsubroutineSENDCMDalso'*¦assumesthatA0pointstothememory-*¦mappedI/OareafortheSASI.‰PAGE?‰MOVEQIƒSELECTED+REQREAD,D3„TheSASIcontrollershouldbeready3‰BSR.S„CHKFLAGStorespondwithitsfourdatabytes5‰BNE.S„CTRLERRŽwithinafewmicroseconds,sowedon't**¦returncontroltothesystemwhilewe're'*¦waitingonthecontroller'sresponse.)*¦Instead,wecallCHKFLAGStowaituntil**¦thecontrollerisready.Ifthecontrol-**¦lerbecomesreadyforthewrongactivity%*¦orifthecontrollerdoesn'tbecome)*¦readyatallwithinafewmicroseconds,(*¦CHKFLAGSreturnscontrolwiththeCC.Z(*¦bitresettoindicatetheFATALerror. &*¨Thetimeoutloopthatisprovidedby**¦CHKFLAGSisconsiderablylongerthanthe(*¦controlleractuallyneeds,sowewon't(*¦timeouthereunlessthecontrolleris)*¦reallyfailing.‚Ontheotherhand,only)*¦asmallportionofthecompletetimeout)*¦loopwilleverbeexecutedundernormal**¦circumstances,sothetimeoutloopwon't&*¦adverselyaffectsystemperformance. 9‰MOVEP.L‚DATA0(A0),D2‹ReadallfourdatabytesintoD2by1‰ROL.L„#8,D2accessingtheSASIcontroller'sdata5‰AND.W„#ERRBITS,D2Šregisteratallfourofitsmemory&*¦addresses,andisolatethebitsthat"*¦definetheactualerrorcode.‚We&*¦isolatetheerror-definitionbitsin&*¦D2.W,andwe'lllateruseD2.Wasan'*¦indexintotheSASIerror-codetable. 2‰BSR†GETSTATGetthecontroller'sstatuscode,and0‰BNE.S„CTRLERRŽdeclareacontrollererrorifthe(*¦controllergivesusanerrorstatuson(*¦therequest-sensecommand.‚IftheSASI$*¦controllercan'tevenrespondtoa)*¦request-sensecommandwithoutreporting**¦anewerror,somethingseriousis wrong. @‰MOVE.BƒERRCODE(PC,D2.W),D1„Thecontrollerhasproperlygivenus'*¦aSASIerrorcodetodefinetheexact%*¦natureoftheproblemthatoccurred%*¦duringthelastI/Otransaction.‚We&*¦usethaterrorcodeasanindexinto)*¦theSASIerror-codetable,andwegeta)*¦Versadoserrorcodefromthetableinto&*¦D1.B.‚Oncewe'vetranslatedtheSASI(*¦errorcodeintoaVersadoserrorcode,%*¦wetransfercontroltotheSASIDONE&*¦routine,whichwillreporttheerror*¦codeinD1.Btotheuser. 9‰MOVE.L„CMDOP(A5),D2ŠGetthesectornumberwiththeerror2‰AND.L…#LSNMASK,D2‰fromthestatuspacketintoD2. ‰BRA‡SASIDONE‰PAGEO*********************************************************************************ˆSASIERROR-CODETABLE*C*ˆThistabletranslatesSASIerrorcodesintoVersadoserrorcodes.*O*******************************************************************************  /*ˆThetype-0errorcodesdescribedriveerrors.  *¨----‚SASIErrorCode.*¨|*¨|$*¨V…SASIDefinitionandExplanation. ?ERRCODE‚DC.B…ISTACNT‡$00„Noerror.‚Therearetwopossiblecases&*¦inwhichwecangetthiserrorcode. &*¦Themostlikelycaseariseswhenthe(*¦SASIcontrollerdetectsaparityerror!*¦inthecommandsequencethatwe%*¦transmittoit.‚Aparityerrorisa&*¦specialkindoferror,andwereally'*¦shouldn'tusearequest-sensecommand(*¦followingaparityerror.‚However,the(*¦codeissimplerifwedo,andtheSASI)*¦controllerreportsthatithasnoerror(*¦inthiscasebecauseaparityerroris&*¦notclassifiedasanordinaryerror. $*¦Theothercasethatgeneratesthis'*¦errorcodecanoccurasaresultofa%*¦controllermalfunctioninwhichthe'*¦controllerfirstreportsanerrorand*¦thenrefusestoclassifyit. '*¦Wereportacontrollererrorwhenever$*¦wegetthiserrorcodebecausethe'*¦situationisseriousineitherofthe*¦possiblecases. 2‰DC.B…ISTANRˆ$01„Noindexsignal.‚Versadosdoesn't'*¦reallyhaveanerrorcodetodescribe%*¦thissituation,sowesimplyreport*¦thatthediscisnotready. 8‰DC.B…ISTASEK‡$02„Noseekcomplete.‚Sincetheseeknever$*¦completed,wereportaseekerror. 4‰DC.B…ISTACRC‡$03„Writefault(rigiddisconly).‚The)*¦controllerwasunabletowritethedata'*¦totherigiddisccorrectly.‚Versados&*¦doesn'treallyhaveanerrorcodeto)*¦describethissituation,sowereporta*¦CRCdataerror.‰PAGE*¨----‚SASIErrorCode.*¨|*¨|$*¨V…SASIDefinitionandExplanation. 7‰DC.B…ISTANRˆ$04„Drivenotready.‚Wereportanerrorto'*¦indicatethatthedriveisnotready. 6‰DC.B…ISTANRˆ$05„Drivenotselected(rigiddisconly).'*¦Versadosdoesn'treallyhaveanerror(*¦codetodescribethissituation,sowe&*¦reportanerrortoindicatethatthe*¦driveisnotready. 7‰DC.B…ISTAUNR‡$06„Notrack00.‚Versadosdoesn'thavean(*¦errorcodetodescribethissituation,&*¦sowesimplyreportanunrecoverable*¦deviceerror. '*¦ThefollowingSASIerrorcodesaren't)*¦defined,andwereportanindeterminate&*¦channelerrorifwereceiveanerror*¦codethatisn'tdefined. '‰DC.B…ISTAICE‡$07„Undefinederrorcode.'‰DC.B…ISTAICE‡$08„Undefinederrorcode.'‰DC.B…ISTAICE‡$09„Undefinederrorcode.'‰DC.B…ISTAICE‡$0A„Undefinederrorcode.'‰DC.B…ISTAICE‡$0B„Undefinederrorcode.'‰DC.B…ISTAICE‡$0C„Undefinederrorcode.'‰DC.B…ISTAICE‡$0D„Undefinederrorcode.'‰DC.B…ISTAICE‡$0E„Undefinederrorcode.'‰DC.B…ISTAICE‡$0F„Undefinederrorcode.‰PAGE4*ˆThetype-1errorcodesdescribecontrollererrors.  *¨----‚SASIErrorCode.*¨|*¨|$*¨V…SASIDefinitionandExplanation. 8‰DC.B…ISTAMRK‡$10„IDreaderror.‚ArigiddischadanECC(*¦errorinanIDfield,orafloppydisc%*¦hadaCRCerrorinanIDfield.‚The&*¦errorcannotbecorrected.‚Sincethe(*¦errorisintheIDfield,wereportan%*¦address-markerror.‚Note:‚ECCmeans'*¦Error-CorrectingCode,andCRCstands*¦forCyclicalRecordCheck.  7‰DC.B…ISTACRC‡$11„Anuncorrectabledataerrorwasfound&*¦duringareadoperation.‚Wereporta*¦CRCdataerror. 6‰DC.B…ISTADME‡$12„AnIDaddressmarkwasnotfound,so(*¦thediscmaybeunformatted.‚Wereport'*¦anerrorindicatingthatthetrackor*¦sectorIDwasnotfound. 8‰DC.B…ISTADDM‡$13„Dataaddressmarknotfound.‚Wereport&*¦anerrorindicatingthatadatamark*¦hasbeendeleted. 7‰DC.B…ISTASAˆ$14„Recordnotfound.‚Thecorrectcylinder)*¦andheadwerefound,butthesectorwas'*¦notfound.‚Wereportanerrorcodeto&*¦indicatethatthesectoraddresswas *¦invalid. 5‰DC.B…ISTASEK‡$15„Seekerror.‚Theread/writeheadwas(*¦positionedtoawrongcylinder,and/or(*¦awrongheadwasselected.‚Wereporta *¦seekerror. 7‰DC.B…ISTATOˆ$16„DMAdatatimeouterror.‚Thecontroller%*¦hasreportedatimeouterror,sowe'*¦reportatimeouterrortothesystem. 4‰DC.B…ISTAWPˆ$17„Writeprotecteddevice.‚Theuseris)*¦tryingtowritetoadiscthatiswrite)*¦protected,sowereportaerrortothat *¦effect.‰PAGE*¨----‚SASIErrorCode.*¨|*¨|$*¨V…SASIDefinitionandExplanation. 6‰DC.B…ISTACRC‡$18„Correctabledata-fielderror.‚AnECC(*¦erroroccurred,butthedataerrorwas&*¦automaticallycorrectedifautomatic"*¦datacorrectionwasn'tdisabled. 8‰DC.B…ISTABDS‡$19„Badtrackfound.‚Versadosdoesn'thave&*¦anerrorcodeforabadtrack,sowe&*¦reportthecodethatindicatesabad *¦sector. 8‰DC.B…ISTACFG‡$1A„Formaterror.‚Whilethecontrollerwas&*¦performingacheck-trackcommand,it(*¦discoveredthattheformatonthedisc'*¦wasnotasexpected.‚Sincetheformat&*¦ofthediscdoesn'tmatchtheformat%*¦thatthecontrollerthinksthedisc&*¦shouldhave,wereportanerrorcode'*¦indicatingthatthedeviceconfigura-*¦tionisincorrect. '*¦ThefollowingSASIerrorcodesaren't)*¦defined,andwereportanindeterminate&*¦channelerrorifwereceiveanerror*¦codethatisn'tdefined. '‰DC.B…ISTAICE‡$1B„Undefinederrorcode.'‰DC.B…ISTAICE‡$1C„Undefinederrorcode.'‰DC.B…ISTAICE‡$1D„Undefinederrorcode.'‰DC.B…ISTAICE‡$1E„Undefinederrorcode.'‰DC.B…ISTAICE‡$1F„Undefinederrorcode.‰PAGE1*ˆThetype-2errorcodesdescribecommanderrors.  *¨----‚SASIErrorCode.*¨|*¨|$*¨V…SASIDefinitionandExplanation. 8‰DC.B…ISTAIEˆ$20„Invalidcommandreceivedfromthehost.'*¦Sincewehavenobusinesssendingthe(*¦SASIcontrolleraninvalidcommand,we'*¦reportanerrorcodetoindicatethat'*¦someinternalI/Oerrorhasoccurred. 5‰DC.B…ISTAEOV‡$21„Illegallogicalsectoraddress.‚The&*¦sectoraddressisbeyondthemaximum'*¦addressforthetypeofdrivethatis(*¦beingused.‚Someonehasprobablygiven)*¦ussomebadconfigurationparametersto&*¦causethiserrortooccur.‚Wereport*¦anend-of-volumeerror. 4‰DC.B…ISTAUNR‡$22„Illegalfunctionforthespecified#*¦drive.‚Forexample,acheck-track)*¦commanddoesnotapplyforfloppydiscs(*¦withIBMtrackformat.‚Versadoshasno(*¦errorcodetodescribethissituation,&*¦sowesimplyreportanerrorcodeto)*¦indicatethatthereisanunrecoverable*¦error. '*¦ThefollowingSASIerrorcodesaren't)*¦defined,andwereportanindeterminate&*¦channelerrorifwereceiveanerror*¦codethatisn'tdefined. '‰DC.B…ISTAICE‡$23„Undefinederrorcode.'‰DC.B…ISTAICE‡$24„Undefinederrorcode.'‰DC.B…ISTAICE‡$25„Undefinederrorcode.'‰DC.B…ISTAICE‡$26„Undefinederrorcode.'‰DC.B…ISTAICE‡$27„Undefinederrorcode.'‰DC.B…ISTAICE‡$28„Undefinederrorcode.'‰DC.B…ISTAICE‡$29„Undefinederrorcode.'‰DC.B…ISTAICE‡$2A„Undefinederrorcode.'‰DC.B…ISTAICE‡$2B„Undefinederrorcode.'‰DC.B…ISTAICE‡$2C„Undefinederrorcode.'‰DC.B…ISTAICE‡$2D„Undefinederrorcode.'‰DC.B…ISTAICE‡$2E„Undefinederrorcode.'‰DC.B…ISTAICE‡$2F„Undefinederrorcode.‰PAGE7*ˆThetype-3errorcodesdescribemiscellaneouserrors.  *¨----‚SASIErrorCode.*¨|*¨|$*¨V…SASIDefinitionand Explanation. 8‰DC.B…ISTAUNR‡$30„RAMerrorinSASIcontroller.‚Amemory)*¦failurehasoccurredinthecontroller,&*¦sowereportanunrecoverableerror. '*¦ThefollowingSASIerrorcodesaren't)*¦defined,andwereportanindeterminate&*¦channelerrorifwereceiveanerror*¦codethatisn'tdefined. '‰DC.B…ISTAICE‡$31„Undefinederrorcode.'‰DC.B…ISTAICE‡$32„Undefinederrorcode.'‰DC.B…ISTAICE‡$33„Undefinederrorcode.'‰DC.B…ISTAICE‡$34„Undefinederrorcode.'‰DC.B…ISTAICE‡$35„Undefinederrorcode.'‰DC.B…ISTAICE‡$36„Undefinederrorcode.'‰DC.B…ISTAICE‡$37„Undefinederrorcode.'‰DC.B…ISTAICE‡$38„Undefinederrorcode.'‰DC.B…ISTAICE‡$39„Undefinederrorcode.'‰DC.B…ISTAICE‡$3A„Undefinederrorcode.'‰DC.B…ISTAICE‡$3B„Undefinederrorcode.'‰DC.B…ISTAICE‡$3C„Undefinederrorcode.'‰DC.B…ISTAICE‡$3D„Undefinederrorcode.'‰DC.B…ISTAICE‡$3E„Undefinederrorcode.'‰DC.B…ISTAICE‡$3F„Undefinederrorcode.‰PAGEO*********************************************************************************ˆCONTROLLER-ERRORROUTINE*G*ˆControlcomestothis‚routinewhenwe'vedetectedacontrollererror.G*ˆWedeclareacontrollererrorwhentheSASIcontrollerdoessomethingF*ˆthatsimplycannotbeexplained‚byany‚definedsetofcircumstances.E*ˆWhenacontrollererroroccurs,we‚downthe‚SASIchannelandreportF*ˆacontrollererror.‚Acontrollererrorisaseriousproblem,andthe=*ˆsystemshouldn'ttrytousetheSASIchannelfollowingone.*A*ˆThereare‚twoentrypoints.‚Theentrypoint‚atCTRLERR1‚isusedD*ˆtheerrorisdetectedwithinasubroutine.‚TheentrypointCTRLERR*ˆisusedotherwise.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*>*ˆExitsto:‚SASIDONEtoterminateprocessingfortheactivity.*O******************************************************************************* 7CTRLERR1ADDQ.Lƒ#4,SP’Controlcomestothisentrypoint%*¦whenacontrollererrorisdetected%*¦fromwithinasubroutine.‚Weremove&*¦thesubroutine'sreturnaddressfrom(*¦thestack,sothestackisrestoredto&*¦theconditionthatithadbeforethe*¦subroutinewascalled. >CTRLERR‚ST.B…CHANDOWN(A5)‹DowntheSASIchannelbysettingthe"*¦variablethatindicatesthatthe#*¦controllerisdown.‚Ifthesystem(*¦triestoaccesstheSASIchannelagain#*¦withoutresettingitfirst,we'll%*¦reportanerrorindicatingthatthe$*¦channelisdown.‚Thesystemreally"*¦shouldn'ttrytoaccesstheSASI'*¦channelagainwithoutfirstresetting$*¦thecontroller.‚Evenresettingthe)*¦controllermaynotcorrecttheproblem,'*¦butwe'llletthesystemtryasoften*¦asitwishes. 5‰MOVEQIƒISTACNT,D1SetupD1.Bforreportingastatus5‰BRA†SASIDONEcodethatindicatesacontrollererror,%*¦andgoterminateprocessingforthe!*¦currententryoftheI/Oqueue.‰PAGEO******************************************************************************** *ˆCHKFLAGS.AL*O******************************************************************************* GREADRDY‚MOVEQIƒSELECTED+REQREAD,D3„Thisspecialentrypointisusedfor(*¦checkingtheSASIcontrollertoseeif(*¦ithasinputdatareadytotransferto(*¦us.‚WegettheproperFLAGSvalueinto'*¦D3.B,andthencontrolfallsdirectly'*¦intothemainentrypointforsubrou-*¦tineCHKFLAGS. :*ˆControlsometimesfallsintothissubroutinefromabove.  ‚Drive/controllersupportstheconfigurerequest.?*‚Drive/controllerdoesnotsupporttheconfigurerequest.4*•D1.B=VERSAdoserrorcodefortheerrordetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** SET_CNFG: F***********************************************************************Ä*3*ˆModifiedforbothtypesofcontrollers12/12/83**Ä*F********************************************************************** *H*‚Weneedtosetupavariableblocktodescribeadefine-formatcommandD*‚sequencethatcanbesenttotheSASIcontroller.‚ThisneedstobeB*‚doneONLYfor51/4"drives.‚Foran8"drivewedooneofthese:F*„a)8"FLOPPY:‚Thisissupported,butwedon'tneedtosetupforit.7*orb)8"HARD:„ThisisNOTsupported,soreturn.*EQ710„EQU‡CONFGBLK+IOSATW/‰BTSTW…#IOASIZE,EQ710(A1)‚Checkthesizefirst. ‰IF‚‚THEN.SŽThisisan8"... AEQ720†EQU…CONFGBLK+IOSATW…Sinceitisan8",testfloppyorhard.8‹MOVE.B‚#ISTACNF,D1‰ReturnerrorinD1for8"harddisk.@‹BTSTWƒ#IOARDISC,EQ720(A1)Setforfloppyandforhard"‹RTS™disk(andD1haserrorcode).‰ENDI‰PAGE**‚Thisisa51/4"drive:*=‰MOVEM.LƒD0/D2/D3/A0/A3,-(A7)ƒSavetheregisterswewilluse. *‰LEA‡DTCCMD(A5),A0‡POINTTOCOMMANDPACKET#‰CLR.B…DTCFLAG(A5)‰ARMLOOPCOUNTEREQ730„EQU‡CONFGBLK+IOSATW‰BTSTW…#IOARDISC,EQ730(A1)‰BEQ.S…L0650AŽBRAFORFLOPPY  **‚Mustbea51/4"HARDdisk:*;‰MOVE.L„#$C2000000,(A0)+„INITTOACLASS6,OPCODE2COMMAND(‰MOVE.W„#0,(A0)+ŒFORDTC520ACONTROLLER STVALUE‚EQU‡$0B3C0000 3‰MOVE.L„#STVALUE,D3‰GETSTEPVALUEDEFAULTSINTOD3 EQHEADS‚EQU‡IOSHDS+CONFGBLK -‰ADD.B…EQHEADS(A1),D3†SET#OFHEADS(BYTE4)‰SUBQ†#$1,D3Ž#OFHEADS-1**ˆB15•B0*ˆ---------------- ---------*‚D3„!…!…!…!…!*ˆ------------------------- *‹^…^…^…^*‹!…!…!…!---------(#HEADS)-1"*‹!…!…!---------------$0„STEPMODE)*‹!…!---------------------$3CƒSTEPPERIOD2*‹!---------------------------$0BƒSTEPPULSEWIDTH*0*ˆTHISTAKESCAREOF#HEADSANDTHESTEPVALUES*1‰MOVE.L„D3,(A0)+ŒMOVEDATATORAM(1STLONGWORD)*EQTRK„EQU‡IOSTRK+CONFGBLK *‰MOVE.W„EQTRK(A1),D3ˆGETTOTAL#CYLINDERS#‰MOVE.W„D3,D2SAVELOWERWORDIND2$‰AND.L…#$0000FFFF,D3‡MASKUPPERWORD(‰SWAP†D3’TOTAL#CYLINDERSINUPPERWORD,‰LSL.W…#7,D2DIVIDEBY2ANDPLACEINBYTE2‰ADD.W…D2,D3MOVEITINTOD3%‰AND.B…#0,D3MAKESURELASTBYTEIS0‰PAGE**ˆB15•B0*ˆ-------------------------*‚D3„!…!…!…!…!*ˆ------------------------- *‹^…^…^…^&*‹!…!…!…!---------SETTO0ˆ(TYPE/SEEK)0*‹!…!…!---------------(#CYLINDERS)/2(PRE-COMP)/*‹!…!---------------------#CYLINDERS…(LOBYTE)3*‹!---------------------------#CYLINDERS…(HIBYTE)*0*ˆTHISTAKESCAREOF#CYLINDERS&PRECOMPVALUE*‰MOVE.L„D3,(A0)+ŒSAVEINMEMORY ‰MOVE.W„#0,D3GET0,‰MOVE.W„D3,(A0)+ŒCLEARLAST2BYTESOFBLOCK 1‰LEA‡DTCCMD(A5),A0‡GETPOINTERTOPARAMETERBLOCK*‰MOVE.L„DCBPNTR(A1),A3†A3<--DCBaddress.#‰MOVE.B„DCBCDV(A3),D3‡GETLUNFIELD‰LSL.B…#5,D3SHIFTLUNFIELD-‰MOVE.B„D3,1(A0)ŒPLACELUNINPARAMETERBLOCK‰BRA.S…SETCNFG_EXIT  **‚Mustbea51/4"FLOPPYdisk:*7L0650AƒMOVE.L„#$C0000000,(A0)+„CLASS6,OPCODE0COMMAND‰MOVE.W„#0,(A0)+ŒINTODTCCMD 0STVAL1ƒEQU‡$17060015‹FORMICROPOLIS1115-6DRIVE !‰MOVE.L„#STVAL1,D0ŠSETUPDTCDATA **ˆB15•B0*ˆ-------------------------*‚D0„!…!…!…!…!*ˆ------------------------- *‹^…^…^…^'*‹!…!…!…!---------HEADSETTLETIME15mS8*‹!…!…!---------------MAXCYLINDERADDRESSSETTO0HERE,*‹!…!---------------------STEPINTERVAL„6mS4*‹!---------------------------STEPPULSEWIDTH17uS*4*ˆTHISTAKESCAREOF#CYLINDERS&TIMINGPARAMETERS*‰PAGE'‰MOVE.W„EQTRK(A1),D3ˆGET#OFCYLINDERS-‰AND.L…#$FFFF00FF,D0‡MAKESUREFIELDISCLEAR-‰AND.L…#$0000FFFF,D3‡MAKESUREFIELDISCLEAR‰LSL.W…#8,D3PUT#INBYTE1(‰ADD.L…D3,D0PUTINMAXCYLINDERADDRESS‰MOVE.L„D0,(A0)+ŒPUTINDTCDATA 0STVAL2ƒEQU‡$CD000B80‹FORMICROPOLIS1115-6DRIVE-‰MOVE.L„#STVAL2,(A0)+‡NOMODIFICATIONSPASSED **ˆB15•B0*ˆ-------------------------*‚D0„!…!…!…!…!*ˆ------------------------- *‹^…^…^…^(*‹!…!…!…!---------DRIVEIDENTIFIER-$803*‹!…!…!---------------DELAYAFTERWRITEDE-ASSERTED7*‹!…!---------------------VALIDDATAAFTERDRIVESELECT:*‹!---------------------------VALIDDATAAFTERHEADSELECT*0*ˆTHISTAKESCAREOFADDTIONALTIMINGPARAMETERS* -‰MOVE.W„#0,(A0)+ŒLAST2BYTES0BYDEFINITION6‰LEA‡DTCCMD(A5),A0‡NOWGOBACKANDFIXDENSITY&SIDES BYTE5„EQU‡5“LASTBYTEINDTCCMD!EQCNFGƒEQU‡IOSATW+CONFGBLK…IOSATW*‰MOVE.B„BYTE5(A0),D0ˆGETFIELDINQUESTION ‰MOVE.W„EQCNFG(A1),D3‡GETIOSATW+‰BTST†#IOATDEN,D3‰SINGLEORDOUBLEDENSITY?‰BEQ.S…MOD1BRAIFSINGLE%‰OR.B†#6,D0THESEBITSARESETFOR2D-MOD1…BTST†#IOADSIDE,D3ˆSINGLEORDOUBLESIDED‰BEQ.S…MOD2BRAIFSINGLE‰OR.B†#1,D0THISBITSETFOR2S&MOD2…MOVE.B„D0,BYTE5(A0)ˆREPLACEFIELD #‰MOVE.B„DCBCDV(A3),D3‡GETLUNFIELD‰LSL.B…#5,D3SHIFTLUNFIELD(‰MOVE.B„D3,1(A0)ŒPLACELUNINDATAFIELD *%*‚Commonexitpointfor51/4"drive:7*‚Returnsincethecontrollersupportsthecommand* SETCNFG_EXIT: (‰MOVE.B„#0,D0’Setgoodstatusonreturn.<‰MOVEM.Lƒ(A7)+,D0/D2/D3/A0/A3ƒRestoretheregistersweused.‰RTS‰PAGEN******************************************************************************* *ˆSET_CODE*F*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledatE*ˆthebeginningofthedriver.‚ThefunctionofthisroutineistosetD*ˆanymedia‚and/or‚driverelatedcodesinthedrive'svariableblockC*ˆ(device-dependentportion)‚requiredby‚theparticular‚controller.>*ˆItiscalledbyconfigure,read,write,andformatcommands.**A*ˆEntry:„A1= pointertoDrive'sVariableBlockinglobalmemory.#*’A5=physicaladdressoftheCCB.* *’Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D‚*‡**™A„P‡P* *ˆCalls:none**ˆExit:‚RTStocaller.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** SET_CODE: 4‰MOVEM.LƒD0/D4,-(A7)‰Saveanyregisterswewilluse. K****************************************************************************0*ƒModifiedforthe1403EScontroller1/10/84ƒBWN**ƒTrackformatbyte:*!*ˆ00ˆSingledensity,singlesided *ˆ01ˆSingledensity,doublesided *ˆ06ˆDoubledensity,singlesided *ˆ07ˆDoubledensity,doublesided**‰PAGE.‰MOVEQ…#0,D4ThisregisterwillholdCTRLCODE. *5*‚TheCTRLCODEneedstobesetuponlyfor8"floppy,1*‚andwearedoingaCONFIGcommand.‚Inallother*‚casesitissettozero.*‰CMP.B…#CNFGFUNC,IOFUNCT(A1)+‰IF‚‚THEN.SŽThisisaCONFIGcommand... EQ652†EQU‡CONFGBLK+IOSATW5‹MOVE.W„EQ652(A1),D0†GettheattributeswordintoD0. ‹BTSTW…#IOASIZE,D0&‹IF‚‚THEN.SŒThisisan8"drive... BTSTW…#IOARDISC,D0#IF‚‚THEN.SŠanditisafloppy. "BTST†#IOADDEN,D0ƒDoubledensity?IF‚‚THEN.SˆIfso,#‘BSET„#CMDDDEN,D4ƒsetbits1and2.‘BSET„#CMDDDEN2,D4ENDI BTST†#IOADSIDE,D0‚Doublesided?IF‚‚THEN.S$‘BSET„#CMDDSIDE,D4‚Ifso,setbit0.ENDI ENDI ‹ENDI ‰ENDI 0‰MOVE.B„D4,CTRLCODE(A1)…Setupthecontrolcode. 3‰MOVEM.Lƒ(A7)+,D0/D4‰Restoretheregistersweused.‰RTS‰PAGEN********************************************************************************ˆCHK_FLOPPYROUTINE*C*ˆThisisa‚devicedependent‚routinewhose‚offsetmust‚beinstalledD*ˆatthebeginningofthedriver.The‚functionof‚thisroutine‚istoF*ˆcheckthatthebytespersector,‚sectorspertrack,anddata-densityG*ˆdensityvaluesareconsistentwitheachother.Thisroutineiscalled?*ˆafterthe‚user's‚configuration‚block‚has‚been‚filled‚with‚theG*ˆproposedconfiguration.Therefore,A0pointstotheendoftheuser's*ˆconfigurationblock.*0*ˆEntry:A0=endofuser'sconfigurationblock.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567 *™D†***ƒ***™A‚Pƒ** *ˆCalls:none*/*ˆExit:‚RTStocallerwithconditioncodesset:-*noerrorsinthisconfigurationcheck.*anerrorwasfound.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N*******************************************************************************/*‚TablesusedtocheckthefloppyconfigurationJ*‚TheRWINandSASIcontrollersagreeontheirvaluesfor128bytesectorsN*‚and256bytesector.Howeverthereisadifferenceonthe1024bytesectors,E*‚andadifferenceinwhatissupportedbythedifferentcontrollers.J*‚Fornow,withonly128or256bytessectors,thereisnodifference,and*‚wecanusethesametables.**$*ƒBYTESPERSECTOR--SINGLEDENSITY*-BPS_S„DC.W†128Š128bytes,singledatadensity,‰DC.W†0Œwedonotsupport256singledensity,‰DC.W†0Œwedonotsupport512singledensity-‰DC.W†0Œwedonotsupport1024singledensity*$*ƒBYTESPERSECTOR--DOUBLEDENSITY*5BPS_D„DC.W†0ŒSASIdoesnotsupport128doubledensity(‰DC.W†256Š256bytes,doubledatadensity,‰DC.W†0Œwedonotsupport512doubledensity-‰DC.W†0Œwedonotsupport1024doubledensity‰PAGEƒTHEN.SŒIfdoubledensity,movepntrto*ŽADDQ.Lƒ#BPS_DENS,A2„doubledensitytable.‰ENDI***6‰MOVE.W„IOSPSM-IOSDRSV(A0),D6‰D6<---bytespersector 0‰MOVE.W#C_TBL_SZ-1,D7Searchformatchinbytes)BPS_LOOPCMP.Wƒ(A2)+,D6’persectortable.‰DBEQ„D7,BPS_LOOP.‰BNE.SƒRET“Ifnomatch,returnwithCCR=*'*‚Weareherebecausewefoundamatch.* BPS_FOUND4‰LEA‡SPT5_S(PC),A2‡A2<---‚pntrtosectorpertrack,#*¦5",singledensitytable.(SPT5_S)1‰BTSTW…#IOADDEN,D4‰Ifdoubledensity,pointA2to-‰IFƒƒTHEN.SŒsectorspertrack,5",double,ŽADDQ.Lƒ#SPT_DDEN,A2„densitytable.(SPT5_D)‰ENDI.‰BTSTW…#IOASIZE,D4‰If8"diskette,pointA2to0‰IFƒƒTHEN.SŒthesectorspertrack,8"table,4ŽADDQ.Lƒ#SPT_SIZE,A2„eithersingleordoubledensity*‰ENDIšasfixedupabove.(SPT8_DorSPT8_S)*D*ƒNowthatA2ispointingtothepropertableforsectorspertrack,G*ƒsetupD4topointtothebyteoffsetofourentryfromthebeginning=*ƒofthepropertable,andlet'scheckthesectorspertrack.*‰MOVE.W„#C_TBL_SZ-1,D3 ‰SUB.W…D7,D37‰MOVE.B„IOSSPT-IOSDRSV(A0),D2‰D2<---sectorspertrack‰CMP.B…0(A2,D3.W),D2ARET†MOVEM.Lƒ(A7)+,D2/D3/D4/D6/D7/A2ƒReturnwithCCR=ifmatch‰RTS›foundandotherwise.‰PAGEN******************************************************************************* *ˆCHK_LSN*C*ˆThisisadevicedependentroutinewhoseoffsetmust‚be‚installedD*ˆatthebeginningofthe‚driver.ThefunctionofthisroutineistoC*ˆcheckthat‚therequestedstartinglogical‚sectornumber(inD2.L)E*ˆislessthanorsameasthelargestlogicalsectornumbersupported$*ˆbytheparticulardiskcontroller.**-*ˆEntry:D2=startinglogicalsectornumber.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D†P*™A* *ˆCalls:none*/*ˆExit:‚RTStocallerwithconditioncodesset:3*=startinglogicalsectornumberisinvalid.1*=startinglogicalsectornumberisvalid.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** CHK_LSN: :‰CMP.L„#LSNMASK+1,D2ŠSincethefirstlogicalsectoronthe)*¦diskislogicalsectorzero,thenumber(*¦ofthelastlogicalsectoronthedisk&*¦isD2-1.‚Ifthisnumberistoolarge)*¦tofitundertheLSNmask,somethingis'*¦wrong.‚Wecan'thavealogicalsector(*¦numberthatislargerthanthelargest(*¦sectornumberthattheSASIcontroller *¦supports.‰RTS‰PAGEN********************** ********************************************************* *ˆBLD_PACKET*C*ˆThisisadevice-dependentroutinewhose‚offsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoC*ˆbuildanyorall‚partsofthecommandpacketthatcanbebuiltat=*ˆinterrupt‚level0‚which‚willbe‚used‚bythe‚particular‚disk,*ˆcontrollertoprocessthecurrentcommand.*A*ˆEntry:„A1=pointertoDrive'sVariableBlockinglobalmemory.#*’A5=physicaladdressoftheCCB.* *’Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™A„P‡P* *ˆCalls:„none*/*ˆExit:‚RTStocallerwithconditioncodesset:3*‚Noerrorswerefoundinbuildingthepacket.4*‚Anerrorwasdetectedinbuildingthepacket.4*•D1.B=VERSAdoserrorcodefortheerrordetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** *F*‚ThisfunctionisnotrequiredbytheSASIdriver.‚Thecommandpacket8*‚isbuiltwiththeinterruptsmaskedintheco-routine.* BLD_PACKET: ‰CMP.B…D0,D0‰RTS‰PAGEN******************************************************************************* *ˆDISK_START*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledE*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto:*.*Š1.‚Setupthedevice-dependentfieldsinthe*Ždrive'svariableblock.-*Š2.‚Setupforcommandqueueingifrequired./*Š3.‚Ifthedriveisnotbusy,tellthecommand*Žtothecontroller.**D*ˆEntry:A1=addressofthedrivesvariableblockinglobalmemory.#*A5=physicaladdressoftheCCB.*=*Interruptlevelonentryisatourhardwarelevel(masked).*!*ˆRegisterusage:…01234567*™D‚* *™A‚*P‡P**ˆCalls:SASIINT**ˆExit:‚RTStocaller.*N****************************************************************************** DISK_START: ‰PUSH…SR/‰MOVEM.L‚D0/A0,-(A7)ŠSaveanyregistersweuse. 6‰LEA†IOQCNT(A5),A0ŠPutthepointertothedrive'sarea8‰MOVE.Wƒ(A0),D0Žofglobalmemoryintothenextavailable;EQ670„EQU†IOQUEUE-IOQCNT‡queueentry,andadvancethequeue=‰MOVE.LƒA1,EQ670(A0,D0.W)„pointer.‚Wedon'tneedtocheckfor2‰ADD.W„#4,(A0)Žqueueoverflowbecausewecannever&*¦accumulatemorethanonequeueentry'*¦foreachdrive.‚Wealsodon'tneedto(*¦checkforqueuewrap-aroundbecausewe'*¦physicallymovequeueentriesinstead&*¦ofusingwrap-aroundqueuepointers. -‰TST.W„D0•Ifthequeuewasn'temptybeforewe1‰BNE.S„L0410madethelatestentry,theinterrupt$*¦handlerisalreadyactiveandwill)*¦eventuallycompletetheI/Otransaction'*¦thatwe'vejustspecified.‚Otherwise,#*¦weneedtoactivatetheinterrupt *¦handler.‰PAGE8‰LEA†PROCQUE(PC),A0‰Setuptheco-routineswitchpointer>‰MOVE.LƒA0,INTSWTCH(A5)†totelltheinterrupthandlertostart<‰MOVE.LƒCCBCHB(A5),A0ˆprocessinganewI/Oqueueentry.‚Then4‰BSR†SASIINTŽpointA0totheMVME420'smemory-mapped"*¦I/Oarea,andactivateinterrupt%*¦processingbycallingtheinterrupt#*¦handleronceasasubroutine.‚The%*¦machine'sinterruptlevelisatthe)*¦samelevelthatwouldbepresentduring#*¦anactualinterruptfromtheSASI(*¦channel,sotheinterrupthandlerwill(*¦performcorrectly.‚Weneedtocallthe(*¦interrupthandleronceasasubroutine%*¦toactivateinterruptprocessingif&*¦interruptprocessingisn'tcurrently *¦active. *C*ƒNowwehavestartedofftheI/OandarereadytoreturntoCMRto(*ƒbeawakenedwhenaninterruptarrives.* 9L0410„MOVEM.L‚(A7)+,D0/A0ŠRestoreregistersthatweused.‰POP‡SR‰RTS‰SPC‡6‰PAGEN********************************************************************************ˆCHK_PARAMROUTINE*C*ˆThisisa‚devicedependent‚routinewhose‚offsetmust‚beinstalledD*ˆatthebeginningofthedriver.The‚functionof‚th isroutine‚istoB*ˆvalidate‚any‚device‚dependent‚parameters.‚Thisroutineiscalled?*ˆafterthe‚user's‚configuration‚block‚has‚been‚filled‚with‚theG*ˆproposedconfiguration.Therefore,A0pointstotheendoftheuser's*ˆconfigurationblock.*/*ˆEntry:A0=endofuser'sconfigurationblock* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™DˆR*™A‚P* *ˆCalls:none*$*ˆExit:‚RTSbacktocallingroutine.>*CONDITIONCODES:noerrorsinthisconfigurationcheck.* anerrorwasfound./*D3.B=Returnederrorcodeiferrorisfound.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** CHK_PARAM: ‰CMP.B…D0,D0Setconditioncodes ‰RTS›Return.N******************************************************************************* *‰ENDROUTINESCALLEDBYDISKLIB*N******************************************************************************ŠPAGEN********************************************************************************‰FINISHOFFTHEINITIALIZATION*2*‰Theseotherdevice-dependentthingsMUSTbedone>*‰beforewecanhandlecommands.‚Theyprobablycouldhavebeen?*‰doneinINITatthestartofthedriverbutarehandledhere.*A*‰1.‚ResetsboththeSA1403DSASIcontrollerandtheMVME420SASI*PeripheralAdapter.2*‰2.‚TeststheMVME420toseeifitisfunctional.**‰Entry:A5=addressofCCB.**‰Registersmaybeusedfreely.* *‰Calls:none*N****************************************************************************** DO_INIT: **‚Resetthecontroller*5‰MOVE.LƒCCBCHB(A5),A4ŠGetthephysicaladdressofthe:‰LEA†DIAGNOST(A4),A3†channel'smemory-mappedI/Oareainto"*¦A4,andsetupA3toaddressthe$*¦MVME420'sDIAGNOSTregister.‚We'll&*¦accesstheDIAGNOSTregisterseveral'*¦times,soit'sworthwhiletodedicate%*¦anaddressregistertopointtoit. ?‰MOVE.Bƒ#RESET,CONTROL(A4)…ResettheMVME420andtheSA1403Dby(*¦settingtheRESETbitintheMVME420's#*¦CONTROLregister.‚Inonecasethe'*¦MVME420andtheSA1403Dmayhavejust&*¦beenresetbytheautomaticpower-up)*¦reset,butresettingthemagaininthat&*¦onecasedoesnoharm.‚Resettingthe&*¦MVME420illuminatesitsfailLEDand$*¦alsodisablesitsinterrupt.‚We'll&*¦extinguishthefailLEDlaterifthe)*¦MVME420passesthetestswe'reaboutto(*¦perform,butwe'llleavetheinterrupt&*¦disableduntilwewantaninterrupt. **‚Testthecontroller*3‰MOVEQIƒ$55,D0‘Writeadistinctivebitpatterninto4‰MOVE.BƒD0,(A3)ŽtheMVME420'sDIAGNOSTregister,and5‰CMP.B„(A3),D0ŽsettheCHANDOWNflagifwecan'tread5‰SNE.B„CHANDOWN(A5)‰backthesamebitpatternthatwe%*¦wrote.‚Ifwereadbackthesamebit$*¦patternthatwewrote,however,we%*¦cleartheCHANDOWNflagtoindicate"*¦that(sofar,atleast)theSASI*¦channelisnotdown. .‰NOT.B„D0•Invertthebitpatternthatwewrote1‰NOT.B„(A3)‘totheDIAGNOSTregisterearlier,and.‰SUB.B„(A3),D0Žchecktoseeifthepatternwas:‰OR.B…D0,CHANDOWN(A5)†invertedproperly.‚Ifitwasn't,set(*¦theCHANDOWNflagtoindicatethatthe"*¦SASIchannelisdefinitelydown. 0‰BNE.S„L0020’IftheMVME420failedeitherofthe$*¦testsabove,returntothecalling&*¦routineandleavetheMVME420'sfail$*¦LEDilluminated.‚Theteststhatwe(*¦performontheMVME420certainlydon't&*¦compriseacomprehensivecheckoutby)*¦anymeans,butthey'llprobablycatcha'*¦surprisingnumberofproblems.‚Inany(*¦case,thechecksthatwemakearecon-)*¦siderablybetterthannochecksatall. ?EQ460„EQU†LEDOFF+DSABLINTˆTheMVME420passedourcursorytests,?‰MOVE.Bƒ#EQ460,CONTROL(A4)ƒsoextinguishitsfailLED,butkeep&*¦itsinterruptdisabled.‚ThefailLED'*¦wasautomaticallyilluminatedwhenwe%*¦resettheMVME420,andthef ailLED'*¦remainedlituntilnow.‚TheMVME420's&*¦interruptwasautomaticallydisabled&*¦byourearlierresetcommand,andwe%*¦wanttokeeptheinterruptdisabled$*¦untilwehaveaspecificreasonto *¦enableit. L0020„RTS *********************** *‚PATCHSPACE***********************ŠDS.Wƒ30ŠENDNN‰PAGE/************************************************ *ˆM435DRV.SA*/***********************************************‰OPT‡CRE‰OPT‡PCS‰OPT‡BRS-M435DRV‚IDNT†45,0†MAGTAPEdriverforMVME435)‰TTL‡M435DRV:‚MAGTAPEdriverforMVME435‰PAGE$TRACE„SET'OFF'‰TracerfordebuggingG*************************************************************************ˆMAGTAPE.COMMENTS.SA*G************************************************************************1*ˆDRIVERFORMAGTAPEUSINGMVME435ADAPTERBOARD*G**************************************************************************ˆREVISIONHISTORY***ˆ9/9/83„WrittenbyB.W.N.,*ˆ9/28/83ƒImplementingdirectmodeforreads-*ˆ11/30/83‚Fixes‚topreventtapefromrunning*’offtheendofthereel.;*ˆ12/1/83ƒDelayaddedforslowtransportincheckingready.'*ˆ3/9/84„Cleanedup‚commentsinWAKEUP.:*ˆ3/13/84ƒFixedTIMEFLAG(A1)--->‚TIMEFLAG(A5)‚inFINDDENS#*’(shouldhavebeenoffsetfromA5)%*ˆ4/4/84„Newboardwithenhancements:4*’(1)Candisableandenableinterruptsattheboard+*–levelbywritingintotheDSCMDregister.***–Usenewmacros,ENABLMTAandINHIBMTAto'*–turntheboardinterruptoninINTRTN0*–andtoturntheboardinterruptoffwhenabout*–togiveacommand.*1*–ReplaceINHIBwhichmasksallinterruptsatthe1*–wholeinterruptlevelwithINHIBMTA,whichonly"*–affectsinterruptsattheboard.*4*–Theonlyexceptioniswhenwearemessingwiththe-*–IOQUEUEinthecommandhandlerandMTADONE.*–Whyisthat,youask?3*–IhopetofindoutwhytheSASIdoesitthisway.*6*’(2)Afterreadingaharderror,areadofthestatus2*–registerwillcleartheinterruptsothereisno*–needtostopthetape.1*–Fortestingpurposes,fornow,iftheinterrupt1*–doesnotgoaway,inoneread,wewillstopthe*–tapeasbefore.*4*’(3)AninterruptisgeneratedwhenDNBSYgetsset.1*–Bit1intheSTAT2registercannowmeanoneof'*–3things:DNBSY,FNBSY,andfilemark.ÅÌ?Õ4Ý.å6í:õ\ýa: 9H7%=-95H=EE;M;UC]6e:m9uZ}J…O6•=>¥I­KµK1*–ForaDNBSYwejustcontinueasifnointerrupt*–ofthattypewerereceived.**ˆ4/12/84ƒBugfix:4*’A1wasnotgettingsetupproperlyforabranchto*’PROCQUEfromMTADONE.6*’Nowweputtheaddressofthedrive'svariableblock*’intoA1beforewebranch.*.*’EndoftapehandlingwasnotrightinMTINT.*’EliminatedaBRA‚MTINT3.*.*’Checkforendoftapeonforwardcommandand6*’beginningoftapeonreversacommandwasnotcorrect*’inPROCQUE(STAT1vs.STAT2)*A*ˆ5/4/84„Sometimeswhenablanktapeismountedonthetransport,2*’wedecideerroneouslythatthetransportdensity *’cannotbechangedinsoftware.3*’Don'tknowatthispointwhythisseemstooccur,/*’possiblysomethingtodowiththetransport?.*’Anyway, don'twanttolockouttheuserfrom0*’selectingatransportdensityforawritefrom.*’loadpoint,sochangethelogicinSELECT2to*’ignoretheCNGDENSflag.*4*’UseBRanchshortwhereverpossibleandaddapatch*’areaattheend.*8*ˆ4/7/84„ReplaceSELECT2callswithSELECTcalls.‚Modify *’SELECT.*5*ˆ5/22/84ƒRewritetheDOWRITEroutineusingWHILE-DO.2*’Addaperiodicactivationcalltotimeoutinthe5*’driverifDOREADtakestoolong.‚Wedothisbecause6*’IOSsendsusatimeoutfortheIOSRTOvalueandthis9*’mustmakedofornotonlyread,butrewind,search,and:*’everythingbutwrite.Wewantashortreadtimeoutbuta1*’longrewindtimeoutsowemustdoitourselves.4*’Thisrequireschangestothe9995..IOE.EQfileand*’anewsysgentotest.*<*ˆ6/15/84ƒIfuserasksforatimeoutwitha0interval,just*’treatasnotimeout.:*’Afteracommandhascompleted,inhibitinterruptsatthe8*’boardandenableinterruptsatthesystemlevel(lower0*’maskby1)sothatwedon'ttieupthesystem.*<*ˆ9/18/84ƒFoundaproblemwhiletestingonVM03.‚Continually3*’gettingtimedoutduringreads.‚Timingdependent.3*’TheproblemwasIwasreadingSTAT1asecondtime4*’intheinterruptserviceroutine,andtherewasan<*’interruptpendingthatgotclearedbutwasneverserviced.*5*’Itispossibleforthefollowingsequencetooccur:8*’HALFFULLinterruptoccurs,ReadSTAT2,‚FNBSYinterrupt4*’occurs,readSTAT1.‚Inthiscasewewillnotgeta*’FNBSYinterrupt.8*’ThereforewhenitistimetocheckforFNBSY,readthe6*’bit4inSTAT1todecideifitisaFNBSYinsteadof*’thebit1inSTAT2.*’ChangesmadeinMTINT.*;*ˆ12/04/84‚Ontapedrivesrunningat100ipsontheVME/10,5*’theREAD2Kroutinewasnotgettingbytesoutofthe0*’FIFOfastenough.‚Speededuptheprimaryloop.1*’Thisreducedthetimebetween4bytereadsfrom4*’25.6microsecondstoabout11microseconds,which*’didthetrick.*7*’OntapedrivesthatdonotconformtothePERTECspec6*’forwhichtheMVME435boardwasdesigned,readingin,*’directmodecorruptedbytesontheVME/10.4*’Asaworkaround,thedrivernowreadsinbuffered4*’modewhentheuserspecifiesabuffersizeof40962*’bytesorless.‚I'mnotsurewhy,butonthetape4*’drivesIusedfortesting,therewillbemorethan6*’4096bytesreadfromtheMVME435whenthetapeblock7*’sizeislargerthan4096,evenwhenwearereadingin-*’bufferedmode.‚Thisisagoodfeature,asa2*’bufferoverflowmessagewillalerttheuserthat6*’theblocksizeonthetapeisindeedlargerthanhis;*’4096bytebuffer.Butmostlyweexpecttheuserknowsthe%*’sizeofthetapeblocksbeingread.*=*ˆ12/7/84ƒWhenauserasksfor0readtriesor0writetries,&*’thedrivershouldchangethe0to1.9*’ThatwasnotbeingdoneintherightplaceinCONFGCOM.=*ˆ11/12/85‚Inline3903and8176removedthecomment(*)from*’SF.BTIMEFLAGinbothplaces.5*’InroutineCKRDYaddedBRAMTINT3afterreturnfrom*’BSR.LINTRTN6*’ModificationstoHALTI/Ologictoreturnthecorret*’errorstatus.2*’InroutineSTOPTAPEaddedanENABLMTAmacrocall*7*ˆ12/11/85‚InstallNEWKillermodificationwhichleaves,*’TheDriverID(Number)andReason(Number)2*’inCRASHSAValongwiththeCCBandDCBpointers.*8*ˆ01/27/86‚-FixedbuginREAD2KMOVE.L#HAFBUF,D2....was*§MOVE.W#HAFBUF,D23*’-Changedthecheckforlessthan2048bytesfrom2*”toallowingthewrite2ktoexecutefor*”anybufferlengthof2048.9*’-Fixedaproblemofthedrivernotdetectingapending6*”interruptthatoccurrswhilethedriverismaskedat6*”interruptlevel.Thiscausesbusserrorsifthetape6*”drivewasnotfastenoughtoreaddatafromtheFIFO2*”asthedriverwasinwritingdataintotheFIFO.I**************************************************************************(*ˆMODULESCALLEDINTHEMAGTAPEDRIVER:*H*--------------------ƒINITIALIZATIONƒ-----------------------------------*<*INITIAL‚ EQU‡*‡InitializesthedevicedependentpartofCCB$*œInitializesMVME435andtapedrive*K*--------------------------------------------------------------------------*H*--------------------ƒCOMMANDSERVICE‚----------------------------------**6*COMMANDSEQU‡*‡DispatchescommandsreceivedfromCMR**STATCMD‚EQU‡*‡Statuscommand.*STATCONFEQU‡*‡Updatesfirst4bytesofIOCB!*DFCONFG‚EQU‡*‡Defaultconfigure*CONFG„EQU‡*‡Configurecommand5*CONFGCOMEQU‡*‡Executescommonconfigurationchores**?*CONERROREQU‡*‡Errorexitforconfigureanddefaultconfigure*1*RDWRTCMDEQU‡*‡Entryforreadandwritecommand@*COMMCMD‚EQU‡*‡EntryforI/Ocommandsotherthanread,write,or*œconfigure&mount2*CONFG2ƒEQU‡*‡Entrypointforconfigureandmount *HALTCMD‚EQU‡*‡HaltI/Ocommand2*LOGPHYƒEQU‡*‡Convertlogicaltophysicaladdress***HALTEXITEQU‡*‡ExitforhaltI/Ocommand$*CMDEXIT‚EQU‡*‡Commandscommonexit;*CMDEXIT1“Entrypointforcommandscompletedwithouterror>*CMDEXIT2EQU‡*‡Entrypointforcommandscompletedwitherror9*CMDEXIT3EQU‡*‡Entrypointforcommandstobecompleted*œunderinterruptcontrol*%*QEVENTT”QueuesI/Ocompletionevent* *EXECREQ‚EQU‡*‡Doestrap0call *KILL_IT‚EQU‡*‡Killsthesystem*&*CMDSWIT‚EQU‡*‡TableusedinCOMMANDS'*CONFGLENEQU‡*‡TableusedinCONFGCOM*K*--------------------------------------------------------------------------*F*-------------------„INTERRUPTSERVICEƒ-------------------------------*%*INTERUPTEQU‡*‡Interpretsinterrupt+*MTINT„EQU‡*‡Dispatchesmagtapeinterrupt***PROCQUE‚EQU‡*‡Processesnextqueueentry'*SELECTƒEQU‡*‡Selectspropertransport-*œRe-selectstransportwithrequesteddensity*œforwritefromloadpoint**DOWRITE‚EQU‡*‡Writetotape<*WRITE2K”Transfer2KbytesfromFIFOtomemory(directmode)3*WRITDATAEQU‡*‡TransferbytesfromFIFOtomemory*>*DOCONFG‚EQU‡*‡Dotheconfigureandmount(interruptcontrol)&*FINDDENSEQU‡*‡Findthetapedensity1*SET_TIME“Dotrap0callforperiodicactivation*œduringFINDDENScommand.2*WAKEUP•Routinethatisactivatedduringperiodic'*œactivationwakeupcallfromFINDDENS.;*WAKEUP2”RoutineforwakeupcallsfromDOREAD,SPACE,ERASE*œSEARCH,andDOREWIND*+*DORDFWD‚EQU‡*‡Dothereadforwardcommand.*READ2K•Transfer2KbytesfromFIFOtomemory*ž(directmode)3*READDATAEQU‡*‡Transferbytesfrom‚FIFOtomemory+*žbufferedmode/endofblockindirectmode*;*STOPTAPE“Afterresetformattercommand,waitforthetape2*žtostop,cleartheformatternotbusyinterrupt.**&*DOREWINDEQU‡*‡Dotherewindcommand*;*DOSFMFWDEQU‡*‡Dothesearchforwardforfilemarkcommand;*DOSFMREVEQU‡*‡Dothesearchreverseforfilemarkcommand+*SEARCH•Commonroutineforsearchfilemark*,*DOSPFWDEQU‡*ˆDothespaceforwardcommand,*DOSPREVEQU‡*ˆDothespacereversecommand2*SPACE–Commonroutineforspaceforward&reverse*-*DOWRTFM‚EQU‡*‡Dothewritefilemarkcommand$*DOERASE‚EQU‡*‡Dotheerasecommand:*FM_ERAS_COMMCommonroutineforeraseandwritefilemark*;*MTADONE‚EQU‡*‡Completecommandprocessingunderinterrupt *œcontrol%*QEVENTI”QueuesI/Ocompletionevent*3*CKRDY–Seeifthetransportisready.Ifnotready,*œimmediately,delayforawhileuntilitis*œorwehaverunoutoftime.*#*IDLELOOPEQU‡*‡Waitforacommand*%*OPTABLE‚EQU‡*‡TableusedinPROCQUE*TRTABLE”TableusedinSELECT*I*------------------------------------------------------------------------F**********************************************************************‰PAGEI***************************************************************************ˆMAGTAPE.MACROS.SA*J*************************************************************************** *ˆMacrosforthemagtapedriver*J******************************************************************************A*<<<<<<<<<<<<<<<<<< COMMENTED OUT 12/2/8  3 >>>>>>>>>>>>>>>>>>>>>>>*<*ˆItwasdiscoveredthatgettingreadytakessometransports:*ˆlongerthanothers,soweneededatimeouttotestready(*ˆafteradelayofseveralmilliseconds. *ˆAsubroutinedoesthejobnow.****ƒCKRDY„MACRO**?*ˆPutthenotreadyerrorcodeintoD1,andcheckthereadybit=*ˆoftheSTAT1register.‚Ifthetransportisnotready,goto *ˆMTADONE.*****†MOVE.B„#ISTANR,D1***†BTST†#READYB,STAT1(A0)***†BEQ.S‡MTADONE***†ENDM*** CKEOT„MACRO**<*ˆPuttheendofvolume(endoftape)errorcodeintoD1and2*ˆchecktheendoftapebitoftheSTAT1register.**ˆIfweareatendoftape,gotoMTADONE.**‰MOVE.B„#ISTAEOV,D1‰BTST†#EOTB,STAT1(A0)‰BNE.L…MTADONE‰ENDM*** INHIB„MACRO**"*ˆInhibitinterruptsatourlevel.**‰MOVE.W„CCBISR(A5),SR‰ENDM7*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *ˆbwn‡4/4/84*INHIBMTA MACRO*"*ˆInhibitinterruptsattheboard.**‰MOVE.B„#DISABLCD,DSCMD(A0)‰ENDM*/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* ENABL„MACRO**2*ˆEnableinterruptsbyloweringmaskbyonelevel.**‰MOVE.W„CCBSR(A5),SR‰ENDM*D*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *ˆbwn‡4/4/84*'*ˆEnableinterruptsattheboardlevel.**ENABLMTA MACRO**‰MOVE.B„#ENABLECD,DSCMD(A0)‰ENDM**F*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%**8*ˆCheckfilemarkandifafilemarkwasdetected,putthe)*ˆISTAEOFmessageinD1andgotoMTADONE** CKFM…MACRO‰MOVE.B„#ISTAEOF,D1‰TST.B…SAVEFM(A1)‰BNE.L‡MTADONE‰ENDM***8*ˆCheckforbeginningoftapeandifso,puttheISTABOV!*ˆmessageinD1andgotoMTADONE** CKBOT„MACRO‰MOVE.B„#ISTABOV,D1‰BTST†#LDPNTB,STAT1(A0)‰BNE.L‡MTADONE‰ENDM**6*ˆCKTRDENmacroupdatesthecurrenttransportdensity.8*ˆItrequiresthatA0=addressofmemory-mappedIOarea-*ˆandA1=addressofdrive'svariableblock.** CKTRDEN‚MACRO‰TST.B…STAT1(A0)‰IFˆ†THEN.S“MOVE.B„#XDSD800,TRANDENS(A1)‰ELSE.S“MOVE.B„#XDSD1600,TRANDENS(A1)‰ENDI‰ENDM * *ˆTRACEmacrousedfordebuggingH*ˆIftheTRACEis'ON',thenwheneverthemacroTRACEXXisencountered,7*ˆthecharacters'XX'willbeputintothetracetable.*ˆCall:ƒTRACER1,RTR8*Thiswillputthecharacters'R1'intothetracetable6*thatstartsatRTR_TABLEandisindexedbyRTR_INDEX*andhaslengthRTR_LEN.* TRACE„MACRO‰IFEQ†TRACE-'ON'MOVE.W…D0,-(SP)MOVE.W…#\2_TABLE,D0ADDƒ\2_INDEX(A5),D0MOVE‚#'\1',(A5,D0)ADD.W#2,\2_INDEX(A5)"IF„\2_INDEX(A5)‚‚#\2_LENƒTHEN“CLR„\2_INDEX(A5)ENDIMOVE.W…(SP)+,D0‰ENDC‰ENDM *@*ˆTheCLR_TRmacroisusedtoclearthetracetableofinterest.*ˆCall:CLR_TRƒRTR3*ŽThisclearstheRTR„tablefromoffset0tooffset *ŽRTR_LEN-1.* CLR_TRƒMACRO‰IFEQ†TRACE-'ON'MOVEM.L‰D4/A3,-(SP)LEAƒ\1_TABLE(A5),A3FORƒD4=#1‚TO‚#\1_LENƒDO “CLR.B…(A3)+ENDFCLRƒ\1_INDEX(A5)MOVEM.L‰(SP)+,D4/A3‰ENDC‰ENDM G************************************************************************Í*'*ˆFromtheSASIdriverbyDavidPheanis*C*******************************************************************  2LONGWORDMACRO›Thismacroskipszeroormorebytes'*¦inmemory(ifnecessary)toalignthe)*¦assembler'slocationcountertoalong-&*¦wordboundary.‚Wedefinealong-word)*¦boundarytobealocationwhoseaddress*¦isevenlydivisibleby4. ,‰DS.W…0–First,alignthelocationcounterto"*¦awordboundary.‚Ifthelocation(*¦counterisalreadyonawordboundary,*¦wedon'tchangeit. 0‰IFNE…*/4*4-*Ifthelocationcounterisn'tona-‰DS.W…1”long-wordboundary,advanceitbyone-‰ENDCšwordtoputitonalong-wordboundary. ‰ENDM-‰PAGEš#######################################1MOVEIAƒMACRO›Thismacroisu  sefulwhenwewantto%*¦putanimmediatevalueintoan"*¦register.‚Iftheimmediatevalue"*¦happenstobesmallenoughtobe#*¦representedcorrectlyina16-bit&*¦two's-complementnumbersystem,this#*¦macrogeneratesatwo-wordMOVE.W)*¦instructionknowingthatsignextension)*¦willoccuratexecutiontimetosetthe'*¦entireregisterproperly.‚Other-(*¦wise,themacrogeneratesathree-word#*¦MOVE.Linstruction.‚Byusingthis'*¦macrowecanbeassuredofgenerating'*¦theshortestcorrectinstruction,and)*¦themacrowillstillfunctioncorrectly#*¦iftheimmediatevaluehappensto&*¦changeasaresultoffutureprogram$*¦modifications.‚TheMOVEIAmacrois*¦invokedasfollows. "*¦[