IMD 1.17: 25/11/2014 13:05:18 82VKXBVERDOS D* BT20:0 68K VERSADOS/RMS68K OBJECT 4.5 (DS,DD 96 tpi 5.1/4" DISK) REVISED: 04/22/86 DISK 20 OF 24  BT20 82VKXBVERDOS 0420²c-AND.L#1<MOVE.LQTAIL(A5),A0„getcurrentqueuepointer(evenifempty)(CMPA.LQHEAD(A5),A0„isthequeueempty?BNE.S‚INTROK3‰br=no.LEA.L‚CONFINFO(A5),A4ƒyes,thequeueisempty,MOVE.LDVDCBPTR(A4),A4ƒsosetA4<=BUSDCB'SUB.L‚A3,A3setupdummyIOSPBaddress BRA.S INTROK4*4INTROK3MOVE.LDCBQOFST(A0),A4ƒA4<==addressofDCB7MOVE.LIPBQOFST(A0),A3ƒA3<==addressofcurrentIOSPB*.*ˆGiveDMAcompleteinterrupthighestpriority*DINTROK4BTST.L#IOCINT,D0‚didanI/Ocomplete(DMA)interruptoccur?BEQ.SINTR100‚yes*, BTST #TMSINT,D0 was it a TMS9914 interrupt? BEQ INTR500 br = yes*'*ˆElseitmustbeaBUSERRORinterrupt*E********************************************************************** *ƒBUSERROR*:*ˆTheBuserrorinterruptisgeneratedbytheMVME300cardB*ˆwheneveraDMAbuserrorconditionoccursduringatransmission.8*ˆIftherewasnoI/Oinprogress,theinterruptwillbe>*ˆconsideredspuriousandwillgenerateanunsolicitedchannel?*ˆinterrupttoIOS.‚IfI/Owasinprogress,thecurrentcommand=*ˆwillbeabortedandahardwaremalfunctionerroreventsent *ˆtoIOS.*6BSET.B#VBIMENAB,CONTREG2(A1)‚enableBuserrorvector(MOVE.LQTAIL(A5),A0‚isI/Oinprogress? CMPA.L QHEAD(A5),A0BEQINTREXIT‰branchifno*@*ƒIfanSRQwasinprogress,abortallSRQprocessingandsenda$*ƒHardwareMalfunctionerrortoIOS.*B*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<* *ˆ4/24/84ƒbwn*9*ˆMustinhibitTMS9914A‚interrupts‚duringDMAoperations.*ˆMustre-enablehere.*4BSET.B#VBIMENAB,CONTREG0(A1)‚re-enable9914intrps*?*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>. MOVEQ #ISTABUS,D1 indicate hardware bus errorBSRPROCMERR‚processerrorBRAINTREXIT‚normalexit6 TTL GPIB DRIVER - INTERRUPT PROCESSING (DMA COMPLETE) PAGEG*************************************************************************ƒI/OCOMPLETE*:*ˆThisinterruptisgeneratedbytheMVME300cardwhenever>*ˆaDMAWRITEorDMAREADhascompleted.Threemajorfunctions<*ˆareaccomplishedinthissectionandtheyare:(1)I/Opost6*ˆformatting(ifspecified)afteraDMAWRITE/READhas;*ˆcompleted,(2)menuprocessingandinitiationand(3)SRQ *ˆprocessing.*8*ˆForpostI/Oformatting,theusermayspecifyaformatD*ˆroutinestobeexecuteduponcompletingthedesiredDMAoperation.<*ˆTheseroutinesmustbespecifiedatsysgentimeandshould*ˆreporterrors.*<*ˆThemenuprocessingsectionisdesignedtoeitherinitiate;*ˆthenextmenuitemor,ifatendofmenu,toqueueanI/O:*ˆcompletioneventbacktoIOSandinitiateannewmenuif7*ˆthereareotheroperationswaitingontheGPIBqueue.*;*ˆThelastmajorsectionoftheI/Ocompleteportionofthe8*ˆinterrupthandleristohandleprogramflowofservice;*ˆrequestfunctions(SRQ)whenreceivedincontrollermode.?*ˆTheprocessorwillrunstatusmenuestoeachdeviceconnected;*ˆtotheGPIBuntilthedevicerequestingserviceisfound.;*ˆOncefound,anSRQASQeventwillbesentbacktoIOSfor*ˆexamination.*INTR100:5 MOVE.B #1<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>/MOVE.LQTAIL(A5),A0‚currentmenuqueuepointer)CMPA.LQHEAD(A5),A0‚isI/Oinprogress?BEQINTREXIT‰br=no*5BTSTW#CAC_S,BUSACTIV(A5)ƒareweincontrollermode?BEQ.SINTR115br=no*4BTST#LADS_B,ADDRSTAT(A1)ƒis9914inlistenermode?BEQ.SINTR110br=no7MOVE.B#TCS,AUXCMD(A1)†sotakecontrol(synchronously)2MOVE.BDATAIO(A1),D0ˆreadregtogetthingsgoing BRA.S INTR115**ƒAlldataDMAsequencesrequirethelengthofthetransfertoD*ƒbereportedbackintheIOSparameterblockoriginatingthiscall.**>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>**<*‚ChecktoseeifthiswastheINorOUTprocessor.Ifitis8*‚calculatethelengthofthelasttransferbasedonthe=*‚contentsoftheGPIBCmemoryaddressregister(MAR)andtheC*‚typeofI/Ooperationperformed,elsenolengthcalcs.arereq'd.*?MOVE.LMENUCPOS(A5),A0‚getaddressofmenuitemjustcompleted1CMPI.B#OUT,(A0)„wastheOUTprocessorexecuted?BEQ.SINTR150…br=yes*/CMPI.B#IN,(A0)„wastheINprocessorexecuted?1BNE.SINTR200„br=TERMorSEOIprocessfinished*I* Check for the one command that uses the secondary buffer instead of the* primary buffer for data xfer.*GINTR130CMPI.W#IOOWIN,IOSFCT(A3)ƒisthisanoutoutwithinputcommand?BNE.SINTR150ƒbr=noGSUB.LD6,D0‚D0=currentM.A.R.minus(secondary)bufferstartaddress BRA.S INTR160*LINTR150 SUB.L D7,D0 D0 = current M.A.R. minus (primary) buffer start address*;INTR160 MOVE.L D0,IOSLEN(A3) store I/O xfer length in IOSPB*C*ƒChecktoseeifthereisaspecialpostformatterstobeexecuted*CMOVE.LIOSFMTA+DCBDEV(A4),D1‚getpointertouserdefinedformatter1 BEQ.S INTR200 br = no user defined I/O formatter*B*‚ChecktoseewhetherinputoroutputmenuprocessorwasexecutedA*‚andthenseeifthereisauserdefinedpostprocessorforthis *‚device.*@MOVE.W#PST_OFMT,D0ƒD0<==preloadpostoutputformatteroffset5CMPI.B#OUT,(A0)…arewedoing"OUT"menuprocessing?BEQ.SINTR180„branchifyes7MOVE.W#PST_IFMT,D0ƒD0<==postinputformatteroffset*:INTR180MOVE.LD1,A0†A0<==baseaddressofallformatters8TST.L0(A0,D0.W)ƒdiduserdefineapostdataformatter?BEQ.SINTR200ƒbranch=no*+MOVEM.LD1-D7/A0-A6,-(A7)‚saveenvironment.JSR0(A0,D0.W)‚executeuserdefinedformatter MOVEM.L (A7)+,D1-D7/A0-A6,TST.BD0ƒcheckerrorcodefromuserroutine!BEQ.SINTR200‚branchifnoerror*B*‚Anerrorhasbeendetectedintheuser'sinputformatterroutine*-MOVEQ‚#ISTAINFE,D1‚setinputformattererrorBSRPROCMERR‚processerror+ BRA.S INTR250 exit DMA interrupt processor*INTR200:'BSRPROCMENU„processnextmenuitem(s)*INTR250:6 MOVE.W (A7)+,D5 retrieve previous TMS9914 status regs (TST.WD5ˆwasthereapendinginterrupt? BEQ INTREXIT br = no BRA.SINTR510‚elsegohandleit  ; TTL GPIB DRIVER - INTERRUPT PROCESSING (TMS9914 INTERRUPT) PAGEE***********************************************************************ƒTMS9914AINTERRUPTSECTION*<*„Enteringthissectionoftheinterruptprocessorindicates8*„thatoneormoreinterruptconditionsenabledhasbeen;*„received.Readingtheinterruptmaskregsiters(INTR0and9*„INTR1)oftheTMS9914Awillindicatewhichcondition(s) *„occurred.*;*„TheGPIBcanbeinoneandonlyoneofthefourfollowing<*„states:(1)controllermode,(2)talkermode,(3)listener%*„mode,or(4)idlemode.‚Thesemodes@*„arestoredin'BUSACTIV'andmaychangedependingonwhattype=*„ofinterruptoccurred.‚Also,differentactionsmaybetaken?*„dependingonthecurrentstateoftheBUS.‚Allinterruptbits8*„willbecheckedeachtimeaTMS9914Ainterruptoccurs.* INTR500:5MOVEP.WINTR0(A1),D5ƒreadinterruptstatusregisters6AND.W‚TMSMASK(A5),D5ƒD5=validinterruptstatusbitsINTR510:B BSET.B #VBIMENAB,CONTREG0(A1) reset interrupt enable for TMS9914A***0***†MyAddressChange(MAC)checkandprocessing***$BTST#MACBIT,D5†istheMACbitset?BEQ.SINTR600ƒbr=no*I AND.W #$FFFF-(1< BTSTW #SRQPROG,BUSACTIV(A5) USER I/O or SRQ polling sequence?(BNE.SINTR605br=SRQpollingsequenceJ MOVE.B SRQBYTE(A5),IOSSAD-1(A3) else move serial poll byte to user's IOPB-INTR605BSRPROCMENU‰continueprocessingmenu BRA INTR700*+*ˆCheckifwehaveanyTaskI/Oreadytogo*8INTR610MOVE.L#READPEND,D3‚setupforI/Opendingcheck0BSRCHECKIOPgolookfortasklevelI/Opending***0***„ByteOut(BO)interruptcheckandprocessing***)INTR700BTST#BOBIT,D5„istheBObitset? BEQ.S INTR800*9BTSTW#CAC_S,BUSACTIV(A5)ƒistheBUSincontrollermode?BEQ.SINTR750br=no*5*‚Acommandstringmightbeinprogress.‚Sendoutthe"*‚nextcommandbytewithATNtrue.*/TST.LCMDCOUNT(A5)‰falseorlastBOinterrupt?(BEQ.SINTR800Žbranchifyes(ignoreit)*5SUB.L#1,CMDCOUNT(A5)†decrementcommandstringcount5BEQ.SINTR730Žbranchiffinishedwithcommandstring4MOVE.LCMDBFPTR(A5),A0…getptrtonextcommandbyte&MOVE.B(A0)+,D1Œgetnextcommandbyte5MOVE.LA0,CMDBFPTR(A5)…updatecommandbufferpointer%BSRCOMCMD‘outputcommandontheBUSBRA.SINTR800Žcontinue*@*ƒCommandprocessingiscompletefornow.Continuewiththenext=*ƒmenuitemafterthecommandoutmenuitemprocessorforthe*ƒcurrentcommand.*1INTR730BSRPROCMENUˆcontinuewithnextmenuitemBRA.SINTR800Žcontinue*!* We are not the active cntroller*8INTR750MOVE.L#WRITPEND,D3‚setupforpendingI/Ocheck.BSRCHECKIOPcheckforpendingtasklevelI/O*** 8***†ServiceRequest(SRQ)interruptcheckandprocessing***BINTR800BTST#SRQBIT,D5ƒisadeviceonourBUSrequestingservice?BEQ.SINTR900„br=no*: BSETW #SRQWAIT,BUSACTIV(A5) indicate SRQ intrp processing3MOVE.LQHEAD(A5),D1‡yes,getcurrentqueuepointer'CMP.LQTAIL(A5),D1ˆisthequeueempty?(BNE.SINTR900Žbranchifno,busisbusy*A*‚SincetheGPIBisidle,initiatetheservicerequestprocessing2*‚todeterminewhichdeviceisrequestingservice.*9*ˆFirstbuildadummyqueueentryforstandardprocessing** MOVEM.L A3-A4/D4-D7,-(A7) save intrp regs SUB.L A3,A3 dummy IOSPB address LEA.L CONFINFO(A5),A4L MOVE.L DVDCBPTR(A4),A4 A4 <= to BUS DCB (serial polling is a BUS operation)* LEA.L SRQBYTE(A5),A0 input buffer pointer,MOVEQ#1,D4‚Statusbyteresponselength=1/ MOVE.L A3,D5 dummy length for secondary buffer2 MOVE.L A0,D6 dummy primary buffer address pointer4 MOVE.L A3,D7 dummy secondary buffer address pointer' BSR PSHGPIBQ go put entry on the queue- MOVEM.L (A7)+,A3-A4/D4-D7 restore intrp regs1 BEQ.S INTR900 br = queue full, process SRQ later&BSRPROCMSRQ‚startuptheSRQprocess***<***ƒRemote/LocalChange(RLC)interruptcheckandprocessing***6INTR900BTST#RLCBIT,D5ƒremote/localchangeinterrupt?BEQ.SINTR1000ƒbranchifno*@MOVE.BADDRSTAT(A1),D1‡D1<==‚currentaddressstateofTMS9914A6AND.W#1<*‚bitmaskandchecktoseeifweevenneedtorespondtothis*‚secondaryaddress.*8LEA.LCONFINFO(A5),A0„A0<==ptrtoconfigurationareas?MOVE.LCNFIGPTR(A0),A0ƒA0<==ptrtoconfigurationareaofBUS*=*‚Readthecommandpassthruregistertoobtainthesecondary*‚addressthatisrequired.*DMOVE.BCMDPTHRU(A1),D2†D2=secondaryaddrcontrollerisrequesting$AND.L#SECMASK,D2‹maskaddressbitsAMOVE.LIOSSAMW(A0),D1‡D1<==maskofvalidsecondarywriteaddrsDBTST#TADS_B,ADDRSTAT(A1)ƒAreweinprimarytalkeraddressedstate?BEQ.SINTR1140ŽBranchifno*@MOVE.LIOSSAMR(A0),D1‡D1<==maskofvalidsecondaryreadaddrs*.INTR1140BTST.LD2,D1ˆvalidsecondaryaddress?BNE.SINTR1150branchifyes*(*‚Thisisnotavalidsecondaryaddress.*?MOVE.B#DACR0,AUXCMD(A1)‚releasehdshk&don'tenterLADS/TADSBRA.SINTR1200ƒcontinue*AINTR1150 MOVE.B #DACR1,AUXCMD(A1) release hdshk & enter TADS/LADS4OR.B#1<BRA.SCKIO040gosendeventtouserabouttypeofpendingI/O*&*ˆTaskI/Oispending,checkformatch.*’onoperationtype&secondaryaddr.ifreq'd*8CKIO010 BTST.B D3,IOPEND(A5) Is it a a matching request?.BEQ.SCKIO030Br=no,abortTaskI/Orequest*C BTST.B #SECONDAR,IOPEND(A5) Is there a secondary address involved?)BEQ.SCKIO050Br=no,gostartthemenu5MOVE.LQTAIL(A5),A0‰getpointertocurrentoperation2MOVE.LIPBQOFST(A0),A0†AO<==I/Oparameterblock9CMP.W#IORSEC,IOSFCT(A0)„Isitasecondaryreadcommand?BEQ.SCKIO015br=yes:CMP.W#IOWSEC,IOSFCT(A0)„Isitssecondarywritecommand?.BNE.SCKIO030br=no,abortpendingtaskI/O*CKIO015 MOVEQ #SECMASK,D1@AND.BIOPEND(A5),D1‰D1=activecontrollerrequestedsec.addr.HCMP.BIOSSAD-1(A0),D1‡isitthesameasrheTask'srequestedsecaddr.?'BEQ.SCKIO050br=yes,startthemenu*.CKIO030BSRHLTCMD‹killthetaskrequestedI/O CKIO050BSETW#BUSIOP,BUSACTIV(A5)ƒsetINTRPlevelI/Opending&BSRPROCMENU‘InitiateI/Oonthemenu* CKIO060 RTS PAGEH**************************************************************************—CANCELPENDINGI/O*;*ˆAneventhasoccurredontheBUSthatforcesustocancel9*ˆanypendingI/Oregardlessofsource.‚Thecauseofthis&*ˆeventwillalsobesenttotheuser.**/*ˆENTER:„A1<==‚baseaddressofGPIBCregisters*’A3<==‚addressofIOSPB*’A4<==‚addressofDCB*’A5<==‚addressofCCB*.*’D5.W<==current9914intrpreg(INTRLEVEL)**’D3.B<==I/Ooperationtype(READ/WRITE)* CANCLIOP:#BSRHLTALL’HaltallI/OontheBUS, MOVE.B #0,IOPEND(A5) cancel any pending I/OHAND.W‚#$FFFF-(1<PROCMENAMOVE.LQTAIL(A5),A6‰A6<==ptrtocurrentqueueentry1BTSTW#HALTED,CSTQOFST(A6)‚wasthismenuHalted?BNEPROCM020br=yesK MOVE.L MENUNPOS(A5),MENUCPOS(A5) update: next item is now the current item6MOVE.LMENUNPOS(A5),A0ƒgetnextmenupositionpointer#MOVE.B(A0)+,D0ƒgetnextmenuitem5MOVE.LA0,MENUNPOS(A5)ƒupdatenextmenuitempointer* *ƒchecktoseeifatendofmenu*CMP.B#END,D0Œendofmenu?BEQ.SPROCM020‹yes* * Initiate I/O on next menu item*;LEA.LMENUCTBL(PC),A0ƒA0<--menufunctioncodejumptable(CMP.B#MENUCLEN,D0‚validfunctioncode?BGTPROCMERB‚branchifno*/AND.W#$FF,D0ƒmasktheoffsetofroutineindex"ASL.W#1,D0…maketablecompatibleAMOVE.W0(A0,D0.W),D0‚relativedistancebetweentableandroutineAMOVEM.LD0/D2-D7/A0-A6,-(A7)‚saveeverythingexceptD1forerror,MOVE.LCCBCHB(A5),A1‚getbaseaddrofGPIBC)JSR0(A0,D0.W)‚initiateI/Oonmenuitem3MOVEM.L(A7)+,D0/D2-D7/A0-A6‚restoreallregisters TST.BD1‚setconditionalreturn2BNE‚PROCMERA‚gotoprocessormenuerrorprocessor*C*…Thesepreviousmenuitemwassuccessfullyinitiated/completed.If;*…themenuitemwasaClassIIorClassIIItype(auxiliary5*…commandorspecialfunctiontype)nointerruptwill9*…begeneratedsocheckthatheretokeepthingsrolling.*5MOVE.LMENUCPOS(A5),A0ƒgetcurrentmenuitempointer/CMPI.B#AUXTYPE,(A0)‚wasitanauxiliarytype?,BGE.SPROCMENA‚yes,continuewithnextitem*:*‚Thefollowingisaspecialcasecheckforthemenuitems9*„DATAXFRTERM/SEOI.Ifeitherprocessorwasperformedin7*„theimagemodeorperformedinformattedmodewithno>*„EORcharactersenabled,thennointerruptwillbegenerated.*;BCLRW#TERMINT,CSTQOFST(A6)ˆareweexpectinganinterrupt?-BNE.SPROCMENA•br=no,gotonextmenuitem*6PROCMRTNMOVEM.L(A7)+,D2-D7/A1-A6‚restoreenvironment RTS  PAGE*>*‚IthasbeendeterminedthatweareattheendofthecurrentB*‚operationmenuitemtableorthisI/OoperationhasbeenHALTED.*8PROCM020BTSTW#SRQPROG,BUSACTIV(A5)‚isSRQinprogress?BNEPROCM200•yes7MOVEQ‚#ISTAOK,D1setoperationcompletionstatustook PROCM050 MOVEQ #0,D0+MOVE.BDCBCDV(A4),D0‚getthedevicenumber1MOVE.WD1,-(A7)ˆsaveoperationcompletionstatus9MOVE.WDEVQBSY(A5),D1‚D1<==currentdevicebusybitmap(BCLRD0,D1clearthatdevice'sbusybit%MOVE.WD1,DEVQBSY(A5)‚updatebitmapMOVE.W(A7)+,D1ˆrestorestatus: BTSTW #HALTED,CSTQOFST(A6) was this operation terminated?BNE.SPROCM055Žbr=yesH BTSTW #SRQFAIL,CSTQOFST(A6) if an SRQ poll, did the device not respond?BEQ.SPROCM060‰br=O.K.*5PROCM055MOVEQ#ISTATO,D1„elsesettimeouterrorcode*2PROCM060 MOVE.B D1,IOSSTA(A3) save status in IOSPB2MOVE.B#XPSNRM,D4ƒD4<==seteventtypetonormalBSRQEVENT‚sendeventtoIOS/BTSTW#SRQWAIT,BUSACTIV(A5)†isanSRQwaiting?BEQ.SPROCM100”no*7*‚Overlaythecurrentcompletedqueueentry(operation)1*‚withdummySRQprocessinginformationpointers.* LEA.L CONFINFO(A5),A1J MOVE.L DVDCBPTR(A1),DCBQOFST(A6) set to DCB of the BUS for SRQ processing'CLR.WCSTQOFST(A6)ŠInitcommandstatus-CLR.LIPBQOFST(A6)ŠcleardummyIOSPBpointer LEA.L SRQBYTE(A5),A16MOVE.LA1,PBPAOFST(A6)†setdummyinputbufferaddress5MOVE.B#1,PBLNOFST(A6)†setdummyinputbufferlength(CLR.LSBPAOFST(A6)Šnosecondarybuffer!'CLR.WSBLNOFST(A6)Šanditslengthis0 BRA.S PROCSRQA  PAGE*3*ˆENTRYPOINTFORSRQPROCESSINGATINTERRUPTLEVEL*?*‚ThereisanSRQrequestwaitingtobehandledsoinitiatethe@*‚statusmenuforthefirstdevicenumberconnectedtothisCCB.=*‚Also,sendanI/Ocompleteeventbackforpreviousfunction%*‚sincewegototherthingstodonow* PROCMSRQ: +MOVEM.LD2-D7/A1-A6,-(A7)…saveenvironment*>PROCSRQAMOVE.LQTAIL(A5),A6ŠA6<==ptrtocurrentqueueentry2BCLRW#SRQWAIT,BUSACTIV(A5)„takeoutofwaitmode8BSETW#SRQPROG,BUSACTIV(A5)„putinSRQinprogressmode3LEA.LCOND_SP(PC),A0‹A0<==serialpollmenutable+MOVE.LA0,MENU(A5)settopofmenupointer=MOVE.BCSPDEVNM(A5),D0‰getdevicenumberoflastserialpoll>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>(BRA.SPROCM227‘initiateI/OonSRQmenu* PAGE$PROCM100BSRPOPGPIBQƒpopGPIBqueue;BEQPROCMRTN‚branchifqueueisempty(nothingelsetodo)*:*‚Setupthenecessarypointersfromthequeueinformation-*‚andthenbuildthemenuforthenewcommand**MOVE.LQTAIL(A5),A6‚getnewqueuepointer3*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *ˆ4/24/84ƒbwn#*ˆSetupregistersbeforebranching?MOVE.LIPBQOFST(A6),A3‚A3<==addressofIOSPBfornewcommand=MOVE.LDCBQOFST(A6),A4‚A4<==addressofDCBfornewcommand*6*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>EBTSTW#HALTED,CSTQOFST(A6)‚wasthiscommandentrypreviouslyhalted?BNEPROCM020ƒbranchifyes2*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *ˆ4/24/84ƒbwn**ƒThesemovesdoneabovenow.*?*MOVE.LIPBQOFST(A6),A3‚A3<==addressofIOSPBfornewcommand=*MOVE.LDCBQOFST(A6),A4‚A4<==addressofDCBfornewcommand*8*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*(BSRGETCMDP…getpointertonextcommand+BNEPROCM020„BR=invalidcommand,discard4BSRVALOPER…validateoperationalmodeandabilities)BNEPROCM020„Error,invalidcmd,discard(BSRBUILDMEN„buildmenufornewcommandBNEPROCM020„Branchiferror&BRAPROCMENA„initiateI/Oonnewmenu**‚SRQProcessingandDetection*7PROCM200 BTSTW #HALTED,CSTQOFST(A6) SRQ polling halted?&BNE.SPROCM300„br=yes,termpolling+MOVE.BSRQBYTE(A5),D1ƒreadthestatusbyte*.BTST#6,D1ƒisthisdevicerequestingservice? BNE.S PROCM400 branch if yes*A*‚Getnextindexdevicenumberofthenextdevicetoserialpoll.?*‚Thetechniqueusedallowswraparoundsothatnodeviceonthe:*‚BUSwillhaveagreaterpriorityofbeingserialpolled.*1PROCM220MOVE.BCSPDEVNM(A5),D0‚getcurrentindex2ADD.B#1,D0ƒbumpbyonetogetnextdevicenumber+CMPI.B#MAXDEVNM+1,D0ƒendofdevicechain?BNE.SPROCM225‚notyet MOVEQ#1,D0‚resettodevice#1*I*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<* *‡10/9/84…SJF*A*‡Wewillinsertcodeinheretoimplementtheconceptoflooping?*‡twicethroughalldevicesonabustolocatethesourceofan=*‡SRQ.‚ThiswasnecessaryduetodevicespulsingtheSRQline1*‡andthenmissingtrueSRQ'sfromotherdevices.*J*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>EPROCM225MOVE.B‚FSPDEVNM(A5),D2…D2<--device#westartedSRQ'swith(AND.Bƒ#$0F,D2Maskouttheloopcounter5CMP.BƒD0,D2HavewereachedthestartingSRQdevice?BNE.SƒPROCM227ŒNotyet7BSET.B‚#7,FSPDEVNM(A5)…Setthepotemtiallapindicator.BNE.SƒPROCM300ŒBranchifwehavelappedtwice*?PROCM227MOVE.LCCBCHB(A5),A1‚A1<--baseGPIBaddressofboard.BTST.B‚#BUSSRQ,BUSSTAT(A1)ƒisSRQstilltrue?1BEQ.SƒPROCM300Žbranchifnot,exitSRQprocesses =*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<* *10/9/84…sjf*+*ˆThiscodewasreplacedbytheabovelogic*L*PROCM225CMP.BFSPDEVNM(A5),D0‚havewedoneacompleteturnaroundtheBUS?**BEQ.SPROCM300ƒyes,wemayhaveproblems*@*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *-*‚Checktoseeifthisdevicenumberisvalid**PROCM240ANDI.L#$FF,D0ƒgetridofgarbage4MOVE.BD0,CSPDEVNM(A5)ƒupdatecurrentdevicenumber /ASL.L#3,D0ƒcalcoffsetintoconfiginfotable5LEA.LCONFINFO(A5),A0ƒbaseaddrofconfiginfotable6MOVE.LDVDCBPTR(A0,D0.L),A4ƒgetpointertodeviceDCBJMOVE.LCNFIGPTR(A0,D0.L),A0ƒgetptrtocurrentdeviceconfigurationblock MOVE.L A0,D0 set cond codes:BEQ.SPROCM220ƒbranchifdevicenotpresentorconfiguredF MOVE.L A4,DCBQOFST(A6) save new DCB pointer at current queue locationCBTSTW#IOASPOC,IOSATW(A0)‚doesdevicehaveserialpollcapability?BEQ.SPROCM220ƒbranchifno*>MOVE.LMENU(A5),MENUNPOS(A5)‚resetstatusmenupointertotopBRAPROCMENAƒinitiateI/O*>PROCM300 BCLRW #SRQPROG,BUSACTIV(A5) clear SRQ in progress bit(BRAPROCM100„continuenormalprocessing*.*ƒFoundadeviceonthebusrequestingservice*5PROCM400MOVEQ‚#SRQTYPE,D0‚seteventtypetoSRQtypeBSRSENDUEVS‚sendevent>*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>* *’10/9/84„sjf*5*ˆThislogicisnowperformedaboveaftereachdevice *ˆisqueried.*-*MOVE.LCCBCHB(A5),A1‚getbaseaddrofGPIBC/*BTST.B#BUSSRQ,BUSSTAT(A1)ƒisSRQstillTRUE?7*BEQ.SPROCM300‚no,cleanupandcontinuenormaloper.*>*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *5*ˆResetthelapindicatorandthefirstdevicepolled5*ˆforthisnextSRQseries.EachtimeanSRQisfound4*ˆwemustlapatleasttwicetocatchdevicesmissed*ˆbytogglingSRQ's.*** MOVEQ #1,D0 set to first device index of configuration blocks*DPROCM520 MOVE.B D0,FSPDEVNM(A5) set start of serial poll index chainABRA.SPROCM227‚startoveragain…***10/9/84sjf‚WASPROCM240*****5*‚ProcessMenuentrypointwhenanerrorhasoccurred#*‚withthereasonfroerrorinD1.B* PROCMERR:+MOVEM.LD2-D7/A1-A6,-(A7)…saveenvironment*>PROCMERAMOVE.LQTAIL(A5),A6ƒA6<==ptrtocurrentqueueentry1 BCLRW #SRQPROG,BUSACTIV(A5) was SRQ in progress?4BEQPROCM050ƒbr=NO,terminateUSERI/Oprocessing-BRAPROCM100ƒelsepopSRQmenuandterminate*:PROCMERBMOVEQ#ISTADRVE,D1‚setdriverrun-timeerrorcode% BRA.S PROCMERA go to error processor 8 TTL GPIB DRIVER - INTERRUPT PROCESSOR (MENU PROCESSORS) PAGEE***********************************************************************’MENUITEMCOMMANDPROCESSES*>*ˆThefollowingroutinesaretheindividualmenuitemroutinesA*…thatwhencombinedmakeupamenuforeachGPIBfunction.TheseE*…menuitemsaredispatchedbythemenuprocessorateitherinterrupt;*…levelorcommandlevel.Allregistershavebeenpreserved?*…beforeenteringexceptforD0andA0whichmayalwaysbeused@*…asworkregisters.Thefollowingregisterdescriptionentryis$*…trueforallmenuitemprocessors:*-*’ENTER:‚A1=BaseAddressofGPIBCregisters%*šA3=AddressofIOSParameterBlock,*šA4=AddressofDeviceControlBlock(DCB)-*šA5=AddressofChannelControlBlock(CCB)1*šA6=AddressofUser'sTaskControlBlock(TCB)* *’EXIT:ƒIfD1=0…THENƒNoerrors*œELSED1=errorcode9*Note:TheINITIOprocessorhassavedallregistersupon)*”entrysoallregistersarefreetouse.*G*********************************************************************** ! TTL CLASS I MENU ITEM PROCESSORS PAGEF************************************************************************ˆCLASSIMENUITEMPROCESSORS*1*’Thisclassofmenuitemsinitiatevarioustypes>*ˆofI/OinbothDMAandnon-DMAmodes.AllclassImenuitems-*ˆwillgenerateaninterruptafterexecution.*F********************************************************************** **ˆPROCESSOR:WriteData*:*ˆPURPOSE:TosetupthewriterequestaccordingtotheIOS0*‘options,setuptheDMAregisters,andthento*‘initiatetheI/O.* WRITDATA: 9 MOVEQ #1<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>& MOVE.B D2,UNICMD(A1) initiate the I/O*3WRITD025MOVEQ‚#ISTAOK,D1setreturnstatustoO.K.*WRITDRTNRTS…exitwritedata*<*ˆSpecialprocessingforDMAtransferofonly1byte(either&*ˆdataorterminationchar.sequence).*HWRITD030 BSETW #TERMINT,CSTQOFST(A6) let PROCMENU know no intrp expected‰BRA.SWRITD025Žtakegoodexit**‚WriteFormattedMode;*ˆSinceDMAwriterequestsaretransfereddirectlyfromthe;*ˆusersbuffer,andWriteFormattedEORcharacteristics(if8*ˆenabled)willbesentoutbytheterminationprocessor'*ˆuponcompletionofthisDMAtransfer.*>WRITDFMTMOVE.BWEORFMT(A2),D1‚getEORreqforWriteFormatted2BTST.L#FIXTERM,D1‚fixedlengthtransferenabled?BEQ.SWRITD060„branchifnoF MOVE.W IOSFBWF(A2),D0 yes change transfer length to fixed requirement*G*ƒIfanyoftheCR,LF,orEOScharactersareenabled,EOI(ifenabled);*ƒmustbeheldoffforthistransferandtransmittedbythe*ƒterminationprocessor.*WRITD060 MOVE.B D1,D37 AND.B #1<*„terminateonthehighestpriorityterminatorwithEOShaving:*„thehighestpriorityfollowedbyLFandCRrespectively.*0READ115MOVEQ#0,D2ŠclearDMAoperationregister#BTST.L#EOSTERM,D1ŠisEOSenabled?BEQ.SREADD060branchifno; MOVE.B IOSEOSR(A2),EOSCOMP(A1) yes, set EOS read character+BRA.SREADD080andbypassCR/LFEOSchecks)READD060BTST.L#LFTERM,D1‚isLFenabled?BEQ.SREADD070branchifno1MOVE.B#LF,EOSCOMP(A1)…yes,setLFasterminator'BRA.SREADD080andbypassCREOScheck)READD070BTST.L#CRTERM,D1ƒisCRenabled?6*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *ˆ4/24/84ƒbwn*=*ˆFixsothatreadwillterminateonfixedlengthdatainput. *ˆInsertedREADD090labelbelow.**BEQ.SREADD020branchifno BEQ.S READD090*?*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>1MOVE.B#CR,EOSCOMP(A1)…yes,setCRasterminator@READD080BSET.L#EOSBIT,D2‚enableEOSdetectionforDMAtransfer2READD090BTST.L#FIXTERM,D1‰fixedlengthtransfer?BEQ.SREADD020branchifno1TST.WD3“diduserreallyspecifyafixedlength?3BEQ.SREADD020br=no,useIOSPBspecifiedlength;CMP.WD0,D3‘compareuser'srealbufferlengthtoDEVICE'S!8BGE.SREADD011Žbr=user'sbuffersize.GE.todevice's4MOVEQ‚#ISTAADD,D1Šbr=hisbufferisnotbigenoughBRA.SREADDRTNŽabort*BREADD011MOVE.WD3,D0ˆsetupDMAfordevice'sfixedlengthrecord!4READD020:BSRSETUPDMA†setupDMAbytecountandMAR+MOVE.B#LON1,AUXCMD(A1)…setupListenmode .BSET.L#DMAWRITE,D2ˆenableDMAwritecommmand6BCLRW#BIBIT,TMSMASK(A5)ƒdisableBIinterruptsonDMA7MOVE.WTMSMASK(A5),D1†resetinterruptmaskonTMS9914A MOVEP.W D1,INTR0(A1)*MOVE.B#GTS,AUXCMD(A1)…lowertheATNlineB*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<* *ˆ4/24/84ƒbwn*9*ˆMustinhibitTMS9914A‚interrupts‚duringDMAoperations.*2BCLR.B#VBIMENAB,CONTREG0(A1)‚disable9914intrps*?*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>&MOVE.BD2,UNICMD(A1)‡initiatetheI/O+MOVEQ‚#ISTAOK,D1ŠsetreturnstatustoO.K.READDRTNRTSexitreaddata PAGE(*ˆPROCESSOR:SendTerminationCharacters*6*ˆPURPOSE:ThisprocessorwillsendtheEORcharacters,*‘inDMAmodetocompletethepreviouswrite*‘formattedtransfer.* SENDTERM:%MOVE.WIOSOPT(A3),D1‚getIOSoptions.AND.W#IOPIMG,D1‚datatransferinimagemode?>BNE.SSENDTRM9ƒbranchifyes(noEOScharactersinthismode)*3BSRGETCNFIGƒgetptrtocurrentconfigurationdataB MOVE.B WEORFMT(A0),D1 get EOR characteristics for Write Formatted$ MOVE.B IOSEOSW(A0),D2 get EOS char.7LEA.LTERMBUF(A5),A0‚A0<==terminationbufferpointer*?*ƒOnceagain,justasinthereadprocessor,theEORcharacters8*ƒmaybemultiplysetandaresoftwarepriorityencoded.>*ƒIfenabled,theCRcharacterwillbesentoutfirstfollowed1*ƒbytheLFcharacterandthentheEOScharacter.** MOVEQ #0,D0 reset EOS string byte counter+BTST.L#CRTERM,D1ƒisCRcharacterenabled?BEQ.SSENDTRM2„branchifno0MOVE.B#CR,(A0)+‚storeCRinterminationbufferADDQ.L#1,D0ˆbumpbytecount*3SENDTRM2BTST.L#LFTERM,D1ƒisLFcharacterenabled?BEQ.SSENDTRM4„branchifno?MOVE.B#LF,(A0)+‚yes,storeLFcharacterinterminationbufferADDQ.L#1,D0ˆbumpbytecount*;SENDTRM4BTST.L#EOSTERM,D1‚iswriteEOScharacterenabled?BEQ.SSENDTRM8„branchifno:MOVE.BD2,(A0)+ƒstoreEOScharacterinterminationbufferADDQ.L#1,D0ˆbumpcount*1SENDTRM5 MOVEQ #0,D2 initialize DMA transfer type SUB.LD0,A0‡setstartofbuffer*0*ˆSetupfordataxfer:‰A0<--terminatorstring*¦D0=ƒstringlength*¦D1=ƒEORoptions*¦D2=ƒDMAcommand*,BRAWRITD010†dotheterminatorstringwrite*(SENDTRM8TST.LD0‚anyEOSchar.tosend? BNE.S SENDTRM5*?SENDTRM9 BSETW #TERMINT,CSTQOFST(A6) set no interrupt expected!+MOVEQ‚#ISTAOK,D1setreturnstatustoO.K.)RTS„exitterminationcharacterprocessor  PAGE***ˆPROCESSOR:SendEOI*<*ˆPURPOSE:ƒSendsthelastcharacterofadata(OUT)transfer3*“withtheEOIlineTrue(usesTMS9914EOIcontrol)**SENDEOI:)BSRGETCNFIGgetpointertoconfig.data2MOVE.BWEORFMT(A0),D1‡getWriteFormattedoptions MOVE.W IOSOPT(A3),D0.AND.W#IOPIMG,D0ŒwasdataxferinImagemode?.BEQ.SSENDEOI2Žbr=NO,useFormattedoptions*.MOVE.BWEORIMG(A0),D1‡getWriteImageoptions*ASENDEOI2BTST#EOITERM,D1„doweneedtosendlastchar.withEOI?BEQ.SSENDEOI4Žbr=no,exit*-*ƒSendthelastdatabyteofthestring(DMA)*BMOVE.B#FEOI,AUXCMD(A1)…setTMS9914tosendEOIcoincidentw/data;MOVE.B#$FE,BCNTLSB(A1)…setupBCRto1'scompl.of1byteFMOVE.B#$FF,BCNTMSB(A1)…THEMARISSTILLSETFROMPREVIOUSXFER!!!!!!#MOVEQ#0,D2‘setupfordataoutput(BRAWRITD022godotheoutputoperation*LSENDEOI4 BSETW #TERMINT,CSTQOFST(A6) set no intrp expected flag for PROCMENU>BTSTW#CAC_S,BUSACTIV(A5)ƒNomoreoutputistotakeplace,so?BEQ.SSENDEOI5ŽifweareaController,takecontroloftheBUSHMOVE.B#TCA,AUXCMD(A1)†NOW!causeitwon'tbedoneatnormalintrptime*SENDEOI5 MOVEQ #ISTAOK,D1 RTS ‰PAGE*ˆPROCESSOR:Untalk‚(UNT)*:*ˆPURPOSE:TosendtheuniversalUNTALKcommandoutonthe*‘BUSwiththeATNlinetrue.*SENDUNT:&MOVE.B#UNT_CMD,D1‚setUntalkcommand!BRACOMOUT…sendoutcommandbyte **ˆPROCESSOR:Unlisten‚(UNL)*<*ˆPURPOSE:TosendtheuniversalUNLISTENcommandoutonthe *‘BUSwiththeATNlinetrue.*SENDUNL:(MOVE.B#UNL_CMD,D1‚setUnlistencommand!BRACOMOUT…sendoutcommandbyte *'*ˆPROCESSOR:ListenAddressGroup(LAG)*;*ˆPURPOSE:Tosendtheprimarylistenaddressofthedevice1*‘specifiedintheLUNparameteroftheIOSPBout#*‘ontheBUSwiththeATNlinetrue*SENDLAG:3BSRGETPADDR‚gettheprimaryaddressofthedevice/OR.B#$20,D1ˆconverttoprimarylistenaddress!BRACOMOUT…sendoutcommandbyte *%*ˆPROCESSOR:OtherTalkAddress(OTA)*9*ˆPURPOSE:Tosendtheprimarytalkaddressofthedevice1*‘specifiedintheLUNparameteroftheIOSPBout#*‘ontheBUSwiththeATNlinetrue*SENDOTA:K MOVE.B #TON0,AUXCMD(A1) UNTALK the GPIB, send aux command talk only (cs=0)3BSRGETPADDR‚gettheprimaryaddressofthedevice-OR.B#$40,D1ƒconverttoprimarytalkaddress!BRACOMOUT…sendoutcommandbyte ***ˆPROCESSOR:OtherSecondaryAddress(OSA)*9*ˆPURPOSE:Tosendthesecondaryaddressspecifiedinthe.*‘secondaryaddressparameteroftheIOSPBout$*‘ontheBUSwiththeATNlinetrue.*SENDOSA:5MOVE.BIOSSAD-1(A3),D1‚getdesiredsecondaryaddress AND.B#$1F,D1ƒmaskaddressbits8 OR.B #PPE_CMD,D1 set into secondary address group range!BRACOMOUT…sendoutcommandbyte *,*ˆPROCESSOR:ParallelPollUnconfigure(PPU)*:*ˆPURPOSE:Tosendtheuniversalparallelpollunconfigure1*‘commandoutontheBUSwiththeATNlinetrue.t*SENDPPU:ILEA.LCONFINFO(A5),A0‚A0<==startofconfigurationareaforalldevices*;*‚ResetthecurrentparallelpollconfigurationoftheBUS.*0MOVE.LCNFIGPTR(A0),A2‚A2<==cnfigptrforBUS6BSET.B#PPIS,IOSPOLC(A2)‚setParallelPollIdleState> MOVE.B #0,PARLPOLL(A1) clear the GPIBC parallel poll register#MOVE.B#PPU_CMD,D1‚setPPUcommand+BRACOMOUTƒsendthecommandoutontheBUS *'*ˆPROCESSOR:ParallelPollEnable(PPE)*:*ˆPURPOSE:Tosendparallelpollconfigurationinformation3*‘(PPPandSbitssetupinPPEparameterofIOSPB)*‘outontheBUS.*SENDPPE:1MOVE.BIOSSAD-1(A3),D1‚getPPconfigurationinfo"AND.B#$0F,D1†maskPPPandSbits*8*‚Settheparallelpollconfigurationregistertoactive *ˆandsetthenewconfiguration.*9BSRGETCNFIGƒA0<==ptrtoconfigurationareafordevice8MOVE.BD1,IOSPOLC(A0)‚saveindeviceconfigurationarea*3OR.B#PPE_CMD,D1„encodebitstomakeaPPEcommand+BRACOMOUT…sendoutcommandbytetodevice ***ˆPROCESSOR:ParallelPollConfigure(PPC)*8*ˆPURPOSE:Tosendtheuniversalparallelpollconfigure0*‘commandoutontheBUSwiththeATNlinetrue.*SENDPPC:*MOVE.B#PPC_CMD,D1‚setupthePPCcommand!BRACOMOUT…sendoutcommandbyte *(*ˆPROCESSOR:ParallelPollDisable(PPD)*6*ˆPURPOSE:Tosendtheuniversalparallelpolldisable0*‘commandoutontheBUSwiththeATNlinetrue.*SENDPPD:*MOVE.B#PPD_CMD,D1‚setupthePPDcommand!BRACOMOUT…sendoutcommandbyte *%*ˆPROCESSOR:SerialPollEnable(SPE)*3*ˆPURPOSE:Tosendtheuniversalserialpollenable0*‘commandoutontheBUSwiththeATNlinetrue.*SENDSPE:*MOVE.B#SPE_CMD,D1‚setuptheSPEcommand!BRACOMOUT…sendoutcommandbyte *&*ˆPROCESSOR:SerialPollDisable(SPD)*4*ˆPURPOSE:Tosendtheuniversalserialpolldisable0*‘commandoutontheBUSwiththeATNlinetrue.*SENDSPD:*MOVE.B#SPD_CMD,D1‚setuptheSPDcommand!BRACOMOUT…sendoutcommandbyte *$*ˆPROCESSOR:ClearAllDevices(DCL)*5*ˆPURPOSE:Tosendtheuniversaldeviceclearcommand(*‘outontheBUSwiththeATNlinetrue.*SENDDCL:*MOVE.B#DCL_CMD,D1‚setuptheDCLcommand!BRACOMOUT…sendoutcommandbyte * *ˆPROCESSOR:LocalLockout(LLO)*6*ˆPURPOSE:Tosendtheuniversallocallockoutcommand(*‘outontheBUSwiththeATNlinetrue.*SENDLLO:*MOVE.B#LLO_CMD,D1‚setuptheLLOcommand!BRACOMOUT…sendoutcommandbyte **ˆPROCESSOR:TakeControl(TCT)* 5*ˆPURPOSE:Tosendtheaddressedtakecontrolcommand(*‘outontheBUSwiththeATNlinetrue.*SENDTCT:*MOVE.B#TCT_CMD,D1‚setuptheTCTcommand!BRACOMOUT…sendoutcommandbyte *)*ˆPROCESSOR:SelectiveDeviceClear(SDC)*7*ˆPURPOSE:Tosendtheaddressedselectivedeviceclear/*‘commandoutontheBUSwiththeATNlinetrue*‘toallcurrentlisteners.*SENDSDC:*MOVE.B#SDC_CMD,D1‚setuptheSDCcommand!BRACOMOUT…sendoutcommandbyte **ˆPROCESSOR:GoToLocal(GTL)*4*ˆPURPOSE:Tosendtheuniversalgotolocalcommand(*‘outontheBUSwiththeATNlinetrue.*SENDGTL:*MOVE.B#GTL_CMD,D1‚setuptheGTLcommand!BRACOMOUT…sendoutcommandbyte *(*ˆPROCESSOR:GroupExecuteTrigger(GET)*6*ˆPURPOSE:Tosendtheuniversalgroupexecutetrigger0*‘commandoutontheBUSwiththeATNlinetrue.*SENDGET:*MOVE.B#GET_CMD,D1‚setuptheGETcommand!BRACOMOUT…sendoutcommandbyte *)*ˆPROCESSOR:ReadSerialPollstatusbyte*0*ˆPURPOSE:ThisprocessorispartoftheCOND_SP)*‘(ConductSerialPoll)menu.Itspurpose+*‘istosetupforByte-Ininterrupt‚toget!*‘thestatusbytedesireddevice.*READSP:)BSRMTFIFO’cleartheFIFO(VME-300bug!)3MOVEM.LD0-D7/A0-A6,-(A7)ƒsaveregsonTrap0call1LEASP_TO(PC),A0ŒsetPATforserialpolltimeout"MOVE.L#1000,A1waitfor1second MOVEQ #0,D1EMOVE.BCCBISR(A5),D1ˆgetintrplevelfromhighbyteofCCBS.R.wordAND.B#$0F,D1maskoffgarbage)MOVE.LA5,D2setCCBaddressasPATI.D.TR0$.RQPA,‘starttimerBRA.SREADSP1br=timergoing*$ KILL.DRIVER M300INT_ID,T0RQPA,A5,A4 !READSP1 MOVEM.L (A7)+,D0-D7/A0-A6/ BSETW #SPTIMER,BUSACTIV(A5) mark timer running4MOVE.B#LON1,AUXCMD(A1)…setuptoreadSPdatabyte3MOVE.B#GTS,AUXCMD(A1)†DropATNtolethimsendit#MOVEQ#ISTAOK,D1Œsetreturnstatus RTS  PAGE .*ˆSerialPollReadStatusByteTimeoutRoutine*=*ˆIfauserhasrequestedtheserialpollfunction,atimeout=*ˆerrorstatuswillbereturned.‚Elseifthetimeoutoccurred;*ˆasaresultofthedriverpollingadeviceinresponseto<*ˆanSRQinterrupt,theSerialPollstatusbyte(intheCCB)<*ˆwillbesettozeroandthecurrentdevicewillbeskipped*ˆinthepollingsequence.*+SP_TO:ƒMOVEM.LA3-A5,-(A7)‹saveimmed.regs‰MOVE.LD1,A5’setCCBpointer‰MOVE.LQTAIL(A5),A07‰CMPA.LQHEAD(A5),A0‹isthereanoperationinprogress?/‰BEQ.SSP_TO2’br=no,musthavebeencancelled9‰BCLRW#SPTIMER,BUSACTIV(A5)ƒwastimeralreadycancelled?‰BEQ.SSP_TO2’br=yes,ignore*1*ˆSetupregisterstolooklikeVME-300interrupt*"‰MOVE.LDCBQOFST(A0),A4ˆA4<--DCB#‰MOVE.LIPBQOFST(A0),A3ˆA3<--IOPB+‰MOVE.LCCBCHB(A5),A1ŠA1=hardwareaddress<‰MOVE.B#TCS,AUXCMD(A1)ˆtakecontrolofBUSnow,sincethere)‰MOVE.BDATAIO(A1),D1Šisnointrpcoming!)‰BTSTW#SRQPROG,BUSACTIV(A5)ƒSRQpolling?‰BNE.SSP_TO1’br=no,userI/O;‰BSETW#SRQFAIL,CSTQOFST(A0)ƒmarkSRQpollresponsefailure*SP_TO1ƒCLR.BSRQBYTE(A5)resetstatusbyte3‰BSRPROCMENU’andprocessasnormalstatusresponse'SP_TO2ƒMOVEM.L(A7)+,A3-A5‹restoreregs‰RTE*?*ˆRoutinetocancel‚thecurrentlyrunningSerialPollI/Otimer* KILLSPTO:5‰BCLRW#SPTIMER,BUSACTIV(A5)ƒcleartimerrunningflag3‰MOVEM.LD0-D7/A0-A6,-(A7)…saveregsonTrap0call.‰LEASP_TO(PC),A0Žsetupparmstocanceltimer‰SUBA.LA1,A1’interval‰MOVE.LA5,D2’setCCBI.D.1‰MOVE.BCCBISR(A5),D1Šgetintrplevelforrequest#‰AND.L#$0F,D1‘clearexcessgarbage(‰OR.L#$8000,D1options=cancelrequest‰TR0$.RQPA,“gocancel$‰BRA.SKILLSP1‘br=requestaccepted$‰KILL.DRIVERM300INT_ID,T0RQPA,A5,A4*.KILLSP1‚MOVEM.L(A7)+,D0-D7/A0-A6…restoreregs‰RTS  PAGE*1*ˆPROCESSOR:SendAuxiliaryCommandBufferString*4*ˆPURPOSE:Thisgeneralprocessorwillsimplyoutput-*‘whateverisintheusersauxiliarycommand+*‘stringbufferoutontheBUSwiththeATN *‘linetrue.* SENDAUXS:8BSRGETXFRAD‹getphysicalI/Oaddressforthisfunction ,MOVE.LD6,A0‹A0<==startingbufferaddress1 MOVE.L D5,CMDCOUNT(A5) set command string length+MOVE.B(A0)+,D1Špreloadfirstcommandbyte?MOVE.LA0,CMDBFPTR(A5)‚setcommandbufferpointertonextbyteBRACOMCMDsendcommand  " TTL CLASS I MENU ITEM SUBROUTINES PAGE**‚TLPROC*&*ˆTALKER/LISTENERWRITE/READPROCESSOR*6*ˆThepurposeofthisroutineistodetermineifitis9*ˆO.K.toinitiatethecurrentRead/Writecommandatthis1*ˆtime.‚Ifnot,thecurrentoperationwillsetup%*ˆaTasklevelI/Ooperationpending.*.*’ENTER:‚D0.B=‚typeofoperation-Read/Write#*šA1=baseaddrofGPIBCregisters'*šA3=addressofIOCBforthisrequest*šA5=addressofCCB*:*’EXIT:‚IFCCthenO.K.toinitiateI/O(D0.b=don'care)*™ELSE(IFCSANDD1=0)2*œTHEN‚taskwaitingforcontrollertomakerequest$*™ELSE(IFCSANDD1.B=errorcode)*œTHENcommandisaborted* *’RegisterUsageƒ01234567 *¡D*R***¡A*TLPROC:5BTSTW#CAC_S,BUSACTIV(A5)„isBUSincontrollermode?+BNE.STLP20‘br=yes,O.K.toinitiateI/O*=BTSTW#BUSIOP,BUSACTIV(A5)ƒisthereINTRPlevelI/Opending?6BNE.STLP10‘br=yes,gocheckformatchingoperation*6MOVE.BD0,IOPEND(A5)ˆelsemarkTasklevelI/OpendingDMOVE.LMENUCPOS(A5),MENUNPOS(A5)‚backupmenupointertore-execute(MOVEQ#ISTAOK,D1Œsetreturncode=O.K. BRA.STLP40‘andexitwithC=1*>TLP10MOVE.BIOPEND(A5),D2ƒD2=INTRPlevelI/Opendingstatus MOVE.B D0,D11AND.BD2,D1‘D1=INTRP^TASKI/Opendingstatus1BEQ.STLP30‘br=operationtypemismatch-error*/BTST#SECONDAR,D2‹secondaryaddressoperation?*BEQ.STLP20‘br=no,O.K.toinitiateI/O* MOVEQ #SECMASK,D3 MOVE.B IOSSAD-1(A3),D1-AND.BD3,D1‘D1=taskrequestedsec.address0AND.BD2,D3‘D3=INTRPlevelpendingsec.addr.CMP.BD1,D3‘aretheythesame?4BNE.STLP30‘br=no,gokilltaskrequestedcommand*,TLP20BSRMTFIFOO.K.toinit.I/O!LET'SGO'BNE.STLP40‘oops,hardwaremalfunction*6CLR.BIOPEND(A5)ŒclearINTRPlevelI/Opendingstatus/BCLRW#BUSIOP,BUSACTIV(A5)ƒandassociatedflag&MOVEQ#ISTAOK,D1ŒsetreturncodeO.K.ANDI#$FE,CCRclearCarrybit RTS*'TLP30MOVEQ#ISTAIRPI,D1…seterrorcode* TLP40ORI#$01,CCR‹setCarrybit RTS  PAGE* *ƒSETUPDMA*>*‡ThisroutineisusedbytheREADDATA,WRITDATA,andSENDTERM<*„processorstosetupthememoryaddressregister(MAR)andA*„thebytecountregister(BCR)ontheMVME300card.Thesesimply8*„setuptheDMAtransferregistersbutinitiatenoI/O.*-*ˆENTER:‚A1=baseaddressofGPIBCregisters,*A0=bufferaddresstoread/writeto/from."*D0=numberofbytestotransfer*!*ˆRegisterUsage:†01234567*šD‚P*šA‚P* SETUPDMA: MOVE.L D0,-(A7).NOT.WD0…convertbytecountto1'scompliment-MOVE.BD0,BCNTLSB(A1)‚saveLSBofbytecount LSR.W#8,D0‡getnexteigthbits-MOVE.BD0,BCNTMSB(A1)‚saveMSBofbytecount*#MOVE.LA0,D0†D0<==bufferaddressB*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *ˆ4/24/84ƒbwn*8*ˆTheaddresswegetinD0istheaddressasseenbythe *ˆdriver.4*ˆIfweareusingdualportedram‚ontheVME/10,and5*ˆifthisaddressisinon-boardram,thenitmustbe;*ˆtranslatedtoanon-boardaddressastheMVME300seesit.1*ˆWedothisbyaddingtheRAM_SKEWoffsettothe%*ˆaddress,usingtheGO_OFF_BDmacro.* ‰GO_OFF_BDD0*>*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>%MOVE.BD0,MARLSB(A1)‚saveLSBofMAR LSR.L#8,D0„getnexteightbits%MOVE.BD0,MARISB(A1)‚saveISBofMAR LSR.L#8,D0„getnexteightbits%MOVE.BD0,MARMSB(A1)‚saveMSBofMAR MOVE.L (A7)+,D0 RTS…exit PAGE**‚COMOUT*7*ˆSincecommandsbytes(ATN=true)cannotbesentout=*„inDMAmode,thisprocessorwillsendoutabyteatatime.'*„ItassumesthattheATNlineistrue.*-*ˆENTER:„A1=baseaddressofGPIBCregisters*’A5=addressofCCB *’D1.B=commandbytetobesent*  ' ED!<):189:A-I5Q4Y.a1iJqMy?:‰/‘2™:¡=©=±6¹EÁ6É!*ˆRegisterUsage:„01234567*˜D„P‡P*˜A„P*COMOUT:FMOVE.L#1,CMDCOUNT(A5)ƒsetcommandcountto1forinterruptprocessor*C*‚EntryPointusedbytheCommandOut/DataOutandtheCommandOut/*‚DataInprocessors**ƒspaceintheCCBfornewblockandstoringnewconfiguration=*ƒinformation.‚Inactuality,thespaceforallconfigurations<*ƒattachedtothisCCBhavealreadybeenallocatedanditis+*ƒjustamatterofadjustingsomepointers.=*‡SinceIOIisinitiatingthiscall,A1looksliketheuser's?*ƒbufferbutisreallyapointertothedefaultconfigurationof *ƒtheDCB.;*‡TheBUSactivityflag(BUSACTV)issetupatthistimeto$*ƒindicateitsinitialstartupmode.*+MOVE.LA2,-(A7)‚saveaddressofGPIBCregs6LEA.LCONFINFO(A5),A2‚configuration/DCBpointertable MOVEQ #0,D0'MOVE.BDCBCDV(A4),D0‚getdevicenumber"ASL.L#3,D0‡calculatetableindex@MOVE.LNEXTCNFG(A5),A0‚A0<==nextavailableconfigurationarea=MOVE.LA0,CNFIGPTR(A2,D0.L)‚setconfigurationptrfordevice3MOVE.LA4,DVDCBPTR(A2,D0.L)„setDCBptrfordevice*I*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*8*ˆ10/16/84‚SETSERVICEREQUESTWAITINGFLAGTOCATCHANY2*’SRQ'SPENDINGONTHEBUSATTIMEOFBOOT/STARTUP6*’SINCETHATSRQINTERRUPTWILLBELOSTINTHETMS9914$*’ATTIMEOFCHANNELINITIALIZATION.*‰BSETW…#SRQWAIT,BUSACTIV(A5)*I*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>JMOVE.WIOSVARL+DCBDEV(A4),D0„D0<==lengthofvariableconfigurationarea BTST#0,D0…oddnumberofbytes?BEQ.SCDEVA„branch  ifnoBADDQ#1,D0…allocateinevenbyamountsforaddressingconsistency*KCDEVALEA.LIOSILN(A0,D0.W),A2‚calculatetotallengthofconfigurationareaDMOVE.LA2,NEXTCNFG(A5)ƒupdatenextavailableconfigurationareaptr.MOVE.L(A7)+,A2‚restoreaddressofGPIBCregs*?*ƒThenextcheckwilldetermineiftheGPIBisbeingconfigured4*ƒwithsystemcontrollercapabilities.‚Ifthisisso=*ƒthenthebusinterfacewilltakecontroloftheBUSatthis?*ƒpoint.‚OtherwiseitsmodewillbesetaccordingtothedeviceB*ƒattributesword(IOSATW)passedintheconfigurationdatablock.E*ƒIftheBUSisconfiguredforTalker/Listeneronly,NOOTHERDEVICESI*ƒWILLBEALLOWEDTOBECONFIGUREDATSYSTEMINTIALIZATIONTIME.‚AttemptsG*ƒtoaccessthesedevicesatalatertimewillcauseaDEVICENOTREADY(*ƒerrorconditiontobereturnedbyIOS.*&TST.BDCBCDV(A4)”configuringtheBUS?BNE.SCOMNCNFG”branchifno MOVE.L A1,-(A7)9BSRRESETIO—correctforintrpstoanun-attachedchannel MOVE.L (A7)+,A1ABTSTW#IOASCTC,IOSATW(A1)‰isBUSbeingconfig.withS.C.capab?BEQ.SCOMNCNFG•branchifno*2*ˆElsetestinterfaceforcompatibleconfiguration*:*ˆNOTE!!!‚Thedevicewillbestrippedofsystemcontroller8*ˆcapabilitieswithoutnotifyingthecalleronthefirst9*ˆtimeconfigurationonly.Thisallowsasuccessfulfirst:*ˆtimeconfigurationandwillnotmarkthisdeviceOFFLINE*ˆuponreturn.*.TST.BADDRREG(A2)‘isMVME300cardinSCmode?BPL.SCDEVB—branchifyes9BCLRW#IOASCTC,IOSATW(A1)‰donotallowS.C.capabilities BRA.S COMNCNFG*>*ˆSoftware&hardwareS.C.configurationsagree,TAKECONTROL!*CDEVB MOVE.L A1,-(A7)#MOVE.LA2,A1•setupA1forSENDIFC&BSRSENDIFC–TakecontrolofBUS,NOW! MOVE.L (A7)+,A1*/*‚Continuewithnormalconfigurationprocessing*"*ˆCheckforunsupportedattributes*MCOMNCNFGMOVE.W#CECUAP,D2ƒpreloadunsupportedattribute/parametererrorcode*3MOVE.W#NVALBATM,D0ƒgetmaskofinvalidattributes8AND.WIOSATM(A1),D0ƒtryingtochangeinvalidattribute?"BNECNFGERR†branchifyes(error)*1MOVE.W#NVALBPRM,D0‚getmaskofvalidparameters8AND.WIOSPRM(A1),D0‚tryingtochangeinvalidparameter?"BNECNFGERR…branchifyes(error)*9*‚Settheattributesintotheuser'sconfigurationbuffer"*‚thathedoesnotwanttochange.*0MOVE.WIOSATM(A1),D0‚D0<==hisattributesmask;AND.WD0,IOSATW(A1)ƒZeroouttheattributesofhisthathe9NOT.WD0Ždoesn'twanttochange,zeroouttheattributes=AND.WIOSATW(A0),D0ƒofminethathedoeswanttochange,and.OR.WD0,IOSATW(A1)„combinetheminhisspace.* *‚Dothesamefortheparameters*3COMN010MOVEQ#0,D0ƒbesureupper16bitsareclearKMOVE.WIOSPRM(A1),D0‚D0<==maskofparametersthathedoeswanttochange7MOVEM.LA0-A2,-(A7)„saveconfigurationblockaddresses4LEA.LIOSREC(A0),A0„A0<==addrof1stparaminCCB@LEA.LIOSREC(A1),A1„A1<==addrof1stparaminuserdatablock2LEA.LPAR_SIZ,A2…A2<==addroftableparamsizes*NXTPARM MOVEQ #0,D11MOVE.B(A2)+,D1‚get#ofbytesinnextparameter%BEQ.SCHKPARM„branchifendoftable*+LSR.W#1,D0…wanttochangenextparameter?BCS.SINCPARMƒbranchifyesASUBQ#1,D1†doesnotwanttochangeitsomoveparameterfromCCB2*totheuser'sbuffersothathewillhaveacopy)MOVPARMMOVE.B(A0)+,(A1)+‚movenextbyte)DBRAD1,MOVPARMƒuntilbytecountexpires'BRA.SNXTPARMƒcheckthenextparameter*?INCPARMADD.LD1,A0‚hedoeswanttochangeitsoleavehiscopy4ADD.LD1,A1‰aloneandjustgotothenextparameter BRA NXTPARM*>*ƒChecktoseeifhe'sdoinganyconfigurationthatisillegal*:CHKPARMMOVEM.L(A7)+,A0-A2‚restoreconfigurationpointers=MOVE.W#CECIPA,D2‚preloadinvalidprimaryaddresserrorcode*2MOVE.BIOSPRMA(A1),D0‚getcurrentprimaryaddress0CMP.B#$1E,D0…valid?(MUSTBE0<=ADDR.<=$1E)BHICNFGERR…branch=‚error*"TST.BDCBCDV(A4)‚isthisthebus?BNE.SCHKPRM2…branchifno*=*‚Chec  ktoseeiftheprimaryaddressconfiguredmatcheswhat-*‚issetontheswitchesoftheMVME300card.*CMOVE.BADDRREG(A2),D1ƒD1<==primaryaddrreadfromboardswitches+NOT.BD1‰usecomplementofswitchregister AND.B#$1F,D1„maskprimaryaddr?CMP.B#$1F,D1„isswitchregister=$1F(INVALIDGPIBADDRESS!)CBNE.SCHKPRM1„BR=no,usehardwareswitchregisterasBUSaddress)MOVE.BD0,D1…elseuseSYSGENBUSaddress*@CHKPRM1MOVE.BD1,ADDRREG(A2)‚setTMS9914Aprimaryaddrregister, MOVE.B D1,IOSPRMA(A1) update config. buffer9BTSTW#IOSPOLCB,IOSPRM(A1)‚localppconfiguringthebus?BEQ.SCHKPRM2ƒbranchifno*=MOVE.BIOSPOLC(A1),D0‚D0<==newparallelpollconfiguration/BMI.SCHKPRM2ƒbr=noconfigurationsetforPP;AND.B#$1F,D0ƒmaskPPP,SandIbits,BUSisinPPSSstate+MOVE.BD0,IOSPOLC(A1)‚saveinusersbuffer+BSRSETPPREG‚setupparallelpollregister*JCHKPRM2ANDI.L#$7FFFFFFF,IOSSAMR(A1)ƒmaskoutbit31ofboththeReadand*‚Theonlythingthatremainsnowissec.addr.validationandD*‚toupdatetheTMS9914AinterruptmaskregistertoenablesecondaryI*‚addressingifvalidsecondaryaddresseswerenewlydefinedfortheBUS.*8OKCNFGTST.LIOSSAMR(A1)‚anysec.Readaddr'sspecified?SNED0“D0=Yes/No3TST.LIOSSAMW(A1)ˆanysec.Writeaddr'sspecified?SNED1“D1=Yes/No$MOVEQ#CECSADR,D2ˆpreseterrorcode$EOR.BD0,D1ŽBothmustbespecified! BNECNFGERRŽelseitisanerror*" TST.B DCBCDV(A4) is this the BUS? BNE.S OKCNFG3 br = noBMOVE.WTMSMASK(A5),D0‚setthecurrentstateofthe9914Amaskreg5 BSET #APTBIT,D0 set up to enable secondary adressing0 TST.L IOSSAMR(A1) any sec read addresses valid?BNE.SOKCNFG2ƒbranchifyes:BCLR#APTBIT,D0ƒelsedisablesecondaryaddressinterrupts5OKCNFG2MOVE.WD0,TMSMASK(A5)‚saveinmaskstatusreg8 MOVEP.W D0,INTR0(A2) update TMS9914A interrupt mask reg*OKCNFG3 MOVEQ #0,D0FMOVE.WIOSVARL+DCBDEV(A4),D0„D0<==lengthofvariableparameterarea@ADD.L#(IOSILN-IOSATW)/2-1,D0ƒaddinrestofconfigurationarea*MOVEM.LA0/A1,-(A7)ƒsavestartofbuffers5LEA.LIOSATW(A0),A0‚setpointerstostartofbuffers LEA.L IOSATW(A1),A1*?OKCNFG5MOVE.W(A1)+,(A0)+‚copyhisvalidatedbuffertotheCCB#DBRAD0,OKCNFG5„configurationarea*5MOVEM.L(A7)+,A0/A1ƒrestorestartofbufferpointers.EXGA0,A1‰setA0=hisbuffer,A1=CCBbuffer5BSR.SSTATYP1…setupstatusandconfigurationheaderFMOVE.B#1,DCBCCF(A4)ƒsetflagindicatingthataCONFIGUREoraCHANGE *®DEFAULTCONFIGURATIONwasdone*A*ˆThistestisperformedatthistimesoaninitialconfigurationC*ˆwilloccurevenifthereisaS.C.switch/sysgenincompatibility.*-TST.BDCBCDV(A4)‚areweconfiguringtheBUS?#BNE.SOKCNFG7‚branch=notthebus*2EXGA0,A1ƒsetA0=CCBbufferandA1=hisbuffer4MOVEQ‚#CECSCE,D2ƒpreloadinvalidS.C.configurationBBTSTW#IOASCTC,IOSATW(A0)‚areweconfiguringforS.C.capability?6 BEQ.S OKCNFG7 branch = no, else test hardware config.9 TST.B ADDRREG(A2) is the MVME300 card switch in SC mode?'BMI.SCNFGERR‚branch=no  ,gotoerror*0OKCNFG7MOVEQ‚#ISTAOK,D1‚setreturnstatustoOK RTSƒexit*CCNFGERR MOVE.B D2,IOSCEC(A1) save specific configuration error codeBMOVEQ‚#ISTACNF,D1‚setinvalidconfigurationfordeviceerrorcode(RTSƒexitcommonconfigurationprocessor  TTL COMMON SUBROUTINES PAGE**‚STATYP*A*ˆThisroutineisusedbyCONFIGURE,CHANGEDEFAULTCONFIGURATION;*…andREQUESTSTATUSprocessorstostorethecurrentstatus8*…informationinthestandardconfigurationareaheader.*,*ˆENTER:‚A2=baseaddressofGPIBregisters*A4=addressofDCB*A5=addressofCCB*5*ˆEXIT:ƒA0=addressofconfigurationareafordevice*!*‹RegisterUsage:ƒ01234567*›D* *›AR‡PP*STATYP:0BSR.SGETCNFIGƒA0<==currentconfigurationptr*STATYP1: MOVEQ #0,D0"TST.BDCBCDV(A4)‰isthistheBUS?BNE.SSTATYP2Œbr=no'MOVE.BADDRSTAT(A2),D0ƒgetGPIBstatusAND.B#$FE,D0Œmaskoutgarbage*6STATYP2 MOVE.B D0,IOSDST(A0) put dev. status in buffer9 MOVE.B DCBDEV+IOSCTP(A4),IOSCTP(A0) set the channel type8 MOVE.B DCBDEV+IOSDTP(A4),IOSDTP(A0) set the device type/ MOVE.B #IODGPIB,IOSDRC(A0) set the driver code RTSƒexit  PAGE* *„SETPPREG*:*ˆThissubroutinewillsetorclearthedesiredbitofthe?*…parallelpollregisterforwhenaparallelpollisperformed.A*…IfboththeIndividualStatusbitandtheSensebitsareequal,>*…thebitspecifiedwillbesetintheparallelpollregister.8*…otherwisetheparallelpollregisterwouldbecleared.*;*ˆThePPregwillnotbesetifthesystemisinPPISstate.**,*ˆENTER:‚A0=pointertoconfigurationtable*A5=addressofCCB**ˆEXIT:ƒnoerrorsreturn*!*‹RegisterUsage:ƒ01234567*›D*ƒ**›AƒP* SETPPREG:!MOVE.LA1,-(A7)‚Saveenvironment MOVEQ #0,D23 MOVE.B IOSPOLC(A0),D0 get current PP configuration3BMI.SSETPR025ˆbr=InPPISstate,don'tsetPPreg'BTST#PPSENSE,D0‚isthesensebitset?BNE.SSETPR020‚branchifyes*:*‚Thesensebitisequaltozero,sotheindividualstatus8*‚mustalsobezerotosettheparallelpollstatusto1*2BTST#INDIVST,D0‚istheindividualstatusbitsetBNE.SSETPR015ƒno*$SETPR010AND.L#7,D0‚maskbitnumber'BSETD0,D2‚settoparallelpollstatus*6SETPR015MOVE.LCCBCHB(A5),A1‚A1<==ptrtoGPIBCregs:MOVE.BD2,PARLPOLL(A1)‚storeresultsinParallelpollreg,SETPR025‚MOVE.L(A7)+,A1ƒrestoreenvironment RTS*:*‚Thesensebithasbeendeterminethatitisequaltoone*7SETPR020BTST#INDIVST,D0‚isindividualstatusbitset?BNE.SSETPR010„branchifyesBRA.SSETPR015„no,exit PAGE* *ƒGETCNFIG*5*ˆGetapointertothecurrentconfigurationareafor*…thedesireddevice.**ˆENTER:‚A4=addressofDCB*A5=addressofCCB*5*ˆEXIT:ƒA0=addressofconfigurationareafordevice*!*‹RegisterUsage:ƒ01234567*›D* *›AR‡PP* GETCNFIG: MOVEQ #0,D0  IOCB*'*ˆONEXIT:‚D2.WISTABLEOFFSET(INDEX)+*’D1.B&=OPERATIONSTATUS(0=O.K)*8*‚FindthefunctioninthetableofvalidGPIBfunctions*GETCMDP:!ˆMOVEM.LA0/D0/D6,-(A7)saveregs5MOVE.W#NUMCMDS-1,D0ƒnumberofvalidGPIBcommands-14LEA.LIOSCMDTB(PC),A0ƒsetptrtoGPIBcommandtable1MOVE.WIOSFCT(A3),D6ƒpickupfunctionfromIOSPB8MOVEQ‚#ISTAIF,D1ƒsetinvalidcommanderrorjustincase*&GETCMD50CMP.W(A0)+,D6ƒfoundcommand?.DBEQD0,GETCMD50ƒbranchifno,looksomemore*,BNE.SGETCMDX„exitwitherror,endoftable4MOVE.W#NUMCMDS-1,D2ƒcalculaterelativetableindexSUB.WD0,D2‚D2<==tableindex"ASL.W#1,D2‚Calculatewordoffset*0MOVEQ‚#ISTAOK,D1setprocessO.K.returnstatus*GETCMDX TST.B D1 set return condition code$ MOVEM.L (A7)+,A0/D0/D6 restore regs RTS* 6 TTL GPIB DRIVER - COMMON SUBROUTINES (QUEUE HANDLING) PAGE**‚POPGPIBQUEUEENTRY*6*ˆIfI/Oisabortedoranoperationiscompleted,this9*…routinewillpopthatoperationfromtheGPIBqueueand9*…updatethenecessaryqueuepointers.Itisassumedthat:*…thecallerhaspreviouslyinhibitedallinterruptssince*…thisiscriticalprocessing.**’ENTER:ƒA5-addressofCCB*#*’EXIT:ƒIF„THEN‚queueisempty)*œELSE‚queuestillhasatleastoneentry*!*ŽRegisterUsage:ƒ01234567*žD *žA**‡P* POPGPIBQ:1LEA.LGPIBQEND(A5),A0‚A0<==ptrtoendofqueue.MOVE.LQTAIL(A5),A1„getcurrentqueuepointer2CMPA.LQHEAD(A5),A1„isthereanentrytoPOPoff?,BEQ.SPOPG15ŒBR=no,exitwithproper?ADDA.L#GPIBQLEN,A1„advancepointerbylengthofaqueueentryCMPA.LA0,A1…atendofqueue?BNE.SPOPG10ƒno*%* time to wrap around to top of queue*5LEA.LGPIBQ(A5),A1…setqueuepointertotopofqueue*APOPG10MOVE.LA1,QTAIL(A5)ƒupdatecurrentoperationqueuepointer„THENƒnoerrors*•ELSE„queueisfull*!*RegisterUsage:ƒ01234567 * D*‡PPPP* A*PƒPPPP* PSHGPIBQ:!MOVE.LA1,-(A7)ƒsaveenvironment4LEA.LGPIBQEND(A5),A1„A1<==endofGPIBqueuearea4MOVE.LQHEAD(A5),A0†A0<==nextavailablequeueptr*CLR.W‚CSTQOFST(A0)†setentrystatustoOK+MOVE.LA4,DCBQOFST(A0)ƒsaveaddressofDCB6MOVE.LA3,IPBQOFST(A0)ƒsavephysicaladdressofIOSPB?MOVE.LD7,PBPAOFST(A0)ƒsavephysicaladdressofprimarybufferIMOVE.LD6,SBPAOFST(A0)ƒsavephysicaladdressofsecondary/config.buffer2MOVE.WD4,PBLNOFST(A0)ƒsaveprimarybufferlength4MOVE.WD5,SBLNOFST(A0)ƒsavesecondarybufferlength;ADDA.L#GPIBQLEN,A0„incrementbylengthofonequeueentry"CMPA.LA1,A0…timetowraparound?BNE.SPSHQ010„branchifno*0LEA.LGPIBQ(A5),A0‚setptrtotopofqueuearea**PSHQ010CMPA.LQTAIL(A5),A0‚isqueuefull?5BEQ.SPSHQRTN‚yes,butthisshouldnothavehappened4 MOVE.L A0,QHEAD(A5) update next available queue ptr4MOVEQ#1,D0‚setconditioncodeforO.K.return*PSHQRTNMOVE.L(A7)+,A1ƒrestore RTSA TTL GPIB DRIVER - COMMON SUBROUTINES (VALIDATE OPERATIONAL MODE) PAGE**‚VALIDATEOPERATIONALMODE*9*ˆThisroutinewillbecalledatthepointwhenacommand:*ˆisabouttobescheduledforI/Oinitiation.Thepurpose;*ˆistodetermineiftheBUSisinthepropermodeforthis:*ˆcommandandtodetermineiftheBUSordevice(depending:*ˆonwhothiscommandisdirectedto)hastheca  pabilities3*ˆ(ifanyarenecessary)toperformthisoperation.*3*’ENTER:‚A3=addressofIOSPBforcurrentfunction*šA4=addressoftheDCB*šA5=addressoftheCCB%*šD2.W=indexofcommandinVALPARTB*'*’EXIT„D1=errorcode(0ifnoerrors)* *RegisterUsage…01234567 *¡D*R****¡A**VALOPER:FLEA.LVALPARTB(PC),A0ƒA0<==baseaddressofcommandvalidationtableDMOVE.W0(A0,D2.W),D4‚D4<==bitmapofnecessarycommandparameters*?CMP.B#XDSGDEV,IOSDTP+DCBDEV(A4)‚isthiscommandforadevice?BNE.SVALOP050ƒbranchifno*@*‚SincethiscommandisdirectedtowardsadeviceandthevaluesB*‚inVALPARTBarerelativetotheBUS,theREAD/WRITEbitstakeonA*‚theoppositemeaningthantheydidfortheBUS.‚Forexample,ifB*‚thereisawritecommandtoadevice,thevalueinVALPARTBwillB*‚indicatethatthetalkerability(VALTALK)willbenecessaryforA*‚thiscommand.‚However,thisbitwassetrelativetotheBUS.SoA*‚ifthewritecommandisdirectedtoadevice,thisrequirestheC*‚BUStobeinthetalkermodeandthedevicetobeinthelistenerB*‚mode.‚ItisforthesereasonsthattheTALKandLISTENabilitiesA*‚(VALTALKandVALLISTrespectively)areexclusiveor'dwith'11' *‚soastoinverttheirmeaning.*BMOVEQ#VALTALK+VALLIST,D0‚setupspecificcapabilitiestolookat MOVE.B D0,D39AND.BD4,D3D3=Talker/Listenercapabilityrequirements#BEQ.SVALOP050br=none,continueCMP.BD0,D3arebothrequired?-BEQ.SVALOP050br=yes,sononeedtoalter6EOR.WD0,D4else,changemeaningrelativetoadevice*C*ƒNowthatwehavethemeaningoftheabilitybitscorrectrelative;*ƒtothecommand,checkthecurrentattributeswordfortheB*ƒspecifieddevicetoseeifthedeviceorBUSiscapableofdoing*ƒthatcommand.*,VALOP050MOVE.WD4,D2‡D2<==WorkingbitmapHAND.W#VALTALK+VALLIST+VALCTL+VALSCTL+VALSRQ,D2‚anyabilitiesrequired?BEQ.SVALOP100branchifno8BSRGETCNFIGgetapointertouser'sconfigurationarea-MOVE.WD2,D3D3<==currentdeviceabilities5AND.WIOSATW(A0),D3ˆmaskabilitiesthatarerequired;CMP.BD2,D3doesthisdevice/BUShavetherightabilities.BNE.SVALOP250branchifno*C*‚Nowthattheabilityhasbeenverified,checktoseethattheBUS,*‚isinthenecessarymodeforthiscommand.**VALOP100MOVE.WD4,D2…savecurrentbitmap?AND.W#VALTMOD+VALLMOD+VALCMOD+VALBTLM,D2‚anymodesnecessary?BEQ.SVALOP500ƒbranchifno*3MOVE.WBUSACTIV(A5),D0‚D0<==currentbusactivity3CMP.B#XDSGDEV,IOSDTP+DCBDEV(A4)‚isthisadevice?BEQ.SVALOP200‚branchifyes8BTST#BVALBTLM,D4‚doweneedtobeinT/LmodeforBUS?BNE.SVALOP300‚branchifyes*5VALOP200BTST#CAC_S,D0ƒistheBUSincontrollermode/BNE.SVALOP500‚branchifyes,everythingisOK*"*‚ERROR:Amodeerrorhasoccurred*?VALOP250MOVEQ#ISTAIVCM,D1ƒsetinvalidcommandmodeerrorcodeBRA.SVALOPRTNƒexitwitherror*6VALOP300BTST#CAC_S,D0‚istheBUSincontrollermode?FBNE.SVALOP250‚branchifyes-error-can(tbeincontrollerforcmd*?*‚SincethiscommandisdirectedtotheBUS,itmayrequirethe>*‚BUStobeeitherinTalkerorListenermode.‚Checktoseeif>*‚thosemodesarerequiredforthiscommandandifsocheckto=*‚seethattheBUSisintheappropriatemode.‚TheproperT/L>*‚modecheckisskippediftheBUSisIDLE.‚Theoperationwill#*‚subsequentlybequeuedinTLPROC.*4 AND.W #1<*‚Thischeckwill  seeifasecondaryaddressistobeverified<*‚forthiscommandandcheckagainstvaliddeviceaddresses.*?VALOP500BTST#BVALSADR,D4ƒcheckGPIBdevicesecondaryaddress?BEQ.SVALOP600ƒbranchifno*3 CMP.B #XDSGDEV,IOSDTP+DCBDEV(A4) Is this a device? BEQ.S VALOP520*?BTSTW#APTBIT,TMSMASK(A5)‚operatinginsecondaryaddressmode?$BEQ.SVALOP250‚branchifno(error)*5VALOP520BSRGETCNFIG‰getconfigurationptrofdeviceDMOVE.LIOSSAMR(A0),D2„D2<==bitmaskofconfiguredvalidreadS.A./BTST‚#BVALLIST,D4‚isthisasecreadfunction?BNE.SVALOP540‚branchifyesEMOVE.LIOSSAMW(A0),D2ƒD2<==bitmaskofconfiguredvalidwriteS.A.*DVALOP540‚MOVE.BIOSSAD-1(A3),D0‚getS.A.fromIOSPBforthisrequest@MOVEQ#ISTAIVSA,D1‚preloadinvalid/unconfiguredS.A.errorcode?BTST.LD0,D2„isthisaddrconfiguredtobevalidinthismode?'BEQ.SVALOPRTN‚exitwitherrorinD1.B*NVALOP600 BTST #BVALBCHG,D4 does commmand reequire user to be in charge of BUS?, BEQ.S VALOP700 br = no, all checks complete% MOVEQ #ISTAIVBD,D1 preset error code LEA.L CONFINFO(A5),A0*MOVE.LDVDCBPTR(A0),A0‚A0<---DCbofBUS" TST.L DCBWNT(A0) is the BUS open?/BEQ.SVALOPRTNƒbr=no,returnwitherrorcode*;*‚Themodeanddeviceisnowcapableofcompletingthetask*/VALOP700MOVEQ#ISTAOK,D1„setreturncodetoOKVALOPRTNRTS„exit @ TTL GPIB DRIVER - COMMON SUBROUTINES (HALT ALL I/O IN PROGRESS) PAGE*%*•HALTI/OTOBUSORSPECIFIEDDEVICE*>*ˆThisroutineisdesignedtohaltallI/Othatisinprogress?*ˆandanyI/OthatiswaitingtobeexecutedontheGPIBqueue.=*ˆThisroutinemaybeenvokedatinterruptorcommandlevels.>*ˆIfatcommandlevel,aHALTcommandwasreceiveddirectedto;*ˆtheBUS.Atinterruptlevel,aIFC,DCL,orTCTinterrupt<*ˆwasencountered.‚TheseinterruptscauseallpendingI/Oto *ˆbeaborted.*2*’ENTER:„A4=addressofDCBforcurrentoperation*œA5=addressofCCB*)*’EXIT:…IfD1.B=0ƒThenallentrieswere%*œmarked'Halted'andtheappropriate+*œeventsweresentforthewaitingcommands*œonthequeue.*˜ELSE*œtherewasnoI/Otohalt.*!*ŽRegisterUsage:†01234567*ŸDƒ*R*ŸA‹PP*HLTALL:+MOVEM.LD2-D7/A1-A6,-(A7)ƒsaveenvironment6MOVE.LQTAIL(A5),A6‰A6<==ptrtocurrentqueueentry(CMPA.LQHEAD(A5),A6‰isthequeueempty?+BEQHLTERR’branchifyes(nothingtohalt)*BSRRESETIO‘doasoftreset1BSRKILLSPTOcancelSerialPolltimerifrunning>LEA.LGPIBQEND(A5),A0‡A0<==addressofphysicalendofqueue*CHLTALL10BSETW#HALTED,CSTQOFST(A6)‚setthisentrystatustohalted5ADDA.L#GPIBQLEN,A6‰bumppointertonextqueueentry&CMPA.LA6,A0attheendofthequeue?BNE.SHLTALL20Žbr=no6LEA.LGPIBQ(A5),A6Šelsewraparoundtostartofqueue*>HLTALL20 CMPA.L QHEAD(A5),A6 at the end of all queued entries?'BNE.SHLTALL10Žbranchifno-continue*< BCLRW #SRQWAIT,BUSACTIV(A5) clear any potential SRQ waiting=BTSTW#BUSIOP,BUSACTIV(A5)‚isthependingI/Ointerruptset?BNE.SHLTALL30Žbranchifyes-CLR.BIOPEND(A5)ŒresetpendingtaskI/Oflag*>HLTALL30 MOVE.L QTAIL(A5),A6 A6 <== current operation on queueMOVE.LDCBQOFST(A6),A4†getDCB!MOVE.LIPBQOFST(A6),A3†getIOSPB8BSRPROCMENUcleanupandsendhaltstoqueuedcommands BRA.S HLTOK 4 TTL GPIB DRIVER - COMMON SUBROUTINES (HALT COMMAND) PAGE*6*ˆHaltI/OtoaspecificdeviceortheBUSinT/Lmode*HLTCMD:+*>>>>>>>>>>>>>>>>>>>>>>>>>10/28/85ƒREV4.5+MOVEM.LD2-D7/A1-A6,-(A7)ƒsaveenvironment1MOVE.LQTAIL(A5),A6ƒgetpointertocurrententry(CMPA.LQHEAD(A5),A6‰isthequeueempty?(BEQ.SHLTERRbr=yes(nothingtohalt)4*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*9*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *ˆ4/24/84ƒbwn**ˆFixanOOPS!#*LEA.LGPIBQEND,A0‹setend-of-queue LEA.L GPIBQEND(A5),A0*>*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<**ˆLocatet  hecommand*1HLTC60 CMPA.L DCBQOFST(A6),A4 is this the device?BEQ.SHLTC80br=yes*'ADDA.L#GPIBQLEN,A6‰bumptonextentryCMPA.LA6,A0endofqueue?BNE.SHLTC70br=no*0LEA.LGPIBQ(A5),A6Šelseresettostartofqueue*HLTC70CMPA.LQHEAD(A5),A6ƒendofentries?(BNE.SHLTC60br=no,continuechecking:BRA.SHLTERRentrynotfound,returnerrortoIOSrequest*5HLTC80 BSETW #HALTED,CSTQOFST(A6) mark command halted+CMPA.LQTAIL(A5),A6‰isitthecurrentI/O?BNE.SHLTOK‘br=no**BSRRESETIO‘terminateanyI/Oinprogress3MOVE.LIPBQOFST(A6),A3†setpointertouser'sIOSPBBSRPROCMENUcancelcommand0BTSTW#BUSIOP,BUSACTIV(A5)‚anyBUSI/Opending?BNE.SHLTOK‘br=yes8AND.B#$3F,IOPEND(A5)‡elseclearpendingtaskI/OFLAGS*3HLTOKMOVEM.L(A7)+,D2-D7/A1-A6ƒrestoreenvironment,MOVEQ#ISTAOK,D1†setgooderrorreturncode RTS*)*>>>>>>>>>>>>>>>>>>>>>>>10/28/85‚REV4.5.HLTERRMOVE.B#ISTAIF,D1ˆseterrorreturncode.*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.MOVEM.L(A7)+,D2-D7/A1-A6ƒrestoreenvironment RTS 7 TTL GPIB DRIVER - COMMON SUBROUTINES (BUILD NEXT MENU) PAGE**ƒBUILDNEWMENUITEM*:*ˆThisroutinewillsetupallthemenupointersnecessary<*ˆtoexecutethenextcommand.Sincethecommandhasalready9*ˆbeenvalidated,ifitisnotnowfoundintheIOSCMDTB,;*ˆthisroutinewillreturnaruntimeerrorcodetoIOSand*ˆthecommandwillbeaborted.*3*ENTER:‚A3=addressofIOSPBforcurrentfunction*—A5=addressofCCB*!*RegisterUsage:…01234567*žD‚** *žA‚*…PƒP* BUILDMEN:6MOVE.WIOSFCT(A3),D0ˆextractcurrentfunctioncommand4LEA.LIOSCMDTB(PC),A0‡tableofvalidGPIBfunctions;MOVE.L#NUMCMDS-1,D1ˆD1=numberofcommandsinGPIBtable*<*‚FindthefunctioninthetableofavailableGPIBfunctions*9BUILDM10CMP.W(A0)+,D0…comparetonextfunctionintableBEQ.SBUILDM20foundfunction?%DBRAD1,BUILDM10‹no,continuesearch*=*‚ERROR:Thisisanirrecoverableerrorbecausethisfunction9*‰wasvalidatedpreviouslyandnowamatchdidnotoccur.(*‰Somebodyoverrantheparameterbuffer.*:BUILDM15MOVEQ‚#ISTADRVE,D1‚setdriverruntimeerrorcodeRTSšexitwitherror*.*‚Matchhasbeenfoundsosetupmenupointers*JBUILDM20 MOVE.L #NUMCMDS-1,D0 subtract index from total number of commands SUB.L D1,D0ASL.L#1,D0getwordoffset9LEA.LCTLCFTBL(PC),A0…tableofcontrollermenufunctions3BTSTW#CAC_S,BUSACTIV(A5)‚GPIBincontrollermode?BNE.SBUILDM30ŒbranchifyesELEA.LTLCFTBL(PC),A0†no,settableoftalker/listenermenufunctions*;BUILDM30MOVE.W0(A0,D0.W),D1ƒgetrelativedistanceofmenu?BEQ.SBUILDM15ŠthisshouldneverhappenbutdothisifitdoesILEA.L0(A0,D1.W),A0…getabsolutepointertomenutableforthisfunction+MOVE.LA0,MENU(A5)†settopofmenupointer2MOVE.LA0,MENUNPOS(A5)‚setnextmenuitempointerMOVEQ‚#ISTAOK,D1‡goodreturn RTS•exit3 TTL GPIB DRIVER - COMMON SUBROUTINES (QUEUE EVENT) PAGED*********************************************************************5*‰QUEUEACOMPLETIONEVENTTOTHEATTACHEDTASK(IOS)*;*‰ThisroutinecallstheexectosendasmalleventtoIOS.9*‰UsesQEVNTIifwe'reprocessinganinterruptandQEVNTT*‰ifwe'renot.*8*‰NOTE:‚Thisroutineiscompletelyre-entrantandmaybe2*runatanytime.‚Allworkiscompletelyregister3*oriented.‚Allmessagesareassumedtobe10bytes*inlength!!!!!!**‰Entry:D1.W=eventstatus*D4.B=eventtype*A4=addressofDCB.*A5=addressofCCB.**‰Exit:‚D0=garbage.*D1=garbage.*;*‰Thestructureoftheeventyoumustsupplyisasfollows:*‹BYTES‚MEANING@*‰*ƒ1„eventlengthassumingnoserviceaddress(always10bytes)4*‰*ƒ1„eventcode(1ifnoserviceaddress,else$81)*1„eventtype*‰*ƒ1„channelkey<*‰*ƒ4„ID(DCBaddressforussincewe'reastandardchannel)*2„statusvalue*@*‰Fieldsmarkedby*areplacedintheeventbythis routineand%*‰neednotbepreparedbythecaller.@*‰IfaserviceaddresswasspecifiedfortheI/O,itisinsertedD*‰beforetheeventtypefield,andeventlengthisupdateby4bytes>*‰andtheeventcodewillbemodifiedtoindicateacompletion:*‰serviceaddressispresent(MSBofeventcodeisa"1").*J************************************************************************** QEVENT:>ŠMOVEM.LD2-D7/A0-A6,-(A7)Savetheregisterswe'llblowaway.*0*‚Startsettingthosevalueswhichneverchange.*!ŠMOVE.WD1,D6’D6<==eventstatusBŠMOVE.W#(10*256)+IOEVCD,D2„D2<==prepareeventlength/eventcode#ŠMOVE.LA4,D5’D5<==addressofDCB3ŠASL.W#8,D4“shifteventtypetoupperbyteofword7ŠMOVE.BCCBKEY(A5),D4ŠSetthechannelkeyinlowerbyte0ŠAND.L#$FF,D6‘clearupperbytesofeventstatus*C*‚Iftherewasaserviceaddressspecified,gobackandfixthings.*AŠMOVE.LCCBSVVC(A5),D3…isacompletionserviceaddressspecified?ŠBEQ.SQEVT010branchifno*-ŠADDI.W#4*256,D2ŠadjusteventlengthforCSA7ŠMOVE.B#$80+IOEVCD,D2…adjusteventcodetosetCSAbit***ˆStageallregistersforeventprocessing*-QEVT010ƒSWAPD2“stageeventlength/eventcodeŠTST.LD3’anyCSAspecified?ŠBEQ.SQEVT020branchifno*,*ˆStageregistersforeventwithCSAaddress*ŠSWAPD3 ŠMOVE.WD3,D2 ŠMOVE.WD4,D3 ŠMOVE.LD5,D4 ŠMOVE.LD6,D5ŠSWAPD5ŠBRA.SQEVT030*3*ˆStageallregistersforeventwithnoCSAaddress*QEVT020ƒMOVE.WD4,D2 ŠMOVE.LD5,D3 ŠMOVE.LD6,D4ŠSWAPD4 ŠCLR.LD5*&*‚Dotheexeccalltoqueuetheevent.*FQEVT030ƒMOVE.LCCBRQSTA(A5),A0„A0<--addressofTCBofattachedtask.7ŠTST.B‚BINTCNT(A5)ˆIfwe'renotqueueingtheeventfrom*ŠIF…THEN.Sˆwithintheinterrupttour,0ŒMOVEQ‚#T0QEVNTT,D0…D0<--theQEVNTTdirective.ŒTRAPƒ#0"ŒBRA.S‚OKEVENTŠIfgood,goreturn.1ŒMOVEM.L(A7)+,D2-D7/A0-A6Restoretheregisters.&ŒKILL.DRIVERM300INT_ID,T0QEVNTT,A5,A4ŠELSE.S0ŒMOVEQ‚#T0QEVNTI,D0…D0<--theQEVNTIdirective.ŒTRAPƒ#0"ŒBRA.S‚OKEVENTŠIfgood,goreturn.1ŒMOVEM.L(A7)+,D2-D7/A0-A6Restoretheregisters.&ŒKILL.DRIVERM300INT_ID,T0QEVNTI,A5,A4ŠENDI COKEVENTƒMOVEM.L(A7)+,D2-D7/A0-A6Restoretheregistersandreturn.ŠRTS—* 4 TTL GPIB DRIVER - INTERRUPT PROCESSING (SEND EVENT) PAGEF*********************************************************************** *‚SENDUEVT*5*ˆThepurposeofthistask‚istosendaneventtothe9*„usertaskfromthedeviceI/Odriver.‚Thistaskmustbe7*„runatinterruptlevelorelsethesystemwillcrash.:*„Currentlythereare7reasonsforthiseventontheGPIB>*„andtheyare:SRQ,RLC,DCL,TCT,GET,IFC,andI/Opending.**ˆENTER:‚D0.B=eventtype*D1.B=eventstatus3*A4.L=addressofDCBofdeviceassoc.withevent*A5.L=addressofCCB*.*ˆEXIT:ƒeventwassentorelsesystemcrashed.* *’RegisterUsage‚01234567* D** * A*‡PP*9*ˆNOTE:ƒTheentrypointSENDUEVS:isusedwhenanon-zero6*eventstatus(passedinD1.B)willbesentinevent.%*OtherwiseuseSENDUEVTentrypoint.*6*ˆNOTE:‚Thisroutinewillchecktoseethatthedevice-*specifiedbytheDCBpointerisopenbefore0*tryingtosendtheevent.‚Ifthedeviceisnot1*open,anattemptwillbemadetosendtheevent.*totheBUS.‚IftheBUSisnotopentheevent*willbediscarded.*C******************************************************************* SENDUEVT:&MOVEQ#0,D1‰preloadzeroeventstatus*DSENDUEVS: MOVEM.L D2-D7/A0-A6,-(A7) save regs that may get destroyed6TST.B‚BINTCNT(A5)ƒmakesureweareatinterruptlevelBBEQ.S‚SENDUEOK†br=no,fatalerror!BUTDON'TCRASH,justignore; MOVE.L DCBAID(A4),A2 A2 = DCB I.D. of event causing device*9SENDUE05 TST.L DCBTSK(A4) is this device claiming Events?/BNE.SSENDUE07‹branch=yes,gosendtheevent1TST.BDCBCDV(A4)‰isthisdevicealreadytheBUS?3BEQ.SSENDUEOKbr=yes,thenthrowtheeventaway)MOVE.LDCBSUP(A4),A4‡elsegotrytheBUS BRA.SSENDUE05Žgotryagain!*7SENDUE07ASL.W#8,D0‡putAsynceventtypeinhighbyte,&MOVE.BD1,D0†addineventstatusbyteMOVE.WD0,-(A7)ƒsaveonstack/MOVE.LA2,-(A7)ƒsavedeviceI.D.dataonstackK MOVE.W #(AILNG*256)+AIEVCD,-(A7) PUSH event length + Async event type code*.MOVE.LDCBSES(A4),D1‚D1=tasksessionnumber$MOVE.LDCBTSK(A4),A0‚A0=taskname.MOVEQ#13,D0†Call'GTXTCB'fortherightinfo TRAP #0) BRA.S SENDUE10 good, A0 = address of TCB'MOVEM.L(A7)+,D2-D3‚Cleanupthestack( BRA.S SENDUEOK bad, go throw away event*BSENDUE10MOVEM.L(A7)+,D2-D3ƒstagetheregistersforRMS68KQEVENT.MOVEQ#T0QEVNTI,D0‚initiateQEVENTIdirective TRAP #0NOPŒgoodevent*5*ƒIfwereturnheredirectlytheeventwasn'tqueued!!*ˆIgnoretheerrorandkeepgoing*6SENDUEOK MOVEM.L (A7)+,D2-D7/A0-A6 restore environment RTS NNNNN' TTL GPIB MENU ITEM TABLE - GPIB TABLES PAGEE********************************************************************** *COMMANDI/OMENUDRIVERTABLES*E**********************************************************************=*…THEFOLLOWINGCOMMANDI/OMENUSAREUSEDTOCOORDINATEGPIB<*…TRANSMISSIONPROTOCOLONTHEBUS.MENUSAREGENERATEDEACH:*…TIMEAREQUESTFROMIOSISMADETOTHEDRIVER.EACHMENU=*…CONSISTSOFSEVERALMENUITEMSEACHOFWHICHHASASPECIFIC?*…TASKTOACCOMPLISHORINITIATE.ONLYONEMENUMAYBEEXECUTED?*…ATATIMEANDANYREQUESTSFORI/OTHATOCCURWHILEEXECUTINGA*…AMENUAREQUEUEDUPANDWILLBEPROCESSEDWHENITSTURNCOMES.9*…MENUITEMSCONSISTOFESSENTIALLYFOURDIFFERENTTYPES:**…1.COMMANDITEMS(BUSCMD)*?*ˆTHESEWILLSENDIEEE-488COMMANDSTOTHEGPIBCINTERFACEWITH@*ˆTHEATNLINETRUE.ALLTHESETYPESAREDESIGNATEDBYTHEMACRO*ˆBUSCMD.*&*…2.AUXILLIARYCOMMANDITEMS(AUXCMD)*5*ˆAUXILLIARYCOMMANDSAREMENUITEMSTHATAREWRITTEN<*ˆDIRECTLYTOTHEAUXILIARYCOMMANDREGISTEROFTHETMS9914A?*ˆREGARDLESSOFTHETHESTATEOFTHEATNLINEANDAREGENERATED*ˆBYAUXCMDMACROCALL.*,*…3.DATAINPUT/OUTPUTMENUITEMS(DATAXFER)*@*ˆTHESEINITIATETHEACTUALDATADMATRANSFER.THECOMPLETIONOF@*ˆTHESECOMMANDSISPROMPTEDBYANI/OCOMPLETEINTERRUPTBYTHE3*ˆGPIBC.THESETYPESARECALLEDWITHDATAXFR.*#*…4.FUNCTIONMENUITEMS(FUNCTION)*7*ˆTHESECAUSESOMESORTOFMENUFUNCTIONTOTAKEPLACE.>*ˆFOREXAMPLE,THEFUNCTIONMENUITEMSIGNIFIESTHETHIS>*ˆMENUPACKETISCOMPLETEANDTHATTHEMENUPROCESSORISREADY?*ˆFORANEWMENU.ALLTHESETYPESOFCOMMANDSAREPREFIXEDWITH *ˆTHEMACROCALLFUNCTION.*D************ ******************************************************** SECTION 0 DS 0*D**********************************************************************ˆFUNCTION:INPUTDATA*?*ˆFUNCTIONCODETOINITIATEMENU:IOREAD‚(CONTROLLERMODEONLY)* Ñ6ÚBâ?êAò@úB@ DCF"?*02+:0B<J5R(Z/<*ˆPURPOSE:TOINITIATEDMAWRITE(WRITEINTOMEMORY)OFDATA*C********************************************************************INP_DATABUSCMDUNT„UNTALKˆBUSCMDUNL„UNLISTEN%ˆBUSCMDOTA„SENDPRIMARYTALKADDRESSˆDATAXFRIN„DMAWRITE(INPUT)ˆBUSCMDUNT„UNTALKˆFUNCTIONEND„ENDOFMENUˆDS.W0ŠASSUREWORDALIGNMENT*C*********************************************************************ˆFUNCTION:OUTPUTDATA*?*ˆFUNCTIONCODETOINITIATEMENU:IOWRIT(CONTROLLERMODEONLY)*:*ˆPURPOSE:TOINITIATEDMAREAD(READFROMMEMORY)OFDATA*D*********************************************************************OUT_DATABUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN'‰BUSCMDLAGˆSENDPRIMARYLISTENADDRESS‰DATAXFROUT‡DMAREAD(OUTPUT)#‰DATAXFRTERM†SENDTERMINATINGCHAR'‰DATAXFRSEOI†SEND'EOI'WITHLASTBYTE‰BUSCMDUNLˆUNLISTEN‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*D**********************************************************************ˆFUNCTION:OUTPUTWITHINPUT*?*ˆFUNCTIONCODETOINITIATEMENU:IOOWIN‚(CONTROLLERMODEONLY)*8*ˆPURPOSE:TOPERFORMANDOUTPUTFUNCTIONFOLLOWEDBYAN'*‘INPUTFUNCTIONWITHONEMENUREQUEST.*D*********************************************************************OWI_DATABUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN'‰BUSCMDLAGˆSENDPRIMARYLISTENADDRESS'‰DATAXFROUT‡INITIATEDMAREAD(OUTPUT)&‰DATAXFRTERM†SENDTERMINATINGCHAR(S)'‰DATAXFRSEOI†SEND'EOI'WITHLASTBYTE‰BUSCMDUNLˆUNLISTEN%‰BUSCMDOTAˆSENDPRIMARYTALKADDRESS&‰DATAXFRINˆINITIATEDMAWRITE(INPUT)‰BUSCMDUNTˆUNTALK‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E***********************************************************************ˆFUNCTION:REQUESTSTATUS*3*ˆFUNCTIONCODETOINITIATEMENU:IOSTATƒ(ANYMODE)*7*ˆPURPOSE:‚STANDARDIOSREQUESTSTATUSFUNCTIONCOMMAND*E**********************************************************************)REQ_STATFUNCTIONFREQSTATƒREQUESTSTATUS‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E********************************************************************** *ˆFUNCTION:CHANGECONFIGURATION*3*ˆFUNCTIONCODETOINITIATEMENU:IOCNFGƒ(ANYMODE)*=*ˆPURPOSE:‚STANDARDIOSCHANGECONFIGURATIONFUNCTIONCOMMAND*E**********************************************************************6CNFG_DEVFUNCTIONFCNFGDEVƒCHANGEDEVICECONFIGURATION‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E**********************************************************************(*ˆFUNCTION:CHANGEDEFAULTCONFIGURATION*3*ˆFUNCTIONCODETOINITIATEMENU:IOCHDC‚(ANYMODE)*7*ˆPURPOSE:‚STANDARDIOSCHANGEDEFAULTFUNCTIONCOMMAND*E**********************************************************************7CH_DEFLTFUNCTIONFCHDEFLTƒCHANGEDEFAULTCONFIGURATION‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*D*********************************************************************"*ˆFUNCTION:COMMANDOUT/DATAOUT*?*ˆFUNCTIONCODETOINITIATEMENU:IOCODO‚(CONTROLLERMODEONLY)*9*ˆPURPOSE:TOALLOWTHEUSERTOSENDNON-STANDARDCOMMAND1*‘SEQUENCES(ATNTRUE)FOLLOWEDBYADATASTRING.*D*********************************************************************7CDAT_OUTBUSCMDAUXˆSENDCOMMANDSTRINGFROMAUXBUFFER‰BUSCMDUNTˆUNTALK'‰DATAXFROUT‡INITIATEDMAREAD(OUTPUT)#‰DATAXFRTERM†SENDTERMINATINGCHAR'‰DATAXFRSEOI†SEND 'EOI'WITHLASTBYTE‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E**********************************************************************!*ˆFUNCTION:COMMANDOUT/DATAIN*?*ˆFUNCTIONCODETOINITIATEMENU:IOCODI‚(CONTROLLERMODEONLY)*;*ˆPURPOSE:TOALLOWTHEUSERTOSENDANON-STANDARDCOMMAND-*‘SEQUENCE(ATNTRUE)FOLLOWEDBYANINPUTOF*‘DATACOMMAND.*E**********************************************************************6CDAT_IN‚BUSCMDAUXˆSENDCOMMANDSTRINGFROMAUXBUFFER%‰DATAXFRINˆINTIATEDMAWRITE(INPUT)‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E***********************************************************************ˆFUNCTION:COMMANDOUT*?*ˆFUNCTIONCODETOINITIATEMENU:IOCMDO‚(CONTROLLERMODEONLY)*;*ˆPURPOSE:TOALLOWTHEUSERTOSENDANON-STANDARDCOMMAND*‘SEQUENCE(ATNTRUE).*E**********************************************************************6CMD_OUT‚BUSCMDAUXˆSENDCOMMANDSTRINGFROMAUXBUFFER‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E**********************************************************************"*ˆFUNCTION:READSECONDARYADDRESS*?*ˆFUNCTIONCODETOINITIATEMENU:IORSEC‚(CONTROLLERMODEONLY)*8*ˆPURPOSE:SIMILARTOINPUTDATAEXCEPTTHATASECONDARY*‘ADDRESSMUSTBESPECIFIED.*E**********************************************************************READ_SECBUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN ‰BUSCMDOTAˆPRIMARYTALKADDRESS‰BUSCMDOSAˆSECONDARYADDRESS&‰DATAXFRINˆINITIATEDMAWRITE(INPUT)‰BUSCMDUNTˆUNTALK‰FUNCTIONEND…ENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENTE**********************************************************************#*ˆFUNCTION:WRITESECONDARYADDRESS*?*ˆFUNCTIONCODETOINITIATEMENU:IOWSEC‚(CONTROLLERMODEONLY)*9*ˆPURPOSE:SIMILARTOOUTPUTDATAEXCEPTTHATASECONDARY*‘ADDRESSMUSTBESPECIFIED*D*********************************************************************WRITE_SECBUSCMDUNT‡UNTALK‰BUSCMDUNLˆUNLISTEN"‰BUSCMDLAGˆPRIMARYLISTENADDRESS‰BUSCMDOSAˆSECONDARYADDRESS'‰DATAXFROUT‡INITIATEDMAREAD(OUTPUT)2‰DATAXFRTERM†SENDTERMINATIONCHAR(IFNECESSARY)'‰DATAXFRSEOI†SEND'EOI'WITHLASTBYTE‰BUSCMDUNLˆUNLISTEN‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*C********************************************************************%*ˆFUNCTION:UNCONFIGUREPARALLELPOLL*>*ˆFUNCTIONCODETOINITIATEMENU:IOPPU‚(CONTROLLERMODEONLY)*1*ˆPURPOSE:TORESETALLDEVICESOFTHEIRPARALLEL*‘POLLCONFIGURATIONSTATE.*C********************************************************************5PP_UNCFGBUSCMDPPUˆPARALLELPOLLUNCONFIGURECOMMAND‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*B*******************************************************************#*ˆFUNCTION:CONFIGUREPARALLELPOLL*>*ˆFUNCTIONCODETOINITIATEMENU:IOPPC‚(CONTROLLERMODEONLY)*6*ˆPURPOSE:TOCONFIGUREWHICHOF8PARALLELPOLLLINES+*‘THESPECIFIEDDEVICEISTORESPONDONWHEN*‘PARALLELPOLLED.*A******************************************************************PP_CNFIGBUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN"‰BUSCMDLAGˆPRIMARYLISTENADDRESS+‰BUSCMDPPCˆPARALLELPOLLCONFIGURECOMMAND(‰BUSCMDPPEˆSENDPOLLANDSENSEBITINFO‰BUSCMDUNLˆUNLISTEN‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*@*****************************************************************!*ˆFUNCTION:CONDUCTPARALLELPOLL*?*ˆFUNCTIONCODETOINITIATEMENU:IOPPOL(CONTROLLERMODEONLY)*=*ˆPURPOSE:ALLOWACTIVECONTROLLERTOPARALLELALLCONFIGURED-*‘DEVICES(I.E.DEVICESWHOAREPARALLELPOLL'*‘CONFIGURED)ANDRECEIVETHEIRSTATUS.*B*******************************************************************-COND_PP‚AUXCMDTCSŠTAKECONTROLSYNCHRONOUSLY,‰FUNCTIONFRPP‡REQUESTPARALLELPOLLROUTINE‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSURE WORDALIGNMENT*E**********************************************************************$*ˆFUNCTION:SETPARALLELPOLLSTATUS*8*ˆFUNCTIONCODETOINITIATEMENU:IOSPPS‚(T/LMODEONLY)*:*ˆPURPOSE:‚SETUPTHEPARALLELPOLLRESPONSEBIT(PPR)AND*’THESENSEBIT(S).*E**********************************************************************/SET_PPƒFUNCTIONFSETPP…SETPARALLELPOLLSTATUS‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E**********************************************************************"*ˆFUNCTION:SETSERIALPOLLSTATUS*8*ˆFUNCTIONCODETOINITIATEMENU:IOSSPS(T/LMODEONLY)*5*ˆPURPOSE:‚SETTHEVALUETOBERETURNEDTOTHEACTIVE'*’CONTROLLERWHENWEARESERIALPOLLED.*E**********************************************************************-SET_SPƒFUNCTIONFSETSP…SETSERIALPOLLSTATUS‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*C********************************************************************'*ˆFUNCTION:DEVICESTATUS(SERIALPOLL)*?*ˆFUNCTIONCODETOINITIATEMENU:IOSPOL(CONTROLLERMODEONLY)*2*ˆPURPOSE:CONDUCTSERIALPOLLOFSPECIFIEDDEVICE*B*******************************************************************COND_SP‚BUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN#‰BUSCMDSPEˆSENDSERIALPOLLENABLE%‰BUSCMDOTAˆSENDPRIMARYTALKADDRESS%‰DATAXFRSPB‡RECEIVESERIALPOLLBYTE"‰BUSCMDSPDˆLEAVESERIALPOLLMODE‰BUSCMDUNTˆUNTALK‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*C********************************************************************!*ˆFUNCTION:PARALLELPOLLDISABLE*>*ˆFUNCTIONCODETOINITIATEMENU:IOPPD‚(CONTROLLERMODEONLY)*@*ˆPURPOSE:TODISABLEADEVICEFROMSENDINGASTATUSBITMESSAGE!*‘INRESPONSETOAPARALLELPOLL.*C********************************************************************PP_DISABBUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN ‰BUSCMDLAGˆLISTENADDRESSGROUP#‰BUSCMDPPCˆPARALLELPOLLCONFIGURE)‰BUSCMDPPDˆPARALLELPOLLDISABLECOMMAND‰BUSCMDUNLˆUNLISTEN‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*C*********************************************************************ˆFUNCTION:INTERFACECLEAR*C*ˆFUNCTIONCODETOINITIATEMENU:IOSIFC(SYSCONTROLLERMODEONLY)*1*ˆPURPOSE:TOALLOWTHESYSTEMCONTROLLERTOSEND**‘THEINTERFACECLEARCOMMANDTOTHEGPIBC*C********************************************************************'INTF_CLRFUNCTIONFSIC…SENDIFCCOMMAND‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*C*********************************************************************ˆFUNCTION:REMOTEENABLE*C*ˆFUNCTIONCODETOINITIATEMENU:IOSREN(SYSCONTROLLERMODEONLY)*1*ˆPURPOSE:TOALLOWTHESYSTEMTOSENDTHEREMOTE*‘ENABLEMESSAGETOTHEGPIBC.*C********************************************************************.REM_ENABAUXCMDSRE1ˆSENDREMOTEENABLE(CS=1)‰FUNCTIONEND‰ENDOFMENU‰DS.W0ASSUREWORDALIGNMENT*C*********************************************************************ˆFUNCTION:REMOTEDISABLE*C*ˆFUNCTIONCODETOINITIATEMENU:IOCREN(SYSCONTROLLERMODEONLY)*1*ˆPURPOSE:TOALLOWTHESYSTEMTOSENDTHEREMOTE*‘DISABLEMESSAGETOTHEGPIBC.*C********************************************************************/REM_DNABAUXCMDSRE0ˆSENDREMOTEDISABLE(CS=0)‰FUNCTIONEND‰ENDOFMENU‰DS.W0ASSUREWORDALIGNMENT*C********************************************************************2*ˆFUNCTION:ENTRYI:ABORTBUSANDDEVICEMESSAGES*’ENTRYII:‚CLEARALLDEVICES*F*ˆFUNCTIONCODETOINITIATEMENU:I.IOABT1(SYSCONTROLLERMODEONLY)#*¨II.IOSDCL(CONTROLLERMODEONLY)*7*ˆPURPOSE:TOHALTALLACTIVITYONTHEGPIBCBYSENDING/*‘THEINTERFACECLEARANDDEVICECLEARMESSAGES*C********************************************************************2S_IFCDCLFUNCTIONFSIC‡SENDINTEFACECLEARCOMMAND*S_ DCL„BUSCMDDCLŠSENDDEVICECLEARCOMMAND‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*C********************************************************************%*ˆFUNCTION:LOCALLOCKOUTALLDEVICES*?*ˆFUNCTIONCODETOINITIATEMENU:IOSLLO‚(CONTROLLERMODEONLY)*-*ˆPURPOSE:ALLOWUSERTOSENDOUTLLOCOMMAND*C********************************************************************$S_LOCLOKBUSCMDLLOŠSENDLLOCOMMAND‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*C********************************************************************!*ˆFUNCTION:ABORTDEVICEMESSAGES*?*ˆFUNCTIONCODETOINITIATEMENU:IOABT2(CONTROLLERMODEONLY)*0*ˆPURPOSE:TOHALTANYI/OTODEVICES‚BYSENDING"*‘THEUNTALKANDUNLISTENCOMMANDS*B*******************************************************************S_UNTUNLBUSCMDUNTŠSENDUNTALK‰BUSCMDUNLŠSENDUNLISTEN‰FUNCTIONENDŠENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*A*******************************************************************ˆFUNCTION:TAKECONTROL*?*ˆFUNCTIONCODETOINITIATEMENU:IOTCTL(CONTROLLERMODEONLY)*1*ˆPURPOSE:TOALLOWUSERTOREGAINCONTROLOFTHE)*‘BUSATANYTIMEPROVIDEDHEHASCONTROL-*‘OFTHEBUSANDHASCONTROLLERCAPABILITIES.*A******************************************************************/TAKE_CTLFUNCTIONFTAKCTL‚TAKECONTROLFUNCTION‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*A*******************************************************************ˆFUNCTION:GOTOSTANDBY*>*ˆFUNCTIONCODETOINITIATEMENU:IOGTS(CONTROLLERMODEONLY)*2*ˆPURPOSE:TOALLOWUSERTORELEASECONTROLOFTHE)*‘BUSATANYTIMEPROVIDEDHEHASCONTROL-*‘OFTHEBUSANDHASCONTROLLERCAPABILITIES.*A******************************************************************,GO_STBY‚FUNCTIONFGTS…GOTOSTANDBYFUNCTION‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT    A*******************************************************************ˆFUNCTION:REQUESTCONTROL*(*ˆFUNCTIONCODETOINITIATEMENU:IORQCL*5*ˆPURPOSE:TOALLOWUSERTOINITIALLYTAKECONTROLOF-*‘THEBUSAFTERTHESYSTEMISINITIALIZEDAND'*‘THEMVME-300HASCOMEUPINT/LMODE./*‘THISCOMMANDWILLPUTTHETMS9914INTO'CACS'.*‘ANDALLOWNORMALCONTROLLERFUCTIONSWITHOUT!*‘HAVETOBEASYSTEMCONTROLLER.*A******************************************************************1REQ_CTL‚FUNCTIONFREQCTL‚REQUESTCONTROLFUNCTION‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*A*******************************************************************ˆFUNCTION:RELEASECONTROL*(*ˆFUNCTIONCODETOINITIATEMENU:IORLCL*2*ˆPURPOSE:TOALLOWUSERTOGIVEUPCONTROLOFTHE)*‘BUSATANYTIMEPROVIDEDHEHASCONTROL+*‘OFTHEBUS.‚THISCOMMANDSIMPLYDROPSTHE+*‘ATNLINEONTHEBUSANDSWITCHESTHEGPIB%*‘DRIVERFROMCONTROLLERTOT/LMODE.#*‘(THE9914GOESINTO'CIDS'STATE)*A******************************************************************1REL_CTL‚FUNCTIONFRELCTL‚RELEASECONTROLFUNCTION‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*A*******************************************************************ˆFUNCTION:PASSCONTROL*?*ˆFUNCTIONCODETOINITIATEMENU:IOPCTL(CONTROLLERMODEONLY)*3*ˆPURPOSE:TOALLOWUSERTOPASSCONTROLTOANOTHER)*‘DEVICEONTHEBUSCAPABLEOFCONTROLLER*‘RESPONSIBILITIES.*B*******************************************************************PASS_CTLBUSCMDUNTŠSENDUNTALK‰BUSCMDUNLŠSENDUNLISTEN%‰BUSCMDOTAŠSENDPRIMARYTALKADDRESS‰BUSCMDTCTŠSENDTAKECONTROL/‰FUNCTIONFRELCTL„ISSUERELEASECONTROLCOMMAND‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*A******************************************************************"*ˆFUNCTION:CLEARSPECIFIEDDEVICE*?*ˆFUNCTIONCODETOINITIATEMENU:IOSSDC‚(CONTROLLERMODEONLY)*$*ˆPURPOSE: TOCLEARSPECIFIEDDEVICE*B*******************************************************************SPEC_CLRBUSCMDUNTŠUNTALK‰BUSCMDUNLŠUNLISTEN"‰BUSCMDLAGŠPRIMARYLISTENADDRESS"‰BUSCMDSDCŠSELECTIVEDEVICECLEAR‰BUSCMDUNLŠUNTALK‰FUNCTIONENDŠENDOFMENU‰DS.W0ŽASSUREWORDALIGNMNET*A******************************************************************%*ˆFUNCTION:CLEARADDRESSEDLISTENERS*?*ˆFUNCTIONCODETOINITIATEMENU:IODSDC‚(CONTROLLERMODEONLY)*!*ˆPURPOSE:TOCLEARALLLISTENERS*B********************************************************************ADDR_CLRBUSCMDSDCŠSELECTIVEDEVICECLEAR‰FUNCTIONENDŠENDOFMENU‰DS.W0ŽASSUREWORDALIGNMNET*A******************************************************************!*ˆFUNCTION:SPECIFIEDGOTOLOCAL*A*ˆFUNCTIONCODETOINITIATEMENU:IOSGTL‚(CONTROLLER&T/LMODES)*2*ˆPURPOSE:TOPUTSPECIFIEDLISTENERINLOCALMODE*B*******************************************************************SPEC_GTLBUSCMDUNTŠUNTALK‰BUSCMDUNLŠUNLISTEN"‰BUSCMDLAGŠPRIMARYLISTENADDRESS‰BUSCMDGTLŠGOTOLOCALCOMMAND‰BUSCMDUNLŠUNLISTEN‰FUNCTIONENDŠENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*A******************************************************************+*ˆFUNCTION:ADDRESSEDLISTENERSGOTOLOCAL*A*ˆFUNCTIONCODETOINITIATEMENU:IODGTL‚(CONTROLLER&T/LMODES)*3*ˆPURPOSE:TOPUTADDRESSEDLISTENERSINLOCALMODE*B*******************************************************************'ADDR_GTLBUSCMDGTLŠGOTOLOCALCOMMAND‰FUNCTIONENDŠENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*B*********************************************************************ˆFUNCTION:REMOTEENABLESPECIFIEDDEVICE*?*ˆFUNCTIONCODETOINITIATEMENU:IODREM‚(CONTROLLERMODEONLY)*5*ˆPURPOSE:TOPLACEASPECIFIEDDEVICEINREMOTEMODE*B*******************************************************************'SPEC_REMAUXCMDSRE1‰SENDREMOTEENABLE‰BUSCMDUNTŠUNTALK‰BUSCMDUNLŠUNLISTEN"‰BUSCMDLAGŠPRIMARYLISTENADDRESS‰BUSCMDUNLŠUNLISTEN‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*A******************************************************************$*ˆFUNCTION:TRIGGERSPECIFIEDDEVICE*?*ˆFUNCTIONCODETOINITIATEMENU:IOSGET‚(CONTROLLERMODEONLY)*(*ˆPURPOSE:TOTRIGGERASPECIFIEDDEVICE*>***************************************************************SPEC_GETBUSCMDUNTŠUNTALK‰BUSCMDUNLŠUNLISTEN"‰BUSCMDLAGŠPRIMARYLISTENADDRESS&‰BUSCMDGETŠSENDGROUPEXECUTETRIGGER‰BUSCMDUNLŠUNLISTEN‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*A******************************************************************'*ˆFUNCTION:TRIGGERADDRESSEDLISTENERS*?*ˆFUNCTIONCODETOINITIATEMENU:IODGET‚(CONTROLLERMODEONLY)*-*ˆPURPOSE:TOTRIGGERALLADDRESSEDLISTENERS*>***************************************************************.ADDR_GETBUSCMDGETŠSENDGROUPEXECUTETRIGGER‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*B*******************************************************************-*ˆFUNCTION:PRIMARYANDSECONDARYREADTOBUS*’ENTRYPOINTI:‚SECONDARYREAD*’ENTRYPOINTII:PRIMARYREAD*;*ˆFUNCTIONCODETOINITIATEMENU:I:IORSEC‚(T/LMODEONLY)*§II:IOREAD‚(T/LMODEONLY)*1*ˆPURPOSE:‚ALLOWOWNEROFBUSTOMAKEPRIMARYAND-*’SECONDARYREADREQUESTSFROMTHECONTROLLER *’INCHARGE.B*******************************************************************$RSEC_TLEQU*READSECONDARYADDRESS8INTL_DATDATAXFRINŠREADDATA‚(WHENCONTROLLERREQUESTS)FUNCTIONENDENDOFMENUDS.W0–ASSUREWORDALLIGNMENT*E**********************************************************************0*ˆFUNCTION:PRIMARYANDSECONDARYWRITEFROMBUS *’ENTRYPOINTI:‚SECONDARYWRITE*’ENTRYPOINTII:PRIMARYWRITE*;*ˆFUNCTIONCODETOINITIATEMENU:I:IOWSEC‚(T/LMODEONLY)*§II:IOWRIT‚(T/LMODEONLY)*1*ˆPURPOSE:‚ALLOWOWNEROF THEBUSTOMAKEPRIMARY0*’ANDSECONDARYWRITEREQUESTSTOTHECONTROLLER *’INCHARGE.*D*********************************************************************%WSEC_TLEQU*WRITESECONDARYADDRESS:OUTL_DATDATAXFROUT‰WRITEDATA‚(WHENCONTROLLERREQUESTS)8DATAXFRTERMSENDTERMINATIONCHARACTERS(IFNECESSARY)'DATAXFRSEOISEND'EOI'WITHLASTBYTEFUNCTIONENDENDOFMENUDS.W0–ASSUREWORDALLIGNMENT*B*******************************************************************1*ˆFUNCTION:OUTPUTWITHINPUTCOMMANDINT/LMODE*8*ˆFUNCTIONCODETOINITIATEMENU:IOOWIN‚(T/LMODEONLY)*7*ˆPURPOSE:‚COMBINATIONOFTHEPRIMARYWRITEFOLLOWEDBY%*’PRIMARYREADOPERATIONINT/LMODE.*B*******************************************************************:OITL_DATDATAXFROUTƒWRITEDATA(WHENCONTROLLERREQUESTS)&DATAXFRTERMŠSENDMESSAGETERMINATORS'DATAXFRSEOIŠSEND'EOI'WITHLASTBYTE0DATAXFRINŒREADDATA(WHENCONTROLLERREQUESTS)FUNCTIONENDŠENDOFMENUDS.W0ASSUREWORDALLIGNMENT TTL GPIB DRIVER - DRIVER TABLES PAGEB*************************************************************************´********’MENUITEMCODEJUMPTABLE•**À*/*†THISTABLEISINDEXEDBYTHEMENUELEMENTS.*7*†THEORDEROFTHISTABLEMUSTREMAINCONSISTENTWITH‡*%*†THEVALUESASSIGNEDTOEACHITEM.™********´*******B****************************************************************** MENUCTBL:DC.W0‘ENDOFMENUINDICATOR*DC.WSENDUNT-MENUCTBL‚UNTALKROUTINEADDR,DC.WSENDUNL-MENUCTBL‚UNLISTENROUTINEADDR:DC.WSENDLAG-MENUCTBL‚PRIMARYLISTENADDRROUTINEADDRESS8DC.WSENDOTA-MENUCTBL‚PRIMARYTALKADDRROUTINEADDRESS6DC.WSENDOSA-MENUCTBL‚SECONDARYR/WADDRROUTINEADDR=DC.WSENDPPU-MENUCTBL‚PARALLELPOLLUNCONFIGUREROUTINEADDR;DC.WSENDPPC-MENUCTBL‚PARALLELPOLLCONFIGUREROUTINEADDR8DC.WSENDPPE-MENUCTBL‚PARALLELPOLLENABLEROUTINEADDR9DC.WSENDPPD-MENUCTBL‚PARALLELPOLLDISABLEROUTINEADDR6DC.WSENDSPE-MENUCTBL‚SERIALPOLLENABLEROUTINEADDR7DC.WSENDSPD-MENUCTBL‚SERIALPOLLDISABLEROUTINEADDR0DC.WSENDDCL-MENUCTBL‚DEVICECLEARROUTINEADDR1DC.WSENDLLO-MENUCTBL‚LOCALLOCKOUTROUTINEADDR0DC.WSENDTCT-MENUCTBL‚PASSCONTROLROUTINEADDR:DC.WSENDSDC-MENUCTBL‚SELECTIVEDEVICECLEARROUTINEADDR/DC.WSENDGTL-MENUCTBL‚GOTOLOCALROUTINEADDR9DC.WSENDGET-MENUCTBL‚GROUPEXECUTETRIGGERROUTINEADDR5 DC.W SENDAUXS-MENUCTBL SEND AUXILIARY COMMAND STRINGC DC.W READDATA-MENUCTBL INITIATE DMA WRITE ROUTINE ADDR (READ DATA)C DC.W WRITDATA-MENUCTBL INITIATE DMA READ ROUTINE ADDR (WRITE DATA)B DC.W SENDTERM-MENUCTBL SEND TERMINATION CHARACTER(S) ROUTINE ADDR+DC.WREADSP-MENUCTBLƒREADSERIALPOLLBYTE5DC.WSENDEOI-MENUCTBL‚SEND'EOI'WITHLASTDATABYTE=DC.WAUXPROC-MENUCTBL‚GENERALAUXILIARYCOMMANDROUTINEADDR=DC.WSENDIFC-MENUCTBL‚SENDIFCCOMMANDROUTINEFUNCTIONADDRGDC.WSENDRPP-MENUCTBL‚SENDREQUESTPARALLELPOLLROUTINEFUNCTIONADDRDDC.WSENDRLC-MENUCTBLƒPERFORMRELEASECONTROLROUTINEFUNCTIONADDRADC.WSENDTCA-MENUCTBLƒPERFORMTAKECONTROLROUTINEFUNCTIONADDRDDC.WSENDRQC-MENUCTBLƒPERFORMREQUESTCONTROLROUTINEFUNCTIONADDR2DC.WREQSTAT-MENUCTBL‚REQUESTSTATUSROUTINEADDR4DC.WCNFGDEV-MENUCTBL‚CONFIGUREDEVICEROUTINEADDR@DC.WCHDEFLT-MENUCTBL‚CHANGEDEFAULTCONFIGURATIONROUTINEADDR:DC.WSETPP-MENUCTBL„SETPARALLELPOLLSTATUSROUTINEADDR8DC.WSETSP-MENUCTBL„SETSERIALPOLLSTATUSROUTINEADDR5DC.WSENDGTS-MENUCTBL‚GOTOSTANDBYFUNCTIONROUTINE*6MENUCLEN EQU (*-MENUCTBL)/2 NUMBER OF ENTRIES IN TABLE  PAGEC**************************************************************************µ********˜CONTROLLERŸ*'*ŒCODE/FUNCTIONMENUTABLEJUMPTABLE’**Á*1*†THISTABLECONTAINSTHEADDRESSESOFTHEMENUŽ*7*†TABLESFOREACHOFTHEGPIBCIOSFUNCTIONSTHATAREˆ*8*†VALIDINCONTROLLERONLYMODE.THISTABLEISINDEXED‡*8*†BYAMATCHIN'IOSCMDTB'.IFTHEENTRYISZERO,THIS‡*'*†MENUISINVALID INCONTROLLERMODE.˜**Á********µ*******C*******************************************************************%CTLCFTBLDC.WINP_DATA-CTLCFTBL‚INPUTDC.WOUT_DATA-CTLCFTBLƒOUTPUT)DC.WOWI_DATA-CTLCFTBLƒOUTPUTWITHINPUT&DC.WREQ_STAT-CTLCFTBLƒREQUESTSTATUS,DC.WCNFG_DEV-CTLCFTBLƒCHANGECONFIGURATION4DC.WCH_DEFLT-CTLCFTBLƒCHANGEDEFAULTCONFIGURATION,DC.WCDAT_OUT-CTLCFTBLƒCOMMANDOUT/DATAOUT*DC.WCDAT_IN-CTLCFTBL„COMMANDOUT/DATAIN"DC.WCMD_OUT-CTLCFTBL„COMMANDOUT&DC.WREAD_SEC-CTLCFTBLƒREADSECONDARY(DC.WWRITE_SEC-CTLCFTBLƒWRITESECONDARY1DC.WPP_UNCFG-CTLCFTBLƒPARALLELPOLLUNCONFIGURE/DC.WPP_CNFIG-CTLCFTBLƒPARALLELPOLLCONFIGURE,DC.WCOND_PP-CTLCFTBL„CONDUCTPARALLELPOLL.DC.WSET_PP-CTLCFTBL…SETPARALLELPOLLSTATUS,DC.WSET_SP-CTLCFTBL…SETSERIALPOLLSTATUS*DC.WCOND_SP-CTLCFTBL„CONDUCTSERIALPOLL-DC.WPP_DISAB-CTLCFTBLƒPARALLELPOLLDISABLE'DC.WINTF_CLR-CTLCFTBLƒINTERFACECLEAR%DC.WREM_ENAB-CTLCFTBLƒREMOTEENABLE&DC.WREM_DNAB-CTLCFTBLƒREMOTEDISABLE&DC.WS_DCL-CTLCFTBL†CLEARALLDEVICES3DC.WADDR_CLR-CTLCFTBLƒCLEARALLLISTENINGDEVICES%DC.WS_LOCLOK-CTLCFTBLƒLOCALLOCKOUT$DC.WPASS_CTL-CTLCFTBLƒPASSCONTROL-DC.WADDR_GTL-CTLCFTBLƒLISTENERSGOTOLOCAL)DC.WADDR_GET-CTLCFTBLƒLISTENERSTRIGGER2DC.WS_IFCDCL-CTLCFTBLƒINTERFACEANDDEVICECLEAR+DC.WS_UNTUNL-CTLCFTBLƒUNTALKANDUNLISTEN$DC.WTAKE_CTL-CTLCFTBLƒTAKECONTROLDC.W0“REQUESTCONTROL&DC.WREL_CTL-CTLCFTBL„RELEASECONTROL$DC.WGO_STBY-CTLCFTBL„GOTOSTANDBY.DC.WSPEC_CLR-CTLCFTBLƒSPECIFIEDCLEARDEVICE/DC.WSPEC_REM-CTLCFTBLƒSPECIFIEDREMOTEDEVICE0DC.WSPEC_GET-CTLCFTBLƒSPECIFIEDTRIGGERDEVICE-DC.WSPEC_GTL-CTLCFTBLƒSPECIFIEDGOTOLOCAL  PAGEC**************************************************************************TALKER/LISTENER–*******'*ŒCODE/FUNCTIONMENUTABLEJUMPTABLE’**Á*6*†THISTABLECONTAINSTHEADDRESSESOFTHEMENUITEM‰*6*†TABLEFOREACHOFTHEGPIBCIOSFUNCTIONSTHATARE‰*8*†VALIDINTALKER/LISTENERMODE.THISTABLEISINDEXED‡*7*†BYAMATCHIN'IOSCMDTB'.IFANENTRYISZERO,THENˆ*/*†THATMENUISINVALIDINTALK/LISTENERMODE.**Á********µ*******C*******************************************************************#TLCFTBLDC.WINTL_DAT-TLCFTBL‚INPUTDC.WOUTL_DAT-TLCFTBLƒOUTPUT(DC.WOITL_DAT-TLCFTBLƒOUTPUTWITHINPUT%DC.WREQ_STAT-TLCFTBLƒREQUESTSTATUS+DC.WCNFG_DEV-TLCFTBLƒCHANGECONFIGURATION3DC.WCH_DEFLT-TLCFTBLƒCHANGEDEFAULTCONFIGURATIONDC.W0’COMMANDOUT/DATAOUTDC.W0’COMMANDOUT/DATAINDC.W0’COMMANDOUT$DC.WRSEC_TL-TLCFTBL„READSECONDARY%DC.WWSEC_TL-TLCFTBL„WRITESECONDARY!DC.W0’PARALLELPOLLUNCONFIGUREDC.W0’PARALLELPOLLCONFIGUREDC.W0’CONDUCTPARALLELPOLL-DC.WSET_PP-TLCFTBL…SETPARALLELPOLLSTATUS+DC.WSET_SP-TLCFTBL…SETSERIALPOLLSTATUSDC.W0’CONDUCTSERIALPOLLDC.W0’PARALLELPOLLDISABLE&DC.WINTF_CLR-TLCFTBLƒINTERFACECLEARDC.W0’REMOTEENABLEDC.W0’REMOTEDISABLEDC.W0’CLEARALLDEVICES#DC.W0’CLEARALLLISTENINGDEVICESDC.W0’LOCALLOCKOUTDC.W0’PASSCONTROLDC.W0’LISTENERSGOTOLOCALDC.W0’LISTENERSTRIGGER"DC.W0’INTERFACEANDDEVICECLEARDC.W0’UNTALKANDUNLISTENDC.W0’TAKECONTROL%DC.WREQ_CTL-TLCFTBL„REQUESTCONTROLDC.W0’RELEASECONTROLDC.W0’GOTOSTANDBYDC.W0’SPECIFIEDCLEARDEVICEDC.W0’SPECIFIEDREMOTEDEVICE DC.W0’SPECIFIEDTRIGGERDEVICEDC.W0’SPECIFIEDGOTOLOCAL  PAGEC**************************************************************************µ*******!*’CODE/FUNCTIONIOSMATCHTABLE’**Á*6*†THISTABLECONTAINSTHECOMBINEDCODEANDFUNCTION‰*;*†FOREACHCOMMANDAVAILABLEINIOSTOABUSSABLEDEVICE.„*7*†WHENANIOSPARAMETERBLOCKISRECEIVED,THISTABLEˆ*8*†WILLBESCANNEDFORAMATCH.WHENFOUNDTHERELATIVE‡*5*†OFFSETINTHETABLEWILLINDEXINTO'CFMENUTB'TOŠ*:*†POINTTOTHEAPPRIORIATEMENUDRIVERFORTHATFUNCTION…*1*†THESECOMMANDSAREPASSEDINTHEIOSPBINTHEŽ**† PARAMETER'IOSFCT'.¨**Á********µ*******C*******************************************************************IOSCMDTBDC.WIOREAD„INPUTDC.WIOWRIT‡OUTPUTDC.WIOOWIN‡OUTPUTWITHINPUTDC.WIOSTAT‡REQUESTSTATUS!DC.WIOCNFG‡CHANGECONFIGURATION)DC.WIOCHDC‡CHANGEDEFAULTCONFIGURATION!DC.WIOCODO‡COMMANDOUT/DATAOUT DC.WIOCODI‡COMMANDOUT/DATAINDC.WIOCMDO‡COMMANDOUTDC.WIORSEC‡READSECONDARYDC.WIOWSEC‡WRITESECONDARY%DC.WIOPPUˆPARALLELPOLLUNCONFIGURE#DC.WIOPPCˆPARALLELPOLLCONFIGURE"DC.WIOPPOL‡CONDUCTPARALLELPOLL%DC.WIOSPPS‡SETPARALLELPOLLSTATUS#DC.WIOSSPS‡SETSERIALPOLLSTATUS DC.WIOSPOL‡CONDUCTSERIALPOLL!DC.WIOPPDˆPARALLELPOLLDISABLEDC.WIOSIFC‡INTERFACECLEARDC.WIOSREN‡REMOTEENABLEDC.WIOCREN‡REMOTEDISABLEDC.WIOSDCL‡CLEARALLDEVICES(DC.WIOSSDC‡CLEARALLLISTENINGDEVICESDC.WIOSLLO‡LOCALLOCKOUTDC.WIOPCTL‡PASSCONTROL"DC.WIOSGTL‡LISTENERSGOTOLOCALDC.WIOSGET‡LISTENERSTRIGGER'DC.WIOABT1‡INTERFACEANDDEVICECLEAR DC.WIOABT2‡UNTALKANDUNLISTENDC.WIOTCTL‡TAKECONTROLDC.WIORQCL‡REQUESTCONTROLDC.WIORLCL‡RELEASECONTROLDC.WIOGTSˆGOTOSTANDBY#DC.WIODSDC‡SPECIFIEDCLEARDEVICE$DC.WIODREM‡SPECIFIEDREMOTEDEVICE%DC.WIODGET‡SPECIFIEDTRIGGERDEVICE"DC.WIODGTL‡SPECIFIEDGOTOLOCAL*6NUMCMDSEQU(*-IOSCMDTB)/2‚NUMBEROFCOMMANDSINTABLE  PAGEF***********************************************************************.*ŽCOMMANDBUFFER/MODE/ABILITYVALIDATIONTABLE*:*ˆThistableisusedbyVALIDATESandVALOPERtodetermine4*ˆwhethercertainparameters/modesneedbevalidated:*ˆforthedesiredcommand.Thistableisindexedaccording9*ˆtotheindexforIOSCMDTB.Thestructureisasfollows:**ˆ|--|--|--|--|--|--|--|--|*ˆ|7|6|5|4|3|2|1|0|*ˆ|--|--|--|--|--|--|--|--|:*‰|‚|‚|‚|‚|‚|‚|‚|___musthavetalkerability(VALTALK)**=*‰|‚|‚|‚|‚|‚|‚|______musthavelistenerability(VALLIST)**<*‰|‚|‚|‚|‚|‚|_________musthavecontrollerability(VALCTL)C*‰|‚|‚|‚|‚|____________musthavesys.controllerability(VALSCTL)7*‰|‚|‚|‚|_______________musthaveSRQability(VALSRQ)@*‰|‚|‚|__________________validateprimarybufferaddr.(VALPBUF)C*‰|‚|_____________________validatesecondarybufferaddr.(VALSBUF)G*‰|________________________validateconfigurationbuf.addr.(VALCBUF)**ˆ|--|--|--|--|--|--|--|--|*ˆ|15|14|13|12|11|10|9|8|*ˆ|--|--|--|--|--|--|--|--|2*‰|‚|‚|‚|‚|‚|‚|‚|___validintalkermode(VALTMOD)5*‰|‚|‚|‚|‚|‚|‚|______validinlistenermode(VALLMOD):*‰|‚|‚|‚|‚|‚|_________mustbeincontrollermode(VALCMOD)?*‰|‚|‚|‚|‚|____________validonlyforBUSinT/Lmode(VALBTLM) *‰|‚|‚|‚|ŸordeviceonCTLmode.@*‰|‚|‚|‚|_______________validonlyforbussabledevice(VALBDEV)C*‰|‚|‚|__________________commandvalidonlyforBUSitself(VALBUS)?*‰|‚|_____________________validatesecondaryaddress(VALSADR)>*‰|________________________mustbeincharge(control)ofBUS*A*ˆNOTE:‚DONOTCHANGETHEORDEROFBITS0-4BECAUSETHEYDIRECTLY8*CORRESPONDTOTHEATTRIBUTESWORDINTHECONFIGURATION*BLOCKFOREACHDEVICE.*@*…**NOTE:‚THESECAPABILITIESWHENDESIGNATEDINTHETABLEBELOW9*AREWITHRESPECTTOTHEBUS.‚IFTHATPARTICULARCOMMAND9*ISUSEDANDITISDIRECTEDTOWARDSADEVICERATHERTHAN6*THEBUS,THEBITBEINGSETWILLTAKEONITSOPPOSITE3*MEANING.‚THATIS,IF'VALTALK'ISSPECIFIEDFORA:*COMMAND,IFTHECOMMANDISDIRECTEDTOWARDSTHEBUSTHAT8*IMPLIESTHATTHEBUSHASTALKERABILITIES.HOWEVER,IF?*THATSAMECOMMANDWASDIRECTEDTOWARSADEVICE,THE'VALTALK'=*BITIMPLIESTHATTHEDEVICEMUSTHAVELISTENERCAPABILITIES<*BECAUSETHEBUSWILLBETRYINGTOTALKTOIT.THEOPPOSITE**ISALSOTRUEFORTHE'VALLIST'BITALSO.* 3VALPARTBDC.WVALLIST+VALPBUF+VALBTLM+VALLMOD‡INPUT,DC.WVALTMOD+VALTALK+VALPBUF+VALBTLMOUTPUTGDC.WVALTALK+VALLIST+VALPBUF+VALSBUF+VALBTLM+VALTMOD‚OUTPUTWITHINPUTDC.WVA LCBUF§REQUESTSTATUS"DC.WVALCBUF§CHANGECONFIGURATION'DC.WVALCBUF§CHANGEDEF.CONFIGURATION@DC.WVALCTL+VALBUS+VALPBUF+VALSBUF+VALCMOD‰COMMANDOUT/DATAOUT?DC.WVALCTL+VALBUS+VALPBUF+VALSBUF+VALCMOD‰COMMANDOUT/DATAIN/DC.WVALCTL+VALBUS+VALSBUF+VALCMOD‘COMMANDOUT*‚PARAMETERBLOCKELEMENTSIZETABLEFORCONFIGURATIONREQUEST*@****************************************************************PAR_SIZDC.B2…RECORDLENGTHDC.B4ŒDEVICESIZEDC.B4ŒWRITETIMEOUTVALUEDC.B4ŒREADTIMEOUTVALUEDC.B4ŒEORREQUIREMENTSDC.B2ŒEOSWRITE/READCHAR#DC.B1ŒPARALLELPOLLCONFIGURATIONDC.B1ŒPRIMARYADDRESS3DC.B4Œ#OFBYTESINFIXEDWRITE-FORMATTED/IMAGE2DC.B4Œ#OFBYTESINFIXEDREAD-FORMATTED/IMAGE#DC.B4ŒREADSECONDARYADDRESSMASK$DC.B4ŒWRITESECONDARYADDRESSMASK(DC.B8ŒRESERVEDFORLATERUSE/EXPANSIONDC.B0ŒENDOFCONFIGURATION* DS 0=/* =/*†DRVLIB.LF=/*'=/* Link chain file to create DRVLIB.RO.=/* Input modules should all be in SECTION 15.=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to DRVLIB.LL=/*=/IFC \1ƒ=ARGDRVLIB.LL=/ENDIF=/*=LINK„,DRVLIB.RO,\1;HMIXRINPUT DRVLIB.QEVENT.ROIN„DRVLIB.LOGPHY.ROINPUT DRVLIB.SETTIME.ROEND=/*=ENDNNNN NNbHACIADRV‚IDNT45,0…VERSAdosACIAterminaldriverwithtype-ahead12/03/85D‰TTL‚ACIADRV:VERSAdosACIAterminaldriverwithtype-ahead12/03/85 ‰LLENƒ120J**************************************************************************J***************************************************************************9*‰ACIADRV:‚VERSAdosACIAterminaldriverwithtype-ahead.*8*‰Purpose:‚VERSAdosdevicedrivertohandleasynchronous/*terminals(ofanytype)overtheACIAchipon*thefollowingboards:*’DEBUG(EXORmacs),…MVME110**‰Revisionhistory:*7*12/18/85‚InstallNEWKillermodificationwhichleaves,*šTheDriverID(Number)andReason(Number)2*šinCRASHSAValongwiththeCCBandDCBpointers.8*12/17/84‚InterruptroutineandRCAroutinemodifiedto1*špreventtheEDITORfromhanging.‚Wemustdetect5*šend-of-breakbeforecheckingthereceivedcharacter4*šforbit7set(garbagecharacteratend-of-break).6*11/21/84‚Modifiedtheinterruptroutine.‚TheSpecial0*šReceiveConditionroutineisexecutednowonly1*šwhentherehasbeenareceiveinterruptandSRC2*šbitsarepending.‚Thiswillpreventtheterminal/*šfromhangingwhenBREAKispressedtologon.1*10/23/84‚AllBSR'stoTERMLIBnowJSR'sincase.*šTERMLIBislocatedmorethan32Kbytesaway.3*‘9/27/84‚Addingdocumentation,INCLUDE9995files,"*šusingTERM_BREAKinSRCroutine.,*‘9/25/84‚RemovedXREFtoBREAKandGET_LEN.5*‘9/21/84‚ChangedPASS19.MPSCDRV.SAtodriveanACIA.3*‘8/30/84‚FixedSPRconcerningSETUP.‚Commentedout(*šthecodethatteststhemodembit.‚Now**šiftheoffhookbitisset,theDTRline&*šissetlow,‚whetherornotthemodem *šbitisset.9*05/23/84‚ChangedcodethatreferencedthebaudratePIA1*šontheEXORmacstobeexecutedconditionallyif/*šthechanneltypeisa$66ora$67.‚Thiswill(*šallowtheACIADRVtoworkonaVME110.1*šChangedthecodethatresettheACIAtogetthe!*švalueforresetoutoftheCDB.0*šChangedUNSTOProutinetofixbugwhereachark-t=|B„CŒ5”:œA¤F¬L´I¼QÄFÌL(*šisdestroyedintheUSEXOFF/XONmode.2*šChangedGET_STATroutinetotestCTSbitinstead *šofDCDbit.7*08/05/83‚ChangedToDriveAnACIAinsteadofNEC72017*10/19/82‚Majorrepairssothatinterruptswillnotbe3*šdisabledsolongastoscrewupSDLC.‚Revision1.**‘9/16/82‚InitialreleasebySteveFranck.*J**************************************************************************J**************************************************************************‰PAGE****‚XREF'sfromTERMLIB* ‰XREF†LOG_ERR ‰XREF†RESET‰XREF†TERM_INIT‰XREF†TERM_COMMAND‰XREF†TERM_TBE‰XREF†TERM_BREAK‰XREF†TERM_GOT_CHAR **‚Includefilesused....**‰INCLUDE9995.&.STR.EQ*‰INCLUDE9995.&.TCB.EQ*‰INCLUDE9995.&.CCB.EQ*‰INCLUDE9995.&.IOE.EQ*‰INCLUDE9995.&.KILL.MC*‰INCLUDE9995.&.KILLDRV.EQ*‰INCLUDE9995.&.NIO.EQ*‰INCLUDE9995.&.LV5.EQ*‰INCLUDE9995.&.BAB.EQ*‰INCLUDE9995.&.TERMINAL.EQ*‰INCLUDE9995.&.UTILITY.MC*‰INCLUDE9995.&.TERMCCB.EQ* ŠPAGE**‚ACIAequates:* CREG†EQU„0 SREG†EQU„CREG DREG†EQU„2,RDRFBITƒEQU„0’Receivedataregisterfullbit.TDREBITƒEQU„1’Transmitdataregisteremptybit$DCDBIT„EQU„2’DataCarrierDetectbitCTSBIT„EQU„3’ClearToSendbit'OVRNBITƒEQU„5’Receiveddataoverrunbit**%*‰SPECIALEQUATEFORTHEEXORMACSPIA*0BAUDPIAƒEQU„$FEE001ŒBaudratePIAdeviceaddress(*£AddressofPIAonEXORmacsDebugboard#*£tosetthebaudratefortheACIA*ŠNOLISTNNŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.KILL.MCŠINCLUDE9995.&.KILLDRV.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠINCLUDE9995.&.BAB.EQŠINCLUDE9995.&.UTILITY.MCŠLISTŠINCLUDE9995.&.TERMINAL.EQŠINCLUDE9995.&.TERMCCB.EQŠOFFSET‚TERMDDP */*‚DevicedependentBackgroundactivationblocks$*‚NonerequiredfortheACIAdriver.**7RESERVE.1XINTENAB‘Valuetoputincontrolregisterto*§enabletransmitinterrupts. 7RESERVE.1XINTDISA‘Valuetoputincontrolregisterto*§disabletransmitinterrupts. 0RESERVE.1XRTSHI“ValuetomakeRTSlinegoHIGH *ƒfortheMPSCdriver.‚CMRautomaticallyallocatesonepageofA*ƒmemory($100bytes)fortheCCB,andourvariableEXTCCBSZwillB*ƒresideintheCMRparametertableatthebeginningofthedriver8*ƒtotellCMRhowmanyextrapagesofmemoryareneeded.**CCBSIZEBEQU‡*PAGESIZEEQU‡$100L1‡SET‡CCBSIZEB+PAGESIZE-1CCBSIZE‚EQU‡L1/PAGESIZEEXTCCBSZEQU‡CCBSIZE-1;ŠTTL„ACIADRV:‚VERSADOSACIATERMINALDRIVERWITHTYPE-AHEADŠPAGEJ***************************************************************************+*‰SERVICEVECTORTABLE,REVISIONINFO,ETC.*@*‰ThistableisexaminedbyCMRwhenthechannelisallocatedtoC*‰determinewheretogoforinterrupts,commands,&initialization.<*‰Itmustalwaysbeattheverytopofthedrivercode.‚Also>*‰includedisaparametertellingthenumberofextrapagesof>*‰memorytoincludeintheCCB,andinformationdescribingthe*‰revisionofthedriver.*L**************************************************************************** ŠSECTION‚0ŠOPT„BRS ACIADRV: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!*=ŠDC.LƒINTERRUPT-ACIADRV‚Addressofinterruptserviceroutine.9ŠDC.LƒCOMMAND-ACIADRV„Addressofcommandserviceroutine.5ŠDC.LƒINIT-ACIADRV‡Addressofinitializationroutine.ŠDC.Lƒ0’Reserved. **‚OtherCMRparameters.*7ŠDC.BƒEXTCCBSZ‹#ofextrapagesintheCCB.‚TheCCBmay)*§beanysizefrom1to256pages(apage'*§is256bytes):‚ifthisfieldis0,it*§willbe1page,etc.ŠDC.Bƒ0,0,0ŽReserved.ŠDC.Lƒ0,0,0ŽReserved. **‚Revisioninfo:*/ŠDC.Bƒ'121854'‹DateoflastassemblyasMMDDYY.1ŠDC.Bƒ''Spaceindicatesnopatchesto.LOfile.)ŠDC.Bƒ'4'MajorVERSAdosrevisionnumber.*‰PAGE*+*‚JumptableforusebythegenericTERMLIB*‰BRA.L…PUT_CHAR ‰BRA.L…CK_TBE‰BRA.L…DDP_RESET ‰BRA.L…SETUP‰BRA.L…CLOCK_RESET‰BRA.L…GET_STAT‰BRA.L…DDP_STOP‰BRA.L…DDP_UNSTOP‰BRA.L…DDP_BEG_BREAK‰BRA.L…DDP_END _BREAK **‰PAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INITIALIZATIONROUTINE*>*‰ThisroutineiscalledbyCMRwhenthechannelisallocated.9*‰Itspurposeistosetupthingsforcommandserviceand7*‰interruptservice.‚Themajorfunctionsperformedare:"*Validatethechanneltypefield.+*Getmemoryfortransmit&receivequeues..*Initializeflags,pointers,etc.intheCCB.*InitializetheACIA.*@*‰WegotherethroughaJSRfromCMR,andwillexitwithanRTS.>*‰AllregistershavebeensavedbyCMRandmaybeusedfreely.?*‰Entryisatinterruptlevel0,andweareinsupervisormode.**‰Entry:A5=addressofCCB.*'*‰Exitsto:‚CMR(viaRTS)ifallisOK.'*”KILLERifexecwon'tallocatememory.*J**************************************************************************J**************************************************************************J************************************************************************** ŠDS…0 INIT:.‰JSR‡TERM_INIT‹Dothedevice-independentstuff2‰IFƒƒTHEN…SomethingwentwrongwithTERM_INIT.4‰IFƒƒTHEN„Theexeccallfailedandwecannotget!*œthescheduler'sentrypoint!!!-ŽKILL.DRIVERACIADRV_ID,BAD_T_INIT,A5,#NO_DCB‰ELSERTSThechannelisdown!!‰ENDI‰ENDI*?*‚Callguardedforthedevicedependentinitializationroutine.*‰LEA‡DO_INIT(PC),A0‰MOVE.L„#T0GUARD,D0‰TRAP†#0‰RTSŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰COMMANDSERVICEROUTINE*>*‰Wegetenteredherewhentheattachedtask(IOS)invokesCMR?*‰viaaTRAP1withanINITIATEI/Oparameterblocktoprocess.>*‰CMRhasalreadycheckedtheCMRparameterblocktoensureit<*‰resideswithintheaddressspaceoftheattachedtask.‚IOSA*‰hasalreadyvalidatedtheIOCB,exceptforthebufferaddresses *‰therein.*@*‰WegotherethroughaJSRfromCMR,andwillexitwithanRTS.>*‰AllregistershavebeensavedbyCMRandmaybeusedfreely.?*‰Entryisatinterruptlevel0,andweareinsupervisormode.*5*‰Entry:A2=physicaladdressofCMRparameterblock*A5=physicaladdressofCCB*3*‰Exit:‚D0=resultsofparameterblockvalidation:3*•always0inourcase,indicatingitwasOK,since2*•IOSwillnotsendusanyrequestexceptHALTI/O/*•ifwearealreadybusy,andCMRmakesallthe*•otherchecks.*A*‰Note:‚TERMLIBdoesnotrecognizeCMRcommandsforHALT&RESET.B*‰HALTcanstillbeaccomplishedthroughuseoftheHALTI/OIOCB.*J**************************************************************************J**************************************************************************J************************************************************************** COMMAND:‹JSR…TERM_COMMAND‹RTS—returntoCMR.‹PAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INTERRUPTHANDLINGROUTINE*<*‰ThisroutinecompletesI/Orequestsstartedbythecommand:*‰serviceroutine.‚Itisenteredattheinterruptpriority;*‰levelofinterruptsonthischannel,andisessentiallya9*‰subroutinetothefirstlevelinterrupthandlerinCMR.*:*‰Entry:D0,A0,A1havebeensavedbyCMRandareavailable*A5=addressofCCB*9*‰ExitisalwaysviaRTS,whichtakesusbacktoCMR.‚The3*carrybitisexaminedbyCMRtodeterminewhether7*thedriverh andledtheinterruptorwhetheritshould4*passtheinterruptontothenextguyinthechain*onthatvector:*='Ihandledit'**‰Stack:*(A7)+4...*(A7)ƒlongwordreturnaddress*J**************************************************************************J**************************************************************************J************************************************************************** INTERRUPT:0‰MOVE.L„CCBCHB(A5),A1‡STATUS/CONTROLREGADDRESS$‰MOVE.B„SREG(A1),D0‰GETCOPYOFSREG‰IFTHEN.SIFNOINTERRUPT‹AND…#$FFFE,SR‹CLEARCARRY‹RTS‰ENDI ‰PUSH.L„D1’SAVED1 (‰BTST†#RDRFBIT,D0‰TestReceiveregfull.*‰BNE.S…RCA‘Branchifreceivedacharacter. +‰BTST†#OVRNBIT,D0‰Testforreceiveoverrun.‰BNE.S…SRC‘Branchifoverrun. )‰BTST†#DCDBIT,D0ŠTestforDCDtransition.&‰BNE.S…SRC‘BranchifDCD(don'tcare). -‰BTST†#TDREBIT,D0‰Testtransmitbufferempty.%‰BNE.S…TBE‘Branchifbufferisempty. +‰BRA.S…INT_EXITŒShouldnotgethereanyway.ŠPAGEJ***************************************************************************)*‰TRANSMITBUFFEREMPTYINTERRUPTHANDLER*=*‰TheACIA'stransmitbufferjustbecameempty,soifwehave+*‰morecharacterstosendwecandoitnow.**‰Entry:A0=NOTUSED*A1=addressofACIA*A5=addressofCCB*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** TBE:5ŠMOVE.BXINTDISA(A5),CREG(A1)ƒDISABLEXMITINTERRUPTS *%%%%%%%%%%ƒBWN‚9/17/84*F*‚Callthedevice-independentroutinethatdealswithtransparentmode)*‚orinvokestheXMITbackgroundroutine.* ‰JSR‡TERM_TBE ‰BRA‡INT_EXITŠPAGEJ***************************************************************************(*‰RECEIVEDCHARACTERAVAILABLEINTERRUPT*=*‰TheACIAhasjustreceivedacharacter,anditisavailable=*‰forreading.‚Wewilldothatnow,andtheresultwillgoin$*‰thereceivequeueifthere'sroom.**‰Entry:A0=NOTUSED*A1=addressofACIA*A5=addressofCCB*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** RCA:.‰MOVEQ…#$74,D1‰TestPARITY,FRAMING,OVERRUNand‰AND.B…D0,D1‹DCDerrors.&‰BNE.S…SRCBranchifoneoftheabove. 8‰MOVE.BDREG(A1),D0ˆGetthecharfromtheACIAandreset ‰TST.B…GOTBREAK(A5) ‰IFTHEN/‹SFˆGOTBREAK(A5)„Clearerroronlastcharflag./‹TST.B…D0ŽIsthisgarbagecharatend-of-break? ‹BLT‡INT_EXIT‰ENDI *%%%%%%%%%%%%‚BWN9/17/84*C*‚CallthedeviceindependentroutinetocheckfortransparentmodeG*‚anddothestufffortransparentmodeorifnotintranparentmodetoG*‚checkforanyspecialcharacterssuchasXON,XOFF,BREAKEQUIVALENT,G*‚orDISCARDOUTPUT.Otherwise,putthecharacterinthereceivequeue.*‰JSR‡TERM_GOT_CHAR ‰BRA‡INT_EXITŠPAGEJ***************************************************************************%*‰SPECIALRECEIVECONDITIONINTERRUPT*:*‰TheACIAdetectedanerrorintheprocessofreceivinga<*‰character.‚Weneedtorecordthisinformationsothatwhen<*‰thecorrespondingdataisrequestedfromthereceivequeue*‰wecanreportanerror.**‰Entry:A0=NOTUSED*A1=addressofACIA*A5=addressofCCB*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** #SRC:†EQU„*’A1<--addrofourACIA."*£D0<--ourACIAstatusregister.'‰MOVE.B‚DREG(A1),D1ˆD1CONTENTSOFDREG0‰TST.BƒGOTBREAK(A5)‡TESTERRORONLASTCHARFLAG ‰BNE…INT_EXIT ‰BTST†#4,D0"‰IFTHEN.STESTFRAMINGERROR‹ST…GOTBREAK(A5)†SETERRORFLAG3‹JSR„TERM_BREAKˆCall thedeviceindependentroutine*£totakecareofabreak. ‹BRA„INT_EXIT‰ENDI—* ‰BTSTƒ#6,D0ŽTESTPARITYERROR‰IFTHEN.S1‹PUT_BYTEPAR_FRAM,D0„Logaparity/framingerror;‹JSR„LOG_ERRŠ* ‹BRA„INT_EXIT*¢else(notparityorframing)‰ELSE.S‰BTST†#5,D0‹TESTOVERRUNERROR‰IFTHEN.S*‹PUT_BYTEOVERRUN,D0…Loganoverrunerror.‹JSR„LOG_ERRŠ* ‹BRA„INT_EXIT‰ENDI–*‰ENDI2‰BRA„INT_EXIT‹Exit.MUSTHAVEBEENDCD.DONTCARE.‰NOP‰PAGE*E*‚Nowexitasfromaninterrupt.‚WemayinfacthavebeencalledfromF*‚commandserviceorinitialization,buttheyhadtosetituptolook*‚likeaninterrupt,too.*INT_EXIT:POP.L‚D1‘RestoreD1,7ŠMOVEQ‚#1,D0ŽsetcarrybittotellCMR'wehandledit,' ŠSUBQƒ#2,D0Ž*ŠRTS—andreturn.ŠPAGEO********************************************************************************2*‰ROUTINESTOSETTHECLOCKDIVISORTOx16ANDx64*7*‰NoworkheresinceACIAcannotsettheclockdivisor.*=*‰WemusthaveaCLOCKRESETentrypointforTERMLIB,however.**‰Entry:*‹A1ƒ=*‹A5ƒ=addrofourCCB.**‰Exit:*O******************************************************************************* CLOCK_RESET:ŠRTSŠPAGEK*****************************************************************************!*ROUTINES„CALLED„BY**–TERMLIB**F**********************************************************************‰PAGEL******************************************************************************ˆTRANSMITTHECHARACTER*?*ˆThisisthedevicedependentroutinethatactuallywritesthe*ˆcharactertothedevice.*F*ˆTheoffsettothisroutinemustbeinstalledatthebeginningofthe *ˆdriver.**ˆEntry:„A1=addressofACIA*’A5=addressofCCB*’D0.B=charactertotransmit*ˆInterruptlevelonentry:0*C*ˆExit:…Allregistersarepreserved,includingthestatusregister.<*’Itisimportanttokeeptheinterruptlevelthesameasit*’wasuponentry.*J************************************************************************** PUT_CHAR:‰PUSHƒSR‰INHIBIT1‰MOVE.BD0,DREG(A1)ˆOtherwise,transmitthechar./‰MOVE.BXINTENAB(A5),CREG(A1)‚ENABLEXMITINTS.‰POP„SR‰RTS‰PAGEM******************************************************************************$*ˆCHECKTHEDEVICE'STRANSMITBUFFER*F*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledat*ˆthebeginningofthedriver.**ˆEntry:A1=addressofACIA*A5=addressofCCB*ˆInterruptlevelonentry:0**ˆExit:‚Conditioncodes:"*=transmitbuffernotempty*=transmitbufferempty<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.*M*****************************************************************************CK_TBE:A‰BTST.B#TDREBIT,SREG(A1)‚IfACIA'stransmitbufferisnotempty,‰RTS‰PAGEH************************************************************************* *ˆDEVICEDEPENDENTRESETROUTINE*9*ˆThisisthedevice-dependentpartoftheresetroutine.*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.**ˆEntry:A5=addrofCCB*ˆInterruptlevelonentry:0*$*ˆExit:‚Allregistersarepreserved.<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.*E********************************************************************* DDP_RESET:*A*‚ACIAdidnothaveanydevicedependentresetstuffintheRESET:*‚routine,whichiswherethisstuffwouldhavecomefrom.* ŠRTS—exit.ŠPAGEJ***************************************************************************@*‰SUBROUTINETOSETUPTHEDEVICEACCORDINGTOTHECONFIGURATION*;*‰Usestheworkingconfiguration(intheCCB)tosetupthe;*‰device,andsomeconfiguration-relatedfieldsintheCCB.*?*‰Theoffsettothisroutinemustbeinstalledatthebeginning*‰ofthedriver.**‰Entry:A5=addressofCCB*‰In terruptlevelonentry:0*$*‰Exit:‚Allregistersarepreserved.<*‰Itisimportanttokeeptheinterruptlevelthesameasit*‰wasuponentry.*J************************************************************************** SETUP:<ŠMOVEM.LD0-D1/A0-A3,-(A7)Savesomeregistersonthestack. ŠPUSHƒSR **‚Firstsetupaddresses.*4ŠLEA„CONFIG(A5),A0†A0<--addrofCCBconfiguration.3ŠMOVE.LCCBCHB(A5),A1†A1<--addrofourACIAport.**‚[4]„x16clockrate,(*‰stopbits&parityfromconfiguration.*)ŠMOVE.Bƒ#1,D0ŒStartwithx16clockinD0. )‰BTSTWƒ#IOABITS,IOSATW(A0)ƒTESTBITS/CHAR‰IFTHEN.SIF8THEN‹OR.Bƒ#$10,D0Œ(8bits/char)>‹BTSTW‚#IOAUSEP,IOSATW(A0)Ifwe'reusingparity,enableit... ‹IF…THEN OR.Bƒ#$08,D09BTSTW‚#IOAPRTY,IOSATW(A0)andifwe'reusingoddparity,IF…THENŠsetitup. OR.Bƒ#$04,D0ENDI‹ELSE.S•8BITSNOPARITY)BTSTW‚#IOASTPB,IOSATW(A0)ƒTESTSTOPBITSIFTHEN.SIF1THEN OR.Wƒ#$04,D0ENDI‹ENDIƒPAGE‰ELSE.S˜ELSE7THEN)‹BTSTW„#IOASTPB,IOSATW(A0)„TESTSTOPBITS‹IFTHEN.SOR.Wƒ#$08,D0IF1‹ENDI&‹BTSTW„#IOAPRTY,IOSATW(A0)ƒTESTPARITY‹IFTHEN.S‘IFODDTHEN OR.W„#$04,D0‹ENDI‰ENDI "*§TransmitterintdisabledDTRlow /ŠOR.B…#$80,D0ŽRecieve,Overrun,DCD‚Int'sEnabled‰INHIBITŠMOVE.BƒD0,(A1)‰POP‡SR9ŠMOVE.BƒD0,XINTDISA(A5)†SAVECONTREG(XMITINTDISABLED) ŠOR.B…#$20,D08ŠMOVE.BƒD0,XINTENAB(A5)…SAVECONTREG(XMITINTENABLED):ŠAND.B„#%10011111,D0„Clearbits5and6forsettingupRTS*ŠOR.B…#%01000000,D0„SetRTSbitforaHIGHŠMOVE.BƒD0,XRTSHI(A5)**‚Setupbaudrate*G‰IF.BCCBTYPE(A5)#$66OR.BCCBTYPE(A5)#$67THEN.SKG052384.‹MOVE.B„IOSBRT(A0),D0‡Theconfiguredbaudrate‹PUT_BYTE‚$F0,D1ŽMask!‹BTST†#0,CCBTYPE(A5)†Asideport?‹IFTHEN.S LSL.B…#4,D0PUT_BYTE‚$0F,D1‹ENDI2‹AND.B…D1,BAUDPIA…Clearoldbaudrate…KEG05/23/842‹OR.B†D0,BAUDPIA…Insertnewbaudrate„KEG05/23/84‰ENDI **‚Restoreregistersandreturn.*8ŠMOVEM.L(A7)+,D0-D1/A0-A3Restoreregistersfromstack.ŠRTSŠPAGEJ****************************************************************************‰GETDEVICESTATUSBYTE*"*‰PreparestheDEVICESTATUSbyte.*8*‰Note:‚thisroutinedoesnotsetthebreakindicatorin*thedevicestatusbyte.*?*‰Theoffsettothisroutinemustbeinstalledatthebeginning*‰ofthedriver.**‰Entry:A5=addressofCCB*‰Interruptlevelonentry:0*&*‰Exit:‚D0.B=thedevicestatusbyte.<*‰Itisimportanttokeeptheinterruptlevelthesameasit*‰wasuponentry.*J************************************************************************** GET_STAT: ŠCLR.B‚D0 ŠPUSH.LA0ŠMOVE.LƒCCBCHB(A5),A00ŠBTST…#CTSBIT,SREG(A0)„TESTCTSBITŒKEG05/23/84ŠIFTHEN.S'ŒBSETƒ#XDSNRB,D0ŠDATASETNOTREADYBITŠENDI ŠPOP.L‚A0 ŠRTS—Return.ŠPAGEM******************************************************************************5*ˆDEVICEDEPENDENTSTUFFFORLOWERINGAHARDWARELINE*ˆTOSTOPTHETRANSMITTER.*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.**ˆEntry:‚A1=addressofACIA*A5=addressofCCB3*ˆInterruptlevelonentry:INHIBITEDatourlevel.*$*ˆExit:ƒAllregistersarepreserved.*K*************************************************************************** DDP_STOP:DŠMOVE.BXRTSHI(A5),CREG(A1)MakeRTSgoHIGHtostopthetransmitter*¤KEG05/23/84ŠRTS‰PAGEK****************************************************************************$*ˆDEVICEDEPENDENTUNSTOPTHEDEVICE*=*ˆWhenwearenotusingXOFF/XON,weunstopthedeviceinour*ˆowndevicedependentway.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.**ˆEntry:‚A1=addressofACIA*A5=addressoftheCCB3*ˆInterruptlevelonentry:INHIBITEDatourlevel.*$*ˆExit :ƒAllregistersarepreserved.*J************************************************************************** DDP_UNSTOP:CŠMOVE.BXINTENAB(A5),CREG(A1)MakeRTSgoLOWtoenabletransmitter*¦KEG05/23/84ŠRTSŠPAGEK****************************************************************************&*ˆDEVICEDEPENDENTBEGINBREAKROUTINE*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.**ˆEntry:‚A1=addrofACIA*A5=addrofCCB3*ˆInterruptlevelonentry:INHIBITEDatourlevel.*$*ˆExit:ƒAllregistersarepreserved.*E********************************************************************* DDP_BEG_BREAK:‰SAVEƒD08‰MOVE.BXINTDISA(A5),D0„D0<--imageofACIACONTROLREG,‰OR.Bƒ#$60,D0ŒAddbitstosendbreaksignal.‰MOVE.BD0,CREG(A1)ˆ* ‰RESTORED0‰RTS‰PAGEK****************************************************************************$*ˆDEVICEDEPENDENTENDBREAKROUTINE*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.**ˆEntry:‚A1=addrofACIA*A5=addrofCCB3*ˆInterruptlevelonentry:INHIBITEDatourlevel.*$*ˆExit:ƒAllregistersarepreserved.*L**************************************************************************** DDP_END_BREAK:.‰MOVE.B‚XINTENAB(A5),CREG(A1)ƒENABLEXMITINT.‰RTS‰PAGEI***************************************************************************“BACKGROUND**šAND**‘CALL__GUARDED**–ROUTINES**•(DEVICE-DEPENDENT)*E*********************************************************************ŠPAGEO*********************************************************************************‰FINISHOFFTHEINITIALIZATION*A*‰Theinitializationroutinehasgonearoundresettingeverything@*‰itcan,buttheroutinesRESETandSETUPshouldonlybecalled>*‰fromwithinthebackground.‚Soheinvokedthisroutinetodo *‰itforhim.**‰Entry:*A5=addressofCCB.*O******************************************************************************* DO_INIT:**‚Inhibitinterrupts*‰PUSH†SR‰INHIBIT*)*‚GetaddressofstartofdriverintoCCB*‰LEA‡ACIADRV(PC),A4‰MOVE.L„A4,DRV_ADDR(A5)*0*‚NowactuallydotheminimumsetupontheACIA.*.ŠMOVE.LCCBCHB(A5),A1†A1<--addrofourACIA.4ŠMOVE.BCCBRESV(A5),CREG(A1)ResetourACIAchannel. ŠJSR„RESETŽReseteverything.ŠBSR.L‚DDP_RESET5ŠBSR.L‚SETUPŽSetuptheACIAaccordingtotheconfig.**‚Enableinterruptsnow.*‰POP‡SR‰RTS‰PAGE*********************** *‚PATCHSPACE***********************ŠDS.Wƒ30ŠEND  N‰PAGE7DISKLIB‚IDNT†45,0†VERSAdosdiskdrivergenericroutines3‰TTL‡DISKLIB:‚VERSAdosdiskdrivergenericroutines ‰LLEN†120 ‰OPT‡CRE,PCS,BRSO*******************************************************************************O*******************************************************************************O********************************************************************************(*‰DISKLIB:‚VERSAdosDisk‚Driver‚Routines*7*‰Purpose:‚Acollectionofdiskdriverroutinesusedto *“supportthefollowingdrivers: *œM320DRV *œRWINDRV *œM420DRV *œVM22DRV *œSCSIDRV *œM360DRV**‰Revisionhistory:<*10/08/85‚ExtractedfromVERSAdos4.4releaseofRWINDRV.SA=*11/26/85‚AddedcodeforextendedconfigurationblockR.E.M.7*12/05/85‚InstallNEWKillermodificationwhichleaves,*šTheDriverID(Number)andReason(Number)2*šinCRASHSAValongwiththeCCBandDCBpointers.:*12/11/85‚AddedCHK_PARAMcalltoalldiskdriversR.E.M.**‰Othernotes:0*ThiscodeisROMab leandposition-independent.*O*******************************************************************************O*******************************************************************************O*******************************************************************************  * *‚INCLUDES***ˆ9995.&.IOE.EQ*ˆ9995.&.STR.EQ*ˆ9995.&.TCB.EQ*ˆ9995.&.NIO.EQ*ˆ9995.&.LV5.EQ*ˆ9995.&.CCB.EQ*ˆ9995.&.DISK.EQ*ˆ9995.&.UTILITY.MC*ˆ9995.&.DISKCCB.EQ*ˆ9995.&.DISKMEM.EQ*ˆ9995.&.KILL.MC*ˆ9995.&.KILLDRV.EQ*‰NOLIST‰INCLUDEƒ9995.&.IOE.EQ‰INCLUDEƒ9995.&.STR.EQ‰INCLUDEƒ9995.&.TCB.EQ‰INCLUDEƒ9995.&.NIO.EQ‰INCLUDEƒ9995.&.LV5.EQ‰INCLUDEƒ9995.&.CCB.EQ‰INCLUDEƒ9995.&.DISK.EQ‰INCLUDEƒ9995.&.UTILITY.MC‰INCLUDEƒ9995.&.DISKCCB.EQ‰INCLUDEƒ9995.&.DISKMEM.EQ‰INCLUDEƒ9995.&.KILL.MC‰INCLUDEƒ9995.&.KILLDRV.EQ‰LIST‰PAGEÍÔEÝNå=í@õ>ýI- :@7%2-;5:=8E1M;U5]1e+m1u5}+…20•42¥.­4µ9½<O********************************************************************************1*ƒEQUATESANDMACROSFORTHEGENERICDISKLIBRARY*O*********************************************************************************@*ƒOFFSETTOMARKTHEENDOFTHESERVICEVECTORTABLEINADRIVER*SERVECT‚EQU‡$28*=*‚ADRIVERTHATWISHESTOUSEDISKLIBMUSTHAVETHEFOLLOWING>*‚BRANCHTABLEIMMEDIATELYFOLLOWINGTHESERVICEVECTORTABLE:**†BRA.L‡SET_CNFG*†BRA.L‡SET_CODE*†BRA.L‡CHK_FLOPPY*†BRA.L‡CHK_LSN*†BRA.L‡BLD_PACKET*†BRA.L‡DISK_START*†BRA.L‡CHK_PARAM*‰OFFSET„SERVECTT_SET_CNFG‰DS.L†1T_SET_CODE‰DS.L†1T_CHK_FLOPPY‡DS.L†1T_CHK_LSNŠDS.L†1T_BLD_PACKET‡DS.L†1T_DISK_START‡DS.L†1T_CHK_PARAMˆDS.L†1** O********************************************************************************>*ƒMACROTOPERFORMTHEJUMPTOthedeviceDEPENDENTSUBROUTINE**ƒAssumption:‚None.**ƒCalledby:ƒT_JSR‚ROUTINE*2*‰where‚T_ROUTINEisanoffsetintheabovetable.*O******************************************************************************** T_JSR„MACRO ‰IFC'\1','' ŒFAIL‚400ŒMEXIT‰ENDC‰MOVE.LA4,-(SP)‰MOVE.LDRV_ADDR(A5),A4 ‰JSR„T_\1(A4)‰MOVE.L(SP)+,A4‰ENDM‰PAGEO********************************************************************************2*ƒDescriptionsoftheroutinesrequiredbyDISKLIB*O*******************************************************************************  N*******************************************************************************)*ˆSET_CNFG…SETUPFORACONFIGURECOMMAND*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoD*ˆsetthefields'sinthedrive'svariableblock,device-independent#*ˆportion,foraconfigurecommand.**A*ˆEntry:A1=pointertoDrive'sVariableBlockinglobalmemory.#*A5=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™A„P‡P* *ˆCalls:none*/*ˆExit:‚RTStocallerwithconditioncodesset:7*‚Drive/controllersupportstheconfigurerequest.?*‚Drive/controllerdoesnotsupporttheconfigurerequest.4*•D1.B=VERSAdoserrorcodefortheerrordetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N******************************************************************************‰PAGEN******************************************************************************* *ˆSET_CODE*F*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledatE*ˆthebeginningofthedriver.‚ThefunctionofthisroutineistosetD*ˆanymedia‚and/or‚driverelatedcodesinthedriv e'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******************************************************************************‰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******************************************************************************‰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******************************************************************************‰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******************************************************************************‰PAGEN******************************************************************************* *ˆDISK_START*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledE*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto:*8*Š1.‚Performdevice-dependentcodetostartthecommand.**D*ˆEntry:A1=addressofthedrivesvariableblockinglobalmemory.#*A5=physicaladdressoftheCCB.*=*Interruptlevelonentryisatourhardwarelevel(masked). *!*ˆRegisterusage:…01234567*™D*™A„P‡P* *ˆCalls:none**ˆExit:‚RTStocaller.*N******************************************************************************‰PAGEN********************************************************************************ˆCHK_PARAMROUTINE*C*ˆThisisa‚devicedependent‚routinewhose‚offsetmust‚beinstalledD*ˆatthebeginningofthedriver.The‚functionof‚thisroutine‚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******************************************************************************‰PAGEO********************************************************************************;*ƒDEVICE-DEPENDENTROUTINES‚THATARENOTCALLEDBYDISKLIB,9*ƒBUTNEVERTHELESSNEEDTODOCERTAINTHINGSFORDISKLIB.*O*********************************************************************************INIT:>*…ThisistheentrypointforanINITIALIZATIONcallfromCMR.*‰INITmustdothefollowing:*6*ŽPutthestartingaddressofthedriverintotheCCB:*LEA…MY_DRVR(PC),A0*MOVE.L‚A0,DRV_ADDR(A5)*4*ŽPutthenumberofdevicescontrolledintotheCCB:*MOVE.L‚#DRIVES,MAX_DRVS(A5)*(*ŽPutthedriveblocksizeintotheCCB:*MOVE.L‚#DRVBLKSZ,DRV_SIZE(A5)**‘....**“RTSO*******************************************************************************‰PAGE** *‚XREF's.**C*‚ThisXREFisfromthedriverlibraryDRVLIB.ROwhichislinkedin*‚atSYSgentime.*0‰XREF†LOGPHYŽConvertlogicaladdresstophysical6‰XREF†I_NRM_QEVENTˆQueueanormalI/Ocompletionevent*¦frominterrupthandler6‰XREF†N_NRM_QEVENTˆQueueanormalI/Ocompletionevent*¦fromcommandlevel.**I*‚TheseXREF'sarefromtheDSKTYPEmodule,tableofvaliddiskchannels.*5‰XREF†CH_TYPESŒChanneltypesfordiskdrivers(table)0‰XREF†NUMTYPESŒNumberofsupportedchanneltypes5‰XREF†NUMBYTESŒNumberofbytesberentryinthetable *(*‚XDEF'Sforthedevice-dependentmodule*2‰XDEF†DISK_INIT‹Device-independentinitialization.6‰XDEF†DISK_COMMANDˆDevice-independentcommandhandler.-‰XDEF†CHAN_DONE‹Interruptcompletionroutine..‰XDEF†LSN2CHSConvertlogicalsectornumberto$*§Cylinder-Head-Sectorwithintrack.5‰XDEF†LOGPHY1Logical-to-physicaladdressconversion.  ‰SECTION14DISKLIB: **‚Identificationmnemonic*‰DC.B†'!DISKLIB'**‚Revisioninfo:*/ŠDC.Bƒ'121185'‹DateoflastassemblyasMMDDYY.1ŠDC.Bƒ''Spaceindicatesnopatchesto.LOfile.)ŠDC.Bƒ'4'MajorVERSAdosrevisionnumber.*ŠPAGEO*********************************************************************************‰NOTESONCODINGSTANDARDS*O******************************************************************************* G*‚BecausethisisanI/Odriver,speedisoftheutmostimportance,andG*‚asaresulttradeoffsweremadedecreasingthestraightforwardnessofL*‚thecodeinfavoroflesstimespentprocessinginterrupts.‚Inparticular,F*‚theinterruptserviceportionofthisdriverisnotatallmodular--H*‚some'routines'havemultipleentryandexitpoints,andreturnisnot*‚alwaystothecaller.*G*‚OnevisualaidusedwhichmaysaveyousomeworkistheuseoflabelsD*‚inexecutablecode.‚Considerthefollowingsampleprogramsegment:*.*‰LABEL1:˜ labelaloneonline,followedby':'*‘MOVE.B......7*‰LABEL2:ADD.B‚......Šlabelnotalone,followedby':'-*‰LABEL3‚CMP.B‚......Šlabelnotalone,no':'*F*‚Eachwayofwritingthelabelhasitsownsignificance.‚LABEL1marksC*‚thebeginningofalogicalmodule,andnothingfallsintoLABEL1.G*‚LABEL2isalabelbranchedtofromoutsidethelogicalmodule.‚LABEL3F*‚isa'local'label,branchedtoonlyfromwithinthelogicalmodule.  >*‚Foreachsubroutine,registerusageisspecifiedasfollows:**‰Entry:A5=addressofCCB**‰Exit:‚A0=garbage(*A1=addressofoursideofthedevice*G*‚TheentryconditionsspecifyonlytheREQUIREMENTSoftheroutine.‚InI*‚otherwords,aregistermaybeknowntocontainaparticularvalue,butI*‚ifitisnotusedbyaroutine,itisnotlistedasanentrycondition.J*‚TheexitconditionslistonlythoseregisterswhichCHANGE.‚IntheaboveH*‚example,thefactthatA5isnotlistedasanexitconditionindicates"*‚thatitstillpointstotheCCB.*J*‚Ifamoduledoesnotrepresentasubroutine(thatis,willnotreturntoK*‚thecodeitwasenteredfrom),theexitconditionsfortheregisterswill*‚notbespecified.ŠPAGEJ****************************************************************************‰COMMANDSWITCHINGTABLE*:*‰Theseareusedbythecommandserviceroutinetojumpto.*‰theappropriateroutinetohandleacommand.*J************************************************************************** ŠDS…0 CMDSWIT: 3‰DC.W…READCMD-*-4ŒThereadcommandtellsthedriver2‰DC.W…IOREADtoreaddatafromadiskintomemory. 5‰DC.W…WRITECMD-*-4‹Thewritecommandtellsthedriver1‰DC.W…IOWRITtowritedatafrommemorytoadisk. 5‰DC.W…STATCMD-*-4ŒThestatuscommandtellsthedriver-‰DC.W…IOSTATtoreturnthecurrentstatusand *¦configurationofadiskdrive. 7‰DC.W…CONFIG-*-4Theconfigurecommandtellsthedriver3‰DC.W…IOCNFGtochangethecurrentconfigurationof*¦adiskdrive. 3‰DC.W…DFCONFIG-*-4‹Thechangedefaultconfiguration3‰DC.W…IOCHDCcommandtellsthedrivertochangethe(*¦defaultconfigurationofadiskdrive. 4‰DC.W…FORMAT-*-4Theformatcommandtellsthedriver*‰DC.W…IOFRMTtoformatanentirediskora*¦particulartrackofadisk. ‰DC.W…0”Endofswitchingtable.‰PAGEO*******************************************************************************O*******************************************************************************O*********************************************************************************ˆINITIALIZATIONROUTINE*B*ˆThis‚subroutineiscalledfromthedevice-dependentdriverafterA*ˆitreceivesaninitializationcallfromCMR.‚It'spurposeisto?*ˆsetthingsupforcommandserviceandinterruptservice.‚It's*ˆspecificfunctionsare:**Š1.Validatethechanneltype.>*Š2.Allocateglobalmemoryforthedrive'svariableblockand**storethestartingaddressintotheCCB.*:*ˆEntryisthroughaJSRfromthedevice-dependentmodule.?*ˆEntryisatinterruptlevel0,andweareinsupervisormode.*%*ˆEntry:„A6=physicaladdressofTCB*’A5=physicaladdressofCCB*!*ˆRegisterusage:ˆ01234567*œD‚**œA‚*‰P*D*ˆExit:…RTStothedevice-dependentmodulewithconditioncodesset: *”and‚channelisdown.$*”‹memoryallocationhasfailed./*”‹allwentwell,OKtoproceedwithdevice*£dependentI/O.*O*******************************************************************************O*******************************************************************************O******************************************************************************* ‰SECTIONƒ14‰DSˆ0 DISK_INIT:*F*‚Checkthechanneltypefieldwearesupposedtobetomakesureit's*‚atypethisdriverhandles.*/ŠMOVE.BCCBTYPE(A5),D0…D0<--ourchanneltype.7ŠLEA„CH_TYPES,A0ˆA0<--addroftableofcha nneltypes. ŠFOR.W…D1=#1‚TO‚#NUMTYPESƒDOŒCMP.Bƒ(A0)+,D0 ŒBEQ‡CH_FOUNDŒADD.L…#NUMBYTES-1,A0ŠENDF*%*„BADCHANNELTYPE!!!„SENDBACK*A‰MOVE.B#ISTAICE,CHANDOWN(A5)‚ReturnIndeterminateChannelError.)‰MOVE.B„#-1,D0‹Setconditioncodeto#‰RTS˜andreturntocallingroutine.‰PAGE**…GOODCHANNELTYPE!!!*CH_FOUND*=*‚Wegotherebecausewefoundthechanneltypeinthetable.B*‚WecannotvalidatetheDeviceCodebecausewedonothaveenoughH*‚informationyet.‚TheDeviceCodeischeckedatCONFIGUREcommandtime.* *M*‚WenowallocateglobalmemoryforallofthedrivevariableblocksbasedonK*„1)thenumberofdevicesSYSGEN'edinforthedevice-dependentdriverand5*„2)thesizeofonedrivevariableblock(DRV_SIZE).*A‰MOVE.W„MAX_DRVS(A5),D0‚D0<--numberofdrivesforthischannel.9‰MULU†DRV_SIZE(A5),D0‚TotalspacerequiredforallDVB's.<‰ADD.W…#PAGESIZE-1,D0ƒConverttoanintegralnumberofpages)‰LSR.W…#8,D0Œtoallocatephysicalmemory.‰MOVEA.WƒD0,A0 ‰MOVE.L„#4,D0‰TRAP†#0Allocatememory.‰BRA.S…INIT100ŠGoodreturn.,‰BRA.S…INIT150ŠMemoryallocationhasfailed. 7INIT100‚MOVE.L„A0,DVBPTR(A5)„SavethestartoftheDVB.*,*‚Clearthedrivevariableblockarea(DVB):*8‰MULU†#PAGESIZE,D2…D2isreturnedasthenumberofpages4‰ADD.L…D2,A0Œthatwereallocated.‚A0issetuptothe3‰LSR.W…#2,D2Œendofglobalmemory.‚D2issetupasa,‰SUB.W…#1,D2Œcounteroflongwordstoclear. -CLRDVBƒCLR.L…-(A0)ŒCleartheDVBmemoryarea.‰DBRA†D2,CLRDVB ‰MOVE.B„#0,D0ŒReturn.‰RTS .INIT150‚STˆCHANDOWN(A5)…Markthechanneldown.‰MOVE.B„#1,D0ŒReturn.‰RTS‰PAGEO*******************************************************************************O*******************************************************************************O*********************************************************************************ˆCOMMANDSERVICEROUTINE*B*ˆThissubroutineiscalled‚fromthedevice-dependent‚driverafterD*ˆitreceivesacommandtoinitiateanI/OtransactionwithadeviceB*ˆthatiscontrolledbythatdriver.‚Thepurpose‚ofthismoduleis@*ˆtoperformthe‚commontasks‚thatare‚necessaryfor‚allcommand@*ˆroutines,andto‚directcontrol‚tothe‚individualroutine‚thatB*ˆprocessesthegivencommand‚throughthecommandswitching‚table.*5*ˆEntry:„A2=physicaladdressofCMRparameterblock*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*"*ˆRegistersusage:„01234567 *™D‚***…RR*™A‚*RPRRPP*@*ˆEXIT:…A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’D6=Channeldevice#*9*ˆExitsto:Theroutinethatprocessesthegivencommand.*O*******************************************************************************O*******************************************************************************O******************************************************************************* DISK_COMMAND: 6‰MOVE.LƒSP,SAVESP(A5)ŠSavethestackpointersowecan$*¦laterabortatanylevelofnested$*¦subroutinesandeasilyrestorethe%*¦stackenvironmentthatexistedwhen*¦thisroutinebeganexecution. :‰MOVE.LƒXIOCPK(A2),D6ŠGetthephysicaladdressoftheIOCB2‰MOVEQ.L‚#0,D5forthecommandintoA4.‚Subroutine7‰MOVE.WƒXIOPLN(A2),D5ˆLOGPHY1convertsthelogicalIOCB?‰MOVE.LƒCCBTASKA(A5),A0†address(inD6)intoaphysicaladdress)‰BSR.L„LOGPHY1Žforus.‚SubroutineLOGPHY11‰MOVE.LƒD6,A4returnsthephysicaladdressofthe *¦IOCBinD6. 9‰MOVE.LƒXIOUID(A2),A3ŠGetthephysicaladdressoftheDCB2‰MOVEQ.L‚#0,D6intoA3,andgetthechanneldevice;‰MOVE.BƒDCBCDV(A3),D6ˆnumberintoD6.‚Thesevaluesindicate&*¦theparticulardevicethatshouldbe*¦accessedbythecommand.‰PAGE8‰MOVEQIƒISTACDN,D1Ifthediskchannelisdown,goqueue:‰TST.B„CHANDOWN(A5)‰aneventtotheattachedtasktoindi-8‰BNE.S„C MDEXIT2catethatthechannelisoutofservice. 8‰MOVE.LƒDVBPTR(A5),A1ˆSetupA1topointtothevariable>‰MOVE.WƒDRV_SIZE(A5),D0†blockforthediskdrivethatistobe-‰MULU…D6,D0accessedbythecommand.‚Thedisk1‰ADD.L„D0,A1drivevariableblock'sareinglobal%*¦memory,andtheparticularvariable#*¦blockisindicatedbythedrive's!*¦channeldevicenumber.‚Thecode&*¦heredependsonthefactthatglobal#*¦memoryisorganizedintoparallel)*¦variableblockswithonevariableblock *¦foreachdriveonthechannel.  7‰MOVE.WƒIOSFCT(A4),D0ŠNowpreparetosearchthecommand;‰LEA†CMDSWIT(PC),A0‡switchingtableforthecommandthatis6‰MOVEQIƒISTAIF,D1ŒspecifiedbytheIOSFCTfieldofthe$*¦IOCB.‚WeputtheIOSFCTvalueinto%*¦D0.W,andweputtheaddressofthe(*¦switchingtableintoA0.‚Wealsoputa$*¦statuscodeintoD1.B.‚Thisstatus'*¦codewillbeusedifthegivenIOSFCT%*¦valuedoesn'tcorrespondtoavalid*¦commandcode.  4L0030„MOVE.Wƒ(A0)+,D2Thisloopsearchesthecommand7‰BEQ.S„CMDEXIT2switchingtabletoseeifwecanfinda6‰CMP.W„(A0)+,D0matchfortheIOSFCTvalueinD0.W.‚If4‰BNE.S„L0030wereachtheend-of-tablesentinelword)*¦withoutfindingamatch,wegoqueuean&*¦eventtotelltheattachedtaskthat)*¦we'vereceivedaninvalidcommandcode.&*¦Otherwise,wesetupD2.Wtocontain&*¦theswitchingoffsetfortheroutine!*¦thathandlesthegivencommand.  8‰JMP†0(A0,D2.W)‹Transfercontroltothecommandroutine.‰PAGEO*******************************************************************************O*********************************************************************************ˆSTATUSCOMMANDROUTINE*G*ˆThecommandserviceprocessorinvokestheSTATCMDroutineinresponseE*ˆtoastatuscommand.‚Itspurpose‚istosetuptheusertask'spara-E*ˆmeterblocktoreflectthe‚drive'scurrentstatusandconfiguration=*ˆbasedontheconfigureblockinthedrive'svariableblock.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask**’D5=03*’D6=Channeldevice#forthediskdrive(DCBCDV)*!*ˆRegisterusage:…01234567 *™D‚*‰** *™A‚*P*ƒPP**ˆCalls:„STATCONF*7*ˆExit:…Fallsthroughtocommonexitroutine(CMDEXIT).*O*******************************************************************************O******************************************************************************* STATCMD: :EQ170„EQU†CONFGBLK+IOSATWˆSetupA2topointtotheIOSATW+‰LEA†EQ170(A1),A2‰fieldinthedriveblock. 2‰BSR.S„STATCONFSetIOSDST,IOSCTP,IOSDTP,IOSDRC%*¦intheusertask's‚parameterblock. :‰MOVE.WƒREC_ATT(A1),(A0)+†SettheIOSATMandIOSPRMfields=‰MOVE.WƒREC_PAR(A1),(A0)+„intheusertask'sstatusparameter%*¦block.‚Themaskscontainallofthe!*¦bitssignificanttothedriver. 8EQ120„EQU†IOSDLN-IOSATWŠChecktomakesuretheconfigure6EQ121„EQU†EQ120/2Žblockcontainsanintegralnumberof6EQ122„EQU†EQ121*2Žwords.Generateanassemblyerrorif.‰IFNE…EQ120-EQ122Šthisassumptionisnottrue.‰FAIL…0‰ENDC ?EQ1120ƒEQU†IOSEATM-IOSATW‡SetequatestocopyparametersfieldsEQ1121ƒEQU†EQ1120/2 :‰MOVEQWƒEQ1121-1,D0‹Copythedrive'scurrentconfiguration?L0130„MOVE.Wƒ(A2)+,(A0)+Švaluesfromtheconfigureblockinthe6‰DBRA…D0,L0130CCBtotheusertask'sstatusparablk.)*¦Thisportioncopiesonlytheparameters*¦uptoIOSEATM.‰PAGE<‰MOVE.WƒREC_XAT(A1),(A0)+†SettheIOSEATMandIOSEPRMfields=‰MOVE.WƒREC_XPR(A1),(A0)+„intheusertask'sstatusparameter%*¦block.‚Themaskscontainallofthe!*¦bitssignificanttothedriver. AEQ1122ƒEQU†IOSEATW-IOSEATM†Setthepointerintheconfigureblock8‰ADDQ.Lƒ#EQ1122,A2‹oftheCCBtotheextendedparameters EQ1123ƒEQU†IOSDLN-IOSEATWEQ1124ƒEQU†EQ1123/2 :‰MOVEQWƒEQ1124-1,D0‹Copythedri ve'scurrentconfiguration?L1130„MOVE.Wƒ(A2)+,(A0)+Švaluesfromtheconfigureblockinthe6‰DBRA…D0,L1130CCBtotheusertask'sstatusparablk."*¦Thisportioncopiestheextended *¦parameters. ‰PAGEO*********************************************************************************ˆCOMMONEXITROUTINE*B*ˆTheCMDEXIT‚routineisa‚commonexitroutinethatisusedbytheC*ˆmanydifferentpathsthroughthecommandserviceroutine.‚ControlC*ˆcomestooneofthreeentrypointsbelowtoterminateprocessing.*%*ˆEntry:„A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB3*’A6=physicaladdressofTCBoftheattachedtask**D1.B=IOSSTAstatusvalue*!*ˆRegisterusage:…01234567*™D‚R**™A‚*‰P*1*ˆExit:…Returntodevice-dependentmoduleviaRTS*O*******************************************************************************  BCMDEXIT1MOVEQIƒISTAOK,D1ŒWe'vefinishedprocessingacommandwith'*¦noerrorsandwewanttoqueueanI/O(*¦completioneventtotheattachedtask. ECMDEXIT2LEA‡DO_EVENT(PC),A0…We'vefinishedprocessingacommandwith8‰MOVE.L„#T0GUARD,D0‰anerrorandwewanttoqueueanI/O/‰TRAP†#0’completioneventtotheattachedtask.$*¦Thestatusvalueforthecompleted&*¦commandisinD1.Bwhenwegethere. "*¨WeuseCALL-GUARDEDtoqueuethe&*¦eventforcommandcompletionsothat&*¦itwillbeprotectedfromanyevents$*¦queuedfromtheinterrupthandler. BCMDEXIT3MOVE.LƒSAVESP(A5),SPŠRestorethestackpointer,andclear4‰MOVEQ„#0,D0D0toindicatethatthecommandservice(‰RTS›routinehasoperatedproperly.‚Then$*¦returncontroltotheroutinethat"*¦calledsubroutineDISK_COMMANDS. #*¨Thisexitisvalidfromanylevel&*¦withinthedriverbecausewerestore(*¦theSPassaveduponentry.Thedriver*¦remainsre-entrant.‰PAGEO******************************************************************************** *ˆSTATUS/CONFIGURECOMMONCHORES*F*ˆThesubroutineSTATCONFperformsfunctionsthatarecommontostatus?*ˆcommands,configurecommands,anddefaultconfigurecommands.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.<*’A2=IOSATWfieldindrive'sconfigureblockofCCBorDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™DŒ** *™A‚*PPƒPP*&*ˆExit:…Returntothecallingroutine.*O******************************************************************************* STATCONF: ;‰MOVE.LƒIOSDBP(A4),D6ŠGetthephysicaladdressofthefirst9‰MOVE.Lƒ#IOSDLN,D5‹locationoftheusertask'sconfigure/?‰MOVE.LƒCCBTASKA(A5),A0†statusparameterblockintoD6.‚LOGPHY17‰BSR.L„LOGPHY1Žconvertsthelogicaladdresoftheusers>STATCON1MOVE.LƒD6,A0parameterblockintoaphysicaladdress. 8‰TST.B„MOUNTED(A1)ŒIfthediskisnotcurrentlymounted,/‰SEQ.B„(A0)‘wesettheXDSNRBbitoftheIOSDST@‰AND.B„#1<‰MOVEQIƒXDSRDK-XDSFDK,D5…theIOSATWfieldoftheconfiguration8L0180„ADD.B„#XDSFDK,D5‹blockthatisindicatedbyA2.‚We8‰MOVE.BƒD5,(A0)+alwaysusetheconfigurationblockthat2L1‡SET†IOSDTPisindicatedbyA2insteadofsimply)*¦usingthecurrentconfigurationbecause(*¦wewanttomaintainconsistencyinthe&*¦caseofadefaultconfigurecommand. =‰MOVE.B„DRV_CODE(A1),(A0)+„SettheI OSDRC(driver-code)field1L1‡SET‡IOSDRCŽintheusertask'sconfigure/status**¦parameterblock.NotethatA0nowpoints(*¦totheIOSATMfieldoftheusertask's&‰RTS›configure/statusparameterblock.‰PAGEO*******************************************************************************O*********************************************************************************ˆDEFAULTCONFIGURECOMMAND*H*ˆThecommandserviceprocessorinvokestheDFCONFIGroutineinresponseG*ˆtoadefaultconfigurecommand.‚ItspurposeistoestablishorchangeE*ˆthedrive'sdefaultconfiguration,whichiskeptinthedrive'sDCB*ˆarea.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory..*’A2=physicaladdressofCMRparameterblock*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*3*’D6=Channeldevice#forthediskdrive(DCBCDV)*!*ˆRegisterusage:…01234567*™D‚****ƒPP*™A‚*P*PPP*;*ˆExit:…Branchestocommonconfigurationchores(CONFGCOM).*O*******************************************************************************O******************************************************************************* DFCONFIG: :EQ160„EQU†DCBDKC+IOSATWŠSetupregisterA2topointtothe7‰LEA†EQ160(A3),A2‰IOSATWfieldofthedefaultconfigure"*¦blockinthedrive'sDCB(Device*¦ControlBlock)area. 0‰MOVEQ.L‚#0,D5’ClearD5todifferentiatebetween%*¦aconfigurecommandadef-configure%*¦commandinthecommonconfiguration *¦routine. 2‰BRA.S„CONFGCOMBranchtothecommonconfiguration(*¦routine,whichdoeseverythingweneed*¦todo.‰PAGEO*******************************************************************************O*********************************************************************************ˆCONFIGURECOMMAND*F*ˆThecommandserviceprocessorinvokestheCONFIGroutineinresponseC*ˆtoa‚configurecommand.‚Itspurposeistoestablishor‚changetheF*ˆdrive'scurrentconfiguration,whichiskeptinthedrive'svariable6*ˆblockinthedrive-associatedareaofglobalmemory.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*3*’D6=Channeldevice#forthediskdrive(DCBCDV)*!*ˆRegisterusage:…01234567*™D‚****ƒPP*™A‚*P*PPP*;*ˆExit:…BranchestoCMDEXIT2fornon-existentdevices,else$*’fallsthroughtoCONFGCOMroutine.*O*******************************************************************************O******************************************************************************* CONFIG:2‰BSR.L„CHK_DEVICEFillDRV_CODE,REC_ATT,REC_PAR,)*¦REC_XAT,andREC_XPRifourdevicecode(*¦isfoundinDSKTYPE.‚Ifnot,exitwith*¦anerrortoCMDEXIT2. :EQ210„EQU†CONFGBLK+IOSATWˆSetupA2topointtotheIOSATW9‰LEA†EQ210(A1),A2‰fieldofthedrive'sconfigureblockin%*¦thedrive-associatedareaofglobal'*¦memory.‚Thisconfigureblockcontains(*¦thedrive'scurrentconfiguration,and%*¦that'stheconfigurationwewantto*¦establishorchange. =EQ220„EQU†DCBDKC+IOSWTOŠCopytheIOSWTO(write-timeout)field=EQ230„EQU†CONFGBLK+IOSWTO†andtheIOSRTO(read-timeout)fieldB‰MOVE.LƒEQ220(A3),EQ230(A1)‚fromthedrive'sdefaultconfigurationEQ250„EQU†CONFGBLK+IOSRTO†block.‚Theuserisn'tallowedtosetC‰MOVE.LƒEQ240(A3),EQ250(A1)‚orchangethesevalueswithaconfigure'*¦command,sowealwaysusethedefault%*¦values.‚Weneedtoputthesevalues&*¦intothecurrentconfigurationblock$*¦nowsowe'llhavetherightvalues)*¦therewhenwecopythemintotheuser's*¦configureparameterblock. ;‰MOVEQ.L‚#CNFGFUNC,D5‹Putthefunctioncodeforaconfigure)*¦commandintoregisterD5,andfallinto#*¦thecommonconfigurationrou tine.‰PAGEO*********************************************************************************ˆCOMMONCONFIGURATIONCHORES*D*ˆThe‚CONFGCOM‚routineisusedbythe‚configure(CONFIG)anddefaultF*ˆconfigure(DFCONFIG)routines.‚Itspurposeistodomostofthework*ˆforbothofthem.*9*ˆEntry:„A0=pointertoIOSATMfieldofusertask'sCSB.:*’A1=pointertodrive'svariableblockinglobalmemory.5*’A2=physicaladdressofIOSATWfieldinCCBorDCB*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask**D5.L=I/Ofunctionflag5*D6.L=Channeldevice#forthediskdrive(DCBCDV)*!*ˆRegisterusage:…01234567*™D‚****ƒPP*™A‚*P*PPP*C*ˆCalls:„STATCONF,STATCON1,CHK_FLOPPY,CHK_LSN,CMD_COM,SET_CNFG*3*ˆExit:…BranchestoCMDEXIT1fordefaultconfigure..*’BranchestoCMDEXIT1forconfigure-dismount.+*’BranchestoSTART_IOforconfigure-mount.0*’BranchestoCONERRORforconfigurationerrors.*O******************************************************************************* CONFGCOM: <‰MOVEM.L‚D6/D5,-(SP)ŠSaveD6andD5(D5isontopofstack). 3‰MOVE.Wƒ#$FFFF,D1ŒSetupD1.Wwithabitpatternto>‰SUB.W„REC_PAR(A1),D1‡indicatetheIOSPRMbitswedon'tallow. 2‰BSR.S„STATCONFSetIOSDST,IOSCTP,IOSDTP,IOSDRC%*¦intheusertask's‚parameterblock. 6‰MOVE.Wƒ(A0)+,D0Copytheusertask'sIOSATMintoD0.W4‰MOVE.Wƒ(A0)+,D2andtheusertask'sIOSPRMinD2.W.3L1‡SET†IOSATMThesemasksindicatewhichfieldsthe,L1‡SET†IOSPRMusertaskisspecifyinginthe*¦configureparameterblock. 3CONERR40EQU†CECDAP‘Iftheusertask'sIOSPRMfield:‰MOVEQIƒCONERR40,D3Šcontainsanybitsthatarenotallowed1‰AND.W„D2,D1fortheIOSPRMfield,abortwiththe4‰BNE.L„CONERRORerrorcodeinD3.Btobereturnedto&*¦theusertaskintheIOSDSTfieldof *¦theconfigureparameterblock.‰PAGE3CONERR41EQU†CECDIA‘Iftheusertask'sIOSATMfield:‰MOVEQIƒCONERR41,D3Šcontainsanybitsthatarenotallowed6‰MOVE.Wƒ#$FFFF,D1ŒfortheIOSATMfield,abortwiththe:‰SUB.W„REC_ATT(A1),D1‡errorcodeinD3.Btobereturnedto1‰AND.W„D0,D1theusertaskintheIOSDSTfieldof.‰BNE.L„CONERRORtheconfigureparameterblock. #*¨Ifwedon'taborthere,weendup*¦withD1.W=0touselateras*¦asanindexregister. 6‰TAS.B„ACTIVE(A1)Ifthecommandthatwe'reprocessing.‰BNE.S„L0810isthefirstconfigureordefault:‰MOVEQ.L‚#$FFFFFFFF,D0ˆconfigurecommandreceivedforthis<‰MOVEQ.L‚#$FFFFFFFF,D2ˆdisksincesysteminitialization,set'*¦allbitsofD0andD2.‚Thesesettings)*¦forD0andD2willcauseustocopyall)*¦attributeandparameterfieldsfromthe'*¦usertask'sconfigureparameterblock(*¦intothedisk'scurrentconfiguration.(*¦ThisspecialcaseallowsIOStosetup%*¦thedisk'sinitialconfigurationto%*¦includeeventhedisk-configuration'*¦fieldsthatarenotrecognizedbythe *¦driver. 4L0810„AND.W„D0,(A0)SettheIOSATWfieldintheuser/‰NOT.W„D0“task'sconfigureblocktoreflectthe7‰AND.W„(A2)+,D0finalattributesthatwillbeineffect1‰OR.W…D0,(A0)Žwiththeproposedconfiguration.‚We3L1‡SET†IOSATWcomputethisfinalattributevalueby'*¦combiningtheattributebitsthatthe)*¦usertaskisspecifyingwiththevalues&*¦oftheremainingattributebitsfrom(*¦theexistingconfiguration.‚TheIOSATM&*¦valuefromtheusertask'sconfigure'*¦parameterblocktellswhichattribute'*¦bitstheusertaskisspecifying,and(*¦theotherattributebitscomefromthe*¦existingconfiguration. 8CONERR42EQU†CECDIWIf(1)thefinalattributesindicate9‰MOVEQIƒCONERR42,D3Šthatthediskisarigiddiskand(2)8‰MOVE.Wƒ(A0)+,D0theyalsospecifyanyattribute(s)that5‰AND.W„#$1F,D0Žapplyonlytofloppydisks,abortwith=‰CMP.W„#1<*‚willreflectthetotalconfigurationthatisbeingproposed. F*ˆRecallthatD1.W=0fromabove.‚WealsohaveD2.W=IOSPRMfromtheH*‚usertask'sconfigureparameter‚block,‚orelsewe‚have‚D2.W=$FFFF‚ifK*‚we'reprocessing‚thefirst‚configurecommandordefaultconfigurecommandI*‚thathas‚been‚processedforthis‚disksincesystem-initialization‚time.L*‚Additionally,wehave‚A0=LOC(IOSREC)intheusertask'sconfigureparam-I*‚eterblock,‚andwe‚have‚A2=LOC(IOSREC)‚intheconfigureblockthatis*‚beingupdated. 1‰BRA.S„L0310’Branchintotheloopthatmergesthe#*¦parametervalues.‚We'lluseD1.W,%*¦whichequalszerofromabove,asan *¦indexintotheCONFGLENtable. O*********************************************************************************ˆCONFIGURATION-LENGTHTABLE*F*ˆThis‚tabledefinesthelengthofeachparameterfieldinaconfigureF*ˆblockforadiskdrive.‚ThereisoneentryintheCONFGLENtableforE*ˆeach‚parameterfieldina‚configureblock,andthevalueofatableD*ˆentryis‚N-1whereNis‚thelength(inbytes)‚ofthecorresponding*ˆparameterfield.*O******************************************************************************* CONFGLEN:)‰DC.B…IOSRSZ-IOSREC-1†Length(IOSREC)-1.)‰DC.B…IOSWTO-IOSRSZ-1†Length(IOSRSZ)-1.)‰DC.B…IOSRTO-IOSWTO-1†Length(IOSWTO)-1.)‰DC.B…IOSSPT-IOSRTO-1†Length(IOSRTO)-1.)‰DC.B…IOSHDS-IOSSPT-1†Length(IOSSPT)-1.)‰DC.B…IOSTRK-IOSHDS-1†Length(IOSHDS)-1.)‰DC.B…IOSILV-IOSTRK-1†Length(IOSTRK)-1.)‰DC.B…IOSSOF-IOSILV-1†Length(IOSILV)-1.)‰DC.B…IOSPSM-IOSSOF-1†Length(IOSSOF)-1.)‰DC.B…IOSSHD-IOSPSM-1†Length(IOSPSM)-1.*‰DC.B…IOSTRKD-IOSSHD-1…Length(IOSPSD)-1.,‰DC.B…IOSPCOM-IOSTRKD-1„Length(IOSTRKD)-1.,‰DC.B…IOSSPTD-IOSPCOM-1„Length(IOSPCOM)-1.,‰DC.B…IOSSRTD-IOSSPTD-1„Length(IOSSPTD)-1.,‰DC.B…IOSEWCC-IOSSRTD-1„Length(IOSSRTD)-1.+‰DC.B…IOSECC-IOSEWCC-1…Length(IOSEWCC)-1.*‰DC.B…IOSEATM-IOSECC-1…Length(IOSECC)-1.$‰DC.B…-1“End-of-ParametersSentinel. ECONFGLN:,‰DC.B…IOSGPB2-IOSGPB1-1„Length(IOSGPB1)-1.,‰DC.B…IOSGPB3-IOSGPB2-1„Length(IOSGPB2)-1.,‰DC.B…IOSGPB4-IOSGPB3-1„Length(IOSGPB3)-1.+‰DC.B…IOSSSC-IOSGPB4-1…Length(IOSGPB4)-1.*‰DC.B…IOSDRSV-IOSSSC-1…Length(IOSSSC)-1.-‰DC.B…-1“End-of-Extended-ParametersSentinel.,‰DS.W†0“Ensureitsalignedtowordboundary.‰PAGE*G*ˆThisloop,whichisenteredatL0310,processestheparameterfields.* 2L0280„ROR.W„#1,D2’BringthenextbitoftheIOSPRM&*¦fieldintobit15ofD2wherewecan*¦easilytestit. 0L0290„TST.W„D2•Iftheparameter-maskbitisset,2‰BMI.S„L0300theuserisspecifyingthisparameter3‰MOVE.Bƒ(A2),(A0)Œvalue.‚Otherwise,theuserisnot>L0300„CMP.B„(A2)+,(A0)+Šspecifyingthisparametervalue,sowe3‰DBRA…D0,L0290copytheparameterfromtheexisting$*¦configurationintotheusertask's&*¦configureparameterblock.‚Thisloop$*¦processesonebyteatatimeuntil$*¦we'veprocessedallbyte(s)ofthe%*¦currentparameterfield.‚Noticethe)*¦useoftheCMP.Binstructiontoadvance*¦bothaddressregisters. /‰ADDQ.Wƒ#1,D1’AdvanceD1.Wtoindextothenext$*¦byteoftheCONFGLENtable.‚Recall)*¦thatwehadD1.W=0whencontrolfirst*¦enteredthisloop. DL0310„MOVE.BƒCONFGLEN(PC,D1.W),D0ƒGetthenextentryoftheCONFGLEN,‰EXT.W„D0“tableintoD0.W.‚ThisvalueisN-14‰BGE.S„L0280whereNisthenumberofbyte(s)inthe%*¦nextparameterfield.‚Ifwehaven't#*¦reachedthenegativeend-of-table&*¦sentinelentry,loopbacktoprocess*¦thenextparameterfield. ?*ˆNowwewantto processtheExtendedParametersandAttributes 3‰MOVE.Wƒ#$FFFF,D1ŒSetupD1.Wwithabitpatternto>‰SUB.W„REC_XPR(A1),D1‡indicatetheIOSEPRMbitswedon'tallow 7‰MOVE.Wƒ(A0)+,D0Copytheusertask'sIOSEATMintoD0.W5‰MOVE.Wƒ(A0)+,D2andtheusertask'sIOSEPRMinD2.W.4L1‡SET†IOSEATMŽThesemasksindicatewhichfieldsthe-L1‡SET†IOSEPRMŽusertaskisspecifyinginthe*¦configureparameterblock. "*¦Iftheusertask'sIOSEPRMfield:‰MOVEQIƒCONERR40,D3Šcontainsanybitsthatarenotallowed2‰AND.W„D2,D1fortheIOSEPRMfield,abortwiththe4‰BNE.L„CONERRORerrorcodeinD3.Btobereturnedto&*¦theusertaskintheIOSDSTfieldof *¦theconfigureparameterblock.EQU1000‚EQU†IOSEATW-IOSEATM5‰ADDQ.Lƒ#EQU1000,A2ŒIncrementtotheIOSEATWfieldof*¦configureparameterblock‰PAGE"*¦Iftheusertask'sIOSEATMfield:‰MOVEQIƒCONERR41,D3Šcontainsanybitsthatarenotallowed7‰MOVE.Wƒ#$FFFF,D1ŒfortheIOSEATMfield,abortwiththe:‰SUB.W„REC_XAT(A1),D1‡errorcodeinD3.Btobereturnedto1‰AND.W„D0,D1theusertaskintheIOSDSTfieldof.‰BNE.L„CONERRORtheconfigureparameterblock. #*¨Ifwedon'taborthere,weendup*¦withD1.W=0touselateras*¦asanindexregister. 8‰BTST…#6,ACTIVE(A1)ˆIfthecommandthatwe'reprocessing.‰BNE.S„L1810isthefirstconfigureordefault:‰MOVEQ.L‚#$FFFFFFFF,D0ˆconfigurecommandreceivedforthis<‰MOVEQ.L‚#$FFFFFFFF,D2ˆdisksincesysteminitialization,set9‰BSET…#6,ACTIVE(A1)ˆallbitsofD0andD2.‚Thesesettings)*¦forD0andD2willcauseustocopyall)*¦attributeandparameterfieldsfromthe'*¦usertask'sconfigureparameterblock(*¦intothedisk'scurrentconfiguration.(*¦ThisspecialcaseallowsIOStosetup%*¦thedisk'sinitialconfigurationto%*¦includeeventhedisk-configuration'*¦fieldsthatarenotrecognizedbythe *¦driver. 5L1810„AND.W„D0,(A0)SettheIOSEATWfieldintheuser/‰NOT.W„D0“task'sconfigureblocktoreflectthe7‰AND.W„(A2)+,D0finalattributesthatwillbeineffect2‰OR.W…D0,(A0)+withtheproposedconfiguration.‚We4L1‡SET†IOSEATWcomputethisfinalattributevalueby'*¦combiningtheattributebitsthatthe)*¦usertaskisspecifyingwiththevalues&*¦oftheremainingattributebitsfrom)*¦theexistingconfiguration.TheIOSEATM&*¦valuefromtheusertask'sconfigure'*¦parameterblocktellswhichattribute'*¦bitstheusertaskisspecifying,and(*¦theotherattributebitscomefromthe*¦existingconfiguration. ‰BRA.S…L1310 ‰PAGE*F*ˆNowwewanttoprocesstheparameterfields.‚ForanyparameterfieldM*‚thattheusertaskisnotspecifying,we'llcopytheexistingconfigurationL*‚valueintotheusertask'sconfigureparameterblock.‚TheresultingmergedK*‚parametervaluesthatendup‚in‚theusertask'sconfigureparameterblock>*‚willreflectthetotalconfigurationthatisbeingproposed. G*ˆRecallthatD1.W=0fromabove.‚WealsohaveD2.W=IOSEPRMfromtheH*‚usertask'sconfigureparameter‚block,‚orelsewe‚have‚D2.W=$FFFF‚ifK*‚we'reprocessing‚thefirst‚configurecommandordefaultconfigurecommandI*‚thathas‚been‚processedforthis‚disksincesystem-initialization‚time.M*‚Additionally,wehave‚A0=LOC(IOSGPB1)intheusertask'sconfigureparam-J*‚eterblock,‚andwe‚have‚A2=LOC(IOSGPB1)‚intheconfigureblockthatis*‚beingupdated. 3L1280„ROR.W„#1,D2’BringthenextbitoftheIOSEPRM&*¦fieldintobit15ofD2wherewecan*¦easilytestit. 0L1290„TST.W„D2•Iftheparameter-maskbitisset,2‰BMI.S„L1300theuserisspecifyingthisparameter3‰MOVE.Bƒ(A2),(A0)Œvalue.‚Otherwise,theuserisnot>L1300„CMP.B„(A2)+,(A0)+Šspecifyingthisparametervalue,sowe3‰DBRA…D0,L1290copytheparameterfromtheexisting$*¦configurationintotheusertask's&*¦configureparameterblock.‚Thisloop$*¦processesonebyteatatimeuntil$*¦we'veprocessedallbyte(s)ofthe%*¦currentparameterfield.‚Noticethe)*¦ useoftheCMP.Binstructiontoadvance*¦bothaddressregisters. /‰ADDQ.Wƒ#1,D1’AdvanceD1.Wtoindextothenext$*¦byteoftheECONFGLNtable.‚Recall)*¦thatwehadD1.W=0whencontrolfirst*¦enteredthisloop. DL1310„MOVE.BƒECONFGLN(PC,D1.W),D0ƒGetthenextentryoftheECONFGLN,‰EXT.W„D0“tableintoD0.W.‚ThisvalueisN-14‰BGE.S„L1280whereNisthenumberofbyte(s)inthe%*¦nextparameterfield.‚Ifwehaven't#*¦reachedthenegativeend-of-table&*¦sentinelentry,loopbacktoprocess*¦thenextparameterfield. &*¨NoticethatA0pointstotheIOSDRSV$*¦fieldoftheusertask'sconfigure(*¦parameterblockwhencontrolfallsout'*¦ofthisloop.‚Similarly,A2pointsto$*¦theIOSDRSVfieldoftheconfigure%*¦blockfortheconfigurationthatis*¦beingupdated.‰PAGEG*ˆNowwewanttochecktheproposedconfigurationtoseeifitcontainsK*‚anyinvalid‚orinconsistentconfigurationvalues.‚Ifitdoes,we'llabort#*‚withanappropriateerrorreport. 4CONERR43EQU†CECDII‘Theinterleavefactorforadisk6‰MOVEQIƒCONERR43,D3Šmustbeintherange1throughthe8EQ320„EQU†IOSILV-IOSDRSV‡numberofsectorspertrack.‚If7‰MOVE.BƒEQ320(A0),D0‰theIOSILVparameterisn'tinthis6‰BEQ.L„CONERRORrange,abortwithanerrorreport.The>EQ321„EQU†IOSSPT-IOSDRSV‡errorisreturnedtotheusertaskin5‰CMP.B„EQ321(A0),D0‰theIOSDSTfieldoftheconfigure ‰BHS.L„CONERRORparameterblock.* 5EQ322„EQU†IOSSOF-IOSDRSV‰Thespiraloffsetforadisk7‰MOVE.BƒEQ322(A0),D0‰mustbeintherange0throughthe3‰CMP.B„EQ321(A0),D0‰numberofsectorspertrack.‚If2‰BHS.L„CONERRORtheIOSSOFparameterisn'tinthis$*¦range,abortwithanerrorreport.* 1CONERR44EQU†CECDSS‘Thedrivercontainscodethat;‰MOVEQIƒCONERR44,D3Šassumesthatthelogicalsectorsizeis&*¦anonzeromultipleofLCDSCTSZwhere>EQ325„EQU†IOSPSM-IOSDRSV‡LCDSCTSZisdefinedtobethelargest9‰MOVE.WƒEQ325(A0),D0‰commondivisorofallpossiblevalid5‰BEQ.L„CONERRORsectorsizes.‚Herewechecktoverify'*¦thatthelogicalsectorsize(IOSPSM)#*¦isnonzero.‚Ifweaborthere,the(*¦errorcodeinD3.Bwillbereturnedto&*¦theusertaskintheIOSDSTfieldof *¦theconfigureparameterblock. ;‰MOVEQ.L‚#VDOSRSZ>>2,D1‰NowwegettheVERSAdosrecordsize3‰ASL.L„#2,D1intoD1.L,andwesettheIOSRECfield?EQ326„EQU†IOSREC-IOSDRSV‡oftheconfigureparameterblockequal;‰MOVE.WƒD1,EQ326(A0)‰totheVERSAdosrecordsize.‚Wesavea)*¦wordofmemoryherebytakingadvantage&*¦ofthefactthattheVERSAdosrecord *¦sizeisevenlydivisibleby4. 8EQ327„EQU†VDOSRSZ>>2IftheVERSAdosrecordsizeisever9EQ328„EQU†EQ327<<2changedsothatitisn'tamultipleof6‰IFNE…VDOSRSZ-EQ328ˆ4,wewanttogenerateanassembly/‰FAIL…0”[****ERROR****ERROR****ERROR****]-‰ENDCšerrortoalerttheconfusedmaintenance'*¦programmertotheproblemthatarises(*¦here.‚Theinstructionthatisnormally$*¦skippedheregeneratesanassembly)*¦erroriftheVERSAdosrecordsizeisn't*¦amultipleof4.‰PAGE.‰DIVU…D0,D1’Werequirethatthelogicalsector*‰SWAP…D1“size(inD0.W)evenlydividesthe(*¦VERSAdosrecordsize(inD1)sowecan)*¦translateanintegralnumberoflogical(*¦sector(s)intoaVERSAdosrecord.‚Here(*¦wegettheremainderfromthedivision(*¦intoD1.W,andwesavethequotientin*¦thetophalfofD1. >‰AND.W„#(1<‚THENtrackmustbenonzeroandEVEN.‹LSR.B‚#1,D0D0<--IOSSPT/2.2‹BCS.L‚CONERRORErrorifsectorspertrackisodd."*¦WesavetheIOSSPTvalueinD2.W)*¦forfutureuse,andwesaveIOSSPT/2in$*¦D0.Lforfutureuse(floppyonly). %*¨Wemusthaveanevennumberforthe(*¦numberofsectorspertrackbecausewe(*¦pairupthesectorsintrackzeroofa&*¦256BYTES/SECTORfloppydisk.‚Recall'*¦thattrackzeroofa256BYTES/SECTOR'*¦floppydiskisrecordedin128BYTES/&*¦SECTOR,sotwosectorsintrackzero)*¦areequalinsizetoasinglesectorin'*¦anyothertrackofa256BYTES/SECTOR*¦floppydisk.‰ENDI‰PAGE8CONERR46EQU†CECDDS‘Gettheerrorcodethatwe'lluseto9‰MOVEQIƒCONERR46,D3Šindicatethatsomethingiswrongwith*¦thedisk'scapacity. 5‰MOVEQ.L‚#0,D5Initializenumberofsurfacestozero. :EQ330„EQU†IOSATW-IOSDRSV‰Determinerigidorfloppydiskto>‰BTSTW„#IOARDISC,EQ330(A0)‚useincalculationof#ofheadsor‰BNE.S„L0320#ofsides.*B*„Checktomakesurethatthebytespersector,sectorspertrack,A*„anddatadensityvaluesareconsistentfor51/4"and8"floppyF*„diskettes.‚Ifnot,gotoCONERRORwithaerrorcode$47.ƒ11/7/84BWN*8CONERR47EQU†CECDFC‘Gettheerrorcodethatwe'lluseto8‰MOVEQI„CONERR47,D3‰indicatethatthereisaconflictin9‰T_JSR…CHK_FLOPPYŠthefloppydiskconfiguration.‚Ifthere5‰BNE.L…CONERRORŒisanerror,branchtoCONERROR.Else8‰MOVEQIƒCONERR46,D3Šrestoreerrorcodefornextroutine. 2‰ADDQ.Lƒ#1,D5’SetD5=1forasingle-sidedfloppy?‰BTSTW„#IOADSIDE,EQ330(A0)‚disk.‚Determinetheactualnumberof/‰BEQ.S„L0845sidesfromtheIOADSIDEbitofthe-‰ADDQ…#1,D5attributesword.Ifdouble-sided,‰BRA.S„L0845SetD5=2. ;EQ840„EQU†IOSHDS-IOSDRSV‰Wehavearigiddisk,socalculate.L0320„MOVE.BƒEQ840(A0),D5‰thenumberofheads. 4L0845„MULU…D5,D2’Computethetotalnumberoflogical‚THEN‘oflogicalsectorstoaccountfortheC‰CMP.W#VDOSRSZ,IOSPSM-IOSDRSV(A0)factthatthesectorsintrack03‰IF‚THEN‘ofa256BYTES/SECTORfloppydiskare0‰SUB.L„D0,D2halfaslargeasnormalsectors.‚We7‰BLS.L„CONERRORnowhavethetotalcapacityofthedisk-‰ENDIšintermsoffull-sizedlogicalsectors.*‰ENDIšIfthetotalcapacityofthediskin(*¦termsoffull-sizedlogicalsectorsis#*¦zeroorless,wer eportanerror. 0‰MOVE.LƒD2,D0’Wewanttodividethedisk'stotal0‰CLR.W„D2“sectorcount(inD2)byVDOSRSZ/IOSPSM)‰SWAP…D2“(inD1)toobtainthetotaldisk/‰DIVU…D1,D2capacitytermsofVERSAdosrecords.>EQ880„EQU†IOSRSZ-IOSDRSV‡Unfortunately,theresultingquotient:‰MOVE.WƒD2,EQ880(A0)‰canbea32-bitnumber,andthe680002‰MOVE.WƒD0,D2islimitedto16-bitquotients.‚This1‰DIVU…D1,D2codeperformsthedivisiontoyielda8‰MOVE.WƒD2,EQ880+2(A0)‡32-bitquotient,andwestorethe%*¦resultintotheIOSRSZfieldofthe(*¦usertask'sconfigureparameterblock.%*¦Wesimplydiscardtheremainder(if$*¦any),sotheusercan'taccessany$*¦partialVERSAdosrecordthatmight*¦existattheendofthedisk. %*¨Weperformthedivisionanalogously)*¦tothewayapersondoeslongdivision.)*¦Thedifferenceisthatweuseabaseof#*¦65,536insteadofbase10.‚Divide)*¦faultcan'toccuronthefirstdivision)*¦becausewereducethedividendtoa16-&*¦bitnumber.‚Dividefaultcan'toccur$*¦ontheseconddivisionbecausethe)*¦remainderinthetophalfofD2mustbe*¦lessthanthedivisor. 1‰IFEQ…VDOSRSZToguaranteethatdividefaultdoes/‰FAIL…0”[****ERROR****ERROR****ERROR****],‰ENDCšnotoccur,wemustassurethatVDOSRSZ *¦isnonzero. 7‰T_JSR…CHK_PARAM‹Nowwemustcheckanydevicedependent(‰BNE‡CONERRORŒparametersforanyerrors. ‰PAGEG*ˆFinally,we'rereadytocopytheproposedconfigurationfromtheuserI*‚task's‚configure‚parameterblockintotheconfigureblockthatisbeing *‚updated. A‰MOVEQWƒIOSDRSV-IOSEATW-1,D0„Allparametersandattributesinthe=L0330„MOVE.Bƒ-(A0),-(A2)Šproposedconfigurationarevalid,so3‰DBRA…D0,L0330copytheproposedconfigurationinto=EQU1001‚EQU†IOSEATW-IOSEATM†theconfigureblockthatisbeing5‰SUBQ.Lƒ#EQU1001,A0Šupdated.‚Foraconfigurecommand,8‰SUBQ.Lƒ#EQU1001,A2Šwe'reupdatingthecurrentconfigure?‰MOVEQWƒIOSEATM-IOSATW-1,D0‚blockinthedrive'svariableblock3L1330„MOVE.Bƒ-(A0),-(A2)Šwhichisinglobalmemory,2‰DBRA†D0,L1330Œandforadefaultconfigurecommand&*¦we'reupdatingthedefaultconfigure'*¦blockinthedrive'sDCB.‚Noticethat)*¦wecopytheIOSATWfieldandallofthe)*¦parameterfields,butwedon'tcopythe%*¦maskfieldsbecausethemaskfields(*¦aren'treallypartofthetotaldevice*¦configuration. $*¨Attheconclusionofthisstep,A2#*¦pointstotheIOSATWfieldofthe'*¦configureblockthat'sbeingupdated,&*¦soA2issetproperlyforustocall*¦subroutineSTATCON1. /‰TST.L„(SP)“Recallthatthevalueontopofthe0‰BEQ.S„L0830stackiszeroifwe'reperforminga(*¦defaultconfigurecommand.‚Weskipthe$*¦nextsectionofcodeforadefault&*¦configurecommand,andweexecuteit)*¦onlyforanordinaryconfigurecommand. D*ˆThis‚section‚ofcode‚isexecutedonlyforaconfigurecommand,not"*‚foradefaultconfigurecommand.  :‰MOVE.WƒD1,SCTPVREC(A1)ˆSetSCTPVREC<--VDOSRSZ/IOSPSMto(*¦indicatethenumberoflogicalsectors'*¦inaVERSAdosrecord.‚Recallthatthe(*¦desiredvaluewascomputedearlierand%*¦waskeptinD1.‚Weneedtoknowhow'*¦manylogicalsector(s)thereareina)*¦VERSAdosrecordsowecanmakethedisk(*¦appeartocontainVERSAdosrecords.‚We"*¦don'twanttosetSCTPVRECfora#*¦defaultconfigurecommandbecause%*¦SCTPVRECiseffectivelypartofthe)*¦drive'scurrentconfiguration,notpart'*¦ofthedrive'sdefaultconfiguration.‰PAGE7‰MOVE.WƒIOSOPT(A4),D0ŠIftheentireIOSOPTfieldofthe2‰BNE.S„L0820IOCBiszero,settheMOUNTEDflagto8‰ST.B…MOUNTED(A1)Šindicatethatthediskisnowmounted.(*¦AconfigurecommandwithazeroIOSOPT(*¦fieldisdefinedtobeaconfigureand*¦mountcommand. 6L0820„CMP.W„#IOPDMNT,D0ŒIftheIOSOPTfieldissetfor2‰IFTHEN’Dismount,cleartheMOUNTEDflagand;‰CLR.B„MOUNTED(A1)ŠsettheDCBCCFflagtoindicatethedisk7‰ST.B…DCBCCF(A3)‹isnowdismounted.‚Aconfigurecommand4‰BRA†CMDEXIT1 withthisoptionbitsetisdefinedto*‰ENDIšbeaconfigureanddismountcommand.$*¦SettingtheDCBCCFflagintheDCB%*¦indicatesthattheoperatingsystem(*¦shouldreturnthedrivetoitsdefault*¦configuration. @*ˆControl‚converges‚here‚for‚both‚configure‚commands‚anddefault*‚configurecommands. 5L0830„BSR†STATCON1SetIOSDST,IOSCTP,IOSDTP,IOSDRC%*¦intheusertask's‚parameterblock. "‰MOVEM.L‚(SP)+,D5/D6ŠRestoreRegs.1‰TST.L„D5“DoesD5containa0foradef-confcmd?/‰BEQ†CMDEXIT1Doneifitdoes...branchtoexit. ,‰BSR†CMD_COMŽDostuffcommontoallcommands8‰T_JSR„SET_CNFGGetconfigureparametersindriveblock.-‰IF‚THEN‘Conditioncodessetifthe/ŠBRA…CMDEXIT2Ždrive/controllerdoesnotsupport!‰ENDI›configurecommand,soexit!&‰BRA.L„START_IOStarttheI/Orolling!*8* Registers are set as follows before executing CMD_COM:**ˆA6=TCBofattachedtask. *ˆA5=CCB *ˆA4=IOCB *ˆA3=DCB#*ˆA1=Diskdrive'svariableblock.*ˆD6=Drive'sdevicenumber.*ˆD5=1=I/Ofunctionflag.‰PAGEO*********************************************************************************ˆCONFIGURATIONERRORROUTINE*E*ˆControlcomestothisroutinewhen‚itisnecessarytoabortwithanE*ˆerrorcodefromanyconfigurationcommand.‚ErrorcodesintherangeC*ˆ$01to$3F‚areuniversal.‚Errorcodesintherange‚$40to$7Fare*ˆuniquetothisdriver.*!*ˆEntry:„D3=‚detailederrorcode<*’D6=‚physicaladdressofuser'staskconfigurepara.block*!*ˆRegisterusage:…01234567 *™D„RƒP…P*™A‚**2*ˆExit:…Branchestocommonexitroutine(CMDEXIT).*O*******************************************************************************  CONERROR: 2‰MOVE.LƒD6,A0’Putthedetailederrorcodeintothe5‰MOVE.BƒD3,IOSDST(A0)ˆIOSDSTfieldoftheusertask's9‰MOVEQIƒISTACNF,D1‹configureparameterblock,andthengo4‰BRA†CMDEXIT2tothecommandprocessor'scommonexit(*¦routinewithD1.Bsetuptoreportthe#*¦majorerrorcodethatindicatesa*¦configurationerror.‰PAGEO*******************************************************************************O*********************************************************************************ˆREADCOMMANDROUTINE*G*ˆThecommandserviceprocessorinvokestheREADCMDroutineinresponseB*ˆtoareadcommand.‚ItspurposeistoprepareforadatatransferE*ˆfromthedisktomemorybasedonthedrive'scurrentconfiguration.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask**’D5=03*’D6=Channeldevice#forthediskdrive(DCBCDV)*!*ˆRegisterusage:…01234567*™D‚******* *™A‚*PƒPPP***ˆCalls:„CHK_MT,CMD_COM,BUF_COM,CONVERT*-*ˆExit:…BranchestoSTART_IOroutineifokay.,*’BranchestoCMDEXIT2iferrorisdetected.*O*******************************************************************************O******************************************************************************* READCMD:.‰BSR†CHK_MTDetermineifthedriveismounted. ;‰MOVEQ.L‚#READFUNC,D5‰SetupflagforreadcommandintoD5.)‰BSR†CMD_COMŽDothestuffcommonforI/O.1‰BSR.L„BUF_COMŽDothestuffcommontoread/write.6‰BSR.L„CONVERTŽConverttheVERSAdossectortological.‰BRA.L„START_IO‰PAGEO*******************************************************************************O*********************************************************************************ˆWRITECOMMANDROUTINE*H*ˆThecommandserviceprocessorinvokestheWRITECMDroutineinresponseC*ˆtoawritecommand.‚ItspurposeistoprepareforadatatransferE*ˆfrommemorytothediskbasedonthedrive'scurrentconfiguration.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6 =physicaladdressofTCBofattachedtask**’D5=03*’D6=Channeldevice#forthediskdrive(DCBCDV)*!*ˆRegisterusage:…01234567*™D‚******* *™A‚*PƒPPP***ˆCalls:„CHK_MT,CMD_COM,BUF_COM,CONVERT*-*ˆExit:…BranchestoSTART_IOroutineifokay.,*’BranchestoCMDEXIT2iferrorisdetected.*O*******************************************************************************O******************************************************************************* WRITECMD:.‰BSR†CHK_MTDetermineifthedriveismounted. 9‰MOVEQ.L‚#WRTFUNC,D5ŠSetupflagforwritecommandinD5.)‰BSR†CMD_COMŽDothestuffcommonforI/O.1‰BSR.L„BUF_COMŽDothestuffcommontoread/write.6‰BSR.L„CONVERTŽConverttheVERSAdossectortological.‰BRA.L„START_IO‰PAGEO*******************************************************************************O*********************************************************************************ˆFORMATCOMMANDROUTINE*F*ˆThecommandserviceprocessorinvokestheFORMATroutineinresponseE*ˆtoaformatcommand.‚Itspurposeistopreparetoformat-alternate,E*ˆformat-diskorformat-trackbasedondrive'scurrentconfiguration.*Ü Å5Î;Ö?Þ>æ5î5ö7þ68=??&C.?6F>>F;N8VA*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask**’D5=03*’D6=Channeldevice#forthediskdrive(DCBCDV)*!*ˆRegisterusage:…01234567*™D‚******* *™A‚*PƒPPP***ˆCalls:„CHK_MT,CMD_COM,CONVERT,FRMTALT*-*ˆExit:…BranchestoSTART_IOroutineifokay.,*’BranchestoCMDEXIT2iferrorisdetected.*O*******************************************************************************O******************************************************************************* FORMAT:.‰BSR†CHK_MTDetermineifthedriveismounted. :‰MOVEQ.L‚#FMTFUNC,D5ŠSetupflagforformatcommandinD5.2‰BSR†CMD_COMŽDothestuffcommonforallcommands. .‰MOVEQ.L‚#0,D2SettheVERSAdosrecordlength.6‰BSR.L„CONVERTŽConverttheVERSAdossectortological.*A*ˆForalternatesectorcommands,OffsetIOSALT=IOSSADholdsthe@*ˆsectornumberforthealternatesector,andwewanttosaveit*ˆinIOBUFLOC=IOALTSEC.*-‰CMP.W„#IOPBAD,IOOPTS(A1)ƒFormatbadcommand? ‰IF‡THEN=ŠMOVE.LƒIOSSAD(A4),D6‡GetsectornumberofalternateintoD6.3ŠBSR.LƒFRMTALTŽExecutesubroutinetosetthingsup.‰ENDI ‰BRA.L„START_IO‰PAGEO********************************************************************************0*ˆSUBROUTINETOCHECKFORTHEDISKBEINGMOUNTED*C*ˆThissubroutineiscalledbytheREAD,WRITEandFORMATcommands.A*ˆItsfunctionistochecktheMOUNTEDbyteofthedriveblocktoC*ˆensurethedriveismountedbeforeprocessingthecommand.‚Ifthe8*ˆdriveisnotmounted,weexitwithanerrorcondition.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*%*ˆExit:…RTStocallerifallisokay."*’CMDEXIT2ifdiskisnotmounted.*O******************************************************************************* CHK_MT:8‰MOVEQIƒISTADNM,D1Ifthediskthatisbeingaccessedis6‰TST.B„MOUNTED(A1)Šnotmounted,rejectthecommandand#‰BEQ†CMDEXIT2returnanerrorcode. ‰RTS‰PAGEO********************************************************************************.*ˆSUBROUTINETODOWORKCOMMONTOALLCOMMANDS*C*ˆThisroutineiscalledbythehandlersofREAD,WRITE,FORMATandB*ˆCONFIGUREcommands.‚Itsfunctionistodotheworkcommontoall@*ˆcommandsgoingtothediskcontroller.‚Itstoresthefollowing 7*ˆfieldsinthedriveblock:‚IOOPTS,DRIVENUM,IOFUNCT,'*¤CTRLCODE,IOCBPTR,DCBPNTR,IOBUFTCB.G*ˆItinitializesEOVFLAGtocontaingoodstatus.Itclearsthesefields3*ˆinthedriveblock:‰NOFINISH,HALFSCTS,IOSCTCNT,)*¤IOSECTOR,IOBUFEND,IOBUFLOC,IOBUFPTR.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask**’D5=I/OFunctionflag*’D6=Devicenumber*!*ˆRegisterusage:…01234567*™D„* *™A‚*P…P*0*ˆCalls:„SET_CODEinthedevice-dependentmodule**ˆExit:…RTSbacktothecaller.*O******************************************************************************* CMD_COM: =‰MOVE.LƒCCBTASKA(A5),A0†PointA0totheTCBthatcontrolsthe*¦taskthatownstheIOCB. *7*ˆSavethevariableswehavesofarinthedriveblock.*C‰MOVE.WƒIOSOPT(A4),IOOPTS(A1)CopytheI/Ooptionsfield,thedrive=‰MOVE.BƒD6,DRIVENUM(A1)†numberandtheI/Ofunctionflaginto'‰MOVE.BƒD5,IOFUNCT(A1)‡thedriveblock. 1‰T_JSR„SET_CODECalculatethecontrollercodeand*¦copyitintothedriveblock.‰PAGEC‰MOVEM.L‚A0/A3/A4,IOBUFTCB(A1)‚SavetheTCB,DCBandIOCBaddresses. *%*ˆInitializeEOVFLAGforgoodstatus.*5‰MOVEQIƒISTAOK,D1ŒInitializeEOVFLAGtoindicategood‰MOVE.BƒD1,EOVFLAG(A1)‡status.*8*ˆClearthevariablesthatwedon'thavevaluesforyet.*‰MOVE.Lƒ#0,IOBUFPTR(A1)‰MOVE.Lƒ#0,IOBUFLOC(A1)‰MOVE.Lƒ#0,IOBUFEND(A1)‰MOVE.Lƒ#0,HALFSCTS(A1)‰MOVE.Lƒ#0,IOSECTOR(A1)‰MOVE.Lƒ#0,IOSCTCNT(A1)  ‰MOVE.Bƒ#0,NOFINISH(A1) ‰RTS‰PAGEO********************************************************************************9*ˆSUBROUTINETODOWORKCOMMONTOREADANDWRITECOMMANDS*:*ˆThisroutineiscalledbythehandlersofREADandWRITE?*ˆcommands.‚Itsfunctionistocheckthatthedriveismounted,<*ˆgettheVERSAdosrandomrecordnumber,validatethebuffer:*ˆaddressandlength,andfillthefollowingfieldsinthe6*ˆdriveblock:‚IOBUFEND,IOBUFTCB,IOBUFPTR,IOBUFLOC.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*!*ˆRegisterusage:…01234567*™D‚**Rƒ*** *™A‚*P…P*7*ˆExit:…D2=CountofVERSAdosrecordstobeprocessed.**ˆCalls:„LOGPHY1*.*ˆExitsto:RTSbacktocallerifallisokay. *’CMDEXIT2iferrorisdetected.*O******************************************************************************* BUF_COM: =‰MOVE.LƒCCBTASKA(A5),A0†PointA0totheTCBthatcontrolsthe*¦taskthatownstheIOCB. *B*ˆTheIOOPTSfieldalreadystoredinthedriveblocktellsuswhen@*ˆtheIOCBincludestheoptionalIOSTSKandIOSSESfields.‚TheseB*ˆfieldsdesignatethetaskthatownstheI/Obufferwhenthetask>*ˆthatownstheIOCBisasystemtaskthatdoesn'towntheI/O *ˆbuffer. 5ˆTST.W„IOOPTS(A1)‹TesttheoptionsfieldforTaskID.0ˆIFTHEN’Ifthetaskisasystemtask. 6‰LEA†IOSTSK(A4),A0ŠWeneedtogetapointertotheTCB5‰MOVE.LƒA1,-(SP)thatcontrolsthetaskthatownsthe7‰MOVE.Lƒ#T0GETTCB,D0‰I/Obuffer.‚TheT0GETTCBexecutive/‰TRAP…#EXECrequestusesA0asapointertothe4‰BRA.S„L0350IOSTSK/IOSSESpacket,anditreturnsA0)*¦withapointertotheTCBthatcontrols"*¦thespecifiedtask.‚TheT0GETTCB(*¦executiverequestdestroysA1,D0,D1,)*¦andD2,butwepreservethevalueofA1$*¦bysavingitonthestack.‚Control%*¦returnsfromtheT0GETTCBexecutive(*¦requesttotheinstructionimmediately&*¦followingtheTRAPinstructionifno*¦errorsaredetected. 9L0340„MOVEQIƒISTAADD,D1ControlreturnsfromtheT0GETTCB4‰BRA†CMDEXIT2executiverequesttothispointifthe'*¦specifiedtaskdoesn'texist.‚Inthis%*¦case,wereportanerrorindicating$*¦th atthespecificationfortheI/O%*¦bufferisbad.‚Noticethatwedon't(*¦needtocleanupthestackbecausethe*¦errorroutinecleansitup. 8L0350„MOVE.Lƒ(SP)+,A1RestoreA1topointtothedrive's)*¦areaofthedrive-associatedportionof*¦globalmemory.‰ENDI 1‰MOVE.LƒA0,IOBUFTCB(A1)ˆSavethenewTCBaddress. 9‰MOVE.LƒIOSSAD(A4),D6ŠGetthephysicaladdressoftheI/O<‰MOVE.LƒIOSEAD(A4),D5ˆbufferintoD6,andgetthelength(in.‰SUB.L„D6,D5bytes)oftheI/ObufferintoD5.5‰ADD.L„#1,D5SubroutineLOGPHY1requiresthebuffer's3‰BSR.L„LOGPHY1ŽlogicaladdressanditslengthinD6&*¦andD5asinputs,andthesubroutine(*¦alsoassumesthatA0pointstotheTCB&*¦thatcontrolsthetaskthatownsthe(*¦I/Obuffer.SubroutineLOGPHY1returns)*¦buffer'sphysicaladdressinD6,andit *¦preservestheotherregisters. ?‰MOVE.LƒD6,IOBUFPTR(A1)†Savethebufferpointerindriveblock.@‰MOVE.LƒD6,IOBUFLOC(A1)†Savethebufferlocationindriveblock.*C*ˆWewanttofindtheaddressofthelastbyteintheuser's‚bufferC*ˆandsaveitinIOBUFEND.‚ThiswillenableustodoublecheckthatB*ˆwewillnotreadpasttheendofthebuffer,whichwouldbebad.**‰MOVE.L„D5,D4D4<---LengthofI/Obuffer.‰ADD.L…D6,D4D4<---Startingaddress+length!‰SUBQ.L„#1,D4—-1=endingaddress‰MOVE.L„D4,IOBUFEND(A1)‰PAGE*A*ˆCalculatethetotalnumberofVERSAdosrecordstobeprocessed.*'*¨Dividethebuffersize(inD5)bythe?EQ380„EQU†CONFGBLK+IOSREC†VERSAdosrecordsize.‚Thequotientin<‰DIVU.WƒEQ380(A1),D5‰D5.WtellsushowmanyVERSAdosrecords'*¦weneedtoprocess,andtheremainder&*¦inthetophalfofD5shouldbezero)*¦becausewedon'tallowanyI/Otransfer"*¦thatinvolvesapartialVERSAdos *¦record. '*¨Wedon'tneedtoworryaboutdividing#*¦byzeroherebecausetheVERSAdos$*¦recordsizeisanonzeroconstant. 1‰MOVEQ.L‚#0,D2’MovethecountofVERSAdosrecords2‰MOVE.WƒD5,D2intoD2,andreportabuffer-address4‰CMP.L„D5,D2errorifthetophalfofD5isnonzero.1‰BNE.S„L0340ThetophalfofD5canbenonzeroin$*¦oneoftwoways.‚Eitherthebuffer(*¦sizeisn'tanintegralmultipleofthe#*¦VERSAdosrecordsize,orelsethe)*¦buffersizeissolargethatitexceeds)*¦thecapacityof65,535VERSAdosrecords$*¦(i.e.,16,776,960bytes).‚Withthe)*¦presentleveloftechnologythereisno'*¦needtoallowasingleI/Ocommandto(*¦specifyatransferofmorethan65,535*¦VERSAdosrecords.‰RTS‰PAGEO********************************************************************************;*ˆSUBROUTINETOCONVERTVERSADOSRECORDSTOLOGICALSECTORS*C*ˆThisroutineis‚calledbythehandlersof‚READ,WRITE,andFORMATD*ˆcommands.‚ItsfunctionistovalidatetheVERSAdosstartingrecordE*ˆnumberandtruncatethelengthiffoundtogobeyondtheendoftheA*ˆdisk.‚Itthen‚convertsthe‚VERSAdosrecord‚numbersdefiningtheC*ˆstartandlength‚oftheI/Otransfer‚tologicalsectornumberson>*ˆthedisk.‚Itstoresthefollowingfieldsinthedriveblock:(*ˆIOSECTOR,IOSCTCNT,HALFSCTS,NOFINISH*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*1*’D2=CountofVERSAdosrecordstobeprocessed.*•=0forformatcommands.*!*ˆRegisterusage:…01234567 *™D‚**R*R*™A‚*P*,*ˆExit:…RTSbacktothecallerifnoerrors.!*’CMDEXIT2iferrorsencountered.**’D2=Countoflogicalsectors%*’D4=Startinglogicalsectornumber*O******************************************************************************* CONVERT:*A*ˆDeterminewhetherthestartingVERSAdosrecordnumberisbeyond)*ˆtheendofthedisk.‚Exitnowifitis.*;‰MOVE.LƒIOSRRN(A4),D3ˆGetthespecifiedVERSAdosrecordno. ;EQ890„EQU†CONFGBLK+IOSRSZˆNowchecktoseeifthespecified6‰M  OVE.LƒEQ890(A1),D0‰VERSAdosrecordnumber(inD3)is2‰SUB.L„D3,D0beyondtheendofthedisk,andabort0‰IFTHEN’withanerrorreportifitis.‚The3ŠMOVEQIISTARR,D1userhasaseriousproblemifthe5ŠBRA„CMDEXIT2Žspecifiedstartingrecordisbeyondthe)‰ENDIšendofthedisk.‚RecallthatIOSRSZ(*¦specifiesthetotalnumberofVERSAdos'*¦recordsavailableontheentiredisk.&*¦Sincetherecordnumberofthefirst&*¦recordiszero,therecordnumberof)*¦thelastVERSAdosrecordonthediskis *¦IOSRSZ-1. #*¦D0<--#ofVERSAdosrecordsfrom%*¦startingrecordtotheendofdisk.‰PAGE*B*ˆDeterminewhetherthenumberofVERSAdosrecordstobeprocessedA*ˆwillgobeyondtheendofthedisk.Truncatelengthifitdoes.*-‰CMP.L„D0,D2’Checktoseeiftherecordcount4‰IF‚THEN‘exceedsthenumberofVERSAdosrecords:ŠMOVEQIISTAEOV,D1Œthatareavailablebetweenthestarting=ŠMOVE.BD1,EOVFLAG(A1)ˆrecordandtheendofthedisk.Change-ŠSUB.L‚D0,D2‘EOVFLAGtoreflecttheerrorand8ŠMULUƒ#VDOSRSZ,D2‹truncatethelengthoftransferinD2.8ŠSUB.L‚D2,IOBUFEND(A1)‡UseD2totruncatethebufferend1ŠCLR.L‚D2”addresstomatchthelengthoftransfer*ŠMOVE.WD0,D2‘thatwe'regoingtoprocess.‰ENDI%*¨ThereareroutinesinVERSAdosthat(*¦dependonustoreturnthisparticular(*¦errorcodewhenanI/Otransferstarts'*¦atalegalVERSAdosrecordnumberbut%*¦extendsbeyondtheendofthedisk. *3*ˆConverttheVERSAdosrecordsintologicalsectors*7‰MOVE.WƒSCTPVREC(A1),D0ˆGetthenumberofsector(s)per2‰MULU.WƒD0,D2VERSAdosrecordintoD0,andconvert'*¦thecountofVERSAdosrecords(inD2)%*¦intoacountoflogicalsectors.‚D2'*¦nowtellsushowmanylogicalsectors(*¦toprocess.Theresultisa32-bitno. 0‰MOVEQ.L‚#0,D4’HerewesetD4<--D3*SCTPVRECto7L0680„ADD.L„D3,D4starttheconversionofthespecified2‰BCS.S„L0730VERSAdosrecordnumberintoalogical-‰SUB.W„#1,D0sectornumber.‚We'reeffectively3‰BHI.S„L0680multiplyingtheVERSAdosrecordnumber)*¦bythenumberoflogicalsector(s)ina&*¦singleVERSAdosrecord,butwecan't(*¦useamultiplyinstructionbecausethe$*¦VERSAdosrecordnumberis32-bits. *,*ˆDeterminedisktypetocompleteconversion*?EQ690„EQU†CONFGBLK+IOSATWˆIfthediskthatisbeingaccessedisB‰BTSTW„#IOARDISC,EQ690(A1)‚aharddisk,or128BYTES/SECTORfloppy-‰BNE.S„L0750disk,therestoftheconversionB***†BTSTW„#IOADDEN,EQ690(A1)ƒroutinecanbeskippedbecauseD4now>‰CMP.W„#VDOSRSZ>>1,CONFGBLK+IOSPSM(A1)hasthecorrectlogical‰BEQ.S„L0750sectornumber.‰PAGE*.*„Conversionfor256BYTES/SECTORfloppydisks!*ˆD2<--Countoflogicalsectors(*ˆD3<--StartingVERSAdosrecordnumber'*ˆD4<--Startinglogicalsectornumber 4‰MOVEQ.L‚#0,D0’We'redealingwitha256BYTES/SECTORAEQ710„EQU†CONFGBLK+IOSSPT†floppydisk.GetthenumberofVERSAdos;‰MOVE.BƒEQ710(A1),D0‰recordsintrackzero(recordedin128#‰LSR.B„#1,D0BYTES/SECTOR)intoD0. *@*ˆCheckforthestartinglogicalsectornumberbeyondtrackzero*2‰CMP.L„D0,D4’Ifthestartinglogicalsectornumber4‰BHS.S„L0740isbeyondtheendoftrackzero,goadd(*¦IOSSPT/2toittocorrectforthefact)*¦thatthesectorsintrackzeroareonly%*¦halfsectors.‚Allofthesectorsin)*¦trackzerowerecountedasfullsectors$*¦intheoriginalcomputationofthe*¦logicalsectornumber. *1*ˆThestartingsectornumberiswithintrackzero*.‰SUB.L„D4,D0D0<--fullsectorsintrackzero1‰ASL.W„#1,D4D4<--Startingsectorintrackzero*B*ˆDoublesectorcountifentireI/Otransferiswithintrackzero.?*ˆIncreasesectorcountbynumberoffullsectorsintrackzero,*ˆifthetransferextendsbeyondtrackzero.*/‰CMP.L„D0,D2D2<--totalcountoffullsectors1‰BHI.S„L0720Branchifextendsbeyondtrackzero.3‰MOVE.LƒD2,D0D0/D2<--totalcountoffullsectors1L0720„ADD.L„D0,D2D2<--countoflogicalsectors‰BCC.S„L0755Errorifoverflow. &*¦D0<--countoffulls  ectorstrack0‰PAGE*ˆalogicalsectornumberandtostorethefollowingfieldsin?*ˆthedriveblock:‚IOALTSEC,IOBUFPTR,ALTCYL,ALTHEAD,BADSEC.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*.*’D4=Logicalsectornumbertobemarkedbad.'*’D6=AlternateVERSAdosrecordnumber*!*ˆRegisterusage:…01234567 *™D‚**ƒ* *™A‚*P…P**ˆCalls:„LSN2CHS*'*ˆExit:…RTSbacktothecallerifokay.&*’CMDEXIT2ifanerrorisencountered.*O******************************************************************************* FRMTALT:*?*ˆThealternatesectorscommandonlyworksfortherigiddisks,>*ˆsowewillcheckhereifwehavearigiddiskandabortwith*ˆanerrormessageifnot.*"‰MOVEQI„ISTAIF,D1•Ifthisisnota/‰MOVE.W„CONFGBLK+IOSATW(A1),D0ˆrigiddisk,then'‰BTSTW…#IOARDISC,D0’abortwithanerror‰BEQ.L…CMDEXIT2–message. *3*ˆRecallthatthealternatesectornumberisinD6.*4‰MOVE.L„CONFGBLK+IOSRSZ(A1),D0ˆIfthissectornumber(‰MOVEQI„ISTARR,D1•goesbeyondtheendof!‰SUB.L…D6,D0™thedisk,thenabort&‰BLS.L…CMDEXIT2–withanerrormessage.‰PAGE*@*ˆConverttheVERSAdosrecordnumber‚inD6intoalogicalsector5*ˆnumberinD3,thenmoveintoIOALTSECandIOBUFPTR.*/‰MOVE.W„SCTPVREC(A1),D0…SetD3<---D6*SCTPVREC/‰MOVEQ.Lƒ#0,D3bysuccessiveadds,sinceIOSALT‰MOVEQI„ISTARR,D1#‰REPEAT˜ismaybemorethan16bits.-ADD.LƒD6,D3Abortifresultexceeds32bits.BCS.LƒCMDEXIT2 SUBQ.W‚#1,D0 ‰UNTIL.S‚<‰MOVE.L„D3,IOALTSEC(A1)…Logicalsectoraddressofalternate.7‰MOVE.L„D3,IOBUFPTR(A1)…MustalsobesavedinIOBUFPTR.*A*ˆWearegoingtocheckthatthetrackofthealternatesectoris<*ˆnotthesameasthetrackofthebadsector.‚Ifitis,theE*ˆcontrollerwouldmakethattrackinaccessible,andthat'sanerror.*A*ˆThesubroutineLSN2CHStakesalogicalsectornumberinD0,and?*ˆreturnsthecylindernumberinD0.W,theheadnumberinD1.B,1*ˆandthesectornumberwithinthetrackinD2.B.* ‰MOVE.L„D6,D0‰BSR.L…LSN2CHS‰MOVE.W„D0,ALTCYL(A1! )‰MOVE.B„D1,ALTHEAD(A1)*@*ˆConvertsectortobemarkedbadinD4tocylinder,head,sector.* ‰MOVE.L„D4,D0‰BSR.L…LSN2CHS<‰MOVE.B„D2,BADSEC(A1)‡Itisthesectornumberwithinthebad*¦trackthatweneedtosave.*1‰CLR.L…D2’Wedon'tneedtocomparesectornumbers**¦withinthetrack,andweneedtorestore"*¦D2to0becauseitisgoinginto *¦IOSCTCNT$‰CMP.W…ALTCYL(A1),D0‡Samecylinder?!‰BNE.S…NOT_ALTIfnot,noproblem7‰CMP.B…ALTHEAD(A1),D1†Samecylinderandsameheadmeans#*¦sametrack,andthisisanerror.‰IFƒƒTHEN.S“MOVE.B„#ISTAIF,D1 “BRA‡CMDEXIT2‰ENDINOT_ALT‰RTS‰PAGEO********************************************************************************%*ˆSUBROUTINETOCHECKTHEDEVICECODE*;*ˆThisroutineiscalledbythehandlerofCONFIGcommands.;*ˆItsfunctionistocheckthedevicecodeforthischannelD*ˆtoseethatitexistsintheDSKTYPEmoduleandisassociatedwith@*ˆthecurrentchannel.‚Ifitexists,thefollowingfieldsinthe=*ˆdrive'svariableblockareset:‚DRV_CODE,REC_ATT,REC_PAR,*ˆREC_XAT,REC_XPR*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB.*’A5=physicaladdressofCCB.*!*ˆRegisterusage:…01234567 *™D‚*** *™A„PƒPƒP*/*ˆExitto:‚RTStocallingroutineifallisok. *’CMDEXIT2iferrorisdetected.*O******************************************************************************* CHK_DEVICE: /‰MOVE.B„CCBTYPE(A5),D0ƒD0<--ourchanneltype.7‰LEA‡CH_TYPES,A0†A0<--addroftableofchanneltypes. -‰MOVE.B„DCBFLG(A3),D2„D2<--ourdevicecode.<‰MOVE.B„D2,DRV_CODE(A1)‚Storeinthedrive'svariableblock. ‰FOR.W…D1=#1‚TO‚#NUMTYPESƒDO‹CMP.Bƒ(A0)+,D0‹BEQ‡CHAN_FOUNDCHK_AGAIN‚ADD.L…#NUMBYTES-1,A0‰ENDF*8*„DEVICECODEWASNOTFOUNDASSOCIATEDWITHOURCHANNEL:*5‰MOVE.B„#ISTANDV,D1†ReturnNon-existantdeviceerror. ‰BRA‡CMDEXIT2*@*…Achannelmatchingourshasbeenfound,seeifourdevicecode>*…matchestheDRV_CODEentryinDSKTYPE.‚A0ispointingtotheB*…devicecodeentryinthetable.‚NotethattheCHANNELmustexistA*…becausewecheckeditatINITIALIZATIONtime,wecouldn'tcheck9*…ourdevicecodebecausewedidn'tknowitatthattime.* CHAN_FOUND‰CMP.B…(A0),D2ŠIsthisforme?(‰BNE‡CHK_AGAINˆNo-tryanotherchannel.‰PAGE*D*…Ourdevicecodeandchanneltypematchesthatstoredinthetable.2*…LoadREC_ATTandREC_PARfromthetableentries.**—Channeltype“(byte)*ŒA0‚---->‚Drivecode•(byte)*—RecognizedattributesŠ(word)*—RecognizedparametersŠ(word)'*—RecognizedExtendedattributes(word)'*—RecognizedExtendedparameters(word) 5‰MOVE.B„(A0)+,D2‹Alreadyhavethedevicecodestored.7‰MOVE.W„(A0)+,REC_ATT(A1)‚Setuptheattributesandthe9‰MOVE.W„(A0)+,REC_PAR(A1)‚parametersmasksinthedrive's)‰MOVE.W„(A0)+,REC_XAT(A1)‚variableblock.‰MOVE.W„(A0)+,REC_XPR(A1)‰RTS‰PAGEM*******************************************************************************ˆSTART_IOSUBROUTINE*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*!*ˆRegisterusage:…01234567*™D„* *™A‚*P…P*?*ˆCalls:„BLD_PACKET,DISK_STARTinthedevice-dependentmodule.**ˆExit:…RTSbacktothecaller.*M***************************************************************************** START_IO:5‰T_JSR„BLD_PACKETCallthedevice-dependentdriverto3‰IF‚‚THENbuildthecommandpacketforthedisk/‹BRA„CMDEXIT2controllerboard.‚Conditioncodes'‰ENDIšsetifthedriverdetectsan"*¦errorwhilebuildingthepacket. ;‰MOVE.LƒIOBUFTCB(A1),A0ˆIncrementtheTCBIOCNTfieldofthe;‰ADD.B„#1,TCBIOCNT(A0)†TCBthatcontrolsthetaskthatowns)*¦theI/Obuffer(ortheIOCBinthecase#*¦of! aformataconfigurecommand).$*¦TheTCBIOCNTfieldofatask'sTCB'*¦indicateshowmanyI/Orequest(s)the#*¦taskhaspendingcompletionunder*¦interruptcontrol. 3‰MOVE.WƒSR,-(SP)SavethevalueoftheSR,andthen9‰MOVE.WƒCCBISR(A5),SRˆinhibitinterruptsatthechannel's*¦interruptlevel. 5‰T_JSR…DISK_STARTŒCallthedevice-dependentdriverto$*¦docommandqueueingandsettingup*¦ofINTSWTCH,etc. 5‰MOVE.Wƒ(SP)+,SRRestoretheSR,andtransfercontrol4‰BRA†CMDEXIT3tothecommandprocessor'scommonexit *¦routine.‰PAGEM******************************************************************************B*ˆLSN2CHS--Convertlogicalsectornumbertocylinder,head,sector*“withintrack.*&*ˆAlgorithm:„(SPT=sectorspertrack)*–(LSN=logicalsectornumber)**’LSN.*‹----------------ˆ=…Cylinderno.+Remainder1*ŠSPT*Numberofheads* *Remainder1,*‹------------------†=…Headno.+Remainder2*’SPT*)*ˆRemainder2‚=‚sectornumberwithintrack*/*ˆEntry:„A1=addressofdrive'svariableblock*’D0=logicalsectornumber*!*ˆRegisterusage:…0ƒ1234567"*™D‚P/RRR‘P=Parameterregister*™A†P“R=Returnregister**ˆExit:…D0.B=Cylindernumber*’D1.B=Headnumber**’D2.B=Sectornumberwithintrack(0-31)**ˆExitsto:RTStocaller*O******************************************************************************* LSN2CHS: ‰CLR.L…D1 ‰CLR.L…D26‰MOVE.B„CONFGBLK+IOSHDS(A1),D1‡D1<---Numberofheads8‰MOVE.B„CONFGBLK+IOSSPT(A1),D2‡D2<---Sectorspertrack2‰MULU†D2,D1D1<---Numberofheads*Sectors/track"‰DIVU†D1,D0D0.W=Cylindernumber"‰MOVE.L„D0,D1D1.W<---Remainder1 ‰LSR.L…#8,D1 ‰LSR.L…#8,D1‰DIVU†D2,D1D1.W=HeadNumber.‰MOVE.L„D1,D2D2.W<---Sectornumberintrack ‰LSR.L…#8,D2 ‰LSR.L…#8,D2‰RTS‰PAGEO********************************************************************************(*ˆLOGICAL-TO-PHYSICALADDRESSCONVERSION*F*ˆGivenaphysicalTCBaddressandthelogicaladdressandlengthofaE*ˆmemoryarea,subroutine‚LOGPHYcomputesthephysicaladdressoftheE*ˆmemoryarea.‚ItalsocheckstomakesurethatthegivenmemoryareaE*ˆreallybelongstothetask‚thatiscontrolledbythespecifiedTCB.*D*ˆThesubroutinewillnotreturnunlessthespecifiedmemoryresidesH*ˆentirelywithinthememorysegmentthatbelongstothespecifiedtask.*?*ˆEntry:„A0=physicaladdressofTCBoftaskcontainingbuffer;*’D6=logicaladdressofthefirstwordofthememoryarea)*’D5=lengthinbytesofthememoryarea*!*ˆRegisterusage:…01234567 *™D‚PP‡PR *™A‚PP‡P*B*ˆExit:…D6=physicaladdressofthefirstwordofthememoryarea *’Returntothecallingroutine.*O******************************************************************************* -LOGPHY1‚BSR†LOGPHY‘UsetheroutineinDRVLIB. ‰IF‚THEN.S5‹MOVEQIƒISTAADD,D1‹LOGPHYreturnsthisconditioncode)‹BRA†CMDEXIT2‹if(1)thespecifiedmemory'*¦areaiscompletelyoutsideanymemory'*¦segmentthatbelongstothespecified'*¦taskor(2)thespecifiedmemoryarea!*¦isinamemory-mappedI/Oarea.‰ENDI *‰RTSControlreachesthispointwhenwe've'*¦madeasuccessfuladdressconversion.‰PAGEJ****************************************************************************•BACKGROUND*œAND*”CALL__GUARDED**˜ROUTINES**•(DEVICEINDEPENDENT)*J************************************************************************** O*********************************************************************************‰SENDTHEEVENT(CALLGUARDED)*6*‰Somebodyincommandservicewantstoqueueanevent,=*‰butofcoursehecouldn'tsenditsincetheQ_EVENTroutine;*‰canonlybecalledfromthebackground.‚Soheaskedmeto)*‰doitforhim.‚I'msuchaniceroutine.*!*ˆEntry:„A3ƒ=‚AddressoftheDCB.*’A4ƒ=‚AddressoftheIOCB.*’A5ƒ=‚Add" ressoftheCCB.*’D1.B=‚Error/statuscode.*!*ˆRegisterusage:…01234567*™D„P *™AˆPPP**ˆCalls:„Q_EVENT***ˆExit:…RTSbacktocallerifallisokay.*’KILLERiferrorisdetected.*O******************************************************************************* DO_EVENT: /‰ST†NONINTERRUPT(A5)ƒSetupforanormalevent.0‰BSR…Q_EVENTŒCalltheroutinetosendtheevent.‰SF†NONINTERRUPT(A5) ‰IF‚‚THEN&ŠKILL.DRIVERDISKLIB_ID,T0QEVNTT,A5,A3‰ENDI ‰RTS‰PAGEJ***************************************************************************5*‰QUEUEACOMPLETIONEVENTTOTHEATTACHEDTASK(IOS)*;*‰ThisroutinecallstheexectosendasmalleventtoIOS.;*‰ItusesI_NRM_QEVENTifwe'reprocessinganinterruptand:*‰N_NRM_QEVENTifwe'renot.‚TheseroutinesareinDRVLIB.*7*‰NOTE:thisroutinemayonlybecalledfromwithinthe*background!!!!!*!*ˆEntry:„A3ƒ=‚AddressoftheDCB.*’A4ƒ=‚AddressoftheIOCB.*’A5ƒ=‚AddressoftheCCB.*’D1.B=‚Error/statuscode.4*’NONINTERRUPT=00=Processinganinterruptevent.0*’NONINTERRUPT=FF=Processinganormalevent.*!*ˆRegisterusage:…01234567*™D„P *™AˆPPP*#*ˆCalls:‚I_NRM_QEVENT,N_NRM_QEVENT*7*ˆExit:ƒRTSbacktocallerwiththeconditioncodeset:**=Theeventwassucessfullyqueued."*=UnsucessfulTRAP#0call.*O******************************************************************************* Q_EVENT: :‰MOVEM.LƒD3/A0,-(A7)‰Savetheregisterswewillblowaway. 9‰MOVE.BƒD1,IOSSTA(A4)ŠStorethestatuscodeintotheIOCB&*¦whereitcanbeexaminedbythetask$*¦thatoriginallyrequestedtheI/O. **‚SetupA0andD3forDRVLIB:*/‰MOVE.L„#0,A0A0<--0=DONOTCOPYTHEEVENT! ‰MOVE.L„A3,D3D3<--DCBaddress #‰IF.BƒNONINTERRUPT(A5)‚‚#0ƒTHEN$‹BSR.LƒI_NRM_QEVENTˆInterruptevent.‰ELSE!‹BSR.LƒN_NRM_QEVENTˆNormalevent.‰ENDI +‰MOVEM.L‚(A7)+,D3/A0ŠRestoretheregisters.‰RTS‰PAGEL*****************************************************************************/*ˆROUTINES„FOR„THE…INTERRUPT*'*‹HANDLER…FOR„THE…DEVICE**’DEPENDENT…MODULE*L**************************************************************************** O*******************************************************************************O*******************************************************************************O*********************************************************************************ˆINTERRUPTHANDLER*B*ˆThis‚subroutineiscalledfromthedevice-dependentdriverafterC*ˆitcompletesthedevice-dependentinterrupthandling.‚ItspurposeA*ˆisdothecommonthingsforcommandcompletioninterrupts.‚It's*ˆspecificfunctionsare:*=*Š1.GettheTCB,IOCBandDCBaddressesandtheIOBUFLOCand;*IOBUFPTRvariablesoutofthedriveblockintodesignated *registers.1*Š2.Calculatethedatatransferlengthinbytes.=*Š3.CompletetheIOSRRNfieldifthespecificVERSAdoserror*coderequiresit.'*Š4.QueuethecompletioneventtoIOS.D*Š5.DecrementthecountofoutstandingI/Ooperationsforourtask.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’A5=physicaladdressofCCB*’D1=VERSAdoserrorcode,*’D2=Logicalsectornumberoferrorsector*!*ˆRegisterusage:ˆ01234567 *œD‚S** *œA„SƒSSP**ˆCalls:„MATCH_ERR,Q_EVENT*+*ˆExit:…RTStothedevice-dependentmodule.*O*******************************************************************************O*******************************************************************************O******************************************************************************* CHAN_DONE: 0EQ630„REG†D0/D2/A1/A3/A4‡Saveworkingregisters.‰MOVEM.L‚EQ630,-(A7)Š* #‰TST.B„D1“Testtheerrorcondition.4‰IFTHEN’Iftherewasanerrorforthecommand,4ŠBSR†MATCH_ERR‹executet" hesubroutinethatcompletes,‰ENDIštheIOSRRNfieldoftheIOCBifreq'd.‰PAGE@‰MOVEM.L‚IOBUFLOC(A1),EQ630…WeuseaMOVEM.Linstructiontopull&*¦severalvariablesoutofdriveblock'*¦inonestep.‚Thisinstructionsetsup*¦theregistersasfollows: L1‡SET†IOBUFLOCD0=IOBUFLOC.L1‡SET†IOBUFPTRD2=IOBUFPTR.L1‡SET†IOBUFTCBA1=IOBUFTCB.5L1‡SET†DCBPNTRŽA3=DCBPNTR.‚(ForsubroutineQ_EVENT)5L1‡SET†IOCBPTRŽA4=IOCBPTR.‚(ForsubroutineQ_EVENT) $*¨TheSETinstructionsthatareused'*¦herearejustdummyinstructionsthat&*¦generateartificiallabelreferences*¦fortheconcordancelisting. 1‰SUB.L„D0,D2’Nowcomputethenumberofdatabytes=‰MOVE.LƒD2,IOSLEN(A4)ˆthatweactuallytransferred,andstore&*¦thatnumberintotheIOSLENfieldof%*¦theIOCB.‚ForanI/Ooperationthat%*¦doesn'tinvolvethetransferofany%*¦read/writedata,wehaveIOBUFLOC=)*¦IOBUFPTR,soweproperlysetIOSLEN=0*¦inthiscase. 3‰SF†NONINTERRUPT(A5)†Setupforaninterruptevent.*‰BSR…Q_EVENTGosendthecompletionevent. ‰IF‚‚THEN&ŠKILL.DRIVERDISKLIB_ID,T0QEVNTI,A5,A3‰ENDI 9‰SUB.B„#1,TCBIOCNT(A1)ˆDecrementthecountofoutstanding'*¦I/Ooperationsforthetaskthatowns)*¦theI/Obuffer(ortheIOCBinthecase%*¦ofaformatcommandoraconfigure-*¦floppycommand).‰MOVEM.L(A7)+,EQ630‰RTS‰PAGEO*********************************************************************************ˆMATCH_ERRROUTINE*C*ˆThisroutinedetermineswhethertheVERSAdoserrorcodepassedinF*ˆregisterD1mustupdatetheIOSRRNfieldintheIOSparameterblock.*A*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory.*’D1=VERSAdoserrorcode,*’D2=Logicalsectornumberoferrorsector*!*ˆRegisterusage:ˆ01234567*œD‚#PŽ#=savedbyCHAN_DONE *œA„#ƒ##**ˆExit:…RTStocaller*O******************************************************************************* MATCH_ERR:3‰LEA‡ERRDISK(PC),A4†TesttheVERSAdoserrorcodeto=LOOKING‚MOVE.B„(A4)+,D0ŒdeterminewhethertheIOSRRNfieldof8‰BEQ.S…NOTFOUNDŒtheIOCBneedstobeupdated.Ifamatch0‰CMP.B…D0,D1isfoundinthetableERRDISK,then'‰BNE.S…LOOKINGupdatetheIOSRRNfield. ***ˆWehaveamatchofVERSAdoserrorcodes.>*ˆCalculatetheVERSAdosrecordnumberfromthelogicalsector*ˆnumberreturnedinD2.*@EQ635„EQU‡CONFGBLK+IOSATW‡Determinethedisktypefromthedrive@‰BTSTW…#IOARDISC,EQ635(A1)variableblock.‚Ifitisaharddisk,2‰BNE.S…E150theLSNequalstheVERSAdossectorno. A***†BTSTW…#IOADDEN,EQ635(A1)„Ifthisisa128BYTES/SECTORfloppyB‰CMP.W#VDOSRSZ>>1,CONFGBLK+IOSPSM(A1)disk,dividetheLSNbytwo.‰BEQ.S…E100togettheVERSAdossectornumber. AEQ640„EQU‡CONFGBLK+IOSSPT†Wemusthavea256BYTES/SECTORfloppy.7‰MOVEQ.Lƒ#0,D0Usethesectorspertrackvaluefromthe8‰MOVE.B„EQ640(A1),D0ˆdrive'svariableblocktodetermine3‰CMP.L…D0,D2iftheerrorsectoriswithintrack0.4‰BLT.S…E100Ifitswithintrack0,dividetheLSNby4‰LSR.L…#1,D02togettheVERSAdossectornumber.If4‰SUB.L…D0,D2itsbeyondtrack0,convertthesectors3‰BRA.S…E150pertracktoVERSAdossectorspertrack'*¦andsubtractthatfromtheLSNtoget*¦theVERSAdossectornumber.‰PAGE 3E100…LSR.L…#1,D2ConvertfromLSNbydividingby2.E150…MOVE.L„IOCBPTR(A1),A4‰MOVE.L„D2,IOSRRN(A4) NOTFOUND‰RTS O********************************************************************************1*ˆVERSADOSDISKERRORCODESCROSS-REFERENCETABLE*A*ˆThislistofVERSAdoserrorcodesaretheonesthatmustupdate.*ˆtheIOSRRNfieldintheIOSparameterblock.*O******************************************************************************* ,ERRDISK‚DC.B†ISTACMPD2=DATACOMPAREERROR'‰DC.B†ISTASPED3=SECTORPROTECTERROR!‰DC.B†ISTACRCE3=DATACRCERROR*‰DC.B†ISTADDME5=DELETEDDATAMARKERROR2‰DC.B†ISTADMEEC=TRACK/SECTORIDNOTFOUNDERROR)‰DC.B†ISTAMRKED=ADDRESSM# ARKCRCERROR#‰DC.B†ISTABDSEF=BADSECTORERROR‰DC.B†0 *********************** *‚PATCHSPACE***********************‰DS.Wƒ30‰ENDNNNNN?EPCIDRVƒIDNTƒ45,0†VERSAdos2661terminaldriverwithtype-ahead;ŠTTL„EPCIDRV:‚VERSAdos2661terminaldriverwithtype-ahead ŠLLENƒ120J**************************************************************************J**************************************************************************J**************************************************************************J***************************************************************************9*‰EPCIDRV:‚VERSAdos2661terminaldriverwithtype-ahead.*8*‰Purpose:‚VERSAdosdevicedrivertohandleasynchronous3*terminals(ofanytype)overtheSIG2661chipon*thefollowingboards: *’MVME101**‰Revisionhistory:*7*12/18/85‚InstallNEWKillermodificationwhichleaves,*šTheDriverID(Number)andReason(Number)2*šinCRASHSAValongwiththeCCBandDCBpointers.7*02/14/85‚ModifiedINITERRroutinetoclearthestatus5*šregisterflags;oldinstruciondidnotclearflags./*šModifiedPUT_CHARtodisableinterruptsuntil,*šcharacteristransmitted;oldinstructions *šallowedcharacterstobelost.1*10/23/84‚AllBSR'stoTERMLIBnowJSR'sincase.*šTERMLIBislocatedmorethan32Kbytesaway.:*10/01/84‚ChangedPASS19.MPSCDRV.SAtodrivetheSIG2661,+*šalsodeletedXREF'stoBREAKandGET_LEN.3*‘8/30/84‚FixedSPRconcerningSETUP.‚Commentedout(*šthecodethatteststhemodembit.‚Now**šiftheoffhookbitisset,theDTRline&*šissetlow,‚whetherornotthemodem *šbitisset.*6*‘10/3/83‚Changestoletinterruptsworkcorrectlyfor**š2661chip.AlsoallowesDATAI/Otowork0*šviaRTSline(notDTR).DTRisalwaysenabled.*š(2661chiponly).,*šChangedby:MarcoSchmidtMotorolaMunich.2*‘8/19/83‚Addedconditionalassemblystufftomake-*šthisdriverassembleforthe7201chip(the4*šoriginaldriver)andfortheSignetics2661(EPCI),*šchip.‚The2661isonboththeVM01andthe*šMVME101board.8*‘4/7/83‚ChangedUNSTOProutinetofixbugwhereachar(*šisdestroyedintheUSEXOFF/XONmode.* ^0g;oEw=/‡—AŸ?§G¯L·H¿LÇNÏV×7*10/19/82‚Majorrepairssothatinterruptswillnotbe3*šdisabledsolongastoscrewupSDLC.‚Revision1.**‘9/16/82‚InitialreleasebySteveFranck.*J**************************************************************************J******************# ********************************************************J**************************************************************************J**************************************************************************‰PAGE***‚XREF'sfromTERMLIB* ‰XREF†LOG_ERR ‰XREF†RESET‰XREF†TERM_INIT‰XREF†TERM_COMMAND‰XREF†TERM_TBE‰XREF†TERM_BREAK‰XREF†TERM_GOT_CHAR**‚Equatefilesincluded:**ˆ9995.&.SIG2661.EQ*ˆ9995.&.STR.EQ*ˆ9995.&.TCB.EQ*ˆ9995.&.CCB.EQ*ˆ9995.&.BAB.EQ*ˆ9995.&.IOE.EQ*ˆ9995.&.NIO.EQ*ˆ9995.&.LV5.EQ**ˆ9995.&.TERMINAL.EQ„Equatesforterminals*ˆ9995.&.UTILITY.MCA*ˆ9995.&.TERMCCB.EQ…OffsetsandequatesforCCBDDPforterminals.*ˆ9995.&.KILL.MC*ˆ9995.&.KILLDRV.EQ*ŠNOLISTŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠINCLUDE9995.&.BAB.EQŠINCLUDE9995.&.UTILITY.MCŠINCLUDE9995.&.KILL.MCŠINCLUDE9995.&.KILLDRV.EQŠLISTŠINCLUDE9995.&.SIG2661.EQŠINCLUDE9995.&.TERMINAL.EQŠINCLUDE9995.&.TERMCCB.EQŠOFFSET‚TERMDDP*0*‚DevicedependentBackgroundactivationblocks:$*„NonerequiredfortheEPCIdriver.**@*ƒComputethenumberofpagesofmemorythatweneedforoneCCBNN>*ƒfortheMPSCdriver.‚CMRautomaticallyallocatesonepageofA*ƒmemory($100bytes)fortheCCB,andourvariableEXTCCBSZwillB*ƒresideintheCMRparametertableatthebeginningofthedriver8*ƒtotellCMRhowmanyextrapagesofmemoryareneeded.**CCBSIZEBEQU‡*PAGESIZEEQU‡$100L1‡SET‡CCBSIZEB+PAGESIZE-1CCBSIZE‚EQU‡L1/PAGESIZEEXTCCBSZEQU‡CCBSIZE-1;ŠTTL„EPCIDRV:‚VERSADOS2661TERMINALDRIVERWITHTYPE-AHEADŠPAGEJ***************************************************************************+*‰SERVICEVECTORTABLE,REVISIONINFO,ETC.*@*‰ThistableisexaminedbyCMRwhenthechannelisallocatedtoC*‰determinewheretogoforinterrupts,commands,&initialization.<*‰Itmustalwaysbeattheverytopofthedrivercode.‚Also>*‰includedisaparametertellingthenumberofextrapagesof>*‰memorytoincludeintheCCB,andinformationdescribingthe*‰revisionofthedriver.*L**************************************************************************** ŠSECTION‚0ŠOPT„BRS EPCIDRV: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!*=ŠDC.LƒINTERRUPT-EPCIDRV‚Addressofinterruptserviceroutine.9ŠDC.LƒCOMMAND-EPCIDRV„Addressofcommandserviceroutine.5ŠDC.LƒINIT-EPCIDRV‡Addressofinitializationroutine.ŠDC.Lƒ0’Reserved. **‚OtherCMRparameters.*7ŠDC.BƒEXTCCBSZ‹#ofextrapagesintheCCB.‚TheCCBmay)*§beanysizefrom1to256pages(apage'*§is256bytes):‚ifthisfieldis0,it*§willbe1page,etc.ŠDC.Bƒ0,0,0ŽReserved.ŠDC.Lƒ0,0,0ŽReserved. **‚Revisioninfo:*/ŠDC.Bƒ'121885'‹DateoflastassemblyasMMDDYY.1ŠDC.Bƒ''Spaceindicatesnopatchesto.LOfile.)ŠDC.Bƒ'4'MajorVERSAdosrevisionnumber.*‰PAGE*+*‚JumptableforusebythegenericTERMLIB*‰BRA.L…PUT_CHAR ‰BRA.L…CK_TBE‰BRA.L…DDP_RESET ‰BRA.L…SETUP‰BRA.L…CLOCK_RESET‰BRA.L…GET_STAT‰BRA.L…DDP_STOP‰BRA.L…DDP_UNSTOP‰BRA.L…DDP_BEG_BREAK‰BRA.L…DDP_END_BREAK **‰PAGEJ**************************************************************************J**************************************************************************J**************************************$ **************************************‰INITIALIZATIONROUTINE*>*‰ThisroutineiscalledbyCMRwhenthechannelisallocated.9*‰Itspurposeistosetupthingsforcommandserviceand7*‰interruptservice.‚Themajorfunctionsperformedare:"*Validatethechanneltypefield.+*Getmemoryfortransmit&receivequeues..*Initializeflags,pointers,etc.intheCCB.*Initializethe2661.*@*‰WegotherethroughaJSRfromCMR,andwillexitwithanRTS.>*‰AllregistershavebeensavedbyCMRandmaybeusedfreely.?*‰Entryisatinterruptlevel0,andweareinsupervisormode.**‰Entry:A5=addressofCCB.*'*‰Exitsto:‚CMR(viaRTS)ifallisOK.'*”KILLERifexecwon'tallocatememory.*J**************************************************************************J**************************************************************************J************************************************************************** ŠDS…0 INIT:.‰JSR‡TERM_INIT‹Dothedevice-independentstuff2‰IFƒƒTHEN…SomethingwentwrongwithTERM_INIT.4‰IFƒƒTHEN„Theexeccallfailedandwecannotget!*œthescheduler'sentrypoint!!!-‹KILL.DRIVEREPCIDRV_ID,BAD_T_INIT,A5,#NO_DCB‰ELSERTSThechannelisdown!!‰ENDI‰ENDI*?*‚Callguardedforthedevicedependentinitializationroutine.**‰LEA‡DO_INIT(PC),A0‰MOVE.L„#T0GUARD,D0‰TRAP†#0‰RTSŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰COMMANDSERVICEROUTINE*>*‰Wegetenteredherewhentheattachedtask(IOS)invokesCMR?*‰viaaTRAP1withanINITIATEI/Oparameterblocktoprocess.>*‰CMRhasalreadycheckedtheCMRparameterblocktoensureit<*‰resideswithintheaddressspaceoftheattachedtask.‚IOSA*‰hasalreadyvalidatedtheIOCB,exceptforthebufferaddresses *‰therein.*@*‰WegotherethroughaJSRfromCMR,andwillexitwithanRTS.>*‰AllregistershavebeensavedbyCMRandmaybeusedfreely.?*‰Entryisatinterruptlevel0,andweareinsupervisormode.*5*‰Entry:A2=physicaladdressofCMRparameterblock*A5=physicaladdressofCCB*3*‰Exit:‚D0=resultsofparameterblockvalidation:3*•always0inourcase,indicatingitwasOK,since2*•IOSwillnotsendusanyrequestexceptHALTI/O/*•ifwearealreadybusy,andCMRmakesallthe*•otherchecks.*A*‰Note:‚TERMLIBdoesnotrecognizeCMRcommandsforHALT&RESET.B*‰HALTcanstillbeaccomplishedthroughuseoftheHALTI/OIOCB.*J**************************************************************************J**************************************************************************J************************************************************************** COMMAND:‹JSR…TERM_COMMAND‹RTS—returntoCMR.‹PAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INTERRUPTHANDLINGROUTINE*<*‰ThisroutinecompletesI/Orequestsstartedbythecommand:*‰serviceroutine.‚Itisenteredattheinterruptpriority;*‰levelofinterruptsonthischannel,andisessentiallya9*‰subroutinetothefirstlevelinterrupthandlerinCMR.*:*‰Entry:D0,A0,A1havebeensavedbyCMRandareavailable*A5=addressofCCB*9*‰ExitisalwaysviaRTS,whichtakesusbacktoCMR.‚The3*carrybitisexaminedbyCMRtodeterminewhether7*thedriverhandledtheinterruptorwhetheritshould4*passtheinterruptontothenextguyinthechain*onthatvector:*='Ihandledit'**‰Stack:*(A7)+4...*(A7)ƒlongwordreturnaddress*J**************************************************************************J************$ **************************************************************J************************************************************************** INTERRUPT:ŠPUSH.LD1‘saveD1*ŠMOVE.LCCBCHB(A5),A1†getaddressof2661.8ŠMOVE.BCREG(A1),D1ˆgetcontentsofthecontrolregister7ŠMOVE.BSREG(A1),D0ˆgetcontentsofthestatusregister*-*‰dowehaveanythingenabledonthisdevice?**ŠBTSTƒ#TXEN,D1‹isthetransmitterenabled?3ŠBNE.S‚INT010branchifitis-we'egettingcloser'ŠBTSTƒ#RXEN,D1‹isthereceiverenabled?1ŠBNE.S‚INT010branchifitis-we'reevencloser*3*‰thisinterruptmustnotbeforus-returntoCMR*5INTNOP„POP.L‚D1‘restoreD1soCMRwillworkcorrectly$ŠAND.W‚#$FFFE,SRŠclearthecarrybitŠRTS—andgoawayŠPAGENNNN*8*ˆisprobablysomeinterruptforus-findoutwhatkind*$INT010ƒPUSH.L„D2ˆnowweneedD2also6‰MOVE.B„D0,D2…needanothercopyofthestatusregister!‰AND.B…#$38,D2ƒgetanyerrorbits*‰BNE.S…SRC‡branchifanyerrorbitsareon‰POP.L…D2ˆrestoreit.‰BTST†#RXRDY,D0isthereareceiverinterrupt?'‰BNE.S…RCA‡branchifyes-gohandleit1‰BTST†#TXRDY,D0isthereatransmitterinterrupt?'‰BNE.S…TBE‡branchifyes-gohandleit8‰BTST†#DNR,D0ƒisthereachangeintheDSRorDCDlines?‰BNE.S…DSRTN…branchifthereis,‰BTST†#FB,D1„areweintheforcebreakmode?+‰BNE.S…FBMODE„branchifforcingabreaknow*B*ˆifwegotheretherereallywasn'toninterruptforusafterall*‰BRA.S…INTNOP„andreturn‰PAGEJ***************************************************************************)*‰TRANSMITBUFFEREMPTYINTERRUPTHANDLER*=*‰The2661'stransmitbufferjustbecameempty,soifwehave+*‰morecharacterstosendwecandoitnow.**‰Entry:A0=NOTUSED*A1=addressof2661NNN*A5=addressofCCB*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** TBE:(ŠMOVE.B„CREG(A1),D1‰getco% ntrolregister%ŠBCLR†#TXEN,D1ŒswitchofftheXmitter!ŠMOVE.B„D1,CREG(A1)‰loadthechip *%%%%%%%%%%ƒBWN‚9/17/84*F*‚Callthedevice-independentroutinethatdealswithtransparentmode)*‚orinvokestheXMITbackgroundroutine.* ‰JSR‡TERM_TBE‰BRA.S…INT_EXIT‰PAGEJ***************************************************************************(*‰RECEIVEDCHARACTERAVAILABLEINTERRUPT*=*‰The2661hasjustreceivedacharacter,anditisavailable=*‰forreading.‚Wewilldothatnow,andtheresultwillgoin$*‰thereceivequeueifthere'sroom.**‰Entry:A0=NOTUSED*A1=addressof2661*A5=addressofCCB*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** RCA:/‰MOVE.B„DREG(A1),D0‰Getthecharfromthechip.*C*‚CallthedeviceindependentroutinetocheckfortransparentmodeG*‚anddothestufffortransparentmodeorifnotintranparentmodetoG*‚checkforanyspecialcharacterssuchasXON,XOFF,BREAKEQUIVALENT,G*‚orDISCARDOUTPUT.Otherwise,putthecharacterinthereceivequeue.*‰JSR‡TERM_GOT_CHAR‰BRA.S…INT_EXIT‰PAGEN*******************************************************************************%*ˆSPECIALRECEIVECONDITIONINTERRUPT,*‘Anerrorbitisoninthestatusregister.*‘Determineactualcause.*‘bit3=parityerror*‘bit4=dadaoverrun8*‘bit5=framingerrororbreak(breakifdatareg=0)**ˆEntry:ƒA0=NOTUSED*‘A1=addressof2661*‘A5=CCBadddress*‘D0=statusregistervalue*‘D1=controlregistervalue$*‘D2=errorbitsofstatusregister)*–D2MUSTbepulledoffthestackinhere*O******************************************************************************* SRC:+‰POP.L„D2“restoreD2tomaketheresthappy6‰BSET…#ERRSET,D1‹clearstatusregerrorflags„02/14/85%‰MOVE.BƒD1,CREG(A1)Šdoittothechip‰BTST…#PE,D0aparityerror?,‰BEQ.S„INTERR10branchifnotaparityerror;INTERR05PUT_BYTEPAR_FRAM,D0Šsetparity/framingerrorcode ‰JSR†LOG_ERRŽandgotellsomeone‰BRA.S„INT_EXIT$INTERR10BTST…#DOVR,D0dataoverrun?*‰BEQ.S„INTERR20branchifnotdataoverrun0‰PUT_BYTEOVERRUN,D0‹setdataoverrunerrorcode ‰JSR†LOG_ERRŽandgotellsomeone‰BRA.S„INT_EXIT%INTERR20BTST…#FE,D0aframingerror?3‰BEQ.S„INT_EXITbranchifno-weshouldn'tbehere;‰MOVE.BƒDREG(A1),D0Šseeifabreakinsteadofframingerror0‰BNE.S„INTERR05branchifreallyaframingerror**ˆabreakwasreceived*(‰MOVE.B„CREG(A1),D1‰getcontrolregister"‰BCLR†#RXEN,D1Œswitchoffreciever)‰MOVE.B„D1,CREG(A1)‰tellcontrolregister*3‰JSR†TERM_BREAK‹Callthedeviceindependentroutine*¦totakecareofabreak.‰BRA.S„INT_EXIT‰PAGEO*********************************************************************************ˆFBMODE„FORCEBREAKINTERRUPT/*‘Weareinaforcebreakmode.‚Wewanttostay3*‘inthismodeuntilthetimerwepreviouslyset-up *‘expires.**ˆEntry:‚A0=NOTUSED*A1=addressof2661*A5=CCBaddress*O******************************************************************************* FBMODE:+‰BRA.S„INT_EXITjustexitinterruptservice‰PAGEO******************************************************************************** *ˆDSRTN…DATASETREADYINTERRUPT4*’TherewasachangeintheDSRlineorthe‚DCDline3*’orthetransmitterwentempty.‚Weonlycareabout*’thetransmittergoingempty.**ˆEntry:‚A0=NOTUSED*A1=addressof2661*A5=CCBaddress*D0=statusregistervalue*D1=controlregistervalue*O******************************************************************************* DSRTN:/‰MOVE.BƒSREG(A1),D1Šre-readthestatusregister,‰BTST…#DNR,D1Žistheinterruptbitstillon?3‰BEQ.S„INT_EXITbranchifno,ignorethisinterrupt,‰CMP.B„D0,D1seeifDSRandDCDhavechanged/‰BNE†TBE’thisisreallyatransmitterinterrupt2‰BRA.S„I% NT_EXITwedon'tcareaboutthisinterrupt‰NOP‰PAGE*E*‚Nowexitasfromaninterrupt.‚WemayinfacthavebeencalledfromF*‚commandserviceorinitialization,buttheyhadtosetituptolook*‚likeaninterrupt,too.*INT_EXIT:POP.L‚D1‘RestoreD1,7ŠMOVEQ‚#1,D0ŽsetcarrybittotellCMR'wehandledit,' ŠSUBQƒ#2,D0Ž*ŠRTS—andreturn.ŠPAGEO********************************************************************************2*‰ROUTINESTOSETTHECLOCKDIVISORTOx16ANDx64*7*‰Noworkheresince2661cannotsettheclockdivisor.*=*‰WemusthaveaCLOCKRESETentrypointforTERMLIB,however.**‰Entry:*‹A5ƒ=addrofourCCB.**‰Exit:*O******************************************************************************* CLOCK_RESET:ŠRTSŠPAGEK*****************************************************************************!*ROUTINES„CALLED„BY**–TERMLIB**F**********************************************************************‰PAGEL******************************************************************************ˆTRANSMITTHECHARACTER*?*ˆThisisthedevicedependentroutinethatactuallywritesthe*ˆcharactertothedevice.*F*ˆTheoffsettothisroutinemustbeinstalledatthebeginningofthe *ˆdriver.**ˆEntry:„A1=addressof2661*’A5=addressofCCB*’D0.B=charactertotransmit*ˆInterruptlevelonentry:0*C*ˆExit:…Allregistersarepreserved,includingthestatusregister.<*’Itisimportanttokeeptheinterruptlevelthesameasit*’wasuponentry.*J************************************************************************** PUT_CHAR:ŠSAVE„D1ŠPUSH„SR D***Thefollowingcodewascommentedoutandre-arrangedtoŠ02/14/85#*** prevent the loss of characters:)***‡MOVE.B‚D0,DREG(A1)ˆtransmitthechar.0***‡MOVE.B‚CREG(A1),D1ˆswitchonthetransmitter***‡BSET„#TXEN,D1‹setthebit$***‡MOVE.B‚D1,CREG(A1)ˆtellthechip ŠINHIBIT/ŠMOVE.B‚CREG(A1),D1ˆreadcurrentregistervalue-ŠBSET„#TXEN,D1‹setthetransmitterenablebit7ŠMOVE.B‚D1,CREG(A1)ˆtellthechiptoenabletransmitter*ŠMOVE.B‚D0,DREG(A1)ˆtransmitthecharacter ŠPOP…SR ŠRESTORED1ŠRTS‰PAGEM******************************************************************************$*ˆCHECKTHEDEVICE'STRANSMITBUFFER*F*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledat*ˆthebeginningofthedriver.**ˆEntry:A1=addressof2661*A5=addressofCCB*ˆInterruptlevelonentry:0**ˆExit:‚Conditioncodes:"*=transmitbuffernotempty*=transmitbufferempty<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.*M*****************************************************************************CK_TBE:ŠMOVEM.LD0-D1,-(A7)ŠPUSHƒSRŠINHIBIT ŠMOVE.BCREG(A1),D1 ŠMOVE.BD1,D0ŠBSETƒ#TXEN,D1ŠMOVE.BD1,CREG(A1)5ŠBTST.B#0,SREG(A1)ˆTestiftransmitbufferisempty. ŠIFTHEN$ŒMOVE.BD0,CREG(A1)†BUFFERISEMPTY.ŒPOP„SR4ŒAND.W‚#$FFFB,SRˆsetconditioncodeforreturn.ŒMOVEM.L(A7)+,D0-D1ŒRTS ŠENDI **‚Transmitterisnotempty:*(ŠMOVE.BD0,CREG(A1)ˆBUFFERISNOTEMPTY.ŠPOP„SR3ŠOR.Wƒ#$0004,SRŠsetconditioncodeforreturn.ŠMOVEM.L(A7)+,D0-D1ŠRTS‰PAGEH************************************************************************* *ˆDEVICEDEPENDENTRESETROUTINE*9*ˆThisisthedevice-dependentpartoftheresetroutine.*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.**ˆEntry:A5=addrofCCB*ˆInterruptlevelonentry:0*$*ˆExit:‚Allregistersarepreserved.<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.*E********************************************************************* DDP_RESET:6ŠMOVEM.L‚A1/D0,-(A7)†saveusedregistersonthestack.ŠPUSH…SRŠINHIBIT )& ŠMOVE.LƒCCBCHB(A5),A1„getaddressof26615ŠMOVE.Bƒ#$37,CREG(A1)„turnthetranmitteron,rec.on'ŠMOVE.BƒDREG(A1),D0†clearanyinterrupt ŠPOP†SR0ŠMOVEM.L‚(A7)+,A1/D0†Restoresavedregistersand ŠRTS—exit.ŠPAGEJ***************************************************************************@*‰SUBROUTINETOSETUPTHEDEVICEACCORDINGTOTHECONFIGURATION*;*‰Usestheworkingconfiguration(intheCCB)tosetupthe;*‰device,andsomeconfiguration-relatedfieldsintheCCB.*?*‰Theoffsettothisroutinemustbeinstalledatthebeginning*‰ofthedriver.**‰Entry:A5=addressofCCB*‰Interruptlevelonentry:0*$*‰Exit:‚Allregistersarepreserved.<*‰Itisimportanttokeeptheinterruptlevelthesameasit*‰wasuponentry.*J************************************************************************** SETUP:<ŠMOVEM.LD0-D1/A0-A3,-(A7)Savesomeregistersonthestack.ŠPUSHƒSR**‚Firstsetupaddresses:4ŠLEA„CONFIG(A5),A0†A0<--addrofCCBconfiguration.3ŠMOVE.LCCBCHB(A5),A1†A1<--addrofour2661port. -ŠPUT_BYTE‚ASY16X,D0…Startwithx16clockrate:ŠBTSTW‚#IOASTPB,IOSATW(A0)Addinthenumberofstopbits. ŠIF…THENŠOR.B…#SB1,D01stopbitŠELSEŠOR.B…#SB2,D02stopbitsŠENDI >ŠBTSTW‚#IOAUSEP,IOSATW(A0)Ifwe'reusingparity,enableit... ŠIF…THENŠOR.B…#PENBL,D0:ŠBTSTW‚#IOAPRTY,IOSATW(A0)andifwe'reusingevenparity,ŠIF…THENŠsetitup.ŠOR.B…#PTYPE,D0ŠENDIŠENDI 1ŠBTSTW‚#IOABITS,IOSATW(A0)Addinbits/charinfo. ŠIF…THENŠOR.Bƒ#BIT7,D0ˆ(7bits/char)ŠELSEŠOR.Bƒ#BIT8,D0ˆ(8bits/char)ŠENDI ŠINHIBIT2ŠMOVE.BƒD0,MREG1(A1)…setmodereg1foraboveinfo2ŠMOVE.BƒIOSBRT(A0),D0„getuserspecifiedbaudrate#ŠOR.B…#ITCX16,D0‡set16xclockrate=ŠMOVE.BƒD0,MREG2(A1)…setmodereg2for16xclockrate&baud ŠMOVE…(A7),SRŠPAGE*/*‚[5]„RTS&DTRlineslow,transmitterenabled,*‰bits/charfromconfiguration.*2ŠMOVE.Bƒ#$37,D0Žsetfornorm,RTSlow,reseterror"*ªflags,nobreak,disabletransmit,*ªenablereceiver,DTRlow***5***‚Removethemodemtest,aspertheMPSCDRVdriver:***C****†BTSTW‚#IOAMODM,IOSATW(A0)„Ifthisisamodemwe'retalkingto,****†IF…THENŽ*8ŠBTSTW‚#IOAOFFH,IOSATW(A0)„andtheguywantsitoffhook,ŠIF…THENŽ*ŠAND.B‚#$FF-DTR,D0 ***‡ENDIš*ŠENDIš* ŠINHIBIT,ŠMOVE.B‚D0,CREG(A0)ˆsetthecontrolregister0ŠMOVE.B‚SREG(A0),D0ˆclearanypendinginterruptsŠPOP„SR **‚Restoreregistersandreturn.*8ŠMOVEM.L(A7)+,D0-D1/A0-A3Restoreregistersfromstack.ŠRTSŠPAGEJ****************************************************************************‰GETDEVICESTATUSBYTE*"*‰PreparestheDEVICESTATUSbyte.*8*‰Note:‚thisroutinedoesnotsetthebreakindicatorin*thedevicestatusbyte.*?*‰Theoffsettothisroutinemustbeinstalledatthebeginning*‰ofthedriver.**‰Entry:A5=addressofCCB*‰Interruptlevelonentry:0*&*‰Exit:‚D0.B=thedevicestatusbyte.<*‰Itisimportanttokeeptheinterruptlevelthesameasit*‰wasuponentry.*J************************************************************************** GET_STAT:*4* Let's see if the device status bit 'DSR' is ready.* ‰CLR.B…D0‰MOVEM.LƒD1/A0,-(A7) 2‰MOVE.L„CCBCHB(A5),A0‡gettheaddressofthe2661.5‰MOVE.B„SREG(A0),D1‰gettheDSRbitofthestatusreg ‰TST.B…D1/‰IFˆTHEN‹bit7istheDSRbitin2661chip5‰BSET†#XDSNRB,D0Šsettheunreadybitinthedev.state‰ENDI ‰MOVEM.Lƒ(A7)+,D1/A0‰RTS‰PAGEM******************************************************************************5*ˆDEVICEDEPENDENTSTUFFFORLOWERINGAHARDWARELINE*ˆTOSTOPTHETRANSMITTER.*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.**ˆEntry:‚A1=addressof2661*A5=addressofCCB3*ˆInterruptlevelonentry:INHIBITEDatourlevel.*$*ˆExit:ƒAllregistersarepreserved.*K**********& ***************************************************************** DDP_STOP:*0*ˆTheVME101boardneedsRTSforthehandshake!*ŠSAVE…D0 ,ŠMOVE.BƒCREG(A1),D0‰getthecontrolregister%ŠBCLR…#RTS,D0disablerequesttosend%ŠMOVE.BƒD0,CREG(A1)‰doittothechip ŠRESTORE‚D0ŠRTSŠPAGEK****************************************************************************$*ˆDEVICEDEPENDENTUNSTOPTHEDEVICE*=*ˆWhenwearenotusingXOFF/XON,weunstopthedeviceinour*ˆowndevicedependentway.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.**ˆEntry:‚A1=addressof2661*A5=addressoftheCCB3*ˆInterruptlevelonentry:INHIBITEDatourlevel.*$*ˆExit:ƒAllregistersarepreserved.*J************************************************************************** DDP_UNSTOP:*2*‰fortheVME101weneedRTStodothehandshake.*ŠSAVE…D0 ,ŠMOVE.BƒCREG(A1),D0‰getthecontrolregister$ŠBSET…#RTS,D0enablerequesttosend)ŠMOVE.BƒD0,CREG(A1)‰anddoittothechip ŠRESTORE‚D0ŠRTSŠPAGEK****************************************************************************&*ˆDEVICEDEPENDENTBEGINBREAKROUTINE*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.**ˆEntry:‚A1=addrof2661*A5=addrofCCB3*ˆInterruptlevelonentry:INHIBITEDatourlevel.*$*ˆExit:ƒAllregistersarepreserved.*E********************************************************************* DDP_BEG_BREAK:*)*‚startthe2661sendingthebreaksignal*‰SAVE„D0 9‰MOVE.B‚CREG(A1),D0†getcurrentstateofcontrolregister)‰OR.B„#FB,D0‹turnontheforcebrackline+‰OR.B„#TXEN,D0‰turnonthetransmitteralso-‰MOVE.B‚D0,CREG(A1)†andwriteitallbackout ‰RESTORED0‰RTS‰PAGEK****************************************************************************$*ˆDEVICEDEPENDENTENDBREAKROUTINE*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.**ˆEntry:‚A1=addrof2661*A5=addrofCCB3*ˆInterruptlevelonentry:INHIBITEDatourlevel.*$*ˆExit:ƒAllregistersarepreserved.*L**************************************************************************** DDP_END_BREAK:ŠSAVE„D0 9ŠMOVE.B‚CREG(A1),D0ŠgetcurrentstateofcontrolregisterŠBCLR„#3,D0turnoffthebreak,ŠBCLR„#TXEN,D0turnoffthetransmitteralso)ŠMOVE.B‚D0,CREG(A1)Šandwriteitbackout0ŠMOVE.B‚SREG(A1),D0Šclearanypendinginterrupts ŠRESTORED0ŠRTSŠPAGEI***************************************************************************“BACKGROUND**šAND**‘CALL__GUARDED**–ROUTINES**•(DEVICE-DEPENDENT)*E*********************************************************************ŠPAGEO*********************************************************************************‰FINISHOFFTHEINITIALIZATION*A*‰Theinitializationroutinehasgonearoundresettingeverything@*‰itcan,buttheroutinesRESETandSETUPshouldonlybecalled>*‰fromwithinthebackground.‚Soheinvokedthisroutinetodo *‰itforhim.**‰Entry:*A1=addressof2661.*A5=addressofCCB.*O******************************************************************************* DO_INIT:**‚Inhibitinterrupts*‰PUSH†SR‰INHIBIT*)*‚GetaddressofstartofdriverintoCCB*‰LEA‡EPCIDRV(PC),A4‰MOVE.L„A4,DRV_ADDR(A5) ‰JSR„RESETŽReseteverything.‰BSR.L‚DDP_RESET5‰BSR.L‚SETUPŽSetupthe2661accordingtotheconfig.**‚Enableinterruptsnow.*‰POP‡SR‰RTS‰PAGE*********************** *‚PATCHSPACE***********************ŠDS.Wƒ30ŠEND  ' NNNNNNNDIPCDRV„IDNTƒ48,0…VERSAdosIPCchannelI/OHandlerProcess-01/16/86@ŠTTL„IPCDRV:‚VERSAdosIPCchannelI/OHandlerProcess-01/16/86 ŠNOFORMATŠPAGE ŠLLENƒ120J***************************************************************************,* IPC -- REV. 1.05 02JUN80 (TB59) STEVE BALL4*2.0002NOV81(TL09)JIMSMITH…-SPLITIPCFROMCMR.*2.0101FEB82(TL09)JIMSMITH…-VECTORCHAIN**2.0223FEB82(TL09)JIMSMITH…-IOCBUSE4*4.0001SEP82ˆMARCBRIEL„-CONFIGURECLASSREQUESTS4*4.3014SEP83(TB59)STEVEBALL„-FIXHALTI/OBUGS6*4.xx23APR84ˆFREDMATHESON-UPDATEPERNEWFIRMWARE3*4.4028NOV84ˆPHILDUCLOSƒ-ADDCONFIGAREAINCCB:*4.4127DEC84ˆDICKVANDERLIN-BUGFIXFORDCTTABLESIZE.*4.4319MAR85ˆPHILDUCLOSƒ-FIX‚HALTI/OBUGS8*4.4426MAR85ˆPHILDUCLOSƒ-ADDUPDATEIOSATWINCONFIG8*4.4512JUN85ˆPHILDUCLOSƒ-QUICKFIXFORCMDCHANBUGS*>*ˆ4.45ISAQUICKANDDIRTYFIXFORSOMECOMMANDCHANNELBUGS.F*ˆPLEASE!!!FIXTHESEBUGSCORRECTLYSOMETIMEINTHEFUTURE.PJD61285*8*4.4610SEPT85‡BobMatthewsƒ-IntheLUDTBLthecurrent*²configurationareafor*²entries4,5,6,7readIOSPLN*²andshouldhavebeenIOSTLN*2*4.4712DEC85ˆMikeD.ˆ-InstallNEWKillerstuff.7*4.4816JAN86ˆSTEVELUDWIGƒ-returncyls,hds,sptdisks*B*******************************************************************+*ChangestoIPCDRVforversion4.3ƒ8/28/84*?*‚1.TheIPCdriverhasbeenmodifiedtotakeadvantagesofthe;*…increasedfunctionalityprovidedbyrecentchangestothe*…MCCMfirmware.*+*ChangestoIPCDRVforversion4.3ƒ9/25/84*<*‚1.TheIPCdriverwasmodifiedtodeleterefenencestothe*…SecondayMapbit.*?*‚2.TheIPCdriverwasmodifiedtoincludechangesrequiredby*…4.4enhancements.* *ChangestoIPCDRVƒ11/26/84ƒPJD*G* 1. The device area was moved from an allocated segment to the CCB andF*„currentconfigurationinformationwasaddedtotheCCB.‚2additional@*„segmentsarenowrequiredfortheCCB.‚ThegetsegcallfortheØß4è\ð?øI0>G8 G(I0D8B@IH5P7XV`ThNp=x<€7ˆ==˜= B¨=°6¸EÀKÈ?' *„deviceareawasdeleted.*C********************************************************************.* USER REQUEST SIDE FOR IPC COMMAND PROCESSING*9*ƒPURPOSE:‚VALIDATEANDPASSIPCCOMMANDINFORMATIONFROM#*USERTOIPC,68000SHAREDMEMORY.**ƒENTRY:‚JSRFROMCMRHANDLER*‹JSRFROMINTERRUPTHANDLER*5*ƒEXIT:‚RTS-PARAMETERBLOCKVALIDATIONSTATUSIND0***ƒSYSGENOPTIONS:DCBCONFIGUREPARAMETERS**ƒEXECROUTINESCALLED:‚QEVENTT**ƒCODEISRE-ENTRANT*H*-----------------------------------------------------------------------**ŠPAGE **‚Includedequatefiles:*ˆ9995.&.TRACE.EQ*ˆ9995.&.STR.EQ*ˆ9995.&.TCB.EQ*ˆ9995.&.CCB.EQ*ˆ9995.&.IOE.EQ*ˆ9995.&.NIO.EQ*ˆ9995.&.LV5.EQ*ˆ9995.&.KILL.MC*ˆ9995.&.KILLDRV.EQ*ŠNOLISTŠINCLUDE9995.&.TRACE.EQŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠINCLUDE9995.&.KILL.MCŠINCLUDE9995.&.KILLDRV.EQN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<ŠINCLUDE9995.&.DUALPORT.MCŠINCLUDE9995.&.UTILITY.MCN*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>ŠLISTŠPAGE* ŠSECTION0‰PAGEO*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *ºBKM7/14/83**ˆBITTESTMACRO* BTSTM„MACRO „IFGE†\1-16‰OPT‡MEX‰BTSTW…#\1-16,\2(\3) ‰OPT‡NOMEX„ENDC* „IFLT†\1-16‰OPT‡MEX‰BTSTW…#\1,\2+2(\3) ‰OPT‡NOMEX„ENDC‰ENDM *ºBKM7/14/83O*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<‰PAGE**$*…EQUATESFORTESTINGVECTORNUMBERS*#AVECTLOƒEQU„25‘LOWESTAUTOVECTOR#$AVECTHIƒEQU„31‘HIGHESTAUTOVECTOR##UVECTLOƒEQU„64‘LOWESTUSERVECTOR# IPCORG„EQU„*ŠPAGE*6* IPC COMMAND PACKET FORMAT (AS SEEN IN SHARED MEMORY)* ŠOFFSET0IPCSTX„DS.Bƒ1*2STARTOFTEXTIPCPID„DS.Bƒ1*2PACKETIDN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<*£$40=2ndConfigurePacket*£0ƒ=allothersN*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>IPCPKSZƒDS.Bƒ1*2PACKETSIZE IPCPHDVƒDS.Bƒ1*2PHYSICALDEVICE%IPCCHCMƒDS.Bƒ1*2CHANNELCOMMANDTYPEIPCDVCMƒDS.Bƒ1*2DEVICECOMMAND$IPCNBKSƒDS.Bƒ2*2#BLOCKSTOTRANSFERIPCBKSZƒDS.Bƒ2*2BLOCKSIZE*IPCBUFAD‚DS.Bƒ4*268000ADDRESS(PHYSICAL)IPCCKSMƒDS.Bƒ2*2CHECKSUM$IPCCMPRM‚DS.Bƒ4*2COMMANDPARAMETERSIPCETX„DS.Bƒ1*2ETXLOCATION** OUTPUT WITH INPUT EXTENSIONŠOFFSETIPCCMPRM!IPCSWCFƒDS.Bƒ4*2SOFTWAREOPTIONS-IPCNBKS2‚DS.Bƒ2*2#BLOCKS(OUTPUTWITHINPUT)/IPCBKSZ2‚DS.Bƒ2*2BLOCKSIZE(OUTPUTWITHINPUT)3IPCBUFA2‚DS.Bƒ4*268000ADDRESS(OUTPUTWITHINPUT)IPCETX2ƒDS.Bƒ1*2ETXLOCATION** CONFIGURE PACKET (1st)*ŠOFFSETIPCNBKS)IPCHWC1ƒDS.Bƒ1*2H/WCONFIGURATIONBYTE1)IPCHWC2ƒDS.Bƒ1*2H/WCONFIGURATIONBYTE2)IPCHWC3ƒDS.Bƒ1*2H/WCONFIGURATIONBYTE3)IPCHWC4ƒDS.Bƒ1*2H/WCONFIGURATIONBYTE4)IPCSWC1ƒDS.Bƒ1*2S/WCONFIGURATIONBYTE1)IPCSWC2ƒDS.Bƒ1*2S/WCONFIGURATIONBYTE2)IPCSWC3ƒDS.Bƒ1*2S/WCONFIGURATIONBYTE3)IPCSWC4ƒDS.Bƒ1*2S/WCONFIGURATIONBYTE4IPCCETXƒDS.Bƒ1*2ETXLOCATIONN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<** CONFIGURE PACKET (2nd)*ŠOFFSETIPCNBKS$IPCPMSKƒDS.Bƒ2*2IOCBPARAMETERMASKIPCXOF„DS.Bƒ1*2XOFFCHARACTERIPCXON„DS.Bƒ1*2XONCHARACTER%IPCBRK„DS.Bƒ1*2BREAKEQUIVALENTCHARŠDS.Bƒ1*2UNUSED"IPCRPRTƒDS.Bƒ1*2REPRINTLINECHAR!IPCCNCLƒDS.Bƒ1*2CANCELLINECHAR,IPCRTRMƒDS.Bƒ4*2READTERMINATINGCHAR'S(4)&IPCEOL„DS.Bƒ2*2ENDOFLINESTRING(2)IPC2ETXƒDS.Bƒ1*2ETX*N*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>** FORMAT TRACK PACKETŠOFFSETIPCBUFAD'IPCFPSNƒDS.Bƒ4*2PHYSICALSECTORNUMBERIPCFETXƒDS.Bƒ1*2ETXLOCATION** FORMAT DISK PACKETŠOFFSETIPCNBKSIPCDETXƒDS.Bƒ1*2ETXLOCATION** REQUEST STATUS PACKET( ŠOFFSETIPCNBKSIPCRETXƒDS.Bƒ1*2ETXLOCATION* * IPC RETURN (COMPLETION) PACKET* ŠOFFSET0RTNSTX„DS.Bƒ1*2STARTOFTEXTRTNPID„DS.Bƒ1*2PACKETI.D.RTNPKSZƒDS.Bƒ1*2PACKETSIZE RTNPHDVƒDS.Bƒ1*2PHYSICALDEVICE RTNCHCMƒDS.Bƒ1*2CHANNELCOMMANDRTNSTCMƒDS.Bƒ1*2STATUSCOMMANDRTNSTVLƒDS.Bƒ2*2STATUSVALUERTNSTPRƒEQU„*’STATUSPARAMETERS** IPC NORMAL COMPLETION EVENT*ŠOFFSETRTNSTPRRTNBLKSƒDS.Bƒ2*2NO.OFBLOCKSRTNBKSZƒDS.Bƒ2*2BLOCKSIZE#RTNDADRƒDS.Bƒ4*268KMEMORYADDRESS** DISK ERROR COMPLETION EVENT*ŠOFFSETRTNSTPR%RTNSECNƒDS.Bƒ4*2ENDINGSECTORNUMBER** DISK STATUS RETURN*ŠOFFSETRTNSTPRRTNDSTAƒDS.Bƒ2*2DEVICESTATUS RTNLSECƒDS.Bƒ4*2LOGICALSECTORS* * PRINTER/TERMINAL STATUS RETURN*ŠOFFSETRTNSTPRRTNSTADƒDS.Bƒ4*2DEVICESTATUS)RTNHWS1ƒDS.Bƒ1*2H/WCONFIGURATIONBYTE1)RTNHWS2ƒDS.Bƒ1*2H/WCONFIGURATIONBYTE2)RTNHWS3ƒDS.Bƒ1*2H/WCONFIGURATIONBYTE3)RTNHWS4ƒDS.Bƒ1*2H/WCONFIGURATIONBYTE4)RTNSWS1ƒDS.Bƒ1*2S/WCONFIGURATIONBYTE1)RTNSWS2ƒDS.Bƒ1*2S/WCONFIGURATIONBYTE2)RTNSWS3ƒDS.Bƒ1*2S/WCONFIGURATIONBYTE3)RTNSWS4ƒDS.Bƒ1*2S/WCONFIGURATIONBYTE4** IPC MEM MAPPED EQUATES*,IPCINT„EQU„$0D68000TOIPCINTERRUPTOFFSET*IPCRESET‚EQU„$0F68000TOIPCRESETOFFSET'IPCIMB1ƒEQU„$10168000TOIPCWRITEBOX%IPCIAB1ƒEQU„$10368000TOIPCACKBOX#IPCIM1„EQU„$10568000COMMANDWRITE'IPCIMB2ƒEQU„$181IPCTO68000WRITEBOX%IPCIAB2ƒEQU„$183IPCTO68000ACKBOX!IPCIM2„EQU„$185IPCCOMMANDWRITE*IPCLST„EQU„$1FFLASTBYTEOFSHAREDMEMORY** MISCELLANEOUS EQUATES* STX‡EQU„$02 ETX‡EQU„$03 RSˆEQU„$1E ACK‡EQU„$06 NAK‡EQU„$151LUMAX…EQU„8’MAXIMUMDEVICENO.VALUEFORDISKIPC(*£MCCMMAXIS5BUTTHEIRISTABLESPACE*£ENOUGHFOR8.(IPCRDCDƒEQU„$10CHANNELCOMMANDFORREAD)IPCWRCDƒEQU„$20CHANNELCOMMANDFORWRITE(RTNGDC„EQU„$70NORMALSTATUSPACKETCODE,RTNHLT„EQU„$71HALT/ABORTSTATUSPACKETCODE+RTNSTA„EQU„$72SOLICITEDSTATUSPACKETCODE&RTNUNS„EQU„$80UNSOLICITEDPACKETCODE"RTNGDS„EQU„$0000ŽGOODSTATUSVALUE,SPKT†EQU„$0200ŽFIRST2BYTESOFEVERYPACKET+SECSIZƒEQU„$100“SYSTEMREQUIREDSECTORSIZE'IOPKSZ„EQU„21”READORWRITEPACKETSIZE,OWIPKSZƒEQU„29”OUTPUTWITHINPUTPACKETSIZE'STPKSZ„EQU„7•STATUSREQUESTPACKETSIZE#CNPKSZ„EQU„15”CONFIGUREPACKETSIZEN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<'C2PKSZ„EQU„21”CONFIGURE2ndPACKETSIZE(TBKPKSZƒEQU„7•TRANSMITBREAKPACKETSIZEN*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>$FDPKSZ„EQU„7•FORMATDISKPACKETSIZE&FTPKSZ„EQU„15”FORMATTRACKPACKETSIZEHLTPKSZƒEQU„7•HALTPACKETSIZEIOEVCD„EQU„1•I/OEVENTCODE$SMMBIT„EQU„24”SECONDARYMEM.MAPBIT3PRTPRM„EQU„$0023‘PRINTERCONFIGPARAMETEREDITMASK4PRTATM„EQU„$0003‘PRINTERCONFIGATTRIBUTESEDITMASK4TERPRM„EQU„$5FB3‘TERMINALCONFIGPARAMETEREDITMASK5TERATM„EQU„$06FE‘TERMINALCONFIGATTRIBUTESEDITMASK** OPTION EQUATES*$XPKCECH‚EQU„$C0000000ŽNOECHOOPTIONN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<)XPKCNUL‚EQU„$A0000000ŽACCEPTNULLSOPTIONN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PJD 3/14/85 >>>>>>>)XPKNTPA‚EQU„$90000000ŽNOTYPEAHEADOPTIONN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PJD 3/14/85 >>>>>>>)XPKCXFN‚EQU„$84000000ŽUSEXOFF/XONOPTIONN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PJD 3/14/85 >>>>>>>-XPKCTAB‚EQU„$88000000ŽFLUSHTYPEAHEADBUFFERN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<+XSWFF„EQU„$82000000ŽTOPOFPAGE(FORMFEED)** CONFIGURATION EQUATES*XHWBITƒEQU„2–8BITPARITYXHWPRTY‚EQU„4–PARITYXHWEVNƒEQU„5–EVENPARITYXHWSTPƒEQU„6–2STOPBITSXHWMDMƒEQU„4–MODEM*N*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<XSWXONƒEQU„2–XON/XOFFORCTS)XSWFLSH‚EQU„3–FLUSHTHETYPEAHEADBUFFER'XSWTAHD‚EQU„4–ACCEPT/INHIBITTYPEAHEAD( !XSWNULƒEQU„5–DISCARD/ACCEPTNULLSN*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>XSWHDXƒEQU„6–HALFDUPLEXXSWALFƒEQU„0–AUTOLINEFEED%XSWTOFƒEQU„1–TOPOFFORMBEFOREPRINT‰PAGE*%*ˆEQUATESFORCHANNEL/DEVICECOMMANDS*XREAD„EQU…$1001READ!XWRITCƒEQU…$2001WRITEWITHCHECK$XWRITNƒEQU…$2002WRITEWITHOUTCHECKXRCRC„EQU…$3001READCRCXREADYƒEQU…$3002READY"XRDHP„EQU…$3003READHEADPOSITIONXFTRAKƒEQU…$4001FORMATTRACKXFDISKƒEQU…$4002FORMATDISK'XWDDM„EQU…$4003WRITEDELETEDDATAMARKXRESTOR‚EQU…$4004RESTOREXSEEK„EQU…$4005SEEKXHALT„EQU…$5001HALTXBOOT„EQU…$6000BOOTSTRAPLOAD*6*ˆADDITIONALEQUATESFORCOMM.CHANNEL/DEVICECOMMANDS*XINF…EQU…$1001READFORMATTEDXINI…EQU…$1002READIMAGE XOUTF„EQU…$2001OUTPUTFORMATTEDXOUTI„EQU…$2002OUTPUTIMAGE0XOFIF„EQU…$2801OUTPUTFORMATTEDINPUTFORMATTED,XOFIM„EQU…$2802OUTPUTFORMATTEDINPUTIMAGE(XOIIM„EQU…$2803OUTPUTIMAGEINPUTIMAGE,XOIIF„EQU…$2804OUTPUTIMAGEINPUTFORMATTED"XBCASTƒEQU…$2007BROADCASTMESSAGE XCONH„EQU…$4001CONFIGUREDEVICEN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<.XCON2PƒEQU…$4002CONFIGUREDEVICE(2NDPACKET)&XCNF2PK‚EQU…$40‘PACKETID(2NDPACKET)(XTRNSBK‚EQU…$4003TRANSMITBREAKREQUESTN*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>**ˆSTATUSVALUE*XPSOK„EQU…0“SUCCESSFULXPSCRCƒEQU…1“DATACRCERROR!XPSDWPƒEQU…2“DISKWRITEPROTECTEDXPSDNRƒEQU…3“DISKNOTREADY#XPSRDMƒEQU…4“READDELETEDDATAMARK"XPSDEVƒEQU…5“INVALIDDEVICEADDRES!XPSIDAƒEQU…6“INVALIDDISKADDRESSXPSSEKƒEQU…7“RESTOREERRORXPSDMEƒEQU…8“RECORDNOTFOUND#XPSMRKƒEQU…9“ADDRESSMARKCRCERRORXPSCDMA‚EQU…$A’DMAERRORXPSCSMƒEQU…$B’CHECKSUMERRORXPSBSYƒEQU…$C’DEVICEBUSY(XPSCBSY‚EQU…$D’CHANNELBUSY(FORMATTING)XPSINDƒEQU…$E’INDETERMINATEXPSCNTL‚EQU…$F’CONTROLLERERRORXPSDVCƒEQU…$10‘DEVICEERRORXPSSEEK‚EQU…$11‘SEEKERROR#XPSNODR‚EQU…$12‘NODEVICECONNECTED&XPXCFGƒEQU…$13‘DEVICECONNECTCONFLICTXPSCMPƒEQU…$14‘COMPAREERROR%XPSSWPƒEQU…$15‘SECTORWRITEPROTECTEDXPSBADƒEQU…$16‘BADSECTORXPSTOTƒEQU…$17‘TIMEOUTXPSCMDƒEQU…$18‘INVALIDCOMMAND!XPSICMƒEQU…1“INVALIDHALTCOMMANDXPSDMAƒEQU…1“DMACHANNELERROR'XPSCSTA‚EQU…1“PERSONALITYSTATUSRETURNO*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<<&*ˆIPCCompletionPacketFlagPositions*'PIDPKTF‚EQU…6“PACKETID2ndPACKETFLAGO*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>>* *ˆADDITIONALCOMM.STATUSVALUES*XPSPARƒEQU…1“PARITYERRORXPSBRKƒEQU…2“BREAKCONDITIONXPSFRMƒEQU…4“FRAMMINGERRORXPSOVRƒEQU…6“DATAOVERUN!XPSOUTƒEQU…7“PRINTEROUTOFPAPER**ƒMiscellaneousequates*5CCBEXTRA‚EQU„3”Thisparameterspecifiesthenumberof+*£extrapagestobeallocatedbyCMRtothe**£CCBwhenthechannelisallocated.Upto"*£255extrapagesmaybespecifiedŠPAGE*** MACRO FOR PUTTING THE H/W PRIORITY LEVEL'* TO THE PRIORITY INDICATED BY THE CCB.* INHIB„MACRO,‰MOVE.W„CCBISR(A5),SR‡SETPROCESSORPRIORITY‰ENDM*+* MACRO FOR DROPPING THE H/W PRIORITY LEVEL* TO AN INTERRUPTABLE STATE.* ENABL„MACRO3‰MOVE.W„CCBSR(A5),SRˆDROPPROCESSORPRIORITYBYONE‰ENDM‰PAGE* * STRUCTURE FOR DEVICE NO. TABLE* ‰OFFSET0LUFLG„DS.Bƒ2–ENTRYFLAGLUDCB„DS.Bƒ4–DCBADDRESSLUIOCBƒDS.Bƒ4–IOCBADDRESSLUTCB„DS.Bƒ4–TCBADDRESSLUBADRƒDS.Bƒ4–BUFFERADDRESS-LUMISCƒDS.Bƒ4–MISCLWORD(USEDWITHHALTI/O)>CNFG…DS.BƒIOSDDC-IOSATWŠspacefordevice#independentportion*¦ofconfiguration.5LUENTRY‚EQU„*–lengthofcommonpartofdevice#entry**ˆAPPROXIMATELY225INSTRUCTIONSEXECUTEDTOGETTOTHISPOINT *ˆ(600us).*J***************************************************************************IOHUSER:** CHECK FOR RESET*ƒIFRESET,DOITANDGETOUT*)ŠCMP.B‚#XDREST,XIOSCD(A2)TESTRESETBYTE#ŠBNE.S‚IOH01000‹BRANCHIFNOTRESETŠBSR„CMRRESTŒCALLRESETROUTINEŠBRA„IPCUSRTN‹RETURN*$* RETURN IF CHANNEL IS IN ERROR MODE*!IOH01000‚BTSTW‚#CCBFGER,CCBFG(A5)2ŠBEQ.S‚IOH01010‹BRANCHIFNOTMARKEDINERRORMODE)ŠMOVE.B#ISTACDN,D1ˆSETUPIOSERRORCODE ŠBRA„ABORT*D* IF WE ARE WAITING FOR ACK/NAK THEN WE CANNOT HONOR THE REQUEST AND2*ƒMUSTSIGNALTHECALLERTHATTHECHANNELISBUSY.*IOH01010‚EQU„* ŠCLR.L‚D7'ŠBTSTW‚#CCBFGWAK,CCBFG(A5)WAITINGACK?)ŠBNE.S‚IOH01015‹BRANCHIFNOTWAITINGACK* 2ŠBTSTW‚#CCBBUSY,CCBFG(A5)„COMMANDBUILDAREABUSY?#ŠBEQ.S‚IOH01020ŽNO,PROCESSCOMMAND*F* REQUEST CAME THRU WHILE WAITING FOR ACK - GIVE USER BACK BUSY STATUS*,IOH01015‚MOVE.B#XSTBSY,D0‡ERRORRETURNCODE ŠBRA„IPCUSRTN*(* CONVERT LOGICAL PB ADDRESS TO PHYSICAL*IOH01020‚CLR.L‚D5,ŠMOVE.LXIOCPK(A2),D6†ADDROFCOMMANDPACKET+ŠMOVE.WXIOPLN(A2),D5†LENGTHOFCOMMANDPKT"ŠMOVE.LCCBTASKA(A5),A1„SETUPTCB ŠBSR„IOHADRCKŠBRA.S‚IOH01060‹GOODRETURNŠNOP—BADLENGTHRETURN(ŠMOVE.B#ISTAIP,D1‰SETUPIOSERRORCODE ŠBRA„ABORT5IOH01060‚MOVE.LD6,A3ŽCOMMANDPACKETPHYSICALADDRESS*3* DETERMINE IF SHARED MEMORY IS FREE (IT SHOULD BE)*.ŠMOVE.LCCBCHB(A5),A4†MEMORYMAPPEDBASETOA4ŠMOVE.BIPCIMB1(A4),D00ŠBEQ.S‚IOH02060‹BRANCHIFNOERROR(MEMORYFREE)*:* SHARED MEMORY IS NOT FREE AND WE ARE NOT WAITING ON ACK.*ƒERRORCONDITION.*)ŠBSETW‚#CCBFGER,CCBFG(A5)MARKCCBASBAD)ŠMOVE.B#ISTACDN,D1ˆSETUPIOSERRORCODE ŠBRA„ABORT *K****************************************************************************(*‚FINDTHECOMMANDINTHECOMMANDTABLE.* IOH02060‚EQU„*)ŠMOVE.LXIOUID(A2),A4†PICKUPDCBPOINTER8ŠMOVE.LCCBTASKA(A5),CCBTASKB(A5)SETUPBUFFERTASKTCB-ŠMOVEQ‚#NUMCMDS-1,D0†Setuptheloopcounter./ŠLEA„CMDTBL,A0ŠA0<--addressofcommandtable./ŠMOVE.WIOSFCT(A3),D6†Setupusercommandcode. 8CMDSRCHƒCMP.W‚(A0)+,D6‹Searchthetableforthecommand.ŠDBEQƒD0,CMDSRCH‰* 3ŠBNE.S‚CMDERRIfwefoundthecommandinthetable,8ŠADD.L‚#JMPOFF-2,A0‡getthecorrespondingentryfromthe5ŠMOVE.W(A0),D0Œjumptableandjumptotheroutineto"ŠJMP„(A0,D0.W)Šhandlethecommand.ŠSPC„2>CMDERR„MOVE.B#ISTAIF,D1ŠThecommandwasn'tfoundinthetable2ŠBRA„ABORTŽsoexitwithaninvalidfunctionerror.ŠPAGEM*******************************************************************************‰REQUESTSTATUS*(*‰Entry:A2=addressofCMRparamblock*A3=addressofuser'sIOCB*A4=addressofDCB*A5=addressofmyCCB*A6=addressofuser'sTCB* *‰Additional-*‰Registers‚A1=addressofIPCsharedmemory*M******************************************************************************REQSTAT:&ŠBSR†CNFGLENSETUPDATABUFFERLENGTH0ŠMOVE.LƒIOSDBP(A3),D6‡SETUPDATABUFFERADDRESS ŠBSR†BUFADDR*¦PhysicalAddrreturnedinD62ŠMOVE.LƒD6,CCBPTR(A5)‡SAVEBUFFERPHYSICALADDRESSŠSPC†2*?*‰Retrievethemasksofsupportedattributesandparametersfor@*‰therequesteddeviceandstorethemintheusersconfiguration*‰statusblock.* ŠMOVE.LD6,A0 ŠBSR„VALATPRM$ŠMOVE.WD0,IOSATM(A0)‰Attributemask$ŠMOVE.WD1,IOSPRM(A0)‰Parametermask-ŠCMP.B‚#XTDIPC,CCBTYPE(A5)ƒDISKIPC?‚<<011686ŠIF…THEN.S8ŠMOVE.BDCBDKC+IOSSPT(A4),IOSSPT(A0)‚RETURNSPTFROMDCB9ŠMOVE.WDCBDKC+IOSTRK(A4),IOSTRK(A0)‚RETURNCYLSFROMDCB8ŠMOVE.BDCBDKC+IOSHDS(A4),IOSHDS(A0)‚RETURNHDSFROMDCBŠENDI™011686>>ŠSPC„2 ŠCLR.L„D6-ŠBSET…#LUFACT,D6ŠSETACTIVEDEVICETABLEFLAG%ŠBSR†DEVTBLŽSETUPDEVICETABLEENTRY /ŠBSR†SETPKTŽSETUPPACKETHEADERINSHAREDMEM. ŠMOVE.Wƒ#XREADY,D16ŠMOVEP.W‚D1,IPCCHCM(A1)†SETUPCHANNEL/DEVICECOMMANDS#ŠMOVE.Bƒ#ETX,IPCRETX(A1)„SETUPETX.ŠMOVE.Bƒ#STPKSZ,IPCPKSZ(A1)SETUPPACKETSIZE ŠBRA†NRMEXIT      ŠPAGEM****************************************************************************** *‰CONFIGURE*@*‰ThiscommandchangestheCCBconfiguration,theonefromwhich<*‰thedriversetsupthedeviceandunderwhichitperforms.*(*‰Entry:A2=addressofCMRparamblock*A3=addressofuser'sIOCB*A4=addressofDCB*A5=addressofmyCCB*A6=addressofuser'sTCB* *‰Additional-*‰Registers‚A1=addressofIPCsharedmemory*M****************************************************************************** CONFIGUR:%ŠCMP.B„#XTDIPC,CCBTYPE(A5)DISKIPC‚?/ŠBEQ†REQSTATYES,MUSTLOOKLIKESTATUSREQUEST &ŠBSR†CNFGLENSETUPDATABUFFERLENGTH0ŠMOVE.LƒIOSDBP(A3),D6‡SETUPDATABUFFERADDRESS ŠBSR†BUFADDR* 2ŠMOVE.LƒD6,CCBPTR(A5)‡SAVEBUFFERPHYSICALADDRESS#ŠMOVE.LƒD6,A0SETUPBUFFERPOINTERŠSPC„2-ŠBSR†VALATPRMŒRetrievethemasksofsupported6ŠMOVEM.W‚D0-D1,-(A7)‰attributesandparametersforthe(*¦requesteddeviceandsavethemaskson *¦thestack.ŠSPC„29ŠMOVE.Bƒ#CECUAP,D2ŠIfunsupportedattributesorparameter2ŠNOT.W„D0’arespecifiedintheusersattributesor<ŠAND.W„IOSATM(A0),D0‡parametersmask,returnaconfiguration*ŠNOT.W„D1’error.Restorethestackedmasks1ŠAND.W„IOSPRM(A0),D1‡beforeprocessingtheerror. ŠOR.W…D0,D1ŠMOVEM.W‚(A7)+,D0-D1ŠBNE.S„IPCR220AŠSPC„26ŠMOVE.Bƒ#CECCDO,D2ŠIftheuseristryingtochangethe1ŠMOVE.Wƒ#%1100,D3‹readorwritetimeout,returna)ŠAND.W„IOSPRM(A0),D3‡configurationerror.ŠBNE.S„IPCR220AŠBRA.S„IPCR220BŠPAGEŠSPC†2BIPCR220A‚MOVE.BƒD2,IOSCEC(A0)‡Savetheconfigurationerrorcodein:ŠMOVE.Bƒ#ISTACNF,D1‰theusersconfigurationdatablockand/ŠBRA†ABORTreturnaconfigurationerrortoIOS.ŠSPC†2IPCR220B‚CLR.L„D6-ŠBSET…#LUFACT,D6ŠSETACTIVEDEVICETABLEFLAG%ŠBSR†DEVTBLŽSETUPDEVICETABLEENTRY*/ŠBSR†SETPKTŽSETUPPACKETHEADERINSHAREDMEM.ŠMOVE.Wƒ#XCONH,D16ŠMOVEP.W‚D1,IPCCHCM(A1)†SETUPCHANNEL/DEVICECOMMANDSŠSPC†23ŠMOVE.LƒCCBPTR(A5),A0‡Loadtheaddressoftheusers*¦configureparameterblock.N*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PJD 11/26/843‰MOVEM.LƒA5,-(A7)ŒSavetheCCBaddressonthestack:‰MOVE.L„CCBDTBL(A5),A5†Getthestartaddressofthedevice*¦tables‰CLR.L…D0’Needthewholereg!4‰MOVE.B„DCBCDV(A4),D0‡GetthedevicenumberfromDCB6‰MULU†#LUDSZE,D0ŠMULsizeofanentrybydevicenumber&*¦togetdistancefromstartoftable./‰ADD.L…D0,A5Addtobasetogetstartofdevice*¦tableforthisdevice.4‰LEA‡CONFIG(A5),A5‡UseoffsetfrombaseofCONFIGso!*¦wecanusetheIOEequatesinto*¦theconfigurationdata.N*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< PJD 11/26/84ŠSPC†2O*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *ºBKM7/14/83A*‰BTSTW‚#DATPRT,DCBATT(A4)ƒIftherequesteddeviceisaterminal,>ŠBTSTM‚DATPRT,DCBATT,A4…Iftherequesteddeviceisaterminal, *ºBKM7/14/83O*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<:ŠBEQ.S‚IPCR222Œbranchtogenerateaterminalconfiguration *£packet.‰PAGE*)*ˆSetuptheprinterconfigurationpacket**'*ˆStartofHardwareConfogurationbytes0ŠMOVE.Lƒ#$80000000,D0‡SETUPH/WCONFIGUREBYTES*&*ˆCheckforlinelengthchangerequest*B‰BTSTW…#IOSRECB,IOSPRM(A0)Doeshewanttochangethelinelength?#‰BEQ.S…IPCR221AŒNo,usethecurrent=ŠMOVE.BƒIOSREC+1(A0),D0…Yes,pickupthelinelengthhewants‰BRA.S…IPCR221B**ˆUsethecurrentlinelength*;IPCR221AMOVE.B„IOSREC+1(A5),D0…UsethecurrentlinelengthCIPCR221B‚MOVEP.L‚D0,IPCHWC1(A1)†PUTH/WCONFIGURATIONINSHAREDMEM%*ˆEndofHardwareConfigurationbytes'*ˆStartofSoftwareConfigurationbytes‰MOVE.L„#$00000080,D0*+*ˆCheckforTopofFormbeforeprintoption*A‰BTSTW…#IOASNFF,IOSATM(A0)DoeshewanttochangetheTopofForm *¦option?#‰BEQ.S…IPCR221DŒNo,usethecurrent8‰BTSTW…#IOASNFF,IOSATW(A0)Yes,doeshewanttheoption? ‰BEQ.S…IPCR221EŒNo,don'tsetit-IPCR221CBSET†#XSWTOF,D0ŠYes,settheoption!‰BRA.S…IPCR221EDIPCR221DBTSTW…#IOASNFF,IOSATW(A5)Istheoptionsetinthecurrent? ‰BNE.S…IPCR221CŒYes,keepitset:IPCR221EROL.L…#8,D0Rotatethefirstbyteoutoftheway.*!*ˆCheckforAutoLinefeedoption*C‰BTSTW…#IOALNFD,IOSATM(A0)DoeshewanttochangetheAUTOLINEFEED *¦option?#‰BEQ.S…IPCR221GŒNo,usethecurrent<ŠBTSTW„#IOALNFD,IOSATW(A0)Yes,doeshewantAUTOLINEFEED?.ŠBEQ.S„IPCR221HŒNo,NOAUTOLINEFEEDdesired.;IPCR221F‚BSET…#XSWALF,D0ŠYes,settheAUTOLINEFEEDoption‰BRA.S…IPCR221H6IPCR221GBTSTW…#IOALNFD,IOSATW(A5)UseAUTOLINEFEED?3‰BNE.S…IPCR221FŒYes,settheAUTOLINEFEEDoption.+ ;IPCR221HROL.L…#8,D0Rotatethesecondbyteoutoftheway.*'*ˆChecktheendofline/printcharacter*C‰BTSTW…#IOSELCB,IOSPRM(A0)Doeshewanttochangetheend-printch?#‰BEQ.S…IPCR221IŒNo,usethecurrent7‰MOVE.B„IOSELC(A0),D0‡Yes,getthecharhewantstouse‰BRA.S…IPCR221J3IPCR221IMOVE.B„IOSELC(A5),D0‡Usethecurrentvalue6IPCR221JROL.L…#8,D0Movethe3rdbyteoutoftheway.*4*ˆAllchoicesmade,sendthelwordtothesharedram*?‰MOVEP.LƒD0,IPCSWC1(A1)†SendtheSoftwareConfigtosharedmem.*)*ˆEndoftheSoftwareConfigurationbytes"*ˆEndofthePrinterConfiguration* ŠBRA†IPCR249ŠPAGE*!*ˆStartofTerminalConfiguration* IPCR222ƒEQU†*ŠMOVE.Lƒ#$80,D0*"*‰CHECKATTRIBUTEMASK-STOPBITS*ŠBTSTW„#IOASTPB,IOSATM(A0)ŠBEQ.S„IPCR223ŽUSEDEFAULT*%*‰SETUPSTOPBITSFROMATTRIBUTEWORD*(ŠBTSTW„#IOASTPB,IOSATW(A0)‚2STOPBITS?ŠBEQ.S„IPCR225ŽBRANCHIFNO&ŠBRA.S„IPCR224ŽYES-GOSETOPTIONBIT*1*‰SETUPSTOPBITSFROMCURRENTCONFIGURATIONAREA* IPCR223ƒEQU†*(ŠBTSTW„#IOASTPB,IOSATW(A5)‚2STOPBITS?ŠBEQ.S„IPCR225ŽBRANCHIFNO**‰SETTHEOPTIONBIT* IPCR224ƒEQU†*ŠBSET…#XHWSTP,D0*%*‰CHECKATTRIBUTEMASK-7/8BITMASK* IPCR225ƒEQU†*ŠBTSTW„#IOABITS,IOSATM(A0)ŠBEQ.S„IPCR226USEDEFAULT***‰SETUPNUMBEROFBITSFROMATTRIBUTEWORD*"ŠBTSTW„#IOABITS,IOSATW(A0)‚8BIT?ŠBNE.S„IPCR228ŽBRANCHIFNOŠBRA.S„IPCR227ŽYES*6*‰SETUPNUMBEROFBITSFROMCURRENTCONFIGURATIONAREA* IPCR226ƒEQU†*"ŠBTSTW„#IOABITS,IOSATW(A5)‚8BIT?ŠBNE.S„IPCR228ŽBRANCHIFNO**‰SETTHE8BITOPTIONBIT* IPCR227ƒEQU†*$ŠBSET…#XHWBIT,D0‹YES,SETOPTIONBIT**‰CHECKATTRIBUTEMASK-PARITY* IPCR228ƒEQU†*ŠBTSTW„#IOAUSEP,IOSATM(A0)ŠBEQ.S„IPCR229USEDEFAULT*&*‰SETUPPARITYUSEFROMATTRIBUTEWORD*%ŠBTSTW„#IOAUSEP,IOSATW(A0)‚USEPARITYŠBEQ.S„IPCR231ŽBRANCHIFNOŠBRA.S„IPCR230ŽYES*2*‰SETUPPARITYUSEFROMCURRENTCONFIGURATIONAREA* IPCR229ƒEQU†*$ŠBTSTW„#IOAUSEP,IOSATW(A5)‚USEPARIYŠBEQ.S„IPCR231ŽBRANCHIFNO**‰SETTHEPARITYUSEOPTIONBIT* IPCR230ƒEQU†*%ŠBSET…#XHWPRTY,D0ŠYES,SETOPTIONBIT*(*‰CHECKATTRIBUTEMASK-ODD/EVENPARITY* IPCR231ƒEQU†*ŠBTSTW„#IOAPRTY,IOSATM(A0)ŠBEQ.S„IPCR232USEDEFAULT*+*‰SETUPEVEN/ODDPARITYFROMATTRIBUTEWORD*&ŠBTSTW„#IOAPRTY,IOSATW(A0)‚EVENPARITYŠBEQ.S„IPCR234ŽBRANCHIFNOŠBRA.S„IPCR233ŽYES*7*‰SETUPEVEN/ODDPARITYFROMCURRENTCONFIGURATIONAREA* IPCR232ƒEQU†*(ŠBTSTW„#IOAPRTY,IOSATW(A5)‚EVENPARITY?ŠBEQ.S„IPCR234ŽBRANCHIFNO* *‰SETTHEPARITYEVENOPTIONBIT* IPCR233ƒEQU†*$ŠBSET…#XHWEVN,D0‹YES,SETOPTIONBIT*%*‰PUTBYTE1H/WCONFIGINSHAREDMEM* IPCR234ƒEQU†*ŠMOVE.BƒD0,IPCHWC1(A1)*(*ˆChecktheparametersmaskforbaudrate*<‰BTSTW…#IOSBRTB,IOSPRM(A0)Shouldweconfigurethebaudrate?'‰BEQ.S…IPCR234AŒNo,usethecurrentone.ŠMOVE.BƒIOSBRT(A0),D0‡Yes,pickupthenewone‰BRA.S…IPCR234B*(*ˆUsethecurrentconfiguration‚baudrate*=IPCR234AMOVE.B„IOSBRT(A5),D0‡Usethecurrentconfigbaudrate>‰MOVE.B„D0,IOSBRT(A0)‡Updatetheuser'sIOCBtoshownewbdrte**‰CHECKATTRIBUTEMASK-MODEM*"IPCR234B‚BTSTW„#IOAMODM,IOSATM(A0)ŠBEQ.S„IPCR235USEDEFAULT*!*‰SETUPMODEMFROMATTRIBUTEWORD*!ŠBTSTW„#IOAMODM,IOSATW(A0)‚MODEM?ŠBEQ.S„IPCR237ŽBRANCHIFNOŠBRA.S„IPCR236ŽYES*-*‰SETUPMODEMFROMCURRENTCONFIGURATIONAREA* IPCR235ƒEQU†*"ŠBTSTW„#IOAMODM,IOSATW(A5)‚MODEM?ŠBEQ.S„IPCR237ŽBRANCHIFNO**‰SETTHEMODEMOPTIONBIT* IPCR236ƒEQU†**ŠBSET…#XHWMDM,D0‹YES,SETMODEMOPTIONBIT*(*‰PUTBYTE2H/WCONFIGINSHAREDMEMORY* IPCR237ƒEQU†*ŠMOVE.BƒD0,IPCHWC2(A1)*'*ˆChecktheparametersmask-NullPads*3‰BTSTW…#IOSNLSB,IOSPRM(A0)‹Configurethenullpads?*‰BEQ.S…IPCR237A–No,usethecurrentconfig:ŠMOVE.BƒIOSNLS(A0),IPCHWC3(A1)ˆYes,moveuser'svalueinto *°sharedram.‰BRA.S…IPCR237B*CIPCR237A‚MOVE.BƒIOSNLS(A5),IPCHWC3(A1)ˆUsethecurrentconfigvalue+ .ŠMOVE.BƒIOSNLS(A5),IOSNLS(A0)‰UpdateuserIOCB*#*ˆChecktherecordlengthparameter*?IPCR237BBTSTW…#IOSRECB,IOSPRM(A0)‹Configuretherecordlength?‰BEQ.S…IPCR237C>ŠMOVE.BƒIOSREC+1(A0),IPCHWC4(A1)‚PUTLINELENGTHINSHAREDMEM‰BRA.S…IPCR237D(IPCR237CMOVE.B„IOSREC+1(A5),IPCHWC4(A1)!‰MOVE.B„IOSREC+1(A5),IOSREC+1(A0)IPCR237D‚CLR.L„D02ŠMOVEP.L‚D0,IPCSWC1(A1)‡SETUPS/WCONFIGUREBYTES*ŠOR.B…#$80,D0ŽSETTHECONFIGUREOPTIONBIT*$*‰CHECKATTRIBUTEMASK-HALFDUPLEX*ŠBTSTW„#IOAECHO,IOSATM(A0)ŠBEQ.S„IPCR238USEDEFAULT*'*‰SETUPHALFDUPLEXFROMATTRIBUTEWORD*'ŠBTSTW„#IOAECHO,IOSATW(A0)‚HALFDUPLEX?ŠBEQ.S„IPCR240ŽBRANCHIFNOŠBRA.S„IPCR239ŽYES*3*‰SETUPHALFDUPLEXFROMCURRENTCONFIGURATIONAREA* IPCR238ƒEQU†*(ŠBTSTW„#IOAECHO,IOSATW(A5)‚HALFDUPLEX?ŠBEQ.S„IPCR240ŽBRANCHIFNO* *‰SETTHEHALFDUPLEXOPTIONBIT* IPCR239ƒEQU†*1ŠBSET…#XSWHDX,D0‹YES-SETHALFDUPLEXOPTIONBITN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<*%*‰CHECKATTRIBUTEMASK-ACCEPTNULLS* IPCR240ƒEQU†*ŠBTSTW„#IOAPNUL,IOSATM(A0)ŠBEQ.S„IPCR241USEDEFAULT*(*‰SETUPACCEPTNULLSFROMATTRIBUTEWORD*)ŠBTSTW„#IOAPNUL,IOSATW(A0)‚ACCEPTNULLS?ŠBEQ.S„IPCR243ŽBRANCHIFNOŠBRA.S„IPCR242ŽYES*4*‰SETUPACCEPTNULLSFROMCURRENTCONFIGURATIONAREA* IPCR241ƒEQU†*)ŠBTSTW„#IOAPNUL,IOSATW(A5)‚ACCEPTNULLS?ŠBEQ.S„IPCR243ŽBRANCHIFNO*!*‰SETTHEACCEPTNULLSOPTIONBIT* IPCR242ƒEQU†*%ŠBSET…#XSWNUL,D0ŠYES-SETOPTIONBIT***‰CHECKATTRIBUTEMASK-ACCEPTTYPEAHEAD* IPCR243ƒEQU†*ŠBTSTW„#IOATAHD,IOSATM(A0)ŠBEQ.S„IPCR244USEDEFAULT*-*‰SETUPACCEPTTYPEAHEADFROMATTRIBUTEWORD*,ŠBTSTW„#IOATAHD,IOSATW(A0)‚ACCEPTTYPEAHEAD+ŠBEQ.S„IPCR246ŽBRANCHIFTYPEAHEADALLOWED#ŠBRA.S„IPCR245ŽTYPEAHEADINHIBITED*9*‰SETUPACCEPTTYPEAHEADFROMCURRENTCONFIGURATIONAREA* IPCR244ƒEQU†*.ŠBTSTW„#IOATAHD,IOSATW(A5)‚ACCEPTTYPEAHEAD?+ŠBEQ.S„IPCR246ŽBRANCHIFTYPEAHEADALLOWED*0*‰SETTHEACCEPTTYPEAHEADINHIBITEDOPTIONBIT* IPCR245ƒEQU†*/ŠBSET…#XSWTAHD,D0‰NO-SETTYPEAHEADINHIBITED*(*‰CHECKATTRIBUTEMASK-XON/XOFFORCTS* IPCR246ƒEQU†*ŠBTSTW„#IOAXCTL,IOSATM(A0)ŠBEQ.S„IPCR247USEDEFAULT*+*‰SETUPXON/XOFFORCTSFROMATTRIBUTEWORD*'ŠBTSTW„#IOAXCTL,IOSATW(A0)USEXON/XOFFŠBEQ.S„IPCR249ŽNO-USECTSŠBRA.S„IPCR248ŽYES*7*‰SETUPXON/XOFFORCTSFROMCURRENTCONFIGURATIONAREA* IPCR247ƒEQU†*'ŠBTSTW„#IOAXCTL,IOSATW(A0)USEXON/XOFFŠBEQ.S„IPCR249NO-USECTS**‰SETTHEUSEXON/XOFFOPTION* IPCR248ƒEQU†*ŠBSET…#XSWXON,D0 IPCR249ƒEQU†*ŠMOVE.Lƒ(A7)+,A5ŒRESTOREA5 IPCR250ƒEQU†*2ŠMOVE.BƒD0,IPCSWC1(A1)†SETUPS/WCONFIGUREBYTE1N*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>*G*ˆ3/26/85‚PJD-THISCODEWASADDEDTOUPDATETHECURRENTCONFIGURATIONA*ˆATTRIBUTEWORDWHENACONFIGURATIONOCCURS.‚ONLYTHEATTRIBUTESG*ˆSUPPORTEDBYTHEOLDMCCMAREUPDATEDHERE,SOTHEY'LLSTILLBEVALIDD*ˆEVENIFTHESECONDCONFIGURATIONPACKET(SUPPORTEDONLYBYTHENEWE*ˆVM30-1FIRMWARE)FAILS.‚THEATTRIBUTEWORDWILLBEUPDATEDWITHALLH*ˆOFTHEUSER'SATTRIBUTEBITSWHENTHESECONDPACKETCOMPLETESSUCCESS-*ˆFULLYLATERON.*9‰MOVE.W„#$007C,D0‹GETMASKOFMAXATTRIBUTESFOROLDMCCM(‰AND.W…IOSATM(A0),D0‡GETUSER'SNEWMASK)‰MOVE.W„IOSATW(A0),D1‡GETUSER'SNEWWORD+‰AND.W…D0,D1STRIPOFFANYUNUSEDWORDBITS-‰NOT.L…D0’MAKEINVERSEOFMASK-BITSTOSAVE<‰AND.W…IOSATW(A5),D0‡ZEROOUTBITSTOBEUPDATEDWITHUSER'S%‰OR.W†D1,D0ORINTHEUSER'SNEWBITS;‰MOVE.W„D0,IOSATW(A5)‡UPDATETHECURRENTCONFIGURATIONAREA*K****************************************************************************#ŠMOVE.Bƒ#ETX,IPCCETX(A1)„SETUPETX.ŠMOVE.Bƒ#CNPKSZ,IPCPKSZ(A1)SETUPPACKETSIZE9ŠMOVE.Bƒ#1,DCBCCF(A4)‡SETCONFIGURATIONCOORDINATIONFLAG ŠBRA†NRMEXITŠPAGEM*******************************************************************************‰CHANGEDEFAULTCONFIGURATION*, 6*‰ThiscommandchangestheDCBconfiguration,towhich4*‰IOSwillrestoreus(viaaCONFIGUREcommand)when/*‰FHSclosesthelastallocationofthedevice.*(*‰Entry:A2=addressofCMRparamblock*A3=addressofuser'sIOCB*A4=addressofDCB*A5=addressofmyCCB*A6=addressofuser'sTCB*M******************************************************************************CHNGDEF:%ŠCMP.B‚#XTDIPC,CCBTYPE(A5)ƒDISKIPC‚?2ŠBEQ„REQSTATIfso,performaconfiguration/status *§request.&ŠBSR„CNFGLENSETUPDATABUFFERLENGTH0ŠMOVE.LƒIOSDBP(A3),D6‡SETUPDATABUFFERADDRESS ŠBSR†BUFADDR2ŠMOVE.LƒD6,CCBPTR(A5)‡SAVEBUFFERPHYSICALADDRESS 7ŠLEA†DCBDEV(A4),A0„A0<--addressofDCBconfiguration. *G************************************************************************)* Printer/Terminal change default command** CCHGD020ƒMOVE.LCCBPTR(A5),A1†A1<--physicaladdressofdatablock.ŠSPC„23ŠMOVE.B#CECUAP,D2‹Ifanyunsupportedattributesor3ŠBSR„VALATPRM‹parametersarespecifiedintheusers1ŠNOT.W‚D0‘attributesorparametersmask,returna)ŠAND.W‚IOSATM(A1),D0†configurationerror. ŠNOT.W‚D1ŠAND.W‚IOSPRM(A1),D1 ŠOR.WƒD0,D1 ŠBNE„BADCNFGŠSPC„2*F*‚Firstweneedtoseewhathisproposedconfigurationwilllooklike.D*‚Plugintohisdatablockthecurrentvaluesforthoseattributes&?*‚parametershedoesn'twanttochange.‚Theappropriatecurrent(*‚configurationisatA0andhe'satA1.*4ŠMOVE.WIOSATM(A1),D0†Pickupusersattributesmask.;ŠAND.W‚D0,IOSATW(A1)†Zeroouttheattributesofhisthathe.ŠNOT.W‚D0‘doesn'twanttochange,zerooutthe<ŠAND.W‚IOSATW(A0),D0†attributesofminethathedoeswantto:ŠOR.WƒD0,IOSATW(A1)†change,andcombinetheminhisspace. @ŠMOVE.WIOSPRM(A1),D0†Getmaskofparametershewantstochange. 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheLINEWIDTH,ŠBCS.S‚CHGD022Œgivehimours.ŠMOVE.WIOSREC(A0),IOSREC(A1) 8CHGD022ƒLSR.W‚#1,D0ŽIfhe'snotchangingtheLINES/PAGE,ŠBCS.S‚CHGD024Œgivehimours.ŠMOVE.LIOSRSZ(A0),IOSRSZ(A1) :CHGD024ƒLSR.W‚#1,D0ŽIfhe'snotchangingtheWRITETIMEOUT$ŠBCS.S‚CHGD026Œvalue,givehimours.ŠMOVE.LIOSWTO(A0),IOSWTO(A1) 9CHGD026ƒLSR.W‚#1,D0ŽIfhe'snotchangingtheREADTIMEOUT$ŠBCS.S‚CHGD028Œvalue,givehimours.ŠMOVE.LIOSRTO(A0),IOSRTO(A1) O*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *ºBKM7/14/83F*CHGD028ƒBTSTW‚#DATPRT,DCBATT(A4)ƒIfthedeviceisaterminal,processCCHGD028„BTSTM‚DATPRT,DCBATT,A4‚Ifthedeviceisaterminal,process *ºBKM7/14/83O*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<2ŠBEQ.S‚CHGD031Œtheterminalspecificconfiguration *£parameters.ŠSPC„24ŠLSR.W‚#1,D0IftheuserisnotchangingtheLogical7ŠBCS.S‚CHGD029ŽRecordlength,copythecurrentdefault.ŠMOVE.WIOSLRL(A0),IOSLRL(A1) 7CHGD029ƒLSR.W‚#1,D0IftheuserisnotchangingtheEOL3ŠBCS.S‚CHGD030ŒCHARACTER,copythecurrentdefault.ŠMOVE.BIOSELC(A0),IOSELC(A1)CHGD030ƒBRA.S‚OKCNFGŠSPC„2I*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>FAM 11/07/846CHGD031ƒLSR.W‚#1,D0Žifhe'schangingtheXOFF/XONcharŠBCS.S‚CHGD031A‹givehimoursŠMOVE.BIOSXOF(A0),IOSXOF(A1)ŠMOVE.BIOSXON(A0),IOSXON(A1)?CHGD031A‚LSR.W‚#1,D0Žifhe'schangingtheBREAKEQUIVALENTcharŠBCS.S‚CHGD031B‹givehimoursŠMOVE.BIOSBRC(A0),IOSBRC(A1)=CHGD031B‚LSR.W‚#1,D0Žifhe'schangingtheDISCARDOUTPUTcharŠBCS.S‚CHGD031C‹givehimoursŠMOVE.BIOSDOP(A0),IOSDOP(A1)*;CHGD031C‚LSR.W‚#1,D0Žifhe'schangingtheREPRINTLINEcharŠBCS.S‚CHGD031D‹givehimoursŠMOVE.BIOSRLN(A0),IOSRLN(A1)*:CHGD031D‚LSR.W‚#1,D0Žifhe'schangingtheCANCELLINEcharŠBCS.S‚CHGD031E‹givehimoursŠMOVE.BIOSCLC(A0),IOSCLC(A1)*:CHGD031E‚LSR.W‚#1,D0Žifhe'schangingtheREADTERMINATORSŠBCS.S‚CHGD031F‹givehimoursŠMOVE.LIOSRTV(A0),IOSRTV(A1)*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>FAM 11/07/84*7CHGD032ƒLSR.W‚#1,D0ŽIfhe'snotchangingtheBAUDRATE,ŠBCS.S‚CHGD034Œgivehimours.ŠMOVE.BIOSBRT(A0),IOSBRT(A1) 9CHGD034ƒLSR.W‚#1,D0ŽIfhe'snotchangingtheNULPADDING,ŠBCS.S‚CHGD036Œgivehimours.ŠMOVE.BIOSNLS(A0),IOSNLS(A1) 7CHGD036ƒLSR.W‚#2,D0ŽtheTERMINATOR-CLASSdoesn'tapply.6ŠBCS.S‚OKCNFGIftheuserisnotchangingtheTERMINAL<ŠMOVE.BIOSTCD(A0),IOSTCD(A1)CODE,copythecurrentdefault )*£Currentlytherearenoerrorchecksfor)*§MCCMserialparallelports,sogoahead"*§withtheproposedconfiguration. *OKCNFG:*J*‚Itpassedallthetests,somoveittotherealthing(eithertheDCBorH*‚ortheCCB).‚Don'tmovethemasks,though;startwithATTRIBUTESWORD.*ŠSPC„2BŠMOVE.LIOSDST(A0),IOSDST(A1)‚Copythedevice,driver,andchannel3ŠCLR.B‚IOSDST(A1)‹codesfromtheDCBintotheusers'*¥configurationblock.Clearthestatus(*¥fieldforlackofcurrentinformation.ŠSPC„22ŠBSR.S‚CNFGLENLoadD5withthenumberofbytesto<ŠSUB.W‚#IOSATW+1,D5ˆtransfer-1andloadtheaddressesofthe8ŠADD.L‚#IOSATW,A0ŠATTRIBUTESWORDinA0fortheCCB/DCB,:ŠADD.L‚#IOSATW,A1ŠandinA1fortheusersconfigureblock.ŠSPC„2FCNFGLOOP‚MOVE.B(A1)+,(A0)+‰CopytheusersconigurationblockintotheŠDBRAƒD5,CNFGLOOPˆCCB/DCB. :ŠMOVE.B#1,DCBCCF(A4)†Setconfigurationcoordinationflag. ŠCLR.L‚D1‘*1ŠBRA„ABORTgoodstatusbutusetheABORTroutine. *0*‚Configurationerror!‚SetD1toindicateerror.*BADCNFG: :ŠMOVE.B‚#ISTACNF,D1‰Returntheconfigurationerrorcodein?ŠMOVE.BD2,IOSCEC(A1)†theusersconfiguredatablockandreturn(ŠBRA…ABORTŒaconfigurationerrortoIOS.ŠPAGEL*****************************************************************************%*‰GETCONFIGURATIONDATABLOCKLENGTH**‚Entry:A4=AddressofDCB*ŠA5=AddressofCCB*B*‚Exit:‚D5=Configurationdatablocklengthforrequesteddevice*L**************************************************************************** CNFGLEN:8ŠMOVE.L#IOSDLN,D5ŒLoadD5.LwiththeconfigurationdataAŠCMP.B‚#XTDIPC,CCBTYPE(A5)blocklengthforthedisk,printer,or2ŠBEQ.S‚CNFGLENRŒterminalbasedonthedevicetype.ŠSPC„2ŠMOVE.L#IOSPLN,D5O*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *ºBKM7/14/83*‰BTSTW‚#DATPRT,DCBATT(A4)ŠBTSTM‚DATPRT,DCBATT,A4 *ºBKM7/14/83O*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<ŠBNE.S‚CNFGLENRŠSPC„2ŠMOVE.L#IOSTLN,D5ŠSPC„2 CNFGLENR‚RTSŠPAGEL*****************************************************************************2*‰GETMASKSOFSUPPORTEDATTRIBUTESANDPARAMETERS**†Entry:A4=AddressofDCB*ŽA5=AddressofCCB*>*†Exit‚:D0.W=Supportedattributesmaskforrequesteddevice7*ŽD1.W=Supportedparametersmaskforrequesteddevice*L**************************************************************************** VALATPRM:.ŠMOVE.W#0,D0‘IfthedeviceisadiskIPC,the7ŠMOVE.W#0,D1supportedattributesandparametersmasksAŠCMP.B‚#XTDIPC,CCBTYPE(A5)arebothzerobecauseconfigurationis,ŠBEQ.S‚VALATRTNŒnotsupportedonthedevice.ŠSPC„2<ŠMOVE.W#PRTATM,D0‹Ifthedeviceisaprinteroraterminal,<ŠMOVE.W#PRTPRM,D1‰loadtheappropriatesupportedattributesO*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *ºBKM7/14/83?*‰BTSTW‚#DATPRT,DCBATT(A4)andparametersmasksforthedevice.<ŠBTSTM‚DATPRT,DCBATT,A4andparametersmasksforthedevice. *ºBKM7/14/83O*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<ŠBNE.S‚VALATRTNŠSPC„2ŠMOVE.W#TERATM,D0ŠMOVE.W#TERPRM,D1ŠSPC„2 VALATRTN‚RTSŠPAGEL******************************************************************************‰READCOMMAND*,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB- *‰A6=addressofusersTCB* *‰Additional-*‰Registers‚A1=addressofIPCsharedmemory*L*****************************************************************************READ:5ŠBSR„IOSCOMNŒDothestuffcommontoallI/Ocommands,7ŠMOVE.LD6,CCBPTR(A5)†savethebufferphysicaladdress. ŠCLR.L‚D6&ŠBSETƒ#LUFXFR,D6ŒSETDATATRANSFERBITŠBSETƒ#LUFACT,D6ŒSETACTIVEBIT%ŠCMP.B‚#XTDIPC,CCBTYPE(A5)ƒDISKIPC?ŠBNE.S‚READ10BRANCHIFNO$ŠBSR„DSKPRMYES,VALIDATEPARAMETERS+READ10„BSR„DEVTBLSETUPDEVICETABLEENTRY /ŠBSR„SETPKTSETUPPACKETHEADERINSHAREDMEM. %ŠCMP.B„#XTDIPC,CCBTYPE(A5)DISKIPC?ŠBNE.S„READ20ŽBRANCHIFNO ŠMOVE.Wƒ#XREAD,D1&ŠBSR†DSKCMDŽYES,SETUPCOMMANDPACKETŠBRA†NRMEXITGOFINISHUP 1READ20„BTSTW„#IOPFORB,IOSOPT(A3)FORMATTEDMODE?ŠBNE.S„READ30ŽNO4ŠMOVE.Wƒ#XINF,D1ŒYES,SETUPREADFORMATTEDCOMMANDS ŠBRA.S„READ401READ30„MOVE.Wƒ#XINI,D1ŒSETUPREADIMAGECOMMANDSREAD40„CLR.L„D0+ŠBTSTW„#IOPECHB,IOSOPT(A3)ECHOSPECIFIED?ŠBEQ.S„READ50ŽYES+ŠOR.L…#XPKCECH,D0‰NO,SETUPNOECHOOPTIONN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<< READ50„EQU†*2ŠBTSTW„#IOPCTAB,IOSOPT(A3)FLUSHTYPEAHEADBUFFERŠBEQ.S„READ60ŽNO0ŠOR.L…#XPKCTAB,D0‰NO,SETUPFLUSHBUFFEROPTION READ60„EQU†* *ºFAM7/04/84N*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>*6‰MOVEM.LƒD0/A5,-(A7)‰SavetheCCBaddressonthestack:‰MOVE.L„CCBDTBL(A5),A5†Getthestartaddressofthedevice*¦tables‰CLR.L…D0’Needthewholereg!4‰MOVE.B„DCBCDV(A4),D0‡GetthedevicenumberfromDCB6‰MULU†#LUDSZE,D0ŠMULsizeofanentrybydevicenumber&*¦togetdistancefromstartoftable./‰ADD.L…D0,A5Addtobasetogetstartofdevice*¦tableforthisdevice.‰MOVEM.Lƒ(A7)+,D0ŒRestoreD04‰LEA‡CONFIG(A5),A5‡UseoffsetfrombaseofCONFIGso!*¦wecanusetheIOEequatesinto*¦theconfigurationdata.2‰BTSTW…#IOAPNUL,IOSATW(A5)SHOULDWEACCEPTNULLS?‰BEQ.S…READ61ŽNO2‰OR.L†#XPKCNUL,D0‰YES,ADDTHEBITTOACCEPTNULLS*8READ61ƒBTSTW…#IOAXCTL,IOSATW(A5)SHOULDWEUSEXON/XOFF?‰BEQ.S…READ62ŽNO2‰OR.L†#XPKCXFN,D0‰YES,ADDTHEBITTOUSEXON/XOFF*9READ62ƒBTSTW…#IOATAHD,IOSATW(A5)SHOULDWEUSETYPEAHEAD?‰BEQ.S…READ70ŽNO3‰OR.L†#XPKNTPA,D0‰YES,ADDTHEBITTOUSETYPEAHEAD*/READ70ƒMOVEM.Lƒ(A7)+,A5ŒRESTORETHECCBADDRESS"ŠBSR†MCCMCMDSETUPCOMMANDPACKETŠBRA†NRMEXITGOFINISHUPŠPAGEL******************************************************************************‰WRITE**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB* *‰Additional-*‰Registers‚A1=addressofIPCsharedmemory**L*****************************************************************************WRITE:5ŠBSR„IOSCOMNŒDothestuffcommontoallI/Ocommands,7ŠMOVE.LD6,CCBPTR(A5)†savethebufferphysicaladdress. ŠCLR.L‚D6&ŠBSETƒ#LUFXFR,D6ŒSETDATATRANSFERBITŠBSETƒ#LUFACT,D6ŒSETACTIVEBIT%ŠCMP.B‚#XTDIPC,CCBTYPE(A5)ƒDISKIPC?ŠBNE.S‚WRIT10BRANCHIFNO$ŠBSR„DSKPRMYES,VALIDATEPARAMETERS+WRIT10„BSR„DEVTBLSETUPDEVICETABLEENTRY /ŠBSR„SETPKTSETUPPACKETHEADERINSHAREDMEM. %ŠCMP.B„#XTDIPC,CCBTYPE(A5)DISKIPC?ŠBNE.S„WRIT50ŽBRANCHIFNO O*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *ºBKM7/14/83A*WRIT20„BTSTW„#DATWRC,DCBATT(A0)‚WRITEWITHVERIFYFORTHISDCB?>WRIT20…BTSTM„DATWRC,DCBATT,A0‚WRITEWITHVERIFYFORTHISDCB? *ºBKM7/14/83O*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<ŠBEQ.S„WRIT30ŽNO4ŠMOVE.Wƒ#XWRITC,D1ŠYES,SETUPWRITE/VERIFYCOMMANDS ŠBRA.S„WRIT408WRIT30„MOVE.Wƒ#XWRITN,D1ŠSETUPWRITE/NOVERIFYCOMMANDS 'WRIT40„BSR†DSKCMDŽSETUPCOMMANDPACKETŠBRA†NRMEXITGOFINISHUP 1WRIT50„BTSTW„#IOPFORB,IOSOPT(A3)FORMATTEDMODE?ŠBNE.S„WRIT60ŽNO6ŠMOVE.Wƒ#XOUTF,D1‹YES,SETUPWRITEFORMATTEDCOMMANDS ŠBRA.S„WRIT70- 3WRIT60„MOVE.Wƒ#XOUTI,D1‹SETUPWRITEIMAGECOMMANDSWRIT70„CLR.L„D0O*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *ºBKM7/14/832*‰BTSTW„#DATPRT,DCBATT(A0)‚THISAPRINTERDEVICE?/ŠBTSTM„DATPRT,DCBATT,A0‚THISAPRINTERDEVICE? *ºBKM7/14/83O*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<ŠBEQ.S„WRIT80ŽNO3ŠTST.B„DCBBCT(A0)ŠFIRSTWRITEFORTHISASSIGNMENT?$ŠBNE.S„WRIT80ŽNO,NONEEDTODOAFF.ŠOR.L…#XSWFF,D0‹YES,SETUPTOPOFPAGEOPTION-ŠADD.B„#1,DCBBCT(A0)‡NOWSETTOPOFPAGEFLAG)WRIT80„BSR†MCCMCMDSETUPCOMMMANDPACKETŠBRA†NRMEXITGOFINISHUPŠPAGEL*****************************************************************************%*‰OUTPUTW/INPUT‚(MCCMCOMMANDONLY)**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB* *‰Additional-*‰Registers‚A1=addressofIPCsharedmemory**L*****************************************************************************OUTWINP:*'*‚FirsttakecareoftheWRITEportion.*5ŠBSR„IOSCOMNŒDothestuffcommontoallI/Ocommands,8ŠMOVE.LD6,CCBPTR(A5)†storethebufferphysicaladdress.*$*‚NowtakecareoftheREADportion.*?ŠMOVE.LIOSRRN(A3),D6†D6<--logicalstartaddrofreadbuffer.<ŠMOVE.LIOSLEN(A3),D5†D5<--lengthofreadbufferinbytes./ŠMOVE.LD5,CCBLEN1(A5)…Savethebufferlength&&ŠBSR„BUFADDRŒgetthephysicaladdress,8ŠMOVE.LD6,CCBPTR1(A5)…savethebufferphysicaladdress. ŠCLR.L‚D6&ŠBSETƒ#LUFXFR,D6ŒSETDATATRANSFERBITŠBSETƒ#LUFACT,D6ŒSETACTIVEBIT%ŠBSR„DEVTBLSETUPDEVICETABLEENTRY /ŠBSR„SETPKTSETUPPACKETHEADERINSHAREDMEM. 3OUTW10„BTSTW„#IOPFORB,IOSOPT(A3)‚OUTPUTFORMATTED?ŠBNE.S„OUTW30ŽNO,ŠBTSTW„#IOPINFB,IOSOPT(A3)INPUTFORMATTED?ŠBNE.S„OUTW20ŽNO8ŠMOVE.Wƒ#XOFIF,D1‹SETUPOUTPUTFRMT/INPUTFRMTCOMMANDS ŠBRA.S„OUTW50?OUTW20„MOVE.Wƒ#XOFIM,D1‹SETUPOUTPUTFRMT/INPUTIMAGECOMMANDS ŠBRA.S„OUTW502OUTW30„BTSTW„#IOPINFB,IOSOPT(A3)‚INPUTFORMATTED?ŠBNE.S„OUTW40ŽNO5ŠMOVE.Wƒ#XOIIF,D1‹SETUPOUTPUTIMAGE/INPUTFRMTCMDS ŠBRA.S„OUTW50>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<< OUTW60„EQU†*4ŠBTSTW„#IOPCTAB,IOSOPT(A3)FLUSHTYPEAHEADBUFFER?ŠBEQ.S„OUTW61ŽNO,ŠOR.L…#XPKCTAB,D0‰SETUPFLUSHBUFFEROPTIONN*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>*‚THEN.S'ŒKILL.DRIVERIPCDRV_ID,BAD_DEVICE,A5,A4ŠENDI,ŠMULU…#LUDSZE,D0ŠCALCULATEPOSITIONINTABLE2ŠMOVE.LƒCCBDTBL(A5),A1†SETUPDEVICETABLEPOINTERŠINHIBŠTST.W„LUFLG(A1,D0.L)ˆACTIVE?ŠBEQ†HALTERŽNO,ERROR3ŠBSETW„#LUFHLT,LUFLG(A1,D0.L)SETHALTPENDINGFLAG3ŠMOVE.LƒA3,LUMISC(A1,D0.L)‚SAVEHALTPACKETPOINTERŠENABL /ŠBSR†SETPKTŽSETUPPACKETHEADERINSHAREDMEM. ŠMOVE.Wƒ#XHALT,D16ŠMOVEP.W‚D1,IPCCHCM(A1)†SETUPCHANNEL/DEVICECOMMANDS#ŠMOVE.Bƒ#ETX,IPCRETX(A1)„SETUPETX/ŠMOVE.Bƒ#HLTPKSZ,IPCPKSZ(A1)†SETUPPACKETSIZE ŠBRA†NRMEXITŠPAGEH**************************************************************************‰TRANSMITBREAKREQUEST*<*‰ThiscommandsendsthebreakrequesttotheLUNspecified.**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB**J***************************************************************************TBREAK: ŠCLR.L„D6-ŠBSET…#LUFACT,D6ŒSETACTIVEDEVICETABLEFLAG%ŠBSR†DEVTBLSETUPDEVICETABLEENTRY*,ŠBSR†SETPKTSETUPPACKETHDRINSHAREDMEM.ŠMOVE.Wƒ#XTRNSBK,D16ŠMOVEP.W‚D1,IPCCHCM(A1)ˆSETUPCHANNEL/DEVICECOMMANDS#ŠMOVE.Bƒ#ETX,IPCRETX(A1)†SETUPETX/ŠMOVE.Bƒ#TBKPKSZ,IPCPKSZ(A1)‚SETUPPACKETSIZE ŠBRA†NRMEXITŠPAGEL*****************************************************************************C*‰ROUTINECOMMONTOALLI/OCOMMANDS(READ,WRITE,OUTPUTW/INPUT)**‚Entry:A3=addressofIOCB*‰A5=addressofCCB**‚Exit:‚(normal)*‰D6=physicaladdrofbuffer**‚Exit:‚(abort). *‰D1=errorstatus**L*****************************************************************************IOSCOMN:?ŠBTSTW‚#IOPTSKB,IOSOPT(A3)Ifthebuffersresideinadifferent"ŠBEQ.S‚IOSC005ŒtaskfromtheIOCB, 9ŠLEA„IOSTSK(A3),A0†Pointtothetaskname&sessionofthe7ŠTR0$.GETTCB‚,Œbufferowner&callexectogetaddress."ŠBRA.S‚OKTCBŽIfit'sgood,branch.ŠNOP—Ifit'sbad,7ŠMOVE.B#ISTAADD,D1ˆsetstatusinIOCBtoaddresserrorŠTST.L‚(A7)+ŽadjuststackŠBRA„ABORTandexittoCMR. :OKTCB…MOVE.LA0,CCBTASKB(A5)„SavephysicaladdressofTCB. *<*‚ValidatetheinfointheIOCBabouttheprimarybufferand *‚converttophysicaladdresses.*BIOSC005ƒMOVE.LIOSSAD(A3),D6†D6<--bufferphysicalstartaddress.+ŠMOVE.LIOSEAD(A3),D5†D5<--bufferlength.ŠSUB.L‚D6,D5Ž*ŠADDQ.L#1,D5Ž*)ŠMOVE.LD5,CCBLEN(A5)†SavelengthinCCB. >ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner. ŠBSR„IOHADRCK‹Checktheaddress.$ŠBRA.S‚IOSC010ŒIfit'sgood,branch.ŠNOP—Ifit'sabadbaseaddrŠTST.L‚(A7)+Žadjuststack4ŠMOVE.B#ISTAADD,D1ˆSetIOCBstatustoADDRESSERROR2ŠBRA„ABORTandexitwithappropriateerrorstatus. IOSC010ƒEQU„*N*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<< ŠGO_OFF_BDD6N*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>ŠRTSŠPAGEK****************************************************************************/*‰VALIDATEBUFFERADDRESS&CONVERTTOPHYSICAL*$*‰Entry:D5=bufferlengthinbytes-*D6=bufferlogicalstartaddr(toconvert)*A3=addressofIOCB*A5=addressofCCB***‰Exit:‚D6ƒ=bufferphysicalstartaddress*D5ƒ=bufferlength*K****************************************************************************BUFADDR:>ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner. ŠBSR„IOHADRCK‹Checktheaddress.$ŠBRA.S‚OKADDR2ŒIfit'sgood,branch.ŠNOP—Ifit'sabadbaseaddrŠTST.L‚(A7)+Žadjuststack4ŠMOVE.B#ISTAADD,D1ˆSetIOCBstatustoADDRESSERROR2ŠBRA„ABORTandexitwithappropriateerrorstatus.OKADDR2ƒEQU„*’Return.*N*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<< ŠGO_OFF_BD‚D6N*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>ŠRTSŠPAGEO*********************************************************************************ˆCHECKDISKPARAMETERS**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB**O********************************************************************************DSKPRM:%‰MOVE.W‚IOSOPT(A3),D1‰PICKUPOPTIONS+‰AND.Wƒ#IOPRAN,D1ŒRANDOMOPTIONSPECIFIED?‰BNE.SƒDSKPR10YES(‰MOVE.B‚#ISTATM,D1ŒSETUPIOSERRORCODE‰BRA.SƒDSKPR25ERROREXIT(DSKPR10‚MOVE.L‚IOSRRN(A3),D1‰PICKUPRRN‰BPL.SƒDSKPR30GOODRRN/DSKPR20‚MOVE.B‚#ISTARR,D1ŒSETUPIOSERRORCODE DSKPR25‚TST.Lƒ(A7)+‘ADJUSTSTACK‰BRA…ABORTERROREXITŠSPC„2ADSKPR30ƒCMP.LƒDCBSEC(A4),D1‡Iftherandomrecordnumberspecified7ŠBLT.SƒDSKPR35‹intheIOCBispasttheendofthedisk,1ŠMOVE.B#ISTARR,D1‰returnanend-of-volumeerror.ŠBRA.S‚DSKPR25ŠSPC„22DSKPR35‚MOVE.L‚CCBLEN(A5),D1‰PICKUPBUFFERLENGTH"‰DIVS„#256,D1CALC.NO.OFSECTORS ‰MOVE.L‚D1,D2*‰AND.Lƒ#$FFFF0000,D2‰MUSTBEWHOLESECTORS‰BEQ.SƒDSKPR40ITSOK5‰MOVE.B‚#ISTAADD,D1‹ERROR,PARTIALSECTORNOTALLOWED‰BRA…DSKPR25ERROREXIT1DSKPR40‚MOVE.W‚D1,CCBBLKS(A5)ˆSAVENO.OFSECTORS2‰ADD.LƒIOSRRN(A3),D1‰CALC.LASTSECTORTOTRANSFER‰CMP.LƒDCBSEC(A4),D1‰RANGEOK?‰BLE.SƒDSKPR50YES4‰MOVE.L‚DCBSEC(A4),D1‰NO,CALC.MAXSECTORSCANREAD‰SUB.LƒIOSRRN(A3),D1/‰MOVE.W‚D1,CCBBLKS(A5)ˆSAVESECTORSTOTRANSFER ‰BSET„#LUFEOF,D6ŒSETEOFPENDINGDSKPR50‚RTS›RETURN‰PAGEO********************************************************************************** SET UP DEVICE TABLE ENTRY**,*‚Entry:A2=addressofCMRparameterblock/ çÐ@ÙFáIéBñNù;8 P5@!H)61=9:A;I=Q6YEaXi?q;yD>‰G‘F*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB**‰D6=devicetableflag*N*******************************************************************************DEVTBL: ŠCLR.L‚D0(ŠMOVE.BDCBCDV(A4),D0‰PICKUPDEVICENO. ŠCMP.B‚#LUMAX,D0DEVICENO.OK?ŠIF‚‚THEN.S'ŒKILL.DRIVERIPCDRV_ID,BAD_DEVICE,A5,A4ŠENDIŠMULUƒ#LUDSZE,D0ŒCALC.POSITION3ŠMOVE.LCCBDTBL(A5),A0ˆPICKUPDEVICETABLEPOINTER(ŠTST.W‚LUFLG(A0,D0.L)ŠTHISDEVICEFREE?ŠBEQ.S‚DEVT010YESŠTST.L‚(A7)+‘ADJUSTSTACK+ŠMOVE.B#ISTADB,D1ŒRETURNDEVICEBUSYERRORŠBRA„ABORTERROREXIT2DEVT010ƒMOVE.WD6,LUFLG(A0,D0.L)‡UPDATETABLEFLAG,ŠMOVE.LA4,LUDCB(A0,D0.L)‡SETUPDCBADDRESS.ŠMOVE.LA3,LUIOCB(A0,D0.L)†SETUPIOCBADDRESS6ŠMOVE.LCCBTASKB(A5),LUTCB(A0,D0.L)SETUPTCBADDRESS8ŠMOVE.LCCBPTR(A5),LUBADR(A0,D0.L)SETUPBUFFERADDRESS ŠRTSšRETURNŠPAGEJ***************************************************************************%*ˆSETUPPACKETHEADERINSHAREDMEM.**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB*,*‰Return:A1=addressofIPCsharedmemory**I**************************************************************************SETPKT:)ŠLEA†CCBSHR(A5),A1‡GETCOMMANDBUILDAREA)ŠLEA†IPCIM1(A1),A1‡SETUPMESSAGEADDRESSŠMOVE.Wƒ#SPKT,D1/ŠMOVEP.W‚D1,IPCSTX(A1)‡SETUPSTXANDPACKETID%ŠMOVE.LƒXIOUID(A2),A0‡GETDCBADDRESS0ŠMOVE.BƒDCBCDV(A0),IPCPHDV(A1)‚SETUPDEVICENO. ŠRTSšRETURNŠPAGEJ***************************************************************************)*‰SETUPDISKPARAMETERSINSHAREDMEMORY*&*‚Entry:A1=addressofSHAREDMEMORY%*‰A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB**‰D1=CHANNEL/DEVICEcommands*K****************************************************************************DSKCMD:6ŠMOVEP.W‚D1,IPCCHCM(A1)†SETUPCHANNEL/DEVICECOMMANDSŠMOVE.WƒCCBBLKS(A5),D18ŠMOVEP.W‚D1,IPCNBKS(A1)†SETUPNO.OFBLOCKSTOTRANSFERŠMOVE.Wƒ#SECSIZ,D1)ŠMOVEP.W‚D1,IPCBKSZ(A1)†SETUPBLOCKSIZEŠMOVE.LƒCCBPTR(A5),D1.ŠMOVEP.L‚D1,IPCBUFAD(A1)…SETUPBUFFERADDRESS ŠCLR.L„D1'ŠMOVEP.W‚D1,IPCCKSM(A1)†SETUPCHECKSUMŠMOVE.LƒIOSRRN(A3),D1#ŠMOVEP.L‚D1,IPCCMPRM(A1)…SETUPPSN"ŠMOVE.Bƒ#ETX,IPCETX(A1)…SETUPETX.ŠMOVE.Bƒ#IOPKSZ,IPCPKSZ(A1)SETUPPACKETSIZE ŠRTSšRETURNŠPAGEJ***************************************************************************)*ˆSETUPMCCMPARAMETERSINSHAREDMEMORY**&*‚Entry:A1=addressofSHAREDMEMORY%*‰A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB**‰D0=options*‰D1=channel/devicecommands**L*****************************************************************************MCCMCMD:6ŠMOVEP.W‚D1,IPCCHCM(A1)†SETUPCHANNEL/DEVICECOMMANDS&ŠMOVEP.L‚D0,IPCSWCF(A1)†SETUPOPTIONS ŠMOVE.Lƒ#1,D18ŠMOVEP.W‚D1,IPCNBKS(A1)†SETUPNO.OFBLOCKSTOTRANSFERŠMOVE.LƒCCBLEN(A5),D1)ŠMOVEP.W‚D1,IPCBKSZ(A1)†SETUPBLOCKSIZEŠMOVE.LƒCCBPTR(A5),D1.ŠMOVEP.L‚D1,IPCBUFAD(A1)…SETUPBUFFERADDRESS ŠCLR.L„D1'ŠMOVEP.W‚D1,IPCCKSM(A1)†SETUPCHECKSUM"ŠMOVE.Bƒ#ETX,IPCETX(A1)…SETUPETX.ŠMOVE.Bƒ#IOPKSZ,IPCPKSZ(A1)SETUPPACKETSIZE ŠRTSšRETURNŠPAGEO******************************************************************************** *ˆNORMALEXIT*,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB*I**************************************************************************NRMEXIT:/ ‰MOVE.L„CCBCHB(A5),A0‰TST.B…IPCIMB1(A0)‰BNE.S…NRMEXIT*/* INDICATE AWAITING ACK, BUMP I/O PENDING COUNT*ŠINHIB'ŠBSETW‚#CCBFGWAK,CCBFG(A5)ƒSETCCBFLAGŠMOVE.LCCBTASKB(A5),A0-ŠADD.B‚#1,TCBIOCNT(A0)„BUMPI/OPENDINGCOUNT** INTERRUPT THE IPC*4ŠLEA„CCBSHR(A5),A0‰GETPOINTERTOCOMMANDBUILDAREA4ŠLEA„IPCIM1(A0),A0ˆADDOFFSETTONOTUSEIPCOFFSETS2ŠMOVE.L#$D,D0MOVE$10*4LONGWORDS(DBRAADDS1)0ŠMOVE.LCCBCHB(A5),A1†SETUPSHAREDMEM.POINTER‰LEA‡IPCIM1(A1),A19MOVESHR‚MOVEP.L0(A0),D1GETDATAFROMCOMMANDBUILDAREA'‰MOVEP.LD1,0(A1)MOVEITTOSHAREDRAM‰LEA‡8(A0),A0ŒADDTOGETNEXT‰LEA‡8(A1),A1ŒADDTOGETNEXT#‰DBRA†D0,MOVESHRŠLOOPTILALLMOVED;‰MOVE.L„CCBCHB(A5),A1‡GETTHESHAREDRAMADDRESSBACKAGAIN8‰BCLRW…#CCBBUSY,CCBFG(A5)‚FREEUPTHECOMMANDBUILDAREA(ŠMOVE.B#$80,IPCIMB1(A1)ƒMESSAGEWAITING0ŠADD.B‚#2,CCBICNT(A5)…BUMPOUTSTANDINGINTCOUNT%ŠMOVE.B#$80,IPCINT(A1)„INTERRUPTIPC‰ENABL#ŠCLR.L‚D0‘SETUPGOODRETURNTOCMR*7* USER REQUEST SIDE OF IPC ALWAYS EXITS FROM THIS POINT*IPCUSRTN‚EQU„*ŠRTS—RETURNTOMAINLINEŠPAGEJ*****************************************************************************‚NOTHINGTOHALTERRORROUTINE*%*’ENTRY:A2=PARAMETERBLOCKADDRESS*™A3=IOCBPACKETADDRESS*™A4=ADDRESSOFDCB*™A5=ADDRESSOFCCB*™A6=ADDRESSOFCALLERSTCB*H************************************************************************* HALTER:‚ENABL)‰LEA‡CCBPKT(A5),A4‡SETUPQUEUEWORKAREA ‰MOVE.L„#6,D0SETUPPACKETSIZE$‰MOVE.B„#XPSHLT,D1ŠSETUPEVENTTYPE"‰MOVE.L„XIOUID(A2),D2‡SETUPPBID&‰MOVE.W„#ISTAIF,D3ŠSETUPSTATUSVALUE7‰MOVE.B„#ISTAIF,IOSSTA(A3)‚RETURNSTATUSTOUSER'SIOCB‰BSR‡QEVNTGOQUEUEEVENT ‰CLR.L…D0‰BRA‡IPCUSRTNŒRETURN‰PAGEJ*****************************************************************************ˆABORTCOMMANDROUTINE*%*’ENTRY:A2=PARAMETERBLOCKADDRESS*™A3=IOCBPACKETADDRESS*™A4=ADDRESSOFDCB*™A5=ADDRESSOFCCB*™A6=ADDRESSOFCALLERSTCB*™D1=IOSERRORCODE*H*************************************************************************ABORT:)‰LEA‡CCBPKT(A5),A4‡SETUPQUEUEWORKAREA ‰MOVE.L„#6,D0SETUPPACKETSIZE"‰MOVE.L„XIOUID(A2),D2‡SETUPPBID‰AND.W…#$FF,D1!‰MOVE.W„D1,D3SETUPSTATUSVALUE!‰MOVE.B„D1,IOSSTA(A3)‡UPDATEIOCB$‰MOVE.B„#XPSNRM,D1ŠSETUPEVENTTYPE‰BSR‡QEVNTGOQUEUEEVENT ‰CLR.L…D0‰BRA‡IPCUSRTNŒRETURNŠPAGEF***********************************************************************B* SUBROUTINE TO CHECK ADDRESS BOUNDARIES TO SEE IF ENTIRELY WITHIN*ƒCALLINGTASKSADDRESSSPACE.*#*ENTRY:ƒD5‚-NO.OFBYTESTOCHECK*ŠD6‚-68000ADDRESS(LOGICAL)*ŠA1‚-TCBADDRESS** EXEC ROUTINE#* REGISTERS USED: D0-D1,D3,D6/A0-A1**7*EXIT:„D6-PHYSICALADDRESSOFBUFFERBASE(IFLEGAL)*ŠRETURNTOPC„FORGOODADDRESS*”PC+2‚FORBADLENGTH*”PC+4‚FORBADADDRESS*F*********************************************************************** IOHADRCK:$ŠBTSTƒ#0,D6ŽMUSTBEONWORDBOUNDARY(ŠBNE.S‚IOHADR6ŒBRANCHIFBADBUFFERBASE ŠTST.L‚D5.ŠBEQ.S‚IOHADR8ŒDON'TGOTOLOGPHYWITH0COUNT IOHADR2ƒEQU„*/ŠMOVE.LTCBTST(A1),A0†ADDRESSOFTASKSEGTABLE ŠTR0$.LOGPHY&ŠBRA.S‚IOHADR8ŒBRANCHFORGOODADDRESSŠNOP—FORPARTIN/PARTOUTERROR-IOHADR6ƒADD.L‚#2,(A7)ŒADJUSTFORERRORRETURN IOHADR8ƒRTSŠPAGEI***************************************************************************ˆGETTCBROUTINE*)*’ENTRY:A0=POINTERTOTASKANDSESSION***’EXECROUTINE*’REGISTERSUSED:D0-D1/A0-A1***’EXIT:A0=TCBADRESS**˜RETURNTOPC„FORGOODTASKSPECIFICATION!*¢PC+2‚FORBADTASKSPECIFICATION**J***************************************************************************GETTCB: ŠTR0$.GETTCB%ŠBRA.S„GETT10ŽGOODTASKSPECIFICATION%ŠADD.L„#2,(A7)BADTASKSPECIFICATION GETT10„RTSŠPAGEJ**************************************************************************** * SUBROUTINE0  TO COMPUTE CHECKSUM*&*‡ENTRY:A1=PHYSADDROFBLOCKBEGIN,*ŽD5=ONERELATIVECOUNTOFNUMBEROFBYTES*C*‡EXIT:‚D1=CHECKSUM(SUMOFBYTESWITHWORD(16BIT)SIGNIFICANCE)** REGISTERS D0,D5 DESTROYED*M****************************************************************************** *IPCCKSUM:"*ˆTR0$.KILLER‰GOCRASHTHESYSTEM?*‰CLR.LƒD1‹ACCUMULATOR)*‰MOVE.L‚A1,D0ˆADDRESSOFBLOCKBEGINNING'*‰BTSTW‚#24,D0ˆISITFOR2NDARYMEMORY?*‰BNE.SƒCKSUM2‡BRANCHIFYES+* CHECKSUM CALCULATION IF IN PRIMARY MEMORY*‰CLR.LƒD0‹BYTEHOLDER*IPCCK30ƒEQU…*'*‰SUB.Lƒ#1,D5ˆBEGINWITHZERORELINDEX*‰BLT.SƒIPCCK50†BRANCHIFDONE*‰MOVE.B‚0(A1,D5.L),D0 *‰NOT.BƒD0/*‰ADD.WƒD0,D1ˆCONTRIBUTETHISBYTETOCHECKSUUM*‰BRA…IPCCK30†GOFORANOTHER*IPCCK50ƒEQU„**‰RTS…0ŒBACKTOMAINLINE** CHECKSUM CALCULATION IF IN 2NDARY MEMORY *CKSUM2„EQU„*!*‰TR0$.KILLERˆGOCRASHTHESYSTEM"*‰AND.Lƒ#$00FFFFFF,D0‡CLEARBIT24*‰MOVE.L‚D0,A1ˆFORINDEXING*‰CLR.LƒD0‹BYTEHOLDER+*‰MOVE.W‚SR,-(A7)…SAVEFORINTERRUPTUNMASK*IPCCK80ƒEQU…*ŒLOOPTOP,*‰SUB.Lƒ#1,D5ˆBEGINWITHZERORELATIVEINDEX/*‰BLT.SƒIPCCK90†BRANCHIFDONEWITHCALCULATION"*‰MOVE.W‚#$2700,SR„MASKINTERRUPTS!*‰MOVE.W‚#0,$FE0006ƒTOGGLE2NDARY+*‰MOVE.B‚0(A1,D5.L),D0‡PICKUPNEXTFORSUM*‰MOVE.W‚(A7),SR†UNMASK *‰NOT.BƒD0.*‰ADD.WƒD0,D1ˆCONTRIBUTETHISBYTETOCHECKSUM *‰BRA…IPCCK80(*IPCCK90‚ADD.Lƒ#2,A7‰BYPASSSAVEDSTATUS*‰BRA.SƒIPCCK50‡BACKTOCALLERŠPAGEI****************************************************************************‚CMRRESETROUTINE*%*ˆENTRY:A2=PARAMETERBLOCKADDRESS*A3=PACKETADDRESS*A5=CCBADDRESS*A6=CALLERSTCBADDRESS*I**************************************************************************5* Just a note for future maintainers of this code ---*G*Thefollowingresetroutinehasneverbeeninvoked.‚InpracticethereH*ƒisnowayforustoreachthiscodeeventhoughBSRCMRRESTispresentF*ƒinthecode.‚Ifthiscodewereeverexecuted,themostlikelyresultC*ƒwouldbetolosetheIPCuntilareboottakesplace.‚WhenaresetH*ƒisissued,theIPCgoesintoaselftestmodeandthereisnogoodway@*ƒtotellwhenitisdone.‚TheamountoftimespentinselftestG*ƒmodemaybeconsiderable.‚TohandletheresetlogicinanintelligentD*ƒwaywouldinvolvesignificantchangestothedriverandtoIOS.‚As6*ƒof01/18/84,nosuchchangeshavebeencontemplated.*CMRREST:*/ŠMOVE.LCCBCHB(A5),A4†SETUPSHAREDMEMPOINTER*5*‰SETLASTBYTEOFSHAREDMEMORYASANINDICATORTHAT*‰RESETISNOTCOMPLETE*ŠMOVE.B#$FF,IPCLST(A4)=* CLEAR ERROR MODE,WAITING FOR ACK, DEALT WITH ACK, EXIT FLAG%ŠCLR.L‚CCBNAKAD(A5)‡CLEARNAKADDRESS'ŠCLR.L‚CCBERAD1(A5)‡CLEARERRORADDRESSŠINHIB•INHIBITINTERRUPTSEŠAND.W#-1-(1<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>PJD>31485>*G*‰THISCODEWASADDEDON3/14/85TOLOOKFORTHEINVALIDCOMMANDSTATUSC*‰ATTHEWRONGPLACEBECAUSETHEVM30-1FIRMWARE1.0PUTSITTHERE.*D*‰THISCODEMAYBEREMOVEDINTHEFUTUREWHENTHEVM30-1FIRMWAREIS *‰UPDATED*9ŠCMP.B‚#RTNHLT,RTNCHCM+IPCIM2(A4)HALT/ABORTPACKETCODE?4ŠBEQ.S‚PKTC001BRANCHIFYES,CHECKTHESTATUSVALUEŠBRA.S‚PKTC010*N*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<*&*‰CheckforConfiguration(2ndPacket)*"ŠBTST.B#PIDPKTF,RTNPID+IPCIM2(A4)ŠBEQ.S‚PKTC010NO,IPCERRORŠBRA„INEXITYES2ndPacket*N*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<*.PKTC030ƒMOVE.L‚LUDCB(A2),A0‰SETUPDCBPOINTER ŠCLR.LƒD1%ŠCMP.Bƒ#XTDIPC,CCBTYPE(A5)‚DISKIPC? ŠBNE…MCCMPKTŽNO,MUSTBEANMCCM*‰BRA…DSKPKTYESŠPAGEL*****************************************************************************,* HANDLE DISK NORMAL COMPLETION PACKETS HERE*+*ˆENTRY:A2=addressofdevicetableentry*A3=addressofIOCB(*A4=addressofIPCsharedmemorybase*A5=addressofCCB*D0=packetstatusvalue*O********************************************************************************DSKPKT:/ŠLEA…DERXREF(PC),A1‡SETSTATUSCROSSREF.TABLE*ŠCMP.Wƒ#DERXL,D0ŒERRORCODEINTHETABLE?ŠBLE.SƒDSKPK10ŽBRANCHIFYES'ŠBSR…IPCUNSERNO,IPCERROR-RESETIPCŠBRA…IPCINRTNRETURN'DSKPK10ƒCMP.Wƒ#XPSCSM,D0‹CHECKSUMERRORŠBNE.SƒDSKPK20ŽBRANCHIFNOŠCLR.LƒD0“YES,IGNOREIT1DSKPK20ƒLSL.Wƒ#1,D0TIMES2FORPOSITIONINTABLE+ŠMOVE.B‚(A1,D0.W),D1‰PICKUPIOSERRORCODE!ŠBNE.SƒDSKPK30ŽBRANCHIFANERROR&ŠBTSTWƒ#LUFEOF,LUFLG(A2)„EOFPENDING?ŠBEQ.SƒDSKPK30ŽBRANCHIFNO)ŠMOVE.B‚#ISTAEOV,D1ŠSETUPIOSERRORCODEŠBRA.SƒDSKPK505DSKPK30ƒBTST„#1,1(A1,D0.W)ˆNEEDTOUPDATEPSNFIELD?ŠBEQ.SƒDSKPK40ŽBRANCHIFNO:ŠMOVEP.LRTNSTPR+IPCIM2(A4),D2‚PICKUPPSNFROMSHAREDMEM+ŠMOVE.L‚D2,IOSRRN(A3)ˆUPDATEIOCBRRNFIELDDSKPK40ƒCLR.LƒD41ŠBTST„#0,1(A1,D0.W)ˆNEEDTOUPDATELENGTHFIELD?ŠBEQ.SƒDSKPK60ŽBRANCHIFNODSKPK50ƒCLR.LƒD35ŠMOVEP.WRTNBLKS+IPCIM2(A4),D3‚PICKUPNO.OFSECTORS2ŠMOVEP.WRTNBKSZ+IPCIM2(A4),D4‚PICKUPSECTORSIZEŠMULU„D3,D4CALC.NO.OFBYTES5DSKPK60ƒMOVE.L‚D4,IOSLEN(A3)ˆUPDATEIOCBLENGTHFIELD.ŠMOVE.B‚D1,IOSSTA(A3)ˆUPDATEIOCBSTATUSFIELD ŠBRA…INEXITŠPAGEK****************************************************************************!* HANDLE UNSOLICITED PACKE2 TS HERE*+*ˆENTRY:A2=addressofdevicetableentry*A3=addressofIOCB(*A4=addressofIPCsharedmemorybase*A5=addressofCCB*L*****************************************************************************UNSPKT:.ŠCMP.B‚#RTNUNS,RTNSTCM+IPCIM2(A4)RIGHTCODE?ŠBEQ.S‚UNSP010BRANCHIFYES'ŠBSR„IPCUNSERŽNO,IPCERROR-RESETIPCŠBRA„IPCINRTNŽRETURN0UNSP010ƒMOVE.LLUDCB(A2),D2ŠPICKUPLASTCMDDCB$ŠBEQ.S‚UNSP030FIRSTONE,USECCBID ŠMOVE.LD2,A0‘SETUPDCBPOINTER'ŠMOVE.W#XSTVDST,D3‹SETUPSTATUSVALUE%ŠCMP.B‚#XTDIPC,CCBTYPE(A5)ƒDISKIPC?ŠBNE.S‚UNSP020NO;ŠMOVE.BRTNSTAD+IPCIM2(A4),D0‚GETSTATUSFROMSHAREDMEMORYŠMOVE.LD0,D4‘MAKEANOTHERCOPY"ŠAND.W‚#$0F,D4ISOLATEDEVICEBITS"ŠAND.W‚#$F0,D0ISOLATESTATUSBITS$ŠLSL.W‚#8,D0‘SETUPBYTE1OFSTATUSŠOR.WƒD0,D4‘MERGEBYTE1AND2:ŠMOVEP.LRTNLSEC+IPCIM2(A4),D0‚GETSECTORSFROMSHAREDMEM-ŠMOVE.LD0,DCBSEC(A0)‰UPDATEDCBWITHSECTORS&ŠMOVE.L#8,D0‘SETUPEVENTINFOLENGTHŠBRA.S‚UNSP040BUNSP020ƒMOVE.BRTNSTAD+IPCIM2(A4),D0‚GETSTATUSFROMSHAREDMEMORYŠMOVE.LD0,D4‘MAKEANOTHERCOPY"ŠAND.W‚#$0F,D4ISOLATEDEVICEBITS"ŠAND.W‚#$F0,D0ISOLATESTATUSBITSŠBSETƒ#XDSBRK,D0ŒSETBREAKBIT$ŠLSL.W‚#8,D0‘SETUPBYTE1OFSTATUSŠOR.WƒD0,D4‘MERGEBYTE1AND2&ŠMOVE.L#8,D0‘SETUPEVENTINFOLENGTHŠBRA.S‚UNSP040  5UNSP030ƒMOVE.LCCBMNEM(A5),D2ˆSETUPCHANNELMNEMONIC'ŠMOVE.W#XSTVNID,D3‹SETUPSTATUSVALUE0ŠMOVE.BRTNSTPR+IPCIM2(A4),D0‚PICKUPIPCSTATUSŠMOVE.LD0,D4‘MAKEANOTHERCOPY"ŠAND.W‚#$0F,D4ISOLATEDEVICEBITS"ŠAND.W‚#$F0,D0ISOLATESTATUSBITS$ŠLSL.W‚#8,D0‘SETUPBYTE1OFSTATUSŠOR.WƒD0,D4‘MERGEBYTE1AND2/ŠMOVE.BRTNPHDV+IPCIM2(A4),D5SETUPDEVICENO.'ŠMOVE.L#10,D0SETUPEVENTINFOLENGTH+UNSP040ƒMOVE.B#XPSUNS,D1ŒSETUPEVENTTYPE+ŠLEA„CCBCPKT(A5),A4ˆSETUPEVENTBUILDAREA#ŠBSR„QEVNT‘QUEUENOTIFICATIONEVENT ŠBRA„INEX010ŠPAGEJ*************************************************************************** * HANDLE HALT/ABORT PACKET ($71)*+*ˆENTRY:A2=addressofdevicetableentry*A3=addressofIOCB(*A4=addressofIPCsharedmemorybase*A5=addressofCCB*D0=packetstatusvalue*K****************************************************************************HLTPKT:#ŠCMP.W‚#XPSICM,D0ŒINVALIDCOMMAND?ŠBNE.S‚HLTP010BRANCHIFNON*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<*#*‰ConfigureCommand-secondpacket*"ŠBTST.B#PIDPKTF,RTNPID+IPCIM2(A4)ŠBNE.S‚HLTP030YES-2ndpacket*N*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>0ŠBCLRW‚#LUFHLT,LUFLG(A2)…Clearhaltpendingflag&ŠBRA„INEX020GoacknowledgeandreturnGHLTP010ƒMOVE.B#ISTATO,IOSSTA(A3)„UPDATEORIGREQUESTIOCBSTATUSFIELDŠMOVE.LƒA6,-(A7)ŒSAVEA62ŠMOVE.LƒLUMISC(A2),A6‡GETHALTPACKETIOCBADDRESS.ŠMOVE.Bƒ#ISTAOK,IOSSTA(A6)‚UPDATESTATUSTOOKŠMOVE.Lƒ(A7)+,A6ŒRESTOREA67ŠCLR.L‚IOSLEN(A3)ŒUPDATEORIGREQUESTIOCBLENGTHFIELD&ŠMOVE.W#ISTATO,D3ŒSETUPSTATUSVALUE$ŠMOVE.B#XPSHLT,D1ŒSETUPEVENTTYPE-HLTP020ƒMOVE.L#6,D0‘SETUPEVENTINFOLENGTH)ŠMOVE.LLUDCB(A2),D2ŠSETUPDCBFOREVENT+ŠLEA„CCBCPKT(A5),A4ˆSETUPEVENTBUILDAREAŠBSR„QEVNT‘QUEUEHALTEVENT)ŠCLR.W‚LUFLG(A2)CLEARDEVICETABLEENTRY ŠBRA„INEX010* *‰2ndPacket* HLTP030ƒEQU„*+ŠMOVE.LLUBADR(A2),A1‰SETUPBUFFERPOINTER=ŠAND.L‚#$F84F,IOSPRM(A1)…SETUNCONFIGURABLEBITS(2nd)PACKET ŠBRA„STAP030ŠPAGEL*****************************************************************************0* HANDLE SOLICITED DEVICE/CONFIGURE PACKET ($72)*+*ˆENTRY:A2=addressofdevicetableentry*A3=addressofIOCB(*A4=addressofIPCsharedmemorybase*A5=addressofCCB*D0=packetstatusvalue*L*****************************************************************************STAPKT:+ŠMOVE.LLUBADR(A2),A1‰SETUPBUFFERPOINTER(ŠMOVE.LLUDCB(A2),A0ŠPICKUPDCBADDRESS<ŠMOVE.BRTNDSTA+IPCIM2(A4),D1‚PICKUPSTATUSFROMSHAREDMEM ŠMOVE.LD1,D2"ŠAND.B‚#$0F,D2ISO2 LATEDEVICETYPE-ŠMOVE.BD2,IOSDTP(A1)‰UPDATECONFIGUREBUFFER"ŠAND.B‚#$F0,D1ISOLATESTATUSBITS-ŠMOVE.BD1,IOSDST(A1)‰UPDATEDEVSTATUSFIELD%ŠCMP.B‚#XTDIPC,CCBTYPE(A5)ƒDISKIPC?ŠBNE.S‚STAP020NO&ŠCMP.W‚#3,D0‘DEVICENOTREADYSTATUS?%ŠBEQ.S‚STAP010BRANCHIFYES,IT'SOKŠCMP.W‚#$05,D0ŠBEQ.S‚STAP010$*¦JMPIFINVALIDLOGICALUNITNUMBERŠCMP.W‚#$12,D0ŠBEQ.S‚STAP010*¦JMPIFDEVICENOTTHEREŠCMP.W‚#$10,D0ŠBEQ.S‚STAP010*¦JMPIFDEVICEERRORRETURNEDŠCMP.W‚#$13,D0ŠBEQ.S‚STAP010*¦JMPIFDEVICECONFLICTERRORŠTST.W‚D0”RIGHTSTATUSVALUE?ŠBEQ.S‚STAP010BRANCHIFYES‰CMP.W…#$0E,D0‰BNE.S…STAP010!*¦JMPIFOTHERTHANINDETERMINATE*¦CHANNELERROR'ŠBSR†IPCUNSERŒNO,IPCERROR-RESETIPCŠBRA†IPCINRTNŒRETURN1STAP010ƒCLR.B„IOSSTA(A3)ŠUPDATEIOCBSTATUSFIELD>ŠMOVEP.L‚RTNLSEC+IPCIM2(A4),D1PICKUPSECTORSFROMSHAREDMEM*ŠMOVE.LƒD1,IOSRSZ(A1)‡UPDATESECTORSFIELD'ŠCLR.W„IOSATW(A1)ŠCLEARATTRIBUTESWORDŠBRA.S„STAP030* STAP020ƒEQU„*N*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 6/04/84 <<<<<<<ŠTST†D0’REQUESTSTATUSCOMMANDŠBEQ†STAP300YES*&*‰CheckforConfiguration(1stPacket)*"ŠBTST.B#PIDPKTF,RTNPID+IPCIM2(A4)ŠBNE.S‚STAP035Not1stPacketN*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>*ŠCLR.B‚IOSSTA(A3)ŒUPDATEIOCBSTATUSFIELD*O*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *ºBKM7/14/83$*‰BTSTWƒ#DATPRT,DCBATT(A0)ƒPRINTER?!ŠBTSTMƒDATPRT,DCBATT,A0ƒPRINTER? *ºBKM7/14/83O*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<ŠBEQ…STAP040ŽBRANCHIFNO*>*ˆPrinterconfigurationcomplete.‚Updatecurrentconfiguration*ˆandreturntheresults.*&‰MOVEM.LƒA5,-(A7)ŒSavetheCCBaddress6‰LEA‡CONFIG(A2),A5‡UsetheCONFIGoffsetsowecanuse*¦theIOEequates.BŠMOVE.B‚RTNHWS4+IPCIM2(A4),IOSREC+1(A1)UPDATERECORDLENGTHFIELD?ŠMOVE.B‚RTNHWS4+IPCIM2(A4),IOSREC+1(A5)Updatethecurrentline*±lengthconfigvalue..:ŠMOVE.B‚RTNSWS2+IPCIM2(A4),D3‚PICKUPS/WCONFIGUREBYTE2-‰CLR.W…IOSATW(A5)ŠWipetheoldattributesout!ŠBTST„#XSWALF,D3‹AUTOLINEFEED?ŠBEQ.SƒSTAP025ŽBRANCHIFNOC‰BSETW…#IOALNFD,IOSATW(A5)Yes,settheattributeincurrentconfig0ŠBSETWƒ#IOALNFD,IOSATW(A1)‚YES,SETUPATTRIBUTE‰MOVE.B„RTNSWS3+IPCIM2(A4),IOSELC(A5)Setupend/printcharin*°currentconfigurationarea.*‰MOVEM.Lƒ(A7)+,A5ŒRestoretheCCBaddress.* STAP030ƒEQU…* ŠCLR.LƒD1FŠMOVE.BCCBTYPE(A5),IOSCTP(A1)Returnthechanneltypeanddrivercode<ŠMOVE.B#IODIPC,IOSDRC(A1)ƒintheusersconfigurationblock.ŠBRA…INEXITGOQUEUEEVENT*B*ˆEndofsecondpacketfromMCCM.‚Updatethecurrentconfigvalues* STAP035‚EQU‡*&‰MOVEM.LƒA5,-(A7)ŒSavetheCCBaddress:‰LEA‡CONFIG(A2),A5‡UsetheCONFIGoffsetsowecanusethe*¦IOEequates.‰MOVE.W„IOSREC(A1),IOSREC(A5)‰MOVE.L„IOSRSZ(A1),IOSRSZ(A5)<‰MOVE.B„IOSXOF(A1),IOSXOF(A5)Updatethecurrentconfigarea<‰MOVE.B„IOSXON(A1),IOSXON(A5)Updatethecurrentconfigarea<‰MOVE.B„IOSBRC(A1),IOSBRC(A5)Updatethecurrentconfigarea0‰CLR.B…IOSDOP(A5)ŒUpdatethecurrentconfigarea<‰MOVE.B„IOSRLN(A1),IOSRLN(A5)Updatethecurrentconfigarea<‰MOVE.B„IOSCLC(A1),IOSCLC(A5)Updatethecurrentconfigarea<‰MOVE.L„IOSRTV(A1),IOSRTV(A5)Updatethecurrentconfigarea<‰MOVE.L„IOSEOL(A1),IOSEOL(A5)Updatethecurrentconfigarea<‰MOVE.B„IOSBRT(A1),IOSBRT(A5)Updatethecurrentconfigarea<‰MOVE.B„IOSNLS(A1),IOSNLS(A5)Updatethecurrentconfigarea*G*ˆ3/26/85PJD-THISCODEWASADDEDTOUPDATETHECURRENTCONFIGURATION0*ˆATTRIBUTEWORDDURINGACONFIGURATIONREQUEST.**3‰MOVE.W„IOSATM(A1),D0‡GETTHEUSER'SATTRIBUTEMASK3‰MOVE.W„IOSATW(A1),D1‡GETTHEUSER'SATTRIBUTEWORD5‰AND.W…D0,D1STRIPOFFANYUNEEDEDBITSFROMTHEWORD)‰NOT.W…D0’INVERTTHEMASK->BITSTOSAVE-‰AND.W…IOSATW(A5),D0‡CLEARBITSTOBECHANGED%‰OR.W†D1,D0ORINTHEUSER'SNEWWORD<‰MOVE.W„D0,IOSATW(A5)‡SAVETHEN3 EWATTRIBUTEWORDINCURRENT *§CONFIGAREA*‰MOVEM.Lƒ(A7)+,A5‰BRA.S…STAP030ŠPAGE* STAP040ƒEQU…*0ŠBSR…BLDATRMŽCALLTHEBUILDATTRIBUTESUBROUTINE1ŠMOVE.W‚D1,IOSATW(A1)ˆUPDATEUSERATTRIBUTEFIELD* *‰CONFIGURECOMMAND(2ndPacket)* STAP150ƒEQU…***‰NOWLETSINTERRUPTIPCFOR*‰EVENTCOMPLETION.*1ŠMOVE.LƒCCBCHB(A5),A4‡SETUPSHAREDMEMORYPOINTER.ŠCLR.B„IPCIMB2(A4)‰CLEARTHEMESSAGESENTFLAG5ŠMOVE.Bƒ#ACK,IPCIAB1(A4)„PLACEACKINTOSHAREDMEMORY)ŠMOVE.Bƒ#$80,IPCINT(A4)…INTERRUPTTHEIPC.ŠCLR.W„CCBRCNT(A5)‰JUSTINCASEARESETWORKED**ˆCHECKFORSHAREDMEMORYFREE*-STAP152‚TST.B…IPCIMB1(A4)‰ISTHEMEMORYFREE?$‰BNE.S…STAP152NO,WAITFORITTOBE***‰BUILDSECONDPACKET*/STAP151ƒLEA†IPCIM1(A4),A4‡SETUPMESSAGEADDRESSŠMOVE.Wƒ#SPKT,D1/ŠMOVEP.W‚D1,IPCSTX(A4)‡SETUPSTXANDPACKETID+ŠBSET…#PIDPKTF,IPCPID(A4)SET2ndPACKETID0ŠMOVE.BƒDCBCDV(A0),IPCPHDV(A4)‚SETUPDEVICENO.* *ˆSetuppointertodevicetable* ‰CLR.L…D1+‰MOVE.B„DCBCDV(A0),D1‡Getthedevicenumber)‰MULU†#LUDSZE,D1ŠMulbysizeofonetable2‰MOVE.L„CCBDTBL(A5),A0†Getstartaddressoftables4‰ADD.L…D1,A0Addtogetstartofthisdevice'stable:‰LEA‡CONFIG(A0),A0‡UsetheCONFIGoffsetsowecanuseIOE *¦equates.ŠMOVE.Wƒ#XCON2P,D16ŠMOVEP.W‚D1,IPCCHCM(A4)†SETUPCHANNEL/DEVICECOMMANDS*?*‰UsingtheParameterMaskdeterminewhichparameterscomefrom4*‰theParameterBlockandwhichonesusethedefault*,ŠMOVE.W‚IOSPRM(A1),D0ˆGETMASKOFPARAMETERSŠMOVE.W‚#$5FB3,D10ŠMOVEP.WD1,IPCPMSK(A4)‡PARAMETERMASKTOPACKETŠLSR.Wƒ#2,D0LINESPERPAGEŠBCS.SƒSTAP155YESŠMOVE.LƒIOSRSZ(A0),IOSRSZ(A1) STAP155ƒLSR.Wƒ#3,D0XON/XOFCharŠBCS.SƒSTAP170YES*2*‰MovecurrentconfigXON/XOFchar'sto2ndpacket*ŠMOVE.B‚IOSXOF(A0),IPCXOF(A4)3ŠMOVE.B‚IOSXOF(A0),IOSXOF(A1)ŠUpdatetheusersIOCBŠMOVE.B‚IOSXON(A0),IPCXON(A4)3ŠMOVE.B‚IOSXON(A0),IOSXON(A1)ŠUpdatetheusersIOCBŠBRA.SƒSTAP175*'*‰MovenewXON/XOFchar'sto2ndpacket* STAP170ƒEQU…*ŠMOVE.B‚IOSXOF(A1),IPCXOF(A4)ŠMOVE.B‚IOSXON(A1),IPCXON(A4) STAP175ƒEQU…*!ŠLSR.Wƒ#1,D0BRKequivalentchar.ŠBCS.SƒSTAP180YES*,*‰MovecurrentconfigBRKcharto2ndpacket*ŠMOVE.B‚IOSBRC(A0),IPCBRK(A4)3ŠMOVE.B‚IOSBRC(A0),IOSBRC(A1)ŠUpdatetheusersIOCBŠBRA.SƒSTAP185*!*‰MovenewBRKcharto2ndpacket* STAP180ƒEQU…*ŠMOVE.B‚IOSBRC(A1),IPCBRK(A4) STAP185ƒEQU…*ŠLSR.Wƒ#2,D0REPRINTLINEcharŠBCS.SƒSTAP190YES*5*‰MovecurrentconfigREPRINTLINEcharto2ndpacket*ŠMOVE.B‚IOSRLN(A0),IPCRPRT(A4)/ŠMOVE.B‚IOSRLN(A0),IOSRLN(A1)ŠUpdateusersIOCBŠBRA.SƒSTAP195***‰MovenewREPRINTLINEcharto2ndpacket* STAP190ƒEQU…*ŠMOVE.B‚IOSRLN(A1),IPCRPRT(A4) STAP195ƒEQU…*ŠLSR.Wƒ#1,D0CANCELLINEcharŠBCS.SƒSTAP200YES*4*‰MovecurrentconfigCANCELLINEcharto2ndpacket*ŠMOVE.B‚IOSCLC(A0),IPCCNCL(A4)/ŠMOVE.B‚IOSCLC(A0),IOSCLC(A1)‰UpdateusersIOCBŠBRA.SƒSTAP205*)*‰MovenewCANCELLINE‚charto2ndpacket* STAP200ƒEQU…*ŠMOVE.B‚IOSCLC(A1),IPCCNCL(A4) STAP205ƒEQU…*$ŠLSR.Wƒ#1,D0READTERMINATINGchar'sŠBCS.SƒSTAP210YES*;*‰MovecurrentconfigREADTERMINATINGchar'sto2ndpacket*ŠMOVE.L‚IOSRTV(A0),D1ŠMOVEP.LD1,IPCRTRM(A4)'‰MOVE.L„D1,IOSRTV(A1)‡UpdateusersIOCBŠBRA.SƒSTAP215*0*‰MovenewREADTERMINATINGchar'sto2ndpacket* STAP210ƒEQU…*ŠMOVE.L‚IOSRTV(A1),D1ŠMOVEP.LD1,IPCRTRM(A4) STAP215ƒEQU…*ŠLSR.Wƒ#1,D0EOD-OF-LINEstringŠBCS.SƒSTAP220YES*6*‰MovecurrentconfigEND-OF-LINEstringto2ndpacket*ŠMOVE.W‚IOSEOL(A0),D1ŠMOVEP.WD1,IPCEOL(A4)'‰MOVE.W„D1,IOSEOL(A1)‡UpdateusersIOCBŠBRA.SƒSTAP225*+*‰MovenewEND-OF-LINEstringto2ndpacket* STAP220ƒEQU…*ŠMOVE.W‚IOSEOL(A1),D1ŠMOVEP.WD1,IPCEOL(A4)*** STAP225ƒEQU…*#ŠMOVE.B‚#ETX,IPC2ETX(A4)†SETUPETX.ŠMOVE.B‚#C2PKSZ,IPCPKSZ(A4)ƒSETUPPACKETSIZE**‰INDICATEAWAITINGACK*'ŠBSETWƒ#CCBFGWAK,CCBFG(A5)ƒSETCCBFLAG**‰INTERRUPTTHEIPC* NRXINP„EQU„*0ŠM3 OVE.LCCBCHB(A5),A1†SETUPSHAREDMEM.POINTER(ŠMOVE.B#$80,IPCIMB1(A1)ƒMESSAGEWAITING0ŠADD.B‚#2,CCBICNT(A5)…BUMPOUTSTANDINGINTCOUNT%ŠMOVE.B#$80,IPCINT(A1)„INTERRUPTIPC#ŠCLR.L‚D0‘SETUPGOODRETURNTOCMR ŠBRA„IPCINRTNŠPAGEK*****************************************************************************†REQUESTSTATUSHANDLING**ˆENTRY:A0=addressofDCB!*A1=addressofuserdatablock$*A2=addressofdevicetableentry(*A4=addressofIPCsharedmemorybase*K*************************************************************************** STAP300ƒEQU…*,ŠLEA…DCBDEV(A0),A3ˆADDROFDCBCONFIGURATION0ŠBSR…BLDATRMŽcallthebuildattributesubroutine1ŠMOVE.W‚D1,IOSATW(A1)ˆupdateuserattributefield,‰MOVE.L„DCBATT(A0),D1‡GettheDCBattributes**@*‰MoveconfigurationinfofromCURRENTCONFIGtouserdatablock*8‰LEA‡CONFIG(A2),A3‡UsetheCONFIGoffsetintothedevice%*¦tablesoweanusetheIOEequates.;‰LEA‡DCBDEV(A0),A0‡GettheDCBdevicedependentareaoffset*>ŠMOVE.W‚IOSREC(A3),IOSREC(A1)MoveCurrentvaluestouserIOCB@ŠMOVE.L‚IOSRSZ(A3),IOSRSZ(A1)Exceptthatsomevalues(thosenotAŠMOVE.L‚IOSWTO(A0),IOSWTO(A1)configurableanyway)willcomefrom *§theDCB.4ŠBTST…#DATPRT,D1ŠChecktheDCBattributes-isthisa *¦printer?5ŠBNE.SƒSTAP330ŽYes,skiptheupdateofthetermstuff**ˆTerminalstatusrequest*ŠMOVE.L‚IOSRTO(A0),IOSRTO(A1)ŠMOVE.B‚IOSXOF(A3),IOSXOF(A1)ŠMOVE.B‚IOSXON(A3),IOSXON(A1)ŠMOVE.B‚IOSBRC(A3),IOSBRC(A1)ŠMOVE.B‚IOSDOP(A3),IOSDOP(A1)ŠMOVE.B‚IOSRLN(A3),IOSRLN(A1)ŠMOVE.B‚IOSCLC(A3),IOSCLC(A1)ŠMOVE.L‚IOSRTV(A3),IOSRTV(A1)ŠMOVE.L‚IOSEOL(A3),IOSEOL(A1)ŠMOVE.B‚IOSBRT(A3),IOSBRT(A1)ŠMOVE.B‚IOSNLS(A3),IOSNLS(A1)ŠMOVE.B‚IOSTCD(A0),IOSTCD(A1) STAP320ƒEQU…* ŠCLR.LƒD1 ŠBRA.SƒINEXITN*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FAM 6/04/84 >>>>>>>*%*ˆRemainderofprinterstatusrequest*$STAP330‚MOVE.W„IOSREC(A0),IOSLRL(A1)‰MOVE.B„IOSELC(A0),IOSELC(A1)‰BRA.S…STAP320*ŠPAGEK****************************************************************************,*‰HANDLEMCCMNORMALCOMPLETIONPACKETSHERE*+*‹ENTRY:A2=addressofdevicetableentry*’A3=addressofIOCB(*’A4=addressofIPCsharedmemorybase*’A5=addressofCCB*’D0=packetstatusvalue*K****************************************************************************MCCMPKT:2ŠLEA…MERXREF(PC),A1‡SETUPSTATUSCROSSREF.TABLE*ŠCMP.Wƒ#MERXL,D0ŒERRORCODEINTHETABLE?ŠBLE.SƒMCCMP10ŽBRANCHIFYES)ŠBSR.SƒIPCUNSERNO,IPCERROR-RESETIPCŠBRA.SƒIPCINRTNRETURN)MCCMP10ƒCMP.Wƒ#XPSCSM,D0‹CHECKSUMERROR?ŠBNE.SƒMCCMP20ŽBRANCHIFNOŠCLR.LƒD0“YES,IGNOREERROR1MCCMP20ƒLSL.Wƒ#1,D0TIMES2FORPOSITIONINTABLE,ŠMOVE.B‚(A1,D0.W),D1‰PICKUPIOCBERRORCODE ŠCLR.L…D41ŠBTST„#0,1(A1,D0.W)ˆNEEDTOUPDATELENGTHFIELD?ŠBEQ.SƒMCCMP30ŽBRANCHIFNO5ŠMOVEP.WRTNBKSZ+IPCIM2(A4),D4‚PICKUPTRANSFERBYTES5MCCMP30ƒMOVE.L‚D4,IOSLEN(A3)ˆUPDATEIOCBLENGTHFIELD.ŠMOVE.B‚D1,IOSSTA(A3)ˆUPDATEIOCBSTATUSFIELD*¦FALLTHRUTO"INEXIT"ŠPAGEK****************************************************************************!*‚NORMALEXITFROMINTERRUPTTOUR*+*ˆENTRY:A2=addressofdevicetableentry*A3=addressofIOCB(*A4=addressofIPCsharedmemorybase*A5=addressofCCB*K****************************************************************************INEXIT:&ŠMOVE.L‚#6,D0SETUPEVENTINFOLENGTH)ŠMOVE.L‚LUDCB(A2),D2‰SETUPDCBFOREVENT+ŠMOVE.W‚D1,D3SETUPSTATUSVALUEFOREVENT$ŠMOVE.B‚#XPSNRM,D1‹SETUPEVENTTYPE+ŠLEA…CCBCPKT(A5),A4‡SETUPEVENTBUILDAREA!ŠBSR…QEVNTQUEUECOMPLETIONEVENT)ŠCLR.WƒLUFLG(A2)ŒCLEARDEVICETABLEENTRY*5* DECREMENT I/O PENDING COUNT IF SOLICITED TYPE EVENT*7INEX010ƒMOVE.LCCBCHB(A5),A4†RESTORESHAREDMEMPOINTER.ŠBTSTƒ#7,RTNSTCM+IPCIM2(A4)‚ISTHISSOLICITED?ŠBNE.S‚INEX020ŒBRANCHIFNO ŠMOVE.LLUTCB(A2),A0‡TCBADDRESS2ŠSUB.B‚#1,TCBIOCNT(A0)„DECREMENTI4 /OPENDINGCOUNT**‰NOWLETSINTERRUPTIPCFOR*‰EVENTCOMPLETION.*5INEX020ƒCLR.B‚IPCIMB2(A4)ˆCLEARTHEMESSAGESENTFLAG5ŠMOVE.B#ACK,IPCIAB1(A4)ƒPLACEACKINTOSHAREDMEMORY)ŠMOVE.B#$80,IPCINT(A4)„INTERRUPTTHEIPC.ŠCLR.W‚CCBRCNT(A5)ˆJUSTINCASEARESETWORKED*4*‰IPCINTERRUPTHANDLERALWAYSEXITSFROMTHISPOINT*IPCINRTN‚EQU„**‰ENABL˜ENABLEINTERRUPTS6ŠSUB.L‚#1,CCBINL(A5)‰DECREMENTINTERRUPTNESTINGLEVEL/ŠMOVEM.L(A7)+,D1-D7/A2-A4/A6ƒRESTOREREGISTERS"ŠOR.W„#$01,SRŽSETRETURNCONDITION ŠRTS…0”BACKTOINTERRUPTHANDLERŠPAGEK*****************************************************************************6* ROUTINE TO HANDLE 68000 DETECTED FATAL CHANNEL ERROR'*ƒSAVECALLINGADDRESSINCCBFORDEBUG*ƒMARKTHECHANNELINERROR*ƒQUEUEEVENTTOCALLINGTASK*ƒRETURN*+*ˆENTRY:A2=addressofdevicetableentry*A3=addressofIOCB(*A4=addressofIPCsharedmemorybase*A5=addressofCCB*K**************************************************************************** IPCUNSER:ŠINHIB,ŠMOVE.L(A7),CCBERAD1(A5)‚SAVEERRORADDRESS3ŠOR.Wƒ#(1<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 11/07/84 <<<<<<C*********************************************************************‰BUILDATTRIBUTESMASK*!*‹ENTRY:A1=userbufferpointer(*’A4=addressofIPCsharedmemorybase**‹EXIT:‚D1=attributemask*C******************************************************************* BLDATRMƒEQU…* ŠCLR.LƒD1:ŠMOVE.B‚RTNHWS1+IPCIM2(A4),D2PICKUPH/WCONFIGUREBYTE1ŠBTST„#XHWBIT,D2‹8BIT?ŠBNE.SƒBLDA010ŽBRANCHIFYES&ŠBSET„#IOABITS,D1ŠNO,SETUPATTRIBUTE%BLDA010ƒBTST„#XHWSTP,D2‹2STOPBITS?ŠBEQ.SƒBLDA020ŽBRANCHIFNO'ŠBSET„#IOASTPB,D1ŠYES,SETUPATTRIBUTE!BLDA020ƒBTST„#XHWPRTY,D2ŠPARITY?ŠBEQ.SƒBLDA030ŽBRANCHIFNO'ŠBSET„#IOAUSEP,D1ŠYES,SETUPATTRIBUTEŠBTST„#XHWEVN,D2‹EVENPARITY?ŠBEQ.SƒBLDA030ŽBRANCHIFNO'ŠBSET„#IOAPRTY,D1ŠYES,SETUPATTRIBUTEABLDA030ƒMOVE.B‚RTNHWS2+IPCIM2(A4),D2‚PICKUPH/WCONFIGUREBYTE2ŠBTST„#XHWMDM,D2‹MODEM?ŠBEQ.SƒBLDA040ŽBRANCHIFNO'ŠBSET„#IOAMODM,D1ŠYES,SETUPATTRIBUTE,BLDA040ƒAND.Bƒ#$0F,D2ŽISOLATEBAUDRATEBITS,ŠMOVE.B‚D2,IOSBRT(A1)ˆUPDATEBAUDRATEFIELD6ŠMOVE.B‚RTNHWS3+IPCIM2(A4),IOSNLS(A1)UPDATENULLPADS<ŠMOVE.B‚RTNHWS4+IPCIM2(A4),IOSREC+1(A1)UPDATERECORDLENGTHŠCLR.BƒIOSREC(A1):ŠMOVE.B‚RTNSWS1+IPCIM2(A4),D3‚PICKUPS/WCONFIGUREBYTE1ŠBTST„#XSWHDX,D3‹HALFDUPLEXŠBEQ.SƒBLDA050ŽBRANCHIFNO'ŠBSET„#IOAECHO,D1ŠYES,SETUPATTRIBUTE BLDA050ƒEQU…*ŠBTST„#XSWNUL,D3‹ACCEPTNULLSŠBEQ.SƒBLDA060ŽBRANCHIFNO'ŠBSET„#IOAPNUL,D1ŠYES,SETUPATTRIBUTE BLDA060ƒEQU…*#ŠBTST„#XSWTAHD,D3ŠACCEPTTYPEAHEADŠBEQ.SƒBLDA070ŽBRANCHIFNO'ŠBSET„#IOATAHD,D1ŠYES,SETUPATTRIBUTE BLDA070ƒEQU…* ŠBTST„#XSWXON,D3‹ACCEPTXON/XOFFŠBEQ.SƒBLDA080ŽBRANCHIFNO'ŠBSET„#IOAXCTL,D1ŠYES,SETUPATTRIBUTE BLDA080ƒEQU…*ŠRTSN*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FAM 11/07/84 <<<<<<ŠPAGEJ**************************************************************************** QEVNT**„PLACEMSGONUSER'SASQ* *ˆA4=COMPLETIONPACKETPOINTER*ˆA5=CCBADDRESS'*ˆD0=PACKETLENGTH(MINUSHEADERINFO)*ˆD1=EVENTTYPE*ˆD2=ID(4BYTES)*ˆD3=STATUSVALUE(2BYTES) *‡[D4=DEVICESTATUS(2BYTES)]*‡[D5=DEVICENUMBER(1BYTE)4 ]*J***************************************************************************QEVNT:ŠMOVE.LD0,D6ŽSAVELENGTH-ŠMOVE.L#2,D7ŽOFFSETFORSTAGING(NOSVCVCT)'ŠMOVE.B#IOEVCD,1(A4)†CODE(NOSVCVCT)(ŠMOVE.LCCBSVVC(A5),2(A4)‚SERVICEVECTOR*ŠBEQ.S‚QEVNT10ŒBRANCHIFNOSERVICEVECTOR'ŠADD.L‚#4,D0ŽCORRECTLENGTHFORSVCVCT/ŠADD.L‚#4,D7ŽCORRECTOFFSETSTAGINGFORSVCVCT*ŠADD.L‚#$00800000,(A4)„CORRECTFORSVCVCT QEVNT10ƒEQU„*$ŠMOVE.BD1,0(A4,D7)ˆCMPL.EVENTTYPE)ŠMOVE.BCCBKEY(A5),1(A4,D7)USER'SIDKEY*ŠADD.L‚#4,D0ŽCOMPLETELENGTHOFRETURNMSG1ŠCMP.B‚CCBASQL(A5),D0…USER'SMAXASQENTRYLENGTH"ŠBLS.S‚QEVNT20ŒBRANCHIFLENGTHOK/ŠMOVE.BCCBASQL(A5),D0…USER'SLENGTHISSMALLER QEVNT20ƒEQU„*ŠMOVE.BD0,(A4)ŒCORRRECTLENGTH QEVNT40ƒEQU„*ŠMOVE.LD2,2(A4,D7)ˆSETUPID'ŠMOVE.WD3,6(A4,D7)ˆSETUPSTATUSVALUEŠCMP.B‚#6,D6Ž6BYTEINFO?ŠBEQ.S‚QEVNT50ŒBRANCHIFYES(ŠMOVE.WD4,8(A4,D7)ˆSETUPDEVICESTATUSŠCMP.B‚#8,D6Ž8BYTEINFO?ŠBEQ.S‚QEVNT50ŒBRANCHIFYES)ŠMOVE.BD5,10(A4,D7)‡SETUPDEVICENUMBER%ŠCLR.B‚11(A4,D7)ŠCLEARRESERVEDFIELD*@* NOW LET'S PUT THE COMPLETION INTO REGISTERS, INTERRUPT IOH FOR&*ƒEVENTCOMPLETION,SENDEVENTTOTASK** QEVNT50ƒEQU„*ŠMOVEM.L(A4),D2-D7ŠBSR.S‚IPCQEVNTŠRTSŠPAGEK*****************************************************************************9* ROUTINE TO QUEUE EVENT (ALREADY STAGED IN REGISTERS) TO*ƒ-DRIVINGTASK. *ƒ-EVENTBEGINSINREGISTERD2.***ˆEXECROUTINE/*ˆREGISTERSUSED:D0-D1/A0,A3-A6‚WORKREGISTERS*˜D2-D7‹STAGINGREGISTERS**K**************************************************************************** IPCQEVNT:#ŠMOVEM.LA3-A5,-(A7)‡SAVEREGISTERS)ŠMOVE.LCCBRQSTA(A5),A0„CALLER'STCBADDRŠSPC„2<ŠMOVE.L#T0QEVNTI,D0‡WHENONEORMOREINTERRUPTSAREPENDING:ŠTST.B‚CCBINL(A5)‰USETHEQEVNTIENTRYPOINT.ELSEUSETHE ŠBNE.S‚IOHQ4ŽQUEVNTTENTRYPOINTŠMOVE.L#T0QEVNTT,D0 IOHQ4…TRAPƒ#0ŠSPC„2"ŠBRA.S‚IOHQ5ŽBRANCHIFQUEUEINGOK&ŠMOVEM.L(A7)+,A3-A5‡RESTOREREGISTERS7ŠMOVE.L(A7),CCBQVER1(A5)‚SAVECALLERSADDRESSFORDBUGŠBRA.S‚IOHQRTN IOHQ5…EQU„*&ŠMOVEM.L(A7)+,A3-A5‡RESTOREREGISTERS)ŠCLR.L‚CCBQVER1(A5)‡CLEARQERRORADDRESS IOHQRTNƒEQU„*ŠRTS‰PAGE***"* DISK ERROR CROSS-REFERENCE TABLE**ˆSTRUCTURE:-POSITION*“-IOCBERRORCODE*“-UPDATEFLAG*%*ˆUPDATEFLAG:‚BIT0-LENGTHOFXFER*–BIT1-PSNPROVIDED**DERXREF‚DC.B„0,1‘(0)NOERROR"‰DC.B„ISTACRC,2‹(1)DATACRCERROR)‰DC.B„ISTAWP,0Œ(2)DEVICEWRITEPROTECTED#‰DC.B„ISTANR,0Œ(3)DEVICENOTREADY*‰DC.B„ISTADDM,2‹(4)READDELETEDDATAMARK'‰DC.B„ISTAIE,0Œ(5)LOGICALUNTT#ERROR'‰DC.B„ISTAIE,0Œ(6)INVALIDDISKADDRESS!‰DC.B„ISTARES,0‹(7)RESTOREERROR$‰DC.B„ISTADME,2‹(8)RECORDNOTFOUND&‰DC.B„ISTAMRK,2‹(9)ADDRESSMARKERROR&‰DC.B„ISTADMA,0‹($A)DMACHANNELERROR#‰DC.B„ISTACSM,0‹($B)CHECKSUMERROR‰DC.B„ISTADB,0Œ($C)DEVICEBUSY!‰DC.B„ISTACHN,0‹($D)CHANNELBUSY!‰DC.B„ISTAIE,0Œ($E)INDETERMINATE%‰DC.B„ISTACNT,0‹($F)CONTROLLERERROR"‰DC.B„ISTAUNR,0‹($10)DEVICEERROR ‰DC.B„ISTASEK,0‹($11)SEEKERROR‰DC.B„ISTANR,0Œ($12)NODEVICE-‰DC.B„ISTACFG,0‹($13)DEVICECONNECTCONFLICT$‰DC.B„ISTACMP,2‹($14)DCOMPAREERROR,‰DC.B„ISTASPE,2‹($15)SECTORWRITEPROTECTED!‰DC.B„ISTABDS,2‹($16)BBADSECTOR‰DC.B„ISTATO,0Œ($17)TIMEOUT$‰DC.B„ISTAIE,0Œ($18)INVALIDCOMMAND#‰DC.B„ISTABUS,0‹($19)DMABUSERROR'‰DC.B„ISTAMAP,0‹($1A)DMAMAPPINGERROR*‰DC.B„ISTADMC,0‹($1B)DMACONTROLLERERROR)DERXL„EQU…(*-DERXREF)/2-1…MAXERRORVALUE‰PAGE***"* MCCM ERROR CROSS-REFERENCE TABLE**ˆSTRUCTURE:-POSITION*“-IOCBERRORCODE*“-UPDATEFLAG*%*ˆUPDATEFLAG:‚BIT0-LENGTHOFXFER**MERXREF‚DC.B„0,1‘(0)NOERROR ‰DC.B„ISTACSM,1‹(1)PARITYERROR‰DC.B„ISTABRK,1‹(2)BREAK#‰DC.B„ISTANR,0Œ(3)DEVICENOTREADY"‰DC.B„ISTACSM,1‹(4)FRAMMINGERROR'‰DC.B„ISTAIE,0Œ(5)LOGICALUNTT#ERROR"‰DC.B„ISTADO,1Œ(6)RECIEVEOVERRUN'‰DC.B„ISTANR,1Œ(7)PRINTEROUTOFPAPER‰DC.B„ISTAIE,0Œ(8)U5 NUSED‰DC.B„ISTAIE,0Œ(9)UNUSED&‰DC.B„ISTADMA,1‹($A)DMACHANNELERROR‰DC.B„ISTACSM,0‹($B)UNUSED‰DC.B„ISTAIE,0Œ($C)DEVICEBUSY‰DC.B„ISTAIE,0Œ($D)UNUSED!‰DC.B„ISTAIE,0Œ($E)INDETERMINATE)MERXL„EQU…(*-MERXREF)/2-1…MAXERRORVALUE ‰END(M300DRV‚IDNT45,0…MVME-300(GPIB)driver$‰TTL‚M300DRV:MVME-300(GPIB)driverD*********************************************************************&*’GENERALPURPOSEINTERFACEBUSDRIVER*D********************************************************************'*…5/31/84†BWNŽFivebugsfoundandfixed(*£1)TypoerrorincodeatSP_TO.Caused'*¦systemtocrashwhileserialpolling.&*¦ChangeinstructionMOVEMA3-A3,-(A7)*¦toMOVEM.LA3-A5,-(A7).(*£2)IOSPBandDCBpointersnotsetupat *¦PROCM100afterSerialPolling.(*¦Movedinstructionscontainingpointers*¦uptwoinstructions.(*£3)ThefifthinstructionofHLTCMDwas'*¦changedtoreadLEA.LGPIBQEND(A5),A0(*£4)Problem:crashingGPIBdriverwhile!*¦waitingforaDMAreadtostart(*¦Diagnosis:AnSRQinterruptwasoccur-(*¦ingwhiletheMVME300wasinDMAmode.'*¦TheTMS9914Ainterruptregsweretri-&*¦statedatthispointandthuscannot *¦beread.'*¦Solution:TodisableTMS9914aintrpts%*¦priortoanyDMAandre-enablewhen%*¦DMAwascomplete.‚Alsotore-enable"*¦ifHaltIOorBusErroroccurred.*)*£5)FixedlengthbuffertransfersofDMA&*¦readwerenotbeingproperlysetup.&*¦TheIOSbufferlengthwasbeingused&*¦insteadofthesysgenedfixedbuffer!*¦length.Alabelandbranchwere*¦modifiedinREADDATA.*#*ˆ5/31/84ƒBWNŽVME/10problemfixed:'*¦ThedriverdidnotworkonthwVME/10&*¦becausetheoff-boardRAMisseenat"*¦differentaddressesbythe68010*¦andtheGPIBdevice.&*¦Twomacroswerecreatedtocorrectly*¦translateaddresses.)*¦NearlabelINTR115plus7instructions:**¦MOVE.B‚MARLSB(A1),D0*¦MOVE.L‚MENUCPOS(A5),A0* *¦changedto:**¦MOVE.B‚MARLSB(A1),D0*¦GET_ON_BD‚D0*¦MOVE.L‚MENUCPOS(A5),A0*)*¦Nearlabel‚SETUPDMAplus5instructions**¦MOVE.L„A0,D0*¦MOVE.B„D0,MARLSB(A1)* *¦changedto:**¦MOVE.L„A0,D0*¦GO_OFF_BD‚D0*¦MOVE.B„D0,MARLSB(A1)*(*œTheGET_ON_BDandGO_OFF_BDƒmacrosare*œdefinedin9995..DUALPORT.MC.™D¢Aª'-*œThesemacrosrequiresubstitutionsbasedon*œthetargetsystem.2*œThisisdoneatSYSgentime,withequatesinthe**œSYSCMD.CDfileandDEFstatementsinthe*œM300DRV.LGfile.*9*ˆ10/16/84ŒSerialPollprocessingaltered.‚Duetodevices1*œthathavethecapabilitytotoggletheSRQline**œSRQ'swerebeingmissedifthefollowing1*œcircumstanceoccurred.AdevicetoggledtheSRQ/*œline,westartedtopoll,anotherdevice(one0*œalreadypolled)generatedTRUESRQ,wereached0*œendofSRQpollinglist(oncearoundtheBUS)..*œToremedythisproblem,codewasinsertedat/*œPROCMSRQto'loop'theBUStwicetocatchany *œTRUESRQ's.*8*ˆ10/16/84ŒRemovependingSRQ'satpower-on/bootuptime.*<*ˆ09/17/85ŒCorrectprobleminparallelpollmode,PPISstate*œinmoduleM300INTR.AI.2*ˆ10/28/85ŒCorrectproblemwithHALTI/Oinmodule*œM300CMND.AIandM300INTR.AI*7*ˆ12/12/85ŒInstallNEWKillermodificationwhichleaves,*œTheDriverID(Number)andReason(Number)2*œinCRASHSAValongwiththeCCBandDCBpointers.* SECTION 0 OPT BRL M300DRV:>DC.LINTRGPIB-M300DRV‡selfrelativeinterruptserviceaddress*ƒwasreserved.Soonlytheupperbyteissignificant,andthe*ƒnextbytewillbe0.*5DC.B0,0…next14bytesreservedforlaterusebyCMR DC.L 0,0,0*5DC.B'121285'‚dateoflastassemblyinMMDDYYformat*DC.B''ƒreservedforpatches*4DC.B'4'‚minimummajorVERSAdosrevisionlevelthat*¦driveriscompatiblewith.**‚INCLUDEFILES(FORNOW)ARE:**ˆNOLIST*ˆ9995.&.STR.SA*ˆ9995.&.CCB.EQ*ˆ9995.&.TCB.EQ*ˆ9995.&.LV5.EQ*ˆ9995.&.IOE.EQ*ˆ9995.&.NIO.EQ*ˆ9995.&.KILL.MC*ˆ9995.&.KILLDRV.EQ*ˆ9995.&.DUALPORT.MC*ˆLIST*ˆ9995.&.M300DRV.EQ *ˆM300TABL.AI *ˆM300INIT.AI *ˆM300INTR.AI *ˆM300CMND.AI* NOLISTINCLUDEˆ9995.&.STR.EQINCLUDEˆ9995.&.CCB.EQINCLUDEˆ9995.&.TCB.EQINCLUDEˆ9995.&.DUALPORT.MCINCLUDEˆ9995.&.KILL.MCINCLUDEˆ9995.&.KILLDRV.EQ LIST TTL GPIB DRIVER - (LV5)INCLUDEˆ9995.&.LV5.EQ LIST TTL GPIB DRIVER - (IOE)INCLUDEˆ9995.&.IOE.EQ LIST TTL GPIB DRIVER - (NIO)INCLUDEˆ9995.&.NIO.EQ LISTINCLUDEˆ9995.&.M300DRV.EQINCLUDEˆM300TABL.AIINCLUDEˆM300INIT.AIINCLUDEˆM300INTR.AIINCLUDEˆM300CMND.AI**‚GPIBPATCHAREA* DS.B 256 END NNNNN6M319DRVƒIDNTƒ45,0†VERSAdosM319DiskDriver-12/13/852ŠTTL„M319DRV:‚VERSAdosM319DiskDriver-12/13/85J***************************************************************************,* IPC -- REV. 1.05 02JUN80 (TB59) STEVE BALL8*IPC‰2.0002NOV81(TL09)JIMSMITH-SPLITIPCFROMCMR2*IPC‰2.0101FEB82(TL09)JIMSMITH-VECTORCHAIN.*IPC‰2.0223FEB82(TL09)JIMSMITH-IOCBUSE7*IPC‰4.0001SEP82ˆMARCBRIEL-CONFIGURECLASSREQUESTS7*M315DRV…5.0019MAY83ˆRONIWOOD-CHANGEDFORM315IPC>*M315DRV…5.017JULY83ˆMARCOSCHMIDT-PATCHESTO5.00CHANGES*¡DISKCONTROLLERBOARD. *¡USEDIPCDRVASABASE.‚DELETED*¡ALLREFERENCETOMCCMSTUFF.*¡ALLOTHERCHANGESAREMARKED.?*M315DRV…5.0106DEC83ˆJULIEHOBAN-CHANGESMARKEDBY11/17/83=*M315DRV…5.0124JAN84ˆJULIEHOBAN-BUGFIXESEFFECTINGINIT*¯CHANGESMARKEDBY01/24/848*M315DRV…5.0127JAN84ˆJUTTAKINDERMANN-CHANGESTOTHE*´PARAMETERDEF.PARTAND*´THECONFIGUREDISKPART*´ALLCHANGESAREMARKEDBY*¸'01/27/84'.>*M315DRV…5.1023MAR84ˆFRANZMARSCHNER‚-CHANGETOTHECOMMAND*´SERVICEPARTTOENABLE*´USEINTHEVME/10SYSTEM*´ADDEDTWOXREF'STO*´SATISFYVME/10HARDWARE*´DEPENDENCIES*´ALLCHANGESAREMARKEDBY*¸'03/28/84'.<*M315DRV…5.2009MAY84ˆJULIEHOBAN†-FIXTOCONFIGURELENGTH*´TABLE:CHANGESMARKEDBY*¸'05/09/84'.:*M315DRV…5.3027AUG84ˆJULIEHOBAN†-MODIFIEDTOUSEMACRO*´DUALPORT.MCTOACCESS*´OFFBOARDRAMADDRESSES.8*M315DRV…5.3117OCT84ˆDICKVANDERLINƒ-CONFIGBLKOFFSET6 *´DEFINATION(SYMBUGPROBLEM)<*M315DRV…5.3226NOV84ˆJULIEHOBAN†-CONFIGURATIONCHECK$47*´ADDED-SAMEASVME320.O*********************************************************************************!*M319DRV…2.00ƒMAY85ˆALOISFERTL*B*M319DRV…2.10ƒDEC85‚InstallNEWKillermodificationwhichleaves,*œTheDriverID(Number)andReason(Number)2*œinCRASHSAValongwiththeCCBandDCBpointers.**™ChangedforIDTCVME319**‰ListofChanges*«²6»$Ã\Ë0Ó1Û:ãLë5ó1û:C CBA#5+J38;5C0K5S [,cBk4s-{3ƒ4‹6“5›H?*‰-Thedriverusesthesimplecommandchannelprotocolwithout*‹ACK/NAKhandling.@*‰-Byte#3inconfigurationstatusblockindicatingthedriver@*‹codeisredefinedtoindicatethetypeofharddiskcontroller=*‹(XEBECorADAPTEC)connectedtotheIDTC.Thisbyteisalso<*‹usedtoindicateaFloppyTapedevice.Thecontrollercode8*‹isusedinconfigurationrequeststotheVME319board.A*‰-Steppingrateswereimplementedforharddiskstosupportthe?*‹'bufferedstep'featureofXEBECS1410AandADAPTECACB4000.A*‰-Thedriverisinterruptdriven(waitloopofM315DRVremoved)=*‰-Thereisnocommandqueuingused.Ifthechannelisbusy,9*‹controlispassedbacktocallingprogramwithastatus*‹indicating'Channelbusy'.?*‰-Theupdatingofconfigurationparametersisnowdoneonthe<*‹InterruptSideoftheDriver.Thissavestheconfiguration9*‹tablesincasetheVME319firmwareisnotacceptingthe>*‹proposedconfiguration.(Problenofmountingaforeigndisk)<*‰-ThedriveracxepsfourharddisksconnectedtooneIDTC.;*‹ThedisksweredecodetfromthedevicenumberwithinDCB.3*‹Device#0and1:„Drive0and1oncontroller#03*‹Device#2and3:„Drive0and1oncontroller#17*‰-ThedriversupportsaCipher525FloppyTapedrive.D*‰-Sector#3ofthefirstsegmentonthisTapecontainsinformation@*‹storedbyMVME319firmware.Thissectormustneverbewritten.A*‹Toensurethis,anoffsetisaddedtoeachRandomRecordNumberA*‹providedbyVERSAdos.The‚numberofsectorspersegmentisused *‹offset.B*‰-IfaCONFIGURATION/STATUSRequestfortheFloppyTapeoccures,A*‹areadofsector#3isissuedtotheMVME319.Readingsector#3=*‹initializestheMediaDefectTableofthefirmware.Italso7*‹providesthenumberofsectorsavailableonthetape.*!*M319DRV‚2.1‚14NOV85‚ALOISFERTL'*-Maximumdevicenumberreducedto8.,*-TestforwritewithCRCcheckcorrected.6*-Updateflagfor'recordnotfound'errorcorrected!*’toreturnPSNofdefectsector.'*£allchangesmarkedby'11/14/85AF'***=*†******‚ManypartsoftheM315DRVwereusedwithoutchanges.<*ŽAlsothecommentsrelatedtothissectionsisnotchanged.*;*‰NOTE-----Manycommentsinthisdriverrefertothetime0*”'currently'.‚ThisreferstothetimeframeMay.*”andJune1983.‚Italsoreferstothisdriver3*”onlyinassociationwiththeM315diskcontroller6*”boardandallchanges/additionsforthatboardonly.*.* USER REQUEST SIDE FOR IPC COMMAND PROCESSING*9*ƒPURPOSE:‚VALIDATEANDPASSIPCCOMMANDINFORMATIONFROM#*USERTOIPC,68000SHAREDMEMORY.**ƒENTRY:‚JSRFROMCMRHANDLER*‹JSRFROMINTERRUPTHANDLER*5*ƒEXIT:‚RTS-PARAMETERBLOCKVALIDATIONSTATUSIND0**ƒEXECROUTINESCALLED:‚QEVENTT**ƒCODEISRE-ENTRANT*H*-----------------------------------------------------------------------**ŠPAGE *‚IncludedMacrofile**ˆ9995.&.DUALPORT.MC**‚Includedequatefiles:*ˆ9995.&.TRACE.EQ*ˆ9995.&.STR.EQ*ˆ9995.&.TCB.EQ*ˆ9995.&.CCB.EQ*ˆ9995.&.IOE.EQ*ˆ9995.&.NIO.EQ*ˆ9995.&.LV5.EQ*ˆ9995.&.KILL.MC*ˆ9995.&.KILLDRV.EQ*ŠINCLUDE9995.&.DUALPORT.MCŠNOLIST ŠTTLTRACE.SAŠINCLUDE9995.&.TRACE.EQŠNOLISTŠTTL…96 995.&.STR.EQŠINCLUDE9995.&.STR.EQŠNOLISTŠTTL…9995.&.TCB.EQŠINCLUDE9995.&.TCB.EQŠNOLISTŠTTL…9995.&.CCB.EQŠINCLUDE9995.&.CCB.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.&.KILL.MCŠINCLUDE9995.&.KILL.MCŠNOLISTŠTTL…9995.&.KILLDRV.EQŠINCLUDE9995.&.KILLDRV.EQŠLISTŠPAGE5ŠTTL„VERSADOSM319DISKDRIVERVERSION2.1-12/13/85* ŠSECTION0**$*…EQUATESFORTESTINGVECTORNUMBERS*#AVECTLOƒEQU„25‘LOWESTAUTOVECTOR#$AVECTHIƒEQU„31‘HIGHESTAUTOVECTOR##UVECTLOƒEQU„64‘LOWESTUSERVECTOR# IPCORG„EQU„*ŠPAGE*6* IPC COMMAND PACKET FORMAT (AS SEEN IN SHARED MEMORY)*4*ˆNOTE:‚TheIPCdriverneverusedthepacketIDbyte0*foranything-thevaluewasalwayszero.‚This0*drivercurrentlydoesthesamething-however3*thepacketIDnowistheaddressmodifierforthe.*read/writebufferaddresses.‚Ifthevalueis2*zerotheMVME319firmwareusesadefaultaddress2*modifier-regularglobalmemory.‚Otherwise,the2*valueinpacketIDisusedbytheMVME319asthe1*addressmodifiertouse.‚Thisisset-upforthe4*futurewhenseveralprocessorboardsareusingone0*MVME319diskcontrollerboard.‚Thissuppliesa0*wayforthediskcontrollertousethecorrect*memorylocations. ŠOFFSET0IPCSTX„DS.Bƒ1*2STARTOFTEXTIPCPID„DS.Bƒ1*2PACKETIDIPCPKSZƒDS.Bƒ1*2PACKETSIZE IPCPHDVƒDS.Bƒ1*2PHYSICALDEVICE%IPCCHCMƒDS.Bƒ1*2CHANNELCOMMANDTYPEIPCDVCMƒDS.Bƒ1*2DEVICECOMMAND$IPCNBKSƒDS.Bƒ2*2#BLOCKSTOTRANSFERIPCBKSZƒDS.Bƒ2*2BLOCKSIZE*IPCBUFAD‚DS.Bƒ4*268000ADDRESS(PHYSICAL)IPCCKSMƒDS.Bƒ2*2CHECKSUM$IPCCMPRM‚DS.Bƒ4*2COMMANDPARAMETERSIPCETX„DS.Bƒ1*2ETXLOCATION*9*ˆUIPCCONFIGURATIONPACKET-BOARDLEVEL-COMMAND$5000*2*ˆThisisanewpacketsetupfortheMVME310UIPC4*ˆconcept.‚Itpassesbasicinformationtotheboard.4*ˆThecurrentimpemetationinthisdriveristopass4*ˆtheinterruptvectornumbertothediskcontroller3*ˆboard.‚Ifthispacketisnotsent,theboarduses4*ˆadefaultvalueofvectornumber64.Onlyonebyte5*ˆcurrentlycontainsavalue,therestarezeroedout6*ˆandreservedforfutureuse.‚Thecommandcodeis$505*ˆandcurrentlyimplementedfunctioncodeis00-for1*ˆUIPCconfigurationandcontrol.‚Thiscommandis3*ˆcompletelyunrelatedtotheconfigurecommandthe0*ˆdriverreceivesfromVERSAdos.‚Thiscommandis7*ˆsentbythedrivertotheboardintheinitialization7*ˆportion.‚Interruptsareinhibitedduringexecutionof5*ˆthiscommand.‚Theinitializerpollstilthecommand8*ˆiscomplete.Ifthecommandfails,theboardismarked*ˆdownintheCCB.*‰OFFSETIPCNBKSIPCVECT‚DS.Bƒ1*2vectornumber;IPCATTR‚DS.Bƒ1*2attributebytesimpleorextendedprotocol)IPCRESV1DS.Bƒ4*2reservedforfutureuse)IPCRESV2DS.Bƒ4*2reservedforfutureuse)IPCRESV3DS.Bƒ4*2reservedforfutureuse)IPCRESV4DS.Bƒ4*2reservedforfutureuse)IPCRESV5DS.Bƒ4*2reservedforfutureuseIPCVETX‚DS.Bƒ1*2ETXlocation*<*‰UIPCDrive/Mediaconfigurationpacket-commandcode$4008*9*‰Thiscommandisusedtotelltheboardhowthefloppies<*‰andharddisksareconfigured.‚Itissentonbehalfofthe6*‰driverreceivingeitheraconfigurationcommandora?*‰defaultconfigurationcommandfromVERSAdos.‚Thisisnormally:*‰doneduringboottimebyIOI,onceforeachdrive.‚Mount;*‰andInitalsoissuethesecommands.‚Ifthesecommandsare:*‰notsenttotheboardtheboardassumesseveraldefaults<*‰dependingonthedisksize.‚TheM319diskcontrollerknows?*‰ifthefloppyissingleordoubletrackdensitybythenumber*‰ofsectorspertrack.*+*‰Thedefaultsassumedfor8"floppiesare:B*‰MOTOROLAformat,doublesided,singledensity,128bytesectors,=*‰77cylinders,nointerleaving,nospiraloffset,26sectors *‰pertrack./*‰Thedefaultsassumedfor51/4"floppiesare:D*‰IBMformat,doublesided,doubled7 ensity,96TPI,256bytesectors,=*‰80cylinders,nointerleaving,nospiraloffset,16sectors *‰pertrack.*B*‰Thephysicaldevicenumbersforfloppiesare04,05,06,and07.**‰FLOPPYDISKCONFIGUREPACKET*ŠOFFSETIPCNBKS$IPCFATR0‚DS.Bƒ1*2attributesbyte#0*(*‰bitdefinitionsofattributesbyte#0:*G*‚bit0=0=ifacompensationvalueisspecifieditiswritepre-comp?*Š1=ifacompensationvalueisspecifieditisreadpost-comp=*‚bit1=0=compensationvalueisspecified‚(byte$Fvalue))*Š1=compensationvalueisnotspecified*‚bit2=0=51/4"diskette=*Š1=8"diskette‚(if26or52sectors/trackdisketteis8")*‚bit3=notdefined#*‚bit4=0=singlesideddiskette*Š1=doublesideddiskette**‚bit5=0=singledensity(FMencoding)#*Š1=doubledensity(MFMencoding)*‚bit6=0=nospiraloffset*Š1=spiraloffset*‚bit7=0=IBMformatting*Š1=MOTOROLAformatting$IPCFATR1‚DS.Bƒ1*2attributesbyte#1(*‰bitdefinitionsofattributesbyte#1:B*‚bits0,1,2=steppingrate.IfzerotheM319uses6milliseconds-*for8"and6millisecondsfor51/4"disks.* *ž8"‘51/4"*!*=001‡3millisecs.‰6millisecs."*=010‡6millisecs.ˆ12millisecs.#*=011†10millisecs.ˆ20millisecs.#*=100†15millisecs.ˆ30millisecs.*"IPCFSPTƒDS.Bƒ1*2sectorspertrack6IPCFSIDƒDS.Bƒ1*2#ofsides-either01or02isvalid5IPCFSLGƒDS.Bƒ2*2sectorlengthinbytes-either128,"*§256,512or1024.‚Currentlyonly'*§128and256arebeingused.‚Theboard)*§doesdoublereadsforsectorlength128IPCFNC„DS.Bƒ2*2#ofcylinders8IPCFPCNƒDS.Bƒ2*21stcylinderwithcompensationƒ01/27/84#IPCFNU„DS.Bƒ4*2notused-reserved!IPCFIF„DS.Bƒ1*2interleavefactor$IPCFNU1ƒDS.Bƒ1*2notused-reserved$IPCFNU2ƒDS.Bƒ2*2notused-reserved$IPCFNU3ƒDS.Bƒ4*2notused-reservedIPCHFETX‚DS.Bƒ1*2ETXlocation***‚FloppyTapeconfigurePacket*ŠOFFSETIPCNBKSIPCTNU1ƒDS.Bƒ1*2notused'IPCTTYPƒDS.Bƒ1*2Devicetype$80=Tape7IPCTNSEC‚DS.Bƒ1*2NumberofsectorspersegmentonTapeIPCTNU2ƒDS.Bƒ1*2notused-IPCTSSZƒDS.Bƒ2*2physicalsectorsizeontapeIPCTNU3ƒDS.Bƒ4*2notusedIPCTNU4ƒDS.Bƒ4*2notused%IPCTSKIP‚DS.Bƒ1*2skipfactorontapeIPCTNU5ƒDS.Bƒ4*2notusedIPCTNU6ƒDS.Bƒ2*2notusedIPCTNU7ƒDS.Bƒ1*2notusedIPCTETXƒDS.Bƒ1*2ETXlocation**9*‰Thelayoutandassociatedvaluesaredifferentforhard:*‰disksfromthefloppydisks.‚Ifthiscommandisnotsent;*‰tothecontrollerorifthevaluesinthepacketarezero"*‰thefollowingdefaultsareused:@*‰4heads,256bytesectors,256cylinders,128pre-compensationA*‰value,128reducedwritecurrent,and7bitsofECCdataburst.7*‰Thisactuallydefinesan8"10megabyte(unformatted)*‰Winchesterdisk.*D*‰Thephysicaldevicenumbersforharddisksare00,01,02,and03.**‰HARDDISKCONFIGUREPACKET*ŠOFFSETIPCFSPT,IPCHSPTƒDS.Bƒ1*2#ofsectors/track…01/27/84IPCHNOHƒDS.Bƒ1*2#ofheads'IPCHSLGƒDS.Bƒ2*2sectorlengthinbytesIPCHNC„DS.Bƒ2*2#ofcylinders1IPCHPC„DS.Bƒ2*2writepre-compensationcylinder#2IPCHRWCƒDS.Bƒ2*2reducedwritecurrentcylinder#.&IPCHECCƒDS.Bƒ1*2ECCdataburstlengthIPCHNU„DS.Bƒ1*2notused!IPCHIF„DS.Bƒ1*2interleavefactorIPCHNU1ƒDS.Bƒ1*2notusedIPCHNU2ƒDS.Bƒ2*2notused2IPCHATRƒDS.Bƒ1*2attributesbyteforsteppingrateIPCHNU3ƒDS.Bƒ1*2notused!IPCHCTYP‚DS.Bƒ1*2controllertypeIPCHNU4ƒDS.Bƒ1*2notused#*§Theremainingfieldsarethesame!*§asthefloppyconfigurepacket.** FORMAT TRACK PACKETŠOFFSETIPCBUFAD'IPCFPSNƒDS.Bƒ4*2PHYSICALSECTORNUMBERIPCFETXƒDS.Bƒ1*2ETXLOCATION** FORMAT DISK PACKETŠOFFSETIPCNBKSIPCDETXƒDS.Bƒ1*2ETXLOCATION** REQUEST STATUS PACKETŠOFFSETIPCNBKSIPCRETXƒDS.Bƒ1*2ETXLOCATION* * IPC RETURN (COMPLETION) PACKET* ŠOFFSET0RTNSTX„DS.Bƒ1*2STARTOFTEXTRTNPID„DS.Bƒ1*2PACKETI.D.RTNPKSZƒDS.Bƒ1*2PACKETSIZE RTNPHDVƒDS.Bƒ1*2PHYSICALDEVICE RTNCHCMƒDS.Bƒ1*2CHANNELCOMMANDRTNSTCMƒ7 DS.Bƒ1*2STATUSCOMMANDRTNSTVLƒDS.Bƒ2*2STATUSVALUERTNSTPRƒEQU„*’STATUSPARAMETERS** IPC NORMAL COMPLETION EVENT*ŠOFFSETRTNSTPRRTNBLKSƒDS.Bƒ2*2NO.OFBLOCKSRTNBKSZƒDS.Bƒ2*2BLOCKSIZE#RTNDADRƒDS.Bƒ4*268KMEMORYADDRESS** DISK ERROR COMPLETION EVENT*ŠOFFSETRTNSTPR%RTNSECNƒDS.Bƒ4*2ENDINGSECTORNUMBER** DISK STATUS RETURN*ŠOFFSETRTNSTPRRTNDSTAƒDS.Bƒ2*2DEVICESTATUS RTNLSECƒDS.Bƒ4*2LOGICALSECTORS*‰OFFSETRTNSTPRRTNSTAD‚DS.B…4*2’DEVICESTATUS** IPC MEM MAPPED EQUATES*;*‚TheMVME319doesnothaveanIPCinterruptbyte,nordoes;*‚ithavearesetinterruptbyte.Everybytewrittentothe=*‚commandchannelinterruptstheboard.‚Allreferencestothe=*‚softwareinterruptaredeletedinthedriver.‚Ifthedriver>*‚determinesaneedforareset,theboardismarkedinerror.=*‚Thedriverusedtotrytoissuearesetifitfoundafatal@*‚error-suchasthecommandpacketfromtheIPCwasclobbered.*'IPCIMB1ƒEQU„$10168000TOIPCWRITEBOX%IPCIAB1ƒEQU„$10368000TOIPCACKBOX#IPCIM1„EQU„$10568000COMMANDWRITE'IPCIMB2ƒEQU„$181IPCTO68000WRITEBOX%IPCIAB2ƒEQU„$183IPCTO68000ACKBOX!IPCIM2„EQU„$185IPCCOMMANDWRITE* * STRUCTURE FOR DEVICE NO. TABLE*9*TheaddressofthistableisintheCCB.‚Thememoryfor<* this table gets allocated in the initialization section of>*thedriver.‚Thelengthisdependenton#ofdevicesandeach<*entrylength.‚Thenumberofdevicesisnowsetto12.‚Each>* entry pertains to a disk - the disk device number is used to?* determine where in the table the entry is; ie, drive 0 is theF*1stentry,drive1the2nd,etc.‚ThecompleteIOCBforconfigurationF* is saved in this table - it is defined as the current configuration.>* The default configuration is save in the DCB for each drive.* ‰OFFSET0LUFLG„DS.Bƒ2–ENTRYFLAGLUDCB„DS.Bƒ4–DCBADDRESSLUIOCBƒDS.Bƒ4–IOCBADDRESSLUTCB„DS.Bƒ4–TCBADDRESSLUBADRƒDS.Bƒ4–BUFFERADDRESS.ACTIVEƒDS.Bƒ1–ACTIVEFLAG-USEDFORCONFIGURE$MOUNTED‚DS.Bƒ1–MOUNTED/DISMOUNTFLAG,CONFGBLKEQU„*-IOSATWOFFSETTOCONFIGBLOCK6LUCONFƒDS…(IOSDRSV-IOSATW)/2…configureparameterblock(LUENTRY‚EQU„*–LENGTHOFDEVICENO.ENTRY** EQUATES FOR 'LUFLG'*LUFEOFƒEQU„0“EOFPENDINGLUFHLTƒEQU„1“HALTPENDING"LUFXFRƒEQU„2“DATATRANSFERREQUEST(LUFCFGƒEQU„3“Thisisaconfigurerequest3LUFCFGD‚EQU„4“Theconfigurerequestisfordefaults5LUFTSRƒEQU„5“ThisisastatusRequestforFloppyTapeLUFACTƒEQU„15’ACTIVEDEVICE** MISCELLANEOUS EQUATES*STX‡EQU„$02startpacketcodeETX‡EQU„$03endpacketcodeACK‡EQU„$06ackcodeNAK‡EQU„$15nakcode9EXCCP…EQU„$00attributeextendedcommandchannelprotocol7SICCP…EQU„$80attributesimplecommandchannelprotocol-ADAPCNTƒEQU„$02identifiesADAPTECcontroller*TAPECNTƒEQU„$80identifiesTAPEcontroller1TPIFSL„EQU„1’lengthofinformationsectorontape7TPIFSN„EQU„3’sectornumberofinformationblockontape0LUMAX…EQU„8’MAXIMUMDEVICENO.VALUEƒ11/14/85AF3SECOFF„EQU„4’OFFSETTONO.OFSECTORSINCONFIGTBL(RTNGDC„EQU„$70NORMALSTATUSPACKETCODE,RTNHLT„EQU„$71HALT/ABORTSTATUSPACKETCODE+RTNSTA„EQU„$72SOLICITEDSTATUSPACKETCODE"RTNGDS„EQU„$0000ŽGOODSTATUSVALUE,SPKT†EQU„$0200ŽFIRST2BYTESOFEVERYPACKETDLUPAGE„EQU„(LUMAX*LUENTRY+256)/256NO.OFPAGESFORDEVICENO.TABLE+SECSIZƒEQU„$100“SYSTEMREQUIREDSECTORSIZE'IOPKSZ„EQU„21”READORWRITEPACKETSIZE'STPKSZ„EQU„7•STATUSREQUESTPACKETSIZE#CNPKSZ„EQU„29”CONFIGUREPACKETSIZE$FDPKSZ„EQU„7•FORMATDISKPACKETSIZE&FTPKSZ„EQU„15”FORMATTRACKPACKETSIZEHLTPKSZƒEQU„7•HALTPACKETSIZEIOEVCD„EQU„1•I/OEVENTCODE*DSKATM„EQUƒ$031Fsupportedattributesmask)IOATM…EQUƒ$031Fsupportedattributesmask/NVALATMƒEQUƒ$FFFF-DSKATMˆunsupportedattributes+DSKPRMM„EQUƒ$DBF3supportedparametersmask)IOPRM†EQUƒ$DBF3supportedparametersmask0NVALPRMƒEQU„$FFFF-DSKPRMM‡unsupportedparameters$VDOSRSZ‚EQU‡256‘VERSAdossectorsizeLCDS8 CTBTEQU‡7@LCDSCTSZEQU‡1<‰MOVE.B‚#SICCP,IPCATTR(A1)setsimplecommandchannelprotocol ‰CLR.LƒD1*‰MOVEP.LD1,IPCRESV1(A1)„clearunusedarea*‰MOVEP.LD1,IPCRESV2(A1)„clearunusedarea*‰MOVEP.LD1,IPCRESV3(A1)„clearunusedarea*‰MOVEP.LD1,IPCRESV4(A1)„clearunusedarea*‰MOVEP.LD1,IPCRESV5(A1)„clearunusedarea ‰MOVE.B#ETX,IPCVETX(A1)„setETX7‰MOVE.L‚CCBCHB(A5),A1†restorememorymappedI/Oaddress'‰INHIB–inhibitinterruptsonthisboard:‰MOVE.B‚#$80,IPCIMB1(A1)ƒsendmessagewaitingtotheboard* *‰pollforthecompletitionbyte*5IPCI30ƒMOVE.B‚IPCIMB2(A1),D1…getmessagewaitingflag9 (‰BEQ.SƒIPCI30branchtilsomethingthere*2*ˆreceivedmessagewaiting-seeifpacketisgood*0‰CLR.BƒIPCIMB2(A1)ˆclearthemesagewaitingflag(‰CMP.Bƒ#STX,RTNSTX+IPCIM2(A1)ƒisitSTX?-‰BNE.SƒIPCIERRŒbranchifno-thisisanerror ‰CLR.LƒD0-‰MOVE.B‚RTNPKSZ+IPCIM2(A1),D0‚getpacketsize"‰SUB.Lƒ#1,D0Žmakeitzerorelative)‰LSL.Lƒ#1,D0Žaccountforeveryotherbyte,‰ADD.Lƒ#IPCIM2,D0‰addintheoffsettostart5‰CMP.Bƒ#ETX,0(A1,D0.L)„doesthemessageendwithETX?(‰BNE.SƒIPCIERRŒbranchifno-harderror8‰MOVEP.WRTNSTVL+IPCIM2(A1),D0ƒgetreturnedstatusvalue-‰BNE.SƒIPCIERRŒbranchifanerrorisreturned* *‰initdone*IPCI50ƒUNMASK•enableinterrupts ‰RTS‘RETURN**ˆSomethingwaswrongwith5*ˆthemessageformatoranerrorstatuswasreturned.!*ˆMarktheboarddownandreturn.*6IPCIERR‚BSETWƒ#CCBFGER,CCBFG(A5)seterrorflaginCCB6‰OR.W„#(1<*ˆAPPROXIMATELY225INSTRUCTIONSEXECUTEDTOGETTOTHISPOINT *ˆ(600us).*J***************************************************************************IOHUSER:** CHECK FOR RESET*ƒIFRESET,DOITANDGETOUT*)ŠCMP.B‚#XDREST,XIOSCD(A2)TESTRESETBYTE#ŠBNE.S‚IOH01000‹BRANCHIFNOTRESETŠBSR„CMRRESTŒCALLRESETROUTINEŠBRA„IPCUSRTN‹RETURN*(* CONVERT LOGICAL PB ADDRESS TO PHYSICAL*IOH01000‚CLR.L‚D5,ŠMOVE.LXIOCPK(A2),D6†ADDROFCOMMANDPACKET+ŠMOVE.WXIOPLN(A2),D5†LENGTHOFCOMMANDPKT"ŠMOVE.LCCBTASKA(A5),A1„SETUPTCB ŠBSR„IOHADRCKŠBRA.S‚IOH01010‹GOODRETURNŠNOP—BADLENGTHRETURN(ŠMOVE.B#ISTAIP,D1‰SETUPIOSERRORCODE ŠBRA„ABORT5IOH01010‚MOVE.LD6,A3ŽCOMMANDPACKETPHYSICALADDRESS*$* RETURN IF CHANNEL IS IN ERROR MODE*ŠBTSTW‚#CCBFGER,CCBFG(A5)2ŠBEQ.S‚IOH01020‹BRANCHIFNOTMARKEDINERRORMODE)ŠMOVE.B#ISTACDN,D1ˆSETUPIOSERRORCODE ŠBRA„ABORT*E* If there is a command on the VME319 which is not finished yet, give,* back status "CHANNEL BUSY" to calling task*IOH01020‚EQU„*.ŠMOVE.LCCBCHB(A5),A4†MEMORYMAPPEDBASETOA4ŠMOVE.BCCBICNT(A5),D0&ŠBEQ.S‚IOH01030‹branchifchannelfree*4* Channel is not free -- give user back busy status.*(ŠMOVE.B#XSTBSY,D0‰SETUPIOSERRORCODE ŠBRA„IPCUSRTNŠPAGEK****************************************************************************(*‚FINDTHECOMMANDINTHECOMMANDTABLE.* IOH01030‚EQU„*)ŠMOVE.LXIOUID(A2),A4†PICKUPDCBPOINTER8ŠMOVE.LCCBTASKA(A5),CCBTASKB(A5)SETUPBUFFERTASKTCB-ŠMOVEQ‚#NUMCMDS-1,D0†Setuptheloopcounter./ŠLEA„CMDTBL,A0ŠA0<--addressofcommandtable./ŠMOVE.WIOSFCT(A3),D6†Setupusercommandcode. 8CMDSRCHƒCMP.W‚(A0)+,D6‹Searchthetableforthecommand.ŠDBEQƒD0,CMDSRCH‰* 3ŠBNE.S‚CMDERRIfwefoundthecommandinthetable,8ŠADD.L‚#JMPOFF-2,A0‡getthecorrespondingentryfromthe5ŠMOVE.W(A0),D0Œjumptableandjumptotheroutineto"ŠJMP„(A0,D0.W)Šhandlethecommand.ŠSPC„2>CMDERR„MOVE.B#ISTAIF,D1ŠThecommandwasn'tfoundinthetable2ŠBRA„ABORTŽsoexitwithaninvalidfunctionerror.ŠPAGEM*******************************************************************************‰REQUESTSTATUS2*‰ThiscommandisarequeststatustotheMVME319.:*‰Itistoreturnthecurrentconfigurationtothecaller.*(*‰Entry:A2=addressofCMRparamblock*A3=addressofuser'sIOCB*A4=addressofDCB*A5=addressofmyCCB*A6=addressofuser'sTCB* *‰Additional-*‰Registers‚A1=addressofIPCsharedmemory*™andaddressofdev: icetableM******************************************************************************REQSTAT:6ŠMOVE.Lƒ#IOSDLN,D5Šlengthofconfigureparameterblock<ŠMOVE.LƒIOSDBP(A3),D6‡logicaladdressofconfigurepara.blk+ŠBSR†BUFADDRgetthephysicaladdressofit<ŠMOVE.LƒD6,CCBPTR(A5)‡savephys.addrofconfigurepara.blk ŠCLR.L„D6,ŠBSR„DEVTBLgetgetdevicetableentrystuff%ŠMOVE.L‚A0,A1addressoftopoftable"ŠADD.LƒD0,A1addressofthisentry-ŠMOVE.LA2,D7ŽsaveaddressofCMRparamblock/ŠLEA…LUCONF(A1),A2ˆaddressofthisconfigblockŠCLR.L‚D5‘clearforlateruse/ŠBSR.S‚STATCONF‹STATCONFsetsupA0topointto&*£theIOSATMfieldoftheusersstatus%*£parameterblock.‚Italsodetermines&*£thedrivesdevicestatusandsetsup(*£thefirstgroupoffieldsintheusers*£statusparameterblock.9L0110…EQU„IOATM<<16ŠSetIOSATMfieldandtheIOSPRMfield?ŠMOVE.L#L0110+IOPRM,(A0)+intheusersstatuspara.block.‚The%*£valueswereturnaresignificantto*£thisdriver.L0120…EQU„IOSDLN-IOSATWL0121…EQU„L0120/2L0122…EQU„L0121*2*ŠMOVEQ‚#L0121-1,D0ˆnumberofwordstomove;L0130…MOVE.W(A2)+,(A0)+ˆcopycurrentconfigurationtouserŠDBRAƒD0,L01307ŠCMP.B‚#TAPECNT,DCBDKC+IOSDRC(A4)isthisatapedevice*ŠBEQ.S‚RDTINF•yes-‚readinformationblock*²togetthenumberofsectors*²availableonTapeŠCLR.L„D1’setforgoodreturn"ŠMOVE.LD7,A2Žgetbacktheaddress.ŠBRA†ABORTuseaborttoqueueeventandreturnŠPAGEL*****************************************************************************-*‰Read‚theInformationBlockofaFloppyTape*>*‰ThissubroutineiscalledifaConfig/StatusRequestoccuresE*‰foraFloppyTapedevice.AftertheFormatcommandtheVME319Firm-C*‰warewritesinformationaboutbadSegmentsandthenumberofgoodA*‰sectorstothefourthsectorofthetape.AreadofthissectorB*‰causestheVME319FirmwaretoupdateitsownTablesandprovides@*‰thenumberofgoodsectorsonTapetoupdatetheDeviceTables*‰inthisdriver.*+*‰entry:A1=pointertodevicetableentry*A4=addressofDCB*A5=addressofCCB*L*****************************************************************************RDTINF:9ŠMOVE.W#TPIFSL,CCBBLKS(A5)‚Setnumberofsectorstoread9ŠLEA„CCBTIBL(A5),A2…Getaddressofbufferforthissector0ŠMOVE.LA2,CCBPTR(A5)†Setupdestinationaddress?ŠMOVE.L#TPIFSN,CCBRRN(A5)Setupnumberofirstsectortoread ŠCLR.L‚D63ŠBSETƒ#LUFTSR,D6‰SetstatusrequestforFloppyTape"ŠBSETƒ#LUFACT,D6‰SetdeviceactiveŠMOVE.WD6,LUFLG(A1) ŠBSR„SETPKTSetuppacketheader%ŠMOVE.W#XREAD,D1ŠSetupReadcommand%ŠBSR„DSKCMDSetupinCommandChannel ŠMOVE.LD7,A2 ŠBRA„NRMEXITŠPAGEL***************************************************************************** *‰STATUS/CONFIGURECOMMONCHORES*6*‰Thissubroutineperformsfunctionscommontostatus,,*‰configure,anddefaultconfigurecommands.*+*‰entry:‚A1=pointertodevicetableentry!*‘A2=IOSATWfieldinCCBorDCB*‘A3=physicaladdressofIOCB*‘A5=physicaladdressofCCB*M***************************************************************************** STATCONF:7ŠMOVE.LIOSDBP(A3),D6†getphysicaladdressofthefirst!*§locationoftheusersconfigure*§parameterblock)ŠMOVE.L#IOSDLN,D5‰parameterblocklength0ŠMOVE.LA1,-(A7)‹savedevicetableentrypointer0ŠBSR„BUFADDRŒconvertlogicaltophysicaladdress3ŠMOVE.L(A7)+,A1‹restoredevicetableentrypointerSTATCON1‚MOVE.LD6,A0Žsaveit&ŠMOVE.LD6,CCBPTR(A5)†saveinCCBalso1ŠTST.B‚MOUNTED(A1)ˆifthediskisnotmountedset'ŠSEQ.B‚(A0)XDSNRBBITofdevicestatus-ŠAND.B‚#1<*‰calltotheboardiscomplete.‚Themounted/dismountedoptionB*‰ischeckedtoseeiftheDCBmustbechangedformount/dismount.*(*‰Entry:A2=addressofCMRparamblock*A3=addressofuser'sIOCB*A4=addressofDCB*A5=addressofmyCCB*A6=addressofuser'sTCB* *‰Additional-*‰Registers‚A1=addressofIPCsharedmemory*™anddevicetableM****************************************************************************** CONFIGUR: 3ŠMOVE.L#IOSDLN,D5‰configureparameterblocklength<ŠMOVE.LƒIOSDBP(A3),D6„logicaladdressofconfigurepara.blk(ŠBSR†BUFADDRŠconverttophysicaladdress?ŠMOVE.LƒD6,CCBPTR(A5)„savethephy.addrofconfigurepara.blk ŠCLR.L„D6&ŠBSET„#LUFACT,D6ˆsetforactivedevice0ŠBSET„#LUFCFG,D6ˆsetthisisaconfigurerequest%ŠBSR†DEVTBL‹setupdevicetableentry!ŠMOVE.LƒA0,A1ŒtopofdevicetableŠADD.L„D0,A1Œtopofthisentry9ŠMOVE.LƒA2,D7Œmustsavetheparameterblockaddr11/17/83/ŠLEA…LUCONF(A1),A2…sartofthisconfigureblock2L0220…EQU„DCBDKC+IOSWTO†write-timeoutfieldinDBC>2,D1†getVERSAdossectorsize‰ASL.L…#2,D1makeitreal3L0326„EQU‡IOSREC-IOSDRSV†pointtorecordsizefield ‰MOVE.W„D1,L0326(A0)ˆandsaveit*‰DIVU†D0,D1seeifrecordsizemakessense‰SWAP†D1*‰AND.W…#(1<error01/27/84%CONERR46EQU‡$46‘disksizeerrorcode'‰MOVEQ…#CONERR46,D3ˆsetupjustincase‰MOVEQ.Lƒ#0,D5clearforuse*8*ˆComputethenumberofsidesonafloppydisktousein6*ˆcalculationoflogicalsectors.‚Determinerigiddisk9*ˆorfloppyfromthe#IOARDISCbitotheattributesword.6*ˆIfafloppy,setD5=1forasingle-sideddiskette.9*ˆDeterminetheactualnumberofsidesfrom#IOADSIDEbit6*ˆoftheattributesword.‚Ifdouble-sided,setD5=2.*2LC000„EQU‡IOSATW-IOSDRSV†offsettoattributesword0‰BTSTW…#IOARDISC,LC000(A0)seeiffloppyorhard"‰BNE.S…LC010branchifaharddiskM********* Configuration check for floppies only ***************** JH 11/26/845CONERR47EQU†$47”Gettheerrorcodethatwe'lluseto6‰MOVEQ„#CONERR47,D3‰indicatethatwedon'tsupportthe)*¦proposedconfiguration.We'llkeepthis(*¦errorcodeinD3.Baswemakecomputa-$*¦tionsregardingtheconfiguration. 9‰BTSTWƒ#IOADDEN,LC000(A0)„Single-ordouble-datadensity? ‰BEQ.SƒCNF172?EQ375„EQU…IOSPSM-IOSDRSVŠAtthistime,Versadosandthisdriver5‰CMP.Wƒ#256,EQ375(A0)ˆsupportthedoubledata-density5‰BNE…CONERRORŽconfigurationwith256bytespersector.‰BRA.SƒCNF175ONLYandthesingledata-densityCCNF172ƒCMP.Wƒ#128,EQ375(A0)ˆconfigurationwith128bytespersector‰BNE…CONERRORŽONLY.6CNF175ƒMOVEQƒ#CONERR46,D3ŠRestoredisksizeerrorcodeN********************************************************************* 11/26/84‰ADDQ.L„#1,D5setforfloppy8‰BTSTW…#IOADSIDE,LC000(A0)seeifsingleordoublesided#‰BEQ.S…L0845branchifsinglesided"‰ADDQ.L„#1,D5setfordoublesided‰BRA.S…L0845andgocontinueLC010>L0840„EQU‡IOSHDS-IOSDRSV†offsettonumberofheads-harddisk(‰MOVE.B„L0840(A0),D5ˆgetnumberofheads‰PAGE*<*ˆComputethetotalnumberroflogicalsectorsforanentireC*ˆharddiskasIOSSPT*IOSHDS*IOSTRK,andIOSSPT*< #ofheads*IOSTRK?*ˆforafloppy.‚TheorderofmultiplicationisimportantastheB*ˆfirst2factorsarebothone-bytevalues,thusassuringthatthe.*ˆintermediateproductdoesn'texceed16bits.*0L0845„MULU†D5,D2#ofheadsbysectorspertrack7L0850„EQU‡IOSTRK-IOSDRSV†offsetthenumberofcylinders.‰MULU.W„L0850(A0),D2ˆtimesnumberofcylinders?CNERROR2BEQ‡CONERROR‹cannotbezero-somevaluemustbewrong6‰CMP.L…#LSNMASK,D2‰seeifbiggerthanlargestpossible1‰BHI‡CONERRORŒbranchiftoobig-errorsomewhere*@*ˆIfthediskisadoubledensityfloppydisk,subtractIOSSPT/2=*ˆfromthetotalnumberoflogicalsectorstoaccountforthe<*ˆfactthatthesectorsintrackzeroaresingledensityand*ˆhalfthesizeoftherest.*2L0860„EQU‡IOSATW-IOSDRSV†offsettoattributesword/‰BTSTW…#IOADDEN,L0860(A0)‚seeifdoubledensity$‰BEQ.S…L0870branchifsingledesity)‰LSR‡#1,D0get(sectors/track)/2‰01/27/846‰BHI.S…SUBSETRifeven,use(sectors/track)/2‚01/27/843‰ADDQ†#1,D0ifodd,incr.(sectors/track)/2‚01/27/843SUBSETR‚SUB.L…D0,D2getridof1/2trackofsectors3CNERROR3BLS‡CONERRORŒbranchiflessthan0-error*>*ˆNowletsseehavemanyVERSAdossizedsectorswereallyhave*L0870„MOVE.L„D2,D0sectorcount‰CLR.W…D2’clearforuse‰SWAP†D2$‰DIVU†D1,D2dividebyVDOSRSZ/IOSPSM5L0880„EQU‡IOSRSZ-IOSDRSV†offsettototalsectorcount"‰MOVE.W„D2,L0880(A0)ˆandsavehalf‰MOVE.W„D0,D2dofortherest ‰DIVU†D1,D2$‰MOVE.W„D2,L0880+2(A0)†savetherest‰PAGE*6*ƒNowtakeacopyofusersupdatedconfigurationblockA*ƒWeneedthiscopytoupdatetheconfigurationintheDCBorour:*ƒowndevicetableintheinterruptserviceroutineifthe3*ƒVME319boardhasagreedtoournewconfiguration.*,L0328…LEA„CCBCNBE(A5),A2…bottomofsavearea6EQ330…EQU„(IOSDRSV-IOSATW)/2-1numberofwordstomove$ŠMOVEQ‚#EQ330,D0ŠsetuploopcounterL0330…MOVEƒ-(A0),-(A2)ˆcopy-ŠDBRAƒD0,L0330‹A2pointstoIOSATWattheend*8*ˆThissectionofcodeisonlyfortheconfigurecommand*6*ˆSeeifthisisamount,dismount,orconfigureonly.:*ˆIfIOSOPTfieldiszerothisisamountcommand.Setthe:*ˆmountedflagtoindicatethis.‚IftheIOPDMNTbitisset;*ˆthisisadismountandwehavetotellourselvesthatand2*ˆVERSAdosalso.‚VERSAdoswillthenknowtochange;*ˆbacktodefaultconfigurationandthevolumeisnolonger*ˆthere.*;‰BTSTW…#CCBFCF,CCBFG(A5)ƒseeifthisisadefaultconfigure2‰BNE.S…L0830branchifadefaultconfigurecommand7‰MOVE.W„IOSOPT(A3),D0‡gettheoptionsfieldoftheIOCB'‰BNE.S…L0820branchifdismountcommand#‰ST.B†MOUNTED(A1)‰setmountedfield,L0820„ROL.W…#15-IOPDMNTB,D0…getdismountbit‰BPL.S…L0830branchifmount$‰CLR.B…MOUNTED(A1)‰settodismounted)‰ST.B†DCBCCF(A4)ŠsetdismountinDCBalso3L0830„BSR‡STATCON1Œgoupdatedevicestatusandtype‰PAGE*@*ˆNowbuildthepacketinformationforthediskcontrollerboard*%‰BSR‡SETPKTŽsetinitialpacketheader%‰MOVE.W„#XCONFIG,D1‰configurecommand!‰MOVEP.WƒD1,IPCCHCM(A1)†topacket8‰MOVE.L„CCBPTR(A5),A0‡getuser'sparameterblockaddress1‰MOVE.B„#CNPKSZ,IPCPKSZ(A1)29bytepacketlength<‰CMP.B…#TAPECNT,DCBDKC+IOSDRC(A4)„seefithisisFloppyTape‰BEQ‡CONFT010–branchifTape6‰BTSTW…#IOARDISC,IOSATW(A0)Šseeiffloppyorharddisk#‰BNE‡CONFH010Œbranchifaharddisk*(*ˆbuildfloppydiskconfigurationpacket*ˆdoattributesbyte0first%*ˆA0=user'sparameterblockaddress!*ˆA1=M319sharedmemoryaddress*!‰CLR.L…D1ˆbuildattributesbyte0'‰BTSTW…#IOASIZE,IOSATW(A0)8"or5.25"?4‰BEQ.S…CONFF010‚branchif5.25-isalsothedefault‰BSET†#2,D1…setfor8"disketteA‰BRA.S…CONFF020‚leavecompensationattrib.bitunchanged01/27/84;CONFF010BSET†#1,D1…setnocompensationfor51/4"‹01/27/84CONFF020CLR.L…D2-‰MOVE.W„IOSPCOM(A0),D2…getthepre-compvalue.‰MOVEP.WƒD2,IPCFPCN(A1)setthepre-compvalue2‰BTSTW…#IOADPCOM,IOSATW(A0)‚pre-comporpost-comp?8‰BEQ.S…CONFF030Œbranchifpre-alsothedefault01/27/84%‰BSET†#0< ,D1setforpost-compensation1CONFF030BTSTW…#IOADSIDE,IOSATW(A0)†singlesided?(‰BEQ.S…CONFF040Œbranchifsinglesided- ‰BSET†#4,D1setfordoublesided/CONFF040BTSTW…#IOADDEN,IOSATW(A0)FMencoding?‰BEQ.S…CONFF050ŒbranchifFM ‰BSET†#5,D1…setforMFMencoding0CONFF050TST.B…IOSSOF(A0)Šspiraloffset?11/7/83*‰BEQ.S…CONFF060Œbranchifnospiraloffset!‰BSET†#6,D1setforspiraloffset.CONFF060BTSTW…#IOAFRMT,IOSATW(A0)IBMformat?‰BNE.S…CONFF070‚branchifIBM#‰BSET†#7,D1…setforMotorolaformat5CONFF070MOVE.B„D1,IPCFATR0(A1)…setattributesbyte0**ˆattributesbyte1**‰MOVE.B„IOSSR(A0),D1ˆgetthesteppingrate0‰BNE.S…CONFF080Œno-savesteppingrate‡01/27/847‰BTSTW…#IOASIZE,IOSATW(A0)yes-51/4"or8"?‹01/27/844‰BEQ.S…CONFF075Œ51/4",usesteppingcode1ƒ01/27/84-‰ADD.B…#1,D18",usesteppingcode2‡01/27/842CONFF075ADD.B…#1,D1steppingcode1or2Š01/27/845CONFF080MOVE.B„D1,IPCFATR1(A1)…setthesteppingrate**ˆrestofthepacket*0‰MOVE.B„IOSSPT(A0),IPCFSPT(A1)ˆsectorspertrack"‰MOVE.B„#1,D1™setforsinglesided/‰BTSTW…#IOADSIDE,IOSATW(A0)isitsinglesided?&‰BEQ.S…CONFF090‚branchifsinglesided"‰MOVE.B„#2,D1…setfordoublesided-CONFF090MOVE.B„D1,IPCFSID(A1)†set#ofsides%‰MOVE.W„IOSPSM(A0),D1‡getsectorsize'‰MOVEP.WƒD1,IPCFSLG(A1)†setsectorsize(‰MOVE.W„IOSTRK(A0),D1‡get#ofcylinders‰MOVEP.WƒD1,IPCFNC(A1)‡setit ‰CLR.L…D1)‰MOVEP.LƒD1,IPCFNU(A1)‡clearunusedbytes3‰MOVE.B„IOSILV(A0),IPCFIF(A1)…setinterleavefactor‰BRA.S…CONFH050“andcontinue*&*ˆbuildpacketforharddiskconfigure*CONFH010CLR.L…D1&‰MOVEP.WƒD1,IPCFATR0(A1)…noattributes9‰MOVE.B„IOSSPT(A0),IPCHSPT(A1)ˆsetsectors/trackƒ01/27/84-‰MOVE.B„IOSHDS(A0),IPCHNOH(A1)ˆset#ofheads%‰MOVE.W„IOSPSM(A0),D0‡getsectorsize'‰MOVEP.WƒD0,IPCHSLG(A1)†setsectorsize)‰MOVE.W„IOSPCOM(A0),D0†getpre-compvalue%CONFH020MOVEP.WƒD0,IPCHPC(A1)‡setit(‰MOVE.W„IOSTRK(A0),D0‡get#ofcylinders‰MOVEP.WƒD0,IPCHNC(A1)‡SETIT:‰MOVE.W„IOSRWCC(A0),D0†getspecifiedreducedwritecurrent(‰MOVE.W„IOSECC(A0),D1‡getECCvaluealso?CONFH030MOVEP.WƒD0,IPCHRWC(A1)†setreducedwritecurrentvalue‰MOVE.B„D1,IPCHECC(A1)†setECC"‰MOVE.B„#0,IPCHNU(A1)‡clearunused+‰MOVE.B„IOSILV(A0),D0‡getinterleavefactor3CONFH040MOVE.B„D0,IPCHIF(A1)‡setinterleavefactor,CONFH050CLR.L…D0’usetoclearunusedfields‰MOVE.B„D0,IPCFNU1(A1)†notused ‰MOVEP.WƒD0,IPCFNU2(A1)†notused*3*ƒsetupcontrollertypeandsteprateifharddisk*/ŠBTSTW‚#IOARDISC,IOSATW(A0)isthisaharddiskŠBNE.S‚CONFH060‹branchifyes6ŠMOVEP.LD0,IPCFNU3(A1)„clearunusedfieldsforfloppyŠBRA.S‚CONFH070*ECONFH060‚MOVE.BIOSSR(A0),IPCHATR(A1)ƒsetsteppingrateforharddisc#ŠMOVE.BD0,IPCHNU3(A1)Šclearunused3ŠMOVE.BIOSDRC(A0),IPCHCTYP(A1)setcontrollertype#ŠMOVE.BD0,IPCHNU4(A1)Šclearunused*)CONFH070MOVE.B„#ETX,IPCHFETX(A1)ƒsetETX!‰CLR.L…D1’setfornoerrorsfound3‰MOVE.L„D7,A2restoreCMRparablkaddrƒJH01/24/84*‰BRA‡NRMEXITgosendthepacketandreturnŠPAGE*)*ƒsetupconfigurepacketforFloppyTape*:CONFT010CLR.L…D1’clearforsttingunusedspaceinchannel#‰MOVE.B„D1,IPCTNU1(A1)†clearunused4‰MOVE.B„#TAPECNT,IPCTTYP(A1)setdevicetypeisTape<‰MOVE.B„IOSSPT(A0),IPCTNSEC(A1)‚set#ofsectorspersegment#‰MOVE.B„D1,IPCTNU2(A1)†clearunused%‰MOVE.W„IOSPSM(A0),D0‡getsectorsize0‰MOVEP.WƒD0,IPCTSSZ(A1)†setphysicalsectorsize$‰MOVEP.LƒD1,IPCTNU3(A1)†clearunused$‰MOVEP.LƒD1,IPCTNU4(A1)†clearunused7‰MOVE.B„IOSILV(A0),IPCTSKIP(A1)‚setsegmentshipfaktor$‰MOVEP.LƒD1,IPCTNU5(A1)†clearunused$‰MOVEP.WƒD1,IPCTNU6(A1)†clearunused#‰MOVE.B„D1,IPCTNU7(A1)†clearunused%‰BRA.S…CONFH070Œsetupetxandreturn‰PAGEL******************************************************************************ˆCONFIGURATIONERRORROUTINE*8*ˆControlcomeshereisthereisadetectederrorinthe*ˆconfigurationcommand.*ˆentry:ƒD3=errorcode0*‘D6=physicaladdressofusersparameterblock7*‘D7=physicaladdressofC= MRparameterblock‡11/17/83.*ˆNote:„Mustrestore‚D6andD5beforeexiting.*L**************************************************************************** CONERROR:4‰MOVE.L„CCBDTBL(A5),A0†devicetableaddress‚01/27/84‰MOVEQ.Lƒ#0,D0¥01/27/84,‰MOVE.B„DCBCDV(A4),D0‡devicenumber‰01/27/84-‰MULU†#LUENTRY,D0‰calculateposition„01/27/84/‰CLR.W…LUFLG(A0,D0.L)†unsetactivebit†01/27/84)‰MOVE.L„D6,A0…getusersparameteraddress%‰MOVE.B„D3,IOSDST(A0)‡saveerrorcode1‰MOVEQ…#ISTACNF+$FFFFFF00,D1‰setmajorerrorcode>*ˆMOVEM.Lƒ(A7)+,D5/D6‰restoreregs-notusedfor31901/27/842‰MOVE.L„D7,A2includingCMRparablkaddrƒ11/17/83‰BRA‡ABORTandreturn‰PAGEL******************************************************************************‰READCOMMAND*,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB* *‰Additional-*‰Registers‚A1=addressofIPCsharedmemory*L*****************************************************************************READ:5ŠBSR„IOSCOMNŒDothestuffcommontoallI/Ocommands,7ŠMOVE.LD6,CCBPTR(A5)†savethebufferphysicaladdress. ŠCLR.L‚D6&ŠBSETƒ#LUFXFR,D6ŒSETDATATRANSFERBITŠBSETƒ#LUFACT,D6ŒSETACTIVEBIT%ŠBSR„DEVTBLSETUPDEVICETABLEENTRYŠBSR„DSKPRMVALIDATEPARAMETERS/ŠBSR„SETPKTSETUPPACKETHEADERINSHAREDMEM.ŠMOVE.Wƒ#XREAD,D1&ŠBSR†DSKCMDŽYES,SETUPCOMMANDPACKETŠBRA†NRMEXITGOFINISHUPŠPAGEL******************************************************************************‰WRITE**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB* *‰Additional-*‰Registers‚A1=addressofIPCsharedmemory**L*****************************************************************************WRITE:5ŠBSR„IOSCOMNŒDothestuffcommontoallI/Ocommands,7ŠMOVE.LD6,CCBPTR(A5)†savethebufferphysicaladdress. ŠCLR.L‚D6&ŠBSETƒ#LUFXFR,D6ŒSETDATATRANSFERBITŠBSETƒ#LUFACT,D6ŒSETACTIVEBIT%ŠBSR„DEVTBLSETUPDEVICETABLEENTRYŠBSR„DSKPRMVALIDATEPARAMETERS/ŠBSR„SETPKTSETUPPACKETHEADERINSHAREDMEM.<ŠBTSTW‚#DATWRC,DCBATT+2(A4)‚WRITEWITHVERIFYFORTHISDCB? *¹11/14/85AFŠBEQ.S„WRIT30ŽNO4ŠMOVE.Wƒ#XWRITC,D1ŠYES,SETUPWRITE/VERIFYCOMMANDS ŠBRA.S„WRIT408WRIT30„MOVE.Wƒ#XWRITN,D1ŠSETUPWRITE/NOVERIFYCOMMANDS 'WRIT40„BSR†DSKCMDŽSETUPCOMMANDPACKETŠBRA†NRMEXITGOFINISHUPŠPAGEH**************************************************************************ˆFORMATDISKCOMMAND*,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB* *‰Additional-*‰Registers‚A1=addressofIPCsharedmemory**I**************************************************************************FORMAT: )‰BTSTWƒ#IOPFTRK,IOSOPT(A3)‚FORMATTRACK?‰BEQ.SƒFORMT20ŽBRANCHIFNO*A*‚formattrackisnotallowedfordevicesconnectedtoanADAPTEC'*‚orfortheFLOPPYTAPE---checkthis*)ŠMOVE.B#ISTAIF,D1‰errorinvalidfunction1ŠCMP.B‚#ADAPCNT,DCBDKC+IOSDRC(A4)isthisADAPTECŠBEQ„ABORTŽyeserror2ŠCMP.B‚#TAPECNT,DCBDKC+IOSDRC(A4)orFLOPPYTAPE?ŠBEQ„ABORTŽyeserror*!‰MOVE.L‚IOSRRN(A3),D1‰PICKUPRRN%‰BPL.SƒFORMT20GOODIDPOSITIVEVALUE/FORMT10‚MOVE.B‚#ISTARR,D1ŒSETUPIOSERRORCODE ‰BRA…ABORT FORMT20‚CLR.LƒD6‰BSET„#LUFACT,D6ŒSETACTIVEBIT%‰BSR…DEVTBLSETUPDEVICETABLEENTRY5‰LEA‡LUCONF(A0,D0.L),A1‚GETADDRESSOFCONFIUREBLOCK(‰BTSTW…#IOPFTRK,IOSOPT(A3)‚FORMATTRACK?‰BEQ.S…FORMT25ŽBRANCHIFNO3‰CMP.LƒSECOFF(A1),D1ŠSEEIFTHISISBEYONDTHEDISK*‰BLT.SƒFORMT25BRANCHIFSTILLONTHEDISK*‰CLR.WƒLUFLG(A0,D0.L)ˆUNSETTHEACTIVEBIT‰BRA‡FORMT10ANDRETURN6FORMT25‚BSR…SETPKTSETUPPACKETHEADERINSHAREDMEM. 0FORMT30ƒBTSTW„#IOPFTRK,IOSOPT(A3)‚FORMATTRACK?ŠBNE.S„FORMT40YESŠMOVE.Wƒ#XFDISK,D16ŠMOVEP.W‚D1,= IPCCHCM(A1)†SETUPCHANNEL/DEVICECOMMANDS#ŠMOVE.Bƒ#ETX,IPCDETX(A1)„SETUPETX.ŠMOVE.Bƒ#FDPKSZ,IPCPKSZ(A1)SETUPPACKETSIZEŠBRA†NRMEXITGOFINISHUP FORMT40ƒMOVE.Wƒ#XFTRAK,D16ŠMOVEP.W‚D1,IPCCHCM(A1)†SETUPCHANNEL/DEVICECOMMANDSŠMOVE.Wƒ#SECSIZ,D1)ŠMOVEP.W‚D1,IPCBKSZ(A1)†SETUPBLOCKSIZE ŠCLR.L„D1*ŠMOVEP.W‚D1,IPCNBKS(A1)†ZERONO.OFBLOCKSŠMOVE.LƒIOSRRN(A3),D1"ŠMOVEP.L‚D1,IPCFPSN(A1)†SETUPPSN#ŠMOVE.Bƒ#ETX,IPCFETX(A1)„SETUPETX.ŠMOVE.Bƒ#FTPKSZ,IPCPKSZ(A1)…SETUPPACKETSIZEŠBRA†NRMEXITGOFINISHUPŠPAGEL*****************************************************************************C*‰ROUTINECOMMONTOALLI/OCOMMANDS(READ,WRITE,OUTPUTW/INPUT)**‚Entry:A3=addressofIOCB*‰A5=addressofCCB**º £C¬>´<¼CÄKÌCÔ:ÜIä<ì<ô8ü:5 <E,$L*****************************************************************************IOSCOMN:?ŠBTSTW‚#IOPTSKB,IOSOPT(A3)Ifthebuffersresideinadifferent"ŠBEQ.S‚IOSC005ŒtaskfromtheIOCB, 9ŠLEA„IOSTSK(A3),A0†Pointtothetaskname&sessionofthe7ŠTR0$.GETTCB‚,Œbufferowner&callexectogetaddress."ŠBRA.S‚OKTCBŽIfit'sgood,branch.ŠNOP—Ifit'sbad,7ŠMOVE.B#ISTAADD,D1ˆsetstatusinIOCBtoaddresserrorŠTST.L‚(A7)+ŽadjuststackŠBRA„ABORTandexittoCMR. :OKTCB…MOVE.LA0,CCBTASKB(A5)„SavephysicaladdressofTCB. *<*‚ValidatetheinfointheIOCBabouttheprimarybufferand *‚converttophysicaladdresses.*BIOSC005ƒMOVE.LIOSSAD(A3),D6†D6<--bufferphysicalstartaddress.+ŠMOVE.LIOSEAD(A3),D5†D5<--bufferlength.ŠSUB.L‚D6,D5Ž*ŠADDQ.L#1,D5Ž*)ŠMOVE.LD5,CCBLEN(A5)†SavelengthinCCB. >ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner. ŠBSR„IOHADRCK‹Checktheaddress.$ŠBRA.S‚IOSC010ŒIfit'sgood,branch.ŠNOP—Ifit'sabadbaseaddrŠTST.L‚(A7)+Žadjuststack4ŠMOVE.B#ISTAADD,D1ˆSetIOCBstatustoADDRESSERROR2ŠBRA„ABORTandexitwithappropriateerrorstatus. IOSC010ƒRTSŠPAGEK****************************************************************************/*‰VALIDATEBUFFERADDRESS&CONVERTTOPHYSICAL*$*‰Entry:D5=bufferlengthinbytes-*D6=bufferlogicalstartaddr(toconvert)*A3=addressofIOCB*A5=addressofCCB***‰Exit:‚D6ƒ=bufferphysicalstartaddress*D5ƒ=bufferlength*K****************************************************************************BUFADDR:>ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner. ŠBSR„IOHADRCK‹Checktheaddress.$ŠBRA.S‚OKADDR2ŒIfit'sgood,branch.ŠNOP—Ifit'sabadbaseaddrŠTST.L‚(A7)+Žadjuststack4ŠMOVE.B#ISTAADD,D1ˆSetIOCBstatustoADDRESSERROR2ŠBRA„ABORTandexitwithappropriateerrorstatus.OKADDR2ƒRTS—Return.ŠPAGEO*********************************************************************************ˆCHECKDISKPARAMETERS**%*‚Entry:A0=addressofdevicetable%*‰A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB,*‰D0=‚offsetindevicetableforthisdevice**O********************************************************************************DSKPRM:3‰LEA…LUCONF(A0,D0.L),A1„GETADDRESSOFCONFIGUREPB%‰MOVE.W‚IOSOPT(A3),D1‰PICKUPOPTIONS+‰AND.Wƒ#IOPRAN,D1ŒRANDOMOPTIONSPECIFIED?‰BNE.SƒDSKPR10YES(‰MOVE.B‚#ISTATM,D1ŒSETUPIOSERRORCODE‰TST.Lƒ(A7)+‘ADJUSTSTACK‰BRA…ABORTERROREXIT(DSKPR10‚MOVE.L‚IOSRRN(A3),D1‰PICKUPRRN#‰MOVE.L‚D1,CCBRRN(A5)†makeowncopy‰BPL.SƒDSKPR30GOODRRN/DSKPR20‚MOVE.B‚#ISTARR,D1ŒSETUPIOSERRORCODE DSKPR25‚TST.Lƒ(A7)+‘ADJUSTSTACK*‰CLR.WƒLUFLG(A0,D0.L)‡SETTODOINGNOTHING‰BRA…ABORTERROREXITŠSPC„2ADSKPR30ƒCMP.LƒSECOFF(A1),D1‡Iftherandomrecordnumberspecified7ŠBLT.SƒDSKPR35‹intheIOCBispasttheendofthedisk,2ŠMOVE.B#I> STAEOV,D1ˆreturnanend-of-volumeerror.ŠBRA.S‚DSKPR25ŠSPC„22DSKPR35‚MOVE.L‚CCBLEN(A5),D1‰PICKUPBUFFERLENGTH"‰DIVS„#256,D1CALC.NO.OFSECTORS ‰MOVE.L‚D1,D2*‰AND.Lƒ#$FFFF0000,D2‰MUSTBEWHOLESECTORS‰BEQ.SƒDSKPR40ITSOK5‰MOVE.B‚#ISTAADD,D1‹ERROR,PARTIALSECTORNOTALLOWED‰BRA…DSKPR25RETURN1DSKPR40‚MOVE.W‚D1,CCBBLKS(A5)ˆSAVENO.OFSECTORS2‰ADD.LƒCCBRRN(A5),D1‰CALC.LASTSECTORTOTRANSFER‰CMP.LƒSECOFF(A1),D1‰RANGEOK?‰BLE.SƒDSKPR50YES4‰MOVE.L‚SECOFF(A1),D1‰NO,CALC.MAXSECTORSCANREAD‰SUB.LƒCCBRRN(A5),D1/‰MOVE.W‚D1,CCBBLKS(A5)ˆSAVESECTORSTOTRANSFER ‰BSET„#LUFEOF,D6ŒSETEOFPENDING-‰MOVE.WƒD6,LUFLG(A0,D0.L)„SETINDEVICETABLE>DSKPR50‚CMP.Bƒ#TAPECNT,DCBDKC+IOSDRC(A4)‚isthisaFloppyTape!‰BNE.SƒDSKPR60Œno-nothingtodo ‰CLR.LƒD1<‰MOVE.B‚IOSSPT-IOSATW(A1),D1‚getnumberossectorspertrack9‰ADD.LƒD1,CCBRRN(A5)‰addtheoffsettotherand.rec.nr. DSKPR60‚RTS‰PAGEO********************************************************************************** SET UP DEVICE TABLE ENTRY**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB**‰D6=devicetableflag*N*******************************************************************************DEVTBL: ŠCLR.L‚D0(ŠMOVE.BDCBCDV(A4),D0‰PICKUPDEVICENO. ŠCMP.B‚#LUMAX,D0DEVICENO.OK?ŠIF‚‚THEN.S(ŒKILL.DRIVERM319DRV_ID,BAD_DEVICE,A5,A4ŠENDI ŠMULUƒ#LUENTRY,D0‹CALC.POSITION3ŠMOVE.LCCBDTBL(A5),A0ˆPICKUPDEVICETABLEPOINTER(ŠTST.W‚LUFLG(A0,D0.L)ŠTHISDEVICEFREE?ŠBEQ.S‚DEVT010YESŠTST.L‚(A7)+‘ADJUSTSTACK+ŠMOVE.B#ISTADB,D1ŒRETURNDEVICEBUSYERRORŠBRA„ABORTERROREXIT2DEVT010ƒMOVE.WD6,LUFLG(A0,D0.L)‡UPDATETABLEFLAG,ŠMOVE.LA4,LUDCB(A0,D0.L)‡SETUPDCBADDRESS.ŠMOVE.LA3,LUIOCB(A0,D0.L)†SETUPIOCBADDRESS6ŠMOVE.LCCBTASKB(A5),LUTCB(A0,D0.L)SETUPTCBADDRESS8ŠMOVE.LCCBPTR(A5),LUBADR(A0,D0.L)SETUPBUFFERADDRESS ŠRTSšRETURNŠPAGEJ***************************************************************************%*ˆSETUPPACKETHEADERINSHAREDMEM.**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB*,*‰Return:A1=addressofIPCsharedmemory**I**************************************************************************SETPKT:%ŠMOVE.LƒCCBCHB(A5),A1‡MEMMAPPEDADDR)ŠLEA†IPCIM1(A1),A1‡SETUPMESSAGEADDRESSŠMOVE.Wƒ#SPKT,D1/ŠMOVEP.W‚D1,IPCSTX(A1)‡SETUPSTXANDPACKETID0ŠMOVE.BƒDCBCDV(A4),D0‡getdevicenumberŽ03/26/84*ŠCMP.B„#4,D0number4-7isfloppy‹03/26/846ŠBGE.S„SETPKT10Œit'safloppy-nothingtodo‚03/26/843ŠBCLRW„#1,D0if>=2thenoncontroller#1‚03/26/84ŠBEQ.S„SETPKT10Œno03/26/84'ŠBSETW„#4,D0setcontroller#1Ž03/26/84ASETPKT10‚MOVE.BƒD0,IPCPHDV(A1)†setdeviceinIPC-channel†03/26/84 ŠRTSšRETURNŠPAGEJ***************************************************************************)*‰SETUPDISKPARAMETERSINSHAREDMEMORY*&*‚Entry:A1=addressofSHAREDMEMORY%*‰A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB**‰D1=CHANNEL/DEVICEcommands*K****************************************************************************DSKCMD:6ŠMOVEP.W‚D1,IPCCHCM(A1)†SETUPCHANNEL/DEVICECOMMANDSŠMOVE.WƒCCBBLKS(A5),D18ŠMOVEP.W‚D1,IPCNBKS(A1)†SETUPNO.OFBLOCKSTOTRANSFERŠMOVE.Wƒ#SECSIZ,D1)ŠMOVEP.W‚D1,IPCBKSZ(A1)†SETUPBLOCKSIZEŠMOVE.LƒCCBPTR(A5),D1*A*ˆAdjusttheaddressifanoffboardoffsetapplies.…(JH*08/27/84)* ŠGO_OFF_BDD16*‰CMPI.Lƒ#MEMTOP,D1ŠONBOARDMEMORY(VME/10)?ƒ03/28/84*‰BGT.S„GOGON1ŽNOš03/28/845*‰ADDI.Lƒ#OFFST,D1‹YESADJUSTBUFFERADDRESSƒ03/28/84*¦FORVME/10’03/28/84=GOGON1„MOVEP.L‚D1,IPCBUFAD(A1)…SETUPBUFFERADDRESS‡03/28/84 ŠCLR.L„D1'ŠMOVEP.W‚D1,IPCCKSM(A1)†SETUPCHECKSUMŠMOVE.LƒCCBRRN(A5),D1#ŠMOVEP.L‚D1,IPCCMPRM(A1)…SETUPPSN> "ŠMOVE.Bƒ#ETX,IPCETX(A1)…SETUPETX.ŠMOVE.Bƒ#IOPKSZ,IPCPKSZ(A1)SETUPPACKETSIZE ŠRTSšRETURNŠPAGEO******************************************************************************** *ˆNORMALEXIT*,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB*I**************************************************************************NRMEXIT:** BUMP I/O PENDING COUNT*ŠMOVE.LCCBTASKB(A5),A0-ŠADD.B‚#1,TCBIOCNT(A0)„BUMPI/OPENDINGCOUNT** INTERRUPT THE IPC*0ŠMOVE.LCCBCHB(A5),A1†SETUPSHAREDMEM.POINTER (ŠMOVE.B#$80,IPCIMB1(A1)ƒMESSAGEWAITING0ŠADD.B‚#1,CCBICNT(A5)…BUMPOUTSTANDINGINTCOUNT*#ŠCLR.L‚D0‘SETUPGOODRETURNTOCMR*7* USER REQUEST SIDE OF IPC ALWAYS EXITS FROM THIS POINT*IPCUSRTN‚EQU„*ŠRTS—RETURNTOMAINLINEŠPAGEJ*****************************************************************************ˆABORTCOMMANDROUTINE*%*’ENTRY:A2=PARAMETERBLOCKADDRESS*™A3=IOCBPACKETADDRESS*™A4=ADDRESSOFDCB*™A5=ADDRESSOFCCB*™A6=ADDRESSOFCALLERSTCB*™D1=IOSERRORCODE*H*************************************************************************ABORT:)‰LEA‡CCBPKT(A5),A4‡SETUPQUEUEWORKAREA ‰MOVE.L„#6,D0SETUPPACKETSIZE"‰MOVE.L„XIOUID(A2),D2‡SETUPPBID‰AND.W…#$FF,D1!‰MOVE.W„D1,D3SETUPSTATUSVALUE!‰MOVE.B„D1,IOSSTA(A3)‡UPDATEIOCB$‰MOVE.B„#XPSNRM,D1ŠSETUPEVENTTYPE‰BSR‡QEVNTGOQUEUEEVENT5‰MOVE.L„XIOUID(A2),A4‡RESTOREDCBADDRESSˆJH01/24/84 ‰CLR.L…D0‰BRA‡IPCUSRTNŒRETURNŠPAGEF***********************************************************************B* SUBROUTINE TO CHECK ADDRESS BOUNDARIES TO SEE IF ENTIRELY WITHIN*ƒCALLINGTASKSADDRESSSPACE.*#*ENTRY:ƒD5‚-NO.OFBYTESTOCHECK*ŠD6‚-68000ADDRESS(LOGICAL)*ŠA1‚-TCBADDRESS** EXEC ROUTINE#* REGISTERS USED: D0-D1,D3,D6/A0-A1**7*EXIT:„D6-PHYSICALADDRESSOFBUFFERBASE(IFLEGAL)*ŠRETURNTOPC„FORGOODADDRESS*”PC+2‚FORBADLENGTH*”PC+4‚FORBADADDRESS*F*********************************************************************** IOHADRCK:$ŠBTSTƒ#0,D6ŽMUSTBEONWORDBOUNDARY(ŠBNE.S‚IOHADR6ŒBRANCHIFBADBUFFERBASE ŠTST.L‚D5.ŠBEQ.S‚IOHADR8ŒDON'TGOTOLOGPHYWITH0COUNT/ŠMOVE.LTCBTST(A1),A0†ADDRESSOFTASKSEGTABLE ŠTR0$.LOGPHY&ŠBRA.S‚IOHADR8ŒBRANCHFORGOODADDRESSŠNOP—errorbadlength-IOHADR6ƒADD.L‚#2,(A7)ŒADJUSTFORERRORRETURN IOHADR8ƒRTSŠPAGEI****************************************************************************‚CMRRESETROUTINE8*ˆTheMVME319doesnotsupportthereset.Ifthecommand8*ˆchannelmemoryisincorrectthechannelismarkeddown9*ˆandtheuserisnotified.‚Allthecodetoactuallysend;*ˆaresettotheboardiscommentedout.‚Theresetwasused@*ˆbytheUDCandFDCtotrytorecoverfromabadsharedmemory.*%*ˆENTRY:A2=PARAMETERBLOCKADDRESS*A3=PACKETADDRESS*A5=CCBADDRESS*A6=CALLERSTCBADDRESS*I**************************************************************************CMRREST:*/ŠMOVE.LCCBCHB(A5),A4†SETUPSHAREDMEMPOINTER=* CLEAR ERROR MODE,WAITING FOR ACK, DEALT WITH ACK, EXIT FLAG&*‰CLR.L‚CCBNAKAD(A5)‡CLEARNAKADDRESS(*‰CLR.L‚CCBERAD1(A5)‡CLEARERRORADDRESS*‰INHIB•INHIBITINTERRUPTSEŠAND.W#-1-(1<ŠMOVE.BIOSSPT-IOSATW(A4),D0getnumberofsectorspersegment?ŠSUB.L‚D0,D1…reducebynumberofsectorsinse@ gmentbecausethe-*œfirstsegmentisnotaccessablebyVERSAdos9ŠMOVE.LD1,IOSRSZ-IOSATW(A4)storenumberindevicetable'ŠMOVE.LLUDCB(A2),A4‡addressoftheDCB3ŠMOVE.LD1,DCBSEC(A4)†alsosetupnumberofsectors1ŠMOVE.LLUBADR(A2),A4†addressofusersCSBbuffer0ŠMOVE.LD1,IOSRSZ(A4)†alsoreturnittotheuser&RQST10„CLR.L‚D1‘setupforgoodreturn*£nextisnormalexitŠPAGEK****************************************************************************!*‚NORMALEXITFROMINTERRUPTTOUR*+*ˆENTRY:A2=addressofdevidetableentry*A3=addressofIOCB*A5=addressofCCB*K****************************************************************************INEXIT:&ŠMOVE.L‚#6,D0SETUPEVENTINFOLENGTH)ŠMOVE.L‚LUDCB(A2),D2‰SETUPDCBFOREVENT+ŠMOVE.W‚D1,D3SETUPSTATUSVALUEFOREVENT$ŠMOVE.B‚#XPSNRM,D1‹SETUPEVENTTYPE+ŠLEA…CCBCPKT(A5),A4‡SETUPEVENTBUILDAREA#ŠBSR.SƒQEVNTQUEUECOMPLETIONEVENT)ŠCLR.WƒLUFLG(A2)ŒCLEARDEVICETABLEENTRY*5* DECREMENT I/O PENDING COUNT IF SOLICITED TYPE EVENT*7INEX010ƒMOVE.LCCBCHB(A5),A4†RESTORESHAREDMEMPOINTER.ŠBTSTƒ#7,RTNSTCM+IPCIM2(A4)‚ISTHISSOLICITED?ŠBNE.S‚INEX020ŒBRANCHIFNO ŠMOVE.LLUTCB(A2),A0‡TCBADDRESS2ŠSUB.B‚#1,TCBIOCNT(A0)„DECREMENTI/OPENDINGCOUNT**ƒEVENTCOMPLETION*/INEX020ƒCLR.B‚IPCIMB2(A4)ˆclearmessagewaiting.ŠCLR.W‚CCBRCNT(A5)ˆJUSTINCASEARESETWORKED*4* IPC INTERRUPT HANDLER ALWAYS EXITS FROM THIS POINT*IPCINRTN‚EQU„*6ŠSUB.L‚#1,CCBINL(A5)‰DECREMENTINTERRUPTNESTINGLEVEL/ŠMOVEM.L(A7)+,D1-D7/A2-A4/A6ƒRESTOREREGISTERS"ŠOR.W„#$01,SRŽSETRETURNCONDITION&IPCNIRTN‚RTSšBACKTOINTERRUPTHANDLER‰PAGEK*****************************************************************************6* ROUTINE TO HANDLE 68000 DETECTED FATAL CHANNEL ERROR'*ƒSAVECALLINGADDRESSINCCBFORDEBUG*ƒMARKTHECHANNELINERROR*ƒQUEUEEVENTTOCALLINGTASK*ƒRETURN@*ƒThisroutinehasbeenchangedfortheMVME319.ThisboarddoesC*ƒnotcontainaresetinterrupt,thereforetheboardisimmediately@*ƒmarkeddowninsteadoftryingtorecoveronceastheotherIPCC*ƒboardsdo.‚Theunusedcodehasbeencommentedout-butlefthere*ƒforinformationalpurposes.*+*ˆENTRY:A2=addressofdevidetableentry*A3=addressofIOCB(*A4=addressofIPCsharedmemorybase*A5=addressofCCB*K**************************************************************************** IPCUNSER:ŠINHIB,ŠMOVE.L(A7),CCBERAD1(A5)‚SAVEERRORADDRESS3ŠOR.Wƒ#(1<>¥@­?µ?½=Å9Í7Õ7Ý6å8í2õ:ý@  9 *K***************************************************************************K***************************************************************************K***************************************************************************K***************************************************************************‰PAGE‰OPTCRE,PCS,BRS*>*ƒThesevariablesareXREFedinthelinkchainfileM320DRV.LG=*ƒandallowtheusertomodifycertainmedia/driveparameters>*ƒwithouthavingtore-assemblethedriver.‚Seethelinkchain+*ƒfileforadescriptionoftheparameters.* ‰XREFFRMT_SD ‰XREFFRMT_DD ‰XREFFRMT_HD ‰XREFSETTM_5 ‰XREFSETTM_8‰XREFSETTM_HD ‰XREFLDTM_5 ‰XREFLDTM_8 ‰XREFLDTM_HD‰XREFTYP_SEEK **‰MISCEQUATESB *3DRIVESƒEQU‡4“Totalnumberofdrivesonourchannel. **ƒXREF'SfromDISKLIB*ŠXREF…DISK_INITŠXREF…DISK_COMMANDŠXREF…CHAN_DONE **‚Equatefilesincluded:* *‰INCLUDE‚9995.&.TCB.EQ*‰INCLUDE‚9995.&.STR.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.&.KILL.MC*‰INCLUDE‚9995.&.KILLDRV.EQ*‰INCLUDE‚9995.&.UTILITY.MCNNB*‰INCLUDE‚9995.&.DUALPORT.MCƒMacrofiletousewithVMEbusdrivers**$*‰Includethestandardequatefiles:*‰NOLIST‰INCLUDE‚9995.&.TCB.EQ‰INCLUDE‚9995.&.STR.EQ‰INCLUDE‚9995.&.CCB.EQ‰INCLUDE‚9995.&.LV5.EQ‰INCLUDE‚9995.&.IOE.EQ‰INCLUDE‚9995.&.NIO.EQ‰INCLUDE‚9995.&.KILL.MC‰INCLUDE‚9995.&.KILLDRV.EQ‰INCLUDE‚9995.&.UTILITY.MC‰INCLUDE‚9995.&.DUALPORT.MC ‰TTL†DISK.EQ‰LIST‰INCLUDE‚9995.&.DISK.EQ‰TTL†DISKCCB.EQ‰INCLUDE‚9995.&.DISKCCB.EQ‰TTL†M320DRV.SA‰PAGE/‰OFFSETƒDCCBDDPContinuewithchannel-dependent*¦CCBvariablespace.  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* *%%%Å%%%*B*%%%„Device-dependent,channelrelated,variablesstarthere.‰%%%* *%%%Å%%%**%%%™(CCBSPACE)¡%%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  /SPURINT‚DS.B…1–Weusethisvariableforkeeping'*¦countofanyspuriousinterruptsthat'*¦shouldoccurduringexecutionofthis%*¦driver.‚Whenthenumberofspurious$*¦interruptsreaches$80,wesetthe*¦channeldown. 2ECATABLEDS.L…1–ThevariableECATABLEcontainsthe$*¦addressoftheECATablecontained!*¦inglobalmemory.‚TheECATable$*¦containspointerstothefourECAs *¦forthefouravailabledrives.‰PAGE7IOQUEUE‚DS.L…DRIVES‘TheIOQUEUEisusedtoindicatethe(*¦I/Oactivities(ifany)thatarelined'*¦upwaitingtobedoneunderinterrupt**¦controlbytheVME320interrupthandler.'*¦Sincewecanneverhavemorethanone'*¦commandpendingforanysingledrive,(*¦theIOQUEUEhasexactlyenoughentries%*¦toaccommodateoneI/Oactivityfor)*¦eachdrivethataVME320controllercan*¦possiblycontrol. $*¨AnentryintheIOQUEUEisalong-)*¦wordpointerthatcontainsthephysical(*¦addressofadrive'svariableblockin%*¦thedrive-associatedareaofglobal&*¦memoryandthevaluesinthedrive's**¦variableblockdescribetheI/Oactivity$*¦thatmustbedonewiththatdrive. )*§TheVME320driverputsentriesintothe'*¦IOQUEUEintheorderinwhichtheI/O)*¦requestsarereceived,sonodriveona&*¦VME320channelhaspriorityoverany'*¦otherdriveonthesamechannel.‚When&*¦theVME320driverreceivesanewI/O%*¦request,thedriversimplyputsthe&*¦entryforthatrequestintothenext *¦availableslotoftheIOQUEUE. )*§WhentheVME320drivercompletesanI/O&*¦activityunderinterruptcontrol,it(*¦movesallremainingIOQUEUEentriesup%*¦byonepositionintheIOQUEUE.‚The(*¦physicalmovementofqueueentriesmay%*¦soundlikeapoorapproachatfirst&*¦glance,butitturnsouttobequite%*¦good.‚Theuseofwrappingfrontand$*¦rearqueuepointerswithposition-(*¦independentcodeisrathercB umbersome,$*¦andthephysicalmovementofqueue%*¦entriesisabettertechniquefora"*¦shortqueuesuchastheIOQUEUE.‰PAGE1IOQCNTƒDS.W…1–Thisvariablecontainsthecountof#*¦thenumberofbytesintheactive)*¦entriesintheIOQUEUE,soIOQCNT=4*N)*¦whereNisthenumberofactiveentries(*¦intheIOQUEUE.‚ThevalueofIOQCNTis$*¦alwaysintherangefrom0through&*¦through4*DRIVES,sowecouldeasily&*¦useasinglebyteforthisvariable.(*¦However,weuseafullwordforcoding%*¦convenience.‚NoticethatIOQCNTcan%*¦beusedasanoffsetpointertothe&*¦nextavailableentryintheIOQUEUE. H*‚ThefollowingfieldsareusedbytheCHECKERRroutine.‚ThefieldsthatH*‚holdvariablesduetoacommandthathadanerrorareNOTclearedwhen'*‚acommandcompleteswithoutanerror. 1RETRY_FLAGDS.B„1•Thisvariableistheretry_flag'*¦andissetwhenweissuedriverretry%*¦commandstothecontrollerafteran*¦errorhasoccured. 6STATFLAGDS.B‡1”Thisvariableisthe'STATUS'flagand)*¦issetupexactlyastheSTATUSbytein**¦theVME320'smemorymappedI/Ospace.It**¦isusedtofindoutwhichdriveaborted. 7‰DS.W…0MUSTBEONWORDBOUNDARYforMOVE.Linstruction 3SAVECMD‚DS.B…1–Thisvariablesavesthecommandcode(*¦ofthecommandwhichgottheerror.It(*¦isrestoredtothecommandpacketfrom(*¦thislocationafterasuccessfulseek.'*¦Alsousedtosavecommandcodeofthe*¦commandinerror. 3STAT1„DS.B†1•Thisvariablecontainsthemainstatus'*¦returnedfromacommandwhenanerror*¦isreported. 0STAT2„DS.W†1•Thisvariablecontainstheextended%*¦statuswordreturnedfromacommand*¦whenanerrorisreported.‰PAGE1RECNT„DS.B†1•Thisvariablecontainsthenumberof&*¦retriesperformedbytheVME320disk*¦controllerduringacommand. 7RETRY_COUNTDS.Bƒ1•Thisvariablecontainsthenumberof'*¦retriesperformedbytheDRIVERafter"*¦thecontrollerhadasofterror. 6MAX_COUNTEQU†5•Thisequatedefinesthemaximumnumber(*¦ofDRIVERretriestobedoneafterthe*¦controllerhadasofterror. MAXSPTƒEQU†32 5SECTBUFFDS.W…MAXSPT‘Thisvariablepointstoabuffer#*¦thatwillholdastringofsector(*¦numbersusedtoimplementinterleaving*¦andspiraloffset.  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* *%%%Å%%%*>*%%%„Endofdevicedependent,channelrelated,variables.%%%* *%%%Å%%%**%%%•ENDOFCCBSPACE %%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  3CCBSIZEBEQU†*–CCBSIZEBdefinesthesize(inbytes)**¦ofacompleteCCBfortheVME320driver. %*¨CCBSIZEdefinesthesize(inpages)AL0080„EQU†CCBSIZEB+PAGESIZE-1‚ofaCCBfortheVME320driver,andBCCBSIZE‚EQU†L0080/PAGESIZE‡EXTCCBSZdefinesthesize(inpages)of*„|ƒ|ƒ|ƒ|„|ƒ------------1=IOSSHDisnotusedbytheVME320. *„|ƒ|ƒ|ƒ|„|A*„|ƒ|ƒ|ƒ|„----------------1=IOSTRKDisnotusedbytheVME320. *„|ƒ|ƒ|ƒ|9*„|ƒ|ƒ|ƒ---------------------1=IOSPCOMissignificant.*„|ƒ|ƒ|F*„|ƒ|ƒ-------------------------1=IOSSPTDisnotusedbytheVME320.*„|ƒ|<*„|ƒ-----------------------------1=IOSSRBissignificant.*„|K*„---------------------------------1=IOSRWCCBisnotusedbytheVME320. *„7ƒ6ƒ5ƒ4„3ƒ2ƒ1ƒ0$*‚+---+---+---+---++---+---+---+---+*‚|ƒ|ƒ|ƒ|ƒ||ƒ|ƒ|ƒ|ƒ|$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|/*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=IOSRECissignificant.*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|1*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=IOSRSZissignificant. *„|ƒ|ƒ|ƒ|„|ƒ|>*„|ƒ|ƒ|ƒ|„|ƒ------------1=IOSWTOisnotusedbytheVME320. *„|ƒ|ƒ|ƒ|„|@*„|ƒ|ƒ|ƒ|„----------------1=IOSRTOisnotusedbytheVME320. *„|ƒ|ƒ|ƒ|8*„|ƒ|ƒ|ƒ---------------------1=IOSSPTissignificant.*„|ƒ|ƒ|:*„|ƒ|ƒ-------------------------1=IOSHDSissignificant.*„|ƒ|<*„|ƒ-----------------------------1=IOSTRKissignificant.*„|>*„---------------------------------1=IOSILVissignificant. PAGE*'*ˆATTRIBUTESMASKFORTHEVME320DRIVER* **ƒ15‚14‚13‚12ƒ11‚10ƒ9ƒ8$*‚+---+---+---+---++---+---+---+---+*‚| |$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|;*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=Post-read/pre-writeprecompreq'dC .*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|Œ(notused)=*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=8"floppydisk;0=5-1/4"disk. *„|ƒ|ƒ|ƒ|„|ƒ|A*„|ƒ|ƒ|ƒ|„|ƒ------------1=Alternatesectorhandlingcapability *„|ƒ|ƒ|ƒ|„|-*„---------------------------------…Notused.  *„7ƒ6ƒ5ƒ4„3ƒ2ƒ1ƒ0$*‚+---+---+---+---++---+---+---+---+*‚|‹|ƒ||ƒ|ƒ|ƒ|ƒ|$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|<*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=Doubledata-density(MFM)onmedia.*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|9*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=Doubletrack-densityonmedia.*„|ƒ|ƒ|ƒ|„|ƒ|(notused)6*„|ƒ|ƒ|ƒ|„|ƒ------------1=Double-sidedfloppydisk. *„|ƒ|ƒ|ƒ|„|?*„|ƒ|ƒ|ƒ|„----------------1=IBMformat;0=Motorolaformat.*„|ƒ|ƒ|ƒ|™(mustalwaysbeIBM)>*„|ƒ|ƒ|ƒ---------------------1=Rigiddisk;0=floppydisk.*„|ƒ|ƒ|G*„|ƒ|ƒ-------------------------1=Doubledata-density(MFM)ondrive.*„|ƒ|¡(notused)D*„|ƒ-----------------------------1=Doubletrack-densityondrive.*„|¥(notused)C*„---------------------------------1=SeekrequiredonSMDdrive.PAGE¦(notused)A*ˆThisdrivercommunicatescommandstotheVME320diskcontrollerC*‚boardthroughan‚EventControlArea‚(ECA).ƒThereisoneECAblockE*‚allocated‚perpossibledriveonthecontrollerboard.‚TheformatofA*‚ECAisshowninthefollowingdiagram.ƒA‚description‚of‚all‚the**‚parameterswithintheECAblockfollows. * *¡ECAFORMAT* *‰Bit15°Bit0?*ˆ+-----------------------------+-----------------------------+$*‚$0ƒ|ˆCommandCode‰|‰MainStatus‰|?*ˆ+-----------------------------+-----------------------------+*‚$2ƒ|•ExtendedStatus—|?*ˆ+-----------------------------+-----------------------------+>*‚$4ƒ|‚MaximumNumberofRetries‚|‚ActualNumberofRetriesƒ|?*ˆ+-----------------------------+-----------------------------+$*‚$6ƒ|‰DMATypeŒ|‡CommandOptions‡|?*ˆ+-----------------------------+-----------------------------+%*‚$8ƒ|“BufferAddress(upperword)|?*ˆ+-----------------------------+-----------------------------+%*‚$Aƒ|“BufferAddress(lowerword)|?*ˆ+-----------------------------+-----------------------------+!*‚$Cƒ|“BufferLengthRequested‘|?*ˆ+-----------------------------+-----------------------------+,*‚$Eƒ|ŽActualNumberofBytesTransferred‹|?*ˆ+-----------------------------+-----------------------------+*‚$10ƒ|–CylinderNumber–|?*ˆ+-----------------------------+-----------------------------+0*‚$12ƒ|„HeadorSurfaceNumberƒ|‡SectorNumber‰|?*ˆ+-----------------------------+-----------------------------+#*‚$14ƒ|‘CurrentCylinderPosition‘|?*ˆ+-----------------------------+-----------------------------+*‚$16ƒ|™Reservedš|?*ˆ+-----------------------------+-----------------------------+*‚$18ƒ|™Reservedš|?*ˆ+-----------------------------+-----------------------------+*‚$1Aƒ|™Reservedš|?*ˆ+-----------------------------+-----------------------------+*‚$1Cƒ|™Reservedš|?*ˆ+-----------------------------+-----------------------------+*‚$1Eƒ|™Reservedš|?*ˆ+-----------------------------+-----------------------------+'*‚$20ƒ|‡N0-Reserved‰|ˆN1-Reservedˆ|?*ˆ+-----------------------------+-----------------------------+'*‚$22ƒ|‡N2-Reserved‰|ˆN3-Reservedˆ|?*ˆ+-----------------------------+-----------------------------+,*‚$24ƒ|†N4-Post-DataGap…|ˆN5-Reservedˆ|?*ˆ+-----------------------------+-----------------------------+(*‚$26ƒ|†SectorLengthCode…|‹FillByte‰|?*ˆ+-----------------------------+-----------------------------+ PAGE **œECAFORMAT(continued)**‰Bit15°Bit0?*ˆ+-----------------------------+-----------------------------+*‚$28ƒ|™Reservedš|?*ˆ+-----------------------------+-----------------------------+*‚$2Aƒ|™Reservedš|?*ˆ+-----------------------------+-----------------------------+*‚$2Cƒ|™Reservedš|?*ˆ+-----------------------------+-----------------------------+)*‚$2Eƒ|ŠDriveType‰|…NumberofSurfaces†|?*ˆ+-----------------------------+-----------------D ------------+1*‚$30ƒ|„NumberofSectors/Track‚|ˆSteppingRateˆ|?*ˆ+-----------------------------+-----------------------------+-*‚$32ƒ|†HeadSettlingTime…|‡HeadLoadTimeˆ|?*ˆ+-----------------------------+-----------------------------+-*‚$34ƒ|‰SeekType‹|ƒReservedforControllerƒ|?*ˆ+-----------------------------+-----------------------------+**‚$36ƒ|LowWriteCurrentBoundaryTrackŽ|?*ˆ+-----------------------------------------------------------+(*‚$38ƒ|ŽPrecompensationBoundaryTrack|?*ˆ+-----------------------------------------------------------+*‚$3Aƒ|—ECCRemainder—|?*ˆ+-----------------------------------------------------------+*‚$3Cƒ|—ECCRemainder—|?*ˆ+-----------------------------------------------------------+*‚$3Eƒ|—ECCRemainder—|?*ˆ+-----------------------------------------------------------+(*‚$40ƒ|ŽAppendECCRemainderfromDisk|?*ˆ+-----------------------------------------------------------+(*‚$42ƒ|ŽAppendECCRemainderfromDisk|?*ˆ+-----------------------------------------------------------+(*‚$44ƒ|ŽAppendECCRemainderfromDisk|?*ˆ+-----------------------------------------------------------+*‚$46ƒ|™Reservedš|?*ˆ+-----------------------------------------------------------+*‚$48ƒ|™Reservedš|?*ˆ+-----------------------------------------------------------+*‚$4Aƒ|”VME320WorkingArea”|?*ˆ+-----------------------------------------------------------+*‚$4Cƒ|”VME320WorkingArea”|?*ˆ+-----------------------------------------------------------+*‚$4Eƒ|”VME320WorkingArea”|?*ˆ+-----------------------------------------------------------+*‚$50ƒ|”VME320WorkingArea”|?*ˆ+-----------------------------------------------------------+*‚$52ƒ|”VME320WorkingArea”|?*ˆ+-----------------------------------------------------------+*‚$54ƒ|”VME320WorkingArea”|?*ˆ+-----------------------------------------------------------+%*‚$56ƒ|ReservedfortheController|?*ˆ+-----------------------------------------------------------+ PAGE*6*‚Thefollowingsectiondefinesthevariablesthatare-*‚containedintheVME320EventControlArea:* ‰OFFSET„04CMDCODE‚DS.B†1•TheCMDCODEfieldoftheECAcontains(*¦thecommandcodethattellstheVME320*¦whatoperationtoperform. #READ…EQU‡5“VME320readƒcommandcode%WRITE„EQU‡6“VME320write‚commandcode%FRMT…EQU‡7“VME320formatcommandcode#SEEK…EQU‡0“VME320seekƒcommandcode 4MAINSTATDS.B†1•TheMAINSTATfieldoftheECAisset%*¦bytheVME320andcontainsthemain'*¦statusvalueaboutcommandexecution.)*¦ThevaluesforMAINSTATcanbefoundin'*¦theerrorcodetableinthisdriver's*¦interrupthandler. 2EXTSTAT‚DS.W†1•TheEXTSTATfieldoftheECAisset%*¦bytheVME320andcontainsthebit-)*¦orientedstatusaboutcommandexection. 6MAXRETRYDS.B†1•TheMAXRETRYfieldoftheECAcontains#*¦themaximumnumberofretriesPER(*¦COMMANDthattheVME320shouldattempt'*¦afteradiskoperationerror.‚Zeroin"*¦thisfieldindicatesnoretries. 0RETRY„EQU‡10’TherecommendedvalueforMAXRETRY.5MINTRYƒEQU‡1“Minimumretrycounttovalidatesectors. 4ACTRETRYDS.B†1•TheACTRETRYfieldoftheECAisset'*¦bytheVME320andcontainstheactual)*¦numberofretriesexecutedPERCOMMAND. 4DMATYPE‚DS.B†1•TheDMATYPEfieldoftheECAcontains'*¦avaluerepresentingtheDMAtransfer(*¦modeofoperation-holdingthebusor*¦releasingthebus. +DMA†EQU‡0•ThisvalueenteredintheDMATYPE'*¦fieldallowstheusertofreethebus(*¦betweentwo-wordtransfers.‚Anon-zero(*¦valuewouldallowtheusertokeepthe*¦busforupto200usec. 2CMDOPTƒDS.B†1•TheCMDOPTfieldoftheECAcontains**¦optionsapplicabletoreadcommandswhen&*¦handlingdeleteddataaddressmarks.‰PAGE/OPT0…EQU‡0•ThisbitintheCMDOPTfielddefines&*¦thehandlingofdeleteddataaddress&*¦marks.A'0'inthisfieldskipsthe)*¦sectorwithadeleteddataaddressmark'*¦asifitdidnotexist.A'1'D inthis%*¦fieldtransfersthesectorwiththe)*¦deleteddataaddressmarkregardlessof&*¦theCRC/ECCcheckandterminatesthe *¦operation. /OPT2…EQU‡2•ThisbitintheCMDOPTfieldenables&*¦automaticerrorcorrection.A'1'in)*¦thisfieldusestheECAremainderfield)*¦intheECAandcorrectsthedatainthe#*¦VME320internalmemory.Theerror)*¦correctionvectorandrelativeposition$*¦aresavedintheECAworkingarea. >OPT†EQU‡0<FORMSIZEEQU‡EQ070/PAGESIZE†memoryforawritebufferrequired$*¦forformattracksontheVME320.4 *¦bytespersectorpertrackare'*¦requiredforfloppiesand5bytesfor *¦harddisks. PAGE* *ˆVME320Memory-mappedI/OSpace* 1‰OFFSETƒ-13”ThisOFFSETblockdefinesthememory-(*¦mappedI/OspaceforaVME320channel.(*¦TheVME320drivercommunicatesthrough%*¦thismemory-mappedI/Ospacetothe'*¦VME320diskcontroller.Anegative13&*¦offsetisusedduetothecontroller)*¦statusregisterbeing13bytesfromthe'*¦startofthememory-mappedI/Ospace. +‰DS.B†1•Theone-byteregistersECA0through1ECA0…DS.B†1“ECA3areread/writeregistersusedto*‰DS.B†1“communicatetheaddressoftheECA(ECA1…DS.B†6“PointerTabletotheVME320. /VECTORƒDS.B†1•Theone-byteregisterVECTORisa-‰DS.B†1“read/writeregistersetbythedriver)*¦tocontaintheinterruptvectornumber. /SOURCEƒDS.B†1•Theone-byteregisterSOURCEisa-‰DS.B†1“read/writeregistersetbytheVME320"*¦atinterruptacknowledgetimeto'*¦identifywhichdriveisthesourceof*¦theinterrupt. **ˆInterrupt'SOURCE'Register* *„7ƒ6ƒ5ƒ4„3ƒ2ƒ1ƒ0$*‚+---+---+---+---++---+---+---+---+*‚|ƒ|‡|ƒ||ƒ|ƒ|ƒ|ƒ|$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|%*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=Notdefined.*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|'*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=Notdefined. *„|ƒ|ƒ|ƒ|„|ƒ|)*„|ƒ|ƒ|ƒ|„|ƒ------------1=Notdefined. *„|ƒ|ƒ|ƒ|„|+*„|ƒ|ƒ|ƒ|„----------------1=Notdefined. *„|ƒ|ƒ|ƒ|;*„|ƒ|ƒ|ƒ---------------------1=Drive0SourceInterrupt.*„|ƒ|ƒ|=*„|ƒ|ƒ-------------------------1=Drive1SourceInterrupt.*„|ƒ|?*„|ƒ-----------------------------1=Drive2SourceInterrupt.*„|A*„---------------------------------1=Drive3SourceInterrupt.* PAGE /STATUSƒDS.B†1•Theone-byteregisterSTATUSisa(*¦read/writeregisterusedbythedriver%*¦toissueacommandtotheVME320by!*¦settingthebitintheregister"*¦correspondingtothedrivewe're*¦processingthecommandfor. %*¨Thisdriverusescommandqueueing-"*¦itallowsonlyonecommandtobe)*¦processedbythecontrolleratoE netime'*¦andmaintainsaqueueforanypending&*¦commandsreceivedfromtheoperating *¦system. **ˆDriveBusy'STATUS'Register* *„7ƒ6ƒ5ƒ4„3ƒ2ƒ1ƒ0$*‚+---+---+---+---++---+---+---+---+*‚|ƒ|‡|ƒ||ƒ|ƒ|ƒ|ƒ|$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|%*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=Notdefined.*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|'*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=Notdefined. *„|ƒ|ƒ|ƒ|„|ƒ|)*„|ƒ|ƒ|ƒ|„|ƒ------------1=Notdefined. *„|ƒ|ƒ|ƒ|„|+*„|ƒ|ƒ|ƒ|„----------------1=Notdefined. *„|ƒ|ƒ|ƒ|/*„|ƒ|ƒ|ƒ---------------------1=Drive0Busy.*„|ƒ|ƒ|1*„|ƒ|ƒ-------------------------1=Drive1Busy.*„|ƒ|3*„|ƒ-----------------------------1=Drive2Busy.*„|5*„---------------------------------1=Drive3Busy.*‰PAGEO********************************************************************************1*ˆSERVICEVECTORTABLE,PARAMETERS,REVISIONINFO*@*ˆThefirst‚several‚locationsofevery‚I/OdrivermustcontainaB*ˆservicevectortabletocontainthe‚long-wordrelativeaddressesB*ˆofthethreedriversubroutinesthatCMRuses.‚TheCMRparameterC*ˆtableimmediatelyfollowstheservicevectortableandincludesaA*ˆfieldtelling‚CMR‚howmanyextrapages‚toallocatefortheCCB.E*ˆTherevisiontableimmediatelyfollowsthetheCMRparametertable.*O*******************************************************************************O******************************************************************************* ‰SECTION‚0 M320DRV: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!* <‰DC.L…INTERUPT-M320DRV…Addressofinterruptserviceroutine.:‰DC.L…COMMANDS-M320DRV…Addressofcommandserviceroutine.5‰DC.L…INIT-M320DRV‰Addressofinitializationroutine.‰DC.L…0”Reserved. **‚OtherCMRparameters.*3‰DC.B…EXTCCBSZ#ofextrapagesintheCCB.‚TheCCB(*§maybeanysizefrom1to256pages(a&*§pageis256bytes):‚ifthisfieldis*§0,itwillbe1page,etc.‰DC.B…0,0,0Reserved.‰DC.L…0,0,0Reserved. **‚Revisioninfo:*/‰DC.B…'012386'DateoflastassemblyasMMDDYY.1‰DC.B…''’Spaceindicatesnopatchesto.LOfile.)‰DC.B…'4'’MajorVERSAdosrevisionnumber.‰PAGEO********************************************************************************7*ˆJumptableforusebythegenericdiskdriverDISKLIB*O******************************************************************************* ‰BRA.L„SET_CNFG‰BRA.L„SET_CODE‰BRA.L„CHK_FLOPPY‰BRA.L„CHK_LSN‰BRA.L„BLD_PACKET‰BRA.L„DISK_START‰BRA.L„CHK_PARAM‰PAGEO*******************************************************************************O*********************************************************************************ˆINITIALIZATIONROUTINE*B*ˆThis‚subroutineiscalledfromCMR‚whenCMRisinvokedbyataskB*ˆ(normallyIOI)to‚allocateachannel.‚ItspurposeistogivetheD*ˆdriverachancetosetupthingsforcommandserviceandinterrupt-*ˆservice.‚Thebasicfunctionsperformedare:*5*ˆ1.‚PutthestartaddressofthedriverintotheCCB*ŒvariableDRV_ADDR.2*ˆ2.‚Putthetotalnumberofdrivesonourchannel!*ŒintotheCCBvariableMAX_DRVS.8*ˆ3.‚Putthesizeinbytesofthedrive'svariableblock!*ŒintotheCCBvariableDRV_SIZE.?*ˆ4.‚Device-IndependentinitializationinthecalltoDISK_INIT"*ŽtoinitializetheCCBvariables.?*ˆ5.‚Device-DependentinitializationinthecalltoDO_INITfor"*Ždevicedependentinitialization.*B*ˆThissubroutineisenteredthroughaJSRfromCMR,andwillexit7*ˆwithanRTS.‚Theprocessorisinthesupervisormode.*%*ˆEntry:„A6=physicaladdressofTCB*’A5=physicaladdressofCCB*5*ˆInterruptlevelis0.‚Registersmaybeusedfreely.*.*ˆRegistersusedinDISK_INIT:…01234567*¦D‚**¦A‚*‰P**ˆExitsto:CMRviaRTS*O**************************************************************F *****************O*******************************************************************************ŠPAGEINIT: *)*‚GetaddressofstartofdriverintoCCB*ŠLEA‡M320DRV(PC),A0ŠMOVE.L„A0,DRV_ADDR(A5)*9*‚GetthenumberofdrivessupportedbytheM320channel.*ŠMOVE.W„#DRIVES,MAX_DRVS(A5)*5*‚Getthesizeinbytesofthedrive'svariableblock*ŠMOVE.W„#DRVBLKSZ,DRV_SIZE(A5)*>*‚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*********************************************************************************ˆVME320INTERRUPTHANDLER*G*ˆControlcancometotheVME320interrupt‚handlerwhenCMRreceivesanH*ˆinterruptontheinterruptlevelthatisusedbytheVME320controllerF*ˆIfthe‚interruptisaVME320interrupt,theVME320‚interrupthandlerF*ˆsetstheCbitoftheSR,andlowersthe‚interruptmask‚levelbyone*ˆleveluponreturn.*?*ˆEntry:„A1=PhysicaladdressoftheVME320interrupthandler.#*’A5=PhysicaladdressoftheCCB.3*’SR=MaskedattheleveloftheVME320interrupt.*O*******************************************************************************O*******************************************************************************  O********************************************************************************"*ˆVME320INTERRUPTPOLLINGROUTINE*%*ˆEntry:„A5=physicaladdressofCCB*/*ˆRegisterUsage:D0,A0bothsavedbytheexec.*1*ˆFunction:Determineiftheinterruptifforme.*>*ˆExit:…ReturntoCMRviaRTSifitISNOTaVME320interrupt.0*’BranchtoM320INTifitISaVME320interrupt.*O******************************************************************************* INTERUPT:7‰MOVE.L„CCBCHB(A5),A0‰Getthememory-mappedI/Oaddress0‰MOVEQ.Lƒ#7,D0oftheVME320andtesttheSOURCE@INT100ƒBTST†D0,SOURCE(A0)‡registertodeterminewhichdrivesent2‰BNE‡M320INTtheinterrupt.Ifnoneofthebitsin7‰DBRA†D0,INT100‹SOURCEareset,disclaimtheinterrupt.  *¦THEINTERRUPTISNOTFORMECLEAR„EQU‡0<<0‰AND.B…#CLEAR,CCR‰RTS PAGEO********************************************************************************%*ˆVME320INTERRUPTCO-ROUTINELINKAGE*C*ˆControlreachesthispointwhenwe'vesuccessfullyidentifiedthe@*ˆinterruptasaVME320interrupt‚ORƒthisroutineiscalledasa(*ˆsubroutinefromthecommanF dprocessor.*7*ˆTheinterruptlevelismaskedatourchannel'slevel.*?*ˆEntry:„A0=PhysicaladdressofVME320Memory-MappedI/Oarea*’A5=PhysicaladdressofCCB*!*ˆRegisterusage:…01234567'*™D‚*####=Savedtouseasworking%*™A‚PRR##Pregistersthroughout.*"*ˆExit:…Jumptoco-routinesegment*O******************************************************************************* *¦THEINTERRUPTISFORMECM320INT‚BCLR…D0,STATUS(A0)ˆCleartheinterruptbyclearingbusybit1‰SUBQ.Lƒ#4,D0D0isnowequaltothedrivenumber /INTLOOP‚EQU‡*“I'MHEREFROMTHECOMMANDHANDLER9‰MOVE.WƒCCBSR(A5),SR‹Enable68000interruptsatourlevel'*¦sothatotherinterruptsatourlevel'*¦won'tbedelayedwhileweprocessour *¦interrupt. ‰MOVE.BƒDRIVENUM(A1),D2†variableblock.Copyittotheworking2‰MOVE.LƒD2,D1registerandmulitplybyfourtouse0‰MULU…#4,D1asanoffsettohaveA2pointtothe>‰MOVE.LƒECATABLE(A5),A2†ECApacketforthedrivenumberweare9‰MOVE.Lƒ(A2,D1),A2‹handling:commandsetuporcompletion. 5‰GET_ON_BDA2’CallthemacrotoadjusttheECApacket,‰RTS›addressfordualportedramandreturn. PAGEO*********************************************************************************ˆPROCESSNEXTCOMMAND*G*ˆControlcomestothisco-routinesegmenttoprocessthenextcommand.C*ˆSometimeswe'rerequiredtodoalittlehousekeepingbasedonthe$*ˆtypeofcommandanddatatransfer.*?*ˆEntry:„A0=PhysicaladdressofVME320Memory-MappedI/Oarea9*’A1=Pointertodrive'svariableblockinglobalmemory#*’A2=Pointertodrive'sECAblock*’A5=PhysicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPP…P**ˆExit:…BSRtoINTRTN*O******************************************************************************* /PROCNEXTTST.L„HALFSCTS(A1)‰Testthedatatype.5‰IFTHEN’Ifwehavedonetrack0onaDDfloppy,‰MOVE.Lƒ#FRMT_DD,D2Š*-‰MOVE.BƒD2,N4(A2)ŒRestoreN4inthECAblock.‰MOVE.LƒFORMATD(PC),D2‡*4‰MOVE.WƒD2,SLC(A2)‹RestoretheSLCintheECAblock.8‰MOVE.BƒDRIVTYPE(A1),DRVTYPE(A2)Restorethedrivetype.,‰CLR.L„HALFSCTS(A1)‰CleartheHALFSCTSflag.‰ENDI 6‰MOVE.LƒIOSECTOR(A1),D0†Getthelogicalsectornumber.7‰BSR.L„FILLCHSŽFillcylinder-head-sectorfieldsinECA. :‰CMP.B„#FMTFUNC,IOFUNCT(A1)Ifthisistheformatcommand, ‰IFTHEN6‰BSR.L„BLDBUFFŽBuild/Setthebufferfieldsforformat.‰ELSE6‰BSR.L„CHS2BUFŽSetthebufferfieldsforread&write.‰ENDI CPROCQUE‚CLR.B„RETRY_FLAG(A5)‡Cleartheretry_flagforeachcommand.3‰CLR.B„RETRY_COUNT(A5)†Settheretry_counttozero. 9RESENDƒBSR†GET_ADDRGetthedrivenumberandECAaddress.>‰MOVE.Bƒ#$07,MAINSTAT(A2)„Setthemainstatusbytebusy,clear=‰MOVE.Wƒ#0,NUMBYTE(A2)‡numberofbytestransferredfromlast.2‰ADDQ.Lƒ#4,D2Fixdrivenumbertoequalbitnumber *¦tosetintheSTATUSregister. ;‰BSET…D2,STATUS(A0)ˆTellthecontrollertoprocesscommand! ;INTNEXT‚BSR.L„INTRTN‘TheVME320controllerneedstimetodo**¦itsjobsoreturncontroltothesystem.)*¦WhentheVME320controllerhasfinished$*¦itscurrenttask,we'llreceivean&*¦interruptthatwillcausecontrolto*¦comebackhere. PAGEO*********************************************************************************ˆTHEINTERRUPTENTERSG HERE*@*ˆControlcomestothisco-routinesegmentwhenwe'vereceiveda>*ˆcommandcompletioninterrupt.‚Weneedtocheckthestatusof>*ˆcommand.Ifanerroroccuredweexittoprocessit.‚IfthereC*ˆismoretodobeforethiscommandistotallyfinished,webranch*ˆtofinishit.*O******************************************************************************* 7‰TST.B„RETRY_FLAG(A5)‰Testtheretryflag,Ifthen6‰BNE.L„CHECKRETRY‹thiscommandcompletionwasduetoa'*¦driverretryandtheoriginalcommand*¦mustbere-issued. ;‰MOVE.BƒMAINSTAT(A2),D0ˆGetthestatusbitsfromtheVME3207‰BNE.L„CHECKERRcontroller'sstatusbyteintoD0.B,and(*¦reportanerrorifthestatusbitsare&*¦nonzero.‚Astatusbitthatissetin(*¦thecontroller'sstatusbyteindicates *¦anerror. *A*ˆIfthemainstatusiszerobuttheextendedstatusisnotzero,* ˆIF.WEXTSTAT(A2)#0THEN.S5ŠMOVE.Lƒ#1,D0Makeitlooklikewegoterrorcode01.%ŠBRA.L„CHECKERRŒBranchtodoretries.ˆENDI*=*ˆForreadandwritecommands,checkthatthenumberofbytes3*ˆtransferredequalsthenumberofbytesrequested.*@ˆIF.BCMDCODE(A2)#READOR.BCMDCODE(A2)#WRITETHEN.S ‰MOVE.WNUMBYTE(A2),D1‰IF.WBUFLEN(A2)D1THEN.S5ŠMOVE.Lƒ#1,D0Makeitlooklikewegoterrorcode01.%ŠBRA.L„CHECKERRŒBranchtodoretries.‰ENDIˆENDI*=*ˆForreadcommands,checkthe6-byteECCremainderforzero.*#ˆIF.BCMDCODE(A2)#READTHEN.S 3‰IF.LECC(A2)#0OR.WECC+4(A2)#0THEN.S5ŠMOVE.Lƒ#1,D0Makeitlooklikewegoterrorcode01.%ŠBRA.S„CHECKERRŒBranchtodoretries.‰ENDIˆENDI PAGE6‰MOVEQIƒISTACFG,D1IftheNOFINISHflagisnonzero,we8‰TST.B„NOFINISH(A1)‰returnastatuscodeindicatingthat2‰BNE†V320DONEtheactualconfigurationofthedisc(*¦doesn'tmatchtheconfigurationinthe%*¦currentconfigurationblock.‚AnI/O)*¦operationfailedtofinishproperly,so&*¦thesectorsizeonthediscprobably&*¦doesn'tmatchthesectorsizeinthe*¦configurationblock. :‰TST.L„IOSCTCNT(A1)‹TheVME320controllerhassuccessfully2‰BNE†PROCNEXTcompletedtheentireI/Otransaction(*¦thatwasspecifiedbythelastcommand(*¦sequencethatwegaveit.‚Ifthereare&*¦anybytesremainingtobeprocessed,'*¦loopbacktoprocessanotherchunkof*¦theentireI/Otransfer. 9‰MOVE.BƒEOVFLAG(A1),D1‰We'venowcompletedtheentireI/O'*¦transactionthatwasspecifiedbythe$*¦commandthatgeneratedthecurrent%*¦entryoftheI/Oqueue.‚TheEOVFLAG)*¦valuethatwegetherewillbereturned'*¦totheuserasanI/Ostatuscode.If)*¦theI/Otransferwastruncatedtoavoid)*¦runningbeyondtheendofthedisk,the'*¦codeisISTAEOV.Otherwise,wereturn*¦theISTAOKstatuscode. PAGE O*********************************************************************************ˆFINISHPROCESSINGQUEUEENTRY*D*ˆControlcomes‚tothetop‚ofthis‚co-routinewhentheVME320driverC*ˆisreadytofinish‚processing‚thecurrententryofthe‚I/Oqueue.E*ˆEitherwe'vecompletedtheI/OtransactionthatisspecifiedbytheC*ˆcurrententryofthe‚queue,orelsewe've‚runintosomeunreason-G*ˆableproblemthatwecan'tsolve.We'llqueueanI/OcompletioneventC*ˆtotheattachedtask,andwe'll‚removethe‚currententryfromtheD*ˆI/Oqueue.‚IftheI/Oqueuehasanotherentry,we'llloopbackand*ˆstartprocessingit.*?*ˆEntry:„A0=PhysicaladdressofVME320Memory-MappedI/Oarea9*’A1=Pointertodrive'svariableblockinglobalmemory#*’A2=Pointertodrive'sECAblock*’A5=PhysicaladdressofCCB*D1.B=statusvalue*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*3*ˆExitsto:‚IDLELOOProutineifI/Oqueueisempty.4*“PROCQUEiftheI/Oqueuecontainsanactiveentry.*O******************************************************************************* V320DONEEQU†*>‰CMP.B„#FMTFUNC,IOG FUNCT(A1)‚Ifthiswasaformatcommand,take2‰IFTHEN’thisturnofftosubroutineMEMRTNto3ŠBSR.L‚MEMRTNreturnthesegmentofmemoryallocate‰ENDIšfortheformatbuffer. ‰JSR†CHAN_DONE 6EQ170„REG†A1/A3/A4HereweremovethefrontentryfromE‰MOVEM.L‚IOQUEUE+4(A5),EQ170‚theI/Oqueue,andwesetA1topointtoB‰MOVEM.L‚EQ170,IOQUEUE(A5)„thedriveblockforthediskdrivethat&*¦isassociatedwiththenext(ifany)*¦entryoftheI/Oqueue. 7‰SUB.W„#4,IOQCNT(A5)ŠReducethequeue-countpointerand5‰BHI†PROCQUEŽloopbackifnextentryisstillactive. PAGEO*********************************************************************************ˆIDLELOOPROUTINE*G*ˆThisroutineisenteredwhenthecontrolleriscaughtupwithalltheF*ˆworkandthecontrollerisidle.‚We'llreturncontroltothesystem.*?*ˆEntry:„A0=physicaladdressofVME320Memory-MappedI/Oarea*’A5=physicaladdressofCCB*3*ˆExit:…BSRtoINTRTN.‚Itshouldneverreturnhere.*O******************************************************************************* 5IDLELOOPBSR‡INTRTNTheI/Oisalldone,sowereturn*¦controltothesystem. O********************************************************************************2*ˆModifiedtorunwithspuriousinterruptsƒ2/16/84*O******************************************************************************* BV320IDLEADD.B…#1,SPURINT(A5)ˆIfcontrolevergetshere,wehavea@‰CMP.B…#$80,SPURINT(A5)„SPURIOUSINTERRUPTANDWESIMPLYRETURN.2‰BNE‡IDLELOOPŒIfthenumberofspuriousinterrupts9‰ST.B†CHANDOWN(A5)ˆreaches$80,thensetthechanneldown/‰BRA‡IDLELOOPŒandreturntotheidleloopuntil*¦anothercommandgetsusout.*"*¦NOTE:$80isanarbitraryvalue.#*¬Chancesarethatifthenumberof"*¬spuriousinterruptsreachesthis *¬number,thediskcontrolleris *¬failing. PAGEO*********************************************************************************ˆINTERRUPT-RETURNROUTINE*G*ˆControlreachesthispointintheVME320interrupthandlerwhenwe'veC*ˆfinishedexectutingaco-routinesegment‚andwewishto‚returntoC*ˆthesystem.‚Wereturn‚controltothesystemwheneverwemustwaitB*ˆonacontroller‚activity,‚andwedependonan‚interrupttobringC*ˆcontrolbacktouswhenthecontrollerhasfinisheditsactivity.*B*ˆWerestore‚theregistersthatweresavedatthebeginningoftheC*ˆinterrupthandler,settheSR,andsettheC-bittoindicatethat(*ˆwe'veprocessedtheinterruptforCMR.*?*ˆEntry:„A0=physicaladdressofVME320Memory-MappedI/Oarea*’A5=physicaladdressofCCB**ˆExit:…ReturntoCMRviaRTS*O******************************************************************************* FINTRTNƒMOVE.Lƒ(SP)+,INTSWTCH(A5)…Thisroutineiscalledasanordinary'*¦subroutine,sothestackcontainsthe(*¦addressoftheco-routinesegmentthat'*¦shouldbeexecutedinresponsetothe%*¦nextinterrupt.‚Wegetthataddress&*¦outofthestack,andweputitinto*¦theinterruptswitch. <‰MOVEM.L‚(SP)+,RTSREGSŠRestoretheregistersthatweresaved1CARRY„EQU†1<<0‘inINTERUPT,settheSR.Cbit,and4‰OR.B…#CARRY,CCR‹retruntoCMR.‚SettingtheSR.Cbit)‰RTS›indicatesthatwehaveprocessedthe *¦interrupt. *¨Noticethatwedon'traisethe(*¦interruptmasklevel,sotheinterrupt'*¦masklevelisonelevellowerthanit'*¦waswhentheVME320interrupthandler*¦wasinvoked. PAGEO*********************************************************************************ˆVME320ERRORHANDLINGROUTINE*B*ˆThisroutineisexecutedwhenthemainstatusbyteoftheECAisB*ˆNOTzeroafteracommandcompletioninterrupt,andalsowhenthe?*ˆcommandcompletionwasduetoourownretry.‚HerewesavetheB*ˆcommandcode,statusbytesandnumberofcontrollerretriesfromA*ˆthecommandthathadtheerrorintheCCB.‚HerewealsoperformD*ˆdriverretriesforcertainerrorcodes.AnotherimportantfunctionC*ˆofthisroutineistogettheH VERSAdoserrorcodefromtheVME320C*ˆerrorcode,andcomputetheVERSAdossectornumberfromtheerror *ˆsectornumber(whenrequired).***ˆEntry:„A2ƒ=Pointertodrive'sECAblock*’A5ƒ=PhysicaladdressofCCB$*’D0.B=MainstatusfromECApacket*!*ˆRegisterusage:…01234567 *™D‚*R*R*™A†P…P*"*ˆExit:„D1.B=VERSAdoserrorcode*‘D3.L=VERSAdossectornumber*O******************************************************************************* CHECKRETRY:*@*ˆWhenarecalibratecommandcompletessuccessfullyaspartofa>*ˆdriverretry,cleartheretry_flagandre-issuetheoriginal *ˆcommand.*(‰SFˆRETRY_FLAG(A5)Setretry_flagfalse.*‰MOVE.L„#0,CMDCODE(A2)Clearstatusbytes.=‰MOVE.B„SAVECMD(A5),CMDCODE(A2)‡Setcommandcodetooriginal.!‰BRA‡RESEND˜Re-issuethecommand.‰PAGE CHECKERR:B‰IF.BD0#ERRCENDTHEN.S‚Iftheerrorcodereturnedisoneof2ŠMOVE.Bƒ#ISTAICE,D1‰theundefinederrorcodesthen-ŠBRA.L„CHK_ENDreturnthegeneralerrorcode.‰ENDI F‰IF.B#CNFGFUNCIOFUNCT(A1)THEN.S‚Ifthisisaconfigurecommand0ŠMOVEQ„#0,D1thendon'treturnanyerrorcode---ŠBRA.L„CHK_ENDreturnasifnoerroroccured.‰ENDI 2‰BTSTW…#IOPRTYB,IOOPTS(A1)Testretryoptionsbit.0‰IFƒTHEN.SŽIfset,don'tdodriverretries. :‹IF.B‚D0#1‚THEN.S„Ifit'sanon-recoverableerror...:BSR.LEXTEND_STATUS‡Usetheextendedstatustoreportthe1BRA.LREPORT10ŒmostcorrectVERSAdoserrorcode. (‹ELSE.S–Notthenon-recoverableerror...+BRA†REPORT_ERROR…Goreporttheerrorcode. ‹ENDI ‰ENDI‰PAGE‰IF.BD0#1THEN.S*9*ˆFornonrecoverableerrors,arecalibrateandare-issue;*ˆofthecommandmaygetridoftheerror.‚Whenanerroris9*ˆdetected,wesettheretry_flagandissuearecalibrate9*ˆcommandtothecontroller.‚Whenwereturn,weclearthe>*ˆretry_flagandre-issuetheoriginalcommand.‚Thisprocedure=*ˆisrepeateduntilthecommandissuccessfullycompleted,or=*ˆthemaximumretrycountisreached,atwhichtimetheerror*ˆisreported.*#‰IF.BRETRY_FLAG(A5)#0THEN.S -ŒWHILE.BRETRY_COUNT(A5)#MAX_COUNTDO.S 0ADD.B#1,RETRY_COUNT(A5)ŒIncrementretry_count.6MOVE.BCMDCODE(A2),SAVECMD(A5)†Savethecommandcode.1MOVE.L#0,CMDCODE(A2)Setcommandcodetorecal.'ST…RETRY_FLAG(A5)Setretry_flagtrue. BRA„RESEND—Issuearecalibrate. ŒENDW ‰ELSE.S -ŒWHILE.BRETRY_COUNT(A5)#MAX_COUNTDO.S 5ADD.B‚#1,RETRY_COUNT(A5)‹Addonetotheretry_count..MOVE.L#0,CMDCODE(A2)Tryseekcommandagain. BRAƒRESEND ŒENDW‰ENDI*C*ˆUsetheextendedstatustoreportthemostcorrectVERSAdoserror"*ˆcodeformainstatus=$01only.*2ŒBSR†EXTEND_STATUS…ConverttoVERSAdoserrorcode./ŒBRA†REPORT10ŠBranchtofinisherrorreporting. ‰ENDI‰PAGE)‰IF.BD0#07OR.BD0#09THEN.S*:*ˆForerrorcodes07(busy)and09(DMAerror),are-issue;*ˆofthecommandmaygetridoftheerror.‚Whenanerroris;*ˆdetected,wesettheretry_flagandre-issuetheoriginal:*ˆcommand.‚Thisprocedureisrepeateduntilthecommandis:*ˆissuccessfullycompleted,orthemaximumretrycountis<*ˆreached,atwhichtimetheerrorisreported.Weincrement.*ˆbytwosowedon'tendupdoingtenretries.* NNH NNNNN-ŠWHILE.BRETRY_COUNT(A5)#MAX_COUNTDO.S 5ŒADD.B‚#2,RETRY_COUNT(A5)‚Incrementretry_countby2.+ŒST…RETRY_FLAG(A5)†Settheretry_flagtrue.!ŒBRA„RESENDŽRe-issuethecommand. ‹ENDW‰ENDI ‰BRA.S…ENDTABLE O*********************************************************************************ˆVME320ERROR-CODETABLE*E*ˆThistabletranslatesVME320errorcodesintoVERSAdoserrorcodes.C*ˆTherearesomeerrorcodesdefinedbytheVME320controllerwhichC*ˆarenotimplementedinthefirmware(10/11/85).‚Thesearedefined*ˆbelowas#ISTAICE.*O*******************************************************************************  *§----‚VME320ErrorCode.*§|*§|%*§V…VME320DefinitionandExplanation "ERRCODE‚DC.B…ISTACNT‡$00„Noerror.7‰DC.B…ISTABDS‡$01„Nonrecoverableerror(driverretries)!‰DC.B…ISTANRˆ$02„Drivenotready.‰DC.B…ISTAICE‡$03„Reserved.:‰DC.B…ISTAICE‡$04„Invalidsectoraddress(notimplemented)7‰DC.B…ISTAICE‡$05„Floppydataoverrun„(notimplemented)9‰DC.B…ISTAWPˆ$06„Illegalcommand(usedforwriteprotect)!‰DC.B…ISTANRˆ$07„Controllerbusy.%‰DC.B…ISTANRˆ$08„Drivenotavailable.,‰DC.B…ISTABUS‡$09„DMAerror(driverretries)‰DC.B…ISTANRˆ$0A„Commandabort. AERRCEND‚EQU†*-ERRCODE…Errorcodes$0Bthrough$FFarereportedas0*Ÿ"ISTAICE".Thesecodesarecurrentlyundefined * bytheVME320diskcontroller.ENDTABLEDS.W…0 PAGE REPORT_ERROR:=‰MOVE.BƒERRCODE(PC,D0),D1†Translatethemainstatusbyteinto(*¦aVERSAdoserrorcodeusingtheVME320*¦ERRORCODETABLE. REPORT10:D‰MOVE.L‚CMDCODE(A2),SAVECMD(A5)Savethecommandcode,statusbytes,D‰MOVE.B‚ACTRETRY(A2),RECNT(A5)‚andnumberoff/wretriesintheCCB.  /‰MOVEQ.L‚#0,D3’Usingtheactualnumberofbytes<‰MOVE.WƒBUFLEN(A2),D3ˆtransferred,andknowingthebytesper;‰SUB.W„NUMBYTE(A2),D3‡sector,calculatewhichsectorofthe>‰SUB.L„D3,IOBUFPTR(A1)†transactionhadtheerrorandadditto6‰DIVU…BPS(A1),D3‹thestartingsectornumbertogetthe3‰MOVEQ.L‚#0,D2physicalsectornumber.‚SubtracttheNNI NNNNN2‰MOVE.WƒD3,D2numberofbytesNOTtransferredfrom?‰MOVE.LƒIOSECTOR(A1),D3†IOBUFPTRtocorrect#bytestransfered.NNNNNNN4  &6 .5 6= >> F@ N? V9 ^9 f8 n2 v3 ~ †> ŽA –> žA ¦9 ®9 ¶> ¾6 Æ; Î2 Ö  Þ æB î(+‰SUB.L„D2,D3D3<--logical'error'sector.,‰MOVE.LƒD3,D2D2<--logical'error'sector. B*ˆTheNUMBYTEfieldshowshowmanybytesinsectorincrementswereB*ˆsuccessfullytransferred.TheBUFLENfieldsshowshowmanybytes?*ˆwererequested.‚IOSECTORpointstothenextsectorthatwouldA*ˆbetransferrediteverythingwassuccessful.‚D2.Lissettothe<*ˆlogicalerrorsectorfortheCHAN_DONEroutineinDISKLIB.  CHK_END‚CLR.B„RETRY_FLAG(A5) ‰BRA†V320DONE PAGEO********************I ************************************************************"*ˆVME320EXTENDED-ERROR-CODETABLE*A*ˆThistabletranslatesVME320extendederrorcodesintoVERSAdos *ˆerrorcodes*O*******************************************************************************  * ----‚VME320ErrorCode.* |* |&* V…VME320DefinitionandExplanation. 9EXTCODE‚DC.B…ISTAUNR‡Bit0:‚Writefault(notimplemented),‰DC.B…ISTACRC‡Bit1:‚Correctabledataerror.2‰DC.B…ISTADOˆBit2:‚Dataoverrun(notimplemented))‰DC.B…ISTADME‡Bit3:‚Noidentifierfound.‰DC.B…ISTANRˆBit4:‚Notready.9‰DC.B…ISTADDM‡Bit5:‚Deleteddataaddressmark(notimpl)"‰DC.B…ISTAWPˆBit6:‚Writeprotect.'‰DC.B…ISTABDS‡Bit7:‚Positioningerror.9‰DC.B…ISTACRC‡Bit8:‚Dataparttimeout-SAMEASBIT1!!!8‰DC.B…ISTACNF‡Bit9:‚Diskformaterror(notimplemented)=‰DC.B…ISTACRC‡Bit10:UncorrectableECCdataerror(notimpl)9‰DC.B…ISTANRˆBit11:Commandstopordrivenotavailable.*‰DC.B…ISTACFG‡Bit12:Drivetyperejected.*‰DC.B…ISTABDS‡Bit13:Positioningtimeout.:‰DC.B…ISTADME‡Bit14:WrongID-DATA-IDsequence(notimpl)&‰DC.B…ISTABUS‡Bit15:Buserrorfault.‰DS.W…0 *C*ˆExtendedstatusprovidesusefulstatusfornonrecoverableerrors.*EXTEND_STATUS:0‰MOVE.WƒEXTSTAT(A2),D0‡Readtheextendedstatus. ‰IFTHEN5ŠMOVE.Lƒ#16,D2ŽWhenamorespecificcodeisspecified8CHK01…SUBQ.Lƒ#1,D2reportitinsteadofthegeneralcode4ŠROR.W„#1,D0inthemainstatusbyte.Sinceonlyone4ŠBCC.S„CHK01errorcodeisallowed,reportthefirst.ŠNEG.L„D2’onesetintheextendedstatuscode.ŠADD.L„#15,D2Ž*ŠMOVE.BƒEXTCODE(PC,D2),D1ƒ*‰ENDI‰RTS PAGEO*********************************************************************************ˆCONTROLLER-ERRORROUTINE*G*ˆControlcomestothis‚routinewhenwe'vedetectedacontrollererror.G*ˆWedeclareacontrollererrorwhenaVME320controllerdoessomethingF*ˆthatsimplycannotbeexplained‚byany‚definedsetofcircumstances.G*ˆWhenacontrollererroroccurs,we‚downtheVME320channelandreportF*ˆacontrollererror.‚Acontrollererrorisaseriousproblem,andthe?*ˆsystemshouldn'ttrytousetheVME320channelfollowingone.*A*ˆThereare‚twoentrypoints.‚Theentrypoint‚atCTRLERR1‚isusedD*ˆtheerrorisdetectedwithinasubroutine.‚TheentrypointCTRLERR*ˆisusedotherwise.*?*ˆEntry:„A0=PhysicaladdressofVME320Memory-MappedI/Oarea9*’A1=Pointertodrive'svariableblockinglobalmemory*’A5=PhysicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*>*ˆExitsto:‚V320DONEtoterminateprocessingfortheactivity.*O******************************************************************************* 7CTRLERR1ADDQ.Lƒ#4,SP’Controlcomestothisentrypoint%*¦whenacontrollererrorisdetected%*¦fromwithinasubroutine.‚Weremove&*¦thesubroutine'sreturnaddressfrom(*¦thestack,sothestackisrestoredto&*¦theconditionthatithadbeforethe*¦subroutinewascalled. 9CTRLERR‚ST.B…CHANDOWN(A5)‹Downthechannelbysettingthe"*¦variablethatindicatesthatthe#*¦controllerisdown.‚Ifthesystem**¦triestoaccesstheVME320channelagain#*¦withoutresettingitfirst,we'll%*¦reportanerrorindicatingthatthe$*¦channelisdown.‚Thesystemreally$*¦shouldn'ttrytoaccesstheVME320'*¦channelagainwithoutfirstresetting$*¦thecontroller.‚Evenresettingthe)*¦controllermaynotcorrecttheproblem,'*¦butwe'llletthesystemtryasoften*¦asitwishes. 5‰MOVEQIƒISTACNT,D1SetupD1.Bforreportingastatus4‰BRA†V320DONEcodethatindicatesacontrollererror%*¦andgoterminateprocessingforthe!*¦currententryoftheI/Oqueue. PAGEO********************************************************************************?*ˆTheseconstantsareusedbytheVME320driver.‚Constantswere>*ˆchosenoverequatessothedrivercouldbeeasilypatcJ hedto*ˆoptimizedriveoperation.*O******************************************************************************* =FORMATS‚DC.L†$1B0000E5FormatfieldsN4,N5,SLCandFILLBYTE#*¦forasingle-densityfloppydisk.*=FORMATD‚DC.L†$360001E5FormatfieldsN4,N5,SLCandFILLBYTE**¦fordouble-densityfloppyandharddisk.* A*ˆFloppydisksteppingratetableforfloppydisksasdefinedforL*‚VERSAdos4.3.‚Thevaluesbelowareinmilliseconds.‚ThisdrivertranslatesK*‚thesteppingratecodeintoamillisecondvalueusingthetablebelowforK*‚8"floppydiskdrivesanddoublesthevaluesbelowfor5-1/4"floppydisk *‚drives.* $*“8"…5-1/4"„UnitsƒSteppingRateCode%*’---…------„-----ƒ------------------ SRFCODE‚DC.B‡6ˆ12‡Msec„Default‰DC.B‡3ˆ06‡Msec„00‰DC.B‡6ˆ12‡Msec„01‰DC.B†10ˆ20‡Msec„10‰DC.B†15ˆ30‡Msec„11 *=*ˆHarddisksteppingratetableforharddisksasdefinedforL*‚VERSAdos4.4.Thevaluesbelowareinmilliseconds.‚ThisdrivertranslatesH*‚thesteppingratecodeintoamillisecondvalueusingthetablebelow.* *‘Hard†Units†SteppingRateCode*‘----†-----†------------------ SRHCODE‚DC.B‡5ˆMsec†Default‰DC.B‡6ˆMsec†00‰DC.B†10ˆMsec†01‰DC.B†15ˆMsec†10‰DC.B†20ˆMsec†11‰SPC5N*******************************************************************************"*ˆENDOFINTERRUPTSERVICEROUTINE*N******************************************************************************ŠPAGEN********************************************************************************!*ROUTINES„CALLED„BY**–DISKLIB**N******************************************************************************‰PAGEN*******************************************************************************)*ˆSET_CNFG…SETUPFORACONFIGURECOMMAND*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoD*ˆsetthefields'sinthedrive'svariableblock,device-independent#*ˆportion,foraconfigurecommand.**A*ˆEntry:A1=pointertoDrive'sVariableBlockinglobalmemory.#*A5=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D„R*™A„P‡P* *ˆCalls:none*/*ˆExit:‚RTStocallerwithconditioncodesset:7*‚Drive/controllersupportstheconfigurerequest.?*‚Drive/controllerdoesnotsupporttheconfigurerequest.4*•D1.B=VERSAdoserrorcodefortheerrordetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** SET_CNFG:*>*ˆTheVME320diskcontrollerdoesn'thaveaconfigurecommand,6*ˆthereforeitdoesnotrequireanyspecialvariables.*?‰CMP.BD0,D0‰CompareD0withitselftosatisfyconditioncodes.‰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:*@*ˆTheVME320doesn'thaveamedia/drivecontrollercode.‚Ituses@*ˆthreefieldstoaccomplishasimilarfunction:thedrivetype,?*ˆsectorlengthcode,andpost-datagap.‚ThesethreefieldsJ are'*ˆcalculatedintheBLD_PACKETroutine.*‰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****************************************************************************** CHK_FLOPPY:*?*ˆTheVME320isusedbyVERSAdostosupportonly128bytesasa>*ˆsingle-densityfloppydiskand256bytesasadouble-density<*ˆfloppydisk.‚TheVME320statesthatothercombinationsare=*ˆpossible,butwedon'tusethemandwehaven'ttestedthem,E*ˆsowedon'tlimittheuserbyreturninganerrorfromthisroutine.*?‰CMP.BD0,D0‰CompareD0withitselftosatisfyconditioncodes.‰RTS‰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:*=*ˆTheVME320doesnotperformdatatransfersbasedonlogical<*ˆsectornumbers.‚Itusescylinder,head,andsectornumbers6*ˆtolocatelogicalsectors,andisnotlimitedtoany*ˆmaximumsectornumber.*?‰CMP.BD0,D0‰CompareD0withitselftosatisfyconditioncodes.‰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‚*R* *™A‚*P*…P* *ˆCalls:„none*/*ˆExit:‚RTStocallerwithconditioncodesset:3*‚Noerrorswerefoundinbuildingthepacket.4*‚Anerrorwasdetectedinbuildingthepacket.4*•D1.B=VERSAdoserrorcodefortheerrordetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** BLD_PACKET::‰MOVEM.LƒD0/D2/A0/A2,-(SP)ƒSavetheregisterswewilluse. +‰MOVE.L„IOBUFEND(A1),D0…Lastbyteinbuffer+‰SUB.L…IOBUFLOC(A1),D0…Firstbyteinbuffer ‰IFƒTHEN5‰ADDQ.L„#1,D0Addonetogettotalbytestotransfer.‰ENDI4‰MOVE.L„D0,IOBUFLEN(A1)…StoreitinthedrK iveblock. ‰MOVEQ.Lƒ#0,D0*6‰MOVE.B„DRIVENUM(A1),D0…Drivenumbertouseasoffset.)‰MULU†#4,D0Makeintoalong-wordoffset.3‰MOVE.L„ECATABLE(A5),A2…A2<--pointertoECAtable,‰MOVE.L„(A2,D0),A2ŠA2<--ECAblockaddress. !*¦AdjusttheECAblockaddressto'*¦accountforDualPortedRamifreq'd. ‰GET_ON_BDA2 (* The registers will be used as follows: *‚A0=Scratch(*‚A1=Drive'svariableblockintheCCB*‚A2=Drive'sECAblock*‚D0=Scratch*‚D1=Scratch*‚D2=Scratch PAGE*.*SETTHEDISKCONTROLFIELDSINTHEECABLOCK*?*ˆ+-----------------------------+-----------------------------+)*‚$2Eƒ|ŠDriveType‰|…NumberofSurfaces†|?*ˆ+-----------------------------+-----------------------------+1*‚$30ƒ|„NumberofSectors/Track‚|ˆSteppingRateˆ|?*ˆ+-----------------------------+-----------------------------+-*‚$32ƒ|†HeadSettlingTime…|‡HeadLoadTimeˆ|?*ˆ+-----------------------------+-----------------------------+-*‚$34ƒ|‰SeekType‹|ƒReservedforControllerƒ|?*ˆ+-----------------------------+-----------------------------+**‚$36ƒ|LowWriteCurrentBoundaryTrackŽ|?*ˆ+-----------------------------------------------------------+(*‚$38ƒ|ŽPrecompensationBoundaryTrack|?*ˆ+-----------------------------------------------------------+* SPC 2***¤DRIVETYPE: ‰CLR.L„D2“*?EQ450„EQU†CONFGBLK+IOSATW†IfthediskthatisbeingaccessedisC‰BTSTW„#IOARDISC,EQ450(A1)‚aharddisk,putthedrivetypecodefor6‰IF‡THENŒECCharddiskformatintoD2andbranch.‹MOVE.Bƒ#TYPE2,D2 ‹BRA†DRV_TYPE‰ENDI 9‰BTSTW„#IOADDEN,EQ450(A1)ƒTestforsingle-ordouble-data‰IF‡THENŒdensity. 5‹MOVE.Bƒ#TYPE0,D2ŠWe'reasingledensityfloppydisk.=‹BTSTW„#IOASIZE,EQ450(A1)Putthedrivetypecodefor8"into3‹IF‡THENŠD2.‚Iftheattributeswordsayswe're9MOVE.Bƒ#TYPE4,D2ˆactually5.25",changedrivetypecode.‹ENDI ‰ELSE 5‹MOVE.Bƒ#TYPE5,D2ŠWe'readoubledensityfloppydisk.@‹BTSTW„#IOASIZE,EQ450(A1)Putthedrivetypecodefor5.25"into3‹IF‡THENŠD2.‚Iftheattributeswordsayswe're6MOVE.Bƒ#TYPE1,D2ˆactually8",changedrivetypecode.‹ENDI ‰ENDIDRV_TYPE=‰MOVE.BƒD2,DRVTYPE(A2)‡D2<--Drivetype(keepforreference)3‰MOVE.BƒD2,DRIVTYPE(A1)†Saveitinthedriveblock. PAGE***¤NUMBEROFSURFACES: ‰CLR.L„D0“*=EQ460„EQU†CONFGBLK+IOSATW†Determineifthisisaharddiskor@‰BTSTW„#IOARDISC,EQ460(A1)‚floppydiskfromtheattributesword. &‰IF‡THENŒIfwe'reaharddisk....EQ470„EQU†CONFGBLK+IOSHDS†*5‰MOVE.BƒEQ470(A1),D0‰PutthenumberofheadsintoD0. ‰ELSEšIfwe'reafloppydisk....6‰MOVEQ.L‚#1,D0PutdefaultvalueofonesurfaceinD0.?‰BTSTW„#IOADSIDE,EQ460(A1)‚Determineactualnumberofsurfaces.6‰IF‡THENŒIfattributeswordindicates2surfaces.0‰MOVEQ.L‚#2,D0Changenumberofsurfacestotwo.‰ENDI‰ENDI;‰MOVE.BƒD0,NUMSURF(A2)‡PutthenumberofsurfacesintoECA.7‰MOVE.WƒD0,SURF(A1)ŠStorenumberofsurfacesindrive's!*¦variableblockforeasyaccess. SPC 2***¤SECTORSPERTRACK:EQ480„EQU†CONFGBLK+IOSSPT†*;‰MOVE.BƒEQ480(A1),D0‰PutnumberofsectorspertrackinD0.5‰MOVE.BƒD0,NUMSPT(A2)ˆPutnumberofsectorsintoECA.5‰MOVE.WƒD0,SPT(A1)‹Storenumberofsectorsindrive's!*¦variableblockforeasyaccess. SPC 2"***¤HEADSET/LOADTIMESFOR5-1/4" ‰BTST…#2,D2.‰IFTHEN’Executefordrivetypes4and5:5ŠMOVE.Lƒ#SETTM_5,D0‰D0<--headsettlingtimeinmsec3ŠASL.B„#1,D0D0<--settlingtimein500usecunits.ŠMOVE.BƒD0,HEADSET(A2)†WritetotheECAblock.0ŠMOVE.Lƒ#LDTM_5,D0ŠD0<--headloadtimeinmsec3ŠASL.B„#1,D0D0<--settlingtimein500usecunits/ŠMOVE.BƒD0,HEADLOAD(A2)…WritetotheECAblock.ŠBRA.S„STEP_RATE‰ENDI SPC 2%***¤HEADSET/LOADTIMESFORHARDDISK ‰BTST…#1,D2 ‰IF‡THEN6ŠMOVE.Lƒ#SETTM_HD,D0ˆD0<--headsettlingtimeinmsec3ŠASL.B„#1,D0D0<--settlingtimein500usecunits1ŠMOVE.BƒD0,HEADSET(A2)†PutitintotheEK CAblock.1ŠMOVE.Lƒ#LDTM_HD,D0‰D0<--headloadtimeinmsec4ŠASL.B„#1,D0D0<--headloadtimein500usecunits2ŠMOVE.BƒD0,HEADLOAD(A2)…PutitintotheECAblock. PAGE***¥SEEKTYPEFORHARDDISKS%ŠMOVE.Lƒ#TYP_SEEK,D0‰D0<--seektype3ŠIF‡THENŒSeektypezerodefinesbufferedseek:9ŠMOVE.B#BUFFSEEK,SEEKTYPE(A2)PutitintotheECAblock.-ŠELSEšSeektypenotzerodefinessinglestep:9ŠMOVE.B#STEPSEEK,SEEKTYPE(A2)PutitintotheECAblock.ŠENDIŠBRA.S„STEP_RATE‰ENDI ***¤HEADSET/LOADTIMESFOR8"5‰MOVE.Lƒ#SETTM_8,D0ŠD0<--headsettlingtimeinmsec3‰ASL.B„#1,D0D0<--settlingtimein500usecunits1‰MOVE.BƒD0,HEADSET(A2)‡PutitintotheECAblock.0‰MOVE.Lƒ#LDTM_8,D0‹D0<--headloadtimeinmsec4‰ASL.B„#1,D0D0<--headloadtimein500usecunits2‰MOVE.BƒD0,HEADLOAD(A2)†PutitintotheECAblock. STEP_RATE SPC 2***¤HEADSTEPPINGRATE9‰MOVE.BƒCONFGBLK+IOSSRTD(A1),D0ƒD0<--Steppingratecode ‰BTST…#1,D2 ‰IF‡THEN9‰LEA†SRHCODE(PC),A0‡A0<--pointertostepratesforhard‰ELSE;‰LEA†SRFCODE(PC),A0‡A0<--pointertostepratesforfloppy‰ENDI /‰MOVE.Bƒ(A0,D0),D1‹D1<--Steppingrateinmsec9‰BTSTW„#IOARDISC,CONFGBLK+IOSATW(A1)‚Testforfloppydisk‰IFTHEN’Iffloppydisk,8ŠBTSTW„#IOASIZE,CONFGBLK+IOSATW(A1)‚Testthefloppysize%ŠIFTHEN‘Executefor5.25"only:-‹ASL.B„#1,D1ŽDoublethesteppingrateinmsecŠENDIBŠMOVE.Bƒ#STEPSEEK,SEEKTYPE(A2)CopysinglestepseektoECAblock.‰ENDI &‰ASL.B„#1,D1Convertto500usecunits2‰MOVE.BƒD1,STEPRATE(A2)†PutitintotheECAblock. SPC 2$***¤PRECOMPENSATIONCYLINDERNUMBER:>EQ490„EQU†CONFGBLK+IOSPCOM…CopytheprecompensationvaluefromD‰MOVE.WƒEQ490(A1),PRECOMP(A2)thedrive'svariableblocktotheECA. PAGE&***¤LOW-WRITECURRENTCYLINDERNUMBER:EQ500„EQU†CONFGBLK+IOSTRK4‰MOVEQ.L‚#0,D0Usezero'causeweneed4headlines.‰MOVE.WƒD0,LOWCURR(A2) SPC 2>EQ505„EQU†CONFGBLK+IOSPSM†Storethenumberofbytespersector@‰MOVE.WƒEQ505(A1),BPS(A1)„indrive'svar.blockforeasyaccess. SPC 2*.*SETTHETRACKFORMATFIELDSINTHEECABLOCK*?*ˆ+-----------------------------+-----------------------------+'*‚$20ƒ|‡N0-Reserved‰|ˆN1-Reservedˆ|?*ˆ+-----------------------------+-----------------------------+'*‚$22ƒ|‡N2-Reserved‰|ˆN3-Reservedˆ|?*ˆ+-----------------------------+-----------------------------+,*‚$24ƒ|†N4-Post-DataGap…|ˆN5-Reservedˆ|?*ˆ+-----------------------------+-----------------------------+(*‚$26ƒ|†SectorLengthCode…|‹FillByte‰|?*ˆ+-----------------------------+-----------------------------+* ‰CMP.B„#0,D2 '‰IFTHEN’Executefordrivetype0:2‰LEA†FORMATS(PC),A0‡Single-density8"floppydisk.9‰MOVE.Lƒ(A0),N4(A2)ŠGetthefieldsfromthelinkANDfrom8‰MOVE.Lƒ#FRMT_SD,D0Šconstantsattheendofdrivercode.,‰MOVE.BƒD0,N4(A2)ŒPutitintotheECAblock.‰ENDI ‰CMP.B„#1,D2 '‰IFTHEN’Executefordrivetype1:2‰LEA†FORMATD(PC),A0‡Double-density8"floppydisk.9‰MOVE.Lƒ(A0),N4(A2)ŠGetthefieldsfromthelinkANDfrom8‰MOVE.Lƒ#FRMT_DD,D0Šconstantsattheendofdrivercode.,‰MOVE.BƒD0,N4(A2)ŒPutitintotheECAblock.‰ENDI PAGE ‰CMP.B„#2,D2 '‰IFTHEN’Executefordrivetype2:N)‰LEA†FORMATD(PC),A0‡HarddiskusingECC-9‰MOVE.Lƒ(A0),N4(A2)ŠGetthefieldsfromthelinkANDfrom8‰MOVE.Lƒ#FRMT_HD,D0Šconstantsattheendofdrivercode.,‰MOVE.BƒD0,N4(A2)ŒPutitintotheECAblock.‰ENDI ‰CMP.B„#3,D2 '‰IFTHEN’Executefordrivetype3:)‰LEA†FORMATD(PC),A0‡HarddiskusingCRC-9‰MOVE.Lƒ(A0),N4(A2)ŠGetthefieldsfromthelinkANDfrom8‰MOVE.Lƒ#FRMT_HD,D0Šconstantsattheendofdrivercode.,‰MOVE.BƒD0,N4(A2)ŒPutitintotheECAblock.‰ENDI ‰CMP.B„#4,L D2 '‰IFTHEN’Executefordrivetype4:4‰LEA†FORMATS(PC),A0‡Single-density5.25‚floppydisk.9‰MOVE.Lƒ(A0),N4(A2)ŠGetthefieldsfromthelinkANDfrom8‰MOVE.Lƒ#FRMT_SD,D0Šconstantsattheendofdrivercode.,‰MOVE.BƒD0,N4(A2)ŒPutitintotheECAblock.‰ENDI ‰CMP.B„#5,D2 '‰IFTHEN’Executefordrivetype5:4‰LEA†FORMATD(PC),A0‡Double-density5.25‚floppydisk.9‰MOVE.Lƒ(A0),N4(A2)ŠGetthefieldsfromthelinkANDfrom8‰MOVE.Lƒ#FRMT_DD,D0Šconstantsattheendofdrivercode.,‰MOVE.BƒD0,N4(A2)ŒPutitintotheECAblock.‰ENDI PAGE*F*‚Nowwegettoselecttheworkwe'regoingtodobasedonthetypeofF*‚command.‚Mostoftheworkisgoingtobeforformatcommandsbecause(*‚ofthebufferwe'rerequiredtobuild.*7‰CMP.Bƒ#FMTFUNC,IOFUNCT(A1)‚TesttheI/Ofunctioncode.&‰IF†THENIfNOTaformatcommand,6ŠMOVE.LIOSECTOR(A1),D0‡Getthelogicalsectornumber.)ŠBSR.L‚FILLCHSConverttoCYL.HEAD.SECTOR1ŠBSR.L‚CHS2BUFFillthebufferfieldsintheECA. ‰ELSE.L 3ŠCMP.W‚#IOPTRK,IOOPTS(A1)†Ifformattrack-by-track,ŠIF…THEN*(‹TST.L‚IOSECTOR(A1)‹Testfortrackzero.1‹IF…‚THENIfwe'retrack0,dothefollowing: N>ŒBTSTW‚#IOARDISC,CONFGBLK+IOSATW(A1)‚Ifthisisafloppydisk,.ŒIF…‚THENŒandthebytespersectoris256,:CMP.W‚#VDOSRSZ,CONFGBLK+IOSPSM(A1)thenweneedtosetup,IF‚THENHALFSCTS.‚Takethesectorsper(ŽCLR.L‚D0’track,divideby2,andwenow>ŽMOVE.BCONFGBLK+IOSSPT(A1),D0‚haveHALFSCTSforthiscommand. ŽASR.L‚#1,D0ŽMOVE.LD0,HALFSCTS(A1)ENDIŒENDI‹ENDI@‹MOVE.L#0,IOSCTCNT(A1)†CleartheIOSCTCNTfieldindriveblock.ŠENDI *‰CMP.Wƒ#IOPDSK,IOOPTS(A1)„Ifformatdrive,6‰IF†THENPutthetotalnumbersectorsinIOSCTCNT(ŠMOVE.LCONFGBLK+IOSRSZ(A1),IOSCTCNT(A1)‰ENDI PAGE2‰CMP.Wƒ#IOPBAD,IOOPTS(A1)„Ifformatsectorasbad, ‰IF†THEN*@*ˆThealternatesectorscommandisnotsupportedunderVERSAdos.NNNNNB*ˆIftheuserhassettheoptionbit,thenweabortwithanerror.*.‰MOVE.B„#ISTAIF,D1”SetD1withtheerrorcode,‰BRA.S…BLD_OUT—andexit. (‰ELSEšWe'reformattingbutnoneareBAD. :‰MOVE.Bƒ#0,BADSEC(A1)ˆSetthisfieldtoindicatenoneBAD.6‰MOVE.LƒIOSECTOR(A1),D0†Getthelogicalsectornumber.3‰BSR.L„FILLCHSŽConvertLSNtocylinder,head,sector. ‰ENDI 6‰TST.L„FORMBUFF(A1)‰Seeifwealreadyhaveabuffer... ‰IF‚THEN )‰MOVE.Lƒ#FORMSIZE,A0‰Askforformatsize./‰MOVE.LƒL #4,D0ServicerequestcodeforPAGEALOC8‰MOVEM.L‚A1/A2,-(SP)ŠSaveA1forthistypeofexeccall.‰BSR.L„EXECREQ ‰MOVEM.L‚(SP)+,A1/A2ŠRestoreA1.=‰MOVE.LƒA0,FORMBUFF(A1)†SaveaddressofformatbufferinCCB. ‰ENDI ,‰BSR.L„BLDBUFFŽDothisforallformattypes. ‰ENDI PAGE*!*–COMPLETETHEECACOMMANDFIELDS*?*ˆ+-----------------------------+-----------------------------+$*‚$0ƒ|ˆCommandCode‰|‰MainStatus‰|?*ˆ+-----------------------------+-----------------------------+*‚$2ƒ|•ExtendedStatus—|?*ˆ+-----------------------------+-----------------------------+>*‚$4ƒ|‚MaximumNumberofRetries‚|‚ActualNumberofRetriesƒ|?*ˆ+-----------------------------+-----------------------------+$*‚$6ƒ|‰DMATypeŒ|‡CommandOptions‡|?*ˆ+-----------------------------+-----------------------------+* ***¤COMMANDCODEetc..‰MOVE.Lƒ#0,CMDCODE(A2)‡Clearthestatusbytes./‰MOVE.BƒIOFUNCT(A1),D0‡D0<--I/Ofunctioncode ‰EXT.W„D0“*B‰MOVE.BƒOPTBL(PC,D0),CMDCODE(A2)UsetabletosetcodeintheECA. ***¤RETRIESANDCOMMANDOPTIONS6‰MOVE.Lƒ#0,MAXRETRY(A2)†Clearretryandoptionsbytes.2‰BTSTW„#IOPRTYB,IOOPTS(A1)‚Testretryoptionsbit.‰IFTHEN’Ifcleared,C‰MOVE.Bƒ#RETRY,MAXRETRY(A2)‚SetthemaximumretrycountintheECA.@‰MOVE.Bƒ#OPT,CMDOPT(A2)†Setcommandoptionforerrorcorrection. ‰ELSEšIfset,B‰MOVE.Bƒ#MINTRY,MAXRETRY(A2)keepoptions=0butsetretries=1.‰ENDI ***¤DMATYPE5‰MOVE.Bƒ#DMA,DMATYPE(A2)…SettheDMAtypeintheECA.‰CLR.B„D1“Setgoodstatus. BLD_OUT:9‰MOVEM.L‚(SP)+,D0/D2/A0/A2„Restoretheregistersweused.#‰TST.B„D1“Setthestatusonreturn.‰RTS  O*********************************************************************************ˆVME320COMMANDCODETABLE*B*ˆThistablecontainstheVME320definedcommandcodesfortheI/O!*ˆoperationscurrentlysupported.*O******************************************************************************* 0‰DC.B…WRITEWritecommand‚(6):IOFUNCTequals-14OPTBL„DC.B…FRMT‘Formatcommand(7):IOFUNCTequals‚0/‰DC.B…SEEK‘Configure-seek(0):IOFUNCTequals‚1-‰DC.B…READ‘Readcommandƒ(5):IOFUNCTequals‚2‰DS.W†0“Endoftable‰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:INTLOOP**ˆ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;EQ180„EQU†IOQUEUE-IOQCNT‡queueentry,andadvancethequeue=‰MOVE.LƒA1,EQ180(A0,D0.W)„pointer.‚Wedon'tneedtocheckfor2‰ADD.W„#4,(A0)Žqueueoverflowbecausewecannever&*¦accumulatemorethanonequeueentry'*¦foreachdrive.‚Wealsodon'tneedto(*¦checkforqueuewrap-aroundbecausewe'*¦physicallymovequeueentriesinstead&*¦ofusingwrap-aroundqueuepointers. -‰TST.W„D0•Ifthequeuewasn'temptybeforewe/‰BNE†L0410madethelatestentry,theinterrupt$*¦handlerisalreadyactiveandwill)*¦eventuallycompletetheI/Otransaction'*¦thatwe'vejustspecified.‚Otherwise,#*¦weneedtoactivatetheinterrupt *¦handler.‰PAGE8‰LEA†PROCQUE(PC),A0‰Setuptheco-routineswitchpointer@‰MOVE.LƒA0,INTSWTCH(A5)†tostartprocessingnewI/Oqueueentry.<‰MOVE.LƒCCBCHB(A5),AM 0ˆA0<--VME320memory-mappedI/Ospace. ,‰BSR†INTLOOPŽTellcommandtothecontroller.*C*ƒNowwehavestartedofftheI/OandarereadytoreturntoCMRto(*ƒbeawakenedwhenaninterruptarrives.* 9L0410„MOVEM.L‚(A7)+,D0/A0ŠRestoreregistersthatweused.‰POP‡SR‰RTS‰SPC‡15‰PAGEN********************************************************************************ˆCHK_PARAMROUTINE*C*ˆThisisa‚devicedependent‚routinewhose‚offsetmust‚beinstalledD*ˆatthebeginningofthedriver.The‚functionof‚thisroutine‚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.‰PAGEN******************************************************************************* *‰ENDROUTINESCALLEDBYDISKLIB*N******************************************************************************‰PAGEO********************************************************************************7*ˆSUBROUTINESUSEDBYTHECOMMANDANDINTERRUPTHANDLER*O*******************************************************************************  O********************************************************************************9*ˆCONVERTTHEPHYSICALSTARTINGSECTORNUMBERONTHEDISK*B*ˆThisroutineconvertsthePhysicalsectornumbercontainedinD0>*ˆtothecylindernumber,headnumberandsectornumberfields/*ˆrequiredfortheECApacket,andstoresthem.*:*ˆEntry:„A1=Pointertodrive'svariableblockintheCCB#*’A2=Pointertodrive'sECAblock.*’D0=Physicalsectornumbertobeconverted.*!*ˆRegisterusage:…01234567 *™D‚RRR*™A„PP**ˆExit:…D0.W=Cylindernumber*’D1.B=Headnumber5*’D2.B=Sectornumberwithintrack(startingwith1)*8*ˆExitsto:‚CommandHandlerorInterruptHandlerviaRTS***‘PSN=*ˆ---------------------------ƒ=Cylindernumber+Remainder1*ˆSectorsperTrack*#Heads* *‹Remainder10*ˆ------------------Œ=Headnumber+Remainder2*ˆSectorsperTrack*/*ˆRemainder2“=Sectornumber(countingfrom0)*B*ˆNOTE:„Thisdriversometimesreferstothephysicalsectornumber9*‘asthelogicalsectornumber-theyarethesamething.*O******************************************************************************* SPC 2*+*’COMPLETESECTORADDRESSFIELDSINTHEECA*?*ˆ+-----------------------------------------------------------+*‚$10ƒ|–CylinderNumber–|?*ˆ+-----------------------------+-----------------------------+0*‚$12ƒ|„HeadorSurfaceNumberƒ|‡SectorNumber‰|?*ˆ+-----------------------------+-----------------------------+* PAGE FILLCHS: ‰CLR.L„D1 ‰CLR.L„D2 -‰MOVE.WƒSURF(A1),D1D1<--NumberofsurfacesA‰MOVE.BƒCONFGBLK+IOSSPT(A1),D2„D2<--Numberofsectorspertrack3‰MULU…D2,D1D1<---Numberofsurfaces*sect/track$‰DIVU…D1,D0D0.W<--Cylindernumber ‰MOVE.LƒD0,D1/‰LSR.L„#8,D1Shiftremainder1fornextdivide.!‰LSR.L„#8,D1D1.W<--Remainder1 ‰DIVU…D2,D1D1.W<--Headnumber ‰MOVE.LƒD1,D2-‰SWAP…D2“D2.W‚<---Sectornumberinthetrack4‰ADDQ.Lƒ#1,D2VME320countssectorsstartingatone. ;‰MOVE.WƒD0,CYLNUM(A2)ˆPutcylindernumberintheECAblock.8‰MOVE.BƒD1,HEADNUMM (A2)‡PutheadnumberintheECAblock.:‰MOVE.BƒD2,SECTNUM(A2)‡PutsectornumberintheECAblock. ‰RTS PAGEO*********************************************************************************ˆCHSTOBUFFERADDRESS*8*ˆThisroutinefillsthebufferfieldsintheECAblock.-*ˆItusesthefieldsoftheI/OpacketstoredA*ˆearliertomakecalculationsabouttransferlengths.‚Itupdates;*ˆfieldsintheI/Opacketthatareusedlatertodetermine@*ˆifthecommandhasbeencompleted.‚Thisroutineiscalledfrom1*ˆboththecommandhandlerandinterrupthandler.*@*ˆEntry:„A1=Pointertodrive'svariableblockinglobalmemory#*’A2=Pointertodrive'sECAblock*’D0.W=Cylindernumber}3*’D1.B=Headnumber…}-definingstartingsector#*’D2.B=Sectornumberƒ}*!*ˆRegisterusage:…01234567 *™D‚****™A„PP*D*ˆExit:(1)SetsthebufferfieldsinECAblockforread/writeonly.;*Ž(2)ModifiesN4,SLCandDRVTYPEfieldsintheECApacket7*’fortrack0accessesonadouble-densityfloppydisk.<*Ž(3)UpdatestheI/Opackettodeterminecommandcompletion#*’forreadandwritecommandsonly.**ˆExitsto:CallerviaRTS*O******************************************************************************* SPC 2* *•COMPLETETHEECABUFFERFIELDS*?*ˆ+-----------------------------+-----------------------------+%*‚$8ƒ|“BufferAddress(upperword)|?*ˆ+-----------------------------+-----------------------------+%*‚$Aƒ|“BufferAddress(lowerword)|?*ˆ+-----------------------------+-----------------------------+!*‚$Cƒ|“BufferLengthRequested‘|?*ˆ+-----------------------------+-----------------------------+,*‚$Eƒ|ŽActualNumberofBytesTransferred‹|?*ˆ+-----------------------------+-----------------------------+* PAGE CHS2BUF;‰MOVE.LƒIOBUFLEN(A1),D0†D0<--numberofbytestotransfer.8‰IFTHEN.LBufferlengthiszeroforformat&seek. =‰MOVE.LƒHALFSCTS(A1),D1†D1<--sectortransferacrosstrack0 ‰IFTHEN0ŠMULU…#128,D1D1<--#bytestotransfertrack08ŠMOVE.Bƒ#0,SLC(A2)ŠChangesectorlengthcodeintheECA.ŠMOVE.Lƒ#FRMT_SD,D2‰*1ŠMOVE.BƒD2,N4(A2)‹ChangeformatfieldintheECA.?ŠBTST.Bƒ#0,DRVTYPE(A2)†Makingsuredrivetypeindicatesdouble-ŠIFTHEN‘*>ŠSUB.B„#1,DRVTYPE(A2)†ChangedrivetypecodetosingledensityŠENDI-ŠSUB.L„D1,D0D0<--#bytestotransfernext. ‰ELSE4ŠMOVE.Lƒ#MAXB,D1ŒD1<--maxnumberofbytestoxfer./ŠCMP.L„D1,D0Comparetonumberbytesrequested.3ŠIFTHEN‘Branchifthetransferiswithinmax.-ŠSUB.L„D1,D0Subtractmaximumfromrequested.&ŠELSE™D0<--#bytestotransfernext.-ŠMOVE.LƒD0,D1D1<--#bytestotransfernow./ŠMOVEQ.L‚#0,D0D0<--#bytestotransfernext.ŠENDI‰ENDI PAGE*.*‚Copythebufferlength(inbytes)totheECA'*ˆD1=NumberofbytestotransferNOW.(*ˆD0=NumberofbytestotransferNEXT.*8‰MOVE.WƒD1,BUFLEN(A2)ˆCopythebytestotransfertoECA. &‰MOVE.LƒA0,-(SP)SaveA0onthestack./‰MOVE.LƒIOBUFPTR(A1),A0†Getthebufferaddress.+‰GO_OFF_BDA0’Adjustifthereisanoffset.:‰MOVE.LƒA0,BUFADDR(A2)‡CopythebufferaddresstotheECA.‰MOVE.Lƒ(SP)+,A0RestoreA0.*$*ƒHousekeepinginthedriveblock...*5‰ADD.L„D1,IOBUFPTR(A1)†<--1stbytetotransfernext.5‰MOVE.LƒD0,IOBUFLEN(A1)†<--#bytestotransfernext. ‰DIVU…BPS(A1),D17‰ADD.L„D1,IOSECTOR(A1)†<--1stsectortotransfernext.‰DIVU…BPS(A1),D07‰MOVE.LƒD0,IOSCTCNT(A1)†<--#sectorstotransfernext. ‰TST.L„HALFSCTS(A1) ‰IFTHEN ŠCLR.L‚D0ŠMOVE.BCONFGBLK+IOSSPT(A1),D08ŠMOVE.LD0,IOSECTOR(A1)‡<--1stsectortotransfernext.,‰ENDIš(double-densityfloppies/track0only) ‰ENDI ‰RTS *A*„NOTESONMULTIPLETRANSFERS:‚MulitpleblocktransferscanoccurN*‚when:(1)thedatatransfercrossesthetrack0boundaryofadouble-densityL*‚floppydiskand(2)thedatatransferislargerthanthemaximumnumberof*‚byteN sallowedbytheVME320.* PAGEO*********************************************************************************ˆBUILDFORMATBUFFERROUTINE*A*ˆThisroutinebuildstheformatbufferfortheVME320controllerA*ˆboard.‚ItusesfieldsfromtheECApacketforitscomputations.?*ˆItimplementsinterleavingandspiraloffset.Thisroutineis=*ˆcalledfromboththeinterrupthandlerandcommandhandler.*@*ˆEntry:„A1=Pointertodrive'svariableblockinglobalmemory#*’A2=Pointertodrive'sECAblock*!*ˆRegisterusage:…01234567 *™D‚****™A„PP*C*ˆExit:(1)SetsthebufferfieldsintheECAblockforformatcmd.:*Ž(2)Buildstheformatbufferforonetrack,implementing.*’'formatsectorasbad'optionfromVERSAdos.**ˆExitsto:CallerviaRTS*O******************************************************************************* ?BLDBUFF‚MOVEM.L‚D4/A0/A3,-(SP)‡Saveworkingregistersonstack. ‰CLR.L„D2%‰MOVE.WƒSPT(A1),D2‹Sectorspertrack. 0‰CMP.W„#IOPDSK,IOOPTS(A1)ƒTestthecommandtype. ‰IFTHEN’Housekeeping...;‰SUB.LƒD2,IOSCTCNT(A1)‡Decrementsectorcountformat-drive.;‰ADD.LƒD2,IOSECTOR(A1)‡Incrementstartsectorformat-drive.‰ENDI :‰TST.L„HALFSCTS(A1)‰Executefortrack0onDDfloppyonly: ,‰IF‡THENŒResetthesefieldsintheECA::‰MOVE.Bƒ#0,SLC(A2)‹Changesectorlengthcodeto128bytes.‰MOVE.Lƒ#FRMT_SD,D0Š*6‰MOVE.BƒD0,N4(A2)ŒChangeN4toreflectsingledensity.0‰BTST.Bƒ#0,DRVTYPE(A2)‡Changedrivetypecode...1‰IF‡THENŒMakesureitindicatesDDbeforewe‰SUB.B„#1,DRVTYPE(A2)‡subtract.‰ENDI‰ENDI :‰LEA†SECTBUFF(A5),A0†Getpointertosectornumbersbuffer.,‰MOVE.LƒA0,A3A0<--Sectornumberbuffer#1 PAGEL****************************************************************************>*ˆBUILDSTRINGOFSECTORNUMBERSUSINGTHEINTERLEAVEFACTORˆ*L*****************************************************************************E*‚A0=Pointertosectornumberbuffer#1usedforinterleavefactors9*‚A1=Pointertodrive'svariableblockinglobalmemory#*‚A2=Pointertodrive'sECAblock*‚D0=Scratch*‚D1=Scratch*‚D2=Sectorspertrack,*‚D4=Scratch(willholdinterleavefactor) ‰CLR.L„D4E‰MOVE.BƒCONFGBLK+IOSILV(A1),D4Interleavefactorfromconfigureblock$‰IF‡THENŒIfNOTzero,itsokay.4‰MOVEQ.L‚#1,D4Makethefactorofzeroequaltoone.‰ENDI 4*ˆCMP.W„#IOPBAD,IOOPTS(A1)ƒFormatcommandoptions...'*ˆIF‡THENŒIfformatsectorasbad,,*ˆCMP.B„#1,D4Andinterleavingisspecified,*ˆIF‡THEN<*ˆMOVE.Bƒ#1,BADSEC(A1)ˆForceentiretracktobeformatedBAD*ˆENDI*ˆENDI &‰MOVEQ.L‚#1,D0Startingsectornumber.)‰BRA†RW_INTBŽBranchtoentryinsideloop. +RW_INTA‚MOVE.BƒD1,(A0)+Copysectornumber.#‰ADD.L„D4,D1Addinterleavefactor.8‰CMP.W„SPT(A1),D1‹Havewegottothelastsectornumber?$‰BLE†RW_INTCŽBranchiflastorless./‰ADDQ.Lƒ#1,D0Incrementstartingsectornumber. * Enter here.RW_INTB‚MOVE.LƒD0,D1Copytoworkingregister.RW_INTC‚DBRA…D2,RW_INTA PAGEL****************************************************************************:*ˆBUILDSTRINGOFSECTORNUMBERSUSINGTHESPRIALOFFSETŒ*L*****************************************************************************I*‚A0=Pointertosectornumberbuffer#2usedtoimplementspiraloffset9*‚A1=Pointertodrive'svariableblockinglobalmemory#*‚A2=Pointertodrive'sECAblockB*‚A3=Pointertostartofsectornumberbuffer#1(savedearlier)*‚D0=Scratch*‚D1=Scratch*‚D2=Scratch(*‚D4=Scratch(willholdspiraloffset) ‰CLR.L„D4:‰MOVE.BƒCONFGBLK+IOSSOF(A1),D4„D4<--‚Spiraloffsetvalue.'‰IF‡THENŒBranchifaroundifnone. 4*ˆCMP.W„#IOPBAD,IOOPTS(A1)ƒFormatcommandoptions...'*ˆIF‡THENŒIfformatsectorasbad,<*ˆMOVE.Bƒ#1,BADSEC(A1)ˆForceentiretracktobeformatedBAD*ˆENDI :‰MOVE.WƒSPT(A1),D2‹Getthenumberofsectorsinthetrack.&N ‰SUBQ.Lƒ#1,D2D2<--DBxxloopcounter ARW_SOFƒMOVE.Bƒ(A3)+,(A0)+ŠCopythesectornumbersw/interleaving(‰DBRA…D2,RW_SOFŒtothebufferfollowing. <‰MOVE.BƒHEADNUM(A2),D0‡D0<--surfacenumberfromECAblock.+‰MULU…D0,D4SpiralOffset*Surfacenumber.%‰MOVE.WƒSPT(A1),D2‹Sectorspertrack.)‰SUB.L„D4,D2Offsetduetospiraloffset.2‰LEA†SECTBUFF(A5),A3†Pointertointerleavebuffer.-‰ADDA.LƒD2,A3A3<--stringofsectornumbers ‰ENDI  PAGE2***************************************************ˆCOMPLETETHEFORMATBUFFERŽ*2***************************************************3*‚A0=Scratch‚(willholdpointertoformatbuffer)9*‚A1=Pointertodrive'svariableblockinglobalmemory#*‚A2=Pointertodrive'sECAblockM*‚A3=Pointertostringofsectornumbersw/interleavingandspiraloffsets*‚D0=Scratch*‚D1=Scratch*‚D2=Scratch*<‰MOVE.LƒFORMBUFF(A1),A0†A0<--Pointertotheformatbuffer.;‰MOVE.BƒBADSEC(A1),D0ˆD0<--Badsectorinalternatetrack.  *¦NOTE:BADSEChasbeensetto0$*¦ifthiswasnotaformatsectoras*¦badcommand. ‰CLR.L„D2:‰MOVE.WƒSPT(A1),D2‹Getthenumberofsectorsinthetrack.&‰SUBQ.Lƒ#1,D2D2<--DBxxloopcounter THENŒBuildthebufferforGOODsectors... 9‰BTST.Bƒ#1,DRVTYPE(A2)‡Drivetypedefines#bytes/sector:3‰BEQ†FMT_FLOP5-bytesforharddisks/4-bytesfloppy=‰MOVE.BƒCYLNUM(A2),(A0)+…CopytheMSBofthecylindernumber.GFMT_FLOPMOVE.BƒCYLNUM+1(A2),(A0)+ƒCopytheLSBofthecylindernumber.+‰MOVE.BƒHEADNUM(A2),(A0)+„Headnumber-all'‰MOVE.Bƒ(A3)+,(A0)+ŠSectornumber-all.‰MOVE.BƒSLC(A2),(A0)+ˆSectorlengthcode-all )‰ELSEšBuildthebufferforBADsectors... '‰MOVEQ.L‚#2,D1D1<--DBxxloopcounterHBAD_SEC‚MOVE.BƒCYLNUM(A2),(A0)+…CopytheMSBoftheBadcylindernumber.C‰MOVE.BƒCYLNUM+1(A2),(A0)+ƒCopytheLSBoftheBadcylindernumber.)‰MOVE.BƒHEADNUM(A2),(A0)+„Badheadnumber$‰MOVE.Bƒ(A3),(A0)+‹Badsectornumber;‰MOVE.Bƒ#$FF,(A0)+‹ForceSLCto$FFtoindicateBADsector.7‰MOVE.BƒALTCYL(A1),(A0)+…AlternatecylindernumberMSB.9‰MOVE.BƒALTCYL+1(A1),(A0)+ƒAlternatecylindernumberLSB./‰MOVE.BƒALTHEAD(A1),(A0)+„Alternateheadnumber*‰MOVE.Bƒ(A3),(A0)+‹Alternatesectornumber5‰MOVE.BƒALTSLC(A1),(A0)+…Alternatesectorlengthcode+‰MOVE.Bƒ#72,(A0)+ŒPostIDgap(fixedvalue)8‰DBRA…D1,BAD_SEC‹Repeattoget2IDheaderswrittenout. 2‰ADD.L„#1,A3IncrementA3topointtonextsector.‰ENDI 5‰DBRA…D2,FMT_LOOPŠCompletethebuffer-daterequired *¦foreverysectorinthetrack. PAGE*<*‚Thebufferisbuilt-FillbufferfieldsintheECAblock.*8‰MOVE.LƒFORMBUFF(A1),D2†D2<--1stbyteinformatbuffer0‰MOVE.LƒA0,D1D1<--1stbytepastformatbuffer-‰SUB.L„D2,D1D1=lengthoftheformatbuffer-‰MOVE.LƒD2,A0D2=startoftheformatbuffer/‰GO_OFF_BDA0’Adjustfordual-portramaddress. <‰MOVE.LƒA0,BUFADDR(A2)‡PuttheformatbufferaddressinECA.=‰MOVE.WƒD1,BUFLEN(A2)ˆPutthelengthofformatbufferinECA.*>*‚Replacethesectorspertrackfieldforbadsectorhandling.* ‰CLR.L„D2“*4‰MOVE.WƒSPT(A1),D2‹D2<--currentsectorspertrack.=‰MOVE.BƒBADSEC(A1),D0ˆTestflagindicatingbadsectornumber.3‰IF‡THENŒIfflagisthenweabadsector.<‰ADD.B„#2,NUMSPT(A2)ˆAddtothenumberofsectorspertrack.‰ELSE<‰MOVE.BƒD2,NUMSPT(A2)ˆRestoresectorspertrackifallgood.‰ENDI*I*‚Nowthisisinteresting.‚InordertoformatasectorasbadandspecifyM*‚analternate,thenumberofsectorspertrackmustbeadjustedtoequaltheG*‚numberof'CYL-HEAD-SECTOR#...'datasequencesintheformatbuffer.J*‚Whenallthesectorsaregood,thenthisfieldexactlyequalsthenumberI*‚ofsectorsinthetrack.‚Whenanybadsectorsarespecified,thisfieldF*‚isincreasedby3timesthenumberofbadsectorstoaccountfortheF*‚threeIDheadersspecifyingthealternatewrittentotO hebadsector.*+‰MOVEM.L‚(SP)+,D4/A0/A3‡Restorefromstack.‰RTS PAGEO*********************************************************************************ˆMEMORYRETURN*<*ˆThisroutineiscalledbytheinterrupthandlerforformat:*ˆcommands.‚It'spurposeistoreturntheglobalmemoryit<*ˆrequestedfortheformatbufferwhichisnolongerneeded.*@*ˆEntry:„A1=Pointertodrive'svariableblockinglobalmemory*’A5=AddressofourCCB.*!*ˆRegisterusage:…01234567*™D‚***™A‚P**ˆExit:…Tocallerifnoerrors*’Tokilleriferror*O******************************************************************************* MEMRTNNNN9‰MOVEM.L‚D1/A0,-(A7)ŠSaveimportantregswe'llblowaway.)‰MOVE.Lƒ#FORMSIZE,D1‰Askforformatsize./‰MOVE.Lƒ#5,D0ServicerequestcodeforPAGEFREE%‰MOVE.LƒFORMBUFF(A1),A0†Startaddress8‰MOVE.Lƒ#0,FORMBUFF(A1)†Cleartheformatbufferpointer. ‰BSR†EXECREQ'‰MOVEM.L‚(A7)+,D1/A0ŠRestoreA0andD1.‰RTS‰PAGEO******************************************************************************** *ˆEXECREQ*9*ˆThissubroutineiscalledbytheformatcommandtoboth<*ˆgetsystemmemorytouseasaformatbuffer,andtoreturn:*ˆsystemmemory.ThecallsitisusedforarePAGEALOCand<*ˆPAGEFREE.Theregisters(D0,A0,A1)havebeensetforthe*ˆparticularcallbeforeentry.*9*ˆEntry:„A0=Formatbuffersizeinpages(PAGEALOConly)+*•=Startaddressofmemory(PAGEFREEonly)9*’A1=Pointertodrive'svariableblockinglobalmemory*’A2=PointertosomethingNNNN*’A5=AddressofourCCB.*’D0=Servicerequestcode.:*’D1=Buffersizeinpagestobereturned(PAGEFREEonly)*!*ˆRegisterusage:…01234567*™D*™A„PP**ˆExit:…Tocallerifnoerrors*’Tokilleriferror*O******************************************************************************* EXECREQ::‰MOVEM.L‚A1/A2,-(SP)ŠSaveA1/A2onthistypeofexeccall.‰TRAP…#0“Execustiverequest‰BRA†GOOD_CALLŒGoodreturn."‰MOVEM.L‚(SP)+,A1/A2ŠRestoreA1/A2/‰KILL.DRIVERM320DRV_IO D,BOTH_A_F,A5,DCBPNTR(A1) GOOD_CALL"‰MOVEM.L‚(SP)+,A1/A2ŠRestoreA1/A2‰RTS‰PAGEN********************************************************************************‰FINISHOFFTHEINITIALIZATION*2*‰Theseotherdevice-dependentthingsMUSTbedone>*‰beforewecanhandlecommands.‚Theyprobablycouldhavebeen?*‰doneinINITatthestartofthedriverbutarehandledhere.*=*‰1.‚AllocateglobalmemoryfortheEventControlAreas(ECA)$*‰2.‚InitializeECAAddressPointer.-*‰3.‚InitializeECAdriveinterruptregister.6*‰4.‚InitializeECAdrivesourceandstatusregisters.**‰Entry:A5=addressofCCB.* *‰Calls:none*N****************************************************************************** DO_INIT: 8‰MOVE.Lƒ#PAGES,A0ŽAllocateglobalmemoryforoneECAfor5‰MOVE.Lƒ#4,D0eachpossibledeviceandtheassociated*‰TRAP…#0“ECApointertable.‚Theaddressof'*¦thememorysegmentisreturnedinA0.*‰BRA†INIT30Goodreturn!‰BRA.L„INITERRŽBadreturn.INIT30:‰MOVE.LƒA0,ECATABLE(A5)ˆStoretheECAtableaddressinthe3‰MOVEQ.L‚#DRIVES,D1‹CCB.‚Clearallmemorylocations6‰MULU…#PKTLONG,D1ŠinallfourECApacketsplustheECA/‰ADDQ.Lƒ#4,D1tableitself,andrestoretheECA'INIT45ƒCLR.L„(A0)+tableaddresstoA0.‰DBRA…D1,INIT45‰MOVE.LƒECATABLE(A5),A0‰PAGE*@*ˆAdjusttheglobalramaddressoftheECApointertableandthe7*ˆECApacketsifanonboardram/offsetaddressapplies.* ‰GO_OFF_BDA0!*¨GetthebaseaddressoftheECA(‰MOVE.LƒA0,D0PointerTable.‚Immediately6‰ADD.L„#16,D0followingthetablearetheECApackets.;‰MOVEQ.L‚#DRIVES-1,D1‰FilltheECAtableinglobalramwith7‰MOVE.LƒECATABLE(A5),A0†theECApacketaddressesofthe>INIT40ƒMOVE.LƒD0,(A0)+fourpossibledrivesonthecontroller.‰ADD.L„#PKTLEN,D0‹*‰DBRA…D1,INIT40Œ* ‰MOVE.LƒECATABLE(A5),A0*@*ˆAdjusttheglobalramaddressoftheECApointertableandthe7*ˆECApacketsifanonboardram/offsetaddressapplies.* ‰GO_OFF_BDA0#*©GettheECAPointerTableaddress1‰MOVE.LƒA0,D1intoaworkingregister.‚Wehaveto4‰ROR.L„#1,D1translatetheaddressbeforewetellit5‰MOVEQ.L‚#2,D2tothecontroller.Theaddressmustbe1‰MOVE.BƒD1,D0dividedby2andtheorderofbytes4INIT50ƒASL.L„#8,D0reversedi.e.theMSBbecomesthe.‰ASR.L„#8,D1LSBandtheLSBbecomestheMSB-5‰MOVE.BƒD1,D0(theaddressAABBCCDDbecomesDDCCBBAA)‰DBRA…D2,INIT50 9‰MOVE.LƒCCBCHB(A5),A0ŠGetthecontrolleraddressandtell9‰MOVEP.L‚D0,ECA0(A0)ŠtheECAPointerTableaddresstotheD‰MOVE.BƒCCBVECT(A5),VECTOR(A0)controllerthroughtheECAregisters.;‰MOVE.Bƒ#0,SOURCE(A0)ˆTellthecontrollerthevectornumber:‰MOVE.Bƒ#0,STATUS(A0)ˆandinitializethesourceandstatus‰BRA†INITDONEregisters. 4INITERR‚SNE.B„CHANDOWN(A5)‹Ifanerrorwasdetected,1INITDONERTS›shutthechanneldownbysettingthe *¦variableCHANDOWNtonon-zero. *********************** *‚PATCHSPACE***********************ŠDS.Wƒ30ŠENDNNNN