IMD 1.17: 11/11/2014 14:59:18 82VKXBVERDOS C* VERSADOS/RMS68K OBJECT 4.4 SN=48634 17 OF 22  BT17\82VKXBVERDOS 0420¿;-*ŠCALLINCLOS(input_id,param_blk_addr)…closeselectedchannels-*ŠCALLINSTAT(input_id,param_blk_addr)…status8*ŠCALLINENAB(input_id,param_blk_addr)…enableinterrupts9*ŠCALLINDSAB(input_id,param_blk_addr)…disableinterrupts*D*‰andwhereinput_idistheCMRchannelmnemonicofaVME610or620*”boardA*‰andwhereparam_blk_addristhebaseaddressofanInputDriver*“CommandParameterBlock*,*‰Allargumentsforthecallsareidentical.7*‰Thecontentsoftheparam_blkforeachcallisunique*‰tothecall.*6*‰Allthecommandsubroutinescallacommonsubroutine3*‰INPSETtobuildtheInitiateI/Oparameterblock.**‰STACKFORALLCALLS:*7*‰deepeststack:(stackaddressstaysatINPSETreturn)0*˜commandcodeƒ2bytes(initiateI/Oparam.blk) *˜n/aŒ2bytes*˜input_id‡4bytes *˜n/aŒ4bytes *˜n/aŒ4bytes *˜n/aŒ4bytes.*˜commandaddrƒ4bytes(inputcommandaddress),*˜commandlng„2bytes(inputcommandlength)-*˜INPSETreturn‚4bytesdeepeststackaddress *˜A34bytes *˜A24bytes *˜A14bytes *˜D04bytes*‰entrystack:ƒreturn‰4bytes*˜^param_blk_adr4bytes*˜^input-idˆ4bytes* ŠSECTION9?ŠXDEFƒINOPEN,INCLOS,INSTATƒTheFORTRANsubroutinecallsusethe5ŠXDEFƒINENAB,INDSAB‰thesamecommandmnemonicsasthe(*¦correspondingassemblylanguagecalls.&*‰CALLINOPEN(input_id,param_blk_addr)*‰openandconfigurechannels*1INOPEN„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚INPSETset-uptheinitiateI/Oparameterblock)ŠMOVE.L#1,(A2)ŒsettheopencommandcodeINOPN00ƒCLR.L‚D0‘clearforuse'ŠMOVE.W4(A2),D0‹getnumberofchannelsŠASL.L‚#2,D0Žmultiplyby4.INOPN05ƒADD.L‚#6,D0Žaddinthe6byteoverhead-INOPN10ƒMOVE.WD0,(A1)Œsetthecommandlength=(80 -ŠMOVE.LA3,A0ŽTRAP#1parameterblockaddress#ŠMOVE.L#60,D0CMRdirectivenumberŠTRAPƒ#1‘callRMS68K'ŠMOVE.WD0,(A2)Œsetthereturnedstatus)ŠMOVEM.L(A7)+,D0/A1-A3„restoreregisters!ŠMOVE.L(A7)+,A0‹putreturninA0 ŠLEA„8(A7),A7‹cleanupthestackŠJMP„(A0)returntouser*&*‰CALLINCLOS(input_id,param_blk_addr)"*‰closeallchannelsforthisuser*1INCLOS„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚INPSETset-uptheinitiateI/Oparameterblock*ŠMOVE.L#2,(A2)Œsettheclosecommandcode/INCLS10ƒMOVE.W#6,D0ŽInputclosecommandlengthŠBRA„INOPN10ŒgodotheCMRcall*&*‰CALLINSTAT(input_id,param_blk_addr))*‰readinputstatusonspecifiedchannels*1INSTAT„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚INPSETset-uptheinitiateI/Oparameterblock+ŠMOVE.L#5,(A2)Œsetthestatuscommandcode4ŠBRA„INCLS10Œgosetcommandlength&dotheCMRcall*&*‰CALLINENAB(input_id,param_blk_addr).*‰enableinterrptsonspecifiedinputchannels*1INENAB„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚INPSETset-uptheinitiateI/Oparameterblock+ŠMOVE.L#6,(A2)Œsettheenablecommandcode4ŠBRA„INCLS10Œgosetcommandlength&dotheCMRcall*&*‰CALLINDSAB(input_id,param_blk_addr)0*‰disableinterruptsonspecifiedinputchannels*1INDSAB„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚INPSETset-uptheinitiateI/Oparameterblock,ŠMOVE.L#7,(A2)Œsetthedisablecommandcode4ŠBRA„INCLS10Œgosetcommandlength&dotheCMRcall*4*‰INPSETsetuptheCMRinitiateI/Oparameterblock.*‰returns:ƒA1=addressforInputcommandlength**”A2=Inputcommandparameterblockaddress)*”A3=InitiateI/Oparameterblockaddress*(INPSET„CLR.W‚-2(A7)clearcommandlength-ŠLEA„-2(A7),A1Šsaveaddressofcommandlength$ŠMOVE.L24(A7),A0Šgetparam_blk_addr%ŠMOVE.LA0,-6(A7)Šsaveparam_blk_addr,ŠMOVE.LA0,A2Žsaveparam_blk_addrforreturnŠCLR.L‚-10(A7)ŒnotusedŠCLR.L‚-14(A7)ŒnotusedŠCLR.L‚-18(A7)ŒnotusedŠMOVE.L28(A7),A0Šget^input_id!ŠMOVE.L(A0),-22(A7)‡getinput_idŠCLR.W‚-24(A7)Œnotused0ŠMOVE.W#$0700,-26(A7)…initiateI/Ocommandcode4ŠLEA„-26(A7),A3‰initiateI/OparameterblockaddressŠRTS—returntocallerŠENDééééééé *!*…MVME615ACOUTPUTBOARDDRIVER *…copyrighted1983MOTOROLAINC. *œTOMKRYKA* ‰LLEN†120 ‰TTL‡STR.EQ‰INCLUDEƒ9995.&.STR.EQ ‰TTL‡TCB.EQ‰PAGE‰INCLUDEƒ9995.&.TCB.EQ‰TTL‡TR1RTCD.EQ‰PAGE‰INCLUDEƒ9995.&.TR1RTCD.EQ ‰TTL‡CCB.EQ‰PAGE‰INCLUDEƒ9995.&.CCB.EQ ‰TTL‡LV5.EQ‰PAGE‰INCLUDEƒ9995.&.LV5.EQ‰TTL‡M615DRV.EQ‰PAGE‰INCLUDEƒ9995.&.M615DRV.EQ‰TTL‡MVME615DRIVER‰PAGEM615DRV‚IDNT†1,0‡ACODRIVERJ****************************************************************************ƒDR615--REV.1.008/2/83*+*ƒPurpose:‚MVME615ACOUTPUTBOARDHANDLER*/*ƒEntry:‚JSRFROMCMRHANDLER(COMMANDSERVICE) *‹JSRFROMCMRINTERRUPTHANDLER-*ƒExit:-ALWAYSEXITSWITHARTSINSTRUCTION**ƒCODEISRE-ENTRANT********************************* CHANNEL CONTROL BLOCK (CCB) *********************************B*ƒContainschanneldevicedependentdescriptionanddataareasfor*ƒI/Ohandler.*‰OFFSETƒCCBDDP*H* I/O HANDLER DATA AREA *************************************************CCBFLGƒDS.B†2‰Flags(CCBERAD1DS.B†4‰Errordebugsaveaddress2CCBQVER1DS.B†4‰Eventqueueingerrordebugaddress7CCBCCBƒDS.B†4‰Physicaladdressofcommandpacket(IOCB)CCBTASKBDS.B†4‰BuffertaskTCB-CCBPKTƒDS.B†18ˆEventworkarea(commandtour)0CCBCPKT‚DS.B†18ˆEventworkarea(interrupttour)(CCBPTRƒDS.B†4‰PhysicaladdressofbufferCCBLENƒDS.B†4‰Lengthofbuffer0CCBPTR1‚DS.B†4‰Physicaladdressof2ndarybuffer&CCBLEN1‚DS.B†4‰Lengthof2ndarybuffer*CCBCIDƒDS.B†4‰CMRparameterblockid(DCB)CCBCOPT‚DS.B†2‰IOCBoptions#CCBCFIG‚DS.B†$26‡Configurationdata**‰56bytesremain*9*‰CCBFLGDEFINITIONS:if‚CCBFLG.Bifnot0theACOmodule$*fortheCCBcannotbeusedforthe*followingreasons:*9*‰CCBFLG.B=$FA=CCBallocationexceeded#ofspecified/*šdevices-noroominACOtableforthemodule!*’=$FC=noACOTBLwasallocated/*’=$F5=noroominACOTBLforthisACOmodule*™(incorrecttableallocation)*‰PAGE 8MA<I0Q?Y8a4i<qGy>9‰4‘;™7¡1©B±8¹CÁHÉ8Ñ ‰SECTIONƒ8 ‰XREF†ACOTBLH*************************************************************************ƒACOSERVICEVECTORTABLEH************************************************************************#*ˆDC.L†ACOINTŽinterruptsvcaddress!*ˆDC.L†ACOCMDŽcommandsvcaddress)*ˆDC.L†ACOINITinitializationsvcaddress*7*…BelowaretheoffsetformofservicepointersforCMR*.ACODVRƒDC.L†ACOINT-ACODVR‡interruptsvcoffset*‰DC.L†ACOCMD-ACODVR‡commandserviceoffset.‰DC.L†ACOINIT-ACODVR†initializationsvcoffset‰DC.L†0“Reserved‰DC.B†0“numberofextrapages‰DC.B†0,0,0reserved‰DC.L†0,0,0reserved*3*ƒ---ƒ---…CONFIGURATIONCONTROLINFORMATION…---ƒ---*$‰DC.B†'080283'‚dateoflastassembly'‰DC.B†''‡spacemeansnopatchesin.LO#‰DC.B†'4'‡majorVersadosrevision#*I**************************************************************************ƒCOMMANDTABLE&JUMPTABLE:*‰Theseareusedbythecommandserviceroutinetojumpto.*‰theappropriateroutinetohandleacommand.I************************************************************************** CMDTBLƒDC.W†ACOPEN„OPENcommand.‰DC.W†ACOCLS„CLOSEcommand.‰DC.W†ACOUT…OUTPUTONcommand. ‰DC.W†ACOOFF„OUTPUTOFFcommand.‰DC.W†ACOSTA„STATUScommand.‰DC.W†X1ˆ(notused)‰DC.W†X2ˆ(notused)#‰DC.W†ACOPLS„PULSEDOUTPUTcommand.=NUMCMDS‚EQU‡(*-CMDTBL)/2‚Thenumberofcommandsinthetable.*8JMPTBLƒDC.W†OPEN-*„Biasestothecorrespondingroutines. ‰DC.W†CLOSE-* ‰DC.W†OUTON-*‰DC.W†OUTOFF-* ‰DC.W†STAT-*‰DC.W†ENABLER-*‰DC.W†DSABLE-* ‰DC.W†PLSO-*7JMPOFFƒEQU‡JMPTBL-CMDTBL‡Offsetbetweenthetwotables.*‰PAGEH*************************************************************************+*ƒACODRIVERINITIALIZATIONSERVICEROUTINE*>*ˆThedriveris enteredhereforeachCCBallocated.‚Morethan:*ˆoneCCBmaybeallocatedforeachACOmodule.‚OneCCBis%*ˆallocatedforeachinterruptlevel.?*ˆThisroutinecheckstoseeifthereisroomintheACOTBLfor=*ˆthedeviceID.‚ItsavesthedeviceIDandthememorymapped**ˆI/OaddressofthedeviceintheACOTBL.*:*ˆAnerrorcodeissavedintheCCBifthisCCBallocation=*ˆexceedsthemaximumnumberofCCB'sspecifiedduringSYSGEN9*ˆ(SYSGENparameterNACO),ifnoACOTBLexistsornoroom*ˆinthetableforthismodule.*$*ˆEntry:‚allregistersareavailable*A5=CCBaddress,*ˆsingleexit&pointer(A0-A6)preservationI**************************************************************************ACOINIT‚PUSHPOINT•savepointers3‰MOVE.L„CCBCHB(A5),A0‡getmemorymappedI/Oaddress$‰MOVE.L„ACOTBL,A1‹getACOTBLaddress‰CMP.L…#0,A1isthereone?&‰BNE.S…ACOINIT1Œbranchifhaveatable8‰MOVE.B„#ACONTBL,CCBFLG(A5)setnotableerrorcondition!‰BRA.S…ACOINEX1ŒgotoerrorreturnACOINIT5TST.L…(A1,D3)lookforanentryslottosavethisguy5‰BMI.S…ACOINIT6Œbranchifthisslotisempty-useit.‰ADD.W…#IOLNG,D3‹notempty,bumptonextentry"‰SUB.B…#1,D4decrementthecounter(‰BNE.S…ACOINIT5Œbranchifmoretosearch4‰BRA‡ACOEXTERŒerrorifgothere-noroomforthemap>ACOINIT6MOVE.L„D2,(A1,D3)ŠsavethismemorymappedI/Oaddress‰MOVE.L„#0,D0write0toreg‰MOVE.B„D0,IOADR(A0)1ACOEXIT1CLR.B…CCBFLG(A5)Šsetforgoodallocation3‰MOVE.L„CCBCHB(A5),A1‡getmemorymappedI/Oaddress&ACOINEX1POP_POINT•recallallpointers‰RTS*‰PAGEG************************************************************************$*ƒACODRIVERCOMMANDSERVICEROUTINE*6*‹PARAMETERADDRESSANDBOUNDARYCHECKSHAVEBEENMADE**ƒEntry:‚JSRFROMCMRHANDLER.*‹A2-PHYSICALADDRESSOFCMRPARAMETERBLOCK*‹A5-PHYSICALADDRESSOFCCB*5*ƒExit:‚RTS-PARAMETERBLOCKVALIDATIONSTATUSIND0**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A**P**PP*"*”A3=ACOPARAMETERBLOCKADDRESS*”A6=REQUESTORTCBADDRESS*J***************************************************************************)*ŒConvertlogicalPBaddresstophysical.*ACOCMDƒCLR.L…D57‰MOVE.L„XIOCPK(A2),D6‡SetupaddressofACOpara.block:‰MOVE.W„XIOPLN(A2),D5‡SetuplengthofACOparameterblock+‰MOVE.L„CCBTASKA(A5),A1…SetupTCBpointer.&‰BSR‡IOHADRCKŒCallconversionroutine.‰BRA.S…CMD010ŽGoodreturn.‰NOP›Badlengthreturn. ‰CLR.L…D0;‰MOVE.W„#RTCDPBLK,D0ˆSetupinvalidparameterblockaddress‰BRA.S…ACOCEX1gotoerrorexit*!*seeifpassedtheinitializeok*7CMD010ƒMOVE.L„D6,A3Stagephys.addr.ofACOpara.blk. ‰CLR.L…D04‰TST.B…CCBFLG(A5)ŠerrorcodesetinCCBduri ngINIT?/‰BEQ.S…CMD020Žbranchifnoerrorcode,continue$‰MOVE.B„CCBFLG(A5),D0‡seterrorcode‰BRA.S…ACOCEX2gotoerrorexit*,*ŒgetACOTBLaddressintoA4forcommanduse* CMD020ƒEQU‡* ‰MOVE.L„ACOTBL,A4‹ACOTBLaddress)‰CMP.L…#'!ACO',(A4)ˆreallyistheACOTBL?,‰BEQ.S…CMD030ŽbranchifreallyistheACOTBL4‰MOVE.W„#ACONTBL,D0‰seterrorreturncode-notable‰BRA.S…ACOCEX2andreturn**‹findACO-IDinACOTBL*‹A1=entryaddress*0CMD030ƒMOVE.L„XIOCID(A2),D0‡getspecifiedACO-ID(‰MOVE.B„ACONMAX(A4),D1†max#ofACO-ID's$‰MOVE.L„#ACONTRY,D2‰bumppastheader"FNDACO10CMP.L…(A4,D2),D0Šamatch?!‰BEQ.S…FNDACO20Œbranchifamatch&‰ADD.W…#ACOIDLNG,D2ˆbumptonextentry1‰SUB.L…#1,D1decrementnumberofentriestocheck&‰BNE.S…FNDACO10Œbranchifmoreentries.‰MOVE.W„#ACONID,D0Šerror-ACO-IDnotintable3‰BRA.S…ACOCEX2returntoCMRwitherrconditionset+FNDACO20MOVE.L„A4,A1bassaddressoftable‰ADD.L…D2,A1addressofentry*(*ŒFindthecommandinthecommandtable.*-‰MOVEQ…#NUMCMDS-1,D0‡Setuptheloopcounter./‰LEA‡CMDTBL,A0‹A0<--addressofcommandtable.+‰MOVE.W„CMDCOD(A3),D6‡getACOcommandcode.8CMDSRCH‚CMP.W…(A0)+,D6ŒSearchthetableforthecommand.‰DBEQ†D0,CMDSRCH3‰BNE.S…CMDERRŽIfwefoundthecommandinthetable,8‰ADD.L…#JMPOFF-2,A0ˆgetthecorrespondingentryfromthe5‰MOVE.W„(A0),D0jumptableandjumptotheroutineto"‰JMP‡(A0,D0.W)‹handlethecommand.>CMDERRƒMOVE.W„#ACOINVD,D0‰didn'tfindcmdcode-exitwitherrAACOCEX2‚MOVE.W„D0,CMDSTA(A3)‡writeerrcodetousersACOparablk ACOCEX1‚RTS*‰PAGEJ***************************************************************************A*„OPENCOMMAND‚assignsthelogicalconnectionbetweenausertask9*‰andspecifiedchannelswithinanACOmodule.8channels/*‰maximummaybespecifiedinoneopencommand.*#*„ACOOPENcommand‚parameterblock: *‰DS.W‚1„returnedcommandstatus*‰DS.W‚1„commandcode(01)*‰DS.W‚1„#ofchannelstoopen*‰DS.W‚1„1stchannelnumber*‰DS.W‚1„channelconfiguration*Œ.*‰DS.W‚1„nthchannelnumber*‰DS.W‚1„channelconfiguration**„configurationword:+*‰bit0=1wake-uptaskonoutputpulsedone-*Ž=0queueeventtotaskonoutputpulsedone2*ˆbit15=1usedefaultconfiguration(ignorebit0)+*Ž=0usespecifiedconfigurationfrombit0B*ƒDefaultconfiguration:‚nowakeuporqueueeventonpulseoutput.-*‰TheactualconfiguationissavedinACOTBL.%*‰ThetaskTCBaddressisalsosaved.*)*‚Entry:A1=addressofACO-IDinACOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofACOparameterblock*‰A4=addressofACOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:CLRIOM,SETIO,DOIOH**************************************************************************‰seeifchannelalreadyopened*$OPEN…PUSHPOINT‹savealladdressregs‰ALLOCATE‚CHCONFIG*2‰BSR‡CLRIOM„clear(to$FF)theIOmapforthisACO‰CLR.L…D7ˆchannelcounter:‰CMP.W…#ACONID,D0‚anerrorreturnedfromclearingthemap?)‰BEQ.S…OPNOID‡branchifanerrorreturned$‰CLR.L…D2‘channeloffsetintoACOTBL)‰CLR.L…D1‘offsetintoACOparameterblock1‰MOVE.W„CMDCHN(A3),D0†get#ofchannelsspecified/‰BLE.S…OPNINCbranchifnegativeorzero,error0‰CMP.W…#8,D0cannotspecifymorethan8channels-‰BGT.S…OPNINCbranchifgreaterthan8,errorEOPEN10ƒMOVE.W„NUMCHAN(A3,D1),D2‚getchannelnumberfromACOpara.blk.!‰CMP.W…#7,D2insurechannel#<8 ‰BGT.S…OPNINV‰MOVE.W„D2,D5Žsaveit0‰MULU†#CHANLNG,D2ˆgetchanneloffsetintoACOTBL‰ADD.L…#4,D2ŽbumppastACO-ID+‰TST.W…(A1,D2)Œthischannelalreadyopened?-‰BPL.S…OPNOPNbranchifalreadyopened,error‰ADD.L…#1,D7Žcountthischannel>‰MOVE.W„CHNCNFG(A3,D1),D3‚getconfigurationfromACOpara.blk.-‰STORE…D3,CHCONFIG†savechannelconfiguration*0*ŒsaveTCBaddressandconfigurationinformation*.‰LOAD†D3,CHCONFIG‰recallchannelconfiguration)‰BSR‡SETIOgosetIOmapforthischannel5‰CMP.W…#ACONID,D0Šanerrorfou ndduringthesavemap?*‰BEQ.S…OPNERRŽbranchifanerrorwasfound6‰MOVE.W„D3,ACOCNIF(A1,D2)ƒsaveconfigurationinACOTBL)‰MOVE.L„A6,ACOTCB(A1,D2)„saveTCBaddress4‰ADD.W…#OPNTRY,D1ŠbumptonextACOparam.blk.entry3‰SUB.W…#1,D0decrementnumberofchannelsspecified)‰BGT‡OPEN10Žbranchifmorechannelstodo*‰BSR‡DOIOgosettheIOhardwareregisters!‰CMP.W…#ACONID,D0Šanerrorfound?2‰BEQ.S…OPNERRŽbraifanerrwasfound-don'topen‰CLR.L…D0’setforgoodreturn‰BRA.S…OPNXITŽgoreturntoCMR**Œopenerrorshere*5OPNINVƒMOVE.W„#ACOICNS,D0‰setinvalidchannel#error ‰BRA.S…OPNXIT8OPNINCƒMOVE.W„#ACOINC,D0Šsetinvalid#ofchannelserror‰BRA.S…OPNXITŽexit;OPNOIDƒMOVE.W„#ACONID,D0ŠsetACOmodulenotallocatederror‰BRA.S…OPNXITŽgoreturntoCMR9OPNOPNƒMOVE.W„#ACOPND,D0Šsetchannelalreadyopenederror*)*Œresetanyopenedchannelstonotopened*%OPNERRƒTST.W…D7’anychannelstoundo?3‰BEQ.S…OPNXITŽbranchifnonetoundo,returntoCMR&‰MOVE.W„#$FFFF,D3‹set'un-opened'code‰CLR.L…D1’clearforuse6OPNERR10MOVE.W„NUMCHAN(A3,D1),D2ƒgetachannelnumber$‰MULU†#CHANLNG,D2‰getchanneloffset‰ADD.L…#4,D2bumppastheaders*‰MOVE.W„D3,(A1,D2)Šsetthisentryunopened-‰ADD.W…#OPNTRY,D1Šbumptonextchannelnumber‰SUB.W…#1,D7decrementcounter&‰BGT.S…OPNERR10Œbranchifmoretoundo*ŽFallintoexit* OPNXITƒEQU‡*)‰ADD.L…#8,A7…DEALLOCATECHCONFIGonstack‰POP_POINT‹restoreallpointers ‰BRA‡NRMEXIT*I**************************************************************************A*ƒCLRIOMƒClearouttheIOmapforthismemorymappedI/Oaddress.*&*‰Entry:A1=ACO-IDaddressinACOTBL%*A2=addressofCMRparameterblock%*A3=addressofACOparameterblock*A4=addressofACOTBL*A5=addressofCCB*A6=addressofusersTCB**‰Uses:‚D4,D6,D7*%*‰Exit:‚D0=ACONIDifanerrorfound**D0=contentsonentryifnoerrorfound*I**************************************************************************0CLRIOMƒMOVE.W„ACOIO(A4),D7ˆgetoffsettoIOmaps.‰MOVE.B„ACONAL(A4),D6‡get#ofACO'Sallocated3‰MOVE.L„CCBCHB(A5),D4‡getmemorymappedI/Oaddress?CLRIOM1‚CMP.L…IODDR(A4,D7),D4…lookformatchmem.map.I/Oaddr‰BEQ.S…CLRIOM2branchiffound#‰ADD.W…#IOLNG,D7‹bumptonextentry‰SUB.B…#1,D6decrementcounter/‰BNE.S…CLRIOM1branchifmoreentriestosearch#‰MOVE.W„#ACONID,D0Šseterrorreturn‰RTS›returntocaller)CLRIOM2‚CLR.B…DODR07(A4,D7)‡clearthemap‰RTS›returntocaller*‰PAGEI**************************************************************************<*ƒSETIO…BuildtheIOmapentriesforthespecifiedchannels.*Builds1entrypercall*MapisinACOTBL.**‰Entry:A4ƒ=ACOTBLaddress*D3.W=channelconfiguration*D5.B=channelnumber*7*‰Exit:‚D0.W=ACONIDifmapentrynotfound,otherwise*—D0unchanged *‰Uses:D4,D6*‰Entrypoint=SETIO*‰Exitpoint‚=SETIORT**ˆPrivatesubroutineforOPEN*$* Single exit & pointer preservation*I***************************************************************************‰findmapentry* SETIO„EQU‡*‰PUSHPOINT‘saveallpointers‰MOVE.L„D7,-(A7)‹saveD73‰MOVE.W„ACOIO(A4),D7†getoffsettostartofIOmaps.‰MOVE.B„ACONAL(A4),D6†get#ofACO'Sallocated3‰MOVE.L„CCBCHB(A5),D4†getmemorymappedI/Oaddress;SETIOFD‚CMP.L…IODDR(A4,D7),D4ƒfindthematchingI/Oaddress‰BEQ.S…SETIO00‹branchiffound#‰ADD.W…#IOLNG,D7‰bumptonextentry‰SUB.B…#1,D6Ždecrementcounter/‰BNE.S…SETIOFD‹branchifmoreentriestosearch8‰MOVE.W„#ACONID,D0†setfatalerr-thisshouldn'thappen‰BRA.S…SETIORT‰returntocaller**Œdeterminechannelnumber*SETIO00‚CLR.L…D6‘clearforuse/‰MOVE.B„D5,D6Žcopychannelnumbertoworkspace**ŒCHANNEL0-7asoutputchannel*0‰BSET†D5,DODR07(A4,D7)ƒsetdataimageforoutput"SETIORT‚MOVE.L„(A7)+,D7‹restoreD7‰POP_POINT‘restoreallpointers‰RTS—returntocaller*‰PAGED************************************** *******************************;*ƒDOIO†CopythedatainformationfromtheIOregisterimage"*(inthemap)totheIOregister.**ˆENTRYPARAMETERS:*A4=addressofACOTBL*A5=addressofCCB*)*‰Exit:‚D0.W=ACONIDifIOmapnotfound*D0.W=0ifnoerrorsfound**‰Uses:A0,D1,D6,D7*#* Single exit, pointer preservation*D********************************************************************* DOIO…EQU‡*‰PUSHPOINT’saveallpointers!‰MOVE.L„D7,-(A7)‹saveregisterD7*‰MOVE.W„ACOIO(A4),D7†getoffsettoIOmaps$‰MOVE.B„ACONAL(A4),D6†get#ofACO'S3‰MOVE.L„CCBCHB(A5),D1†getmemorymappedI/Oaddress*‰Thiscommanddeactivatesoutputsforspecifiedchannelsthat9*‰havepreviouslybeenopenedforoutputbythesametask<*‰requestingthisactivation.‚Theparameterblockischecked<*‰forerrorsbeforeanyoutputisdeactivated.‚Nochannelis#*‰deactivatedifanerrorisfound.*)*‰ACOOUTPUTOFFcommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode044*‰DS.Wƒ1ƒbitmaskcontainingchannel#'stoactivate*)*‚Entry:A1=addressofACO-IDinACOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofACOparameterblock*‰A4=addressofACOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:DOOFF*%* Single exit with pointers preserved*H*************************************************************************"OUTOFFƒPUSHPOINT‘saveallpointers0‰CLR.L‚D3‘flag-ckpara.blk .beforestopoutput'‰MOVE.L#4,D1ŽbumppastACO-IDintable!‰CLR.L‚D2‘useforchannelcounter‰CLR.L‚D0‘clearforuse+‰MOVE.WCMDCHN(A3),D0†getchannelstostart0‰MOVE.WƒD0,D3Œcopychan.toturnofftoworkreg+OUTOF20‚BTSTƒD2,D0Ždeactivatethischannel?0‰BEQ.S‚OUTOF30Œbranchifno-checknextchannel5‰CMP.L‚ACOTCB(A1,D1),A6ƒchannelbelongstothisuser? ‰BNE„OUTONERŒbranchifno,error.‰BCLR…D2,D3Œnegatecheckflagforthischannel$‰TST„D3‘isallofparameterchecked?(‰BNE.S‚OUTOF30Œbranchifnotallchecked2‰BSR.S‚DOOFFŽgoodpara.block-deactivatechannel‰BRA.S„OUTOFFXŠnormalexit/OUTOF30‚ADD.L‚#1,D2Žbumptonextchannelnumber-‰ADD.L‚#CHANLNG,D1ˆbumptonextchannelentry&‰CMP.L‚#8,D2checkedallthechannels?/‰BNE.S‚OUTOF20Œbranchifmorechannelstocheck ‰BRA†OUTONEROUTOFFX‚EQU‡*‰normalexit‰POP_POINT‹recallallpointers‰CLR.L„D0‰signalnoerrors‰BRA.S…NRMEXITƒnormalexit*‰PAGEI**************************************************************************"*‚STAT-GETOUTPUTSTATUSCOMMANDA*†Thiscommandreadsthestatusofspecifiedoutputchannels.The>*†channelsmusthavepreviouslybeenopenedforoutputbythisC*†user.TheparameterblockischeckedforerrorsbeforeanyoutputA*†statusisread.TheusersparameterblockismodifiedtosignalB*†activechannelsbysettingthecorrespondingbitinthebit-maskE*†word.Thecorrespondingbitnumberofinactivechannelsiscleared.* *†Allchannelsarereadatonce.*,*„ACOOUTPUTSTATUScommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode05<*‰DS.Wƒ1ƒbitmaskcontainingchannelsnumberstoreadstatus$*”(thisisalsothereturnedfield)*)*‚Entry:A1=addressofACO-IDinACOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofACOparameterblock*‰A4=addressofACOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:GTSTAT*I************************************************************************** STAT†PUSHPOINT‘saveallpointers(ŠCLR.L‚D5‘useforreturnedstatusvalues/ŠCLR.L‚D3‘flag-ckpara.blk.beforereadstatus(ŠMOVE.L#4,D1ŽbumppastACO-IDinACOTBLŠCLR.L‚D2‘channelcounterŠCLR.L‚D0‘clearforuse;ŠMOVE.WCMDCHN(A3),D0†getchannelnumberstoreadstatuson3ŠMOVE.WD0,D3Žcopychanactivationreq.bitpattern$ŠAND„#$00FF,D0Šmaskallbutlowbyte/STAT20„BTSTƒD2,D0Žreadstatusforthischannel?ŠBEQ.S‚STAT40branchifno5ŠCMP.L‚ACOTCB(A1,D1),A6ƒchannelbelongstothisuser?1ŠBNE„OUTONERŒbranchifno-returnwitherrorset0ŠBCLRƒD2,D3Žclractivationflagforthischannel*ŠTST„D3‘finishedcheckingparameterblock?1ŠBNE.S‚STAT40branchifnotfinishedcheckingyet0ŠBSR.S‚GTSTATgoreadstatusandsaveinREG.D5!ŠBRA.S‚STAT50gotoprocedureexit3STAT40„ADD.L‚#CHANLNG,D1ˆbumptonextchannelentry(ŠADD.L‚#1,D2Žbumptonextchannelnumber,ŠBRA„STAT20branchtochannelchecksequence6STAT50„MOVE.WD5,CMDCHN(A3)†setreturnedstatusvalues&ŠBRA„OUTONEXŒandreturnwithnoerrors*‰PAGEI*************************************************************************<*‚ENABLE-ENABLEINTERRUPTSCOMMAND---NOTUSEDTHISBOARD3*‰IFCALLED,EXITSWITHINVALIDCOMMANDERRORCODE.*0*„ACOENABLEINTERRUPTScommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode066*‰DS.Wƒ1ƒbitmaskofchannelstoenableforinterrupts)*‚Entry:A1=addressofACO-IDinACOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofACOparameterblock*‰A4=addressofACOTBL*‰A5=addressofCCB*‰A6=addressofusersTCBI**************************************************************************5ENABLER‚MOVE.W„#ACOINVD,D0‡setcode'invalidcommand'(‰BRA.S…NRMEXITŒandreturnwitherrorset**I*************************************************************************=*‚DSABLE-DISABLEINTERRUPTSCOMMAND---NOTUSEDTHISBOARD-*‰IFCALLED,EXITSWITHINVALIDCOMMANDCODE.*1*„ACODISABLEINTERRUPTS commandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode077*‰DS.Wƒ1ƒbitmaskofchannelstodisableforinterrupts)*‚Entry:A1=addressofACO-IDinACOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofACOparameterblock*‰A4=addressofACOTBL*‰A5=addressofCCB*‰A6=addressofusersTCBH*************************************************************************DSABLEƒBRA.S…ENABLER**H************************************************************************* *ƒNORMALEXIT,*ˆEntry:A2=addressofCMRparameterblock%*A3=addressofACOparameterblock*A5=addressofCCB*A6=addressofusersTCB*D0=ACOerrorcode*I**************************************************************************ANRMEXITƒMOVE.WD0,CMDSTA(A3)†setreturnstatusinACOpara.blockŠRTS—returntoCMR*‰PAGEH**************************************************************************ƒPLSO-PULSEDOUTPUTCOMMAND*)*‚Entry:A1=addressofACO-IDinACOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofACOparameterblock*‰A4=addressofACOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB*‚ExitstoNRMEXIT*+*‚Parameterblockformatforpulsedoutput:1*‚ACOparameterblock(pointedtobyA3onentry)* *ˆDS.W†1‰returnedcommandstatus*ˆDS.W†1‰commandcode*ˆDS.W†1‰numberofchannels<*---ƒ---ƒ---ƒparametersforindividualchannelsƒ---ƒ---ƒ---*ˆDS.W†1‰firstchannelnumber,*ˆDS.L†1‰numberofmillisecondsforpulseon*ˆ.*ˆ.*ˆDS.W†1‰nthchannelnumber2*ˆDS.L†1‰numberofmillisecondsfornthchanpulse*7* EACH CHANNEL IS ACTIVATED IN TURN (NON-SYNCHRONOUSLY)H*************************************************************************@*„Pulsed_Out(IN-LISTOFchannelactivationrequest,pulsetimes;*OUT-errorcode)?PLSO…ALLOCATECHANID,ACOPARBK†allocatechan.id&ACOparablock3‰STORE…A3,ACOPARBK‰saveACOparameterblockaddress ‰CLR.L…D6’Initiatepulsedoutput ‰CLR.L…D3 ‰CLR.L…D2 ‰CLR.L…D0$*—getnumberofchannelstoactivate9‰MOVE.W„CMDCHN(A3),D0‡getno.ofchan'sfromACOparablk)PLSO1„TST.W…D0’loopon#ofchan.'stodo ‰BEQ.S…PLSOX‰CLR.L…D5’getchannelnumber‰MOVE.W„NUMCHAN(A3,D6),D5-‰STORE…D5,CHANID‹savechannelnumberonstackC*„ChannelIDconsistsofuserCCBaddress+channumberinLSbyte.+‰MOVE.L„A5,D7copyuser'sCCBaddresstoD75‰ADD.L…D7,CHANID(A7)‡CHANIDnowhascompletechan.ID"‰MOVE.L„D5,D7copychannel#toD7,‰BSR‡BIN_BITconvertbinarytobitmapinD56‰MULU†#CHANLNG,D7‰computeoffsettonthchaninACOTBL%‰ADD‡#4,D7bumptouserTCBinACOTBL-‰CMP.L…ACOTCB(A1,D7),A6„compareTCBaddresses1‰BNE.S…PLSOER1branchonchannelnotcurrentuser2*„GetpulsetimefromACOcommmandparameterblock‰MOVE.L„CHNCNFG(A3,D6),D3%*„IFpulsetime>pulse_min_timeTHEN'‰BEQ.S…PLSOER3ƒbranchonpulsetime=0(‰ADD.W…#6,D6…incrementtonextchannel#-*„requestperiodicactivation(thischannel#)2‰LEA‡PLSOFF(PC),A0‡pointtopulseturnoffroutine%‰CLR.L…D1’setrequestfor1timeonly6‰MOVE.B„CCBPPRIO(A5),D1…setact.prioritysameastask/‰LOAD†D2,CHANID‹setupchannelIDtogotoPLSOFF‰PUSHALL'‰MOVE.L„D3,A1setupactivationinterval$‰TR0$.RQPA,“passrequestforwakeup)*ŒIfnoerrinperiodicact.requestTHEN‰BRA.S…RQPAOKŽgoodreturn(‰BRA.S…PLSOER4errinperiodicact.req."*›activate_this_channel(channel#)*RQPAOKƒMOVE.L„D5,D0passbitmasktoDOOUT ‰BSR‡DOOUT‰POPALL"‰SUB‡#1,D0decrementchannelcount ‰BRA‡PLSO1**ŒErrorhandling)PLSOER1‚CLR.L…D0’Channelnotcurrentuser‰MOVE.W„#ACOICNS,D0 ‰BRA.S…PLSOX1)PLSOER3‚CLR.L…D0’Requestedpulsetime=03‰MOVE.W„#ACOCNFG,D0‰return'badconfiguration'code ‰BRA.S…PLSOX1PLSOER4‚POPALL#‰CLR.L…D0’Periodicactivationerror,‰MOVE.W„#ACOBSY,D0‹return'devicebusy'code ‰BRA.S…PLSOX1*ŒPulsedoutputgoodexitpoint6PLSOX„LOAD†A3,ACOPARBK‚restoreACOparablkaddrtoA3‰CLR.L…D0ˆsetfornormalreturn4PL SOX1ƒADD.L…#12,A7„DEALLOC‚CHANID,ACOPARBKonstack*‰BRA‡NRMEXITƒgotonormalcommonexitpoint*‰PAGE*<*‚PULSEDOUTPUTDEACTIVATION‚Enteredbyperiodicactivation. *„Onentry:?*‡D1containschannelIDcomposedofuser'sCCBaddressinM.S.7*Š3bytes,andchannelnumber(0-7)inleastsig.byte.*PLSOFFƒPUSHALL&‰MOVE.B„D1,D5savecombinedchannelID ‰AND.B…#0,D1recoverCCBaddress+‰MOVE.L„D1,A5stageCCBaddressfor'DOOFF'+‰AND.L…#$000000FF,D5‡recoverchannelnumber‰MOVE.L„D5,D4savebinaryvalue‰MOVE.L„#$0C010000,D2 ‰MOVE.B„D5,D2.‰BSR.S…BIN_BITconvertchan#tobitmapinD5"‰MOVE.L„D5,D0stagedataforDOOFF‰BSR‡DOOFFturnoffchannel0‰MULU†#6,D4pointtodatafieldassoc.withchan.5‰ADD‡#ACONTRY,D4‰addoffsetto1stchanneldatafield‰ADD‡#4,D4addinsizeofACOID+‰MOVE.L„ACOTBL,A2‹getaddr.ofACOTBLtoA2,‰MOVE.L„CCBTASKA(A5),A6…A6=usersTCBaddr. ‰CLR.L…D72‰MOVE.B„ACONMAX(A2),D7†getmax#ofACO-ID'stoD7#‰MOVE.L„CCBMNEM(A5),D6†getCCBname!PLS001ƒEQU‡*“findmatchingACO-ID!‰MOVE.L„ACOID(A2),D3ˆACO-IDtoD3(‰CMP.L…D3,D6doesCCBnamematchACO-ID?‰BEQ.S…PLS002Žbranchonmatch*‰ADDA.W„#ACOIDLNG,A2ˆaddoffsettonextID"‰SUB.B…#1,D7endofpossibleID's?$‰BMI.S…PLS003ŽbranchonIDnotfound‰BRA‡PLS001ŽchecknextID PLS002ƒEQU‡*-‰MOVE.W„ACOCNIF(A2,D4),D0ƒconfigurationtoD0(‰BSR.S…NOTFYUSRŒseeifwakeuporquevent PLS003ƒEQU‡*‰POPALL‰RTE*‰PAGEF**********************************************************************$*‚BINARYtoBIT-mapconversioninD5@*…Producesa1inD5bitcorrespondingtothebinaryvalueinD5*…(uptobit15).A*…Forinput>15binary,theresultantpatterninD5isundefined*BIN_BIT‚ALLOCATE‚BITMAP‰CLR.L…BITMAP(A7)‰ADD.W…#1,BITMAP(A7) LOOP…EQU‡* ‰TST.W…D5 ‰BEQ.S…BINBITXexitonbitfound‰ROL.W…BITMAP(A7) ‰SUB‡#1,D5 ‰BRA.S…LOOP* BINBITX‚EQU‡*‰MOVE.W„BITMAP(A7),D5'‰ADD.L…#8,A7DEALLOCATEBITMAPonstack‰RTS*‰PAGEA*‚NOTIFYUSERƒbymeansofqueeventorwakeupasspecifiedinthe*”channelconfigurationword.*ƒINPUTPARAMETERS:'*A2:AddressofchannelnameinACOTBL;*D4:Offsetfromchannelnametochanneldatafield(base) *™inACOTBL.*A5:AddressofchannelCCB.*A6:User'sTCBaddress#*D2:$0C01*GNOTFYUSRMOVE.WƒACOCNIF(A2,D4),D0getconfigurationfromchannelACOTBL#‰BTST†#15,D0‹defaultconfiguration? ‰BNE.S…NOTIFX1‰BTST…#0,D0‰no,determine:wake-up=1orq-event=0 ‰BNE.S…NOTIFA*ŽQueueevent;datastaging:$*ŽD2=$0C01 *ŽD3=ACOID*ŽD4=MemmappedI/Oaddress*ŽA6=User'sTCBaddress*8‰MOVE.L„CCBCHB(A5),D4ƒgetmem.mappedI/Oaddressstaged‰BSR.S…QUEVENT‰queuetheevent‰BRA.S…NOTIFXŠgotoexit*+NOTIFAƒMOVE.LƒA6,A0ŽstageusersTCBaddress#‰TR0$.WAKEUP,issuewakeuptouserNOTIFX:‰RTS*ŠPAGE*H*‚QUEVENT-queue'seventtodrivingtaskusingdatastagedinregisters *‹asfollows:*‹A6=user'sTCBaddress&*‹D2=$0C01*‹D3=ACOID‚(modulename)&*‹D4=memmappedI/Oaddressofboard<*†(dumpscontentsofregistersD2,D3,&D4tousersbuffer)* QUEVENT‚EQU‡*‰PUSHALLpushallregs"‰MOVE.L„A6,A0…stageuser'saddress ‰TR0$.QEVNTI*+‰BRA.S…QUEVNTOK‚goodreturnforqueueevent+‰BRA.S…QUEVNTER‚badreturnfromqueueeventQUEVNTOKEQU‡*‰POPALLŽrestoreallregs‰RTS QUEVNTER:(‰BRA‡QUEVNTOK‚putabreakherefordebug*‰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‘Mustb eonwordboundary.)ŠBNE.S‚IOHADR4Branchifbadbufferbase.ŠTST.L‚D5”Lengthcan'tbezero.1ŠBEQ.S‚IOHADR8Don'tgotologphywithzerocount1ŠMOVE.LTCBTST(A1),A0‰Addressoftaskseg.table. ŠTR0$.LOGPHY*.ŠBRA.S‚IOHADR8Branchforgoodaddressreturn.0ŠBRA.S‚IOHADR6Branchforbadbytecountreturn.(ŠTST.L‚D5”Wasanentrypointerreturned.#ŠBEQ.S‚IOHADR4Branchifno-ERROR)ŠTST.B‚7(A0,D5)ŽIsthisanMMIOsegment?ŠBNE.S‚IOHADR8Yes,OK.3IOHADR4ƒADD.L‚#2,(A7)AdjustPCforinvalidreturn.3IOHADR6ƒADD.L‚#2,(A7)AdjustPCforinvalidreturn.IOHADR8ƒRTSšReturn.*ŠPAGEH*************************************************************************!* INTERRUPT SIDE FOR IOH HANDLING*?*ƒPURPOSE:‚HANDLEACKNOWLEDGEMENTSANDMESSAGECOMPLETIONSFROM2*ˆTHEIOH.‚OPERATESATHARDWAREINTERRUPTPRIORITY=*ˆLEVELASASUBROUTINETOTHEFIRSTLEVELINTERRUPTHANDLER.*+*ƒENTRY:‚JSR‚FROMINTERRUPTHANDLERROUTINE*‹A0-WORKREGISTER *‹A1=SELF*‹A5=ADDRESSOFCCB*‹D0=WORKREGISTER*/*ƒEXIT:‚RTS-BACKTOINTERRUPTHANDLERROUTINE*/*ƒNOTE:ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***@*ƒThisroutineiscalledonlybythecommoninterrupthandlerin'*ƒRMS68K.ƒThecommoninterrupthandler:7*ƒDOES‚NOT‚PRESERVEƒVALUES‚IN‚REGISTERS‚BEFORE‚THE‚CALL?*ƒThisinterrupthandlerMUSTPRESERVEalldata&addressregs.**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A*****P***4*ƒIfchannelisoff-lineornotattached,justexit.H*************************************************************************<*‹FindACOTABLEmodule(board)namewhichmatchesCCBname:*3ACOINTƒMOVEM.LƒA0-A6/D1-D7,-(A7)ƒsaveallexceptD01‰ALLOCATE‚ACOTADR,CHANUM†allocatelocalvariables-‰MOVE.L„ACOTBL,A2‹getaddressofACOTBLtoA2 ‰CLR.L…D76‰MOVE.B„ACONMAX(A2),D7†getmaxnumberofACOID'stoD7#‰MOVE.L„CCBMNEM(A5),D0†getccbname2IOHI011‚EQU‡*‡findmatchingACOIDloopentrypoint*‰MOVE.L„ACOID(A2),D3ˆgetACOIDforstaging'‰CMP.L…D3,D0doesCCBnamematchACOID?#‰BEQ.S…IOHI020branchonnamematch.‰ADDA.W„#ACOIDLNG,A2ˆaddoffsettonextACOTBL#‰SUB.B…#1,D7testforendofACOTBL4‰BMI.S…IOHIPX„error,exitonACO-IDnotfoundinCCB ‰BRA‡IOHI011D*„Foundmatchingnames,nowgetnumberofinterruptingchanneltoD2C*„onthisboard,usenon-existantchan.8toindicatenointerrupt.5IOHI020‚STORE…A2,ACOTADRŠsaveACOTBLaddressonstack,‰MOVE.L„#$0C010008,D2‡initparafieldsinD2*‰STORE…D2,CHANUM‹savechan.#&returncode>*„ComputeaddressoffieldinACOTBLhavinguser'sTCBaddress ‰CLR.L…D4!‰MOVE.B„D2,D4getchannel‚toD4.B$IOHIPXƒEQU‡*“'ACOINT'procedureexit-‰MOVE.L„#0,D0getint.claimcheck(0=none)*„dealocateACOTADR,CHANUM#‰ADD‡#12,A7Žreleaselocalvariables0‰MOVEM.Lƒ(A7)+,A0-A6/D1-D7ƒrestoreallexceptD0-‰AND‡#$FFFE,SR‹signalCMR'int.notfromACO'‰RTS**‰ENDéééé éFTACO…IDNTƒ1,0ACOsubroutines**‰FORTRANcallablesubroutines*‰forACOdrivercalls*$*‰CALLACOCMD(aco_id,param_blk_addr)*‰whereACOCMDmaybe:*)*‰CALLACOPEN(aco_id,param_blk_addr)…open**‰CALLACOCLS(aco_id,param_blk_addr)…close.*‰CALLACOOUT(aco_id,param_blk_addr)…outputon/*‰CALLACOOFF(aco_id,param_blk_addr)…outputoff+*‰CALLACOSTA(aco_id,param_blk_addr)…status2*‰CALLACOPLS(aco_id,param_blk_addr)„outputpulsed*,*‰Allargumentsforthecallsareidentical.7*‰Thecontentsoftheparam_blkforeachcallisunique*‰tothecall.*6*‰Allthecommandsubroutinescallacommonsubroutine3*‰ACOSETtobuildtheinitiateI/Oparameterblock.**‰STACKFORALLCALLS:*7*‰deepeststack:(stackaddressstaysatACOSETreturn)0*˜commandcodeƒ2bytes(initiateI/Oparam.blk) *˜n/aŒ2bytes*˜aco_id‰4bytes *˜n/aŒ4bytes *˜n/aŒ4bytes *˜n/aŒ4bytes,*˜commandaddrƒ4bytes(acocommandaddress)**˜commandlng„2bytes(acocommandlength)-*˜ACOSETreturn‚4bytesdeepeststackaddress *˜A34bytes *˜A24bytes *˜A14bytes *˜D04bytes*‰entrystack:ƒreturn‰4bytes*˜^param_blk_adr4bytes*˜^aco-idˆ4bytes* ŠSECTION9!ŠXDEFƒACOPEN,ACOCLS,ACOOUT,ACOOFFŠXDEFƒACOSTA,ACOPLS*$*‰CALLACOPEN(aco_id,param_blk_addr)*‰openandconfigurechannels*1ACOPEN„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters3ŠBSR„ACOSETset-uptheinitiateI/Oparameterblock)ŠMOVE.L#1,(A2)ŒsettheopencommandcodeACOPN00ƒCLR.L‚D0‘clearforuse'ŠMOVE.W4(A2),D0‹getnumberofchannelsŠASL.L‚#2,D0Žmultiplyby4.ACOPN05ƒADD.L‚#6,D0Žaddinthe6byteoverhead-ACOPN10ƒMOVE.WD0,(A1)Œsetthecommandlength-ŠMOVE.LA3,A0ŽTRAP#1parameterblockaddress#ŠMOVE.L#60,D0CMRdirectivenumberŠTRAPƒ#1‘callRMS68K'ŠMOVE.WD0,(A2)Œsetthereturnedstatus)ŠMOVEM.L(A7)+,D0/A1-A3„restoreregisters!ŠMOVE.L(A7)+,A0‹putreturninA0 ŠLEA„8(A7),A7‹cleanupthestackŠJMP„(A0)returntouser*$*‰CALLACOCLS(aco_id,param_blk_addr)"*‰closeallchannelsforthisuserÙDâ8ê *1ACOCLS„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚ACOSETset-uptheinitiateI/Oparameterblock*ŠMOVE.L#2,(A2)Œsettheclosecommandcode&ŠMOVE.W#4,D0ŽACOclosecommandlengthŠBRA„ACOPN10ŒgodotheCMRcall*$*‰CALLACOOUT(aco_id,param_blk_addr)'*‰activateoutputonrequestedchannels*1ACOOUT„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚ACOSETset-uptheinitiateI/Oparameterblock+ŠMOVE.L#3,(A2)Œsettheoutputcommandcode*ACOUT10ƒMOVE.Wƒ#6,D0ŒsetupcommandlengthŠBRA„ACOPN10ŒgodotheCMRcall*$*‰CALLACOOFF(aco_id,param_blk_addr))*‰deactivateoutputonspecifiedchannels*1ACOOFF„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚ACOSETset-uptheinitiateI/Oparameterblock/ŠMOVE.L#4,(A2)Œsettheoutputoffcommandcode4ŠBRA„ACOUT10Œgosetcommandlength&dotheCMRcall*$*‰CALLACOSTA(aco_id,param_blk_addr))*‰readinputstatusonspecifiedchannels*1ACOSTA„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚ACOSETset-uptheinitiateI/Oparameterblock+ŠMOVE.L#5,(A2)Œsetthestatuscommandcode4ŠBRA„ACOUT10Œgosetcommandlength&dotheCMRcall*$*‰CALLACOPLS(aco_id,param_blk_addr)>*‰activateoutputforx#ofmillisecondsonspecifiedchannels*1ACOPLS„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚ACOSETset-uptheinitiateI/Oparameterblock2ŠMOVE.L#8,(A2)ŒsetthepulsedoutputcommandcodeŠCLR.L‚D0‘clearforuse,ŠMOVE.W4(A2),D0‹getspecified#ofchannelsŠASL.L‚#2,D0Žmultiplyby6ŠADD.W‚4(A2),D 04ŠBRA„ACOPN05Œgosetcommandlength&dotheCMRcallŠPAGE*4*‰ACOSETsetuptheCMRinitiateI/Oparameterblock,*‰returns:ƒA1=addressforACOcommandlength(*”A2=ACOcommandparameterblockaddress)*”A3=initiateI/Oparameterblockaddress*(ACOSET„CLR.W‚-2(A7)clearcommandlength-ŠLEA„-2(A7),A1Šsaveaddressofcommandlength$ŠMOVE.L24(A7),A0Šgetparam_blk_addr%ŠMOVE.LA0,-6(A7)Šsaveparam_blk_addr,ŠMOVE.LA0,A2Žsaveparam_blk_addrforreturnŠCLR.L‚-10(A7)ŒnotusedŠCLR.L‚-14(A7)ŒnotusedŠCLR.L‚-18(A7)ŒnotusedŠMOVE.L28(A7),A0Šgetaco_idŠMOVE.L(A0),-22(A7)‡getaco_idŠCLR.W‚-24(A7)Œnotused0ŠMOVE.W#$0700,-26(A7)…initiateI/Ocommandcode4ŠLEA„-26(A7),A3‰initiateI/OparameterblockaddressŠRTS—returntocaller*ŠEND*éééééé*!*…MVME625DCOUTPUTBOARDDRIVER *…copyrighted1983MOTOROLAINC. *œTOMKRYKA* ‰LLEN120 ŠTTL„STR.EQŠINCLUDE9995.&.STR.EQ ŠTTL„TCB.EQ‰PAGEŠINCLUDE9995.&.TCB.EQŠTTLTR1RTCD.EQ‰PAGEŠINCLUDE9995.&.TR1RTCD.EQ ŠTTLCCB.EQ‰PAGEŠINCLUDE9995.&.CCB.EQ ŠTTLLV5.EQ‰PAGEŠINCLUDE9995.&.LV5.EQŠTTL9995.&.M625DRV.EQ‰PAGEŠINCLUDE9995.&.M625DRV.EQŠTTLMVME625DRIVER‰PAGE#M625DRV‚IDNTƒ1,0‰DCODRIVERƒ4/21/83J****************************************************************************ƒDR625--REV.1.007/5/83*+*ƒPurpose:‚MVME625DCOUTPUTBOARDHANDLER*/*ƒEntry:‚JSRFROMCMRHANDLER(COMMANDSERVICE) *‹JSRFROMCMRINTERRUPTHANDLER-*ƒExit:-ALWAYSEXITSWITHARTSINSTRUCTION**ƒCODEISRE-ENTRANT*H*-----------------------------------------------------------------------********************************* CHANNEL CONTROL BLOCK (CCB) *********************************B*ƒContainschanneldevicedependentdescriptionanddataareasfor*ƒI/Ohandler.*ŠOFFSET‚CCBDDP*H* I/O HANDLER DATA AREA *************************************************CCBFLG„DS.B„2ŒFlags(CCBERAD1‚DS.B„4ŒErrordebugsaveaddress2CCBQVER1‚DS.B„4ŒEventqueueingerrordebugaddress7CCBCCB„DS.B„4ŒPhysicaladdressofcommandpacket(IOCB)CCBTASKB‚DS.B„4ŒBuffertaskTCB-CCBPKT„DS.B„18‹Eventworkarea(commandtour)0CCBCPKTƒDS.B„18‹Eventworkarea(interrupttour)(CCBPTR„DS.B„4ŒPhysicaladdressofbufferCCBLEN„DS.B„4ŒLengthofbuff er0CCBPTR1ƒDS.B„4ŒPhysicaladdressof2ndarybuffer&CCBLEN1ƒDS.B„4ŒLengthof2ndarybuffer*CCBCID„DS.B„4ŒCMRparameterblockid(DCB)CCBCOPTƒDS.B„2ŒIOCBoptions#CCBCFIGƒDS.B„$26ŠConfigurationdata**‰56bytesremain*9*‰CCBFLGDEFINITIONS:if‚CCBFLG.Bifnot0theDCOmodule$*fortheCCBcannotbeusedforthe*followingreasons:*9*‰CCBFLG.B=$FA=CCBallocationexceeded#ofspecified/*šdevices-noroominDCOtableforthemodule!*’=$FC=noDCOTBLwasallocated òKûG2 =99#@+D3@;<C7K<S5[=c?kAsD{Jƒ>‹&/*’=$F5=noroominDCOTBLforthisDCOmodule*™(incorrecttableallocation)*‰PAGE ‰SECTION8 ‰XREFDCOTBLJ****************************************************************************‚DCOSERVICEVECTORTABLE*L*****************************************************************************#*ˆDC.L†DCOINTŽinterruptsvcaddress!*ˆDC.L†DCOCMDŽcommandsvcaddress)*ˆDC.L†DCOINITinitializationsvcaddress*?*Below are the new offset form of service pointers, for new CMR*DCODVR:(‰DC.L†DCOINT-DCODVR†interruptsvcoffset*‰DC.L†DCOCMD-DCODVR†commandserviceoffset.‰DC.L†DCOINIT-DCODVR…initializationsvcoffset‰DC.L†0‰Reserved‰DC.B†0“numberofextrapages‰DC.B†0,0,0reserved‰DC.L†0,0,0reserved*3*ƒ---ƒ---…CONFIGURATIONCONTROLINFORMATION…---ƒ---*$‰DC.B…'070583'ƒdateoflastassembly'‰DC.B†''‡spacemeansnopatchesin.LO#‰DC.B†'4'‡majorVersadosrevision#*‰PAGEJ****************************************************************************‰COMMANDTABLE&JUMPTABLE*:*‰Theseareusedbythecommandserviceroutinetojumpto.*‰theappropriateroutinetohandleacommand.*J***************************************************************************CMDTBL:ŠDC.WƒDCOPENOPENcommand.ŠDC.WƒDCOCLSCLOSEcommand.ŠDC.WƒDCOUTŽOUTPUTONcommand. ŠDC.WƒDCOOFFOUTPUTOFFcommand.ŠDC.WƒDCOSTASTATUScommand.ŠDC.WƒX1‘(notused)ŠDC.WƒX2‘(notused)#ŠDC.WƒDCOPLSPULSEDOUTPUTcommand.=NUMCMDSƒEQU„(*-CMDTBL)/2‡Thenumberofcommandsinthetable.*9JMPTBL:ƒDC.WƒOPEN-*Biasestothecorrespondingroutines. ŠDC.WƒCLOSE-* ŠDC.WƒOUTON-*ŠDC.WƒOUTOFF-* ŠDC.WƒSTAT-*ŠDC.WƒENABLE-*ŠDC.WƒDSABLE-* ŠDC.WƒPLSO-**7JMPOFF„EQU„JMPTBL-CMDTBL†Offsetbetweenthetwotables.*ŠPAGEJ***************************************************************************+*ˆDCODRIVERINITIALIZATIONSERVICEROUTINE*>*ˆThedriverisenteredhereforeachCCBallocated.‚Morethan:*ˆoneCCBmaybeallocatedforeachDCOmodule.‚OneCCBis%*ˆallocatedforeachinterruptlevel.?*ˆThisroutinecheckstoseeifthereisroomintheDCOTBLfor=*ˆthedeviceID.‚ItsavesthedeviceIDandthememorymapped**ˆI/OaddressofthedeviceintheDCOTBL.*:*ˆAnerrorcodeissavedintheCCBifthisCCBallocation=*ˆexceedsthemaximumnumberofCCB'sspecifiedduringSYSGEN:*ˆ(SYSGENparameterNDCO1),ifnoDCOTBLexistsornoroom*ˆinthetableforthismodule.*$*ˆEntry:‚allregistersareavailable*A5=CCBaddress*I**************************************************************************,*‚singleexit&pointer(A0-A6)preservation*DCOINIT:ŠPUSHPOINT‘savepointers3ŠMOVE.LƒCCBCHB(A5),A0„getmemorymappedI/Oaddress$ŠMOVE.LDCOTBL,A1ŠgetDCOTBLaddressŠCMP.L‚#0,A1Žisthereone?&ŠBNE.S‚DCOINIT1‹branchifhaveatable8ŠMOVE.B#DCONTBL,CCBFLG(A5)setnotableerrorcondition!ŠBRA.SDCOINEX1ŒgotoerrorreturnDCOINIT5‚TST.L‚(A1,D3)Œlookforanentryslottosavethisguy5ŠBMI.S‚DCOINIT6‹branchifthisslotisempty-useit.ŠADD.W‚#IOLNG,D3‰notempty,bumptonextentry"ŠSUB.B‚#1,D4Ždecrementthecounter(ŠBNE.S‚DCOINIT5‹branchifmoretosearch4ŠBRA„DCOEXTER‹errorifgothere-noroomforthemap>DCOINIT6‚MOVE.LD2,(A1,D3)‰savethismemorymappedI/OaddressŠMOVE.L‚#0,D0write0toregŠMOVE.B‚D0,IOADR(A0)1DCOEXIT1‚CLR.B‚CCBFLG(A5)‰setforgoodallocation3ŠMOVE.LCCBCHB(A5),A1†getmemorymappedI/Oaddress'DCOINEX1:POP_POINT‘recallallpointersŠRTS*ŠPAGEJ***************************************************************************$*‰DCODRIVERCOMMANDSERVICEROUTINE*6*‹PARAMETERADDRESSANDBOUNDARYCHECKSHAVEBEENMADE**ƒEntry:‚JSRFROMCMRHANDLER.*‹A2-PHYSICALADDRESSOFCMRPARAMETERBLOCK*‹A5-PHYSICALADDRESSOFCCB*5*ƒExit:‚RTS-PARAMETERBLOCKVALIDATIONSTATUSIND0**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A**P**PP*"*”A3=DCOPARAMETERBLOCKADDRESS*”A6=REQUESTORTCBADDRESS**ƒCODEISRE-ENTRANT*J***************************************************************************)*‰ConvertlogicalPBaddresstophysical.*DCOCMD„CLR.L‚D5;ŠMOVE.LXIOCPK(A2),D6†SetupaddressofDCOparameterblock:ŠMOVE.WXIOPLN(A2),D5†SetuplengthofDCOparameterblock+ŠMOVE.LCCBTASKA(A5),A1„SetupTCBpointer.&ŠBSR„IOHADRCK‹Callconversionroutine.ŠBRA.S‚CMD010Goodreturn.ŠNOP—Badlengthreturn. ŠCLR.L‚D0;ŠMOVE.W#RTCDPBLK,D0‡SetupinvalidparameterblockaddressŠBRA.SDCOCEX1gotoerrorexit*!*‰seeifpassedtheinitializeok*7CMD010„MOVE.LƒD6,A3ŒStagephys.addr.ofDCOpara.blk. ŠCLR.L‚D04ŠTST.B‚CCBFLG(A5)‰errorcodesetinCCBduringINIT?/ŠBEQ.S‚CMD020branchifnoerrorcode,continue$ŠMOVE.BCCBFLG(A5),D0†seterrorcodeŠBRA.S‚DCOCEX2Œgotoerrorexit CMD020„EQU**,*‰getDCOTBLaddressintoA4forcommanduse* ŠMOVE.LDCOTBL,A4ŠDCOTBLaddress)ŠCMP.L‚#'!DCO',(A4)‡reallyistheDCOTBL?,ŠBEQ.S‚CMD030branchifreallyistheDCOTBL4ŠMOVE.W#DCONTBL,D0ˆseterrorreturncode-notableŠBRA.S‚DCOCEX2Œandreturn**‰findDCO-IDinDCOTBL*‰A1=entryaddress*0CMD030„MOVE.LXIOCID(A2),D0†getspecifiedDCO-ID(ŠMOVE.BDCONMAX(A4),D1…max#ofDCO-ID's$ŠMOVE.L#DCONTRY,D2ˆbumppastheader"FNDDCO10‚CMP.L‚(A4,D2),D0‰amatch?!ŠBEQ.S‚FNDDCO20‹branchifamatch&ŠADD.W‚#DCOIDLNG,D2‡bumptonextentry1ŠSUB.L‚#1,D1Ždecrementnumberofentriestocheck&ŠBNE.S‚FNDDCO10‹branchifmoreentries.ŠMOVE.W#DCONID,D0‰error-DCO-IDnotintable5ŠBRA.S‚DCOCEX2ŒreturntoCMRwitherrorconditionset+FNDDCO20‚MOVE.LA4,A1ŽbassaddressoftableŠADD.L‚D2,A1Žaddressofentry (*‰Findthecommandinthecommandtable.*-ŠMOVEQ‚#NUMCMDS-1,D0†Setuptheloopcounter./ŠLEA„CMDTBL,A0ŠA0<--addressofcommandtable.+ŠMOVE.WCMDCOD(A3),D6†getDCOcommandcode.8CMDSRCHƒCMP.W‚(A0)+,D6‹Searchthetableforthecommand.ŠDBEQƒD0,CMDSRCH3ŠBNE.S‚CMDERRIfwefoundthecommandint  hetable,8ŠADD.L‚#JMPOFF-2,A0‡getthecorrespondingentryfromthe5ŠMOVE.W(A0),D0Œjumptableandjumptotheroutineto"ŠJMP„(A0,D0.W)Šhandlethecommand.DCMDERR„MOVE.W#DCOINVD,D0ˆdidn'tfindcommandcode-exitwitherrorCDCOCEX2ƒMOVE.WƒD0,CMDSTA(A3)„writeerrorcodetousersDCOparablk DCOCEX1ƒRTS*ŠPAGEL******************************************************************************‰OPENCOMMAND*A*‰Thiscommandassignsthelogicalconnectionbetweenausertask9*‰andspecifiedchannelswithinanDCOmodule.8channels/*‰maximummaybespecifiedinoneopencommand.*#*‰DCOOPENcommand‚parameterblock: *DS.W‚1„returnedcommandstatus*DS.W‚1„commandcode(01)*DS.W‚1„#ofchannelstoopen*DS.W‚1„1stchannelnumber*DS.W‚1„channelconfiguration*’.*DS.W‚1„nthchannelnumber*DS.W‚1„channelconfiguration**‰configurationword:+*bit0=1wake-uptaskonoutputpulsedone-*•=0queueeventtotaskonoutputpulsedone2*bit15=1usedefaultconfiguration(ignorebit0) *•=0usespecifiedconfiguration**‰Defaultconfiguration:,*nowakeuporqueueeventonpulsedoutput.B*‰Whendefaultconfigurationisspecified,theactualconfiguation9*‰issavedinDCOTBL.ThetaskTCBaddressisalsosaved.*)*‚Entry:A1=addressofDCO-IDinDCOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofDCOparameterblock*‰A4=addressofDCOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:CLRIOM,SETIO,DOIO*K*****************************************************************************‰seeifchannelalreadyopened*$OPEN†PUSHPOINT‘savealladdressregsŠALLOCATEƒCHCONFIG2ŠBSRCLRIOMclear(to$FF)theIOmapforthisDCOŠCLR.L‚D7‘channelcounter:ŠCMP.W‚#DCONID,D0‰anerrorreturnedfromclearingthemap?)ŠBEQ.S‚OPNOIDbranchifanerrorreturned$ŠCLR.L‚D2‘channeloffsetintoDCOTBL)ŠCLR.L‚D1‘offsetintoDCOparameterblock1ŠMOVE.WCMDCHN(A3),D0†get#ofchannelsspecified/ŠBLE.S‚OPNINCbranchifnegativeorzero,error0ŠCMP.W‚#8,D0cannotspecifymorethan8channels-ŠBGT.S‚OPNINCbranchifgreaterthan8,errorGOPEN10„MOVE.WNUMCHAN(A3,D1),D2‚getchannelnumberfromDCOparam.blk.!ŠCMP.W#7,D2insurechannel#<8 ŠBGT.SOPNINVŠMOVE.WD2,D5Žsaveit0ŠMULUƒ#CHANLNG,D2ˆgetchanneloffsetintoDCOTBLŠADD.L‚#4,D2ŽbumppastDCO-ID+ŠTST.W‚(A1,D2)Œthischannelalreadyopened?-ŠBPL.S‚OPNOPNbranchifalreadyopened,errorŠADD.L‚#1,D7Žcountthischannel@ŠMOVE.WCHNCNFG(A3,D1),D3‚getconfigurationfromDCOparam.blk.-ŠSTORE„D3,CHCONFIG†savechannelconfiguration*0*‰saveTCBaddressandconfigurationinformation*.ŠLOAD…D3,CHCONFIG†recallchannelconfiguration+ŠBSR.S‚SETIOgosetIOmapforthischannel5ŠCMP.W‚#DCONID,D0‰anerrorfoundduringthesavemap?*ŠBEQ.S‚OPNERRbranchifanerrorwasfound6ŠMOVE.WD3,DCOCNIF(A1,D2)‚saveconfigurationinDCOTBL)ŠMOVE.LA6,DCOTCB(A1,D2)ƒsaveTCBaddress4ŠADD.W‚#OPNTRY,D1‰bumptonextDCOparam.blk.entry3ŠSUB.W‚#1,D0Ždecrementnumberofchannelsspecified)ŠBGT„OPEN10branchifmorechannelstodo,ŠBSR.S‚DOIOŽgosettheIOhardwareregisters!ŠCMP.W‚#DCONID,D0‰anerrorfound?7ŠBEQ.S‚OPNERRbranchifanerrorwasfound-don'topenŠCLR.L‚D0‘setforgoodreturnŠBRA.S‚OPNXITgoreturntoCMR**‰openerrorshere*5OPNINVƒMOVE.W„#DCOICNS,D0‰setinvalidchannel#error ‰BRA.S…OPNXIT8OPNINCƒMOVE.W„#DCOINC,D0‰setinvalid#ofchannelserror‰BRA.S…OPNXIT‹exit;OPNOIDƒMOVE.W„#DCONID,D0‰setDCOmodulenotallocatederror‰BRA.S…OPNXITgoreturntoCMR9OPNOPNƒMOVE.W„#DCOPND,D0‰setchannelalreadyopenederror*)*‰resetanyopenedchannelstonotopened*%OPNERR„TST.W‚D7‘anychannelstoundo?3ŠBEQ.S‚OPNXITbranchifnonetoundo,returntoCMR&ŠMOVE.W#$FFFF,D3Šset'un-opened'codeŠCLR.L‚D1‘clearforuse6OPNERR10‚MOVE.WNUMCHAN(A3,D1),D2‚getachannelnumber$ŠMULUƒ#CHANLNG,D2ˆgetchanneloffsetŠADD.L‚#4,D2Žbumppastheaders*ŠMOVE.  WD3,(A1,D2)‰setthisentryunopened-ŠADD.W‚#OPNTRY,D1‰bumptonextchannelnumberŠSUB.W‚#1,D7Ždecrementcounter&ŠBGT.S‚OPNERR10‹branchifmoretoundo*…Fallintoexit* OPNXIT EQU *)ŠADD.L„#8,A7ŒDEALLOCATECHCONFIGonstackŠPOP_POINT‘restoreallpointers ŠBRANRMEXIT*ŠPAGEK*****************************************************************************‰SETIO*6*‰BuildtheIOmapentriesforthespecifiedchannels.*‰Builds1entrypercall*‰MapisinDCOTBL.**‰Entry:A4ƒ=DCOTBLaddress*D3.W=channelconfiguration*D5.B=channelnumber*7*‰Exit:‚D0.W=DCONIDifmapentrynotfound,otherwise*—D0unchanged *‰Uses:D4,D6*‰Entrypoint=SETIO*‰Exitpoint‚=SETIORT**ˆPrivatesubroutineforOPEN*$* Single exit & pointer preservation*L******************************************************************************‰findmapentry* SETIO EQU *ŠPUSHPOINT‘saveallpointersŠMOVE.LD7,-(A7)‹saveD73ŠMOVE.WDCOIO(A4),D7†getoffsettostartofIOmaps.ŠMOVE.BDCONAL(A4),D6†get#ofDCO'Sallocated3ŠMOVE.LCCBCHB(A5),D4†getmemorymappedI/Oaddress;SETIOFD‚CMP.L‚IODDR(A4,D7),D4ƒfindthematchingI/OaddressŠBEQ.S‚SETIO00‹branchiffound#ŠADD.W‚#IOLNG,D7‰bumptonextentryŠSUB.B‚#1,D6Ždecrementcounter/ŠBNE.S‚SETIOFD‹branchifmoreentriestosearch>ŠMOVE.W#DCONID,D0‰setforfatalerror-thisshouldn'thappenŠBRA.S„SETIORT‰returntocaller**‰determinechannelnumber*SETIO00‚CLR.L‚D6‘clearforuse/ŠMOVE.BD5,D6Žcopychannelnumbertoworkspace**‰CHANNEL0-7asoutputchannel*/ŠBSETƒD5,DODR07(A4,D7)ƒsetddrimageforoutput"SETIORT‚MOVE.L(A7)+,D7‹restoreD7ŠPOP_POINT‘restoreallpointersŠRTS—returntocaller*ŠPAGED**********************************************************************‰DOIO*6*ˆCopythedatainformationfromtheIOregisterimage"*ˆ(inthemap)totheIOregister.**ˆENTRYPARAMETERS:*A4=addressofDCOTBL*A5=addressofCCB*)*‰Exit:‚D0.W=DCONIDifIOmapnotfound*D0.W=0ifnoerrorsfound**‰Uses:A0,D1,D6,D7*#* Single exit, pointer preservation*D********************************************************************* DOIO EQU *ŠPUSHPOINT’saveallpointers!ŠMOVE.LD7,-(A7)‹saveregisterD7*ŠMOVE.WDCOIO(A4),D7†getoffsettoIOmaps$ŠMOVE.BDCONAL(A4),D6†get#ofDCO'S3ŠMOVE.LCCBCHB(A5),D1†getmemorymappedI/Oaddress*‰Thiscommanddeactivatesoutputsforspecifiedchannelsthat9*‰havepreviouslybeenopenedforoutputbythesametask<*‰requestingthisactivation.‚Theparameterblockischecked<*‰forerrorsbeforeanyoutputisdeactivated.‚Nochannelis#*‰deactivatedifanerrorisfound.*)*‰DCOOUTPUTOFFcommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode044*‰DS.Wƒ1ƒbitmaskcontainingchannel#'stoactivate*)*‚Entry:A1=addressofDCO-IDinDCOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofDCOparameterblock*‰A4=addressofDCOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:DOOFF*%* Single exit with pointers preserved*L*****************************************************************************OUTOFF:ŠPUSHPOINT‘saveallpointers2ŠCLR.L‚D3‘flagtockpara.blk.beforestopoutput'ŠMOVE.L#4,D1ŽbumppastDCO-IDintable!ŠCLR.L‚D2‘useforchannelcounterŠCLR.L‚D0‘clearforuse+ŠMOVE.WCMDCHN(A3),D0†getchannelstostart0ŠMOVE.WƒD0,D3Œcopychan.toturnofftoworkreg+OUTOF20ƒBTSTƒD2,D0Ždeactivatethischannel?0ŠBEQ.S‚OUTOF30Œbranchifno-checknextchannel5ŠCMP.L‚DCOTCB(A1,D1),A6ƒchannelbelongstothisuser? ŠBNE„OUTONERŒbranchifno,error.ŠBCLR…D2,D3Œnegatecheckflagforthischannel$ŠTST„D3‘isallofparameterchecked?(ŠBNE.S‚OUTOF30Œbranchifnotallchecked5ŠBSR.S‚DOOFFŽgoodpara.block-godeactivatechannelŠBRA.S„OUTOFFXŠnormalexit/OUTOF30ƒADD.L‚#1,D2Žbumptonextchannelnumber-ŠADD.L‚#CHANLNG,D1ˆbumptonextchannelentry&ŠCMP.L‚#8,D2checkedallthechannels?/ŠBNE.S‚OUTOF20Œbranchifmorechannelstocheck ŠBRA†OUTONEROUTOFFXEQU*šnormalexitŠPOP_POINT‘recallallpointersŠCLR.L„D0signalnoerrorsŠBRANRMEXITnormalexit*‰PAGE*;* DOOFF talks directly to the IO reg and turns off outputs.G* On entry: D0 has bit map of channels to turn off (a 1 means turn off)*‹A5hasaddressofuserCCB:*ˆDOOFFiscalledbyOUTOFFandPULSEDOUTPUTdeactivation DOOFF…EQU†*/ŠMOVE.LƒA2,-(A7)ŒsaveaddressofCMRparablock3ŠMOVE.LƒCCBCHB(A5),A2‡getmemorymappedI/Oaddress)ŠEOR.B„D0,IOADR(A2)†turnoffselected0-72ŠMOVE.Lƒ(A7)+,A2ŒrestoreaddressofCMRparablockŠRTS*ŠPAGEM******************************************************************************"*ˆSTAT-GETOUTPUTSTATUSCOMMANDA*ˆThiscommandreadsthestatusofspecifiedoutputchannels.The>*ˆchannelsmusthavepreviouslybeenopenedforoutputbythisC*ˆuser.TheparameterblockischeckedforerrorsbeforeanyoutputA*ˆstatusisread.TheusersparameterblockismodifiedtosignalB*ˆactivechannelsbysettingthecorrespondingbitinthebit-maskE*ˆword.Thecorrespondingbitnumberofinactivechannelsiscleared.*-*ˆAllchannelsinaIOsidearereadatonce.*,*‰DCOOUTPUTSTATUScommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode05<*‰DS.Wƒ1ƒbitmaskcontainingchannelsnumberstoreadstatus$*”(thisisalsothereturnedfield)*)*‚Entry:A1=addressof  DCO-IDinDCOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofDCOparameterblock*‰A4=addressofDCOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:GTSTAT*M******************************************************************************STAT:ŠPUSHPOINT‘saveallpointers(ŠCLR.L‚D5‘useforreturnedstatusvalues2ŠCLR.L‚D3‘flagtockpara.blk.beforereadstatus(ŠMOVE.L#4,D1ŽbumppastDCO-IDinDCOTBLŠCLR.L‚D2‘channelcounterŠCLR.L‚D0‘clearforuse;ŠMOVE.WCMDCHN(A3),D0†getchannelnumberstoreadstatuson3ŠMOVE.WD0,D3Žcopychanactivationreq.bitpattern$ŠAND„#$00FF,D0Šmaskallbutlowbyte/STAT20„BTSTƒD2,D0Žreadstatusforthischannel?ŠBEQ.S‚STAT40branchifno5ŠCMP.L‚DCOTCB(A1,D1),A6ƒchannelbelongstothisuser?1ŠBNE„OUTONERŒbranchifno-returnwitherrorset0ŠBCLRƒD2,D3Žclractivationflagforthischannel*ŠTST„D3‘finishedcheckingparameterblock?1ŠBNE.S‚STAT40branchifnotfinishedcheckingyet0ŠBSR.S‚GTSTATgoreadstatusandsaveinREG.D5!ŠBRA.S‚STAT50gotoprocedureexit3STAT40„ADD.L‚#CHANLNG,D1ˆbumptonextchannelentry(ŠADD.L‚#1,D2Žbumptonextchannelnumber,ŠBRA„STAT20branchtochannelchecksequence6STAT50„MOVE.WD5,CMDCHN(A3)†setreturnedstatusvalues&ŠBRA„OUTONEXŒandreturnwithnoerrors*‰PAGE*I* GSTAT reads the channels as required by the channel activation bit map,*‡onabytebasis.**‡DataisreturnedinD5.**…Channeldatamask:/BS07…EQU‡$000000FF‹selectmaskforchannels0-7* GTSTAT EQU *‰MOVE.L„A2,-(A7)ŒpushA25‰MOVE.L„CCBCHB(A5),A2‡getmemorymappedI/Obaseaddr8‰MOVE.W„CMDCHN(A3),D0‡getnewchannelactivationbitmap)‰AND‡#BS07,D0Œselectchannels0-7bitmap)‰BEQ.S…GSTATXŽexitonnochannelstoread%‰MOVE.B„IOADR(A2),D5†getchannels0-7'‰AND.B…D0,D5maskoffnon-readchannels GSTATX EQU *‰MOVE.L„(A7)+,A2ŒrestoreA2‰RTS*ŠPAGEM******************************************************************************$*‰ENABLE-ENABLEINTERRUPTSCOMMAND**‰NOTUSEDTHISBOARD3*‰IFCALLED,EXITSWITHINVALIDCOMMANDERRORCODE.*0*‰DCOENABLEINTERRUPTScommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode06A*‰DS.Wƒ1ƒbitmaskcontainingchannelnumberstoenableinterrupts)*‚Entry:A1=addressofDCO-IDinDCOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofDCOparameterblock*‰A4=addressofDCOTBL*‰A5=addressofCCB*‰A6=addressofusersTCBM******************************************************************************ENABLE:5ENABLERƒMOVE.Wƒ#DCOINVD,D0‡setcode'invalidcommand'&ŠBRA„NRMEXITŒandreturnwitherrorset***M******************************************************************************%*ˆDSABLE-DISABLEINTERRUPTSCOMMAND**‰NOTUSEDTHISBOARD-*‰IFCALLED,EXITSWITHINVALIDCOMMANDCODE.*1*‰DCODISABLEINTERRUPTScommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode07B*‰DS.Wƒ1ƒbitmaskcontainingchannelnumberstodisableinterrupts)*‚Entry:A1=addressofDCO-IDinDCOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofDCOparameterblock*‰A4=addressofDCOTBL*‰A5=addressofCCB*‰A6=addressofusersTCBM******************************************************************************DSABLE:‰BRA.S…ENABLER*‰PAGEM*******************************************************************************ˆPLSO-PULSEDOUTPUTCOMMAND*)*‚Entry:A1=addressofDCO-IDinDCOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofDCOparameterblock*‰A4=addressofDCOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB*‚ExitstoNRMEXIT*+* Parameter block format for pulsed output:1* DCO parameter block (pointed to by A3 on entry)* *ˆDS.W†1‰returnedcommandstatus*ˆDS.W†1‰commandcode*ˆDS.W†1‰numberofchannels<*ƒ---ƒ---ƒ---ƒparametersfori  ndividualchannelsƒ---ƒ---ƒ---*ˆDS.W†1‰firstchannelnumber,*ˆDS.L†1‰numberofmillisecondsforpulseon*ˆ.*ˆ.*ˆDS.W†1‰nthchannelnumber5*ˆDS.L†1‰numberofmillisecondsfornthchannelpulse*7* EACH CHANNEL IS ACTIVATED IN TURN (NON-SYNCHRONOUSLY)M******************************************************************************@*„Pulsed_Out(IN-LISTOFchannelactivationrequest,pulsetimes;*OUT-errorcode)BPLSO…ALLOCATECHANID,DCOPARBK†allocatechannelid&DCOparablock3‰STORE…A3,DCOPARBK‰saveDCOparameterblockaddress ‰CLR.L…D6’Initiatepulsedoutput ‰CLR.L…D3 ‰CLR.L…D2 ‰CLR.L…D0$*—getnumberofchannelstoactivate<‰MOVE.W„CMDCHN(A3),D0‡getnumberofchan'sfromDCOparablkPLSO1:$‰TST.W…D0’loopon#ofchan.'stodo ‰BEQ.S…PLSOX‰CLR.L…D5’getchannelnumber‰MOVE.W„NUMCHAN(A3,D6),D5-‰STORE…D5,CHANID‹savechannelnumberonstackC*„ChannelIDconsistsofuserCCBaddress+channumberinLSbyte.+‰MOVE.L„A5,D7copyuser'sCCBaddresstoD75‰ADD.L…D7,CHANID(A7)‡CHANIDnowhascompletechan.ID"‰MOVE.L„D5,D7copychannel#toD7,‰BSR‡BIN_BITconvertbinarytobitmapinD56‰MULU†#CHANLNG,D7‰computeoffsettonthchaninDCOTBL%‰ADD‡#4,D7bumptouserTCBinDCOTBL-‰CMP.L…DCOTCB(A1,D7),A6„compareTCBaddresses1‰BNE.S…PLSOER1branchonchannelnotcurrentuser2*„GetpulsetimefromDCOcommmandparameterblock‰MOVE.L„CHNCNFG(A3,D6),D3%*„IFpulsetime>pulse_min_timeTHEN'‰BEQ.S…PLSOER3ƒbranchonpulsetime=0(‰ADD.W…#6,D6…incrementtonextchannel#-*„requestperiodicactivation(thischannel#)2‰LEA‡PLSOFF(PC),A0‡pointtopulseturnoffroutine%‰CLR.L…D1’setrequestfor1timeonly6‰MOVE.B„CCBPPRIO(A5),D1…setact.prioritysameastask/‰LOAD†D2,CHANID‹setupchannelIDtogotoPLSOFF‰PUSHALL'‰MOVE.L„D3,A1setupactivationinterval$‰TR0$.RQPA,“passrequestforwakeup)*ŒIfnoerrinperiodicact.requestTHEN‰BRA.S…RQPAOKŽgoodreturn(‰BRA.S…PLSOER4errinperiodicact.req.RQPAOK:"*›activate_this_channel(channel#)$‰MOVE.L„D5,D0passbitmasktoDOOUT ‰BSR‡DOOUT‰POPALL"‰SUB‡#1,D0decrementchannelcount ‰BRA‡PLSO1**ŒErrorhandlingPLSOER1:"‰CLR.L…D0’Channelnotcurrentuser‰MOVE.W„#DCOICNS,D0 ‰BRA.S…PLSOX1*PLSOER3:"‰CLR.L…D0’Requestedpulsetime=03‰MOVE.W„#DCOCNFG,D0‰return'badconfiguration'code ‰BRA.S…PLSOX1*PLSOER4:‰POPALL#‰CLR.L…D0’Periodicactivationerror,‰MOVE.W„#DCOBSY,D0‹return'devicebusy'code ‰BRA.S…PLSOX1*PLSOX:*ŒPulsedoutputgoodexitpoint6‰LOAD†A3,DCOPARBK‰restoreDCOparablockaddresstoA3‰CLR.L…D0ˆsetfornormalreturn*PLSOX1:1‰ADD.L…#12,A7„DEALLOCATECHANID,DCOPARBKonstack*‰BRA‡NRMEXITƒgotonormalcommonexitpoint*‰PAGE*„PULSEDOUTPUTDEACTIVATION:!*ŒEnteredbyperiodicactivation. *‡Onentry:?*ˆD1containschannelIDcomposedofuser'sCCBaddressinM.S.7*‹3bytes,andchannelnumber(0-7)inleastsig.byte.*PLSOFF:‰PUSHALL&‰MOVE.B„D1,D5savecombinedchannelID ‰AND.B…#0,D1recoverCCBaddress+‰MOVE.L„D1,A5stageCCBaddressfor'DOOFF'+‰AND.L…#$000000FF,D5‡recoverchannelnumber‰MOVE.L„D5,D4savebinaryvalue‰MOVE.L„#$0C010000,D2 ‰MOVE.B„D5,D2.‰BSR.S…BIN_BITconvertchan#tobitmapinD5"‰MOVE.L„D5,D0stagedataforDOOFF‰BSR‡DOOFFturnoffchannel0‰MULU†#6,D4pointtodatafieldassoc.withchan.5‰ADD‡#DCONTRY,D4‰addoffsetto1stchanneldatafield‰ADD‡#4,D4addinsizeofDCOID+‰MOVE.L„DCOTBL,A2‹getaddr.ofDCOTBLtoA2,‰MOVE.L„CCBTASKA(A5),A6…A6=usersTCBaddr. ‰CLR.L…D72‰MOVE.B„DCONMAX(A2),D7†getmax#ofDCO-ID'stoD7#‰MOVE.L„CCBMNEM(A5),D6†getCCBname!PLS001ƒEQU‡*“findmatchingDCO-ID!‰MOVE.L„DCOID(A2),D3ˆDCO-IDtoD3(‰CMP.L…D3,D6doesCCBnamematchDCO-ID?‰BEQ.S…PLS002Žbranchonmatch*‰ADDA.W„#DCOIDLNG,A2ˆaddoffsettonextID"‰SUB.B…#1,D7endofpossibleID's?$‰BMI.S…PLS003ŽbranchonIDnotfound‰BRA‡PLS001ŽchecknextID PLS002ƒEQU‡*-‰MOVE.W„DCOCNIF(A2,D4),D0ƒconfigurationtoD0(‰BSR.S  …NOTFYUSRŒseeifwakeuporquevent PLS003ƒEQU‡*‰POPALL‰RTE*‰PAGE$*‰Binarytobit-mapconversioninD5@*‰Producesa1inD5bitcorrespondingtothebinaryvalueinD5*‰uptobit15.@*‹Forinput>15binarytheresultantpatterninD5isundefinedBIN_BIT:‰ALLOCATE‚BITMAP‰CLR.L…BITMAP(A7)‰ADD.W…#1,BITMAP(A7) LOOP…EQU‡* ‰TST.W…D5 ‰BEQ.S…BINBITXexitonbitfound‰ROL.W…BITMAP(A7) ‰SUB‡#1,D5 ‰BRA.S…LOOP* BINBITX‚EQU‡*‰MOVE.W„BITMAP(A7),D5'‰ADD.L…#8,A7DEALLOCATEBITMAPonstack‰RTS*‰PAGE *„NOTIFYUSERA*ˆnotifyuserbymeansofqueeventorwakeupasspecifiedinthe*ˆchannelconfigurationword.*„INPUTPARAMETERS:'*’A2:AddressofchannelnameinDCOTBL;*’D4:Offsetfromchannelnametochanneldatafield(base) *™inDCOTBL.*’A5:AddressofchannelCCB.*’A6:User'sTCBaddress#*’D2:$0C01* NOTFYUSR:?‰MOVE.WƒDCOCNIF(A2,D4),D0getconfigurationfromchannelDCOTBL#‰BTST†#15,D0‹defaultconfiguration? ‰BNE.S…NOTIFX1‰BTST…#0,D0‰no,determine:wake-up=1orq-event=0 ‰BNE.S…NOTIFA*ŽEnqueueevent;datastaging:$*ŽD2=$0C01 *ŽD3=DCOID*ŽD4=MemmappedI/Oaddress*ŽA6=User'sTCBaddress*8‰MOVE.LƒCCBCHB(A5),D4…getmem.mappedI/Oaddressstaged ‰BSR.SQUEVENTenqueuetheevent‰BRA.S‚NOTIFXŽgotoexit*+NOTIFAƒMOVE.LƒA6,A0ŽstageusersTCBaddress#‰TR0$.WAKEUP,issuewakeuptouserNOTIFX:‰RTS*ŠPAGEO******************************************************************************** *ˆNORMALEXIT*,*‚Entry:A2=addressofCMRparameterblock%*‰A3=addressofDCOparameterblock*‰A5=addressofCCB*‰A6=addressofusersTCB*‰D0=DCOerrorcode*I**************************************************************************NRMEXIT:>ŠMOVE.WD0,CMDSTA(A3)†setreturnstatusinDCOparameterblockŠRTS—returntoCMR*ŠPAGE*H*‚QUEVENT-queue'seventtodrivingtaskusingdatastagedinregisters *‹asfollows:*‹A6=user'sTCBaddress&*‹D2=$0C01*‹D3=DCOID‚(modulename)&*‹D4=memmappedI/Oaddressofboard<*†(dumpscontentsofregistersD2,D3,&D4tousersbuffer)* QUEVENT EQU *‹PUSHALL”pushallregs"‹MOVE.L…A6,A0Žstageuser'saddress ‹TR0$.QEVNTI*)‹BRA.SƒQUEVNTOKŒgoodreturnforqueevent'‹BRA.SƒQUEVNTERŒbadreturnfromqueventQUEVNTOK EQU *‹POPALL•restoreallregs‹RTS QUEVNTER:(‹BRAQUEVNTOKputabreakherefordebug*Š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‘Mustbeonworkboundary.)ŠBNE.S‚IOHADR4Branchifbadbufferbase.ŠTST.L‚D5”Lengthcan'tbezero.2ŠBEQ.S‚IOHADR8Don'tgotologphywithzerocount.1ŠMOVE.LTCBTST(A1),A0‰Addressoftaskseg.table. ŠTR0$.LOGPHY*.ŠBRA.S‚IOHADR8Branchforgoodaddressreturn.0ŠBRA.S‚IOHADR6Branchforbadbytecountreturn.(ŠTST.L‚D5”Wasanentrypointerreturned.#ŠBEQ.S‚IOHADR4Branchifno-ERROR)ŠTST.B‚7(A0,D5)ŽIsthisanMMIOsegment?ŠBNE.S‚IOHADR8Yes,OK.3IOHADR4ƒADD.L‚#2,(A7)AdjustPCforinvalidreturn.3IOHADR6ƒADD.L‚#2,(A7)AdjustPCforinvalidreturn.IOHADR8ƒRTSšReturn.*ŠPAGEJ***************************************************************************!* INTERRUPT SIDE FOR IOH HANDLING*?*ƒPURPOSE:‚HANDLEACKNOWLEDGEMENTSANDMESSAGECOMPLETIONSFROM2*THEIOH.‚OPERATESATHARDWAREINTERRUPTPRIORITY=*LEVELASASUBROUTINETOTHEFIRSTLEVELINTERRUPTHANDLER.  *+*ƒENTRY:‚JSR‚FROMINTERRUPTHANDLERROUTINE*‹A0-WORKREGISTER *‹A1=SELF*‹A5=ADDRESSOFCCB*‹D0=WORKREGISTER*/*ƒEXIT:‚RTS-BACKTOINTERRUPTHANDLERROUTINE*/*ƒNOTE:ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***@*ƒThisroutineiscalledonlybythecommoninterrupthandlerin'*ƒRMS68K.ƒThecommoninterrupthandler:;*ƒ!!!ƒDOES‚NOTƒPRESERVEƒVALUESƒINƒREGISTERSƒBEFOREƒTHEƒCALLK*ƒsothisinterrupthandlermustpruservealldatareg.'s&addressreg.'s.5*ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***ƒ***‚***‚******ƒ***ƒ***ƒ*****ƒREGISTERSUSED:ƒ01234567 *”D******** *”A*****P***4*ƒIfchannelisoff-lineornotattached,justexit.K****************************************************************************<*‹FindDCOTABLEmodule(board)namewhichmatchesCCBname:*3DCOINTƒMOVEM.LƒA0-A6/D1-D7,-(A7)ƒsaveallexceptD01‰ALLOCATE‚DCOTADR,CHANUM†allocatelocalvariables-‰MOVE.L„DCOTBL,A2‹getaddressofDCOTBLtoA2 ‰CLR.L…D76‰MOVE.B„DCONMAX(A2),D7†getmaxnumberofDCOID'stoD7#‰MOVE.L„CCBMNEM(A5),D0†getccbname2IOHI011‚EQU‡*‡findmatchingDCOIDloopentrypoint*‰MOVE.L„DCOID(A2),D3ˆgetDCOIDforstaging'‰CMP.L…D3,D0doesCCBnamematchDCOID?#‰BEQ.S…IOHI020branchonnamematch.‰ADDA.W„#DCOIDLNG,A2ˆaddoffsettonextDCOTBL#‰SUB.B…#1,D7testforendofDCOTBL6‰BMI.S…IOHIEX01Œbranchtoerrorexit1onidnotfound ‰BRA‡IOHI011F*…Foundmatchingnames,nowgetnumberofinterruptingchannel(toD2)$*£inthiscase,non-existantchan.85IOHI020‚STORE…A2,DCOTADRŠsaveDCOTBLaddressonstack,‰MOVE.L„#$0C010008,D2‡initparafieldsinD2+‰STORE…D2,CHANUM‹savechan.#&returncode>*„ComputeaddressoffieldinDCOTBLhavinguser'sTCBaddress ‰CLR.L…D4!‰MOVE.B„D2,D4getchannel‚toD4.B$IOHIPXƒEQU‡*‰'DCOINT'procedureexit2‰MOVE.L„#0,D0getinterruptclaimcheck(=0-none)*„dealocateDCOTADR,CHANUM#‰ADD‡#12,A7Žreleaselocalvariables0‰MOVEM.Lƒ(A7)+,A0-A6/D1-D7ƒrestoreallexceptD02‰AND‡#$FFFE,SR‹signalCMR'interruptnotfromDCO'‰RTS*IOHIEX01EQU‡*,*‹errorexitforDCOIDnamenotfoundinCCB‰BRA‡IOHIPXŽgotoprocedureexit**‰ENDééFTDCO…IDNTƒ1,0DCOsubroutines**‰FORTRANcallablesubroutines*‰forDCOdrivercalls*$*‰CALLDCOCMD(dco_id,param_blk_addr)*‰whereDCOCMDmaybe:*)*‰CALLDCOPEN(dco_id,param_blk_addr)…open**‰CALLDCOCLS(dco_id,param_blk_addr)…close.*‰CALLDCOOUT(dco_id,param_blk_addr)…outputon/*‰CALLDCOOFF(dco_id,param_blk_addr)…outputoff+*‰CALLDCOSTA(dco_id,param_blk_addr)…status2*‰CALLDCOPLS(dco_id,param_blk_addr)„outputpulsed*,*‰Allargumentsforthecallsareidentical.7*‰Thecontentsoftheparam_blkforeachcallisunique*‰tothecall.*6*‰Allthecommandsubroutinescallacommonsubroutine3*‰DCOSETtobuildtheinitiateI/Oparameterblock.**‰STACKFORALLCALLS:*7*‰deepeststack:(stackaddressstaysatDCOSETreturn)0*˜commandcodeƒ2bytes(initiateI/Oparam.blk) *˜n/aŒ2bytes*˜dco_id‰4bytes *˜n/aŒ4bytes *˜n/aŒ4bytes *˜n/aŒ4bytes,*˜commandaddrƒ4bytes(dcocommandaddress)**˜commandlng„2bytes(dcocommandlength)-*˜DCOSETreturn‚4bytesdeepeststackaddress *˜A34bytes *˜A24bytes *˜A14bytes *˜D04bytes*‰entrystack:ƒreturn‰4bytes*˜^param_blk_adr4bytes*˜^dco-idˆ4bytes* ŠSECTION9!ŠXDEFƒDCOPEN,DCOCLS,DCOOUT,DCOOFFŠXDEFƒDCOSTA,DCOPLS*$*‰CALLDCOPEN(dco_id,p  aram_blk_addr)*‰openandconfigurechannels*1DCOPEN„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters3ŠBSR„DCOSETset-uptheinitiateI/Oparameterblock)ŠMOVE.L#1,(A2)ŒsettheopencommandcodeDCOPN00ƒCLR.L‚D0‘clearforuse'ŠMOVE.W4(A2),D0‹getnumberofchannelsŠASL.L‚#2,D0Žmultiplyby4.DCOPN05ƒADD.L‚#6,D0Žaddinthe6byteoverhead-DCOPN10ƒMOVE.WD0,(A1)Œsetthecommandlength-ŠMOVE.LA3,A0ŽTRAP#1parameterblockaddress#ŠMOVE.L#60,D0CMRdirectivenumberŠTRAPƒ#1‘callRMS68K'ŠMOVE.WD0,(A2)Œsetthereturnedstatus)ŠMOVEM.L(A7)+,D0/A1-A3„restoreregisters!ŠMOVE.L(A7)+,A0‹putreturninA0 ŠLEA„8(A7),A7‹cleanupthestackŠJMP„(A0)returntouser*$*‰CALLDCOCLS(dco_id,param_blk_addr)"*‰closeallchannelsforthisuser“Dœ8¤ *1DCOCLS„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚DCOSETset-uptheinitiateI/Oparameterblock*ŠMOVE.L#2,(A2)Œsettheclosecommandcode&ŠMOVE.W#4,D0ŽDCOclosecommandlengthŠBRA„DCOPN10ŒgodotheCMRcall*$*‰CALLDCOOUT(dco_id,param_blk_addr)'*‰activateoutputonrequestedchannels*1DCOOUT„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚DCOSETset-uptheinitiateI/Oparameterblock+ŠMOVE.L#3,(A2)Œsettheoutputcommandcode*DCOUT10ƒMOVE.Wƒ#6,D0ŒsetupcommandlengthŠBRA„DCOPN10ŒgodotheCMRcall*$*‰CALLDCOOFF(dco_id,param_blk_addr))*‰deactivateoutputonspecifiedchannels*1DCOOFF„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚DCOSETset-uptheinitiateI/Oparameterblock/ŠMOVE.L#4,(A2)Œsettheoutputoffcommandcode4ŠBRA„DCOUT10Œgosetcommandlength&dotheCMRcall*$*‰CALLDCOSTA(dco_id,param_blk_addr))*‰readinputstatusonspecifiedchannels*1DCOSTA„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚DCOSETset-uptheinitiateI/Oparameterblock+ŠMOVE.L#5,(A2)Œsetthestatuscommandcode4ŠBRA„DCOUT10Œgosetcommandlength&dotheCMRcall*$*‰CALLDCOPLS(dco_id,param_blk_addr)>*‰activateoutputforx#ofmillisecondsonspecifiedchannels*1DCOPLS„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚DCOSETset-uptheinitiateI/Oparameterblock2ŠMOVE.L#8,(A2)ŒsetthepulsedoutputcommandcodeŠCLR.L‚D0‘clearforuse,ŠMOVE.W4(A2),D0‹getspecified#ofchannelsŠASL.L‚#2,D0Žmultiplyby6ŠADD.W‚4(A2),D04ŠBRA„DCOPN05Œgosetcommandlength&dotheCMRcallŠPAGE*4*‰DCOSETsetuptheCMRinitiateI/Oparameterblock,*‰returns:ƒA1=addressforDCOcommandlength(*”A2=DCOcommandparameterblockaddress)*”A3=initiateI/Oparameterblockaddress*(DCOSET„CLR.W‚-2(A7)clearcommandlength-ŠLEA„-2(A7),A1Šsaveaddressofcommandlength$ŠMOVE.L24(A7),A0Šgetparam_blk_addr%ŠMOVE.LA0,-6(A7)Šsaveparam_blk_addr,ŠMOVE.LA0,A2Žsaveparam_blk_addrforreturnŠCLR.L‚-10(A7)ŒnotusedŠCLR.L‚-14(A7)ŒnotusedŠCLR.L‚-18(A7)ŒnotusedŠMOVE.L28(A7),A0Šget^dco_idŠMOVE.L(A0),-22(A7)‡getdco_idŠCLR.W‚-24(A7)Œnotused0ŠMOVE.W#$0700,-26(A7)…initiateI/Ocommandcode4ŠLEA„-26(A7),A3‰initiateI/OparameterblockaddressŠRTS—returntocaller*ŠEND*éé  éééé@‰TTLRAD1DRIVER‚===============================================9RADDRVƒIDNT†1,0RAD1DRIVER‚COPYRIGHT1982MOTOROLA,INC.‰PAGE8*ˆ6/21/82ƒ<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<H*************************************************************************ˆ======================*ˆ{”}*‡{†RADDriver†}*ˆ{”}*ˆ======================I*************************************************************************** ‰TTLSTR.SA‰PAGE‰INCLUDE9995.&.STR.EQ* ‰TTLTCB.EQ‰PAGE‰INCLUDE9995.&.TCB.EQ* ‰TTLCCB.SA‰PAGE‰INCLUDE9995.&.CCB.EQ* ‰TTLLV5.SA‰PAGE‰INCLUDE9995.&.LV5.EQ*‰TTL9995.&.RADDRV.EQ‰PAGEŠINCLUDE9995.&.RADDRV.EQ*@‰TTLRAD1DRIVER‚===============================================ŠPAGE;************************************************************ *ˆCONSTANTS*;*************************************************************ˆCommandCodes*%RASTPCMDEQU‡00ˆ"Stop"commandvalue.%RALODCMDEQU‡01ˆ"Load"commandvalue.%RADMPCMDEQU‡02ˆ"Dump"commandvalue.%RAJMPCMDEQU‡03ˆ"Jump"commandvalue.*RATSTCMDEQU‡04ˆ"Self-test"commandvalue.&RAOPNCMDEQU‡$10‡"Open"commandvalue.'RACLSCMDEQU‡$20‡"Close"commandvalue.'RAABTCMDEQU‡$7F‡"Abort"commandvalue.2RAEXTCMDEQU‡$81‡"Externaltrigger"commandvalue.*RASETCMDEQU‡$82‡"Setpoint"commandvalue.&RASCNCMDEQU‡$83‡"Scan"commandvalue.1RAATOCMDEQU‡$84‡"Auto-rangescan"commandvalue.+RACALCMDEQU‡$85‡"Calibrate"commandvalue.1RAHISCMDEQU‡$86‡"High-speedscan"commandvalue.:RAXEQBYTEQU‡$80‡"Executefunction"command(OR-edinwith(*¦functionnumbertoformcommandbyte.)RAXEQCMDEQU‡RAXEQBYT7RASTOPITEQU‡$FF‡ValuetoputinstopbytetostopRAD.**ˆOffsetsinshared-RAM=*’(68000addressing--i.e.valuesaretwicethe6809offsets.)*RASTPBYTEQU‡0‰Stopbyte.RACMDBYTEQU‡2‰Commandbyte.#RAINTFLGEQU‡4‰Interruptflagbyte."RACSTAT‚EQU‡6‰Commandstatusbyte.#RAINTMSKEQU‡8‰Interruptmaskbyte.¥¬Fµ<½8Å0ÍFÕ0ÝCå7í2õEý?- 250%@-:5:=6E3M=U5]3e0m8u8}-…6-•6%RAFIFOSTEQU‡10ˆStart-of-FIFOoffset."RAFIFONDEQU‡12ˆEnd-of-FIFOoffset(RANXT2GTEQU‡14ˆFIFO-next-to-getoffset.RAPRMPTREQU‡18ˆParameterptr.'RAPARAM‚EQU‡84ˆStartofparameterlist.!RATSTAT‚EQU‡502‡Self-teststatus.BRAOK2STOEQU‡508‡High-speedscan"communications"flag.‚(1=okto**¦putdata,2=oktotakedata,0=stop))RAXSTAT‚EQU‡510‡Hardwarestatusregister.***ˆTableoffsets**)*‚CCB(device-dependentsection)offsets.*;RARDLADREQU‡CCBDDP„AddrofthisRAD'sentryin'RARADLST'.ARACMDCODEQU‡RARDLADR+4ˆCommandcodeRADiscurrentlyworkingon.8RARDFLAGEQU‡RACMDCOD+1Š"Interrupt-being-serviced"flag.3RAUSRTCBEQU‡RARDFLAG+1ŠAddrofcurrentuser'sTCB.:RARTRVADEQU‡RAUSRTCB+4ŠAddrofdata-retrievalsubroutine. =RACHNUSREQU‡RARTRVAD+4ŠUserptrforchan0‚(startofchannel*¦userptrlist).?RAINSTR‚EQU‡RACHNUSR+64‰Interrupt"instruction"flag(indicates&*¦whatistobedonewhenaninterrupt$*¦occursfromthecurrentfunction).9RAJMPRRGEQU‡RAINSTR+1‹Containsvaluefromharwarejumper%*¦"register"onRADboard(loc7000)./RASHRAD‚EQU‡CCBCHBŽStartingaddrofshared-RAM.*M*============================================================================B*‚CCBoffsetsforlocationsusedbystandarddriverskeletoncode.0CCBERAD1EQU‡RAJMPRRG+1ŠErrordebugsaveaddress9CCBQVER1EQU‡CCBERAD1+4ŠEventqueuingerrordebugaddress(CCBCIDƒEQU‡CCBQVER1+4ŠCMRparamblockID*3******‚CheckfortoomuchstufftofitinCCB...‰IFGT†CCBCID+4-256%‰FAIL†499‘Abortassemblyiftoomuch.‰ENDC******** CCB flag positionsCCBFGBSYEQU‡7“ChannelbusyN*=============================================================================***‚Commandpacketoffsets**RACMDERREQU‡0“Errorreturncodelocation..RAREQCMDEQU‡RACMDERR+2ŠRequestedcommandcode8RACMDPRMEQU‡RAREQCMD+2ŠStartofcommandparameterlist.** *ˆFlagvalues*:RAWRKFLGEQU‡1‰FlagsettingforRARDFLAGindicatingweare(*¦workingonaninterruptfromthisRAD.** *ˆErrorcodes*RAERR1ƒEQU‡$F0‡RADis"bad".RAERR2ƒEQU‡$F1‡RADis"busy".RANOTUSREQU‡$FF‡ThisuserisnotusingthisRADnow(triedto*œdoaRADSTP).:RAABORTDEQU‡$FB‡ThisRADwasabortedsincethisuserlast#*¦called--usermustreopenforRAD.7RASYSERREQU‡$FA‡Thisisan"extra"RAD--can'tbeused.'*¦(SYSGENwassetupfortoofewRADs.)RAOVRFLOEQU‡$FC‡FIFOoverflow.***ˆRADstatuscodes*(RAUNINITEQU‡$F000…RADisuninitialized.RASTBAD‚EQU‡$FFFF…RADis"bad".6RASTOKƒEQU‡$F0F0…RADisokandreadytotakecommands.3RASTDOINEQU‡$F001…RADisnowdoinginitialization.*** *ˆBitmasks*=RAINTBITEQU‡$C0‡Bitstocheckinstatusbyteforinterrupts..*œ(Bit7=level4int.,bit6=level3int.)*;RASUBRBTEQU‡0‰Optionbit#foruser-supplieddata-handling+*œsubroutineforwhendataforthischanis*œreceivedfromtheRAD.;RAQUEBT‚EQU‡1‰Optionbit#toqueueeventtouserwhendata)*œforthischanisreceivedfromtheRAD.=RAWAKEBTEQU‡2‰Optionbit#towakeuptheuserwhendatafor%*œthischanisreceivedfromtheRAD.**ˆMisc.constants*RARDRMNDEQU‡$D7FF…EndaddrofRADRAM(excludingshared-RAM).?RALODLNGEQU‡100‡Max#ofwordstoloadordumpthrushared-RAM*¦atonetime.*ˆsetasideintheSYSGENforusebythedriver(RAD1TBL).‚TheC*ˆdrivertakesacommandfromtheuser,passesitontothecorrect?*ˆRAD1board(wherethefirmwarewillinterpretandexecutetheD*ˆcommand),takesthedatabackfromtheRAD1,andpassesitbackto>*ˆtheuserinthemannerspecifiedbythatuser.‚Communication>*ˆbetweenthe68000andtheRAD1boardtakesplacethroughthe*ˆ256-byte-longshared-RAM.*>*ˆCodeinthisdriverisrelocatable,re-entrant,andROMable.**/*ƒENTRY:‚JSRFROMCMRHANDLER(COMMANDSERVICE) *‹JSRFROMCMRINTERRUPTHANDLER*-*ƒEXIT:-ALWAYSEXITSWITHARTSINSTRUCTION**I*========================================================================*²<<<<<<<<<<<<<<<<<<<<<<<<<<<A*ˆAssembleusingchainfileRADASM.CF‡<<<<<<<<<<<<<<<<<<<<<<<<<<<*²<<<<<<<<<<<<<<<<<<<<<<<<<<<H*-----------------------------------------------------------------------*‰PAGEJ*****************************************************************************C*‚THISISTHESERVICEVECTORTABLEWHICHISREQUIREDFORCMR-CALLED*ˆI/ODRIVERS.***L****************************************************************************** ‰SECTION8***‚ServicevectortableforCMR: RADDRVR‚EQU‡*9‰DC.L†RADISR-RADDRVR†Offsettointerruptserviceroutine.7‰DC.L†RADCMD-RADDRVR†Offsettocommandserviceroutine.6‰DC.L†RAINIT-RADDRVR†Offsettoinitializationroutine.‰DC.L†0“RESERVED***‚OtherCMRparams:!‰DC.B†0“#ofextrapagesperCCB. ‰DC.B†0,0,0 ‰DC.L†0,0,0***‚Revisioninfo.:-‰DC.B†'021783'ŒRADDRVrevisiondate(MMDDYY).*‰DC.B†''‘Patchflag(blank=nopatches).$‰DC.B†'4'‘MajorVERSAdosrevision#.*‰PAGEM*******************************************************************************ˆInitializationRoutine*5*’CalledthroughCMRonceforeachCCBwhensystemis5*’booted.‚Thisroutineinitializesthedataareaused*’bytheRADdriver.*!*ˆUponentry:‰A5=addressofCCB*8*ˆUponexit:ŠThefollowingregistercontentsarechanged%*œ(andnotrestored):ƒA0,A1,D1,D2.*M***************************************************************************** RAINITƒEQU‡*7‰MOVEA.LƒRAD1TBL,A0ŠPutaddressofRADtablearea(from*¦SYSPAR)intoA0.5‰CMPA.L„#0,A0HasmemorybeensetupforRADsonthis!‰BEQ.S…RAERRXSsystem?‚No--error.>‰CMPI.B„#RALVL4,CCBPPRIO(A5)…Isthisalevel4CCB?‚(Interrupt**¦levelsaresetinternallyas1morethan*¦actuallevel.)7‰BEQ.S…RAINRETYes--ignoreit,noinitializtionneeded."‰CLR.L…D2’No,mustbelevel3CCB.%‰MOVE.L„D2,A1ClearA1forlateruse.>‰MOVE.B„RARADUSD(A0),D2…SetupD2tocontainnumberofentries*¦inRARADLSTalreadyused.6‰CMP.B…RANUMRAD(A0),D2…Areanyentriesleftavailable?(‰BGE.S…RAERRXSNo--tableisfull--error.8‰ADDQ.B„#1,RARADUSD(A0)…Yes.‚Bumpcountofentries used.9‰MULU†#RARDENTL,D2ˆMultiply#entriesusedbylengthof1$*¦entrytogetoffsetinRARADLSTto*¦nextavailableentry.=‰MOVEA…RARADLAD(A0),A1…PutstartaddrofRARADLSTintoA1,by4‰ADDA.L„A0,A1addingtableareastartaddrtooffset*¦toRARADLST..‰ADDA.L„D2,A1SetA1toaddrofnextavailable*¦entryinRARADLST.<‰MOVE.L„CCBMNEM(A5),(A1)„MoveRAD-IDintoRARADLSTentryfor *¦thisRAD.=‰MOVE.L„A1,RARDLADR(A5)…PutaddrofthisRAD'sRARADLSTentry *¦intoCCB.2‰CLR.B…RACMDCOD(A5)ˆInitializetherestoftheCCB*‰CLR.B…RARDFLAG(A5)ˆdevice-dependentarea.0‰LEA‡RARDFIFO(PC),A1…Setaddrfordata-retrieval8‰MOVE.L„A1,RARTRVAD(A5)…subroutinetoread-FIFOroutine.‰CLR.B…RAINSTR(A5)‰CLR.B…RAJMPRRG(A5)0‰MOVE†#16,D2ŽInitthechanneluserptrs‚(2bytes,‰LEA‡RACHNUSR(A5),A1…each--for32channels).ARAINLP4‚MOVE.L„#$F000F000,(A1)+„Setchanneluserptrsto$F000to&*¦indicatechannelscan'tbeusedyet.‰SUBQ†#1,D2Done?‰BGT‡RAINLP4No--donext.=‰MOVE.L„RARDLADR(A5),A1…Yes.‚SetaddressofentryinRARADLST*¦forthisRADinA1..‰MOVE†#RAUNINIT,RARDSTAT(A1)ˆSetRADstatusto)*¦"uninitialized".‚(TheRADboardwillbe'*¦initializeduponthe1stuserrequest*¦forthisRAD.)‰CLR.L…D1ˆSetD1tozero.9‰ADDQ.L„#RACHNLST,A1ˆSetptrto1stchannelforthisRAD.?‰MOVE.L„#8*RACHNLLG,D2„InitD2tobeusedasachannelcounter.1*œ(SetD2to:‚32*RACHNLLG/4,sincewewillbe0*initializingthe32channelentries4bytesat *atime.)HRAINLP1‚MOVE.L„D1,(A1)+‚InitchanneldataforthisRADinRARADLSTto0.‰SUBQ†#1,D2…Alldone?$‰BHI‡RAINLP1ƒNo--godonextchannel.RAINRET‚RTS‘Return.*;RAERRXS‚EQU‡*‰SOMETHINGISWRONG!!!‚Thisroutinewascalled#*¦moretimesthanthereareRADsin*¦thesystem!!!*;‰MOVE.B„#RASYSERR,RAINSTR(A5)‰SetaflaginCCBtoindicate&*¦thatthisRADcannotbeused--dueto%*¦aSYSGENerror,thereisnotenough'*¦roomintheRADtableareatoinclude *¦thisRAD.‰BRA‡RAINRETƒReturn‰PAGEJ***************************************************************************%*ˆTHISISTHECOMMANDSERVICEROUTINE**ƒENTRY:‚JSRFROMCMRHANDLER**‹A2-PHYSICALADDRESSOFPARAMETERBLOCK*‹A5-PHYSICALADDRESSOFCCB,*‹A6-PHYSICALADDRESSOFATTACHEDTASKTCB*5*ƒEXIT:‚RTS-PARAMETERBLOCKVALIDATIONSTATUSIND0**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A**P**PP**”A3=COMMANDPACKETPOINTER*”A6=REQUESTORTCBADDRESS***ƒCODEISRE-ENTRANT*J*************************************************************************** RADCMD„EQU„*-‰TST.B…XIOSCD(A2)ŠIstheCMRcmdsubcode=0?‰BEQ.S…IOH01110ŒYes.9‰MOVE.B„#RAERR9,D7ŠNo--error--set"illegalcommand"error,‰BSR‡IOHERCHKŒcodeandgomakeerrorreturn.*1* CHECK FOR COMMAND PACKET WITHIN TASK BOUNDARIES*CIOH01110‚MOVE.LXIOUID(A2),CCBCID(A5)SAVECMRPARAMBLOCKID(DCB) ŠCLR.L‚D5,ŠMOVE.LXIOCPK(A2),D6†ADDROFCOMMANDPACKET)ŠMOVEƒXIOPLN(A2),D5†LENGTHOFCOMMANDPKT*ŠMOVE.LCCBTASKA(A5),A1„SETUPTCBPOINTER ŠBSR„IOHADRCKŠBRA.S‚IOH01160‹GOODRETURNŠNOP—BADLENGTHRETURN%ŠMOVE.B#XSTBLN,D7‰BADADDRESSRETURN ŠBSR„IOHERCHK5IOH01160‚MOVE.LD6,A3ŽCOMMANDPACKETPHYSICALADDRESS*0* INSURE THAT COMMAND PACKET IS ON EVEN BOUNDARY* ŠBTSTƒ#0,D6ŠBEQ.S„RACOMAND6ŠMOVE.B#XSTBLN,D7‰BADCOMMANDPACKETADDR(ODDBNDRY) ŠBSR„IOHERCHK**F************************************************************************ˆCommandProcessor*2*’User'scommandisprocessedhere.‚Acheckonthe1*’desiredRAD'sstatusismade,andifthestatus0*’is"good",thecommandprocessorwillcallthe/*’appropriatesubroutinetohandlethecommand.*F***********************************************************************RACOMANDEQU‡**7‰CLR‡RACMDERR(A3)ˆClearerrorreturnlocationinuser's)*¦cmdparamtable(usedlaterasaflag).4‰CMP.B…#RASYSERR,RAINSTR(A5)‰Isthisanon-available*¦RAD(duetoSYSGENerror)?-‰BEQ‡RASKIPITŒYes--makeerrorreturntouser.-‰BSR‡RAFNDUSRŒNo.‚Findthis userinRAUSRLST.7‰CMP.L…#RAABORTD,D0ˆWasthisRADabortedsincethelast*¦timethisusercalled?3‰BEQ‡RACMDRETŒYes--makeerrorreturn(D0isalready *¦setup).*;*’No.‚DatainD0andD1willbeusedlaterinthisroutine.*9‰MOVE†RAREQCMD(A3),D2…StorerequestedcommandcodeinD2.*‰CLR.L…D3’InitD3,whichwillbeoffsetin*¦'RAJMPTBL'forthiscommand.5‰LEA‡RACMDTBL(PC),A4…SetA4toaddrofstartoftable*¦of"legal"commandcodes.=RACMDLUPCMP.B…(A4),D2Doesrequestedcommandcodematchthis*¦tableentry?6‰BEQ.S…RAGOTCMDŒYes--continueprocessingthiscommand.‰CMP.B…#$FF,(A4)+ŠEndoftable?*‰BEQ.S…RANOSUCHŒYes--illegalcommandcode.-‰ADDQ†#4,D3Setjumptableptrtonextentry.+‰BRA‡RACMDLUPŒGobackandchecknextentry.?RANOSUCHMOVE.L„#RAERR9,D0ŠSeterrorreturnto"illegalcommand‰BRA‡RACMDRETŒcode"andreturn.ARAGOTCMDMOVE.L„RARDLADR(A5),A1…PutaddrofentryforthisRADin*¦'RARADLST'intoA1.4RACMD0ƒCMPI†#RASTBAD,RARDSTAT(A1)‰IsRADmarkedbad?‰BNE.S…RACMD1ŽNo.-‰MOVE.L„#RAERR1,D0ŠYes--setD0toerrorcode.‰BRA.S…RACMDRETŒGoreturn.=RACMD1ƒCMPI†#RAUNINIT,RARDSTAT(A1)ˆIsthisRADuninitialized?‰BNE.S…RACMD2ŽNo.$‰BSR‡RAINITRDŒYes--goinitializeit.‰BRA‡RACMD0ŽNowtryagain.BRACMD2ƒCMP‡#RASTDOIN,RARDSTAT(A1)‚IsRADdoinginitializationnow?*‰BEQ.S…RACMD3ŽYes--make"RADbusy"return.6‰CMPI.B„#RAOPNCMD,D2ˆAtthispoint,theRADmustbein%*¦workingcondition.‚Istherequested*¦commandan"open"?+‰BEQ.S…RADOITŽYes--godo"open"processing.8‰CMPI.B„#RACLSCMD,D2ˆIstherequestedcommanda"close"?,‰BEQ.S…RADOITŽYes--godo"close"processing..‰CMPI.B„#RASTPCMD,D2ˆIsthisa"stop"command?‰BEQ.S…RADOIT2Yes--godoit.0‰CMPI.B„#RAABTCMD,D2ˆIsthisan"abort"command?‰BEQ.S…RADOIT2Yes--godoit./‰CMP‡#RASTOK,RARDSTAT(A1)‚No.‚IsRADreadynow?'‰BEQ.S…RADOCMDYes--goprocesscommand.6RACMD3ƒMOVE.L„#RAERR2,D0ŠNo--seterrorcodeto"busy".‰BRA.S…RACMDRETŒGoreturn.ARACMD4ƒMOVE.L„#RAUSRERR,D0ˆSeterrorflagtoindicateuserisnot*¦setuptousethisRAD.‰BRA.S…RACMDRETŒGoreturn.*4RADOCMD‚EQU‡*“Atthispoint,mustbeacommandwhich)*¦actuallyusestheRADboard,sosetthe*¦RADstatustobusy.*8*’D0andD1stillcontaindatafromRAFNDUSRcallabove.*)‰TST.L…D0’IsusersetuptousethisRAD?‰BNE‡RACMD4ŽNo--error.9‰MOVE†D1,RARDSTAT(A1)…SetRADstatustouserptrforthis*¦usertoindicateRADisbusy.:‰MOVE†#1,RACMDERR(A3)…Setcmderrorcodeto1asaflagto%*¦indicatethatthiscmdusestheRAD%*¦boardandsetthestatusto"busy".3RADOIT2‚MOVE.L„A6,RAUSRTCB(A5)…Storeaddrofuser's*¦TCBinCCBforfutureuse. RADOITƒEQU‡*8‰LEA‡RAINSTBL(PC),A4…Putstartaddrofinterrupt"instr-*¦uction"table.1‰MOVE.L„D3,D0Getoffsetintothistableforthis‰ASR.L…#2,D0command.?‰MOVE.B„(A4,D0),RAINSTR(A5)Store"instruction"flaginCCBfor*¦usewheninterruptcomesin.:‰LEA‡RAJMPTBL(PC),A4…Loadaddrofstartofjumptableinto"*¦A4.‚D3stillhasoffsetforthis#*¦commandcodeintothejumptable.%*¦A3containsaddrofcommandpacket.1‰JSR‡(A4,D3)Gotocommand-processingroutinefor(*¦thiscommand.‚(NOTE:D1stillcontains*¦userptrforthisuser.)6‰TST‡RACMDERR(A3)ˆDidthiscmdsettheRADstatusflag *¦to"busy"?‰BEQ.S…RACMDRETŒNo--goreturn. ‰TST‡D0’Yes.‚Wasthereanerror?‰BEQ.S…RACMDRETŒNo--goreturn.,‰BSR‡RACLRSTAŒYes--goclearRADstatusflag.*ARACMDRETMOVE†D0,RACMDERR(A3)…Puterrorreturncodeinuser'scmd*¦paramtable.!‰RTS›Returnfromcommandhandler.*?RASKIPITMOVE.L„#RASYSERR,D0ˆSetD0toindicate"can'tusethis*¦RAD"(duetoSYSGENerror).‰BRA‡RACMDRETŒReturntouser.*D*-------------------------------------------------------------------D*ˆCommandtable,jumptable,and"interruptinstruction"flagtable.2*’(Entriesinthesethreetablesmustcorrespond.)*9RAJMPTBLBRA.L…RARADSTPŒJumptable--allentriesmustbe6‰BRA.L…RARADLODŒlongbranchestoappropriateroutines.‰BRA.L…RARADDMP‰BRA.L…RARADJMP ‰BRA.L…RARADTSTŒ(5thentry)‰BRA.L…RARADEXT‰BRA.L…RARADSET‰BRA.L…RARADSCN‰BRA.L…RARADATO‰BRA.L…RARADCALŒ(10thentry)‰BRA.L…RARADOPN‰BRA.L…RARADCLS‰BRA.L…RARADXEQ‰BRA.L…RARADABT‰BRA.L…RARADHISŒ(15thentry)**--------------------------*4RACMDTBLDC.B†RASTPCMDŒTableoflegalcommandcodes.2‰DC.B†RALODCMDŒEachentryisonebytelong;‚endof4‰DC.B†RADMPCMDŒtableisindicatedby$FF,whichmust.‰DC.B†RAJMPCMDŒNOTbeavalidcode,ofcourse.‰DC.B†RATSTCMDŒ(5thentry)‰DC.B†RAEXTCMD‰DC.B†RASETCMD‰DC.B†RASCNCMD‰DC.B†RAATOCMD‰DC.B†RACALCMDŒ(10thentry)‰DC.B†RAOPNCMD‰DC.B†RACLSCMD‰DC.B†RAXEQCMD‰DC.B†RAABTCMD‰DC.B†RAHISCMDŒ(15thentry)‰DC.B†$FF‘Endoftable.**----------------------------*7RAINSTBLDC.B†1‰Tableof"instruction"flagswhichtell-‰DC.B†1‰thedriverwhatistobedonewhenan-‰DC.B†1‰interruptcomesinforthisfunction.4‰DC.B†2‰(1=Put"task"intoREADYstate;i.e.,turn)‰DC.B†1“cmdhandlerforthiscmdbackon.+‰DC.B†2Š2=Calldata-retrievalsubroutine.4‰DC.B†2Š0=Don'tdoanythingspecial--justturnoff,‰DC.B†2“theinterruptandreturn.‚(Shouldn't#‰DC.B†2“getaninterruptonthese.)‰DC.B†1‰(10thentry)‰DC.B†0‰DC.B†1‰DC.B†2‰DC.B†1‰DC.B†0‰(15thentry)*‰DSˆ0‰(SetPCtoevenaddress.)‰PAGE** ERROR ROUTINE*IOHERCHK‚EQU„* ŠCLR.L‚D0ŠMOVE.BD7,D0ŽVALIDATIONSTATUS2ŠMOVE.L(A7)+,CCBERAD1(A5)SAVEDBUGERRORADDRESSŠBRA†RACMDRET‰GETOUTOFHEREŠPAGE;************************************************************$*ˆSubroutinetohandleRADOPNcalls.*3*’Thisroutine"opens"thedesiredchannelsforuse*’bythisuser.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP*;***********************************************************RARADOPNEQU‡*8‰BSR‡RAFNDUSR‚Checkuserlisttoseeiftherealreadyis*¦andentryforthisuser-RAD*¦combinationinRAUSRLST.6‰MOVE.L„RAD1TBL,A1ŠSetA1tostartaddroftablearea.‰TST‡D0ˆIsthereanentry?(‰BEQ.S…RAOPGOT1‚Yes--usethesameentry.+‰CLR.L…D2ˆNo--putthiscomb.intoRAUSRLST.7‰MOVE†RAUSRLNX(A1),D2…Putnext-availentryptrintoD2.4‰CMP‡#$FFFF,D2‹IsthereanavailableRAUSRLSTentry?‰BEQ‡RAOPNORMŒNo--error.***¦Yes--calculateaddrofnextavailentry.5‰MOVE.L„D2,D1Storenextavailentry#forlateruse.*‰MULU†#RAULNG,D2ŠMultiplybyentrylength.9‰LEA‡RAUSRLST(A1),A4…LoadstartaddrofRAUSRLSTintoA4.2‰ADDA.L„D2,A4SetA4tostartaddrofavailentry.:‰MOVE†RAURADID(A4),RAUSRLNX(A1)…Moveptrtothenextavail(*¦entry(whichwasstoredinthe1sttwo'*¦bytesoftheRAD-IDfieldofRAUSRLST#*¦entry)intoheaderoftablearea.8‰MOVE.L„TCBNAME(A6),RAUUSRNO(A4)†Storeuser#andRAD-ID6‰MOVE.L„TCBSESSN(A6),RAUUSRNO+4(A4)ƒintothisentryin*‰MOVE.L„CCBMNEM(A5),RAURADID(A4)†RAUSRLST.>RAOPGOT1EQU‡*‰Atthispoint,D1containstheptrtotheentry*¦forthisuserinRAUSRLST.‚A3"*¦containsaddrofcommandpacket.:‰MOVE†#RAUNORET,D0ˆInitD0toerrorcodefor"userhasnot$*¦specifiederror-reportingoption"./‰MOVE.L„D1,D3SetD3touserptrforthisuser.9‰MULU†#RAULNG,D3ŠMultiplybylengthofanRAUSRLSTentry.6‰MOVE.L„RAD1TBL,A1ŠSetA1tostartaddroftablearea.8‰LEA‡RAUSRLST(A1),A1…PutstartaddrofRAUSRLSTintoA1.4‰ADD.L…D3,A1A1nowcontainstheaddrofthisuser's*¦entryinRAUSRLST.:‰TST‡RAUEROPT(A1)ˆHaserror-reportingoptionforthisuser‰BEQ.S…RAOP2beenset?‚No. ‰CLR.L…D0’Yes--clearerrorflag.ARAOP2„MOVE†RACMDPRM(A3),D2…Put#chan's(fromparamtable)inD2."‰BNE.S…RAOP3Ifnot0,thengoon.:‰MOVE.L„#RAERR4,D0ŠSetD0to"parameter-table-error"code.‰BRA‡RAOPRETGoreturn.@RAOP3„LEA‡RACMDPRM+2(A3),A4ƒSetA4tostartaddrofchandatain*¦commandparamtable./RAOPLUP1CLR.L…D3’Putrequestedchan#intoD3.‰MOVE.B„1(A4), D3‰CMPI.B„#$1F,D3Validchan#?‰BLS.S…RAOP4Yes.5‰CMP.B…#$FF,D3No--isthistheerror-reportingoption*¦specification?6‰BNE‡RAOPERR1ŒNo--invalidchan#.Gotoerrorroutine.+‰MOVE†2(A4),D4ŒYes.‚Checktheoptionsflag.%‰AND.L…#7,D4Areanyoptionbitsset?(‰BEQ‡RAOPERR1ŒNo--nooptionsset--error. ‰CLR.L…D0’Yes--clearerrorflag.‰BRA.S…RAOPOKXDonextchan.3RAOP4„ASL‡#1,D3Doublechan#tobeusedasoffset.8‰CMPI†#$FFFF,RACHNUSR(A5,D3)ˆChecktheuserptrforthis)*¤chan(inCCB).‚Isthischanunassigned?‰BEQ.S…RAOPOK1Yes--it'sok.?‰CMP‡RACHNUSR(A5,D3),D1‚No.‚Isitalready"owned"bythisuser?3‰BNE.S…RAOPERR2ŒNo--thischanbelongstosomeother*¦user.‚Gotoerrorroutine.4‰MOVE.B„#1,(A4)Yes--setupperbyteofchan#incmd(*¦paramtableto1toindicatethischan#*¦wasalready"owned"bythisuser.'*¦(Thiswillbeusedifanerroroccurs'*¦sothattheuserptrwon'tbereset.)HRAOPOK1‚MOVE†D1,RACHNUSR(A5,D3)‚Setuserptrforthischantothisuser.RAOPERR1MOVE.L„#RAOPILL,D0‰SetD0toindicateillegalchan#.0‰BRA.S…RAOPERR3ŒGoresetuserptrs.forprevious*¦channelsincmdparamlist.CRAOPERR2MOVE.L„#RAOPUNAV,D0ˆSetD0toindicateunavailablechan#.*1RAOPERR3EQU‡*“Clearanyuserptrswhichwereset'*¦whileprocessingthiscallbeforethe*¦errorwasdetected.9‰LEA‡RACMDPRM+2(A3),A4ƒSetA4tostartofchan#'sincmd *¦paramlist.9‰MOVE†RACMDPRM(A3),D4…Store#ofchansincmdparamlist.7RAOPERLPCMP‡D2,D4Havewegonethrualltheentrieswe(*¦wentthrubefore?‚(Quitwhenwegetto'*¦thesamechan#wegottheerroron.)%‰BEQ‡RAOPRETYes--that'sall--return.#‰SUBQ†#1,D4No--deccountofchans.<‰TST.B…(A4)†Wasthischanassignedtouserbeforethiscall?(‰BEQ.S…RAOPERR4‚No--mustclearuserptr.;‰CLR.B…(A4)†Yes--leaveassignmentalone.‚Justclear"flag"./‰BRA.S…RAOPERR5‚Setuptodonextchaninlist./RAOPERR4CLR.L…D3ˆClearuserptrforthischan.$‰MOVE.B„1(A4),D3‚Putchan#intoD3.:‰ASL‡#1,D3…DoubleittogiveoffsetintochanlistinCCB.5‰MOVE†#$FFFF,RACHNUSR(A5,D3)ˆSetthischantounused.GRAOPERR5ADDA.L„#12,A4„SetA4toaddrofnextchan#incmdparamlist.'‰BRA‡RAOPERLP‚Gobackanddonextchan.**?RAOPNORMMOVE.L„#RAOPNOMO,D0ˆSetD0toindicatenoroomforany*¦moreuser-RADcombinations.‰BRA‡RAOPRETReturn.*‰PAGEK****************************************************************************)*ˆSubroutinetoinitializetheRADboard.9*’(SendsaDUMPcommandto RADandchecksforcompletion.3*’IfRADrespondscorrectly,setschanuserptrsto5*’"available"statusandsetsRADstatusto"ready".)*,*’Calledfromthecommandprocessorroutine.*7*ˆUponentry:‰A1=addrofthisRAD'sentryinRARADLST*œA5=CCBaddr**ˆUponreturn:**œ01234567*˜D:‚PPPP*****˜A:‚*PPP*PP**K***************************************************************************RAINITRDEQU‡*-‰MOVEM.LƒD0-D3,-(A7)‰Storeregistercontents.;‰MOVE†#RASTDOIN,RARDSTAT(A1)‚SetRADstatusto"busy--doing*¦initialization".6‰MOVE†#RAINNTRY,D4ˆSetD4tomax#oftimestotryfor$*¦asuccessfulresponsefromtheRAD"*¦beforedeclaringtheRAD"dead".ARAINRD2‚MOVE.L„RASHRAD(A5),A4†SetA4tostartaddrofshared-RAM.=‰BTST.B„#7,RAXSTAT(A4)†IsRADdonewithpoweruproutineyet?6‰BNE.S…RAINRDEDŒNo--shouldhavebeen,somethingwrong.=‰MOVE.B„#RAPARAM/2,RAPRMPTR(A4)‡Yes.‚Setparamptrinshared-&*¦RAMtooffsetinshared-RAMtoparam%*¦area(usingRAD-addressingoffset).8‰CLR.B…RAINTMSK(A4)ˆSetinterruptmasktonointerrupts.<‰MOVE.B„#RADMPCMD,RACMDBYT(A4)ˆPutDUMPcommandintocommand)*¦byteinshared-RAM.‚Thiswillstartthe*¦"RAD-initialize"dump.6‰BSR.S…RAWAITŽWaitfor10millisecbeforecheckingfor*¦responsefromRAD.2‰CMPI.B„#$81,RACSTAT(A4)„Isinitialdumpcomplete?$‰BNE.S…RAINRDEDŒNo--somethingwrong.,‰MOVEP.LƒRAPARAM(A4),D3†Yes.‚Checkresponse.8‰CMP.L…#RABNGRAD,D3ˆIsdumpok(i.e.,wasfirstlongword*¦correct--shouldbe"!RAD")?$‰BNE.S…RAINRDEDŒNo--somethingwrong.:‰MOVE.B„RAPARAM+8(A4),RAJMPRRG(A5)ˆYes--storeRAD"jumper"*¦datafromdumpinCCBloc.(‰MOVE.L„#16,D3ŽSetcounterforchannels.@‰BTST.B„#5,RAJMPRRG(A5)…IsRADboardjumperedfor16chanor32?‰BNE.S…RAINRD316channels.3‰MOVE.L„#32,D3Ž32channels--setchancounterto32.CRAINRD3‚LEA‡RACHNUSR(A5),A4…PutstartaddrofchanuserptrsinA4.GRAINRDLPMOVE.L„#$FFFFFFFF,(A4)+„Setchanptrto"unused"(2chansata‰SUBQ†#2,D3time).‚Alldone?‰BGT‡RAINRDLPŒNo--godonext.B‰MOVE†#RASTOK,RARDSTAT(A1)Yes--setRADstatustook(andunused).7RAINRDRTMOVEM.Lƒ(A7)+,D0-D3‰Restoreregistercontents. ‰RTS›Return.**:RAINRDEDSUBQ†#1,D4RADdidnotrespondcorrectly.‚Havewe*¦triedenoughtimes?*‰BLE.S…RAINRBADŒYes--gomarkthisRADbad.(‰BSR.S…RAWAITŽNo--delayfor10millisec.‰BRA‡RAINRD2Gotryitagain.9RAINRBADMOVE†#RASTBAD,RARDSTAT(A1)‰RADisnotresponding&*¦correctly--setRADstatusto"dead".‰BRA‡RAINRDRTŒReturn.*G* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*.RAWAITƒEQU‡*‰Routinetodelay10milliseconds.*-‰MOVEM.LƒD2/A1,-(A7)‰Storeregistercontents.7‰MOVE.L„#RANREQ,D3ŠSetD3tomax#oftimesto"request%*¦periodicactivation"unsuccessfully&*¦beforegivingupandjustreturning.ARAWAIT1‚LEA‡RADLAY(PC),A0‡Setupforperiodicactivationroutine.%*¦RADLAYistheroutinewhichwillbe)*¦turnedonattheendof10msec.,which&*¦will,inturn,reactivatethistask.%‰MOVE.L„#10,A1ŽSetdelayfor10msec.2‰CLR.L…D1’Settorequestactivationonetimeonly.:‰MOVE.B„CCBPPRIO(A5),D1…Setpriorityofactivationtosame*¦priorityasthistaskhas.1‰MOVE.L„A6,D2PutTCBaddrintoD2,tobeusedas *¦requestID.2‰TR0$.RQPA‚,’Trapto"requestperiodicactivation" *¦routine.%‰BRA.S…RAWAITOKŒRequestwasaccepted.0‰SUBQ†#1,D3Requestwasdenied.‚Havewetriedit*¦enoughtimes?#‰BGT‡RAWAIT1No--tryrequestagain.,‰BRA.S…RAWAITRTŒYes--forgetit--justreturn.9RAWAITOKTR0$.PAUSE,’Waitfor10msec.tobeup.‚(RADLAY(*¦willthenbe"turnedon"andwillthen*¦restartthistaskhere.)7RAWAITRTMOVEM.L„(A7)+,D2/A1ˆRestoreregistercontents. ‰RTS›Return.*M*‚======================================*2RADLAYƒEQU‡*“Routinetore-activatedriverroutine#*¦afteradelaymadeusing"request*¦periodicactivation"routine.*3‰MOVE.L„D1,A0D1contain sTCBaddrwhichwaspassed&*¦asrequestIDtoperiodicactivation%*¦routine.‚PutitinA0astasktobe*¦turnedbackon.*‰TR0$.READY,’Puttaskinto"ready"state.%‰RTE›Returnfromperiodicactivation.**‰PAGE:***********************************************************$*ˆSubroutinetohandleRADSETcalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**:**********************************************************3RARADSETEQU‡*‰Routinetosetupforsetpointscan.:‰MOVE†RACMDPRM+2(A3),D4ƒPut#ofnon-setpointchansinD4.:‰LEA‡RACMDPRM+4(A3),A4ƒSetA4toaddrofstartofchansin*¦cmdparamtable. ‰CLR.L…D35‰MOVE†RAPARAM(A3),D3†Put#ofsetpointchansintoD3.0‰MULU†#6,D3Calculate#bytesforsetptchansin*¦cmdparamtable.1‰ADD.L…D3,A4SetA4tostartaddrofnon-setpoint*¦chansincmdparamtable.3‰MOVE.L„#2,D3SetD3toaddrincrementtonextchan *¦inlist.6‰BSR‡RACHKCHNŒGocheckthesechanstobesuretheyare*¦"owned"bythisuser.‰TST.L…D0’Allok?3‰BNE.S…RASETRETŒNo,error--makeerrorreturn(D0is#*¦alreadysettoerrorflagvalue).*‰CLR.L…D4ˆPut#ofsetpointchansintoD4.‰MOVE†RACMDPRM(A3),D47‰LEA‡RACMDPRM+4(A3),A4ƒSetA4tostartaddrofsetpoint*¦chansincmdparamlist..‰MOVE.L„#6,D3SetD3toaddrincrementtonext*¦setpointchan#inlist.1‰BSR‡RACHKCHNŒGochecksetpointchanstoseethat*¦they"belong"tothisuser.‰TST.L…D0’Dothey?4‰BNE.S…RASETRETŒNo,error--return(D0containserror*¦codealready).8‰MULU†#3,D4…Multiplyby3togive#ofwordsofsetpoint*¦chandatainparamtable.3‰ADD‡RACMDPRM+2(A3),D4„Add#ofnon-setpointchans./‰ADD‡#2,D4Add2forthecountstogivetotal#*¦ofwordsinparamtable. ‰MOVE†D4,D3Store#wordsinD3.'‰ADDQ†#1,D4Add1for#-of-wordscount.;‰ASL‡#1,D4…DoubleD4togive#bytestomovetoshared-RAM.:‰LEA‡RACMDPRM-2(A3),A4…SetA4tostartaddrofparams(1st**¦2bytesaregarbage--willbesetlater.)2‰BSR‡RAMOVPRMŒPuttheparamtableintoshared-RAM.8‰MOVEP…D3,RAPARAM(A1)†Set#ofwordsinshared-RAMparam*¦table.2‰CLR.B…RACSTAT(A1)‰Clearcmdstatusinshared-RAM.;‰MOVE.B„#5,RAINTMSK(A1)…Setinterruptmaskinshared-RAMto)*¦interruptatendofscanorendofcmd.8‰MOVE.B„#RASETCMD,RACMDCOD(A5)ˆStorecmdcodeinCCBfor *¦lateruse.<‰MOVE.B„#RASETCMD,RACMDBYT(A1)ˆStorecmdcodeincmdbyteof,*£shared-RAMtostartexecutionoffunction./‰CLR.L…D0’ClearD0toindicatesuccessfulstart*¦ofsetpointcmd.RASETRETEQU‡**‰RTS›Returnandwaitfor"done"interrupt.‰PAGE K****************************************************************************$*ˆSubroutinetohandleRADSCNcalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**K***************************************************************************RARADSCNEQU‡****+‰MOVE†RACMDPRM+2(A3),D4ƒMove#chanstodo.7‰LEA‡RACMDPRM+4(A3),A4ƒSetA4toaddrofchan#sincmd*¦paramtable.0‰MOVE.L„#2,D3Setincrementvaluetonextchan# *¦inlist.1‰BSR‡RACHKCHNŒCheckrequestedchan#stoseethat!*¦theyall"belong"tothisuser.‰TST.L…D0’Dothey?2‰BNE.S…RASCNRETŒNo--makeerrorreturn.‚(D0already*¦containserrorcode.)1‰ADDQ†#2,D4Add2togive#ofwordstomoveinto4‰ASL.L…#1,D4paramarea;thendoubletoget#bytes.9‰LEA‡RACMDPRM(A3),A4…SetA4tostartaddrofparamstobe*¦putintoshared-RAM./‰BSR‡RAMOVPRMŒMoveparamtableintoshared-RAM.3‰LEA‡RAPARAM(A1),A4†SetA4toaddrinshared-RAMof*¦paramtable.-‰MOVE†RACMDPRM+2(A3),D4ƒSetD4to#ofchans.&‰ADDQ†#1,D4 Add1togive#ofparams.6‰MOVE.B„(A4),4(A4)ŠRearrangeparamtableinshared-RAM9‰MOVE.B„2(A4),6(A4)‰forRADfirmware.‚Put#paramsfirst,&*¦followedbydelaylength.‚(Notethat2‰MOVEP…D4,0(A4)Œ68000addressesshared-RAMononly*¦everyotherbyte.);‰CLR.B…RACSTAT(A1)‰Clearcommandstatusbyteinshared-RAM.=‰MOVE.B„#5,RAINTMSK(A1)…Setinterruptmaskbyteinshared-RAM!*¦forinterruptonend-of-scanor*¦end-of-command.C‰MOVE.B„#RASCNCMD,RACMDCOD(A5)‚StorecmdcodeinCCBforlateruse.:‰MOVE.B„#RASCNCMD,RACMDBYT(A1)ˆSetcommandbyteinshared-#*¦RAMtoexecutescanningfunction.8‰CLR.L…D0ˆClearD0toindicatesuccessfulstartofscan.RASCNRETEQU‡**‰RTS‘Returnandwaitfor"done"interrupt.‰PAGEL*****************************************************************************$*ˆSubroutinetohandleRADEXTcalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**L****************************************************************************?RARADEXTEQU‡*‰Routinetosetupforexternaltriggerfunction.1‰MOVE†RACMDPRM(A3),D4…SetD4to#ofchanstodo.5‰LEA‡RACMDPRM+2(A3),A4ƒPutaddrofchan#listinA4.1‰MOVE.L„#2,D3SetD2toincrementtonextchan#.0‰BSR‡RACHKCHNŒCheckchan#stoseethattheyall*¦"belong"tothisuser.‰TST.L…D0’Dothey?3‰BNE.S…RAEXTRETŒNo,makeerrorreturn.‚(D0contains*¦correcterrorcode.),‰ADDQ†#1,D4Addoneto#ofchansforcount..‰ASL.L…#1,D4Doubletogive#bytestobesent *¦totheRAD.7‰LEA‡RACMDPRM(A3),A4…SetA4toaddrofparamstobeput!*¦intoparamtableinshared-RAM.*‰BSR‡RAMOVPRMŒMoveparamsintoshared-RAM.7‰CLR.B…RACSTAT(A1)‰Clearcmdstatusbyteinshared-RAM.;‰MOVE.B„#5,RAINTMSK(A1)…Setinterruptmaskinshared-RAMto)*¦interruptonendofscanorendofcmd.C‰MOVE.B„#RAEXTCMD,RACMDCOD(A5)‚StorecmdcodeinCCBforlateruse.<‰MOVE.B„#RAEXTCMD,RACMDBYT(A1)‚Putcmdcodeintocmdbytein,*¤shared-RAMtostartexecutionoffunction.<‰CLR.L…D0ˆClearD0toindicatesuccessfulstartoffunction.RAEXTRETEQU‡*#‰RTS›Returnandwaitforinterrupt.‰PAGEN*******************************************************************************$*ˆSubroutinetohandleRADATOcalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**N******************************************************************************5RARADATOEQU‡*‰Routinetosetupforauto-rangescan.*‰MOVE†RACMDPRM(A3),D4…Move#chantoscan.5‰LEA‡RACMDPRM+2(A3),A4ƒPutaddrofchanlistintoA4.6‰MOVE.L„#2,D3SetD3toaddrincrementtonextchan#.0‰BSR‡RACHKCHNŒCheckchan#stoseethattheyall*¦"belong"tothisuser.‰TST.L…D0’Dothey?3‰BNE.S…RAATORETŒNo,makeerrorreturn.‚(D0contains*¦correcterrorcode.)1‰ADDQ†#1,D4…Add1to#ofchanstoincludecount.;‰ASL‡#1,D4…Doubletogive#bytesofparamstosendtoRAD.:‰LEA‡RACMDPRM(A3),A4…SetA4toaddrofparamstobemoved.-‰BSR‡RAMOVPRMŒMoveparamtabletoshared-RAM.7‰CLR.B…RACSTAT(A1)‰Clearcmdstatusbyteinshared-RAM.@‰MOVE.B„#5,RAINTMSK(A1)…Setinterruptmaskbyteinshared-RAMto)*¦interruptonendofscanorendofcmd.C‰MOVE.B„#RAATOCMD,RACMDCOD(A5)‚StorecmdcodeinCCBforlateruse.B‰MOVE.B„#RAATOCMD,RACMDBYT(A1)‚Setcmdbyteinshared-RAMtostart*¦auto-rangescanningfunction.<‰CLR.L…D0ˆClearD0toindicatesuccessfulstartoffunction.RAATORETEQU‡*#‰RTS›Returnandwaitforinterrupt.‰PAGEN*******************************************************************************$*ˆSubroutinetohandleRADHIScalls.*,*’Call edfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**N******************************************************************************5RARADHISEQU‡*‰Routinetosetupforhigh-speedscan.,‰CLR.L…D3’Setuptocheckchan#toseethat(‰MOVE.L„#1,D4it"belongs"tothisuser.5‰LEA‡RACMDPRM+4(A3),A4ƒSetA4toaddrofchan"list".‰BSR‡RACHKCHNŒGocheckchan#./‰TST.L…D0’Doesthischan"belong"tothisuser?2‰BNE.S…RAHISRETŒNo--makeerrorreturn.‚(D0already*¦containscorrecterrorcode.);‰TST.L…RACMDPRM(A3)ˆIsthereauser-supplieddata-retrieval *¦subroutine?‰BEQ.S…RAHIS2ŽNo--error.?‰MOVE.L„RASHRAD(A5),A1†Yes--setA1tostartaddrofshared-RAM.:‰CLR.B…RAPARAM(A1)‰Move$0001into1stwordofparamtable'‰MOVE.B„#1,RAPARAM+2(A1)„inshared-RAM.B‰MOVE.B„RACMDPRM+4(A3),RAPARAM+4(A1)‚Putchan#tobescannedinto?‰MOVE.B„RACMDPRM+5(A3),RAPARAM+6(A1)‚paramtableinshared-RAM.<‰MOVE.B„#RAPARAM/2,RAPRMPTR(A1)‡Putoffsettoparamtablein)*¦shared-RAM(6809addressing)intoparam*¦ptrinshared-RAM.7‰CLR.B…RACSTAT(A1)‰Clearcmdstatusbyteinshared-RAM.9‰CLR.B…RAINTMSK(A1)ˆSetinterruptmaskinshared-RAMto0*¦toindicatenointerrupts.>‰MOVE.B„#1,RAOK2STO(A1)…Set"oktostorenextconversion"flag*¦inshared-RAM.8‰MOVE.B„#RAHISCMD,RACMDCOD(A5)ˆStorecmdcodeinCCBfor *¦lateruse.<‰MOVE.B„#RAHISCMD,RACMDBYT(A1)ˆSetcmdbyteinshared-RAMto%*¦beginexecutionofhigh-speedscan.<‰MOVE.L„RACMDPRM(A3),A2…Gotouser-supplieddata-acquisition=‰MOVEM.LƒD0-D7/A0-A6,-(A7)ƒroutineafterstoringallregister.‰JSR‡(A2)contents.‚Thisroutinewilltakeall(*¦thedesireddataandwillreturnafter(*¦havingstoppedthehigh-speedscanning *¦function.5‰MOVEM.Lƒ(A7)+,D0-D7/A0-A6ƒRestoreregistercontents.4‰CLR.L…D0‡ClearD0indicateasuccessfulcompletion.RAHISRETEQU‡* ‰RTS›Return..RAHIS2ƒMOVE.L„#RAERR4,D0ŠSeterrorcodeinD0.‰BRA‡RAHISRETŒGoreturn.‰PAGEN*******************************************************************************$*ˆSubroutinetohandleRADJMPcalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**N******************************************************************************>RARADJMPEQU‡*‰Routinetosetupforjump-to-RAD-addrcommand.9‰MOVE.B„#RAJMPCMD,D1ˆSetD1tocmdcodeforjumpcommand.=‰LEA‡RACMDPRM(A3),A4…SetA4tostartaddrofcmdparamtable.4‰BRA.S…RAXEQ2ŽGoto2ndentryinRARADXEQ.‚(Jumpand)*¦execute-functionroutineshavethesame*¦set-upforrunning.)‰PAGEL*****************************************************************************$*ˆSubroutinetohandleRADXEQcalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**L****************************************************************************>RARADXEQEQU‡*‰Routinetosetupforexecute-functioncommand.>‰MOVE.B„RACMDPRM+1(A3),D1…SetD1tofunction#tobeexecuted.5‰OR.B†#RAXEQBYT,D1ˆSetthe"executefunction"cmdbit*¦togetthecommandcode.<‰LEA‡RACMDPRM+2(A3),A4ƒSetA4toaddrofrestoftheparams.*M*============================================================================K*=============‚RAXEQ2isa2ndentrypointintothisroutine.‚=============>*=============…(ItisusedbyRARADJMProutine.)Œ=============*9RAXEQ2ƒTST.L…(A4)†Isthereauser-supplieddata-retrieval*¦subroutinespecified?2‰BEQ.S…RAXEQ3„No--useread-F IFOroutine(default).>‰MOVE.L„(A4),RARTRVAD(A5)ƒYes--storeaddrofsubroutineinCCB*¦forlateruse.BRAXEQ3ƒADDQ.L„#6,A4…SetA4tostartofparamstobepassedtoRAD.1‰MOVE†(A4),D4ƒSetD4to#ofparamstobepassed.(‰ADDQ†#1,D4…Add1toincludewordcount.<‰ASL‡#1,D4…Doubletogive#bytestobemovedtoshared-RAM.9‰BSR‡RAMOVPRM‚Moveparamsintoparamtableinshared-RAM.9‰MOVE.B„-1(A4),RAINTMSK(A1)‹Setinterruptmaskinshared-*¦RAMasspecifiedbytheuser.7‰CLR.B…RACSTAT(A1)‰Clearcmdstatusbyteinshared-RAM.<‰MOVE.B„D1,RACMDCOD(A5)…StorecmdcodeinCCBforlateruse.;‰MOVE.B„D1,RACMDBYT(A1)…Setcmdbyteinshared-RAMtostart*¦executionofdesiredcommand.<‰CLR.L…D0ˆClearD0toindicatesuccessfulstartoffunction.‰RTS›Returnandwaitfordata.‰PAGEM******************************************************************************$*ˆSubroutinetohandleRADSTPcalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**M*****************************************************************************>RARADSTPEQU‡*‰Routinetostopthisuser'sfunctionrunningon*¦theRADboard.1‰BSR‡RAFNDUSR‚Findthisuser'sentryinRAUSRLST.%‰TST‡D0ˆIsthisuser/RADinRAUSRLST?‰BNE.S…RASTPER1‚No--error.9‰MOVE.L„RARDLADR(A5),A1…Yes.‚PutaddrofthisRAD'sentry*¦inRARADLSTintoA1.4‰CMP‡RARDSTAT(A1),D1…(D1containsuserptr.)‚Isthis*¦userusingthisRADnow?‰BNE.S…RASTPER1ŒNo--error.;‰MOVE.L„RASHRAD(A5),A1†Yes.‚SetA1tostartaddrofshared-*¦RAM.7‰CLR.B…RACSTAT(A1)‰Clearcmdstatusbyteinshared-RAM.;‰MOVE.B„#1,RAINTMSK(A1)…Setinterruptmaskinshared-RAMto#*¦interruptwhencommandcompletes.:‰MOVE.B„#RASTOPIT,RASTPBYT(A1)ˆSetstopbyteinshared-RAM*¦tostopRADprocessing.&‰TR0$.PAUSEŠ,‰Waitfordoneinterrupt.K*>>>>>>>>>>>>>>>>‚Returnherefrominterrupt.‚<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'‰CMP.B…#$84,RACSTAT(A1)„RADstoppedok?‰BNE.S…RASTPERRŒNo--error.7‰MOVE.L„RARTRVAD(A5),A2…Yes.‚Getaddrofdata-retrieval>‰MOVEM.LƒD0-D7/A0-A6,-(A7)ƒroutineandgetwhateverdatathere‰JSR‡(A2)isinshared-RAM.5‰MOVEM.Lƒ(A7)+,D0-D7/A0-A6ƒRestoreregistercontents.7‰MOVE.L„RARDLADR(A5),A1…PutaddrofthisRAD'sentryin*¦RARADLSTintoA1.4‰MOVE†#RASTOK,RARDSTAT(A1)ŠSetRADstatustounused./‰LEA‡RARDFIFO(PC),A1…Setaddrofdata-retrieval4‰MOVE.L„A1,RARTRVAD(A5)…subroutinetoRARDFIFOaddr./‰CLR.L…D0ˆClearD0toindicatesuccessfulstop.RASTPRETEQU‡*‰RTS‘Returntouser.7RASTPERRBSR‡RAEXERRSet"executionerror"valueinD0.‰BRA‡RASTPRETŒGoreturn.>RASTPER1MOVE.L„#RANOTUSR,D0ˆSet"thisusernotusingRADnow"'‰BRA‡RASTPRETŒerrorflagandgoreturn.‰PAGEM******************************************************************************$*ˆSubroutinetohandleRADCLScalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**M*****************************************************************************:RARADCLSEQU‡*‰RoutinetocloseRADfromusebythisuser.?‰BSR‡RAFNDUSR‚Findthisuser'sentry(w/thisRAD)inRAUSRLST.,‰TST‡D0ˆWasthisuser/RADcombinationfound?‰BNE.S…RACLSERR‚No--error.<‰MOVE.L„RARDLADR(A5),A2…Yes--D1containsuserptr.‚SetA2to'*¦addrofthisRAD'sentryinRARADLST.5‰CMP‡RARDSTAT(A2),D1…IsthisuserusingthisRADnow?‰BNE.S…RACLS2ŽNo.9‰MOVE.L„RASHRAD(A5),A1†Yes--stopfunctionrunninginRAD.%*¦SetA1tostartaddrofshared-RAM.9‰MOVE†#1,RACMDERR(A3)…Seterrorreturnlocationinuser's&*¦cmdtabletoindicatethatthisuser'*¦isstoppingtheRADboard,so theRAD'*¦statuswillbesetto"ok"whendone.2‰CLR.B…RACSTAT(A1)‰Clearcmdstatusinshared-RAM.;‰MOVE.B„#1,RAINTMSK(A1)…Setinterruptmaskinshared-RAMto*¦interruptatendofcmd.:‰MOVE.B„#RASTOPIT,RASTPBYT(A1)ˆSetstopbyteinshared-RAM*¦tostopRADprocessing.&‰TR0$.PAUSEŠ,‰Waitfprdoneinterrupt.=*>>>>>>>>>>>> Return here from interrupt. <<<<<<<<<<<<<<<<<<<(‰CMP.B…#$84,RACSTAT(A1)„DidRADstopok?0‰BNE.S…RACLSER2ŒNo--somekindoferroroccurred.4RACLS2ƒMOVE†#32,D2ŽYes.‚Closeallthisuser'schans.5‰LEA‡RACHNUSR(A5),A1…SetA1toaddrofuserpointers.:RACLSLUPCMP‡(A1),D1Doesthischan"belong"tothisuser? ‰BNE.S…RACLS3ŽNo--gochecknext.0‰MOVE†#$FFFF,(A1)‰Yes--setthischanuserptrto*¦"unassigned"status.9RACLS3ƒADD.L…#2,A1BumpA1topttonextchan'suserptr.‰SUBQ†#1,D2Alldone?‰BGT‡RACLSLUPŒNo--godonext.2‰MOVE†D1,D2Yes.‚Storeuserptrforthisuser/RAD.:‰MULU†#RAULNG,D1ˆDeletethisuser/RADentryfromRAUSRLST.0‰MOVE.L„RAD1TBL,A1ŠPutaddrofRAUSRLSTintoA2.‰LEA‡RAUSRLST(A1),A2<‰CLR.L…RAUUSRNO(A2,D1)…Clearuser#,RAD-ID,anduserstatus+‰CLR.L…RAUUSRNO+4(A2,D1)ƒforthisuser/RAD.‰CLR.L…RAURADID(A2,D1)‰CLR‡RAUSTAT(A2,D1)A‰MOVE†RAUSRLNX(A1),RAURADID(A2,D1)‚Putptrtonextavailentryin,*¤RAUSRLSTinto1st2bytesofRAD-IDfield.=‰MOVE†D2,RAUSRLNX(A1)…Setnext-avail-entryptrtothisentry.0‰CLR.L…D0’ClearD0toindicatesuccessfulclose.RACLSRETEQU‡*3‰TST‡RACMDERR(A3)ˆDidthisuserstoptheRADboard?‰BEQ.S…RACLSRT2ŒNo--goreturn.'‰BSR‡RACLRSTAŒYes--goclearRADstatus.RACLSRT2EQU‡* ‰RTS›Return.BRACLSERRMOVE.L„#RAUSRERR,D0ˆSet"thisusernotopenforthisRAD"*¦errorflaginD0.‰BRA‡RACLSRETŒGoreturn.6RACLSER2BSR‡RAEXERRSet"executionerror"flaginD0.‰BRA‡RACLSRET‚Goreturn.‰PAGEM******************************************************************************$*ˆSubroutinetohandleRADDMPcalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**M*****************************************************************************6RARADDMPEQU‡*‰RoutinetosetuptodumpRAD'smemory.3‰MOVE.L„RACMDPRM(A3),-(A7)‚Savecommandparameters.‰MOVE.L„RACMDPRM+4(A3),-(A7)RADMP1ƒCLR.L…D39‰MOVE†RACMDPRM+4(A3),D3ƒPut#wordstobedumpedintoD3.6‰CMP‡#RALODLNG,D3ˆIs#wordstobedumpedsmallenough$*¦tobedoneinonetransferthrough *¦shared-RAM?‰BLS.S…RADMP2ŽYes--godoit.6‰MOVE†#RALODLNG,D3ˆNo--mustbreakitupanddoitpart'*¦atatime.‚Setuptodothe1stpart.@RADMP2ƒMOVE.L„RASHRAD(A5),A1†SetA1tostartaddrofshared-RAM.;‰MOVE.B„#RAPARAM/2,RAPRMPTR(A1)‡Setupparamptrinshared-5‰CLR.B…RAPARAM(A1)‰RAM.‚Clear1stbyteofparamtable9‰MOVE.B„#2,RAPARAM+2(A1)„andput2(#ofwordsofparams)!*¦intoparamtableinshared-RAM.<‰MOVEP…D3,RAPARAM+8(A1)„Put#wordstodumpintoparamtable*¦inshared-RAM.>‰MOVE.B„RACMDPRM+6(A3),RAPARAM+4(A1)‚PutRADaddrtodumpfromA‰MOVE.B„RACMDPRM+7(A3),RAPARAM+6(A1)‚intoshared-RAMparamtable.8‰MOVE.B„#RADMPCMD,RACMDCOD(A5)ˆStorecmdcodeinCCBfor *¦lateruse.2‰CLR.B…RACSTAT(A1)‰Clearcmdstatusinshared-RAM.;‰MOVE.B„#1,RAINTMSK(A1)…Setinterruptmaskinshared-RAMto *¦interruptoncommandcomplete.9‰MOVE.B„#RADMPCMD,RACMDBYT(A1)ˆSetcmdcodeinshared-RAM*¦toexecutedumpfunction.(‰TR0$.PAUSEŠ,‰Waitfor"done"interrupt.F*>>>>>>>>>>>>>‚Returnfrominterrupthere.‚<<<<<<<<<<<<<<<<<<<<<<<<<<<:‰CMPI.B„#$80,RACSTAT(A1)„CheckcompletionstatusfromRAD.*‰BNE.S…RADMPERRŒStatusisnotgood--error.'‰MOVE†D3,D4Put#wordsdumpedintoD4.$‰ASL‡#1,D4Doubleittoget#bytes.:‰MOVE.L„RACMDPRM(A3),A4…Putaddrofuser'sbufferintoA4.:‰LEA‡RAPARAM+12(A1),A2ƒPutaddrinshared-RAMofdumpdata *¦intoA2.;RADMPLUPMOVE.B„(A2),(A4)+ŠMoveabytefromshared-RAMinto*¦user'sdatabuffer.+‰ADD‡#2,A2B umpshared-RAMptrtonextbyte*¦(68000addressing).1‰SUBQ†#1,D4Decrementbytecount--anymoretodo?‰BHI‡RADMPLUPŒYes--godonext.<‰SUB‡D3,RACMDPRM+4(A3)ƒNo.‚Subtract#wordsdumpedthistime!*¦fromtotal#lefttobedumped.6‰BEQ.S…RADMP3ŽIfzero,finishedallofrequesteddump.+‰ASL.L…#1,D3Double#wordstoget#bytes.9‰ADD.L…D3,RACMDPRM(A3)…Add#bytestouser'sbufferaddr.<‰ADD‡D3,RACMDPRM+6(A3)ƒAdd#bytestoRADaddrtodumpfrom.(‰BRA‡RADMP1ŽGobackanddonextpieceof*¦requesteddump./RADMP3ƒCLR.L…D0’ClearD0toindicatesuccessful*¦completionofdump.‰BSR‡RACLRSTAŒClearRADstatus.RADMPRETEQU‡*3‰MOVE.L„(A7)+,RACMDPRM+4(A3)ŠRestoreuser'scommand+‰MOVE.L„(A7)+,RACMDPRM(A3)Œparametertable. ‰RTS›Return.‰MOVE.B„RACMDPRM+6(A3),RAPARAM+4(A1)‚PutaddrinRADRAMtobe;‰MOVE.B„RACMDPRM+7(A3),RAPARAM+6(A1)‚loadedintoshared-RAM*¦paramtable.+‰MOVE†D3,D4Put#wordstobeloadedinD4.&‰ADDQ†#1,D4Add1togive#ofparams.2‰MOVEP…D4,RAPARAM(A1)†Put#paramsintoshared-RAM*¦paramtable.C‰MOVE.B„#RALODCMD,RACMDCOD(A5)‚StorecmdcodeinCCBforlateruse.7‰CLR.B…RACSTAT(A1)‰Clearcmdstatusbyteinshared-RAM.;‰MOVE.B„#1,RAINTMSK(A1)…Setinterruptmaskinshared-RAMto *¦interruptoncommandcomplete.<‰MOVE.B„#RALODCMD,RACMDBYT(A1)‚Setcmdbyteinshared-RAMto*¦executeloadfunction.(‰TR0$.PAUSEŠ,‰Waitfor"done"interrupt.K*>>>>>>>>>>>>>>>>‚Returnherefrominterrupt.‚<<<<<<<<<<<<<<<<<<<<<<<<<<<<<:‰CMPI.B„#$80,RACSTAT(A1)„CheckcompletionstatusfromRAD.*‰BNE.S…RALODER2ŒStatusisnotgood--error.=‰SUB‡D3,RACMDPRM+4(A3)ƒSubtract#wordsloadedthistimefrom*¦#lefttobeloaded.,‰BEQ.S…RALOD3ŽIfnomorelefttodo,return./‰ASL.L…#1,D3Doubletoget#bytesjustloaded.6‰ADD.L…D3,RACMDPRM(A3)…Add#bytesloadedthistimeto7‰ADD‡D3,RACMDPRM+6(A3)ƒaddressesincmdparamtablefor*¦ remainingloading.'‰BRA‡RALOD1ŽGobackandloadnextpart.5RALOD3ƒCLR.L…D0’ClearD0toindicatesuccessfulload.‰BSR‡RACLRSTAŒClearRADstatus.RALODRETEQU‡*3‰MOVE.L„(A7)+,RACMDPRM+4(A3)ŠRestoreuser'scommand+‰MOVE.L„(A7)+,RACMDPRM(A3)Œparametertable. ‰RTS›Return.@RALODERRMOVE.L„#RAERR4,D0ŠSetD0toerrorvalueforparamtable*¦error.‰BRA‡RALODRETŒGoreturn.8RALODER2BSR‡RAEXERRSetD0toerrorvalueforexecution*¦error.‰BRA‡RALODRET‚Goreturn.‰PAGEJ***************************************************************************$*ˆSubroutinetohandleRADCALcalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**K***************************************************************************>>>>>>>>>>>>>>‚Returnfrominterrupthere.‚<<<<<<<<<<<<<<<<<<<<<<<<<<<<-‰CMP.B…#$80,RACSTAT(A1)„Wascmdcompletedok?‰BNE.S…RACALERRŒNo--error.@‰MOVE.B„RANXT2GT(A1),D2…Yes--getcalibrationreadingsfromFIFO.!*¦Putnext-to-getoffsetintoD2. ‰CLR.L…D5>>>>>>>>>>>>>>‚Returnfrominterrupthere.‚<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<;‰MOVEP.LƒRATSTAT(A1),D0†Putstatusintocmdparamtablefor)‰MOVE.L„D0,RACMDPRM+2(A3)†returntouser./‰CMP.B…#$80,RACSTAT(A1)„Self-testcompletedok?‰BEQ.S…RATST2ŽYes.-‰CMP.B…#$03,RACSTAT(A1)„No.‚Self-testfailed?%‰BNE.S…RATSTERRŒNo--someothererror.8‰MOVE.L„#RATSTFAL,D0ˆSetD0to"testfailed"indication.4‰MOVE.L„RARDLADR(A5),A1…SettheRADstatusto"bad".‰MOVE†#RASTBAD,RARDSTAT(A1)RATSTRETEQU‡* ‰RTS›Return-RATST2ƒCLR.L…D0’SetD0toindicatenoerrors.‰BSR‡RACLRSTAŒClearRADstatus.‰BRA‡RATSTRETŒGoreturn.:RATSTERRBSR‡RAEXERRSetD0toindicate"executionerror".‰BRA‡RATSTRETŒGoreturn.‰PAGEN*******************************************************************************$*ˆSubroutinetohandleRADABTcalls.*,*’Calledfromthecommandprocessorroutine.*#*ˆUponentry:‰A2=paramblockaddr*œA3=commandpacketaddr*œA5=CCBaddr*œA6=TCBaddr*2*ˆUponreturn:ˆD0=errorcode(=0,ifsuccessful)**œ01234567*˜D:‚*********˜A:‚**PP*PP**O*******************************************************************************=RARADABTEQU‡*‰RoutinetoabortwhatevertheRADisdoingand$*¦closeallchansforthisRAD.‚(All&*¦usersofthisRADwillbeflaggedin'*¦RAUSRLSTsotheycanbe"notified"of"*¦theabortontheirnextrequest.@‰MOVE.L„RARDLADR(A5),A1…PutaddrofthisRAD'sentryinRARADLST ‰CLR.L…D3=‰MOVE†RARDSTAT(A1),D3…StoreRADstatus(whichistheuserptr&*¦iftheRADiscurrentlybeingused).*‰CMP‡#RASTOK,D3ŠinA1.‚IsRADrunningnow?(‰BEQ.S…RAABT0ŽNo--don'thavetostopit.#‰CMP‡#RASTBAD,D3‰IsRADmarkedbad?)‰BEQ.S…RAABT0ŽYes--don'thavetostopit.#*¦No--RADmustberunning--stopit.<‰MOVE.L„RASHRAD(A5),A1†Putstartaddrofshared-RAMintoA1.2‰CLR.B…RACSTAT(A1)‰Clearcmdstatusinshared-RAM.;‰MOVE.B„#1,RAINTMSK(A1)…Setinterruptmaskinshared-RAMto *¦interruptwhenRADisstopped.:‰MOVE.B„#RASTOPIT,RASTPBYT(A1)ˆSetstopbyteinshared-RAM*¦tostopRADprocessing.&‰TR0$.PAUSEŠ,‰Waitfordoneinterrupt.I*>>>>>>>>>>>>>>>‚Returnfrominterrupthere.‚<<<<<<<<<<<<<<<<<<<<<<<<<<<<6RAABT1ƒMOVE.L„RAD1TBL,A1ŠPutaddroftableareainA1.6‰LEA‡RAUSRLST(A1),A2…SetA2tostartaddrofRAUSRLST.4‰MOVE†#32,D1ŽMustsetallchanstounusedstatusand&*¦flagallusersofthisRADtoinform'*¦themoftheabortontheirnextcall.?‰LEA‡RACHNUSR(A5),A1‚SetA1tostartofuserptrsforthisRAD.1RAABTLUPCMP‡#$FFFF,(A1)‰Isthischanunassigned?&‰BEQ.S…RAABT2ŽYes--goontonextchan.*‰CMP‡#$F000,(A1)‰Isthischanunavailable?&‰BEQ.S…RAABT2ŽYes--goontonextchan.(‰CLR.L…D2’No--must"unassign"thischan.!‰MOVE†(A1),D2PutuserptrinD2.0‰MOVE†#$FFFF,(A1)‰Setchantounassignedstatus.´2¦3®8¶+¾4Æ4Î8Ö4ÞBæ/î1ö</‰CMP‡D2,D3Doesthischanbelongtothecurrent*¦userofthisRAD(ifany)?#‰BEQ.S…RAABT2ŽYes--don'tflaguser.8‰MULU†#RAULNG,D2ŠMultiplyuserptrbylengthofRAUSRLST+*¤entrytogetoffsettothisuser'sentry.<‰MOVE.B„#RAABTCOD,RAUSTAT(A2,D2)†SetuserstatusinRAUSRLST#*¦toabortcodesothatusercanbe%*¦notifiedofabortonhisnextcall.2RAABT2ƒADD.L…#2,A1BumpA1topttonextuserptr.‰SUBQ†#1,D1Allchansdone?‰BGT‡RAABTLUPŒNo--godonext.=‰MOVE.L„#RAABTCOD,D0ˆYes--notifyc urrentuser(ifany)ofthe‰BSR‡RANOTIFYŒabort.@‰MOVE.L„RARDLADR(A5),A1…PutaddrofthisRAD'sentryinRARADLST *¦intoA1.2‰MOVE†#RASTOK,RARDSTAT(A1)ŠSetRADstatusto"ok".5‰MOVE.L„RASHRAD(A5),A1†SetA1tostartofshared-RAM.8‰CMP.B…#$84,RACSTAT(A1)„Yes.‚DidtheRADstopcorrectly?‰BNE.S…RAABTERRŒNo--error.3‰CLR.L…D0Yes--setD0toindicatesuccessfulabort.RAABTRETEQU‡* ‰RTS›Return.@RAABT0ƒMOVE.L„RASHRAD(A5),A1†SetA1tostartaddrofshared-RAM.8‰MOVE.B„#$84,RACSTAT(A1)„Setcmdstatusinshared-RAMto$*¦"successfulstop"valueforlater.+‰BRA‡RAABT1ŽContinuewithabortprocessing.6RAABTERRBSR‡RAEXERRExecutionerrorinRAD.‚SetD0to *¦errorcode.‰BRA.S…RAABTRETŒGoreturn.‰PAGEK****************************************************************************=*ˆSubroutinetoseterrorreturnvalueinD0forunsuccessful*’functionexecution.*+*ˆCalledfromcommand-handlingsubroutines.*2*ˆUponentry:ƒA1=addrofshared-RAMforthisRAD*K***************************************************************************ARAEXERR‚CMP.B…#$01,RACSTAT(A1)„Didwegetan"illegalcmd"return*¦fromtheRAD?‰BNE.S…RAEXERR2ŒNo.-‰MOVE.L„#RAERR9,D0ŠYes--setD0toerrorcode.‰BRA.S…RAEXERR9ŒGoreturn.=RAEXERR2MOVE.L„#RAEXERRV,D0ˆSetD0toexecutionerrorvalue.RAEXERR9RTS›Return‰PAGEM******************************************************************************>*ˆSubroutinetosettheRADstatusto"ok"andresetthedata-:*’retrieval-subroutineaddresstotheaddressofRARDFIFO.*+*ˆCalledfromcommand-handlingsubroutines.**ˆUponentry:‰A5=CCBaddress.*=*ˆUponexit:‚contentsofregisterA1aredestroyed--allother*œregistersare"untouched".*N******************************************************************************RACLRSTAEQU‡**;‰LEA‡RARDFIFO(PC),A1…Putaddrofread-FIFOroutineintoA1.=‰MOVE.L„A1,RARTRVAD(A5)…Storeitindata-retrieval-subroutine)*¦addrlocinCCB.‚(Thisisthe"default"*¦data-retrievalsubroutine.)=‰MOVE.L„RARDLADR(A5),A1…SetA1toaddrofthisRAD'sentryin *¦RARADLST.2‰MOVE†#RASTOK,RARDSTAT(A1)ŠSetRADstatusto"ok". ‰RTS›Return.‰PAGEN*******************************************************************************,*ˆSubroutinetoreadtheFIFOinshared-RAM.*(*ˆCalledfrominterruptserviceroutine.*3*’Uponentry,A1containsstartaddrofshared-RAM.**•01234567*’D:*ƒ***** *’A:ƒP***N******************************************************************************RARDFIFOEQU‡*RAFILUP1CLR.L…D29‰MOVE.B„RANXT2GT(A1),D2…Getnext-to-getptrforFIFOfrom *°shared-RAM.0‰CLR.L…D6’SetupD6tocontaincommandstatusin=‰MOVE.B„RACSTAT(A1),D6†bits8-15forlateruseinqueueingan‰ASL.L…#8,D6event.;‰ASL‡#1,D2…Doublenext-to-getptrtogetactualoffsetfrom'*¦startofshared-RAM(68K-addressing).4‰LEA‡(A1,D2),A2ŠGetactualaddrofnextvaluetoget*°andstoreitinA2.3‰CMPI.B„#$FF,(A2)‹Anydatainnext-to-getlocation?$‰BEQ‡RAFIFOMTŒNo--FIFOisnowempty.4‰MOVE.B„0(A2),D5‚Yes--findoutwhattodowithdata.1‰MOVE.B„D5,D3Storegainandchan#inD5andD3.>‰AND.L…#$1F,D5ƒMaskoffgain,leavingjustthechannelnumber.0‰MOVE.B„D5,D6Movechan#intoD6forlateruse.7‰MULU†#RACHNLLG,D5ˆCalculateoffsetinto'RARADLST'for*¦thischannel.5‰ADD.L…RARDLADR(A5),D5…Addstart-of-entryaddress(in*¦'RARADLST')forthisRAD.;‰ADD.L…#RACHNLST,D5ˆD5nowcontainstheaddroftheoptions4‰MOVE.L„D5,A3flagforthischannel.‚PutaddrinA3.*9*’========‚PackdataforthisreadingintoD3.‚==========4‰MOVE.B„2(A2),D4ŒPutflagsandhi-databyteintoD4.‰ASL.L…#8,D3ShiftdatainD3.,‰MOVE.B„D4,D3Putflagsandhi-dataintoD3.6‰ANDI.B„#$F0,D3Maskofflowbyte,leavingjustflags.&‰ASL.L…#8,D3Shiftdataoveronebyte.2‰MOVE.B„D4,D3Putflagsandhi-dataintoD3again.8‰ANDI.B„#$0F,D3Maskofflowbyte,leavingjusthi-data.&‰ASL.L…#8,D3Shiftdataoveronebyte.7‰MOVE.B„4(A2), D3ŒPutlo-databyteintoD3.‚Nowalldata(*¦forthisreadinghasbeenputintothe&*¦4bytesofD3inthecorrectformat.8‰MOVE.L„RACHNSTO-RACHNOPT(A3),A3†Putstorage-addrinA3.4‰MOVE.L„D3,(A3)Storedatainlocspecifiedbyuser.+‰MOVE.B„#$FF,(A2)‹SetFIFOlocto"unused".=‰ADDQ.B„#3,RANXT2GT(A1)…SetFIFOnext-to-getptrtonextdata*°locationintheFIFO.3‰MOVE.B„RAFIFOND(A1),D4…SetD4toend-of-FIFOaddr.7‰CMP.B…RANXT2GT(A1),D4…ArewepasttheendoftheFIFO?‰BHS.S…RAF1No.?‰MOVE.B„RAFIFOST(A1),RANXT2GT(A1)…Yes--setFIFOnext-to-getptr*°tostart-of-FIFOptrvalue.6RAF1…MOVE.L„D5,A3ResetA3toaddrofoptionsflagfor *¦thischan.'‰MOVE†(A3),D0PutoptionsflagintoD0.<‰BTST.L„#RASUBRBT,D0ˆIsthereasubroutinetobecalledwhen*¦thereisdataforthischan?‰BEQ.S…RAF2No.?‰MOVE.L„RACHNSUB-RACHNOPT(A3),A3†Yes,putaddrofsubrintoA3.3‰MOVEM.LƒD1-D7/A0-A6,-(A7)ƒStoreregistercontents.‰JSR‡(A3)Jumptosubroutine.5‰MOVEM.Lƒ(A7)+,D1-D7/A0-A6ƒRestoreregistercontents.L*======================‚Onreturnfromsubroutine,D0willbesetforeither0*œqueueeventorwakeupifeitheroftheseisto-*œbedoneafterthesubr.‚Else,D0willbe0.=RAF2…BTST.L„#RAQUEBT,D0‰Arewetoqueueaneventtotheuser?‰BEQ.S…RAF3No.:‰MOVE.L„#RAEVNTHI,D2ˆYes--setupperhalfofD2tostandard*¦eventdata(lengthandcode).2‰MOVE†D6,D2Putcommandstatusandchan#intoD2.=‰MOVE.L„CCBMNEM(A5),D3†PutRAD-IDinto2ndlongwordofevent.*‰BSR‡QEVENTŽGoqueueaneventtotheuser.$‰BRA.S…RAF9Alldonewiththischan.;RAF3…BTST.L„#RAWAKEBT,D0ˆArewetodoawakeupoftheuser?(‰BEQ.S…RAF9No--alldonewiththischan.#‰MOVE.L„A6,A0PutTCBaddrintoA0.+‰MOVEM.LƒD0-D7/A0-A6,-(A7)ƒStoreregisters.*‰TR0$.WAKEUP‰,‰Issueawakeuptotheuser.-‰MOVEM.Lƒ(A7)+,D0-D7/A0-A6ƒRestoreregisters.9RAF9…BRA‡RAFILUP1‚GobackandgetnextreadingfromFIFO.-RAFIFOMTRTS‘RADFIFOisnowempty--return.‰PAGEK****************************************************************************/*ˆSubroutinetofinduser'sentryin'RAUSRLST'*>*ˆCalledfromcommandprocessorandcommand-handlingroutines.**’Uponexit:ƒD0=errorflag*ŸD1=entry#forthisuser.**œAllotherregistersusedwillhavetheir*œcontentsrestored.*L****************************************************************************RAFNDUSREQU‡**3‰MOVEM.LƒD2-D4/A0-A1,-(A7)ƒStoreregistercontents.4‰MOVE.L„RAD1TBL,A1ŠPutaddrofRADtableareainA1.1‰LEA‡RAUSRLST(A1),A0…PutaddrofuserlistinA0.6‰MOVE.L„A1,D0SetD0toaddrofRARADLST,whichisthe1‰ADD‡RARADLAD(A1),D0…sameastheendofRAUSRLST.-‰CLR.L…D1’D1willbea"usercounter".‚(First*¦userwillbe#0.)7‰MOVE.L„TCBNAME(A6),D2†Putusertasknameandsession#'‰MOVE.L„TCBSESSN(A6),D3…intoD2andD3.(‰MOVE.L„CCBMNEM(A5),D4†PutRAD-IDinD4.4RAFNDLP‚CMP.L…RAUUSRNO(A0),D2…Doesthisentrymatch?!‰BNE.S…RAFNXTŽNo--trynextentry.‰CMP.L…RAUUSRNO+4(A0),D3ƒMaybe.‰BNE.S…RAFNXTŽNo--trynext.‰CMP.L…RAURADID(A0),D4…Maybe.‰BEQ.S…RAFGOTITŒYes.:RAFNXTƒADDA.L„#RAULNG,A0ŠDoesn'tmatch.‚Setuptotrynext0‰CMPA.L„D0,A0entry.‚Arethereanymoreentries?2‰BHS.S…RAFNOGOTŒNo--thisuserisnotsetuptouse!*¦thisRAD.‚Gomakeerrorreturn.!‰ADDQ†#1,D1Yes--incentrycount.*‰BRA‡RAFNDLPGobackandcheckthisentry.*RAFNOGOTMOVE.L„#RAERR3,D0ŠSeterrorcode.‰BRA.S…RAFRETŽGoreturn.)RAFGOTITEQU‡*“A0containsaddrofentry;&*¦D1containsptrtothisentry(i.e., *¦entry#).7‰CMP.B…#RAABTCOD,RAUSTAT(A0)‰WasthisRADabortedsince*¦thelastcallbythisuser?#‰BNE.S…RAFNDOKNo--everything'sok.*B************‚Becauseofthewaythe"abort"flagissetandreset,G************‚thefollowingcodewillonlybeexecutedwhenthisroutineD************‚iscalledfromthecommandhandleronthefirstcallby@************‚eachuserafterthisRADhasbeenaborted(RADABT).*3‰CLR.B…RAUSTAT(A0)‰Yes.‚Clearthe"aborted"flagin*¦thisuser'sstatus.8‰MOVE.L„#RAABORTD, D0ˆSeterrorcodeto"warning--RADwas*¦aborted"code.‰BRA.S…RAFRETŽGoreturn. ************ ************/RAFNDOK‚CLR.L…D0’ClearD0toindicatenoerror.;RAFRETƒMOVEM.Lƒ(A7)+,D2-D4/A0-A1ƒRestoreregistercontents. ‰RTS›Return.‰PAGEL*****************************************************************************@*ˆSubroutinetomoveparametersintoshared-RAMparametertable.*+*’Calledfromcommand-handlingsubroutines.*L*****************************************************************************2*’Uponentry--ˆA4=addrofparameterstobemoved*¦D4=#ofbytestobemoved7*’(A4andD4willcontainthesameasaboveuponexit.)$*’Uponexit:ŠA1=addrofshared-RAML*---------------------------------------------------------------------------RAMOVPRMEQU‡*-‰MOVEM.LƒA4/D4,-(A7)‰Storeregistercontents.<‰MOVE.L„RASHRAD(A5),A1†Putstartaddrofshared-RAMintoA1.9‰LEA‡RAPARAM(A1),A0†Putaddrofparamtableinshared-RAM *¦intoA0.RANTF2ƒBTST.L„#RAWAKEBT,D0ˆArewesupposedtoissueawake-up?‰BEQ.S…RANTFRETŒNo--goreturn.8‰MOVEM.LƒD0-D7/A0-A6,-(A7)ƒYes--storeregistercontents.*‰MOVE.L„A6,A0Putuser'sTCBaddrintoA0. ‰TR0$.WAKEUP‰,‰Goissuewake-up.-‰MOVEM.Lƒ(A7)+,D0-D7/A0-A6ƒRestoreregisters.RANTFRETEQU‡*0‰MOVEM.Lƒ(A7)+,D0-D3/A1-A2/A6ŠRestoreregisters. ‰RTS›Return.‰PAGEF***********************************************************************B* SUBROUTINE TO CHECK ADDRESS BOUNDARIES TO SEE IF ENTIRELY WITHIN*ƒCALLINGTASKSADDRESSSPACE.*#*ENTRY:ƒD5‚-NO.OFBYTESTOCHECK*ŠD6‚-68000ADDRESS(LOGICAL)*ŠA1‚-TCBADDRESS**#* REGISTERS USED: D0-D1,D3,D6/A0-A1**7*EXIT:„D6-PHYSICALADDRESSOFBUFFERBASE(IFLEGAL)*ŠRETURNTOPC„FORGOODADDRESS*”PC+2‚FORBADLENGTH*”PC+4‚FORBADADDRESS**C*******************************************************************IOHADRCK‚EQU„*$ŠBTSTƒ#0,D6ŽMUSTBEONWORDBOUNDARY(ŠBNE.S‚IOHADR4ŒBRANCHIFBADBUFFERBASE ŠTST.L‚D5.ŠBEQ.S‚IOHADR8ŒDON'TGOTOLOGPHYWITH0COUNT IOHADR2ƒEQU„*/ŠMOVE.LTCBTST(A1),A0†ADDRESSOFTASKSEGTABLE ŠTR0$.LOGPHY&ŠBRA.S‚IOHADR8ŒBRANCHFORGOODADDRESS(ŠBRA.S‚IOHADR6ŒBRANCHFORBADBYTECOUNT'ŠTST.L‚D5‘WASANENTRYPOINTERRETURNED#ŠBEQ.S‚IOHADR4ŒBRANCHIFNO-ERROR'ŠTST.B‚7(A0,D5)‹ISTHISANMMIOSEGMENTŠBNE.S‚IOHADR8ŒYES,OKIOHADR4ƒADD.L‚#2,(A7)IOHADR6ƒADD.L‚#2,(A7) IOHADR8ƒRTSŠPAGEJ***************************************************************************F*INTERRUPTSERVICEROUTINE…<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*?*ƒPURPOSE:‚HANDLEACKNOWLEDGEMENTSANDMESSAGECOMPLETIONSFROM3*THERAD1.‚OPERATESATHARDWAREINTERRUPTPRIORITY<*LEVELASASUBROUTINETOTHEFIRSTLEVELINTERRUPTHANDLER *(INCMR).*4*ƒENTRY:‚JSR‚FROMINTERRUPTHANDLERROUTINE(INCMR)*‹A0=WORKREGISTER *‹A1=SELF*‹A5=CCBADDRESS*‹D0=WORKREGISTER*/*ƒEXIT:‚RTS-BACKTOINTERRUPTHANDLERROUTINE**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A*****PP***ƒCODEISRE-ENTRANT*F*---------------------------------------------------------------------**"RADISR„EQU„*’INTERRUPTENTRYPOINT.‰MOVEM.LƒD1-D7/A2-A4/A6,-(A7)…STOREREGISTERS.*=‰MOVE.L„RAUSRTCB(A5),A6…SetA6toaddrofcurrentuser'sTCB,(*¦whichwasstoredwhencommandwassent*¦tothisRADboard.7‰MOVEA.LƒRASHRAD(A5),A1†Putaddrofshared-RAMintoA1.3‰MOVE.B„RAXSTAT(A1),D1†PutstatusfromRADintoD1.4‰AND.B…#RAINTBIT,D1ˆDidthisRADsendtheinterrupt?)‰BEQ‡RAINONo.‚ReturnandchecknextRAD.8‰CMP.B…#RALVL4,CCBPPRIO(A5)ŠIsthisalevel4interrupt?‰BNE.S…RAISR1ŽNo--level3.**¦Yes--RAD"died".8‰MOVE.L„CCBMNEM(A5),D0†PutRAD-IDfromthisCCBintoD0.7‰SUB.L…#$0400,D0‹SubtracttogetRAD-IDforlevel3CCB(*¦whichcorrespondstothislevel4CCB.*0*SearchCCBchainforlevel3CCBforthisRAD.*+‰MOVE.L„A5,-(A7)ŒStoreaddroflevel4CCB.6‰MOVE.L„CCBHD,A5ŒStoreaddrof1stCCBinchaininA5.%RAISRLP‚CMP.L…#0,A5EndofCCBchain?6‰BEQ.S…RAISRFALŒYes.‚Somethingwrong--can'tfindlevel)*¦3CCBforthisRAD.‚Ohwell,forgetit!<‰CMP.L…CCBMNEM(A5),D0†IsthistheCCBwehavebeens earching#‰BEQ.S…RAISR0Žfor?ƒEUREKA!!!Itis!0‰MOVE.L„CCBALL(A5),A5‡No--trynextCCBinchain. ‰BRA‡RAISRLPFRAISR0ƒMOVE.L„RARDLADR(A5),A2…PutaddrofthisRAD'sentryinRARADLST *¦intoA2. ‰CLR.L…D3=‰MOVE†RARDSTAT(A2),D3…StoreRADstatus(whichisuserptrfor*¦currentuser,ifany).4‰MOVE†#RASTBAD,RARDSTAT(A2)‰SetRADstatusto"bad".(‰MOVE.L„#RAERR1,D0ŠSetD0toerrorcode.3‰BSR‡RANOTIFYŒNotifycurrentuser,ifany,thatRAD *¦justdied.RAISR8ƒCLR.B…RARDFLAG(A5)ˆFinishedprocessingthisinterrupt--$*¦clear"workingoninterrupt"flag.*3RAISR4ƒEQU‡*“TellCMRthatinterrupthasbeentaken *¦careof.7‰CLR.B…RAINTFLG(A1)ˆClearinterruptflaginshared-RAM.-‰ORˆ#1,SRSetcarrybittoind icatethatthis*¦interrupthasbeenhandled. ‰BRA.S…RAISR9*4RAINO„EQU‡*“TellCMRthatthisinterruptisnotfrom *¦thisRAD.2‰AND‡#$FFFE,SR‹(Clearcarrybittoindicatethis.)**RAISR9ƒEQU‡*“ReturntoCMR.***-* RAD INTERRUPT HANDLER EXITS FROM THIS POINT*/ŠMOVEM.L(A7)+,D1-D7/A2-A4/A6…RESTOREREGISTERSŠRTSšBACKTOINTERRUPTHANDLERŠ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**************************************************************************** QEVENTƒEQU‡**ŠMOVEM.LA0-A6/D0-D7,-(A7)‡Saveregisters.#‰MOVE.L„A6,A0Caller'sTCBaddress.6ŠTR0$.QEVNTIˆ,‰(QEVNTIroutineisusedsincethiswill#*¦becalledonlywhileservicingan *¦interrupt.)#ŠBRA.S‚IOHQ5ŽBranchifqueueingok.-ŠMOVEM.L(A7)+,A0-A6/D0-D7…Restoreregisters.9ŠMOVE.L(A7),CCBQVER1(A5)‚Savecallersaddressfordebug.ŠBRA.S‚IOHQRTN 2IOHQ5…MOVEM.L(A7)+,A0-A6/D0-D7„Restoreregisters..ŠCLR.L‚CCBQVER1(A5)‡Clearqueueerroraddress. IOHQRTNƒRTS—RETURN‰ENDéK*==========================================================================*=*ˆFORTRAN-callablesubroutinesusedtoinvoketheRADdriver.*K*==========================================================================** ‰SECTIONƒ9=‰XDEF†RADOPN,RADTST,RADABT,RADJMP,RADLOD,RADDMP,RADXEQ,RADSTP6‰XDEF†RADATO,RADCLS,RADSCN,RADEXT,RADSET,RADHIS,RADCAL****J*----------------‚CONSTANTS----------------------------------------------*2ERRCODƒEQU‡$F3‘Errorcodefor"paramtableerror".*%RASTPCMDEQU‡00ˆ"Stop"commandvalue.%RALODCMDEQU‡01ˆ"Load"commandvalue.%RADMPCMDEQU‡02ˆ"Dump"commandvalue.%RAJMPCMDEQU‡03ˆ"Jump"commandvalue.*RATSTCMDEQU‡04ˆ"Self-test"commandvalue.&RAOPNCMDEQU‡$10‡"Open"commandvalue.'RACLSCMDEQU‡$20‡"Close"commandvalue.'RAABTCMDEQU‡$7F‡"Abort"commandvalue.2RAEXTCMDEQU‡$81‡"Externaltrigger"commandvalue.*RASETCMDEQU‡$82‡"Setpoint"commandvalue.&RASCNCMDEQU‡$83‡"Scan"commandvalue.1RAATOCMDEQU‡$84‡"Auto-rangescan"commandvalue.+RACALCMDEQU‡$85‡"Calibrate"commandvalue.1RAHISCMDEQU‡$86‡"High-speedscan"commandvalue.2RAXEQCMDEQU‡$80‡"Executefunction"commandvalue.‰PAGE*H*-----------------------------------------------------------------------*!*ˆGeneralformatofFORTRANcall:&*’CALLRADXXX(rad-id,param-table-addr)*=*ˆThiscallwillcause3itemstobepushedontothestack--:*’(1)‚addresswherethedesiredRAD-IDisstored‚(4bytes)9*’(2)‚addressofparametertableinuser'sarea‚(4bytes)*’(3)‚returnaddress‚(4bytes)*A*ˆAllregisterswillbesavedandrestoreduponreturnexceptfor+*’registerA0,whosecontentswillbelost.*@*ˆUponreturn,thestackpointerwillbethesameasitwasjust6*’priortotheRADcall.‚Thefollowingillustratesthe4*’datawhichisputonthestack(andremovedbefore$*’returningtothecallingprogram).*?*ˆ(Lowestaddrofstack)…1)CMRcommandcode,subcode…(2bytes)*£2)**‚(zero-filled)(2bytes)*£3)RAD-ID˜(4bytes)þ8679*£4)**‚(zero-filled)(4bytes)*£5)**‚(zero-filled)(4bytes)*£6)**‚(zero-filled)(4bytes)%*£7)cmdpacketaddr(=addrofuser's*°paramtable)ˆ(4bytes)#*£8)lengthofcmdpacketŠ(2bytes)*£9)contentsofA3(4bytes)*¢10)contentso fD2(4bytes)*¢11)contentsofD1(4bytes)*¢12)contentsofD0(4bytes)*¢13)returnaddr“(4bytes) *¢14)param-table-addrŽ(4bytes)>*ˆ(highmemoryaddr)ˆ15)addrwhereRAD-IDisstoredƒ(4bytes)*5*’#1through8aboveformtheparameterblockforthe(*œCMRTRAP1.‚(**marktheunusedfields)6*’#9through12arestoragelocationsfortheregister *œcontents.;*’#14and15aretheparameterspassedbytheFORTRANcall.*O*********************************************************************************‰PAGECRADOPNƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontentsonthestack.1‰MOVE†#RAOPNCMD,D1ˆStorecommandcodefor"open".9‰MOVE.L„20(A7),A3‹Putaddrofuser'sparamtableintoA3. ‰CLR.L…D2)‰MOVE†4(A3),D2ŒPut#ofchannelsintoD2..‰MULU†#12,D2ŽCalculate#ofbytesinparameter-‰ADD.L…#6,D2table(includingfirst6bytes).6‰BRA‡CALLDRVRŒGosetupparamblockandmakeCMRcall.**CRADTSTƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontentsonthestack.2‰MOVE†#RATSTCMD,D1ˆStorecmdcodefor"self-test".@RADTST2‚MOVE.L„20(A7),A3‹Putaddrofuser'sparamtableintoA3.2‰MOVE.L„#10,D2ŽPut#bytesinparamtableintoD2.6‰BRA‡CALLDRVRŒGosetupparamblockandmakeCMRcall.**6RADABTƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents..‰MOVE†#RAABTCMD,D1ˆStorecmdcodefor"abort".@RADABT2‚MOVE.L„20(A7),A3‹Putaddrofuser'sparamtableintoA3.0‰MOVE.L„#4,D2PutlengthofparamtableintoD2.6‰BRA‡CALLDRVRŒGosetupparamblockandmakeCMRcall.**6RADJMPƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.-‰MOVE†#RAJMPCMD,D1ˆStorecmdcodefor"jump".9‰MOVE.L„20(A7),A3‹Putaddrofuser'sparamtableintoA3. ‰CLR.L…D2%‰MOVE†10(A3),D2‹Put#paramsintoD2.&‰ASL.L…#1,D2Doubletoget#ofbytes./‰ADD.L…#12,D2ŽAdd#bytesinbeginningoftable**¦(includingcount)togivetotal#bytes.6‰BRA‡CALLDRVRŒGosetupparamblockandmakeCMRcall.**6RADLODƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.-‰MOVE†#RALODCMD,D1ˆStorecmdcodefor"load".>RADLOD2‚MOVE.L„20(A7),A3‹Putaddrofuser'sparamtableinA3.2‰MOVE.L„#12,D2ŽPut#bytesinparamtableintoD2.6‰BRA‡CALLDRVRŒGosetupparamblockandmakeCMRcall.**6RADDMPƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.-‰MOVE†#RADMPCMD,D1ˆStorecmdcodefor"dump".3‰BRA‡RADLOD2Gofinishsetup(sameasforRADLOD).**‰PAGE6RADXEQƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.9‰MOVE†#RAXEQCMD,D1ˆStorecmdcodefor"executefunction".9‰MOVE.L„20(A7),A3‹Putaddrofuser'sparamtableintoA3. ‰CLR.L…D2(‰MOVE†12(A3),D2‹Put#ofparamsintoD2.'‰ASL.L…#1,D2Doubletogive#ofbytes.2‰ADD.L…#14,D2ŽAdd#bytesinbeginningoftableto*¦total#bytesintable.6‰BRA‡CALLDRVRŒGosetupparamblockandmakeCMRcall.**6RADSTPƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.-‰MOVE†#RASTPCMD,D1ˆStorecmdcodefor"stop".3‰BRA‡RADABT2Gofinishsetup(sameasforRADABT).**6RADATOƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.8‰MOVE†#RAATOCMD,D1ˆStorecmdcodefor"auto-rangescan".@RADATO2‚MOVE.L„20(A7),A3‹Putaddrofuser'sparamtableintoA3. ‰CLR.L…D2#‰MOVE†4(A3),D2ŒPut#chansintoD2.'‰ASL.L…#1,D2Doubletogive#ofbytes.5‰ADD.L…#6,D2Addtogivetotallengthofparamtable.8‰BRA.S…CALLDRVRŒGosetupparamblockandmakeCMRcall.**6RADCLSƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents..‰MOVE†#RACLSCMD,D1ˆStorecmdcodefor"close".3‰BRA‡RADABT2Gofinishsetup(sameasforRADABT).**6RADSCNƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.-‰MOVE†#RASCNCMD,D1ˆStorecmdcodefor"scan".9‰MOVE.L„20(A7),A3‹Putaddrofuser'sparamtableintoA3. ‰CLR.L…D2#‰MOVE†6(A3),D2ŒPut#chansintoD2.$‰ASL.L…#1,D2Doubletogive#bytes.4‰ADD.L…#8,D2Add#bytesinbeginningofparamtable'*¦togivetotal#bytesinparamtable.8‰BRA.S…CALLDRVRŒGosetupparamblockandmakeCMRcall.**6RADEXTƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.9‰MOVE†#RAEXTCMD,D1ˆStorecmdcodefo r"externaltrigger".3‰BRA‡RADATO2Gofinishsetup(sameasforRADATO).**‰PAGE6RADSETƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.9‰MOVE.L„20(A7),A3‹Putaddrofuser'sparamtableintoA3. ‰CLR.L…D13‰MOVE†4(A3),D1ŒMultiply#ofsetpointchansby6to$‰MULU†#6,D1#bytesforsetptchans. ‰CLR.L…D20‰MOVE†6(A3),D2ŒPut#non-setpointchansintoD2.6‰ASL.L…#1,D2ŽDoubletoget#bytesofnon-setptchans.0‰ADD.L…D1,D2Gettotal#ofbytesinparamtable‰ADD.L…#8,D2intoD2.9‰MOVE†RASETCMD,D1‰SetD1tocmdcodefor"setpointscan".8‰BRA.S…CALLDRVRŒGosetupparamblockandmakeCMRcall.**6RADHISƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.8‰MOVE†#RAHISCMD,D1ˆStorecmdcodefor"high-speedscan"./‰BRA‡RADTST2Gofinishsetup(sameasRADTST).**6RADCALƒMOVEM.LƒD0-D2/A3,-(A7)†Storeregistercontents.4‰MOVE†#RACALCMD,D1ˆStorecmdcodefor"calibration"./‰BRA‡RADLOD2Gofinishsetup(sameasRADLOD).**‰PAGE?CALLDRVRMOVE†D1,2(A3)ŒPutcmdcodeintouser'scmdparamtable.2‰CMP.L…#$7FFF,D2‹Islengthofparamtabletoobig?‰BHI.S…PRMERRŽYes--error."*---------------------------------*/*ˆSetupparameterblockforCMRcallonstack.**’(Thiswillbebuiltfromthebottomup.)*2‰MOVE†D2,-(A7)ŒPutpacketlength(i.e.,#bytesin$*¦user'sparamtable)at"bottom"of*¦paramblockforCMR.7‰MOVE.L„A3,-(A7)ŒAddrofparamtable(=cmdpacket)goes*¦next.0‰CLR.L…-(A7)Clearunusedfieldsofparamblock. ‰CLR.L…-(A7) ‰CLR.L…-(A7)-‰MOVE.L„42(A7),A3‹PutaddrofRAD-IDintoA3.7‰MOVE.L„(A3),-(A7)ŠPutRAD-IDintoparamblockforCMR.<‰MOVE.L„#$07000000,-(A7)„PutCMRcmdcode,subcode,etc.,at*¦"top"ofparamblockforCMR.0‰MOVE.L„A7,A0Putaddrofparamblock(whichnow"*¦startsattopofstack)intoA0.#‰MOVE.L„#60,D0ŽSetD0forCMRcall..‰TRAP†#1’CallCMR,whichwillinturncallthe *¦RADdriver.=RTRN…MOVE.L„46(A7),A3‹Putaddrofuser'sparamtableintoA3.5‰MOVE†D0,(A3)Putreturnederrorflagintoerrorcode*¦byteinuser'sparamtable.3‰LEA‡26(A7),A7‹Setstackptrtoaddrwhereregister*¦contentsarestored.2‰MOVEM.Lƒ(A7)+,D0-D2/A3†Restoreregistercontents.)‰MOVE.L„(A7)+,A0ŒPutreturnaddrintoA0.0‰LEA‡8(A7),A7Œ"Pop"passedparametersoffstack.‰JMP‡(A0)Returntouser.**<*--------------------------‚Errorinuser'sparametertable.*:PRMERRƒMOVE†#ERRCOD,D0ŠSetD0toerrorcodefor"parameter*¦tableerror".‰BRA‡RTRNGoreturntouser.**‰END  éééééŠPAGEŠTTL„TR1RTCD.EQŠINCLUDE9995.&.TR1RTCD.EQ ŠTTL„STR.EQŠINCLUDE9995.&.STR.EQ ŠTTL„TCB.EQŠINCLUDE9995.&.TCB.EQ ŠTTLCCB.EQŠINCLUDE9995.&.CCB.EQ ŠTTLLV5.EQŠINCLUDE9995.&.LV5.EQŠLISTŠTTLRIODRV.EQŠINCLUDE9995.&.RIODRV.E QŠTTLSTDMACRO.AIŠINCLUDESTDMACRO.AI/ŠTTLRIODRIVERCOPYRIGHT1982BYMOTOROLAINC.*‰INCLUDE9995.&.STR.EQ*‰INCLUDE9995.&.TR1RTCD.EQ*‰INCLUDE9995.&.TCB.EQ*‰INCLUDE9995.&.CCB.EQ*‰INCLUDE9995.&.LV5.EQ*‰INCLUDE9995.&.RIO.EQ*‰INCLUDE0..STDMACRO.SA@RIODRV„IDNTƒ2,0‰RIODRVR3/28/83COPYRIGHT1982BYMOTOROLAINC. ŠLLENƒ120ŠPAGEJ****************************************************************************8*ƒRIODRV--REV.1.005/12/82(C313)RONIWOOD&JIMLOE4*REV.2.003/28/83(C313)CHANGEDINTERRUPTHANDLER***ƒPurpose:‚REMOTEI/OHANDLER*/*ƒEntry:‚JSRFROMCMRHANDLER(COMMANDSERVICE) *‹JSRFROMCMRINTERRUPTHANDLER*-*ƒExit:-ALWAYSEXITSWITHARTSINSTRUCTION***ƒCODEISRE-ENTRANT*&*ˆASSEMBLY:USECHAINFILE'RIOASM.CF'*H*-----------------------------------------------------------------------*ŠPAGE*************************** MISCELLANEOUS EQUATES ***************************IOEVCD„EQU„1’I/Oeventcode*********************** *‡MACROS†************************* 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„MACRO4‰MOVE.W„CCBSR(A5),SRˆDropprocessorprioritybyone.‰ENDM*+* Macro for dropping the H/W priority level * to zero.* UNMASKƒMACRO1‰MOVE.W„#$2000,SR‹Setprocessorprioritytozero.‰ENDM‰PAGE********************************* CHANNEL CONTROL BLOCK (CCB) *********************************B*ƒContainschanneldevicedependentdescriptionanddataareasfor*ƒI/Ohandler.*ŠOFFSET‚CCBDDP* '\0F89@-HHP<X9`9h;pFxK€7ˆ>/˜@ 8¨<°5¸=À8È3Ð<Ø5à=è>ðOø^QI9H* I/O HANDLER DATA AREA *************************************************CCBFLG„DS.B„2ŒFlags(CCBERAD1‚DS.B„4ŒErrordebugsaveaddress2CCBQVER1‚DS.B„4ŒEventqueueingerrordebugaddress7CCBCCB„DS.B„4ŒPhysicaladdressofcommandpacket(IOCB)CCBTASKB‚DS.B„4ŒBuffertaskTCB-CCBPKT„DS.B„18‹Eventworkarea(commandtour)0CCBCPKTƒDS.B„18‹Eventworkarea(interrupttour)(CCBPTR„DS.B„4ŒPhysicaladdressofbufferCCBLEN„DS.B„4ŒLengthofbuffer0CCBPTR1ƒDS.B„4ŒPhysicaladdressof2ndarybuffer&CCBLEN1ƒDS.B„4ŒLengthof2ndarybuffer*CCBCID„DS.B„4ŒCMRparameterblockid(DCB)CCBCOPTƒDS.B„2ŒIOCBoptions#CCBCFIGƒDS.B„$26ŠConfigurationdata**‰56bytesremain*9*‰CCBFLGDEFINITIONS:if‚CCBFLG.Bifnot0theRIOmodule$*fortheCCBcannotbeusedforthe*followingreasons:*9*‰CCBFLG.B=$FA=CCBallocationexceeded#ofspecified/*šdevices-noroominRIOtableforthemodule!*’=$FC=noRIOTBLwasallocated/*’=$F5=noroominRIOTBLforthisRIOmodule*™(incorrecttableallocation)**‰PAGE ‰SECTION8 ‰XREFRIOTBLJ******************************************************************************‚RIOSERVICEVECTORTABLE***L*****************************************************************************RIODVR:#*ˆDC.L†RIOINTŽinterruptsvcaddress!*ˆDC.L†RIOCMDŽcommandsvcaddress)*ˆDC.L†RIOINITinitializationsvcaddress**?*Below are the new offset form of service pointers, for new CMR**(‰DC.L†RIOINT-RIODVR†interruptsvcoffset*‰DC.L†RIOCMD-RIODVR†commandserviceoffset.‰DC.L†RIOINIT-RIODVR…initializationsvcoffset‰DC.L†0‰Reserved‰DC.B†0“numberofextrapages‰DC.B†0,0,0reserved‰DC.L†0,0,0reserved 3*ƒ---ƒ---…CONFIGURATIONCONTROLINFORMATION…---ƒ---ŠSPC1$‰DC.B…'032983'ƒdateoflastassembly'‰DC.B†''‡spacemeansnopatchesin.LO#‰DC.B†'4'‡majorVersadosrevision#‰PAGEJ****************************************************************************‰COMMANDTABLE&JUMPTABLE* :*‰Theseareusedbythecommandserviceroutinetojumpto.*‰theappropriateroutinetohandleacommand.*J***************************************************************************CMDTBL:ŠDC.WƒROPENŽOPENcommand.ŠDC.WƒRCLOSECLOSEcommand.ŠDC.WƒROUTONRELAYONcommand. ŠDC.WƒROUTOFFŒRELAYOFFcommand.ŠDC.WƒRSTATŽSTATUScommand.'ŠDC.WƒRENABLENABLEINTERRUPTScommand.(ŠDC.WƒRDSABLDISABLEINTERRUPTScommand."ŠDC.WƒRPLSOŽPULSEDOUTPUTcommand.=NUMCMDSƒEQU„(*-CMDTBL)/2‡Thenumberofcommandsinthetable.*9JMPTBL:ƒDC.WƒOPEN-*Biasestothecorrespondingroutines. ŠDC.WƒCLOSE-* ŠDC.WƒOUTON-*ŠDC.WƒOUTOFF-* ŠDC.WƒSTAT-*ŠDC.WƒENABLE-*ŠDC.WƒDSABLE-* ŠDC.WƒPLSO-**7JMPOFF„EQU„JMPTBL-CMDTBL†Offsetbetweenthetwotables.ŠPAGEJ****************************************************************************+*ˆRIODRIVERINITIALIZATIONSERVICEROUTINE*>*ˆThedriverisenteredhereforeachCCBallocated.‚Morethan:*ˆoneCCBmaybeallocatedforeachRIOmodule.‚OneCCBis>*ˆallocatedforeachinterruptleveltheboardisjumperedto.?*ˆThisroutinecheckstoseeifthereisroomintheRIOTBLfor=*ˆthedeviceID.‚ItsavesthedeviceIDandthememorymapped>*ˆI/OaddressofthedevicethetheRIOTBL.‚Itinitializesthe5*ˆinputPIAofthedeviceifnotalreadyinitialized.B*ˆThisroutinealsocheckstoseeiftheRIOLEDison,indicating<*ˆanI/Ochannelresetwasissuedorapower-up.Ifon,thisA*ˆroutineturnsitoff.Theon/offindicatorisbit#7ofTSTREG.*:*ˆAnerrorcodeissavedintheCCBifthisCCBallocation=*ˆexceedsthemaximumnumberofCCB'sspecifiedduringSYSGEN9*ˆ(SYSGENparameterNRIO),ifnoRIOTBLexistsornoroom*ˆinthetableforthismodule.*$*ˆEntry:‚allregistersareavailable*A5=CCBaddress*I**************************************************************************RIOINIT:ŠPUSHPOINT‘savepointers3ŠMOVE.LƒCCBCHB(A5),A0„getmemorymappedI/Oaddress$ŠMOVE.LRIOTBL,A1ŠgetRIOTBLaddressŠCMP.L‚#0,A1Žisthereone?&ŠBNE.S‚RIOINIT1‹branchifhaveatable8ŠMOVE.B#RIONTBL,CCBFLG(A5)setnotableerrorconditionŠBRARIOINEX1gotoerrorreturnRIOINIT5‚TST.L‚(A1,D3)Œlookforanentryslottosavethisguy5ŠBMI.S‚RIOINIT6‹branchifthisslotisempty-useit/ŠADD.W‚#PIALNG,D3‰notempty,bumptonextentry"ŠSUB.B‚#1,D4Ždecrementthecounter(ŠBNE.S‚RIOINIT5‹branchifmoretosearch4ŠBRA„RIOEXTER‹errorifgothere-noroomforthemap>RIOINIT6‚MOVE.LD2,(A1,D3)‰savethismemorymappedI/Oaddress*E*The input pia ios used exclusively for all input, and is initialized1* to all inputs and muist remain so for all time.*N*The output pia (PIA 2) is used exclusively for all output, and is initialized L*toallinputs.‚Onanychannelwhichisalloctedforoutput,onlytheoutputD*Piawillbesetforoutput.‚Whenthischannelisde-allocated,theH*correspondingoutputPIAbitmustbere-initializedforinput.‚FailureM* to follow this policy will result in impropper operation of input channels.*.ŠMOVE.L‚#0,D0write0toallpiacontrolreg'sŠBSR.SƒRIO.WCR‹doitBŠMOVE.B‚#0,PIA1ADR(A0)„clearalldatadirectionregs(setforinpu!ŠMOVE.B‚#0,PIA1BDR(A0)„clearnext!ŠMOVE.B‚#0,PIA2ADR(A0)„clearnext!ŠMOVE.B‚#0,PIA2BDR(A0)„clearlast2ŠMOVE.B‚#4,D0setcontrolregsfordataregaccess ,ŠBSR.SƒRIO.WCR‹writesaredonebysubroutine&ŠBSR.SƒRIO.CLR‹goclearallinterrupts **‰turnofftheLED*1RIOEXIT1‚CLR.B‚CCBFLG(A5)‰setforgoodallocation3ŠMOVE.LCCBCHB(A5),A1†getmemorymappedI/Oaddress,ŠMOVE.BTSTREG(A1),D1†readthetestregister$ŠBPL.S‚RIOINEX1‹returnifLEDisoff%ŠBCLRƒ#LEDSTA,D1‰cleartheLEDonbit&ŠMOVE.BD1,TSTREG(A1)†turntheLEDoff'RIOINEX1:POP_POINT‘recallallpointersŠRTS**‚SubroutinesusedbyRIOINIT:*DRIO.WCR‚EQU*ƒwritesdatainlsbyteofD0toallpiacontrolreg`s.‰MOVE.B‚D0,PIA1ACR(A0)‰MOVE.B‚D0,PIA1BCR(A0)‰MOVE.B‚D0,PIA2ACR(A0)‰MOVE.B‚D0,PIA2BCR(A0)‰RTS›endRIOWCR**RIO.CLRƒEQU*ƒclearanypendinginterrupts*‰MOVE.B‚PIA1ADR(A0),D0‰MOVE.B‚PIA1BDR(A0),D0‰MOVE.B‚PIA2ADR(A0),D0‰MOVE.B‚PIA2BDR(A0),D0‰RTS›endRIOCLRŠPAGEJ***************************************************************************$*‰RIODRIVERCOMMANDSERVICEROUTINE*6*‹PARAMETERADDRESSANDBOUNDARYCHECKSHAVEBEENMADE**ƒEntry:‚JSRFROMCMRHANDLER.*‹A2-PHYSICALADDRESSOFCMRPARAMETERBLOCK*‹A5-PHYSICALADDRESSOFCCB*5*ƒExit:‚RTS-PARAMETERBLOCKVALIDATIONSTATUSIND0**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A**P**PP*"*”A3=RIOPARAMETERBLOCKADDRESS*”A6=REQUESTORTCBADDRESS**ƒEXECROUTINESCALLED:‚QEVENTI**ƒCODEISRE-ENTRANT*****J***************************************************************************RIOCMD:*)*‰ConvertlogicalPBaddresstophysical.* ŠCLR.L‚D5;ŠMOVE.LXIOCPK(A2),D6†SetupaddressofRIOparameterblock:ŠMOVE.WXIOPLN(A2),D5†SetuplengthofRIOparameterblock+ŠMOVE.LCCBTASKA(A5),A1„SetupTCBpointer.&ŠBSR„IOHADRCK‹Callconversionroutine.ŠBRA.S‚CMD010Goodreturn.ŠNOP—Badlengthreturn. ŠCLR.L‚D0;ŠMOVE.B#RTCDPBLK,D0‡SetupinvalidparameterblockaddressŠBRARIOCEX2gotoerrorexit*!*‰seeifpassedtheinitializeok*CMD010„CLR.L‚D02ŠMOVE.LƒD6,A3ŒStagephys.addr.opfRIOpara.blk.4ŠTST.B‚CCBFLG(A5)‰errorcodesetinCCBduringINIT?/ŠBEQ.S‚CMD020branchifnoerrorcode,continue$ŠMOVE.BCCBFLG(A5),D0†seterrorcode%CMDSRTRƒBRA.S‚RIOCEX2Œgotoerrorexit CMD020„EQU**,*‰getRIOTBLaddressintoA4forcommanduse* ŠMOVE.LRIOTBL,A4ŠRIOTBLaddress)ŠCMP.L‚#'!RIO',(A4)‡reallyistheRIOTBL?,ŠBEQ.S‚CMD030branchifreallyistheRIOTBL4ŠMOVE.B#RIONTBL,D0ˆseterrorreturncode-notableŠBRA.S‚CMDSRTRŒandreturn**‰findRIO-IDinRIOTBL*‰A1=entryaddress*0CMD030„MOVE.LXIOCID(A2),D0†getspecifiedRIO-ID(ŠMOVE.BRIONMAX(A4),D1…max#ofRIO-ID's$ŠMOVE.L#RIONTRY,D2ˆbumppastheader"FNDRIO10‚CMP.L‚(A4,D2),D0‰amatch?!ŠBEQ.S‚FNDRIO20‹branchifamatch&ŠADD.W‚#RIOIDLNG,D2‡bumptonextentry1ŠSUB.L‚#1,D1Ždecrementnumberofentriestocheck&ŠBNE.S‚FNDRIO10‹branchifmoreentries.ŠMOVE.W#RIONID,D0‰error-RIO-IDnotintable3ŠBRA„CMDSRTRŒreturntoCMRwitherrorconditionset+FNDRIO20‚MOVE.LA4,A1ŽbassaddressoftableŠADD.L‚D2,A1Žaddressofentry*(*‰Findthecommandinthecommandtable.*-ŠMOVEQ‚#NUMCMDS-1,D0†Setuptheloopcounter./ŠLEA„CMDTBL,A0ŠA0<--addressofcommandtable.+ŠMOVE.WCMDCOD(A3),D6†getRIOcommandcode.8CMDSRCHƒCMP.W‚(A0)+,D6‹Searchthetableforthecommand.ŠDBEQƒD0,CMDSRCH‰*3ŠBNE.S‚CMDERRIfwefoundthecommandinthetable,8ŠADD.L‚#JMPOFF-2,A0‡getthecorrespondingentryfromthe 5ŠMOVE.W(A0),D0Œjumptableandjumptotheroutineto"ŠJMP„(A0,D0.W)Šhandlethecommand.DCMDERR„MOVE.B#RIOINVD,D1ˆdidn'tfindcommandcode-exitwitherrorŠSPC1RIOCEX2:;ŠMOVE.WƒD0,CMDSTA(A3)‡writeerrorcodetousersRIOparablRIOCEX1:ŠRTSŠPAGEL*****************************************************************************‰OPENCOMMANDA*‰Thiscommandassignsthelogicalconnectionbetweenausertask:*‰andspecifiedchannelswithinanRIOmodule.16channels?*‰maximummaybespecifiedinoneopencommand.InterruptlevelB*‰ofthechannelsaretakenfromtheCCB.Theinterruptslevelsof4*‰inputchannels0-7mustmatchthefollowingorder:-*‰channels0-1musthavesameinterruptlevel-*‰channels2-3musthavesameinterruptlevel-*‰channels4-5musthavesameinterruptlevel-*‰channels6-7musthavesameinterruptlevelD*‰Itisokforallthesechannelstohavethesameinterruptlevels.*#*‰RIOOPENcommand‚parameterblock: *DS.W‚1„returnedcommandstatus*DS.W‚1„commandcode(01)*DS.W‚1„#ofchannelstoopen*DS.W‚1„1stchannelnumber*DS.W‚1„channelconfiguration*’.*DS.W‚1„nthchannelnumber*DS.W‚1„channelconfiguration**‰configurationbyte:*bit0=1outputchannel*•=0inputchannel*bit1=1disableinterrupt*•=0enableinterrupt"*bit2=1interruptonrisingedge*•=0interruptonfallingedge)*bit3=1wake-uptaskoninputinterrupt,*•=0queueeventtotaskonintputinterrupt8*Œbits8-14=‚debounceinterval.‚0=nodebounce,otherwise-*˜debouncetimeisvaluetimes4milliseconds$*bit15=1usedefaultconfiguration *•=0usespecifiedconfiguration**‰Defaultconfiguration:*channels0-7’channels8-15*------------’-------------*inputchannel‘outputchannel*interruptenabled*interruptonfallingedge*queueeventoninterruptB*‰Whendefaultconfigurationisspecified,theactualconfiguation9*‰issavedinRIOTBL.ThetaskTCBaddressisalsosaved.*)*‚Entry:A1=addressofRIO-IDinRIOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofRIOparameterblock*‰A4=addressofRIOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:CLRPIAM,SETPIA,DOPIA*L**************************************************************************** PAGE*OPEN:*‰seeifchannelalreadyopened* ŠPUSHPOINT‘savealladdressregsŠALLOCATEƒCHCONFIG4ŠBSRCLRPIAMclear(to$FF)thePIAmapforthisRIOŠCLR.L‚D7‘channelcounter:ŠCMP.W‚#RIONID,D0‰anerrorreturnedfromclearingthemap?'ŠBEQ„OPNOIDbranchifanerrorreturned$ŠCLR.L‚D2‘channeloffsetintoRIOTBL)ŠCLR.L‚D1‘offsetintoRIOparameterblock1ŠMOVE.WCMDCHN(A3),D0†get#ofchannelsspecified-ŠBLE„OPNINCbranchifnegativeorzero,error2ŠCMP.W‚#16,D0cannotspecifymorethan16channels,ŠBGT„OPNINCbranchifgreaterthan16,errorGOPEN10„MOVE.WNUMCHAN(A3,D1),D2‚getchannelnumberfromRIOparam.blk.ŠMOVE.WD2,D5Žsaveit0ŠMULUƒ#CHANLNG,D2ˆgetchanneloffsetintoRIOTBLŠADD.L‚#4,D2ŽbumppastRIO-ID+ŠTST.W‚(A1,D2)Œthischannelalreadyopened?+ŠBPL„OPNOPNbranchifalreadyopened,errorŠADD.L‚#1,D7Žcountthischannel@ŠMOVE.WCHNCNFG(A3,D1),D3‚getconfigurationfromRIOparam.blk.-ŠSTORE„D3,CHCONFIG†savechannelconfiguration*ŠBMI.S‚OPEN60branchifdefaultsspecifiedŠBTSTƒ#0,D3Žoutputchannel?&ŠBNE.S‚OPEN70branchifoutputchannel**‰setthischannelforinput* ŠMOVE.WD3,D4Žsaveconfiguration"ŠCMP.B‚#8,D5Žseeifchannel#8-153ŠBGE.S‚OPEN50branchifchannel8-15,nointerrupts3ŠMOVE.BCCBPPRIO(A5),D4„getintrruptlevelfromCCBŠASL.L‚#4,D4Žgetintobits4-6$ŠOR.WƒD4,D3Žsavetheinterruptlevel*6*‰checktoseethatinterruptlevelsofchannelsmatch*,OPEN20„MOVE.BD5,D6ŽsavethischannelnumberŠBTSTƒ#0,D5Žoddchannel?*ŠBNE.S‚OPEN30branchifoddchannelnumber*ŠADD.B‚#1,D6Ževen-getchannelnumber+1ŠBRA.S‚OPEN40andcontinue/OPEN30„SUB.B‚#1,D6Žodd-getchannelnumber-15OPEN40„MULUƒ#CHANLNG,D6ˆgetchanneloffsetintotable ŠADD.L‚#4,D6ŽbumppastRIO-ID#ŠTST.W‚(A1,D6)Œthischannelopened?"ŠBMI.S‚OPEN50branchifnotopened9ŠMOVE.WRIOCNIF(A1,D6),D6‚getotherchannelconfigurationŠSPC2ŠBTSTƒ#0,D6Žaninputchannel?,ŠBNE.S‚OPEN50branchifnotaninputchannel$ŠASR.L‚#4,D6Žgetintoloworderbits**‰goodconfiguration0*‰saveTCBaddressandconfigurationinformation* OPEN50„EQU†*.ŠLOAD…D3,CHCONFIG†recallchannelconfiguration+ŠBSR„SETPIAgosetPIAmapforthischannel5ŠCMP.W‚#RIONID,D0‰anerrorfoundduringthesavemap?*ŠBEQ.S‚OPNERRbranchifanerrorwasfound6ŠMOVE.WD3,RIOCNIF(A1,D2)‚saveconfigurationinRIOTBL)ŠMOVE.LA6,RIOTCB(A1,D2)ƒsaveTCBaddress4ŠADD.W‚#OPNTRY,D1‰bumptonextRIOparam.blk.entry3ŠSUB.W‚#1,D0Ždecrementnumberofchannelsspecified)ŠBGT„OPEN10branchifmorechannelstodo,ŠBSR„DOPIAŽgosetthePIAhardwareregisters!ŠCMP.W‚#RIONID,D0‰anerrorfound?7ŠBEQ.S‚OPNERRbranchifanerrorwasfound-don'topenŠCLR.L‚D0‘setforgoodreturnŠBRA.S‚OPNXITgoreturntoCMR**‰defaultconfigurationset*%OPEN60„CMP.W‚#7,D5Žseeifchannel0-7!ŠBLE.S‚OPEN80branchifmaybe0-7!ŠCMP.W‚#16,D5seeifchannel8-16-ŠBGT.S‚OPNCNŽbranchifgreaterthan16,error**‰outputchannel*,OPEN70„MOVE.W#1,D3ŽsetoutputconfigurationŠBRA.S‚OPEN50gosaveit**‰inputconfigurationspecified*-OPEN80„TST.W‚D5‘mustbechannel#0orgreater)ŠBLT.S‚OPNCNŽbranchiflessthan0,errorŠCLR.W‚D3‘setfordefaults/ŠMOVE.BCCBPPRIO(A5),D3„getCCBinterruptlevelŠASL.L‚#4,D3Žputintobits4-6ŠBRA.S‚OPEN20gosaveit**‰openerrorshere*;OPNINT„MOVE.W#RIOIINT,D0ˆsetinvalidinterruptlevelerror.ŠBRA.S‚OPNERRgo'de-open'anyopenedchannels>OPNCN…MOVE.W#RIOICNS,D0ˆsetillegalchannel#specifiederror.ŠBRA.S‚OPNERRgo'de-open'anyopenedchannels8OPNINC„MOVE.W#RIOINC,D0‰setinvalid#ofchannelserrorŠBRA.S„OPNXIT‹exit;OPNOID„MOVE.W#RIONID,D0‰setRIOmodulenotallocatederrorŠBRA.S‚OPNXITgoreturntoCMR9OPNOPN„MOVE.W#RIOPND,D0‰setchannelalreadyopenederror*)*‰resetanyopenedchannelstonotopened*%OPNERR„TST.W‚D7‘anychannelstoundo?3ŠBEQ.S‚OPNXITbranchifnonetoundo,returntoCMR&ŠMOVE.W#$FFFF,D3Šset'un-opened'codeŠCLR.L‚D1‘clearforuse6OPNERR10‚MOVE.WNUMCHAN(A3,D1),D2‚getachannelnumber$ŠMULUƒ#CHANLNG,D2ˆgetchanneloffsetŠADD.L‚#4,D2Žbumppastheaders*ŠMOVE.WD3,(A1,D2)‰setthisentryunopened-ŠADD.W‚#OPNTRY,D1‰bumptonextchannelnumberŠSUB.W‚#1,D7Ždecrementcounter&ŠBGT.S‚OPNERR10‹branchifmoretoundo** Fall into exit* OPNXIT EQU * ŠADD.L„#8,A7ŒdeallocateCHCONFIGŠPOP_POINT‘restoreallpointers ŠBRANRMEXITŠPAGEK*****************************************************************************‰SETPIA*7*‰BuildthePIAmapentriesforthespecifiedchannels.*‰Builds1entrypercall*‰MapisinRIOTBL.**‰Entry:A4ƒ=RIOTBLaddress*D3.W=channelconfiguration*D5.B=channelnumber*7*‰Exit:‚D0.W=RIONIDifmapentrynotfound,otherwise*—D0unchanged *‰Uses:D4,D6*‰Entrypoint=SETPIA*‰Exitpoint‚=SETPIART**L******************************************************************************‰findmapentry* SETPIA EQU *ŠPUSHPOINT‘saveallpointersŠMOVE.LD7,-(A7)‹saveD75ŠMOVE.WRIOPIA(A4),D7†getoffsettostartofPIAmaps.ŠMOVE.BRIONAL(A4),D6†get#ofRIO'Sallocated3ŠMOVE.LCCBCHB(A5),D4†getmemorymappedI/Oaddress=SETPIAFD‚CMP.L‚PIADDR(A4,D7),D4ƒfindthematchingI/OaddressŠBEQ.S‚SETPIA00‹branchiffound$ŠADD.W‚#PIALNG,D7‰bumptonextentryŠSUB.B‚#1,D6Ždecrementcounter0ŠBNE.S‚SETPIAFD‹branchifmoreentriestosearch>ŠMOVE.W#RIONID,D0‰setforfatalerror-thisshouldn'thappen ŠBRA.S„SETPIART‰returntocaller**‰determinechannelnumber*SETPIA00‚CLR.L‚D6‘clearforuse/ŠMOVE.BD5,D6ŽcopychannelnumbertoworkspaceŠCMP.B‚#7,D5Žchannel0-7?ŠBLE.S‚SETPIA20‹branchif0-7**‰channel8-15*/ŠSUB.B‚#8,D6Žgetbit#offsetofchannelnumber ŠBTSTƒ#0,D3Žanoutputchannel?0ŠBNE.S‚SETPIA10‹branchifyes,anoutputchannel**‰channel8-15asinputchannel*%ŠBCLRƒD6,DODR815(A4,D7)‚setforinput ŠBRA.S‚SETPIART‹returntocaller* *‰channel8-15asoutputchannel*SETPIA10 EQU *0ŠBSET…D6,DODR815(A4,D7)ƒsetddrimageforoutput ŠBRA.S‚SETPIART‹returntocaller* *‰channel0-7*%SETPIA20‚BTSTƒ#0,D3Žaninputchannel?,ŠBEQ.S‚SETPIA30‹branchifyes,inputchannel**‰CHANNEL0-7asoutputchannel*/ŠBSETƒD5,DODR07(A4,D7)ƒsetddrimageforoutput#SETPIART‚MOVE.L(A7)+,D7‹restoreD7ŠPOP_POINT‘restoreallpointersŠRTS—returntocaller**‰channel0-7asinputchannel*SETPIA30‚EQU*$ŠBCLRƒD5,DODR07(A4,D7)ƒsetforinput1ŠBSR„NEWSETPŒinitPIAcontrolregsforinterrupts ŠBRA†SETPIARTŠPAGED********************************************************************&*ˆNEWSETPisinterruptsetupforPIA's&*ˆNEWSETPinitializesonePIApercall** Private subroutine for SETPIA** Table driven pia setup::*‚PIAICMSK‚isatableofPIAinterruptcontrolmaskwords.N*‚TheLSbyteisAND'edwithmapentry,andtheMSbyteisOR'dwithmapentry‰SPC3PIAICMSK EQU *-‰DC.W†$05FD…enablefallingirqonevenport#‰DC.W†$04FE…disableeven‰DC.W†$07FF…enablerising‰even‰DC.W†$04FE…disableevenA*----------------------------------------------------------------‰DC.W†$0CEF…enablefallingˆodd‰DC.W†$04F7…disableodd‰DC.W†$1CFF…enablerising‰odd‰DC.W†$04F7…disableoddŠSPC3)PIAMGOFFEQU*‚IRQcontrolimageoffsets:‰DC.B†2‰DC.B†3‰DC.B†0‰DC.B†1‰SPC3NEWSETP:ŠSPC1L*Generate index into table of interrupt control masks based on configuration * and even / odd channel number:(*Configurations are between 00X and 11X.**On entry (data input:)%*ˆD3.W‚containschannelconfiguration*ˆD5.B‚containschannelnumber%*ˆD7„containsoffsettoPIAmapstart**‰PUSHALL–saveall ‰CLR.L…D0/‰MOVE.B„D3,D0…getIRQconfig.toworkingregD0+‰AND.B…#$0004,D0‚selectIRQconfigdatabit‰TST.B…D0ˆsetupforbranches7‰BMI.S…SETPIA33‚branchondefaultconfigurationrequest8‰BEQ.S…SETPIA32‚branchonfallingedgeirqconfiguration‰CMP.B…#4,D0…risingedgeirq?7‰BEQ.S…SETPIA32‚branchonrisingedgeirqconfiguration1‰MOVE.L„#2,D0…onallotherconfig.'s,disableirq6SETPIA32ƒEQU‚*ƒnowdetermineeven/oddchannelnumber"‰BTST†#0,D5…evenoroddchannel#?(‰BEQ.S…SETPIA31‚branchonevenchannel#"‰ADD‡#8,D0…add8foroddchannel##SETPIA31ŠEQU*…rejoinmainsequence ‰CLR.L…D18‰MOVE.W„PIAICMSK(PC,D0),D1‚fetchcontrolwordfromtable)‰MOVE.L„D3,D0…getnewcopyofconfigdata5‰AND.L…#$00000008,D0‚selectwakeup/queeventdatabit ‰MOVE.L„#21,D4„setupshiftcount2‰LSL.L…D4,D0„positionwakeup/queventbitinbit24‰SPC1)‰AND.L…#$0000FF00,D3‡selectdebouncedata1‰LSL.L…#8,D3…positiondebouncedatainbits16-23‰OR.L†D3,D1…adddebouncedata-‰OR.L†D0,D1…addwakeup/queventdataatbit248‰BSR‡WRITMAPƒwritetheinterruptcontroldatatoPIAmap7SETPIA33‚EQU‚*‚branchherefornochangeinirqsetting‰POPALL˜restoreregistervalues‰RTS‰PAGEWRITMAP:#*ˆWritesinterruptdatatoPIAmap.*ˆInputparameterstoWRITMAP:*ˆD5ƒchannel# *ˆD7ƒoffsettostartofPIAmaps$*ˆA4ƒRIOTBLaddressforcurrentuser;*ˆD1.LPIAcontrolmaskword(bits16-23aredebouncedata)!*¤(bit24iswakeup/queventbit).*>*ˆTranslateschannelnumbertoPIAregisterimagemapaddress,4*ˆthenmodifysthemapimagebasedondatainD1.L.2*ˆNowtranslatechannelnumberintoPIAmapoffset* ‰CLR.L…D0/‰MOVE.B„D5,D0…putchannel#intoworkingregD0"‰LSR.B…#1,D0…dividechannel#by2*;*‡PIAchannelindexnowinD0;nowaddoffsetfromPIAMGOFF*‡(piaimageoffsettable)*;‰ADD.B…PIAMGOFF(PC,D0),D7‚addoffsettochannelIRQcontrol$‰ADD.B…#8,D7…bumptoregisterimages**ˆD7containsoffsettoPIAmap*.‰AND.B…D1,(A4,D7)‚modifyPIAcontrolregimage0‰LSR.L…#8,D1…bringORbyteintoworkingposition -‰OR.B†D1,(A4,D7)‚modifyPIAcontrolregimage.‰LSR.L…#8,D1…bringdebouncedataintoposition/‰OR.B†D1,-1(A4,D7)‚adddebouncedatatoPIAmap*‰LSR.L…#1,D1‡bringwakeup/quebittobit7(‰AND.B…#$80,D1Šselectwakeup/queventbit.‰OR.B†D1,(A4,D7)„addwakeup/quebittoPIAmap‰RTS‰PAGED*********************************************************************:*‰DOPIA‚Copytheinterruptcontroldataanddatadirection3*informationfromthePIAregisterimages(inmap)*tothePIAregisters.*A*‚ThePIAmustnotbeallowedtogenerateaninterruptduringtheE*‚initializationprocessbecausetheCMRandRIOtableshavenotbeen@*‚setup.‚Toenforcethis,allinteruptsaredisabledduringthe@*‚codesectionwherethePIAcontrolreg.'sareset,andthePIA*‚interruptflagsarecleared.**ˆENTRYPARAMETERS:*A4=addressofRIOTBL*A5=addressofCCB***‰Exit:‚D0.W=RIONIDifPIAmapnotfound*D0.W=0ifnoerrorsfound**‰Uses:A0,D1,D6,D7**D*********************************************************************;*‚CLRIRQisanANDmaskusedtoclearPIAIRQcontrolbits.*"CLRIRQƒEQU‡$E4‡clearsbits0,1,3,4*** DOPIA EQU *ŠPUSHPOINT’saveallpointers!ŠMOVE.LD7,-(A7)‹saveregisterD7,ŠMOVE.WRIOPIA(A4),D7†getoffsettoPIAmaps$ŠMOVE.BRIONAL(A4),D6†get#ofRIO'S3ŠMOVE.LCCBCHB(A5),D1†getmemorymappedI/Oaddress>DOPIA10ƒCMP.L‚PIADDR(A4,D7),D1ƒlookforamatching‚I/Oaddress(ŠBEQ.S‚DOPIA20Œbranchiffoundtheentry(ŠADD.W‚#PIALNG,D7‰bumptonextmapentry"ŠSUB.B‚#1,D6Ždecrementthecounter/ŠBNE.S‚DOPIA10Œbranchifmoreentriestosearch9ŠMOVE.W#RIONID,D0‰setforfatalerror(shouldn'thappen) ŠBRADOPIAXbranchtoexitpoint**‰D7containsoffsettoPIAmap(*‰setdirectionregisterofchannels0-7**ˆMASKALLINTERRUPTS* DOPIA20 EQU *0ŠMOVE.WƒSR,D6Œsavepresentinterruptmaskstatus!ŠOR‡#$0700,SRˆmaskallinterrupts***‰Setdirectionregisterforchannel0-73*‰NewlycreatedOUTPUTchannelsmustbesettoOFF.4*‰Todothis,ORnewchannelsbitmapwithdatareg.<*‰(thereislogicalinversion)betweenPIAandfinaloutput.*ŠCLR†D2foruseŠCLR†D1foruse6ŠMOVE.LPIADDR(A4,D7),A0ƒgetmemorymappedI/Oaddress,ŠBSET…#2,PIA2ADR(A0)ƒsetfordataregaccess-ŠMOVE.BƒPIA2ADR(A0),D4ƒgetolddataregvalue+ŠNOT†D4convertdataformattoconventional'ŠBCLR…#2,PIA2ACR(A0)ƒsetforDDRaccess;ŠMOVE.BƒPIA2ADR(A0),D2ƒgetacopyofolddatadirectionreg-ŠAND†D2,D4ŒselectonchannelsthatareoutputŠNOT†D24ŠMOVE.BƒDODR07(A4,D7),D1„getthenewoutputchannelsŠAND†D2,D1Œfindnewchannels:ŠMOVE.BPIA2ADR(A0),D0…readchannel0-7directionregister9ŠOR.BƒDODR07(A4,D7),D0ƒaddinthenewsettinginformation8ŠMOVE.BD0,PIA2ADR(A0)…storeintothedirectionregister,ŠBSETƒ#2,PIA2ACR(A0)…setforoutputfunction4ŠOR.B„D1,PIA2ADR(A0)„setnewOUTPUTchannelsforOFF'ŠNOT…D4converttoinverteddataformat/ŠAND.B„D4,PIA2ADR(A0)ƒaddinolddataregvalue*-*‰Setdirectionregisterforchannels8-16.*>*‰NewlycreatedOUTPUTchannelsmustbesetOFF.‚Todothis,OR>*‰newchannelsbitmaskwithdataregister(thereisalogical3*‰inversionbetweenPIAoutputsandfinaloutputs).*ŠCLR†D2foruseŠCLR†D1foruse,ŠBSET…#2,PIA2BDR(A0)ƒsetfordataregaccess-ŠMOVE.BƒPIA2BDR(A0),D4†getolddataregvalue+ŠNOT†D4convertdatatoconventionalformat'ŠBCLR…#2,PIA2BCR(A0)†setforDDRaccess7ŠMOVE.BƒPIA2BDR(A0),D2†getacopyofolddirectionreg.-ŠAND†D2,D4ŒselectonchannelsthatareoutputŠNOT†D20ŠMOVE.BƒDODR815(A4,D7),D1ƒgetnewdirectionreg.%ŠAND†D2,D1Œselectnewoutputchannels;ŠMOVE.BPIA2BDR(A0),D0…readchannel8-15directionregister:ŠOR.BƒDODR815(A4,D7),D0‚addinthenewsettinginformation8ŠMOVE.BD0,PIA2BDR(A0)…storeintothedirectionregister,ŠBSETƒ#2,PIA2BCR(A0)…setforoutputfunction0ŠOR.BƒD1,PIA2BDR(A0)…setnewoutputchannelsoff'ŠNOT†D4convertdatatoinvertedformat 1ŠAND.B„D4,PIA2BDR(A0)ƒreplaceolddataregvalues **ˆClearallPIAinterrupts*‰TST.B…PIA1ADR(A0)‰clearPIA1A‰TST.B…PIA1BDR(A0)‰clearPIA1B‰TST.B…PIA2ADR(A0)‰clearPIA2A‰TST.B…PIA2BDR(A0)‰clearPIA2B*#* Set channels 4-5 IRQ control bits*6ŠMOVE.BPIA2ACR(A0),D0…get0-7outputcontrolregister)ŠAND.B„#CLRIRQ,D0‡negateIRQcontrolbits;ŠOR.BƒOCR07(A4,D7),D0„addchannel4-5interruptinformation*ŠMOVE.BD0,PIA2ACR(A0)…writethenewstuff*,*‰setinterruptinformationforchannels6-7*<ŠMOVE.BPIA2BCR(A0),D0…getchan8-15outputcontrolregister(ŠAND.B„#CLRIRQ,D0‡clearIRQcontrolbits<ŠOR.BƒOCR815(A4,D7),D0ƒsetchannel6-7interruptinformation*ŠMOVE.BD0,PIA2BCR(A0)…writethenewstuff*,*‰setinterruptinformationforchannels0-1*:ŠMOVE.BPIA1ACR(A0),D0…getchan0-7inputcontrolregister(ŠAND.B„#CLRIRQ,D0‡clearIRQcontrolbits;ŠOR.BƒICR07(A4,D7),D0„setchannel0-1interruptinformation*ŠMOVE.BD0,PIA1ACR(A0)…writethenewstuff*,*‰setinterruptinformationforchannels2-3*>ŠMOVE.BPIA1BCR(A0),D0…getchannel8-15inputcontrolregister(ŠAND.B„#CLRIRQ,D0‡clearIRQcontrolbits<ŠOR.BƒICR815(A4,D7),D0ƒsetchannel2-3interruptinformation*ŠMOVE.BD0,PIA1BCR(A0)…writethenewstuffŠCLR.L‚D0‘setforgoodreturn**ˆrestoreinterruptlevel*6ŠMOVE.WƒD6,SRŒreturninterruptmaskstopreviousvalueDOPIAXEQU*˜exitsequenceŠMOVE.Lƒ(A7)+,D7‰restoreD7ŠPOP_POINT‘recallallpointersŠRTS—returntocallerŠPAGEL*****************************************************************************6*‰CLRPIAMƒClearoutthePIAmapforthismemorymapped*“I/Oaddress.*&*‰Entry:A1=RIO-IDaddressinRIOTBL%*A2=addressofCMRparameterblock%*A3=addressofRIOparameterblock*A4=addressofRIOTBL*A5=addressofCCB*A6=addressofusersTCB**‰Uses:‚D4,D6,D7*%*‰Exit:‚D0=RIONIDifanerrorfound**D0=contentsonentryifnoerrorfound*L*****************************************************************************3CLRPIAMƒMOVE.WRIOPIA(A4),D7†getoffsettoPIAmaps.ŠMOVE.BRIONAL(A4),D6†get#ofRIO'Sallocated3ŠMOVE.LCCBCHB(A5),D4†getmemorymappedI/OaddressDCLRPIAM1‚CMP.L‚PIADDR(A4,D7),D4ƒlookformatchingmem.map.I/OaddrŠBEQ.S‚CLRPIAM2‹branchiffound$ŠADD.W‚#PIALNG,D7‰bumptonextentryŠSUB.B‚#1,D6Ždecrementcounter0ŠBNE.S‚CLRPIAM1‹branchifmoreentriestosearch#ŠMOVE.W#RIONID,D0‰seterrorreturnŠRTS—returntocaller*CLRPIAM2‚CLR.L‚DODR07(A4,D7)†clearthemap ŠCLR.L‚OCR07(A4,D7)‡andtherestŠRTS—returntocallerŠPAGEL******************************************************************************‚CLOSECOMMAND*A*‚CloseallconnectionswiththisusertaskandhisopenchannelsB*‚forthisRIOmodule.Thechannelsareputbacktothepre-opened4*‚state.AllI/Oonthisuser'schannelsisstopped.*$*‚RIOCLOSECOMMANDparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode02*)*‚Entry:A1=addressofRIO-IDinRIOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofRIOparameterblock*‰A4=addressofRIOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:STOPPIA*L*****************************************************************************CLOSE:+ŠMOVE.L#4,D1ŽbumppastRIO-IDinthetable!ŠCLR.L‚D2‘useforchannelcounter5CLOSE10ƒCMP.L‚RIOTCB(A1,D1),A6ƒchannelforthisuser?*ŠBNE.S‚CLOSE20Œbranchifnotforthisuser3ŠMOVE.WRIOCNIF(A1,D1),D0‚getchannelconfiguration4ŠBSR„STOPPIAŒgostopI/OonthischannelD2=chan#?ŠMOVE.W#$FFFF,RIOTCB(A1,D1)setthischannelentrytonotused5CLOSE20ƒADD.L‚#CHANLNG,D1ˆpointtonextchannelentryŠADD.L‚#1,D2Žcountthischannel$ŠCMP.L‚#16,D2searchedallchannels?&ŠBNE.S‚CLOSE10ŒbranchifmorechannelsŠCLR.L‚D0‘setfornoerrorsŠBRA„NRMEXITŒandreturntoCMRŠPAGED********************************************************************* 4*‚STOPPIAƒdeactivateI/Oonspecifiedchannelnumber*&*‚Entry:A1=RIO-IDaddressinRIOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofRIOparameterblock*‰A4=addressofRIOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‰D0.W=channelconfiguration%*‰D2.L=channelnumbertodeactivate* *‚Uses:‚D0,A0*L*****************************************************************************:STOPPIAƒMOVE.LCCBCHB(A5),A0†getmemorymappedI/OaddressŠCMP.B‚#8,D2Žchannel8-15?&ŠBGE.S‚STOPIA60‹branchifchannel8-15* *‰channel0-7*5ŠBCLRƒ#2,PIA2ACR(A0)…selectoutputdirectionregister/ŠBCLRƒD2,PIA2ADR(A0)…setthischannelforinput0ŠBSETƒ#2,PIA2ACR(A0)…selectoutputdataregister,ŠBCLRƒD2,PIA2ADR(A0)…deactivatethischannelŠBTSTƒ#0,D0Žinputchannel?,ŠBNE.S‚STOPIART‹branchifno,outputchannel*/*‰inputchannel-determineifusinginterrupts* ŠBTSTƒ#1,D0Žinterruptsdisabled?"ŠBNE.S‚STOPIART‹branchifdisabled-ŠBTSTƒ#0,D2Žseeifoddorevenchannelnumber,ŠBNE.S‚STOPIA10‹branchifoddchannelnumber7ŠMOVE.B#1,D0Ževenchan-disableinterruptsbit#is0ŠBRA.S‚STOPIA20‹andcontinue>STOPIA10MOVE.B#4,D0oddchan-disableinterruptsbit#is3.STOPIA20CMP.B‚#1,D2getactualchannelnumber)ŠBGT.S‚STOPIA30‹branchifnotchannel0-15ŠBCLRƒD0,PIA1ACR(A0)…disableinterrupts-channel0-1STOPIART‚RTS—returntocaller.STOPIA30‚CMP.B‚#3,D2Žseeifchannelnumber2-3!ŠBGT.S‚STOPIA40‹branchifnot2-33ŠBCLRƒD0,PIA1BCR(A0)…disableinterruptschannel2-3ŠBRA.S‚STOPIART‹andreturn.STOPIA40‚CMP.B‚#5,D2Žseeifchannelnumber4-5!ŠBGT.S‚STOPIA50‹branchifnot4-53ŠBCLRƒD0,PIA2ACR(A0)…disableinterruptschannel4-5ŠBRA.S‚STOPIART‹andreturn;STOPIA50‚BCLRƒD0,PIA2BCR(A0)…disableinterruptschannel6-7ŠBRA.S‚STOPIART‹andreturnŠPAGE**‰channel8-15*(STOPIA60‚MOVE.LD2,D0Žgetchannelnumber!ŠSUB.L‚#8,D0Žmake0-7typenumber5ŠBCLRƒ#2,PIA2BCR(A0)…selectoutputdirectionregister"ŠBCLRƒD0,PIA2BDR(A0)…setforinput0ŠBSETƒ#2,PIA2BCR(A0)…selectoutputdataregister,ŠBCLRƒD0,PIA2BDR(A0)…deactivatethischannelŠRTS—returntocallerŠPAGEF************************************************************************‰OUTON-TURNONRELAYCOMMAND;*‰Thiscommandactivatesrelaysforspecifiedchannelsthat9*‰havepreviouslybeenopenedforoutputbythesametask<*‰requestingthisactivation.‚Theparameterblockischecked9*‰forerrorsbeforeanyrelayisactivated.‚Nochannelis!*‰activatedifanerrorisfound.9*‰AllchannelswithinaPIAareactivatedsumultaneously.>*‰Outonreadsthepiadataregistertofindthecurrentstate.*%*‰RIOOUTPUTcommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode034*‰DS.Wƒ1ƒbitmaskcontainingchannel#'stoactivate*)*‚Entry:A1=addressofRIO-IDinRIOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofRIOparameterblock*‰A4=addressofRIOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:DOOUT**L*****************************************************************************OUTON:ŠPUSHPOINT‘saveallpointers3ŠCLR.L‚D3‘flagtockpara.blk.beforedoingoutput.OUTON10ƒMOVE.L#4,D1ŽbumppastRIO-IDintable!ŠCLR.L‚D2‘useforchannelcounterŠCLR.L‚D0‘clearforuse+ŠMOVE.WCMDCHN(A3),D0†getchannelstostart8ŠMOVE.WƒCMDCHN(A3),D3„copyONrequesttocheckregister.)OUTON20ƒBTSTƒD2,D0Žactivatethischannel?0ŠBEQ.S‚OUTON30Œbranchifno-checknextchannel5ŠCMP.L‚RIOTCB(A1,D1),A6ƒchannelbelongetothisuser?"ŠBNE.S‚OUTONERŒbranchifno,error3ŠMOVE.WRIOCNIF(A1,D1),D4‚getchannelconfigurationŠBTST‚#0,D4anoutputchannel?+ŠBEQ.S‚OUTONER1‹branchifnotoutput,error.ŠBCLRƒD2,D3Žnegatecheckflagforthischannel$ŠTST„D3‘isallofparameterchecked?(ŠBNE.S‚OUTON30Œbranchifnotallchecked5ŠBSR„DOOUTŽgoodparameterblock-goactivatechannelŠBRA.S‚OUTONEXŒnormalexit/OUTON30ƒADD.L‚#1,D2Žbumptonextchannelnumber -ŠADD.L‚#CHANLNG,D1ˆbumptonextchannelentry'ŠCMP.L‚#16,D2checkedallthechannels?/ŠBNE.S‚OUTON20Œbranchifmorechannelstocheck*<*Fall into invalid command for error return (error in OUTON)*AOUTONERƒMOVE.W#RIOICU,D0‰setinvalidcommandforthisusererrorŠBRA.S‚OUTONRTŒandreturn?OUTONER1‚MOVE.W#RIOICC,D0‰setinvalidcommandforthischannelŠBRA.S‚OUTONRTŒandreturn$OUTONEXƒCLR.L‚D0‘setforgoodreturn%OUTONRTƒPOP_POINT‘recallallpointersŠBRA„NRMEXITŒgoreturntoCMR‰PAGE** DOOUT…EQU„***A*DOOUT talks directly to the PIA data reg.s and turns on outputs.**‰OnentrytoDOOUT:8*‰D0contains(16bit)bitmaskfordesiredONchannels.<*‰A5containsaddressofCCBfromwhichI/Obaseaddrisob.*-“MOVE.L„A2,-(A7)ŒsaveaddressofCMRparablk*“MOVE.L„CCBCHB(A5),A2‡getI/Obaseaddress#“NOT‡D0’logicinversioninRIOckts*“AND.B…D0,PIA2ADR(A2)†turnonchannels0-7%“LSR.W…#8,D0selectdataforch.8-15+“AND.B…D0,PIA2BDR(A2)†turnonchannels8-15-“MOVE.L„(A7)+,A2ŒrestoreaddrofCMRparablk“RTS‰PAGEM******************************************************************************"*‰OUTOFF-TURNOFFRELAYSCOMMAND=*‰Thiscommanddeactivatesrelaysforspecifiedchannelsthat9*‰havepreviouslybeenopenedforoutputbythesametask<*‰requestingthisactivation.‚Theparameterblockischecked;*‰forerrorsbeforeanyrelayisdeactivated.‚Nochannelis#*‰deactivatedifanerrorisfound.*)*‰RIOOUTPUTOFFcommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode044*‰DS.Wƒ1ƒbitmaskcontainingchannel#'stoactivate*)*‚Entry:A1=addressofRIO-IDinRIOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofRIOparameterblock*‰A4=addressofRIOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:DOOFF*L*****************************************************************************OUTOFF:ŠPUSHPOINT‘saveallpointers2ŠCLR.L‚D3‘flagtockpara.blk.beforestopoutput.OUTOF10ƒMOVE.L#4,D1ŽbumppastRIO-IDintable!ŠCLR.L‚D2‘useforchannelcounterŠCLR.L‚D0‘clearforuse+ŠMOVE.WCMDCHN(A3),D0†getchannelstostart0ŠMOVE.WƒD0,D3Œcopychan.toturnofftoworkreg+OUTOF20ƒBTSTƒD2,D0Ždeactivatethischannel?0ŠBEQ.S‚OUTOF30Œbranchifno-checknextchannel5ŠCMP.L‚RIOTCB(A1,D1),A6ƒchannelbelongstothisuser? ŠBNE„OUTONERŒbranchifno,error3ŠMOVE.WRIOCNIF(A1,D1),D4‚getchannelconfigurationŠBTST‚#0,D4anoutputchannel?)ŠBEQ„OUTONER1‹branchifnotoutput,error.ŠBCLR…D2,D3Œnegatecheckflagforthischannel$ŠTST„D3‘isallofparameterchecked?(ŠBNE.S‚OUTOF30Œbranchifnotallchecked3ŠBSR„DOOFFŽgoodpara.block-godeactivatechannelŠBRA.S„OUTOFFXŠnormalexit/OUTOF30ƒADD.L‚#1,D2Žbumptonextchannelnumber-ŠADD.L‚#CHANLNG,D1ˆbumptonextchannelentry'ŠCMP.L‚#16,D2checkedallthechannels?/ŠBNE.S‚OUTOF20Œbranchifmorechannelstocheck ŠBRA†OUTONEROUTOFFXEQU*šnormalexitŠPOP_POINT‘recallallpointersŠCLR.L„D0signalnoerrorsŠBRANRMEXITnormalexit‰PAGE*** DOOFF…EQU**B*DOOFF‚talksdirectlytothePIAoutputregsandturnsoffoutputs*G* On entry: D0 has bit map of channels to turn off (a 1 means turn off)*‹A5hasaddressofuserCCB*:*‰DOOFFiscalledbyOUTOFFandpulsedoutputdeactivation*/ŠMOVE.LƒA2,-(A7)ŒsaveaddressofCMRparablock3ŠMOVE.LƒCCBCHB(A5),A2‡getmemorymappedI/Oaddress*D*‚ThereisalogicalinversionbetweenPIAoutputsandfinaloutputs**ŠOR.B…D0,PIA2ADR(A2)†turnoffselected0-71ŠLSR.W„#8,D0selectinformationforchannels8-15+ŠOR.B…D0,PIA2BDR(A2)†turnoffselected8-152ŠMOVE.Lƒ(A7)+,A2ŒrestoreaddressofCMRparablockŠRTSŠPAGEM******************************************************************************!*‰STAT-GETINPUTSTATUSCOMMAND;*‰Thiscommandreadsthestatusofspecifiedinputchannels=*‰thatdonothaveinterruptsenabled.‚Thechannelsmusthave >*‰previouslybeenopenedforinputbythisuser.‚Theparameter>*‰blockischeckedforerrorsbeforeanyinputstatusisread.A*‰Theusersparameterblockismodifiedtosignalactivechannels<*‰bysettingthecorrespondingbitinthebit-maskword.The;*‰correspondingbitnumberofinactivechannelsiscleared.**.*‰AllchannelsinaPIAsidearereadatonce.*+*‰RIOINPUTSTATUScommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode05<*‰DS.Wƒ1ƒbitmaskcontainingchannelsnumberstoreadstatus$*”(thisisalsothereturnedfield)*)*‚Entry:A1=addressofRIO-IDinRIOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofRIOparameterblock*‰A4=addressofRIOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:GTSTAT*M******************************************************************************STAT:ŠPUSHPOINT‘saveallpointers(ŠCLR.L‚D5‘useforreturnedstatusvalues2ŠCLR.L‚D3‘flagtockpara.blk.beforereadstatus.STAT10„MOVE.L#4,D1ŽbumppastRIO-IDinRIOTBLŠCLR.L‚D2‘channelcounterŠCLR.L‚D0‘clearforuse;ŠMOVE.WCMDCHN(A3),D0†getchannelnumberstoreadstatuson3ŠMOVE.WD0,D3Žcopychanactivationreq.bitpattern/STAT20„BTSTƒD2,D0Žreadstatusforthischannel?ŠBEQ.S‚STAT40branchifno5ŠCMP.L‚RIOTCB(A1,D1),A6ƒchannelbelongstothisuser?1ŠBNE„OUTONERŒbranchifno-returnwitherrorset3ŠMOVE.WRIOCNIF(A1,D1),D4‚getchannelconfigurationŠBTSTƒ#0,D4Žaninputchannel?9ŠBNE„OUTONER1‹branchifnotinput-returnwitherrorset'ŠCMP.B‚#8,D2Žseeifchannelnumber8-156ŠBGE.S‚STAT30branchif8-15-donotcheckinterrupts,ŠBTSTƒ#1,D4Žischan1-7,setforinterrupts?2ŠBEQ„OUTONER1‹branchifsetforinterrupts-error6STAT30„BCLRƒD2,D3Žclractivationflagforthischannel*ŠTST„D3‘finishedcheckingparameterblock?1ŠBNE.S‚STAT40branchifnotfinishedcheckingyet.ŠBSR„GTSTATgoreadstatusandsaveinREG.D5!ŠBRA.S‚STAT50gotoprocedureexit3STAT40„ADD.L‚#CHANLNG,D1ˆbumptonextchannelentry(ŠADD.L‚#1,D2Žbumptonextchannelnumber#ŠCMP.L‚#16,D2checkedallchannels?,ŠBRA„STAT20branchtochannelchecksequenceXX‚(stampcoupling)?*‚Returnparameters:‚none(sideeffects;writestoPIActlreg)* DOENBL EQU *3‰LEA‡ENBLIRQ(PC),A1†getaddressofenable_irqtable3‰BSR‡MODIFYPIAŒmodifyPIAcontrolregIRQ1ctlbits‰RTS‰PAGE *MODIFYPIA**†It'sfunctionsare:0*ˆa.TowriteinterruptcontroldatatoPIAmaps=*ˆb.TowriteinterruptcontroldatatoPIAcontrolregisters*>*‹ItperformsthesetwofunctionsbeinvokingWRITMAP&DOPIA.+*‹ItDOESNOTMODIFYDEBOUNCECONTROLDATA.***ˆInputparameters:/*’A1„addressofenable/disableconstanttable*’D2„channel#*’A4„RIOTBLaddress*’D1„XXX>*ˆOutputparameters:‚none(sideeffects;writesPIAregisters)*MODIFYPIA EQU * ‰CLR.L…D7‰MOVE.L„D2,D5ˆsetupchannel#2‰MOVE.W„RIOPIA(A4),D7‡getoffsettouser'sPIAmap ‰BTST†#0,D2…evenoroddchannel?"‰BNE.S…MODF1…branchonoddchannel-‰MOVE.W„(A1),D1ƒgetevenchannelcontrolmask ‰BRA.S…MODF2 MODF1 EQU ***ˆstagecodeforWRITMAP*1‰MOVE.W„2(A1),D1‚getoddchannelIRQcontrolmask MODF2 EQU *2‰BSR‡WRITMAPƒwritethenewinterruptstatustomap,‰BSR‡DOPIA…writethenewcontroldatatoPIA‰RTS‰SPC10*ENBLIRQEQU*†tableforusebyDOENBLonly@*‚MSbyteisOR'edwithcontroldata,LSbyteisAND'edwithit.%‰DC.W†$01FF…enableirqevenchannel#$‰DC.W†$08FF…enableIRQoddchannel#;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ŠPAGEM******************************************************************************%*ˆDSABLE-DISABLEINTERRUPTSCOMMAND>*‰Thiscommanddisablesinterruptsforthespecifiedchannels.<*‰Thechannelsmusthavebeenopenedforinputbythisuser,?*‰mustbechannels0-7only,andmustcurrentlyhaveinterrupts;*‰enabled.‚Theparameterblockischeckedforerrorsbefore>*‰anyinterruptsaredisabled.Nochannelsaredisabledifany*‰errorisfound.*1*‰RIODISABLEINTERRUPTScommandparameterblock: *‰DS.Wƒ1ƒreturnedcommandstatus*‰DS.Wƒ1ƒcommandcode07B*‰DS.Wƒ1ƒbitmaskcontainingchannelnumberstodisableinterrupts*)*‚Entry:A1=addressofRIO-IDinRIOTBL%*‰A2=addressofCMRparameterblock %*‰A3=addressofRIOparameterblock*‰A4=addressofRIOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB**‚Calls:DODSABL*M*****************************************************************************DSABLE:ŠPUSHPOINT‘saveallpointers7DSABL10ƒMOVE.L#4,D1ŽsetD1tochanconfig.entry(row)!ŠCLR.L‚D2‘useforchannelcounter1ŠCLR.L‚D0‘clearforuseaschannelactiv.bitmap4ŠMOVE.WCMDCHN(A3),D0†getchannelactivationbitmap+ŠCMP.W‚#$FF,D0Œcannotspecifychannels8-153ŠBGT„ENABLERŒbranchif8-15-returnwitherrorset(DSABL20ƒBTSTƒD2,D0Ždisablethischannel?)ŠBEQ.S‚DSABL30Œbranchifnotthischannel-ŠCMP.L‚RIOTCB(A1,D1),A6ƒbelongstothisuser?0ŠBNE„OUTONERŒbranchifno,returnwitherrorset3ŠMOVE.WRIOCNIF(A1,D1),D4‚getchannelconfigurationŠBTSTƒ#0,D4Žaninputchannel?8ŠBNE„OUTONER1‹branchinnotinput,returnwitherrorsetŠBTSTƒ#1,D4Žinterruptsenabled?1ŠBNE„OUTONER1‹branchifno,returnwitherrorset/ŠBSET…#1,D4Œdisableinterruptsforthischannel>ŠMOVE.WƒD4,RIOCNIF(A1,D1)ƒstoreoutirqdatainconfig.RIOTBLŠPUSHALL“saveallregs!ŠBSR„DODSABLŒgodoactualdisableŠPOPALL”restoreall(DSABL30ƒADD.L‚#1,D2Žbumptonextchannel-ŠADD.L‚#CHANLNG,D1ˆbumptonextchannelentry"ŠCMP.L‚#8,D2Žcheckedallchannels?&ŠBNE.S‚DSABL20Œbranchifmorechannels)ŠBRA†ENABLOKŠreturnwithstatus=noerrsŠPAGE**.*DODSABL is a local subroutine for DSABLE only**ƒInputparameters**’D2.W‚channel#*’A4„RIOTBLaddress*?*‚Returnparameters:‚none(sideeffects;writestoPIActlreg)* DODSABL EQU *3‰LEA‡DSBLIRQ(PC),A1†getaddressofenable_irqtable3‰BSR‡MODIFYPIAŒmodifyPIAcontrolregIRQ1ctlbits‰RTS*** DSBLIRQ‚EQU‡*.‰DC.W†$00FE…disableIRQonevenchannelnumber%‰DC.W†$00F7…disableIRQoddchannel#;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - -‰PAGEM*******************************************************************************ˆPLSO-PULSEDOUTPUTCOMMAND*)*‚Entry:A1=addressofRIO-IDinRIOTBL%*‰A2=addressofCMRparameterblock%*‰A3=addressofRIOparameterblock*‰A4=addressofRIOTBL*‰A5=addressofCCB*‰A6=addressofusersTCB***‰ExitstoNRMEXIT***Parameter block format for pulsed output:*0*RIO parameter block (pointed to by A3 on entry)* *ˆDS.W†1‰returnedcommandstatus*ˆDS.W†1‰commandcode*ˆDS.W†1‰numberofchannels<*ƒ---ƒ---ƒ---ƒparametersforindividualchannelsƒ---ƒ---ƒ---*ˆDS.W†1‰firstchannelnumber,*ˆDS.L†1‰numberofmillisecondsforpulseon*ˆ.*ˆ.*ˆDS.W†1‰nthchannelnumber5*ˆDS.L†1‰numberofmillisecondsfornthchannelpulse*7* EACH CHANNEL IS ACTIVATED IN TURN (NON-SYNCHRONOUSLY)**M***************************************************************************** PLSO:*@*ƒPulsed_Out(IN:LISTOFchannelactivationrequest,pulsetimes;*ˆOUT:errorcode)>‰ALLOCATECHANID,RIOPARBK†allocatechannelid&RIOparablock3‰STORE…A3,RIOPARBK‰saveRIOparameterblockaddress**†Initiatepulsedoutput*!‰CLR.L…D6’clearworkingregisters ‰CLR.L…D3’. ‰CLR.L…D2’. ‰CLR.L…D0’.*$*ˆgetnumberofchannelstoactivate*<‰MOVE.W„CMDCHN(A3),D0‡getnumberofchan'sfromRIOparablk**‡WHILEchannelcount>0*PLSO1:$‰TST.W…D0’loopon#ofchan.'stodo ‰BEQ‡PLSOX**ˆDO**‡getfirstchannelnumber* ‰CLR.L…D5‰MOVE.W„NUMCHAN(A3,D6),D5$‰STORE…D5,CHANID‹savechannelnumber*G* Channel ID will consist of user CCB address + chan number in LS byte.*+‰MOVE.L„A5,D7copyuser'sCCBaddresstoD75‰ADD.L…D7,CHANID(A7)‡CHANIDnowhascompletechan.ID"‰MOVE.L„D5,D7copychannel#toD7,‰BSR‡BIN_BITconvertbinarytobitmapinD5*)*‚IFchannelbelongstocurrentuserTHEN*6‰MULU†#CHANLNG,D7‰computeoffsettonthchaninRIOTBL%‰ADD‡#4,D7bumptouserTCBinRIOTBL-‰CMP.L…RIOTCB(A1,D7),A6„compareTCBaddresses1‰BNE.S…PLSOER1branchonchannelnotcurrentuser**ˆDO'*ˆGetchannelconfigurationfromRIOTBL*  8‰MOVE.W„RIOCNIF(A1,D7),D3ƒgetchannelconfigfromRIOTBL*&*‚IFchannelisanoutputchannelTHEN* ‰BTST†#0,D3.‰BEQ.S…PLSOER2ƒbranchonnotanoutputchannel**„DO2*…GetpulsetimefromRIOcommmandparameterblock*‰MOVE.L„CHNCNFG(A3),D3*%*„IFpulsetime>pulse_min_timeTHEN*'‰BEQ.S…PLSOER3ƒbranchonpulsetime=0**„DO-*†requestperiodicactivation(thischannel#)*2‰LEA‡PLSOFF(PC),A0‡pointtopulseturnoffroutine%‰CLR.L…D1’setrequestfor1timeonly6‰MOVE.B„CCBPPRIO(A5),D1…setact.prioritysameastask/‰LOAD†D2,CHANID‹setupchannelIDtogotoPLSOFF'‰MOVE.L„D3,A1setupactivationinterval‰PUSHALL"‰TR0$.RQPA˜passrequestforwakeup*)*‚Ifnoerrinperiodicact.requestTHEN*‰BRA.S…RQPAOKŽgoodreturn(‰BRA.S…PLSOER4errinperiodicact.req.**†DO*RQPAOK:‰POPALL(‰PUSHALL—amoreelegantwaytodothis?*"*ˆactivate_this_channel(channel#)*$‰MOVE.L„D5,D0passbitmasktoDOOUT ‰BSR‡DOOUT‰POPALL**†END*ƒEND*ƒdecrementchannelcount* ‰SUB‡#1,D0**END* ‰BRA‡PLSO1**ˆErrorhandling*PLSOER1‚CLR.L…D00‰MOVE.B„#RIOICNS,D0‰channelnotforcurrentuser ‰BRA.S…PLSOX1PLSOER2: ‰CLR.L…D00‰MOVE.B„#RIOICC,D0Šchannelnotanoutputchannel ‰BRA.S…PLSOX1PLSOER3:"‰CLR.L…D0’requestedpulsetime=03‰MOVE.B„#RIOCNFG,D0‰return'badconfiguration'code ‰BRA.S…PLSOX1PLSOER4:‰POPALL ‰CLR.L…D0+‰MOVE.B„RIOBSY,D0‹periodicactivationerror ‰BRA.S…PLSOX1Žreturndevicebusy‰SPC2** Pulsed output good exit point*;PLSOX„LOAD†A3,RIOPARBK‰restoreRIOparablockaddresstoA3‰CLR.L…D0ˆsetfornormalreturnPLSOX1: ‰ADD.L…#12,A7*‰BRA†NRMEXIT„gotonormalcommonexitpoint‰PAGE**‡PULSEDOUTPUTDEACTIVATION:**ˆPulsedoutputde-activation.!*ˆEnteredbyperiodicactivation. *ƒOnentry:?*ˆD1containschannelIDcomposedofuser'sCCBaddressinM.S.8*ˆ3bytes,andchannelnumber(0-15)inleastsig.byte.*PLSOFF:‰PUSHALL&‰MOVE.B„D1,D5savecombinedchannelID ‰AND.B…#0,D1recoverCCBaddress+‰MOVE.L„D1,A5stageCCBaddressfor'DOOFF'+‰AND.L…#$000000FF,D5‡recoverchannelnumber,‰BSR‡BIN_BITconvertchan#tobitmapinD5"‰MOVE.L„D5,D0stagedataforDOOFF‰BSR‡DOOFFturnoffchannel‰POPALL‰RTE‰PAGEBIN_BIT:*$* Binary to bit-map conversion in D5*J*Produces a 1 in D5 corresponding to the value in D5 (in binary) up to 15.@*ˆForinput>15binarytheresultantpatterninD5isundefined*‰ALLOCATE‚BITMAP‰CLR.L…BITMAP(A7)‰ADD.W…#1,BITMAP(A7) LOOP…SET‡* ‰TST.W…D5‰BEQ‡BINBITXexitonbitfound‰ROL.W…BITMAP(A7) ‰SUB‡#1,D5 ‰BRA‡LOOP BINBITXŒEQU‡*‰MOVE.W„BITMAP(A7),D5‰DEALOC„BITMAP‰RTSŠPAGEO******************************************************************************** *ˆNORMALEXIT*,*‚Entry:A2=addressofCMRparameterblock%*‰A3=addressofRIOparameterblock*‰A5=addressofCCB*‰A6=addressofusersTCB*‰D0=RIOerrorcode*I**************************************************************************NRMEXIT:>ŠMOVE.WD0,CMDSTA(A3)†setreturnstatusinRIOparameterblockŠRTS—returntoCMRŠPAGEJ****************************************************************************ˆKILR(KILLER)*4*“Routinecalledtohandleunrecoverableconditions.**K****************************************************************************KILR: ‰TR0$.KILLERŠ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‘Mustbeonworkboundary.  )ŠBNE.S‚IOHADR4Branchifbadbufferbase.ŠTST.L‚D5”Lengthcan'tbezero.2ŠBEQ.S‚IOHADR8Don'tgotologphywithzerocount. IOHADR2ƒEQU„*1ŠMOVE.LTCBTST(A1),A0‰Addressoftaskseg.table. ŠTR0$.LOGPHY.ŠBRA.S‚IOHADR8Branchforgoodaddressreturn.0ŠBRA.S‚IOHADR6Branchforbadbytecountreturn.(ŠTST.L‚D5”Wasanentrypointerreturned.#ŠBEQ.S‚IOHADR4Branchifno-ERROR)ŠTST.B‚7(A0,D5)ŽIsthisanMMIOsegment?ŠBNE.S‚IOHADR8Yes,OK.3IOHADR4ƒADD.L‚#2,(A7)AdjustPCforinvalidreturn.3IOHADR6ƒADD.L‚#2,(A7)AdjustPCforinvalidreturn.IOHADR8ƒRTSšReturn.Š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.ŠNOPšBadtaskspecification.&ŠADD.L„#2,(A7)Badtaskspecification.GETT10„RTSšReturn.ŠPAGEJ**************************************************************************** INTERRUPT SSERVICE ROUTINE*?*ƒPURPOSE:‚HANDLETHERIOINTERRUPTSANDNOTIFYTHEUSEROFTHE5*INTERRUPTS.‚OPERATESATHARDWAREINTERRUPTPRIORITY*LEVEL.*1*ƒENTRY:‚JSR‚FROMINTERRUPTHANDLERROUTINE-CMR*‹A0-WORKREGISTER *‹A1=SELF*‹A5=ADDRESSOFCCB*‹D0=WORKREGISTER*5*ƒEXIT:‚RTS-BACKTOINTERRUPTHANDLERROUTINE-CMR*C*ŠInterrupthandlermustpruservealldatareg.'s&addressreg.'s.***ƒREGISTERSUSED:ƒ01234567 *”D******** *”A*****P****ƒEXECROUTINESCALLED:‚QEVENTI**ƒCODEISRE-ENTRANT**?*‚Debounceoninterruptadded9/13/82.‚Debounceis0to512ms,9*‚encodedinbits8-14ofthechannelconfigurationword.I*‚Thescalefactorfordebouncetimeis4mspercountinch.config.wd.*F*---------------------------------------------------------------------*RIOINT:*<* Find RIO TABLE module (board) name which matches CCB name:*-ˆMOVEM.L„A0-A6/D1-D7,-(A7)„saveallexceptD0:ˆALLOCATEƒRIOTADR,CHANUM,CLAIMCHKƒallocatelocalvariables/ˆCLR.L†CLAIMCHK(A7)…clearinterruptclaimcheck-ˆMOVE.L…RIOTBL,A2‰getaddressofRIOTBLtoA2 ˆCLR.L…D76ˆMOVE.B„RIONMAX(A2),D7…getmaxnumberofRIOID'stoD7#ˆMOVE.L„CCBMNEM(A5),D0…getccbname2IOHI011EQU*‚findmatchingRIOIDloopentrypoint*ˆMOVE.L„RIOID(A2),D3‡getRIOIDforstaging'ŠCMP.LƒD3,D0ŽdoesCCBnamematchRIOID?#ŠBEQ.SƒIOHI020Œbranchonnamematch,ŠADDA.W‚RIOOFST,A2‰addoffsettonextRIOTBL#ŠSUB.Bƒ#1,D7ŽtestforendofRIOTBL*ŠBMI…IOHIPXŠbranchtoexitifidnotfound ŠBRAIOHI011 IOHI020ƒEQU**F*‚Foundmatchingnames,nowgetnumberofinterruptingchannel(toD2)2*‚andclearhardwareinterruptflaginPIAdevice.*%‰STORE…A2,RIOTADRŠsaveRIOTBLaddress,‰MOVE.L„#$0C010000,D2‡initparafieldsinD2)‰BSR‡IOHICLRclrirq&getint.channel#+‰STORE…D2,CHANUM‹savechan.#&returncode*>* Compute address of field in RIOTBL having user's TCB address* ŠCLR.L„D4!ŠMOVE.BƒD2,D4getchannel‚toD4.B)ŠCMP.B„#8,D4channelmustbe<8orerror'ŠBEQ.S„IOHIPXŒexitonchannelnotfound1ŠADD.L„#1,CLAIMCHK(A7)ƒmarkinterruptacknowledge2ŠMULU…#6,D4pointtodatafieldassocwithchannel5ŠADD†#RIONTRY,D4‡addoffsetto1stchanneldatafieldŠADD†#4,D4addinsizeofRIOID-ŠMOVE.LƒRIOTBL,A2‰getaddressofRIOTBLtoA26ŠMOVE.L‚RIOTCB(A2,D4),A6„A6nowhasuser'sTCBaddress*"*IF channel requires debounce THEN*3ŠMOVE.WƒRIOCNIF(A2,D4),D0ƒgetchannelconfiguration(ŠAND†#$7F00,D0‹selectdebouncetimedata…IF.L†ŠTHEN*„DO;*ˆRequestperiodicactivation(CCB_adr,chan_#,debounce_time)6*ˆGeneratechannelID=CCBaddress+channel#toD2:**‰MOVE.L„A5,D7copyboardCCBaddresstoD7‰ADD.B…D2,D7addchannelnumber/‰MOVE.L„D7,D2stagechannelIDforperiod.act.! .‰LEA‡DEBOUNCE(PC),A0…pointtodebounceroutine!‰CLR.L…D1’request1periodicact.1‰MOVE.B„CCBPPRIO(A5),D1…setprioritysameastask&‰LSR‡#8,D0positiondebouncetimedata-‰MULU†#4,D0multiplybydebouncedelayfactor ‰MOVE.L„#0,A1*‰MOVE.W„D0,A1stagetimeforperiodicact..‰LINK†A6,#-(ALLREGS+4)…addsomeextraroom(4)*I* NOTE: LINK has reserved space on the stack for all registers + 4 words.A*‡NowIcandoMOVEM.Ltothestackwithoutautoincorautodec.B*‡andaslongasIgetbackA6unchanged,UNLINKA6willtakecare+*‡ofadjustingthestackpointercorrectly.*.‰MOVEM.LƒA0-A6/D0-D7,(A7)„saveallreg.values ‰TR0$.RQPA*/*‡IFnoerrorreturnedfromper.act.req.THEN*,‰BRA.S…DBACTOKgoodreturnfromper.act.req.+‰BRA.S…DBACTNGbadreturnfromper.act.req.*‡DO*DBACTOK‚EQU‡*‰Debounceact.req.returnok**ŠDisableIRQonthischannel.%*ŽStageargumentsforcalltoDODSABL*0‰MOVEM.Lƒ(A7),A0-A6/D0-D7„recallregistervalues.‰MOVE.L„RIOTADR+4(A6),A4„recallRIOTBLaddress#‰AND‡#$000000FF,D2‡selectchannel#+‰BSR‡DODSABLdisableIRQ.note:ck'9/15/82*DBACTNG„EQU…*‰debounceact.req.returnNG*ˆENDƒdisableIRQ0‰MOVEM.Lƒ(A7),A0-A6/D0-D7„recallregistervalues‰UNLK„A6*…END†debouncesetupsequence†ELSE**…hereifnodebouncerequired*.‰LOAD†D2,CHANUM‹recallchannel#&returncode‰BSR‡NOTIFYUSR†ENDI$IOHIPX„EQU*‡'RIOINT'procedureexit+‰LOAD‚D0,CLAIMCHKŒgetinterruptclaimcheck#‰ADD‡#16,A7Žreleaselocalvariables0‰MOVEM.Lƒ(A7)+,A0-A6/D1-D7ƒrestoreallexceptD0+‰TST.L…D0’doesRIODRVclaimthisinterrupt?‰IF.L‚THEN(‰ORˆ#1,SRsignalCMR'interrupthandled'‰ELSE2‰AND‡#$FFFE,SR‹signalCMR'interruptnotfromRIO'‰ENDI‹RTS…PAGE NOTIFYUSR:*A*ˆnotifyuserbymeansofqueeventorwakeupasspecifiedinthe*ˆchannelconfigurationword.**„INPUTPARAMETERS:'*’A2:AddressofchannelnameinRIOTBL;*’D4:Offsetfromchannelnametochanneldatafield(base) *™inRIOTBL.*’A5:AddressofchannelCCB./A!;)41L9*’A6:User'sTCBaddress#*’D2:$0C01**@ŠMOVE.WƒRIOCNIF(A2,D4),D0getchannelconfigurationfromchannel *¤configurationtableinRIOTBL.)ŠBTST…#3,D0determine:wake-uporq-event ‰IF…‰THEN**ˆDO*ˆEnqueueevent;datastaging:*$*ƒD2=$0C01 *ƒD3=RIOID*ƒD4=MemmappedI/Oaddress*ƒA6=User'sTCBaddress*8ŒMOVE.LƒCCBCHB(A5),D4…getmem.mappedI/OaddressstagedŒBSRQUEVENTenqueuetheeventŒRTS˜andreturntocaller*‰ELSE*DO%ŒMOVE.LƒA6,A0ŽstageusersTCBaddress#ŒTR0$.WAKEUP,issuewakeuptouser*ENDŒENDIŒRTS™returntocaller‰PAGE=*‚IOHICLRdeterminesiftheinterruptisforthisRIOmodule.E*‚IftheinterruptisnotforthischannelD2contains'8'onreturn.C*‚IftheinterruptisforthisRIOmodule,theinterruptingchannelI*‚numberisreturnedinD2‚TheinterruptinthePIAisclearedherealso.**‚Inputparameters:%*’A5:PointstotheI/Obaseaddress.*‚Outputparameters:(*’D2:Containsinterruptchannelnumber.* IOHICLR EQU *0ŠMOVE.LCCBCHB(A5),A0ˆgetI/ObaseaddresstoA08ŠBTST.Bƒ#0,PIA1ACR(A0)…ischannel#0setforinterrupts?/ŠBEQ.S„IOHIO01Œbranchifnotset-checkchan18ŠBTST.Bƒ#7,PIA1ACR(A0)…setforinterrupt-isthereone?(ŠBNE†IOHI021ŒbranchonIRQfoundonch0$IOHIO01ƒADD#1,D2“bumpchannelcount5ŠBTST.Bƒ#3,PIA1ACR(A0)…ischan.1setforinterrupts?/ŠBEQ.S„IOHIO02Œbranchifnotset-checkchan28ŠBTST.Bƒ#6,PIA1ACR(A0)…setforinterrupt-isthereone?*ŠBNE.SIOHI021branchonIRQfoundonch1$IOHIO02ƒADD#1,D2“bumpchannelcount4ŠBTST.B‚#0,PIA1BCR(A0)†ischan2setforinterrupts?*ŠBEQ.SƒIOHIO03branchifno-checkchan38ŠBTST.Bƒ#7,PIA1BCR(A0)…setforinterrupt-isthereone?*ŠBNE.S! „IOHI022ŒbranchonIRQfoundonch2$IOHIO03ƒADD‚#1,D2’bumpchannelcount4ŠBTST.B‚#3,PIA1BCR(A0)†ischan3setforinterrupts?*ŠBEQ.SƒIOHIO04branchifno-checkchan48ŠBTST.B‚#6,PIA1BCR(A0)†setforinterrupt-isthereone?*ŠBNE.S‚IOHI022ŽbranchonIRQfoundonch3&IOHIO04ƒADD#1,D2“bumpchannelcounter4ŠBTST.Bƒ#0,PIA2ACR(A0)…ischan4setforinterrupts?*ŠBEQ.S„IOHIO05Œbranchifno-checkchan58ŠBTST.Bƒ#7,PIA2ACR(A0)…setforinterrupt-isthereone?*ŠBNE.SIOHI023branchonIRQfoundonch4&IOHIO05ƒADD#1,D2“bumpchannelcounter4ŠBTST.B‚#3,PIA2ACR(A0)†ischan5setforinterrupts?-ŠBEQ.SƒIOHIO06branchifno-gocheckchan68ŠBTST.B‚#6,PIA2ACR(A0)†setforinterrupt-isthereone?*ŠBNE.SIOHI023branchonIRQfound‚onch5&IOHIO06ƒADD#1,D2“bumpchannelcounter4ŠBTST.B‚#0,PIA2BCR(A0)†ischan6setforinterrupts?-ŠBEQ.S„IOHIO07Œbranchifno-gocheckchan78ŠBTST.B‚#7,PIA2BCR(A0)†setforinterrupt-isthereone?*ŠBNE.SIOHI024branchonIRQfound‚onch6&IOHIO07ƒADD#1,D2“bumpchannelcounter4ŠBTST.B‚#3,PIA2BCR(A0)†ischan7setforinterrupts?2ŠBEQ.SƒIOHIONObranchifno-thisinternotforme8ŠBTST.B‚#6,PIA2BCR(A0)†setforinterrupt-isthereone?*ŠBNE.SIOHI024branchonIRQfound‚onch77IOHIONOƒADD#1,D2“setchan#=8=interruptnotforme ŠRTS™returntointerrupthandler5IOHI021ƒTST.B„PIA1ADR(A0)ˆreadingdataregclearsIRQŠRTS™andreturn-IOHI022ƒTST.BƒPIA1BDR(A0)‰cleartheinterruptŠRTS™andreturn(IOHI023ƒTST.BƒPIA2ADR(A0)‰clearIRQflagŠRTS™andreturn(IOHI024ƒTST.BƒPIA2BDR(A0)‰clearIRQflag‰RTSšandreturn‹PAGE'*‹DEBOUNCE-interruptdebounceroutine3*‹Controlreturnsherewhentheperiodicactivation*‹requesttimeexpires.*ƒInputparameters:**’D1:CCBaddress+channel#(inlsbyte)* DEBOUNCE:‰PUSHALLsaveallregisters*F*‚IF(((channelconfig=risingedgeIRQ)AND(channelstate=up))ORH*†((channelconfig=fallingedgeIRQ)AND(channelstate=down)))THEN*0*…ComputeoffsetforthischannelintheRIOTBL:*5‰MOVE.L„#$0C010000,D2‡setupdatafiledsforNOTIFYUSR!‰CLR.L…D3’clearworkingregisters ‰CLR.L…D4’. ‰CLR.L…D6’.%‰MOVE.B„D1,D4extractchannel#toD46‰MOVE.B„D4,D2completestageofchandatatoNOTIFYUSR*‰MOVE.B„D4,D3savecopyofchannel#inD35‰MULU†#6,D4pointtodatafieldforchannelinRIOTBL7‰ADD‡#RIONTRY+RIOCNIF,D4addoffsetto1stchanneldata*'*ˆGetchannelI/OaddressbasefromCCB*'‰AND‡#$FFFFFF00,D1‡clearlsbyteinCCB#‰MOVE.L„D1,A5putCCBaddressonA5*‰MOVE.L„CCBCHB(A5),A1‡getI/Obaseaddress*+*ˆFindRIOTBLdatasectionforthischannel*+‰MOVE.L„RIOTBL,A2‹getaddressoftheRIOTBL ‰CLR.L…D70‰MOVE.L„CCBMNEM(A5),D0†getchannelnamefromCCB1‰MOVE.B„RIONMAX(A2),D6†getmaxnumberofRIOTBL's LOOP…SET‡*.‰MOVE.L„RIOID(A2),D5ˆgetchannelnamefromCCB%‰CMP.L…D5,D0channelname=CCBname? ‰BEQ.S…FOUND13‰ADD.W…RIOOFST,A2ŠbumptonextRIOID(channelname)!‰SUB‡#1,D6decrementloopcounter*‰BEQ.S…DBERRerrifchannelnamenotfound ‰BRALOOPFOUND1:/‰MOVE.L„RIOTCB(A2,D4),A6†getuser'sTCBaddress3‰BTST†#2,RIOCNIF+1(A2,D4)ƒconfig=risingedgeIRQ? ‰IF…‡THEN*%* DO if set for rising edge interrupt*-‰BTST†D3,PIA1ADR(A1)†channelstatus=hinow? IF‚ƒTHEN*9*‰DO‚notifyuserifstillonrisingedge-goodinterrupt*ŒPUSHALL”saveallregsŒBSR„NOTIFYUSRŒPOPALL•restorallregs**‰END„ofinterruptonrisingedgesequenceˆENDIˆELSE*?*„Elsethechannelconfigurationisforfallingedgeinterrupt.!*†DO‚seeifstillonfallingedge*-‰BTST†D3,PIA1ADR(A1)†channelstatus=lonow? †IF‚ƒTHEN*5*†Channelstatus=lo‚-notifyuserofgoodinterrupt*†DO‰PUSHALL‰BSRNOTIFYUSR‰POPALL"*†END‚offallingedgeIRQsequence‡ENDI**‚ENDƒofdebouncesequence*ƒENDI*"*ˆEnableIRQondebouncedchannel:***BEGINstageparametersforcalltoDOENBL*%‰AND.L…#$000000FF,D2‡selectchannel#&‰MOVE.L„A2,A4getRIOTBLaddresstoA4)‰CLR.L…D1’" setdebouncedatafieldtonull.‰BSRDOENBL”invokeroutinetoenableinterrupt*END*/DBERREQU*‚debounceerr;riotblnamenotfound+‰POPALLŽrestoreallregistersbeforereturn‰RTE›returntoO.S.‰PAGE*H*‚QUEVENT‚enqueue'seventtodrivingtaskusingdatastagedinregisters *‹asfollows:**‹A6=user'sTCBaddress&*‹D2=$0C01*‹D3=RIOID‚(modulename)*‹D4=memmappedI/Oaddress** QUEVENT EQU *‹PUSHALL”pushallregs"‹MOVE.L…A6,A0Žstageuser'saddress ‹TR0$.QEVNTI)‹BRA.SƒQUEVNTOKŒgoodreturnforqueevent'‹BRA.SƒQUEVNTERŒbadreturnfromqueventQUEVNTOK EQU *‹POPALL•restoreallregs‹RTS QUEVNTER:(‹BRAQUEVNTOKputabreakherefordebug*‰ENDéééééFTRIO…IDNTƒ1,0RIOsubroutines**‰FORTRANcallablesubroutines*‰forRIOdrivercalls*$*‰CALLRIOCMD(rio_id,param_blk_addr)*‰whereRIOCMDmaybe:*)*‰CALLRIOPEN(rio_id,param_blk_addr)…open**‰CALLRIOCLS(rio_id,param_blk_addr)…close3*‰CALLRIOOUT(rio_id,param_blk_addr)…outputlatched/*‰CALLRIOOFF(rio_id,param_blk_addr)…outputoff+*‰CALLRIOSTA(rio_id,param_blk_addr)…status6*‰CALLRIOENB(rio_id,param_blk_addr)„enableinterrupts7*‰CALLRIODSB(rio_id,param_blk_addr)„disableinterrupts2*‰CALLRIOPLS(rio_id,param_blk_addr)„outputpulsed*,*‰Allargumentsforthecallsareidentical.7*‰Thecontentsoftheparam_blkforeachcallisunique*‰tothecall.*6*‰Allthecommandsubroutinescallacommonsubroutine3*‰RIOSETtobuildtheinitiateI/Oparameterblock.**‰STACKFORALLCALLS:*7*‰deepeststack:(stackaddressstaysatRIOSETreturn)0*˜commandcodeƒ2bytes(initiateI/Oparam.blk) *˜n/aŒ2bytes*˜rio_id‰4bytes *˜n/aŒ4bytes *˜n/aŒ4bytes *˜n/aŒ4bytes,*˜commandaddrƒ4bytes(riocommandaddress)**˜commandlng„2bytes(riocommandlength)-*˜RIOSETreturn‚4bytesdeepeststackaddress *˜A34bytes *˜A24bytes *˜A14bytes *˜D04bytes*‰entrystack:ƒreturn‰4bytes*˜^param_blk_adr4bytes*˜^rio-idˆ4bytes* ŠSECTION9!ŠXDEFƒRIOPEN,RIOCLS,RIOOUT,RIOOFF!ŠXDEFƒRIOSTA,RIOENB,RIODSB,RIOPLS*$*‰CALLRIOPEN(rio_id,param_blk_addr)*‰openandconfigurechannels*1RIOPEN„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters3ŠBSR„RIOSETset-uptheinitiateI/Oparameterblock)ŠMOVE.L#1,(A2)ŒsettheopencommandcodeRIOPN00ƒCLR.L‚D0‘clearforuse'ŠMOVE.W4(A2),D0‹getnumberofchannelsŠASL.L‚#2,D0Žmultiplyby4.RIOPN05ƒADD.L‚#6,D0Žaddinthe6byteoverhead-RIOPN10ƒMOVE.WD0,(A1)Œset" thecommandlength-ŠMOVE.LA3,A0ŽTRAP#1parameterblockaddress#ŠMOVE.L#60,D0CMRdirectivenumberŠTRAPƒ#1‘callRMS68K'ŠMOVE.WD0,(A2)Œsetthereturnedstatus)ŠMOVEM.L(A7)+,D0/A1-A3„restoreregisters!ŠMOVE.L(A7)+,A0‹putreturninA0AAJ8R ŠLEA„8(A7),A7‹cleanupthestackŠJMP„(A0)returntouser*$*‰CALLRIOCLS(rio_id,param_blk_addr)"*‰closeallchannelsforthisuser*1RIOCLS„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚RIOSETset-uptheinitiateI/Oparameterblock*ŠMOVE.L#2,(A2)Œsettheclosecommandcode&ŠMOVE.W#4,D0ŽRIOclosecommandlengthŠBRA„RIOPN10ŒgodotheCMRcall*$*‰CALLRIOOUT(rio_id,param_blk_addr)'*‰activateoutputonrequestedchannels*1RIOOUT„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚RIOSETset-uptheinitiateI/Oparameterblock+ŠMOVE.L#3,(A2)Œsettheoutputcommandcode*RIOUT10ƒMOVE.Wƒ#6,D0ŒsetupcommandlengthŠBRA„RIOPN10ŒgodotheCMRcall*$*‰CALLRIOOFF(rio_id,param_blk_addr))*‰deactivateoutputonspecifiedchannels*1RIOOFF„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚RIOSETset-uptheinitiateI/Oparameterblock/ŠMOVE.L#4,(A2)Œsettheoutputoffcommandcode4ŠBRA„RIOUT10Œgosetcommandlength&dotheCMRcall*$*‰CALLRIOSTA(rio_id,param_blk_addr))*‰readinputstatusonspecifiedchannels*1RIOSTA„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚RIOSETset-uptheinitiateI/Oparameterblock+ŠMOVE.L#5,(A2)Œsetthestatuscommandcode4ŠBRA„RIOUT10Œgosetcommandlength&dotheCMRcall*$*‰CALLRIOENB(rio_id,param_blk_addr).*‰enableinterrptsonspecifiedinputchannels*1RIOENB„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚RIOSETset-uptheinitiateI/Oparameterblock+ŠMOVE.L#6,(A2)Œsettheenablecommandcode4ŠBRA„RIOUT10Œgosetcommandlength&dotheCMRcall*$*‰CALLRIODSB(rio_id,param_blk_addr)0*‰disableinterruptsonspecifiedinputchannels*1RIODSB„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚RIOSETset-uptheinitiateI/Oparameterblock,ŠMOVE.L#7,(A2)Œsetthedisablecommandcode4ŠBRA„RIOUT10Œgosetcommandlength&dotheCMRcall*$*‰CALLRIOPLS(rio_id,param_blk_addr)>*‰activateoutputforx#ofmillisecondsonspecifiedchannels*1RIOPLS„MOVEM.LD0/A1-A3,-(A7)„savesomeregisters5ŠBSR.S‚RIOSETset-uptheinitiateI/Oparameterblock2ŠMOVE.L#8,(A2)ŒsetthepulsedoutputcommandcodeŠCLR.L‚D0‘clearforuse,ŠMOVE.W4(A2),D0‹getspecified#ofchannelsŠASL.L‚#2,D0Žmultiplyby6ŠADD.W‚4(A2),D04ŠBRA„RIOPN05Œgosetcommandlength&dotheCMRcallŠPAGE*4*‰RIOSETsetuptheCMRinitiateI/Oparameterblock,*‰returns:ƒA1=addressforRIOcommandlength(*”A2=RIOcommandparameterblockaddress)*”A3=initiateI/Oparameterblockaddress*(RIOSET„CLR.W‚-2(A7)clearcommandlength-ŠLEA„-2(A7),A1Šsaveaddressofcommandlength$ŠMOVE.L24(A7),A0Šgetparam_blk_addr%ŠMOVE.LA0,-6(A7)Šsaveparam_blk_addr,ŠMOVE.LA0,A2Žsaveparam_blk_addrforreturnŠCLR.L‚-10(A7)ŒnotusedŠCLR.L‚-14(A7)ŒnotusedŠCLR.L‚-18(A7)ŒnotusedŠMOVE.L28(A7),A0Šget^rio_idŠMOVE.L(A0),-22(A7)‡getrio_idŠCLR.W‚-24(A7)Œnotused0ŠMOVE.W#$0700,-26(A7)…initiateI/Ocommandcode4ŠLEA„-26(A7),A3‰initiateI/OparameterblockaddressŠRTS—returntocallerŠENDé# éé‰SPC10!*†---†---…STANDARDƒMACROS…---…---*H*Allocate macro allocates local storage as long words on the stack,(A7).,*Up to 6 variables may be allocated by name.C*These variables may then be referred to by name offset to stack orH*they may be stored to (by macro STORE) and loaded from (by macro LOAD).*O*Prior to exit, the variables must be de-allocated by invocation of DEALLOCATE. ALLOCATE MACRO*B*Allocate reserves storage on the stack for local named variables,8*‚whicharereferredtoasanoffsetfromstackpointer.\1 SET 2‰IFGT(NARG-1)\2 SET 6‰ENDC‰IFGT(NARG-2) \3 SET 10‰ENDC‰IFGT(NARG-3) \4 SET 14‰ENDC‰IFGT(NARG-4) \5 SET 18‰ENDC‰IFGT(NARG-5) \6 SET 22‰ENDC*ƒSUB.Lƒ#(NARG*4)+4,A7*ƒENDM*B*DEALLOCATEMACRO‚hastobenamedDEALOCtoovercomeassemblerbug DEALOC‚MACRO*>* Deallocate removes storage for local variables on the stack.ƒADD.L‚#(NARG*4)+4,A7*ƒENDMI*LOAD macro allows loading a register from local storage named variables. *Thesyntaxis:‚LOADRn,VARNAME.9*The storage is DYNAMICALLY ALLOCATED by macro 'ALLOCATE'* LOAD‚MACRO*‰MOVE.L„\2(A7),\1‰ENDM*H*STORE macro allows storing a register to local storage named variables.!*Thesyntaxis:‚STORERn,VARNAME.?*The local storage is DYNAMICALLY ALLOCATED by macro 'ALLOCATE'* STORE MACRO*‰MOVE.L„\1,\2(A7)‰ENDM*‰SPC5PUSHPOINTŠMACRO‰MOVEM.LƒA0-A6,-(A7)‰ENDM*POP_POINTŠMACRO‰MOVEM.Lƒ(A7)+,A0-A6‰ENDM* PUSHALLŒMACRO‰MOVEM.LƒA0-A6/D0-D7,-(A7)‰ENDM* POPALLƒMACRO‰MOVEM.Lƒ(A7)+,A0-A6/D0-D7‰ENDM*4ALLREGS‚EQU‡68ˆSpaceforallthereg.'sinthestack** *NOW USE THEM *MACTEST:* *ˆPUSHPOINT *ˆPUSHALL&*ˆALLOCATECOUNT,POINT,CHAR,VAL,MURPHY*ˆMOVE.L„#12345,D1*ˆSTORE†D1,COUNT*ˆLOAD‡D2,COUNT(*ˆDEALLOCATECOUNT,POINT,CHAR,VAL,MURPHY*ˆPOPALL *ˆPOP_POINT*ˆRTS*ˆEND*‰PAGEZ`=/*=/*†IOCFAIL.AF=/*F=/* Chain file to assemble device-failure routine which is called when2=/* a level-4 interrupt occurs in the RAD1 driver.=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to IOCFAIL.LS=/*=/IFC \1ƒ=ARGIOCFAIL.LS=/ENDIF=/*=ASM IOCFAIL.SA,IOCFAIL.RO,\1;R=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDééé# éééc=/*=/*†M600DRV.AF=/*B=/*Chainfiletoassemblethe‚MVME600A/DCONVERTERdevicedriver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M600DRV.LS=/*=/IFC \1ƒ=ARGM600DRV.LS=/ENDIF=/*$=ASM M600DRV.SA,M600DRV.RO,\1;MRZ=70=/*{ Included files are:=/*ƒM600CMTS.SA=/*ƒM600SERV.SA=/*ƒM600INTL.SA=/*ƒM600CMDS.SA=/*}=/*=ENDéééééél=/*=/*†M600LIB.AF=/*7=/* Chain file to assemble FORTRAN-callable subroutines)=/* to interface with the MVME600 driver.=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M600LIB.LS=/*=/IFC \1ƒ=ARGM600LIB.LS=/ENDIF=/*=ASM M600LIB.SA,M600LIB.RO,\1;R=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDé$ éééééu=/*=/*†M605DRV.AF=/*B=/*Chainfiletoassemblethe‚MVME605D/ACONVERTERdevicedriver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M605DRV.LS=/*=/IFC \1ƒ=ARGM605DRV.LS=/ENDIF=/*$=ASM M605DRV.SA,M605DRV.RO,\1;MRZ=75=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.TR1RTCD.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.M605DRV.EQ=/*}=/*=ENDéééééé~=/*=/*†M605LIB.AF=/*D=/* Chain file to assemble FORTRAN-callable subroutines to interface=/* with the MVME605 driver.=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M605LIB.LS=/*=/IFC \1$ „=ARGM605LIB.LS=/ENDIF=/*=ASM M605LIB.SA,M605LIB.RO,\1;R=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDéééééé‡=/*=/*†M610DRV.AF=/*-=/* Chain file to assemble the MVME610 driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M610DRV.LS=/*=/IFC \1ƒ=ARGM610DRV.LS=/ENDIF=/*$=ASM M610DRV.SA,M610DRV.RO,\1;RZ=100=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TR1RTCD.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.BAB.EQ=/*ƒ9995.&.M610CCB.EQ=/*ƒ9995.&.M610INTQ.EQ=/*ƒ9995.&.M610CMD.EQ=/*}=/*=ENDééééé% =/*=/*†M610LIB.AF=/*7=/* Chain file to assemble FORTRAN-callable subroutines-=/* to interface with the MVME610/620 driver.=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M610LIB.LS=/*=/IFC \1ƒ=ARGM610LIB.LS=/ENDIF=/*=ASM M610LIB.SA,M610LIB.RO,\1;R=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDéééééé™=/*=/*†M615DRV.AF=/*>=/* Chain file to assemble the MVME615 AC OUTPUT device driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M615DRV.LS=/*=/IFC \1ƒ=ARGM615DRV.LS=/ENDIF=/*$=ASM M615DRV.SA,M615DRV.RO,\1;MRZ=75=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.TR1RTCD.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.M615DRV.EQ=/*}=/*=ENDéééé% éé¢=/*=/*†M615LIB.AF=/*7=/* Chain file to assemble FORTRAN-callable subroutines)=/* to interface with the MVME615 driver.=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M615LIB.LS=/*=/IFC \1ƒ=ARGM615LIB.LS=/ENDIF=/*=ASM M615LIB.SA,M615LIB.RO,\1;R=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDéééééé«=/*=/*†M625DRV.AF=/*>=/* Chain file to assemble the MVME625 DC OUTPUT device driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M625DRV.LS=/*=/IFC \1ƒ=ARGM625DRV.LS=/ENDIF=/*$=ASM M625DRV.SA,M625DRV.RO,\1;MRZ=75=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.TR1RTCD.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.M625DRV.EQ=/*}=/*=ENDéé& éééé´' M625LIB AFÉÉbbRADDRV AFÒÒbbRADLIB AFÛÛbbRIODRV AFääbbRIOLIB AFííbb=/*=/*†M625LIB.AF=/*7=/* Chain file to assemble FORTRAN-callable subroutines)=/* to interface with the MVME625 driver.=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M625LIB.LS=/*=/IFC \1ƒ=ARGM625LIB.LS=/ENDIF=/*=ASM M625LIB.SA,M625LIB.RO,\1;R=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDééééé& éÁ=/* =/*†RADDRV.AF=/*&=/* Chain file to assemble RAD1 driver=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to RADDRV.LS=/*=/IFC \1ƒ=ARGRADDRV.LS=/ENDIF=/*#=ASM RADDRV.SA,RADDRV.RO,\1;MRZ=126=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.RADDRV.EQ=/*}=/*=ENDééééééÊ=/* =/*†RADLIB.AF=/*7=/* Chain file to assemble FORTRAN-callable subroutines&=/* to interface with the RAD1 driver.=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to RADLIB.LS=/*=/IFC \1ƒ=ARGRADLIB.LS=/ENDIF=/*=ASM RADLIB.SA,RADLIB.RO,\1;R=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDééé' éééÓ=/* =/*†RIODRV.AF=/*%=/* Chain file to assemble RIO driver=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to RIODRV.LS=/*=/IFC \1ƒ=ARGRIODRV.LS=/ENDIF=/*%=ASM RIODRV.SA,RIODRV.RO,\1;MR-WZ=134=/*{ Included files are:=/*ƒ9995.&.TR1RTCD.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.RIODRV.EQ=/*ƒSTDMACRO.AI=/*}=/*=ENDééééééÜ=/* =/*†RIOLIB.AF=/*7=/* Chain file to assemble FORTRAN-callable subroutines%=/* to interface with the RIO driver.=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to RIOLIB.LS=/*=/IFC \1ƒ=ARGRIOLIB.LS=/ENDIF=/*=ASM RIOLIB.SA,RIOLIB.RO,\1;R=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDé' éééééå'M600DRV TEST600 SAúúJ‚bbTEST600 AFKKbbN*******************************************************************************Ì**Ì**MVME600&605…TestProgramž**Ì**Ì*N********************************************************************************G* This program was written to test both the MVME600 and MVME605 driver.**    *‰ModificationHistoryN*-----------------------------------------------------------------------------*10/26/84‡DUHInitialwriting   *1.‚Introduction*F*‰ThisprogramwaswrittentotesttheMVME600andtheMVME605driver.F*‚ThisprogramwillaskforthechannelnumberoftheD/AmoduleandaK*‚digitalvaluetoconvertforthatchannel.‚TheprogramwillthenreadtheG*‚MVME600A/DchannelandcomparewithwhatwaswrittentotheD/A.‚The*‚resultisoutputontheCRT.*8*‰Thisprogramassumestheboardsarejumperedasshown:* *‚VME600: *„J3‚(open)‚addressoffset$1E00*„J4‚1-2…interrupt-notused*„J5‚(open)‚singleendedmode*„J6‚1-2…singleendedmode*„J7‚2-3…singleendedmode* *‚VME605: *„J2,J4,J5,J6‚3-4†+/-10voutput*„J3‹3-4†addressoffset$1E00*C*‚Connectanoutputchannel(0-3)oftheVME605toaninputchannel>*‚ontheVME600.‚YoumustusetheSAMEchannelonbothboards.*ŠPAGE ,*£ASCVAL,BHLCVT,andCVT2arecommonlyused**£functionswhicharemodulesinalibrary(*£filecalledUTILIB.RO.‚Acalltothese'*£functionsareincludedinthissource)*£program,whichisprovidedwithanXREF&*£declaration.‚Thisalsor( equiresthat'*£UTILIB.RObeavailabletothelinkage$*£editorduringthelinkingprocess.%*£SeeTEST605.LFforlinkchainfile. -ŠXREFƒASCVALConvertsASCIItoabinaryvalue$*£ThisroutinewillconvertanASCII,*£characterstringrepresentingadecimalor,*£hexidecimalvaluetotheequivalentbinary,*£value.‚Ifadollarsign($)isencountered&*£hexidecimalconversionisperformed;,*£otherwisedecimalconversionisperformed.+*£AnemptycharacterstringfieldpassedtoòBû:J >IA#B+I3M;,*£thisfunctioninA0producesazerobinary'*£value.‚Conversionterminateswhenthe)*£firstinvalidcharacterisencountered.'*£ENTRY:‚A0-StartingaddressofASCII*°characterstringtoconvert#*£EXIT:‚D1-Characterthatcaused *°termination%*«D2-Classcodeofterminatingchar"*«D3-Binaryresultofconversion*«A0-Addressofthecharacter *°followingtheterminatingchar 8ŠXREFƒBHLCVTConverts4-bytebinaryvaluetoASCIIdigit)*£Thisroutinewillconvertalongbinary-*£wordvaluetoahexadecimalvalueexpressed)*£asan8characterASCIIstring.‚Leading*£zerosaresuppressed.,*£ENTRY:‚D0.L-Binaryvaluetobeconverted(*£EXIT:‚D2.L-Fourhighorderbytesof*²convertedvalue *«D3.L-Fourloworderbytesof*²convertedvalue 6ŠXREFƒCVT2ConvertstwoASCIIdecimaldigitstobinary-*£ThisroutinewillconverttwoASCIIdecimal(*£digitstotheequivalentbinaryvalue.+*£Anemptycharacterstringfieldpassedto,*£thisfunctioninA0producesazerobinary**£value.‚Conversionterminateswhenanon-*£decimaldigitisencountered)*£ENTRY:‚A0-Addressofmostsignificant*°ASCIIdecimaldigit)*£EXIT:‚D0-Binaryresultofconversion!*«A0-Addressoftheterminating *°character ŠPAGE:BUFSIZEƒEQU„$100Thislabeldefinesthevalueforthesize*£oftheconversiontableS. ŠMOVE.LA0,IOSOUT+16-PBA(A4)SettheendingaddressofmessageŠLEA„IOSOUT(PC),A0ŠTRAPƒ#2ŠENDM ŠPAGE 2ŠOPT„PCSWeuseaPCSoptionsotheassemblerwill%*£forcePCrelativeaddressingwithin(*£SECTION.‚ForcesPCrelativeaddressing-*£(wheneversuchanaddressingmodeislegal))*£inaninstructionwhichoccurswithina'*£relocatableSECTIONandreferencesan,*£operandinarelocatableSECTION(neednot**£bethesameSECTIONastheinstruction).,*£Failuretoresolvesucnareferenceintoa-*£16-bitdisplacementfromthePCwillresult)*£inanerror.‚Thisoptionmaybeusedto+*£forcepositionindependentcode;however,(*£thisoptiondoesnotforcePCrelative,*£addressingofabsoluteoperandsorunknown*£forwardreferences. ŠPAGE N*******************************************************************************Ì**™DATAƒSECTIONœ**Ì*N****************************************************************************** ŠSECTIONDATA =D_ABUF„DS.BƒBUFSIZEŒThisisthebufferareathatwillcontain**£thedelayandtheconversionvaluetobe *£converted. =A_DBUF„DS.BƒBUFSIZEŒThisisthebufferareathatwillcontain(*£theconvertedanalogtodigitalvalue. $PBA‡EQU„*’ProgramBaseAddress(PBA)%*£Thislabelisusedtodesignatethe+*£beginningoftheprogram.‚Thisisusedto'*£makereferencestootherpartsofthe*£program,relocatable. :BUFOFSTƒDC.LƒPBA-D_ABUF‰ThisistheoffsetfromPBAtothe'*£conversiontablesothattherelative**£addresscanbefoundtomaketheprogram*£relocatable. 9ŠDS.WƒSTACKLEN‹ThisisthestackareafortheVME605test2STACK…EQU„*’program.‚Registersandotherimportant,*£informationwillbestoredonthestackas)*£theprogramisexecuted.‚Thestackarea'*£isdynamicandwillchangeduringthe *£executionofthetestprogram. 9BUFADR_DAƒDS.Lƒ1Thisisthestorageareafortheaddress-*£oftheconversiontablefortheD/Adriver. 9BUFADR_ADƒDS.Lƒ1Thisisthestorageareafortheaddress-*£oftheconversiontablefortheA/Ddriver. =INPUTBUF‚DS.WƒSTRNGLEN‹Thisisthestorageareafortheinput*£stringsthatareentered. 9STATUS„DS.Lƒ1’Thiswillbethestorageareforthestatus,*£codethatisreturnedfromCMR.‚Thisvalue-*£willbedisplayedtoshowtheuserwhatthe*£errorcodewas. 6NUMBER„DS.Lƒ2’SaveareafortheASCIIvalueofSTATUS. 8INPUT_VALUE‚DS.W‚1Entereddigitalvaluetobeconverted**£toanalog(D/A)isstoredhereinbinary**£formforlatercomparisonwiththevalue*£readofftheA/D.ŠPAGE N*******************************************************************************Ì*!*–PARAMETERƒBLOCKS—**Ì*N****************************************************************************** ŠNEXTWB”ForceevenboundaryIOSOUTŠDC.Bƒ0’Requestcode"ŠDC.BƒWRITEŽFunctionspecificationŠDC.Wƒ8’OptionsŠDC.Bƒ0’StatusŠDC.BƒCRTLogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress  )  ŠNEXTWB”ForceevenboundaryIOSINŠDC.Bƒ0’Requestcode!ŠDC.BƒREADFunctionspecificationŠDC.Wƒ0’OptionsŠDC.Bƒ0’Status"ŠDC.BƒKEYBOARD‹LogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress*#*‚CMRInitiateI/Oparameterblock:CMRBLK„DC.Bƒ7’InitiateI/OŠDC.BƒUNUSEDUnusedŠDC.WƒUNUSEDUnused/ŠDC.Lƒ'DAC1'Channelname(Dynamicallychanged)ŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnused$ŠDC.Lƒ0’AddressofI/Ocontrolblock#ŠDC.Lƒ0’LengthofI/OcontrolblockŠPAGE*2*‚OPENcommandparameterblockfortheD/Adriver:*OPEN_DAƒDC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒOPENOpencommandcodeŠDC.Wƒ1’#ofchannelstoopen-ŠDC.Wƒ0’Channeltoopen(Dynamicallychanged)4OLEN_DAƒEQU„*-OPEN_DAŠLengthofOPENparameterblock*5*‚CONVERTcommandparameterblockfortheD/Adriver:*CONV_DAƒDC.Wƒ0’Returnedstatusfromdriver"ŠDC.WƒCONVERTŒConvertcommandcode ŠDC.Wƒ1’#ofchannelstoconvert0ŠDC.Wƒ0’Channeltoconvert(Dynamicallychanged)ŠDC.Wƒ1’#ofconversions%ŠDC.Lƒ0’BufferaddressofconversionsŠDC.Wƒ01‘Wakeupwhendone7CLEN_DAƒEQU„*-CONV_DAŠLengthofCONVERTparameterblock*2*‚OPENcommandparameterblockfortheA/Ddriver:*OPEN_ADƒDC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒOPENOpencommandcode-ŠDC.Wƒ0’Channeltoopen(Dynamicallychanged)4OLEN_ADƒEQU„*-OPEN_ADŠLengthofOPENparameterblock*5*‚CONVERTcommandparameterblockfortheA/Ddriver:*CONV_ADƒDC.Wƒ0’Returnedstatusfromdriver"ŠDC.WƒCONVERTŒConvertcommandcode ŠDC.Wƒ1’#ofchannelstoconvert )ŠDC.Wƒ0’CommandID(returnwhencomplete)0ŠDC.Wƒ0’Channeltoconvert(Dynamicallychanged) ŠDC.Wƒ00‘Channelcompletioncode%ŠDC.Lƒ0’BufferaddressofconversionsŠDC.Wƒ2’BuffersizeinbytesŠDC.Wƒ0’Controlfield7CLEN_ADƒEQU„*-CONV_ADŠLengthofCONVERTparameterblock*@*‚CLOSEcommandparameterblockfortheA/DandtheD/Adrivers:)CLSBLK„DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒCLOSEŽClosecommandcodeCLOSLENƒEQU„*-CLSBLK ŠNEXTWB ŠPAGE N*******************************************************************************Ì**œMESSAGES¡**Ì*N****************************************************************************** ŠSECTIONMESSAGES CHEAD†DC.BƒCR,LF,LF,'MVME600&MVME605DriverTestProgram',CR,LF,LF HEADE…EQU„*-1ŠNEXTWB1MESS1…DC.Bƒ'…Numberofthechanneltoconvert‚>'MESS1E„EQU„*-1ŠNEXTWB4MESS5…DC.Bƒ'‚Valuetobeconverted($000-$FFF)‚>'MESS5E„EQU„*-1ŠNEXTWBMESS8…DC.Bƒ'Enteredvalue='MESS8E„EQU„*-1ŠNEXTWB#MESS9…DC.Bƒ'=Resultvalue.',CR,LFMESS9E„EQU„*-1ŠNEXTWB6MESS10„DC.BƒCR,LF,'<<>>',CR,LFMESS10EƒEQU„*-1ŠNEXTWB2MESS11„DC.BƒCR,LF,'<<<ƒConversionsdoneƒ>>>',CR,LFMESS11EƒEQU„*-1ŠNEXTWB3BADOPN_DADC.BƒCR,LF,'***OPENABORTEDD/A***--'BOPEN_DA‚EQU„*-1ŠNEXTWB9BADCNV_DADC.BƒCR,LF,'***CONVERSIONABORTEDD/A***--'BCNV_DAƒEQU„*-1ŠNEXTWB4BADCLS_DADC.BƒCR,LF,'***CLOSEABORTEDD/A***--'BCLS_DAƒEQU„*-1ŠNEXTWB3BADOPN_ADDC.BƒCR,LF,'***OPENABORTEDA/D***--'BOPEN_AD‚EQU„*-1ŠNEXTWB9BADCNV_ADDC.BƒCR,LF,'***CONVERSIONABORTEDA/D***--'BCNV_ADƒEQU„*-1ŠNEXTWB4BADCLS_ADDC.BƒCR,LF,'***CLOSEABORTEDA/D***--'BCLS_ADƒEQU„*-1ŠNEXTWB+STATUSMƒDC.Bƒ'ErrorcodereturnedinD0='STATUSME‚EQU„*-1ŠNEXTWBCRLF†DC.BƒCR,LF CRLFE…EQU„*-1ŠNEXTWBSPACE…DC.Bƒ'„'SPACE_ENDEQU„*-1ŠNEXTWBŠPAGEN*******************************************************************************Ì**–PROGRAMƒSECTION™**Ì*N****************************************************************************** ŠSECTIONCODE PROGSTRTŠLEA„STACK(PC),A7.ŠLEA„PBA(PC),A4‰GetProgramBaseAddress(PBA)?ŠMOVE.LBUFOFST(PC),D0…D0=offsettofindtheconversiontableŠNEG.L‚D0–fromPBA3ŠLEA„(A4,D0.L),A0‡AddressforD/Aconversion) bufferFŠMOVE.LA0,BUFADR_DA-PBA(A4)Savetheaddressoftheconversionbuffer@ŠMOVE.LA0,CONV_DA+$A-PBA(A4)thephysicaladdressofthebuffer3ŠADD.L‚#BUFSIZE,A0ˆAddressforA/DconversionbuferFŠMOVE.LA0,BUFADR_AD-PBA(A4)Savetheaddressoftheconversionbuffer@ŠMOVE.LA0,CONV_AD+$C-PBA(A4)thephysicaladdressofthebuffer &ŠOUTPUTHEAD,HEADE‰Displaytheheading N*-----------------------------------------------------------------------------***‰Getthenumberofthechanneltoconvert*N*-----------------------------------------------------------------------------GETCHAN.ŠOUTPUTMESS1,MESS1E‡ChannelnumbertoconvertŠINPUT‚INPUTBUF,INPUTBUF+8ŠLEA„INPUTBUF(PC),A0)ŠBSR„CVT2ConvertASCIIdecimaltobinary'ŠIF.LD0#0OR.LD0#3THEN.S ŒBRAGETCHANŠENDI@ŠMOVE.WD0,OPEN_DA+6-PBA(A4)ChannelnumberforD/AOPEN„commandCŠMOVE.WD0,CONV_DA+6-PBA(A4)ChannelnumberforD/ACONVERTcommand@ŠMOVE.WD0,OPEN_AD+4-PBA(A4)ChannelnumberforA/DOPEN„commandCŠMOVE.WD0,CONV_AD+8-PBA(A4)ChannelnumberforA/DCONVERTcommand **‰C=Constantlevelwaveform*)ŒBSR„GETVAL‹ReturnsD3=ValuetoconvertŒMOVE.W#1,CONV_DA+8-PBA(A4)@ŒMOVE.LBUFADR_DA(PC),A0‚GettheaddressoftheconversiontableŒMOVE.W#0,D1ŒZerodelay%ŒMOVE.WD1,(A0)+‰D1=Delayvalue=0&ŒMOVE.WD3,(A0)+‰D3=ValuetoconvertBŒMOVE.WD3,INPUT_VALUE-PBA(A4)‚Savetheuserentereddigitalvalue%*¢forlatercomparisonwithA/DvalueŒPAGEN*-----------------------------------------------------------------------------**‰Starttheconversionshere*N*-----------------------------------------------------------------------------**ƒOPENTHED/ACHANNEL*ŠLEA„CMRBLK(PC),A0ŠLEA„OPEN_DA(PC),A1ŠMOVE.L#'DAC1',$4(A0)ŠMOVE.LA1,$14(A0)ŠMOVE.W#OLEN_DA,$18(A0)7ŠMOVE.L#CMR,D0ŒHereweperformanexecutiverequesttoŠTRAPƒ#1‘invokeCMR.1ŠIFTHEN.SŒCMRreturnsastatuscodeinD0.BŒMOVE.LD0,STATUS-PBA(A4)/ŒOUTPUTBADOPN_DA,BOPEN_DA‚***OPENABORTED***ŒBRA.L‚SHOW_D0ŠENDI**ƒOPENTHEA/DCHANNEL*ŠLEA„CMRBLK(PC),A0ŠLEA„OPEN_AD(PC),A1ŠMOVE.L#'AD01',$4(A0)ŠMOVE.LA1,$14(A0)ŠMOVE.W#OLEN_AD,$18(A0)7ŠMOVE.L#CMR,D0ŒHereweperformanexecutiverequesttoŠTRAPƒ#1‘invokeCMR.1ŠIFTHEN.SŒCMRreturnsastatuscodeinD0.BŒMOVE.LD0,STATUS-PBA(A4)/ŒOUTPUTBADOPN_AD,BOPEN_AD‚***OPENABORTED***ŒBRA.L‚SHOW_D0ŠENDI**ƒDOCONVERSIONS*3ŠOUTPUTMESS10,MESS10E…<<<ƒStartingconversionsƒ>>> ŒLEA„CMRBLK(PC),A0ŒLEA„CONV_DA(PC),A1ŒMOVE.L#'DAC1',$4(A0)ŒMOVE.LA1,$14(A0)ŒMOVE.W#CLEN_DA,$18(A0)5ŒMOVE.L#CMR,D0ŠTellthedrivertodotheconversionsŒTRAPƒ#1*(*ƒDoawaituntilthedriverwakesusup*ŒMOVE.L#19,D0ŒTRAPƒ#1 ŒMOVE.WCONV_DA(PC),D01ŒIFTHEN.SŒCMRreturnsastatuscodeinD0.BŽMOVE.LD0,STATUS-PBA(A4)4ŽOUTPUTBADCNV_DA,BCNV_DAƒ***CONVERSIONABORTED***ŽBRA.L‚SHOW_D0ŒENDI  ŒLEA„CMRBLK(PC),A0ŒLEA„CONV_AD(PC),A1ŒMOVE.L#'AD01',$4(A0)ŒMOVE.LA1,$14(A0)ŒMOVE.W#CLEN_AD,$18(A0)5ŒMOVE.L#CMR,D0ŠTellthedrivertodotheconversionsŒTRAPƒ#1*A*‚THEA/DDRIVERWILLONLYRETURNWHENCHANNELHASBEENCONVERTED*ŒMOVE.WCONV_AD(PC),D01ŒIFTHEN.SŒCMRreturnsastatuscodeinD0.BŽMOVE.LD0,STATUS-PBA(A4)4ŽOUTPUTBADCNV_AD,BCNV_ADƒ***CONVERSIONABORTED***ŽBRA.L‚SHOW_D0ŒENDI 'ŒOUTPUTMESS8,MESS8E‡'ENTEREDVALUE=' ŒCLR.L‚D04ŒMOVE.WINPUT_VALUE-PBA(A4),D0‚GettheenteredvalueŒBSR„BHLCVTŽConverttoASCIIŒMOVE.LD2,NUMBER-PBA(A4)ŒMOVE.LD3,NUMBER+4-PBA(A4)0ŒOUTPUTNUMBER,NUMBER+7…Outputtheenteredvalue0ŒOUTPUTSPACE,SPACE_END…'„'(outputsomespaces) 7ŒMOVE.LBUFADR_AD(PC),A0„PointtoresultbufferforA/D ŒCLR.L‚D0ŒMOVE.W(A0),D0Gettheresult"ŒAND.W‚#$0FFF,D0‹Resultis12bitsŒBSR„BHLCVTŽConverttoASCIIŒMOVE.LD2,NUMBER-PBA(A4)ŒMOVE.LD3,NUMBER+4-PBA(A4)/ŒOUTPUTNUMBER,NUMBER+7…Outputtheresultvalue'ŒOUTPUTMESS9,MESS9Eˆ'=resultvalue.' ŒBRA.S‚EXIT :SHOW_D0ƒMOVE* .LSTATUS(PC),D0†Getthestatusvaluereturned'SHOW1_D0‚BSR„BHLCVTConvertittoASCII9ŠMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŠMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytesŠOUTPUTSTATUSM,STATUSMEŠOUTPUTNUMBER,NUMBER+7ŠOUTPUTCRLF,CRLFE ŠBRA.S‚EXIT  CHECKQ3ŠCMP.B‚#'Q',INPUTBUF-PBA(A4)DotheywanttoQuit? ŠBEQ.S‚EXIT3ŠCMP.B‚#'.',INPUTBUF-PBA(A4)DotheywanttoQuit? ŠBEQ.S‚EXITŠRTS  EXIT**‚CLOSETHECHANNELS:*ŠLEA„CMRBLK(PC),A0ŠLEA„CLSBLK(PC),A1ŠMOVE.L#'DAC1',$4(A0)ŠMOVE.LA1,$14(A0)ŠMOVE.W#CLOSLEN,$18(A0)1ŠMOVE.L#CMR,D0ŒTellCMRtoclosetheD/AchannelŠTRAPƒ#1ŠIFTHEN.SŒMOVE.LD0,STATUS-PBA(A4)/ŒOUTPUTBADCLS_DA,BCLS_DAƒ***CLOSEABORTED***ŠENDI ŠLEA„CMRBLK(PC),A0ŠLEA„CLSBLK(PC),A1ŠMOVE.L#'AD01',$4(A0)ŠMOVE.LA1,$14(A0)ŠMOVE.W#CLOSLEN,$18(A0)1ŠMOVE.L#CMR,D0ŒTellCMRtoclosetheD/AchannelŠTRAPƒ#1ŠIFTHEN.SŒMOVE.LD0,STATUS-PBA(A4)/ŒOUTPUTBADCLS_AD,BCLS_ADƒ***CLOSEABORTED***ŠENDI /ŠOUTPUTMESS11,MESS11E…<<<ƒConversionsdoneƒ>>> "ŠMOVE.L#15,D0TerminatethistaskŠTRAPƒ#1 *=*‚Routinetogetthedigitalvaluetobeconvertedtoanalog:*GETVAL8ŠOUTPUTMESS5,MESS5E‡Valuetobeconverted($000-$FFF)ŠINPUT‚INPUTBUF,INPUTBUF+8ŠLEA„INPUTBUF(PC),A0!ŠBSR„ASCVAL‹D3=ValuetoconvertŠRTS ŠEND„PROGSTRTééééé=/*=/*†M600DRV.TEST605.AF=/*,=/*†TEST600testprogramassemblychainfile=/*6=/*†Thecommandlinewillacceptargumentsasfollows:=/*;=/*‹Argument01…\1=Outputfileassemblylistingordevice=/*H=/*†Thefollowingshowstheassemblychainsequence.‚InthisexampletheH=/*†NULLdevicewaschosenasArgument01,however,theusercouldifhe5=/*†sodesiredhaverequestedanoutputlistingfile.=/*=/*=CHAINTEST600.AF#NULL=/*-=/*†Defaultargument01isM600DRV.TEST600.LS=/*=/IFC \1ƒ=ARGM600DRV.TEST600.LS=/ENDIF=/*4=ASM M600DRV.TEST600.SA,M600DRV.TEST600.RO,\1;RZ=100=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDéé* éééC'M605DRV TEST605 SAXXWûbbTEST605 AF±±bbN*******************************************************************************Ì**Ì**šMVME605TestProgramž**Ì**Ì*N********************************************************************************6* This program was written to test the MVME605 driver.**    *‰ModificationHistoryN*-----------------------------------------------------------------------------*03/01/84‡KEGInitialwriting ŠPAGE*1.‚Introduction*C*‰ThisprogramwaswrittentotesttheMVME605driverprogram.‚ThisK*‚testprogramwillaskquestionswillinitializetheconversiontablewithN*‚thedelaysandconversionvaluesgivenorwithvaluesthatthisprogramwillL*‚generate.‚Ifaperiod"."ora"Q"isenteredforanyofthequestionstheD*‚programwillterminateandreturnbacktoVERSAdos.‚Youcanusean,*‚oscilloscopetochecktheoutputwaveform.**2.‚ExplanationofQuestions*'*‰A.‚Numberofthechanneltoconvert…>;*Thisquestionaskswhichchannelyouwouldliketodothe>*conversionson.‚Theanswermustbe(0-63),decimal,orthe/*testprogramwillaskforadifferentanswer.*'*‰B.‚(C)onstantlevel‚(S)awtoothwave„>?*Thisquestionasksforthetypeofwaveformyouwouldliketo>*testfor.‚Ananswerof"C"willthenaskyouquestion#Cand?*thenquestion#D.‚Ananswerof"S"willthenaskyouquestion8*#Candthenquestion#E.‚Ananswerof"O"willaskyou?*question#Candthenquestion#Duntilyouanswerquestion#C>*withan$FFFFtoexit.‚The"O"optionisusedtocreateyour6*ownwaveform.‚Thiswillenabletheusertocreat‚the<*conversiontablewithhisowndelaysandconversionvalues* *‰C.‚DelaybetweenconversionsŒ>;*Thisquestionasksforthedelayoftheconversionvalue.?*Thisvaluecanbefrom$0to$FFFFwith$0beingnodelayand<*$FFFFbeingthelongestdelay.‚Eachdelayisapproximately*1(one)millisecondofdelay.***‰D.‚Valuetobeconverted($000-$FFF)‚>+ P6YAa:i;qLyCT‰F‘D™E¡^=*Thisquestionasksforthevaluetobeconverted.‚Thevalue<*canbefrom$000to$FFFwith$000beingthemostnegative;*valueand$FFFbeingthemostpositivevalue.‚Question#F*followsthisquestion.*"*ValueŠ5voltscaleŠ10voltscale* equivalentequivalent4*--------------------------------------------------*$FFFŒ+5.0volts+10.0volts*$C00Œ+2.5“+5.0*$8000.0”0.0*$400Œ-2.5“-5.0*$000Œ-5.0“-10.0*%*‰E.‚Incrementforconversionvalue‡>>*Thisquestionasksfortheincrementvaluethatwillbeused;*tocalculatethesawtoothwaveformwith.‚Thisishowmuch@*thesawtoothwaveformwillbeincrementedforeachconversion.<*Thisvaluecanbefrom$000to$FFF.‚Anythingoutsidethis>*rangewillnotbeacceptedandthetestprogramwillaskfor*adifferentanswer.*(*‰F.‚Numberoftimestodoconversions„>?*Thisquestionasksfortheamountoftimestorunthroughthe*conversiontable. ŠPAGE *‚Examples:*B*‰Thefollowingexampleshouldmakeaconstantlevelat+5.0volts:*‰iftheinputvoltageontheVME605boardis+10.0volts.**‰MVME605DriverTestProgram**&*ŒNumberofthechanneltoconvert‚>0&*‹(C)onstantlevel‚(S)awtoothwave‚>C*“Delaybetweenconversions‚>1,*‰Valuetobeconverted($000-$FFF)‚>$C00'*‹Numberoftimestodoconversions‚>1    E*‰Thefollowingexamplewillcreateasawtoothwavethatwillbefrom-*‰theminimumvoltagetothemaximumvoltage.**‰MVME605DriverTestProgram**&*ŒNumberofthechanneltoconvert‚>0&*‹(C)onstantlevel‚(S)awtoothwave‚>S*“Delaybetweenconversions‚>0'*ŽIncrementforconversionvalue‚>$100(*‹Numberoftimestodoconversions‚>50  ŠPAGE,*£ASCVAL,BHLCVT,andCVT2arecommonlyused**£functionswhicharemodulesinalibrary(*£filecalledUTILIB.RO.‚Acalltothese'*£functionsareincludedinthissource)*£program,whichisprovidedwithanXREF&*£declaration.‚Thisalsorequiresthat'*£UTILIB.RObeavailabletothelinkage$*£editorduringthelinkingprocess.%*£SeeTEST605.LFforlinkchainfile. -ŠXREFƒASCVALConvertsASCIItoabinaryvalue$*£ThisroutinewillconvertanASCII,*£characterstringrepresentingadecimalor,*£hexidecimalvaluetotheequivalentbinary,*£value.‚Ifadollarsign($)isencountered&*£hexidecimalconversionisperformed;,*£otherwisedecimalconversionisperformed.+*£Anemptycharacterstringfieldpassedto,*£thisfunctioninA0producesazerobinary'*£value.‚Conversionterminateswhenthe)*£firstinvalidcharacterisencountered.'*£ENTRY:‚A0-StartingaddressofASCII*°characterstringtoconvert#*£EXIT:‚D1-Characterthatcaused *°termination%*«D2-Classcodeofterminatingchar"*«D3-Binaryresultofconversion*«A0-Addressofthecharacter *°followingtheterminatingchar 8ŠXREFƒBHLCVTConverts4-bytebinaryvaluetoASCIIdigit)*£Thisroutinewillconvertalongbinary-*£wordvaluetoahexadecimalvalueexpressed)*£asan8characterASCIIstring.‚Leading*£zerosaresuppressed.,*£ENTRY:‚D0.L-Binaryvaluetobeconverted(*£EXIT:‚D2.L-Fourhighorderbytesof*²convertedvalue *«D3.L-Fourloworderbytesof*²convertedvalue   6ŠXREFƒCVT2ConvertstwoASCIIdecimaldigitstobinary-*£ThisroutinewillconverttwoASCIIdecimal(*£digitstotheequivalentbinaryvalue.+*£Anemptycharacterstringfieldpassedto,*£thisfunctioninA0producesazerobinary**£value.‚Conversionterminateswhenanon-*£decimaldigitisencountered)*£ENTRY:‚A0-Addressofmostsignificant*°ASCIIdecimaldigit)*£EXIT:‚D0-Binaryresultofconversion!*«A0-Addressoftheterminating *°characterŠPAGE ;BUFSIZEƒEQU„$8000ŽTh+ islabeldefinesthevalueforthesize$*£ofthedelayandconversiontable. 6CLOSE…EQU„2’Thislabeldefinesthecodevaluethatthe+*£D/Adriverrecognizesasthecommandcode*£foraCLOSEcommand. @CLSIZE„EQU„BUFSIZE/4ŠThislabeldefinesthevalueforperforming,*£alooptofilltheconversiontablewitha)*£certaindelayandconversionvalue.‚The-*£sizeisBUFSIZE/4becausethereare2words,*£perentry,1wordfordelayand1wordfor-*£theconversionvalue,andthereare2bytes *£perword. 4CMR‡EQU„60‘Thislabeldefinesthecodevaluethatwe,*£mustusetotelltheoperatingsystemthat+*£wewanttoinvokeCMR,theRMS68KChannel*£ManagementRoutine. /CODE†EQU„8’Thislabeldefinesthenumberofthe%*£programsectionthatcontainscode.-*£Section8isarelativelyarbitrarysection(*£butitisthesectionwherethesystem(*£expects(bydefault)toseecodefora*£program,(readonly). 8CONVERTƒEQU„3’Thislabeldefinesthecodevaluethatthe+*£D/Adriverrecognizesasthecommandcode*£foraCONVERTcommand. 5CRˆEQU„$0DThislabeldefinesthecodeforacarriage*£return 1CRT‡EQU„6’ThislabeldefinesthevaluefortheLU*£numberfortheCRT. 4DATA†EQU„0’Thislabeldefinesthenumberofthedata**£sectionthatcontainsdata.‚Section0is+*£arelativelyarbitrarysection,butitis-*£thesectionwherethesystemexpectstosee"*£codefordata(read/writearea). 6KEYBOARD‚EQU„5’ThislabeldefinesthevaluefortheLU*£numberforthekeyboard. 6LFˆEQU„$0AThislabeldefinesthecodeforalinefeed 3MESSAGES‚EQU„1’Thislabeldefinesthenumberofthe,*£messagessectionthatwillcontainallthe%*£messages.‚Section1isarelatively*£arbitrarysection. 5OPEN†EQU„1’Thislabeldefinesthecodevaluethatthe+*£D/Adriverrecognizesasthecommandcode*£foranOPENcommand. 3READ†EQU„1’Thislabeldefinesthecodevalueofthe&*£IOSrequestcodeforaREADcommand. ŠMOVE.LA0,IOSOUT+16-PBA(A4)SettheendingaddressofmessageŠLEA„IOSOUT(PC),A0ŠTRAPƒ#2ŠENDM ŠPAGE 2ŠOPT„PCSWeuseaPCSoptionsotheassemblerwill%*£forcePCrelativeaddressingwithin(*£SECTION.‚ForcesPCrelativeaddressing-*£(wheneversuchanaddressingmodeislegal))*£inaninstructionwhichoccurswithina'*£relocatableSECTIONandreferencesan,*£operandinarelocatableSECTION(neednot**£bethesameSECTIONastheinstruction).,*£Failuretoresolvesucnareferenceintoa-*£16-bitdisplacementfromthePCwillresult)*£inanerror.‚Thisoptionmaybeusedto+*£forcepositionindependentcode;however,(*£thisoptiondoesnotforcePCrelative,*£addressingofabsoluteoperandsorunknown*£forwardreferences. ŠPAGE N**********************************************, *********************************Ì**™DATAƒSECTIONœ**Ì*N****************************************************************************** ŠSECTIONDATA =D_ABUF„DS.BƒBUFSIZEŒThisisthebufferareathatwillcontain**£thedelayandtheconversionvaluetobe *£converted. $PBA‡EQU„*’ProgramBaseAddress(PBA)%*£Thislabelisusedtodesignatethe+*£beginningoftheprogram.‚Thisisusedto'*£makereferencestootherpartsofthe*£program,relocatable. 9ŠDS.WƒSTACKLEN‹ThisisthestackareafortheVME605test2STACK…EQU„*’program.‚Registersandotherimportant,*£informationwillbestoredonthestackas)*£theprogramisexecuted.‚Thestackarea'*£isdynamicandwillchangeduringthe *£executionofthetestprogram. 8BUFFADDR‚DS.Lƒ1’Thisisthestorageareafortheaddress,*£oftheconversiontable.‚Thisaddresswill-*£befiguredatexecutiontimesotheprogram*£willberelocatable. =INPUTBUF‚DS.WƒSTRNGLEN‹Thisisthestorageareafortheinput*£stringsthatareentered. 6DELAYVAL‚DS.Wƒ1’Thisisthestorageareaforthedelay(*£thatisenteredforthedelayforeach *£conversion. :BUFOFSTƒDC.LƒPBA-D_ABUF‰ThisistheoffsetfromPBAtothe'*£conversiontablesothattherelative**£addresscanbefoundtomaketheprogram*£relocatable. 9STATUS„DS.Lƒ1’Thiswillbethestorageareforthestatus,*£codethatisreturnedfromCMR.‚Thisvalue-*£willbedisplayedtoshowtheuserwhatthe*£errorcodewas.  NUMBER„DS.Lƒ2 1NUMT†DS.Lƒ1’Thisisthestorageforthenumberof&*£conversionstoperform.‚Thiswillbe,*£changeddynamicallyafterthequestionhas*£beenanswered. 5INC‡DS.Wƒ1’Thisisthestorageareafortheincrement**£thatwillbeusedtofigurethesawtooth *£waveform. ŠPAGE N*******************************************************************************Ì*!*–PARAMETERƒBLOCKS—**Ì*N****************************************************************************** ŠNEXTWB”ForceevenboundaryIOSOUTŠDC.Bƒ0’Requestcode"ŠDC.BƒWRITEŽFunctionspecificationŠDC.Wƒ8’OptionsŠDC.Bƒ0’StatusŠDC.BƒCRTLogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress   ŠNEXTWB”ForceevenboundaryIOSINŠDC.Bƒ0’Requestcode!ŠDC.BƒREADFunctionspecificationŠDC.Wƒ0’OptionsŠDC.Bƒ0’Status"ŠDC.BƒKEYBOARD‹LogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress  CMRBLK„DC.Bƒ7’InitiateI/OŠDC.BƒUNUSEDUnusedŠDC.WƒUNUSEDUnusedŠDC.Lƒ'DAC1'ChannelnameŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnused$ŠDC.Lƒ0’AddressofI/Ocontrolblock#ŠDC.Lƒ0’LengthofI/Ocontrolblock   *OPENBLKƒDC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒOPENOpencommandcodeŠDC.Wƒ1’#ofchannelstoopen-ŠDC.Wƒ0’Channeltoopen(Dynamicallychanged)4OPENLENƒEQU„*-OPENBLKŠLengthofOPENparameterblock   *CONVBLKƒDC.Wƒ0’Returnedstatusfromdriver"ŠDC.WƒCONVERTŒConvertcommandcode ŠDC.Wƒ1’#ofchannelstoconvert0ŠDC.Wƒ0’Channeltoconvert(Dynamicallychanged).ŠDC.Wƒ0’#ofconversions(Dynamicallychanged)%ŠDC.Lƒ0’BufferaddressofconversionsŠDC.Wƒ01‘Wakeupwhendone7CONVLENƒEQU„*-CONVBLKŠLengthofCONVERTparameterblock   )CLSBLK„DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒCLOSEŽClosecommandcodeCLOSLENƒEQU„*-CLSBLK ŠNEXTWB ŠPAGE N*******************************************************************************Ì**œMESSAGES¡**Ì*N****************************************************************************** ŠSECTIONMESSAGES 9HEAD†DC.BƒCR,LF,LF,'MVME605DriverTestProgram',CR,LF,LF HEADE…EQU„*-1ŠNEXTWB1MESS1…DC.Bƒ'…Numberofthechanneltoconvert‚>'MESS1E„EQU„*-1ŠNEXTWB*MESS3…DC.Bƒ'ŒDelaybetween, conversions‚>'MESS3E„EQU„*-1ŠNEXTWB1MESS4…DC.Bƒ'„(C)onstantlevel‚(S)awtoothwave‚>'MESS4E„EQU„*-1ŠNEXTWB4MESS5…DC.Bƒ'‚Valuetobeconverted($000-$FFF)‚>'MESS5E„EQU„*-1ŠNEXTWB2MESS6…DC.Bƒ'„Numberoftimestodoconversions‚>'MESS6E„EQU„*-1ŠNEXTWB/MESS7…DC.Bƒ'‡Incrementforconversionvalue‚>'MESS7E„EQU„*-1ŠNEXTWB0MESS10„DC.BƒCR,LF,'<<>>'MESS10EƒEQU„*-1ŠNEXTWB2MESS11„DC.BƒCR,LF,'<<<ƒConversionsdoneƒ>>>',CR,LFMESS11EƒEQU„*-1ŠNEXTWB,BADOPN„DC.BƒCR,LF,'***OPENABORTED***--'BADOPNEƒEQU„*-1ŠNEXTWB2BADCNV„DC.BƒCR,LF,'***CONVERSIONABORTED***--'BADCNVEƒEQU„*-1ŠNEXTWB-BADCLS„DC.BƒCR,LF,'***CLOSEABORTED***--'BADCLSEƒEQU„*-1ŠNEXTWB+STATUSMƒDC.Bƒ'ErrorcodereturnedinD0='STATUSME‚EQU„*-1ŠNEXTWBCRLF†DC.BƒCR,LF CRLFE…EQU„*-1 ŠNEXTWB ŠPAGE N*******************************************************************************Ì**–PROGRAMƒSECTION™**Ì*N****************************************************************************** ŠSECTIONCODE PROGSTRTŠLEA„STACK(PC),A7.ŠLEA„PBA(PC),A4‰GetProgramBaseAddress(PBA)?ŠMOVE.LBUFOFST(PC),D0…D0=offsettofindtheconversiontableŠNEG.L‚D0–fromPBA7ŠLEA„(A4,D0.L),A0‡AddthenegativeoffsettoPBAtogetEŠMOVE.LA0,BUFFADDR-PBA(A4)Savetheaddressoftheconversionbuffer@ŠMOVE.LA0,CONVBLK+$A-PBA(A4)thephysicaladdressofthebuffer &ŠOUTPUTHEAD,HEADE‰Displaytheheading N*-----------------------------------------------------------------------------***‰Getthenumberofthechanneltoconvert*N*-----------------------------------------------------------------------------GETCHAN.ŠOUTPUTMESS1,MESS1E‡ChannelnumbertoconvertŠINPUT‚INPUTBUF,INPUTBUF+8ŠLEA„INPUTBUF(PC),A0)ŠBSR„CVT2ConvertASCIIdecimaltobinary(ŠIF.LD0#0OR.LD0#63THEN.S ŒBRAGETCHANŠENDI?ŠMOVE.WD0,OPENBLK+6-PBA(A4)SavethechannelnumberinOPENBLK?ŠMOVE.WD0,CONVBLK+6-PBA(A4)SavethechannelnumberinCONVBLK N*-----------------------------------------------------------------------------*.*‰Get(C)onstantlevel‚or(S)awtoothwaveform*N*-----------------------------------------------------------------------------GETCLST<ŠOUTPUTMESS4,MESS4E‡(C)onstantlevelor(S)awtoothwaveform+ŠINPUT‚INPUTBUF,INPUTBUF+8GettheirchoiceŠMOVE.BINPUTBUF(PC),D0**£C=Constantlevel*£O=createyourOwnwaveform*£S=Sawtoothwaveform* **‰O=Ownwaveform*CŠIF.BD0#'O'THEN.S‚SeeiftheywanttodothereownwaveformŒMOVE.LBUFFADDR(PC),A2 ŒMOVE.LA2,A1%OWNVAL†BSR„GETDELAY‰Getadelayvalue<ŒIF.LD3#$FFFFTHEN.SD3=$FFFFmeansexit"O"option-ŽMOVE.WD3,(A1)+‰Storethedelayinthetable/ŽBSR„GETVAL‹Gogetthevaluefortheconversion ŽMOVE.WD3,(A1)+‰Savethatvalue ŽBRA„OWNVALŒENDI6ŒSUB.L‚A2,A1ŠFindthedifferencebetweenthebeg&end ŒMOVE.LA1,D01ŒDIVU.W‚#4,D0‰Divideby4because4bytes/commandŒMOVE.WD0,CONVBLK+8-PBA(A4)0ŒBRA„GETNUMTˆGogetthenumberoftimestodoitŠENDI **‰C=Constantlevelwaveform*ŠIF.BD0#'C'THEN.S7ŒBSR„GETDELAY‹Gogetthedelayvalueforeachconversio0ŒMOVE.WD3,DELAYVAL-PBA(A4)Savethedelayvalue)ŒBSR„GETVAL‹ReturnsD3=ValuetoconvertŒMOVE.W#1,CONVBLK+8-PBA(A4)?ŒMOVE.LBUFFADDR(PC),A0‚GettheaddressoftheconversiontableCŒMOVE.WDELAYVAL(PC),D1‚Getthedelayvaluetoputintobuffertabl!ŒMOVE.WD1,(A0)+‰D1=Delayvalue&ŒMOVE.WD3,(A0)+‰D3=Valuetoconvert0ŒBRA„GETNUMTˆGogetthenumberoftimestodoitŠENDI **‰S=Sawtoothwaveform*ŠIF.BD0#'S'THEN.L7ŒBSR„GETDELAY‹Gogetthedelayvalueforeachconversio0ŒMOVE.WD3,DELAYVAL-PBA(A4)SavethedelayvalueGETINCŒREPEAT3ŽOUTPUTMESS7,MESS7EƒIncrementforconversionvalueŽINPUT‚INPUTBUF,INPUTBUF+8ŽLEA„INPUTBUF(PC),A0 ŽBSR„ASCVALŒUNTIL.LD1#0+ŒIF.LD3#1OR.LD3#$0FFFTHEN.S ŽBRA„GETINCŒENDI8ŒMOVE.WD3,INC-PBA(A4)- ƒSavethenumberoftimestodoitCŒMOVE.WDELAYVAL(PC),D0‚Getthedelayvaluetoputintobuffertabl-ŒCLR.L‚D1Startwithamaximumnegativevalue;ŒMOVE.LBUFFADDR(PC),A0‚Gettheaddressofthebuffertable ŒMOVE.LA0,A1ŒMOVE.WINC(PC),D2 ŒREPEAT/ŽMOVE.WD0,(A1)+‡Movethedelayintothebuffer<ŽMOVE.WD1,(A1)+‡Movethedatatobeconvertedintothebuff ŽADD.W‚D2,D1ŒUNTIL.WD1#$0FFF ŒIF.WD1#$0FFFTHEN.S ŽSUB.W‚D2,D1ŒENDI ŒREPEAT/ŽMOVE.WD0,(A1)+‡Movethedelayintothebuffer<ŽMOVE.WD1,(A1)+‡Movethedatatobeconvertedintothebuff ŽSUB.W‚D2,D1ŒUNTIL.WD1#0 6ŒSUB.L‚A0,A1ŒFindthedifferencebetweenthebeg&end ŒMOVE.LA1,D01ŒDIVU.W‚#4,D0‹Divideby4because4bytes/commandŒMOVE.WD0,CONVBLK+8-PBA(A4)2ŒBRA.S‚GETNUMTˆGogetthenumberoftimestodoitŠENDI ŠBRA„GETCLSTN*-----------------------------------------------------------------------------*.*‰Getthenumberoftimetodotheconversions*N*-----------------------------------------------------------------------------GETNUMTŠREPEAT6ŒOUTPUTMESS6,MESS6E‡NumberoftimestodoconversionsŒINPUT‚INPUTBUF,INPUTBUF+8ŒLEA„INPUTBUF(PC),A0 ŒBSR„ASCVALŠUNTILD1#0+ŠIF.LD3#1OR.LD3#$FFFFTHEN.S ŒBRA„GETNUMTŠENDI8ŠMOVE.LD3,NUMT-PBA(A4)„Savethenumberoftimetodoit N*-----------------------------------------------------------------------------**‰Starttheconversionshere*N*-----------------------------------------------------------------------------**ƒOPENTHED/ACHANNEL*ŠLEA„CMRBLK(PC),A0ŠLEA„OPENBLK(PC),A1ŠMOVE.LA1,$14(A0)ŠMOVE.W#OPENLEN,$18(A0)7ŠMOVE.L#CMR,D0ŒHereweperformanexecutiverequestto.ŠTRAPƒ#1‘invokeCMR.‚ThevalueinD0tellsthe)*£operatingsystemthatwewanttoinvoke**£CMR,andthevalueinA0tellsCMRwhere&*£tofinditsparameterblock.‚TheCMR+*£parameterblockcontainsapointertothe(*£I/Ocommandblock,andtheI/Ocommand"*£blockspwcifiesanOPENcommand. 9ŠBNE.S‚BADOPENŒCMRreturnsastatuscodeinD0.B,andCMR+*£returnstheCC.Zbittoreflectthevalue'*£ofthestatuscodeinD0.B.‚Anonzero+*£statuscodeindicatesthatthedriverhas*£rejectedtheOPENcommand.**ƒDOCONVERSIONS*3ŠOUTPUTMESS10,MESS10E…<<<ƒStartingconversionsƒ>>>:ŠMOVE.LNUMT(PC),D7ˆD7=NumberoftimestodoconversionsŠFOR.LD6=#1TOD7DO.SŒLEA„CMRBLK(PC),A0ŒLEA„CONVBLK(PC),A1ŒMOVE.LA1,$14(A0)ŒMOVE.W#CONVLEN,$18(A0)5ŒMOVE.L#CMR,D0ŠTellthedrivertodotheconversionsŒTRAPƒ#1*'*ƒDoawaituntilthedrivewakesusup*ŒMOVE.L#19,D0ŒTRAPƒ#1 ŒMOVE.WCONVBLK(PC),D0ŒBNE.S‚BADCONVŠENDF**‚CLOSETHECHANNEL*ŠLEA„CMRBLK(PC),A0ŠLEA„CLSBLK(PC),A1ŠMOVE.LA1,$14(A0)ŠMOVE.W#CLOSLEN,$18(A0)1ŠMOVE.L#CMR,D0ŒTellCMRtoclosetheD/AchannelŠTRAPƒ#1ŠBNE.S‚BADCLOSE/ŠOUTPUTMESS11,MESS11E…<<<ƒConversionsdoneƒ>>> ŠBRA„EXIT BADOPENŠMOVE.LD0,STATUS-PBA(A4)+ŠOUTPUTBADOPN,BADOPNE…***OPENABORTED***ŠBRA.S‚SHOW_D0 BADCONVŠMOVE.LD0,STATUS-PBA(A4)1ŠOUTPUTBADCNV,BADCNVE…***CONVERSIONABORTED***ŠBRA.S‚SHOW_D0 BADCLOSEŠMOVE.LD0,STATUS-PBA(A4),ŠOUTPUTBADCLS,BADCLSE…***CLOSEABORTED*** :SHOW_D0ƒMOVE.LSTATUS(PC),D0†GetthestatusvaluereturnedŠBSR„BHLCVTConvertittoASCII9ŠMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŠMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytesŠOUTPUTSTATUSM,STATUSMEŠOUTPUTNUMBER,NUMBER+7ŠOUTPUTCRLF,CRLFE ŠBRA.S‚EXIT  CHECKQ3ŠCMP.B‚#'Q',INPUTBUF-PBA(A4)DotheywanttoQuit? ŠBEQ.S‚EXIT3ŠCMP.B‚#'.',INPUTBUF-PBA(A4)DotheywanttoQuit? ŠBEQ.S‚EXITŠRTS  EXIT"ŠMOVE.L#15,D0TerminatethistaskŠTRAPƒ#1 GETDELAY.ŠOUTPUTMESS3,MESS3E‡DelaybetweenconversionsŠINPUT‚INPUTBUF,INPUTBUF+8 ŠBSR„CHECKQŠLEA„INPUTBUF(PC),A0 ŠBSR„ASCVAL ŠTST.L‚D1 ŠBEQ„GETDELAY+ŠIF.LD3#0OR.LD3#$FFFFTHEN.S ŒBRA„GETDELAYŠENDI ŠRTS   GETVAL8ŠOUTPUTMESS5,- MESS5E‡Valuetobeconverted($000-$FFF)ŠINPUT‚INPUTBUF,INPUTBUF+8 ŠBSR„CHECKQŠLEA„INPUTBUF(PC),A0!ŠBSR„ASCVAL‹D3=ValuetoconvertŠRTS   ŠEND„PROGSTRT=/*=/*†M605DRV.TEST605.AF=/*,=/*†TEST605testprogramassemblychainfile=/*6=/*†Thecommandlinewillacceptargumentsasfollows:=/*;=/*‹Argument01…\1=Outputfileassemblylistingordevice=/*H=/*†Thefollowingshowstheassemblychainsequence.‚InthisexampletheH=/*†NULLdevicewaschosenasArgument01,however,theusercouldifhe5=/*†sodesiredhaverequestedanoutputlistingfile.=/*#=/*=CHAINM605DRV.TEST605.AF#NULL=/*-=/*†Defaultargument01isM605DRV.TEST605.LS=/*=/IFC \1ƒ=ARGM605DRV.TEST605.LS=/ENDIF=/*4=ASM M605DRV.TEST605.SA,M605DRV.TEST605.RO,\1;RZ=100=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDééééé©'M610DRV INPTST SA¾¾ÒbbINTSTASMSAÏÏ'MbbTEST610 SAøøF[bbINTSTASMAFAAbbTEST610 AFJJbb"program Input_Test (input,output); const ƒWAIT„=0; ƒOPEN„=1; ƒCLOSEƒ=2; ƒSTAT„=5; ƒENABLE‚=6; ƒDISABLE=7; typeƒbyte=-128..+127;ƒword=-32768..+32767; ƒopen_cdb=packedrecordchan_no:word;config‚:wordŽend; ƒcommand=packedrecordstatus:word; codeƒ:word;casebooleanof’true‚:(chan_mask:word);’false:(chan_cnt‚:word; ›cdb‡:array[0..7]ofopen_cdb)end; ƒinit_IO=packedrecorddone_flag:word; code…:byte;s. ub_code:byte;unused_1:word;(mnemonic:packedarray[1..4]ofchar;)unused_2:packedarray[1..12]ofbyte;cmd_adr‚:^command;cmd_len‚:wordend; )ƒtask_name=packedarray[1..4]ofchar; varƒcmd_blk…:command;ƒcmd_char„:string[8];ƒtask_ID…:task_name;ƒtask_cnt,i:integer;ƒinit_blk„:init_IO;ƒin_char…:char; *procedure p$force (var fil:text); forward; 4procedure clone_tasks (task_cnt : integer); forward; .function send_command (var init_blk : init_IO;*—vartask_ID:task_name):word;forward;{$E}function hex_in : word; varƒnum_str:string[6];ƒnum,i‚:word;ƒerrorƒ:boolean; beginƒrepeat†begin ‰error:=FALSE;‰readln(num_str); ‰num:=0;‰i:=1; #‰while(i<=length(num_str))and7(((num_str[i]>='0')and(num_str[i]<='9'))or7‘((num_str[i]>='A')and(num_str[i]<='F'))ƒ)doŒbeginifnum_str[i]>='A'9’thennum:=num*16+ord(num_str[i])-ord('A')+105’elsenum:=num*16+ord(num_str[i])-ord('0'); i:=i+1Œend;‰ifi<=length(num_str)thenŒbeginerror:=TRUE;+write('Invalidhexnumber-reenter>');p$force(output)Œend†endƒuntilerror=FALSE;ƒhex_in:=num end;{$E} procedure hex_out ( num : word); varƒnum_str:string[4];ƒi,j…:integer; begin ƒnum_str:='„';ƒfori:=4downto1do†begin‰j:=nummod16;‰num:=numdiv16; ‰ifj>=10¶k¿h,Œthennum_str[i]:=chr(j-10+ord('A'))'Œelsenum_str[i]:=chr(j+ord('0'))†end;ƒwriteln(num_str)end;{$E}procedure enter_command; varƒstatus„:word; ƒi‰:integer; beginƒwithinit_blk.cmd_adr^do„begin†casecmd_char[1]of‰'W':code:=WAIT;‰'O':code:=OPEN;‰'C':code:=CLOSE;‰'E':code:=ENABLE;‰'D':code:=DISABLE;‰'S':code:=STAT†end;†ifcode<>WAITthenˆbegin%Šwrite('Enterchannelmnemonic>');Šp$force(output);Šreadln(init_blk.mnemonic);Šifcode<>OPEN then”{AllcommandsexceptOPEN}begin*“write('Enterchannelsmaskinhex.>');“p$force(output);“chan_mask:=hex_inendelse”{OPENcommand}begin /“write('Enternumberofchannelstoopen>');“p$force(output);“readln(chan_cnt); “fori:=0tochan_cnt-1do–begin#™write('Enterchannelnumber>');™p$force(output);™readln(cdb[i].chan_no);2™write('Enterchannelconfigurationinhex.>');™p$force(output);™cdb[i].config:=hex_in–end Œend‚{else} ˆend;{if},†status:=send_command(init_blk,task_ID);†ifcode<>WAITˆthen‰begin‹ifcode=STATŽthenbegin’write('ChannelStatus=');’p$force(output);’hex_out(chan_mask)end;‹write('CommandStatusis');‹p$force(output);‹hex_out(status)‰end „end‚{with}end;{$E} begin‚{main} ƒwithinit_blkdo†begin ‰code:=7;‰sub_code:=0;‰new(cmd_adr)†end; +ƒwrite('Enternumberoftasks(1-26)>');ƒp$force(output);ƒreadln(task_cnt); ƒtask_ID:='INPx'; ƒclone_tasks(task_cnt); ƒwhiletruedo†fori:=1totask_cntdo‡repeat‰begin(Œtask_id[4]:=chr(ord('A')+i-1);$Œwriteln('**Task',task_ID,'**');EŠwrite('Command(O-pen,C-lose,E-nable,D-isable,S-tatus,W-ait)>');Œp$force(output);Œreadln(cmd_char); Œif(length(cmd_char)<>0)and+(cmd_char[1]in['W','O','C','E','D','S'])then‚enter_command‰end‡untillength(cmd_char)=0end. *‰INCLUDE9995.&.TR1.EQŠINCLUDE9995.&.TR1.EQ*‰INCLUDE9995.&.TR1RTCD.EQŠINCLUDE9995.&.TR1RTCD.EQ*‰INCLUDE9995.&.EXE.EQŠINCLUDE9995.&.EXE.EQ*‰INCLUDE9995.&.LV5.EQŠINCLUDE9995.&.LV5.EQ*‰INCLUDE9995.&.M610CMD.EQŠINCLUDE9995.&.. M610CMD.EQŠPAGE*H* VME 610/620 Driver Assembly language test routines. These routines are;* called from a Pascal test task that performs terminal I/OŠSPC„2 ŠSECTION9ŠXDEFƒCLONE_TA I*‚CreatethespecifiednumberoftesttasksthatsharethecodeandstackL* segments of the PASCAL program that is calling this routine. Then allocate.* an ASQ for each task and start them running. ,CLONE_TA‚MOVE.L(A7)+,A4‹SavereturnaddressŠSPC„2$ŠMOVE.L(A7)+,D7‹Savetaskcount-1 ŠSUB.L‚#1,D7ŠSPC„2:ŠLEA.L‚-100(A7),A7ˆAllocateparameterblockspaceonstackŠSPC„27ŠMOVE.LA7,A0ŽStoreCRTCBparameterblockaddressinA0ŠSPC„2'*‚InitializeCreateTCBparameterblock @ŠMOVE.L#'INPA',CRTTSK(A0)ƒNametasksalphabeticallywithinsameŠCLR.L‚CRTSES(A0)‰sessionŠSPC„23ŠMOVE.W#CTOPMP,CRTOPT(A0)PropogatemonitoroptionŠSPC„21ŠMOVE.B#$7F,CRTIPR(A0)„Runtaskatmax.priorityŠMOVE.B#$7F,CRTLPR(A0)ŠSPC„2-ŠMOVE.W#$2000,CRTATT(A0)‚TaskdumpattributeŠSPC„2.ŠLEA.L‚TASKENT(PC),A1…TaskentrypointaddressŠMOVE.LA1,CRTENT(A0)ŠSPC„2ŠMOVE.W#0,CRTUID(A0)†User0ŠSPC„2* Create TCB's %ŠMOVE.WD7,D1ŽInitializeloopcounterŠSPC„2)TCBLOOPƒMOVE.L#CRTCB,D0ŠIssueCRTCBcallŠTRAPƒ#1 ŠBEQ.S‚TCBOK ŠBSR„ERRORŠSPC„2ETCBOK…ADD.B‚#1,CRTTSK+3(A0)„Updatetasknameandloopuntilalltasks#ŠDBRAƒD1,TCBLOOP‰havebeencreated.ŠSPC„25* Initialize Share Segment directive parameter block. #ŠMOVE.L#'INPA',SEGTCB(A0)ƒTaskname<ŠMOVE.W#SGOPPA,SEGOPT(A0)ƒLogical=physicaladdressoptionŠSPC„23ŠMOVE.W#SGATSS,SEGATT(A0)ƒSessionsharablesegmentŠSPC„2,* Share code and data segments to each task. %ŠMOVE.LD7,D1ŽInitializeloopcounter ŠMOVE.LA7,A1ŠSPC„2ÇHÐIØ9àBèB=SEGLOOPƒMOVE.L#SHRSEG,D0‰SharethecodesegmenttoeachtaskŠMOVE.L#'CODE',SEGNAM(A1) ŠMOVE.LA1,A0ŠTRAPƒ#1 ŠBEQ.S‚SEG010 ŠBSR„ERRORŠSPC„2DSEG010„MOVE.L#SHRSEG,D0‰SharethePASCALstacksegmenttoeachtaskŠMOVE.L#'SEG2',SEGNAM(A1) ŠMOVE.LA1,A0ŠTRAPƒ#1 ŠBEQ.S‚SEG020 ŠBSR„ERRORŠSPC„2FSEG020„ADD.B‚#1,SEGTCB+3(A1)†LoopuntilbothsegmentshavebeensharedŠDBRAƒD1,SEGLOOP‰toalltasks.ŠSPC„2)* Initialize Allocate ASQ parameter block ŠMOVE.LA1,A0,ŠMOVE.L#'INPA',ASQTSK(A0)„InitialtasknameŠSPC„2AŠMOVE.B#AQSTQE+AQSTRE+8,ASQSTA(A0)ASR/ASQenabled,noregistersŠSPC„23ŠMOVE.B#18,ASQMML(A0)…Max.eventlength=18bytesŠSPC„2.ŠMOVE.L#2048,ASQQLN(A0)ƒASQlength=2KbytesŠSPC„2-ŠLEA.L‚INTASR(PC),A1†DefaulttointerruptASRŠMOVE.LA1,ASQASR(A0)ŠSPC„2* Allocate ASQs for each task %ŠMOVE.LD7,D1ŽInitializeloopcounterŠSPC„25ASQLOOPƒMOVE.L#GTASQ,D0ƒIssueAllocateASQdirectiveŠTRAPƒ#1 ŠBEQ.S‚ASQ010 ŠBSR„ERRORŠSPC„2EASQ010„ADD.B‚#1,ASQTSK+3(A0)†LoopuntilanASQhasbeenallocatedforŠDBRAƒD1,ASQLOOP‰eachtask.ŠSPC„2'*Initialize Start Task parameter block. :ŠMOVE.L#'INPA',STRTSK(A0)ƒStarttaskswithoutpassingany+ŠMOVE.W#0,STROPT(A0)†initializeregisters.ŠSPC„2* Start all tasks *ŠMOVE.LD7,D1Initializetheloopcounter.ŠSPC„2#STARTLPƒMOVE.L#START,D0ŠStarttaskŠTRAPƒ#1ŠBEQ.S‚STRT010 ŠBSR„ERRORŠSPC„2DSTRT010ƒADD.B‚#1,STRTSK+3(A0)„LoopuntilalltaskshavebeenstartedŠDBRAƒD1,STARTLPŠSPC„2* Task startup completeŠSPC„2-ŠLEA.L‚100(A7),A7‰RestoreentrystackpointerŠSPC„2+ŠJMP„(A4)ReturntocallingPASCALroutine.ŠSPC„2ŠPAGEŠXDEFƒSEND_COMŠSPC„2K* This routine passes the address of an Initiate I/O parameter block to oneM* of the test tasks in an event that is queued to the task. After sending theM* command event, the routine waits for the test task to set a flag indicatingM* that the command has been issued to the driver and the return status can be/ H* read from the command parameter block. The routine then returns to theN* calling PASCAL routine with the command status as the function return value. :SEND_COM‚MOVEM.L(A7)+,A1/A2/A4„Pullparametersfromstack*¤A1=Returnaddress*¤A2=TaskIDaddress*¤A4=InitiateI/OPBaddressŠSPC„2>ŠLEA.L‚-100(A7),A7ˆAllocateparameterblockspaceonthestackŠSPC„2-* Initialize the Queue Event parameter block. 6ŠMOVE.LA7,A0ŽSaveparameterblockbaseaddressinA0.ŠSPC„2?ŠMOVE.L(A2),QEVTSK(A0)†CopythetaskIDpassedfromthePASCAL'*£routinetothedestinationtaskname.ŠSPC„2@ŠMOVE.W#QVOPAS,QEVOPT(A0)ƒSetthecommandprocessingASRofthe?ŠLEA.L‚CMDASR(PC),A2†tasttasktobethealternateASRTserviceŠMOVE.LA2,QEVIAD(A0)†address.ŠSPC„2?ŠLEA.L‚QEVIAD+4(A0),A2†Loadtheeventbufferaddress(following=ŠMOVE.LA2,QEVPKT(A0)†theparameterblock)intotheparameter*£block.ŠSPC„22ŠCLR.W‚(A4)+Clearthecommandconpletionflagand(*£updatethepointertotheInitiateI/O*£parameterblockbaseaddress.ŠSPC„2;ŠMOVE.W#$0603,(A2)+‰Eventlength=6bytes,Eventcode=3ŠMOVE.LA4,(A2)+ŠSPC„2@ŠMOVE.W#CMDLEN,XIOPLN(A4)ƒAssumethatthelengthofthecommand'*£blockisstandard(i.e.notanOPEN) ŠSPC„29ŠMOVE.LXIOCPK(A4),A2‡Getthecommandblockbaseaddress.ŠSPC„2BŠCMP.W‚#INOPEN,CMDCOD(A2)‚IfthecommandisnotOPEN,thestandard/ŠBNE.S‚QUECMDlengthalreadyloadediscorrect.ŠSPC„2:ŠMOVE.WCMDNCO(A2),D1ˆCalculatethecorrectlengthforthe:ŠMULUƒ#OPNCDB,D1‰OPENcommandparameterblockandstorein)ŠADD.L‚#CMDCHL,D1‰theInitiateI/Oblock.ŠMOVE.WD1,XIOPLN(A4)ŠSPC„2AQUECMD„MOVE.L#QEVNT,D0‹Queuethecommandeventtothetesttask.ŠTRAPƒ#1ŠBEQ.S‚ACKLOOP ŠBSR„ERRORŠSPC„2;ACKLOOPƒTST.B‚-2(A4)Loopuntilthecommandcompletionflag+ŠBEQ„ACKLOOPŒhasbeensetbythetesttask.ŠSPC„22ŠLEA.L‚100(A7),A7‹Restoretheentrystackpointer.ŠSPC„2=ŠMOVE.WCMDSTA(A2),(A7)†Savethecommandcompletionstatusin(*£thefunctionreturnwordonthestack.ŠSPC„2/ŠJMP„(A1)‘ReturntothecallingPASCALroutine.ŠSPC„2ŠPAGEJ*‚ThisisthetesttaskthatissuescommandstothedriverasspecifiedbyL* the controlling PASCAL task. The test task handles interrupt notificationsN* sent by the driver. The user is notified of the interrupt via LEDs connected:* to an MVME 625 Digital Output module on the I/O channel. 5VME625„EQU„$FE6001ŒVME625moduleI/Ochanneladdress (* Allocate Stack Segment parameter block SEGBLK„DC.Lƒ0’Taskname…(self)ŠDC.Lƒ0’Sessionnumber(self)6ŠDC.WƒSGOPPALogicalAddress=Physicaladdressoption)ŠDC.WƒSGATRWRead/WriteSegmantattributeŠDC.Lƒ'STAK'Segmentname)ŠDC.Lƒ0’Segmentaddress(ReturnedbyRMS)ŠDC.Lƒ$100SegmentlengthŠSPC„2* Test task entry point* Allocate a stack segment >TASKENTƒMOVE.L#GTSEG,D0ŠAllocateastacksegmentof256bytesŠLEA.L‚SEGBLK(PC),A0ŠTRAPƒ#1 ŠBEQ.S‚TSK010 ŠBSR„ERRORŠSPC„2BTSK010„LEA.L‚$F8(A0),A7‰Initializethestackpointertotheendof*£thestacksegment.ŠSPC„2CTSKWTEVT‚MOVE.L#WTEVNT,D0‹Waitforacommandeventoraninterrupt*ŠTRAPƒ#1‘eventtobeprocessedintheASR.ŠBEQ.S‚TSKWTEVT ŠBSR„ERRORŠSPC„2I*‚Controlreachesherewhentheuserhasissuedacommandforthetaskto* enter the wait state. ;TSKWAITƒMOVE.L#WAIT,D0ŒPlacethetaskintoaWAITstateso0ŠTRAPƒ#1‘interruptsmaybeprocessedonchannels*£usingWAKEUP.ŠSPC„23ŠBSETƒ#7,VME625ŒPulseLED7ontheVME625boardto8ŠBCLRƒ#7,VME625ŠindicatethatawakeuphasbeenreceivedŠSPC„26ŠBRA.S‚TSKWAITŽThislooprepeatsuntilacommandevent*£isqueuedtothetesttask.ŠPAGE* Command event ASR 3CMDASR„SUB.L‚#16,A7Allocatestacktoreceiveevent ŠMOVE.LA7,A0ŠSPC„21ŠMOVE.L#RDEVNT,D0ŠReadcommandeventintobufferŠTRAPƒ#1 ŠBEQ.S‚CMD020 ŠBSR.S‚ERRORŠSPC„28CMD020„MOVE.LEVQTXT(A0),A0‡Loadeventtextbaseaddress ŠADD.L‚#16,A7=ŠMOVE.LXIOCPK(A0),A1ˆLoadInputCommandParameterBlockbase *£address/ ŠSPC„27ŠTST.W‚CMDCOD(A1)ŠIfthecommandcodeiszero,thetest3ŠBEQ.S‚CMDWAITŒtaskistobeputintoaWAITstate.ŠSPC„2* Issue command to the driver. 5ŠMOVE.L#CMR,D0ŒIssuetheInitiateI/OcommandtoCMRŠTRAPƒ#1 ŠBEQ.S‚CMD030ŠSPC„2=ŠMOVE.WD0,CMDSTA(A1)ˆIfanerrorisreturnebyCMR,copythe'*£errorcodeintotheIPBstatusfield.ŠSPC„24* Signal supervisor task that command was completed. FCMD030„MOVE.W#$FFFF,-2(A0)†SetthecommandcompletionflagandreturnŠRTR—fromtheeventŠSPC„2* Put task in WAIT state CCMDWAITƒLEA.L‚TSKWAIT(PC),A1‡Changetheeventreturnaddresstothe'ŠMOVE.LA1,2(A7)‹WAITloopentrypoint.ŠSPC„25ŠMOVE.W#$FFFF,-2(A0)ˆSetthecommandcompletionflagŠSPC„2;ŠMOVE.L#SETASQ,D0‹EnabletheASRandASQsocommandevents4ŠMOVE.L#5,A0ŽmaybeprocessedwhenaWAKEUPoccurs.ŠTRAPƒ#1 ŠBEQ.S‚CMD010 ŠBSR.S‚ERRORŠSPC„20CMD010„RTR˜ReturntotheWAITstateloopuntila+*£commandeventiswaitingandaWAKEUPhas(*£beenissuedtothetaskbythedriver.ŠPAGE* Interrupt Event ASR 3INTASR„SUB.L‚#16,A7Allocatestacktoreceiveevent ŠMOVE.LA7,A0ŠSPC„2)ŠMOVE.L#RDEVNT,D0‰ReadeventintobufferŠTRAPƒ#1 ŠBEQ.S‚INT010 ŠBSR.S‚ERRORŠSPC„2;INT010„MOVE.B3(A0),D0‹LoadtheinterruptingchannalnumberŠSPC„28ŠCMP.L‚#'IN02',4(A0)ˆIfthefirstmoduleisinterrupting1ŠBNE.S‚INT020leavethechannelnumberunchanged.ŠSPC„21ŠADD.B‚#4,D0Ifthesecondmoduleisinterrupting!*£addfourtothechannelnumber.ŠSPC„28INT020„BSETƒD0,VME625ŒPulsetheLEDcorrespondingtothe(ŠBCLRƒD0,VME625Šmodifiedchannelnumber.ŠSPC„2ŠADD.L‚#16,A7RestorestackŠSPC„2ŠRTR™ReturnfromeventŠSPC„2;ERROR…MOVE.L(A7)+,A0Abortthetaskifanunexpectederror9ŠMOVE.L#ABORT,D0Šoccurs.Theaddressofwherertheerror3ŠTRAPƒ#1‘occurredisstoredinA0fortheSCTabort *£message.ŠSPC„2ŠENDN*******************************************************************************Ì**Ì*#*—MVME610orMVME620‚TestProgram•**Ì**Ì*N********************************************************************************6* This program was written to test the MVME610 driver.**    *‰ModificationHistoryN*-----------------------------------------------------------------------------*11/01/84‡DUHInitialwriting   *1.‚Introduction*B*‰ThisprogramwaswrittentotesttheMVME610driver.‚ItcanalsoI*‚beusedtotesttheVME620board.‚ThisprogramwillaskforthechannelI*‚numbertouse.‚ItwillthenaskiftheuserwantstoreadthestatusofL*‚thatchannelorenableandwaitforanegativegoingedgeonthatchannel.K*‚Tousethistestprogram,connectasquarewavegeneratortoachannelonD*‚theVME620DCinputmoduleoraswitchconnectedto120VACforthe*‚VME610ACinputmodule.*8*‰Thisprogramassumestheboardsarejumperedasshown:**‚VME610orVME620:%*„J3‚1,2‚3,4‚5,6‡addressoffset$0005*„J2‚2,4‘interruptINT1*ŠPAGE ,*£ASCVAL,BHLCVT,andCVT2arecommonlyused**£functionswhicharemodulesinalibrary(*£filecalledUTILIB.RO.‚Acalltothese'*£functionsareincludedinthissource)*£program,whichisprovidedwithanXREF&*£declaration.‚Thisalsorequiresthat'*£UTILIB.RObeavailabletothelinkage$*£editorduringthelinkingprocess.%*£SeeTEST620.LFforlinkchainfile. -ŠXREFƒASCVALConvertsASCIItoabinaryvalue$*£ThisroutinewillconvertanASCII,*£characterstringrepresentingadecimalor,*£hexidecimalvaluetotheequivalentbinary,*£value.‚Ifadollarsign($)isencountered&*£hexidecimalconversionisperformed;,*£otherwisedecimalconversionisperformed.+*£Anemptycharacterstringfieldpassedto,*£thisfunctioninA0producesazerobinary'*£value.‚Conversionterminateswhenthe)*£firstinvalidcharacterisencountered.'*£ENTRY:‚A0-StartingaddressofASCII0 ð>ù:D BGF!F)S18*°characterstringtoconvert#*£EXIT:‚D1-Characterthatcaused *°termination%*«D2-Classcodeofterminatingchar"*«D3-Binaryresultofconversion*«A0-Addressofthecharacter *°followingtheterminatingchar 8ŠXREFƒBHLCVTConverts4-bytebinaryvaluetoASCIIdigit)*£Thisroutinewillconvertalongbinary-*£wordvaluetoahexadecimalvalueexpressed)*£asan8characterASCIIstring.‚Leading*£zerosaresuppressed.,*£ENTRY:‚D0.L-Binaryvaluetobeconverted(*£EXIT:‚D2.L-Fourhighorderbytesof*²convertedvalue *«D3.L-Fourloworderbytesof*²convertedvalue 6ŠXREFƒCVT2ConvertstwoASCIIdecimaldigitstobinary-*£ThisroutinewillconverttwoASCIIdecimal(*£digitstotheequivalentbinaryvalue.+*£Anemptycharacterstringfieldpassedto,*£thisfunctioninA0producesazerobinary**£value.‚Conversionterminateswhenanon-*£decimaldigitisencountered)*£ENTRY:‚A0-Addressofmostsignificant*°ASCIIdecimaldigit)*£EXIT:‚D0-Binaryresultofconversion!*«A0-Addressoftheterminating *°character ŠPAGEŠMOVE.LA0,IOSOUT+16-PBA(A4)SettheendingaddressofmessageŠLEA„IOSOUT(PC),A0ŠTRAPƒ#2ŠENDM ŠPAGE 2ŠOPT„PCSWeuseaPCSoptionsotheassemblerwill%*£forcePCrelativeaddressingwithin(*£SECTION.‚ForcesPCrelativeaddressing-*£(wheneversuchanaddressingmodeislegal))*£inaninstructionwhichoccurswithina'*£relocatableSECTIONandreferencesan,*£operandinarelocatableSECTION(neednot**£bethesameSECTIONastheinstruction).,*£Failuretoresolvesucnareferenceintoa-*£16-bitdisplacementfromthePCwillresult)*£inanerror.‚Thisoptionmaybeusedto+*£forcepositionindependentcode;however,(*£thisoptiondoesnotforcePCrelative,*£addressingofabsoluteoperandsorunknown*£forwardreferences. ŠPAGE N*******************************************************************************Ì**™DATAƒSECTIONœ**Ì*N****************************************************************************** ŠSECTIONDATA $PBA‡EQU„*’ProgramBaseAddress(PBA)%*£Thislabelisusedtodesignatethe+*£beginningoftheprogram.‚Thisisusedto'*£makereferencestootherpartsofthe*£program,relocatable. 9ŠDS.WƒSTACKLEN‹ThisisthestackareafortheVME620test2STACK…EQU„*’program.‚Registersandotherimportant,*£informationwillbestoredonthestackas)*£theprogramisexecuted.‚Thestackarea'*£isdynamicandwillchangeduringthe *£executionofthetestprogram. =INPUTBUF‚DS.WƒSTRNGLEN‹Thisisthestorageareafortheinput*£stringsthatareentered. 9STATUS„DS.Lƒ1’Thiswillbethestorageareforthestatus,*£codethatisreturnedfromCMR.‚Thisvalue-*£willbedisplayedtoshowtheuserwhatthe*£errorcodewas. 6NUMBER„DS.Lƒ2’SaveareafortheASCIIvalueofSTATUS.ŠPAGE N*******************************************************************************Ì*!*–PARAMETERƒBLOCKS—**Ì*N****************************************************************************** ŠNEXTWB”ForceevenboundaryIOSOUTŠDC.Bƒ0’Requestcode"ŠDC.BƒWRITEŽFunctionspecificationŠDC.Wƒ8’OptionsŠDC.Bƒ0’StatusŠDC.BƒCRTLogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress   ŠNEXTWB”ForceevenboundaryIOSINŠDC.Bƒ0’Requestcode!ŠDC.BƒREADFunctionspecificationŠDC.Wƒ0’OptionsŠDC.Bƒ0’Status"ŠDC.BƒKEYBOARD‹LogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress  CMRBLK„DC.Bƒ7’InitiateI/OŠDC.BƒUNUSEDUnusedŠDC.WƒUNUSEDUnusedŠDC.Lƒ'IN01'ChannelnameŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnused$ŠDC.Lƒ0’AddressofI/Ocontrolblock#ŠDC.Lƒ0’LengthofI/OcontrolblockŠPAGE*7*‚OPENcommandparameterblockfortheDCINPUTdriver:+OPEN_DCI‚DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒOPENOpencommandcodeŠDC.Wƒ1’#ofchannelstoopen-ŠDC.Wƒ0’Channeltoopen(Dynamicallychanged)-ŠDC.WƒDEFAULTŒChannelconfiguration(Dynamic)6OLEN_DCI‚EQU„*-OPEN_DCI‰LengthofOPENparameterblock*E*‚READOUTPUTSTATUScommandparameterblockfortheDCINPUTdriver:+READ_DCI‚DC.Wƒ0’Returnedstatusfromdriver*ŠDC.WƒREAD_STATUSˆReadstatuscommandcode.ŠDC.Wƒ0’Bitmaskforchannelstoreadandupon(*£returnholdstheactualchannelstatus1 =RLEN_DCI‚EQU„*-READ_DCI‰LengthofREADSTATUSparameterblock*D*‚ENABLEINTERRUPTScommandparameterblockfortheDCINPUTdriver:+ENAB_DCI‚DC.Wƒ0’Returnedstatusfromdriver-ŠDC.WƒENAB_INT‹Enableinterruptscommandcode.ŠDC.Wƒ0’Bitmaskforchannelstoreadandupon(*£returnholdstheactualchannelstatusCELEN_DCI‚EQU„*-ENAB_DCI‰LengthofENABLEINTERRUPTSparameterblock*D*‚ENABLEINTERRUPTScommandparameterblockfortheDCINPUTdriver:+DISB_DCI‚DC.Wƒ0’Returnedstatusfromdriver.ŠDC.WƒDISAB_INTŠEnableinterruptscommandcode.ŠDC.Wƒ0’Bitmaskforchannelstoreadandupon(*£returnholdstheactualchannelstatus>DLEN_DCI‚EQU„*-DISB_DCI‰LengthofDISABLEINTERRUPTSparameter*8*‚CLOSEcommandparameterblockfortheDCINPUTdriver:)CLSBLK„DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒCLOSEŽClosecommandcodeCLOSLENƒEQU„*-CLSBLKŠNEXTWBŠPAGE N*******************************************************************************Ì**œMESSAGES¡**Ì*N****************************************************************************** ŠSECTIONMESSAGES 9HEAD†DC.BƒCR,LF,LF,'MVME620DriverTestProgram',CR,LF,LF HEADE…EQU„*-1ŠNEXTWB1MESS1…DC.Bƒ'…Numberofthechanneltoconvertˆ>'MESS1E„EQU„*-1ŠNEXTWB(MESS2…DC.Bƒ'…Enteroneoftheabove...'MESS2E„EQU„*-1ŠNEXTWB?MESS4…DC.BƒCR,LF,LF,'…0=READTHECURRENTINPUTSTATUS.',CR,LFMESS4E„EQU„*-1ŠNEXTWB0MESS5…DC.Bƒ'…1=ENABLEFORANINTERRUPT.',CR,LFMESS5E„EQU„*-1ŠNEXTWBMESS6…DC.Bƒ'…2=QUIT.',CR,LFMESS6E„EQU„*-1ŠNEXTWB4MESS9…DC.BƒCR,LF,'STATUSOFALLCHANNELS(ASCII)='MESS9E„EQU„*-1ŠNEXTWB2MESS10„DC.BƒCR,LF,'<<>>',CR,LFMESS10EƒEQU„*-1ŠNEXTWB1MESS11„DC.BƒCR,LF,'<<>>',CR,LF,LFMESS11EƒEQU„*-1ŠNEXTWBŠPAGE,BADOPN„DC.BƒCR,LF,'***OPENABORTED***--'BADOPNEƒEQU„*-1ŠNEXTWB8BADEN…DC.BƒCR,LF,'***ENABLEINTERRRUPTABORTED***--'BADENE„EQU„*-1ŠNEXTWB:BADDIS„DC.BƒCR,LF,'***DISABLEINTERRRUPTABORTED***--'BADDISEƒEQU„*-1ŠNEXTWB4BADREADƒDC.BƒCR,LF,'***READSTATUSABORTED***--'BADREADE‚EQU„*-1ŠNEXTWB-BADCLS„DC.BƒCR,LF,'***CLOSEABORTED***--'BADCLSEƒEQU„*-1ŠNEXTWB+STATUSMƒDC.Bƒ'ErrorcodereturnedinD0='STATUSME‚EQU„*-1ŠNEXTWBCRLF†DC.BƒCR,LF CRLFE…EQU„*-1ŠNEXTWBŠPAGE N*******************************************************************************Ì**–PROGRAMƒSECTION™**Ì*N****************************************************************************** ŠSECTIONCODEPROGSTRTŠLEA„STACK(PC),A7.ŠLEA„PBA(PC),A4‰GetProgramBaseAddress(PBA) &ŠOUTPUTHEAD,HEADE‰Displaytheheading N*-----------------------------------------------------------------------------***‰Getthenumberofthechanneltoconvert*N*-----------------------------------------------------------------------------GETCHAN.ŠOUTPUTMESS1,MESS1E‡ChannelnumbertoconvertŠINPUT‚INPUTBUF,INPUTBUF+8ŠLEA„INPUTBUF(PC),A0)ŠBSR„CVT2ConvertASCIIdecimaltobinary'ŠIF.LD0#0OR.LD0#7THEN.S ŒBRAGETCHANŠENDI8ŠMOVE.WD0,OPEN_DCI+6-PBA(A4)Savethechannelnumber... <ŠLEA„BIT_NUMBER(PC),A0‚Convertthechannelnumber(0-7)into?ŠMOVE.B(A0,D0.W),D0‡thecorrespondingbitnumber(1,2,4,8...).8ŠMOVE.WD0,READ_DCI+4-PBA(A4)Savethebitmaskvalue...ŠMOVE.WD0,ENAB_DCI+4-PBA(A4)ŠMOVE.WD0,DISB_DCI+4-PBA(A4) N*-----------------------------------------------------------------------------*4*‰Get„0=READSTATUS‚1=ENABLEINTERRUPTSƒ2=QUIT*N*-----------------------------------------------------------------------------GETCLST'ŠOUTPUTMESS4,MESS4E…Putupthemenu...ŠOUTPUTMESS5,MESS5EŠOUTPUTMESS6,MESS6EFGET_CHOICE‚OUTPUTMESS2,MESS2E…Asktheusertoenteroneoftheabove. +ŠINPUT‚INPUTBUF,INPUTBUF+8GettheirchoiceŠLEA„INPUTBUF(PC),A0)ŠBSR„CVT2ConvertASCIIdecimaltobinary'ŠIF.WD0#0OR.WD0#2THEN.SBRA.SGET_CHOICEŠENDIŠPAGE* *‰0=Readinputstatusco1 mmand:*ŠIF.BD0#0THEN.L /ŒOUTPUTMESS10,MESS10Eƒ<<<ƒStartingcommandƒ>>> ŒBSR.L‚CLOSE_ALL>ŒMOVE.W#DEFAULT,D0†Usethedefaultconfigurationfortheopen$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A06ŒLEA„READ_DCI(PC),A1‚ReadinputstatusparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#RLEN_DCI,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1ŒIFTHEN.SŽMOVE.WREAD_DCI(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)4ŽOUTPUTBADREAD,BADREADEƒ***READSTATUSABORTED***ŒENDI ŒCLR.L‚D0<ŒMOVE.WREAD_DCI+4-PBA(A4),D0‚Getthestatusvaluereturned.ŒBSR„BHLCVTConvertittoASCII9ŒMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŒMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytesŒOUTPUTMESS9,MESS9EŒOUTPUTNUMBER,NUMBER+7ŒOUTPUTCRLF,CRLFE 3ŒOUTPUTMESS11,MESS11Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDIŠPAGE* *‰1=Enableinterruptscommand:*ŠIF.BD0#1THEN.S /ŒOUTPUTMESS10,MESS10Eƒ<<<ƒStartingcommandƒ>>> ŒBSR.L‚CLOSE_ALL 3ŒMOVE.W#$7F08,D0ˆEnableinterrupts,WAKEUPoption,8*‡softwaredebounce=508mSec,triggeronnegativeedge.$ŒBSR.S‚OPEN_CHANˆGoopenthechannel *(*‚Doawaituntilthedriverwakesusup*ŒMOVE.L#19,D0ŒTRAPƒ#1 ŒIFTHEN.SŽMOVE.WENAB_DCI(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)6ŽOUTPUTBADEN,BADENE„***ENABLEINTERRUPTSABORTED***ŒENDI 3ŒOUTPUTMESS11,MESS11Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDI **‰2=quitcommand:*ŠIF.BD0#2THEN.S BRA.LEXITŠENDI ŠBRA.LGETCHANGostartover.ŠPAGEM*----------------------------------------------------------------------------**ƒOPENTHECHANNEL*M*----------------------------------------------------------------------------OPEN_CHANLEA„CMRBLK(PC),A0ŠLEA„OPEN_DCI(PC),A1BŠMOVE.WD0,OPEN_DCI+8-PBA(A4)‚Savetheopenconfigurationoptions.ŠMOVE.LA1,$14(A0)ŠMOVE.W#OLEN_DCI,$18(A0)7ŠMOVE.L#CMR,D0ŒHereweperformanexecutiverequesttoŠTRAPƒ#1‘invokeCMR.ŠIFTHEN.SŒMOVE.LD0,STATUS-PBA(A4)+ŒOUTPUTBADOPN,BADOPNE…***OPENABORTED***ŒBRA.S‚SHOW_D0ŠENDIŠRTS M*----------------------------------------------------------------------------**ƒOUTPUTTHEERRORCODE:*M*----------------------------------------------------------------------------:SHOW_D0ƒMOVE.LSTATUS(PC),D0†GetthestatusvaluereturnedŠBSR„BHLCVTConvertittoASCII9ŠMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŠMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytesŠOUTPUTSTATUSM,STATUSMEŠOUTPUTNUMBER,NUMBER+7ŠOUTPUTCRLF,CRLFE EXIT:ŠBSR.S‚CLOSE_ALL +EXIT_OUT:MOVE.L#15,D0TerminatethistaskŠTRAPƒ#1ŠPAGEN*-----------------------------------------------------------------------------**‚CLOSEALLCHANNEL'SROUTINE:*N*-----------------------------------------------------------------------------CLOSE_ALL MOVE.W D0,-(A7) ŠLEA„CMRBLK(PC),A0ŠLEA„CLSBLK(PC),A1ŠMOVE.LA1,$14(A0)ŠMOVE.W#CLOSLEN,$18(A0)6ŠMOVE.L#CMR,D0ŒTellCMRtoclosetheDCINPUTchannelŠTRAPƒ#1ŠIFTHEN.SŒMOVE.LD0,STATUS-PBA(A4)ŒBSR„BHLCVTConvertittoASCII9ŒMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŒMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytes,ŒOUTPUTBADCLS,BADCLSE…***CLOSEABORTED***ŒOUTPUTNUMBER,NUMBER+7ŒOUTPUTCRLF,CRLFEŒMOVE.W(A7)+,D0‰Restorestack.&ŒBRA.S‚EXIT_OUT‰Outputtheerrorcode.ŠENDI ŠMOVE.W(A7)+,D0ŠRTS M*----------------------------------------------------------------------------*A*ƒTABLETOCONVERTTHECHANNELNUMBER(0-7)TOIT'SCORRESPONDING**ƒBITMAPPEDVALUE(1,2,4,8,16,32,64,128).*M*----------------------------------------------------------------------------$BIT_NUMBER‚DC.B‚1,2,4,8,16,32,64,128 ŠEND„PROGSTRT2 é=/*=/*†M610DRV.INTSTASM.AF=/*5=/* Chain file to assemble portion of the MVME610/620=/* driver test program.=/*:=/* If no output argument is specified for the listing the2=/* chain file will default to M610DRV.INTSTASM.LS=/*=/IFC \1ƒ=ARGM610DRV.INTSTASM.LS=/ENDIF=/*4=ASM M610DRV.INTSTASM.SA,M610DRV.INTSTASM.RO,\1;Z=80=/*{ Included files are:=/*ƒ9995.&.TR1.EQ=/*ƒ9995.&.TR1RTCD.EQ=/*ƒ9995.&.EXE.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.M610CMD.EQ=/*}=/*=ENDéééééé9=/*=/*†M610DRV.TEST610.AF=/*,=/*†TEST610testprogramassemblychainfile=/*6=/*†Thecommandlinewillacceptargumentsasfollows:=/*;=/*‹Argument01…\1=Outputfileassemblylistingordevice=/*=/*H=/*†Thefollowingshowstheassemblychainsequence.‚InthisexampletheH=/*†NULLdevicewaschosenasArgument01,however,theusercouldifhe5=/*†sodesiredhaverequestedanoutputlistingfile.=/*#=/*=CHAINM610DRV.TEST610.AF#NULL=/*-=/*†Defaultargument01isM610DRV.TEST610.LS=/*=/IFC \1ƒ=ARGM610DRV.TEST610.LS=/ENDIF=/*4=ASM M610DRV.TEST610.SA,M610DRV.TEST610.RO,\1;RZ=100=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDééé2 ééB'M615DRV TEST615 SAWWP¿bbTESTAC SA°°‰¨bbTEST615 AFAAbbTESTAC AFJJbbN*******************************************************************************Ì**Ì**–MVME615…TestProgramž**Ì**Ì*N********************************************************************************6* This program was written to test the MVME615 driver.**    *‰ModificationHistoryN*-----------------------------------------------------------------------------*10/31/84‡DUHInitialwriting   *1.‚Introduction*C*‰ThisprogramwaswrittentotesttheMVME615driver.‚ThisprogramK*‚willaskforthechannelnumberoftheACoutputmodule.‚ItwillthenaskH*‚iftheuserwantstoturnthatchannelon,off,pulsedon,orreadtheC*‚statusofallchannels.‚Alampconnectedto120VACcanbeusedto*‚monitorthechannel.*6*‰Thisprogramassumestheboardisjumperedasshown:* *‚VME615:%*„J2‚1,2‚3,4‚5,6†addressoffset$0003*ŠPAGE ,*£ASCVAL,BHLCVT,andCVT2arecommonlyused**£functionswhicharemodulesinalibrary(*£filecalledUTILIB.RO.‚Acalltothese'*£functionsareincludedinthissource)*£program,whichisprovidedwithanXREF&*£declaration.‚Thisalsorequiresthat'*£UTILIB.RObeavailabletothelinkage$*£editorduringthelinkingprocess.%*£SeeTEST615.LFforlinkchainfile. -ŠXREFƒASCVALConvertsASCIItoabinaryvalue$*£ThisroutinewillconvertanASCII,*£characterstringrepresentingadecimalor,*£hexidecimalvaluetotheequivalentbinary,*£value.‚Ifadollarsign($)isencountered&*£hexidecimalconversionisperformed;,*£otherwisedecimalconversionisperformed.+*£Anemptycharacterstringfieldpassedto,*£thisfunctioninA0producesazerobinary'*£value.‚Conversionterminateswhenthe)*£firstinvalidcharacterisencountered.'*£ENTRY:‚A0-StartingaddressofASCII*°characterstringtoconvert#*£EXIT:‚D1-Characterthatcaused *°termination%*«D2-Classcodeofterminatingchar"*«D3-Binaryresultofconversion*«A0-AddressofthecharacterOAX:`DhBpHxB€EˆQR˜I 3  *°followingtheterminatingchar 8ŠXREFƒBHLCVTConverts4-bytebinaryvaluetoASCIIdigit)*£Thisroutinewillconvertalongbinary-*£wordvaluetoahexadecimalvalueexpressed)*£asan8characterASCIIstring.‚Leading*£zerosaresuppressed.,*£ENTRY:‚D0.L-Binaryvaluetobeconverted(*£EXIT:‚D2.L-Fourhighorderbytesof*²convertedvalue *«D3.L-Fourloworderbytesof*²convertedvalue 6ŠXREFƒCVT2ConvertstwoASCIIdecimaldigitstobinary-*£ThisroutinewillconverttwoASCIIdecimal(*£digitstotheequivalentbinaryvalue.+*£Anemptycharacterstringfieldpassedto,*£thisfunctioninA0producesazerobinary**£value.‚Conversionterminateswhenanon-*£decimaldigitisencountered)*£ENTRY:‚A0-Addressofmostsignificant*°ASCIIdecimaldigit)*£EXIT:‚D0-Binaryresultofconversion!*«A0-Addressoftheterminating *°character ŠPAGEŠMOVE.LA0,IOSOUT+16-PBA(A4)SettheendingaddressofmessageŠLEA„IOSOUT(PC),A0ŠTRAPƒ#2ŠENDM ŠPAGE 2ŠOPT„PCSWeuseaPCSoptionsotheassemblerwill%*£forcePCrelativeaddressingwithin(*£SECTION.‚ForcesPCrelativeaddressing-*£(wheneversuchanaddressingmodeislegal))*£inaninstructionwhichoccurswithina'*£relocatableSECTIONandreferencesan,*£operandinarelocatableSECTION(neednot**£bethesameSECTIONastheinstruction).,*£Failuretoresolvesucnareferenceintoa-*£16-bitdisplacementfromthePCwillresult)*£inanerror.‚Thisoptionmaybeusedto+*£forcepositionindependentcode;however,(*£thisoptiondoesnotforcePCrelative,*£addressingofabsoluteoperandsorunknown*£forwardreferences. ŠPAGE N*******************************************************************************Ì**™DATAƒSECTIONœ**Ì*N****************************************************************************** ŠSECTIONDATA $PBA‡EQU„*’ProgramBaseAddress(PBA)%*£Thislabelisusedtodesignatethe+*£beginningoftheprogram.‚Thisisusedto'*£makereferencestootherpartsofthe*£program,relocatable. 9ŠDS.WƒSTACKLEN‹ThisisthestackareafortheVME615test2STACK…EQU„*’program.‚Registersandotherimportant,*£informationwillbestoredonthestackas)*£theprogramisexecuted.‚Thestackarea'*£isdynamicandwillchangeduringthe *£executionofthetestprogram. =INPUTBUF‚DS.WƒSTRNGLEN‹Thisisthestorageareafortheinput*£stringsthatareentered. 9STATUS„DS.Lƒ1’Thiswillbethestorageareforthestatus,*£codethatisreturnedfromCMR.‚Thisvalue-*£willbedisplayedtoshowtheuserwhatthe*£errorcodewas. 6NUMBER„DS.Lƒ2’SaveareafortheASCIIvalueofSTATUS.ŠPAGE N*******************************************************************************Ì*!*–PARAMETERƒBLOCKS—**Ì*N****************************************************************************** ŠNEXTWB”ForceevenboundaryIOSOUTŠDC.Bƒ0’Requestcode"ŠDC.BƒWRITEŽFunctionspecificationŠDC.Wƒ8’OptionsŠDC.Bƒ0’StatusŠDC.BƒCRTLogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress   ŠNEXTWB”ForceevenboundaryIOSINŠDC.Bƒ0’Requestcode!ŠDC.BƒREADFunctionspecificationŠDC.Wƒ0’OptionsŠDC.Bƒ0’Status"ŠDC.BƒKEYBOARD‹LogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress  CMRBLK„DC.Bƒ7’InitiateI/OŠDC.BƒUNUSEDUnusedŠDC.WƒUNUSEDUnusedŠDC.Lƒ'ACO1'ChannelnameŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnused$ŠDC.Lƒ0’AddressofI/Ocontrolblock#ŠDC.Lƒ0’LengthofI/OcontrolblockŠPAGE*8*‚OPENcommandparameterblockfortheACOUTPUTdriver:+OPEN_ACO‚DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒOPENOpencommandcodeŠDC.Wƒ1’#ofchannelstoopen-ŠDC.Wƒ0’Channeltoopen(Dynamicallychanged)-ŠDC.WƒDEFAULTŒChannelconfiguration(Dynamic)6OLEN_ACO‚EQU„*-OPEN_ACO‰LengthofOPENparameterblock*C*‚STARTOUTPUTONcommandparameterblockfortheACOUTPUTdriver:)ON_ACO„DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒON‘ONcommandcode2ŠDC.Wƒ0’Bitmaskforchannelstoturnon(Dynamic)2NLEN_ACO‚EQU„*-ON_ACO‹LengthofONparameterblock*C*‚TURNOUTPUTOFFcommandparameterblockfortheACOUTPUTdriver:*OFF_ACOƒDC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒOFFOffcommandcode4 3ŠDC.Wƒ0’Bitmaskforchannelstoturnoff(Dynamic)4FLEN_ACO‚EQU„*-OFF_ACOŠLengthofOFFparameterblock*A*‚PULSEDOUTPUTcommandparameterblockfortheACOUTPUTdriver:*PON_ACOƒDC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒPULSEŽPulsecommandcodeŠDC.Wƒ1’#ofchannels,ŠDC.Wƒ0’Channelnumber(Dynamicallychanged)/ŠDC.Lƒ0’Timeofpulseinmilliseconds(Dynamic)6PLEN_ACO‚EQU„*-PON_ACOŠLengthofPULSEparameterblock*F*‚READOUTPUTSTATUScommandparameterblockfortheACOUTPUTdriver:+READ_ACO‚DC.Wƒ0’Returnedstatusfromdriver*ŠDC.WƒREAD_STATUSˆReadstatuscommandcode.ŠDC.Wƒ0’Bitmaskforchannelstoreadandupon(*£returnholdstheactualchannelstatus=RLEN_ACO‚EQU„*-READ_ACO‰LengthofREADSTATUSparameterblock*9*‚CLOSEcommandparameterblockfortheACOUTPUTdriver:)CLSBLK„DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒCLOSEŽClosecommandcodeCLOSLENƒEQU„*-CLSBLKŠNEXTWBŠPAGE N*******************************************************************************Ì**œMESSAGES¡**Ì*N****************************************************************************** ŠSECTIONMESSAGES 9HEAD†DC.BƒCR,LF,LF,'MVME615DriverTestProgram',CR,LF,LF HEADE…EQU„*-1ŠNEXTWB1MESS1…DC.Bƒ'…Numberofthechanneltoconvertˆ>'MESS1E„EQU„*-1ŠNEXTWB(MESS2…DC.Bƒ'…Enteroneoftheabove...'MESS2E„EQU„*-1ŠNEXTWB8MESS3…DC.Bƒ'…Time(inmilliseconds)foroutputpulse>'MESS3E„EQU„*-1ŠNEXTWB+MESS4…DC.BƒCR,LF,LF,'…0=OUTPUTON.',CR,LFMESS4E„EQU„*-1ŠNEXTWB#MESS5…DC.Bƒ'…1=OUTPUTOFF.',CR,LFMESS5E„EQU„*-1ŠNEXTWB=MESS6…DC.Bƒ'…2=PULSEANOUTPUTFORASPECIFIEDTIME.',CR,LFMESS6E„EQU„*-1ŠNEXTWB7MESS7…DC.Bƒ'…3=READTHECURRENTOUTPUTSTATUS.',CR,LFMESS7E„EQU„*-1ŠNEXTWB MESS8…DC.Bƒ'…4=QUIT.',CR,LF,LFMESS8E„EQU„*-1ŠNEXTWB4MESS9…DC.BƒCR,LF,'STATUSOFALLCHANNELS(ASCII)='MESS9E„EQU„*-1ŠNEXTWB2MESS10„DC.BƒCR,LF,'<<>>',CR,LFMESS10EƒEQU„*-1ŠNEXTWB1MESS11„DC.BƒCR,LF,'<<>>',CR,LF,LFMESS11EƒEQU„*-1ŠNEXTWBŠPAGE,BADOPN„DC.BƒCR,LF,'***OPENABORTED***--'BADOPNEƒEQU„*-1ŠNEXTWB6BADON…DC.BƒCR,LF,'***STARTOUTPUTONABORTED***--'BADONE„EQU„*-1ŠNEXTWB7BADOFF„DC.BƒCR,LF,'***TURNOUTPUTOFFABORTED***--'BADOFFEƒEQU„*-1ŠNEXTWB:BADPLS„DC.BƒCR,LF,'***STARTOUTPUTPULSEABORTED***--'BADPLSEƒEQU„*-1ŠNEXTWB4BADREADƒDC.BƒCR,LF,'***READSTATUSABORTED***--'BADREADE‚EQU„*-1ŠNEXTWB-BADCLS„DC.BƒCR,LF,'***CLOSEABORTED***--'BADCLSEƒEQU„*-1ŠNEXTWB+STATUSMƒDC.Bƒ'ErrorcodereturnedinD0='STATUSME‚EQU„*-1ŠNEXTWBCRLF†DC.BƒCR,LF CRLFE…EQU„*-1ŠNEXTWBŠPAGE N*******************************************************************************Ì**–PROGRAMƒSECTION™**Ì*N****************************************************************************** ŠSECTIONCODEPROGSTRTŠLEA„STACK(PC),A7.ŠLEA„PBA(PC),A4‰GetProgramBaseAddress(PBA) &ŠOUTPUTHEAD,HEADE‰Displaytheheading N*-----------------------------------------------------------------------------***‰Getthenumberofthechanneltoconvert*N*-----------------------------------------------------------------------------GETCHAN.ŠOUTPUTMESS1,MESS1E‡ChannelnumbertoconvertŠINPUT‚INPUTBUF,INPUTBUF+8ŠLEA„INPUTBUF(PC),A0)ŠBSR„CVT2ConvertASCIIdecimaltobinary'ŠIF.LD0#0OR.LD0#7THEN.S ŒBRAGETCHANŠENDI8ŠMOVE.WD0,OPEN_ACO+6-PBA(A4)Savethechannelnumber...ŠMOVE.WD0,PON_ACO+6-PBA(A4) <ŠLEA„BIT_NUMBER(PC),A0‚Convertthechannelnumber(0-7)into?ŠMOVE.B(A0,D0.W),D0‡thecorrespondingbitnumber(1,2,4,8...).6ŠMOVE.WD0,ON_ACO+4-PBA(A4)Savethebitmaskvalue...ŠMOVE.WD0,OFF_ACO+4-PBA(A4)ŠMOVE.WD0,READ_ACO+4-PBA(A4) N*-----------------------------------------------------------------------------*4*‰Get„0=OUTPUTON„1=OUTPUTOFFƒ2=PULSEDOUTPUT*3=READSTATUS‚4=QUIT*4 N*-----------------------------------------------------------------------------GETCLST'ŠOUTPUTMESS4,MESS4E…Putupthemenu...ŠOUTPUTMESS5,MESS5EŠOUTPUTMESS6,MESS6EŠOUTPUTMESS7,MESS7EŠOUTPUTMESS8,MESS8EFGET_CHOICE‚OUTPUTMESS2,MESS2E…Asktheusertoenteroneoftheabove. +ŠINPUT‚INPUTBUF,INPUTBUF+8GettheirchoiceŠLEA„INPUTBUF(PC),A0)ŠBSR„CVT2ConvertASCIIdecimaltobinary'ŠIF.WD0#0OR.WD0#4THEN.SBRA.SGET_CHOICEŠENDIŠPAGE**‰0=StartoutputONcommand:*ŠIF.BD0#0THEN.S 'ŒBSR.L‚CLOSE_ALLˆGocloseallchannels./ŒOUTPUTMESS10,MESS10Eƒ<<<ƒStartingcommandƒ>>> >ŒMOVE.W#DEFAULT,D0†Usethedefaultconfigurationfortheopen$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A02ŒLEA„ON_ACO(PC),A1„StartoutputONparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#NLEN_ACO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1ŒIFTHEN.SŽMOVE.WON_ACO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)4ŽOUTPUTBADON,BADONE…***STARTOUTPUTONABORTED***ŽBRA.L‚SHOW_D0ŒENDI 3ŒOUTPUTMESS11,MESS11Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDI **‰1=TurnoutputOFFcommand:*ŠIF.BD0#1THEN.S 'ŒBSR.L‚CLOSE_ALLˆGocloseallchannels./ŒOUTPUTMESS10,MESS10Eƒ<<<ƒStartingcommandƒ>>> >ŒMOVE.W#DEFAULT,D0†Usethedefaultconfigurationfortheopen$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A03ŒLEA„OFF_ACO(PC),A1ƒTurnoutputOFFparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#FLEN_ACO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1ŒIFTHEN.SŽMOVE.WOFF_ACO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)6ŽOUTPUTBADOFF,BADOFFE„***TURNOUTPUTOFFABORTED***ŽBRA.L‚SHOW_D0ŒENDI 3ŒOUTPUTMESS11,MESS11Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDI **‰2=PULSEanoutputcommand:*ŠIF.BD0#2THEN.L3ŒBSR„GET_TIME‰Getthepulseduration(milliseconds)+ŒMOVE.LD3,PON_ACO+8-PBA(A4)Storethetime 'ŒBSR.L‚CLOSE_ALLˆGocloseallchannels./ŒOUTPUTMESS10,MESS10E…<<<ƒStartingcommandƒ>>> 7ŒMOVE.W#WAKEUP_O,D0…UsetheWAKEUPoptionfortheopen$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A06ŒLEA„PON_ACO(PC),A1ƒStartoutputpulseparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#PLEN_ACO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1*(*ƒDoawaituntilthedriverwakesusup*ŒMOVE.L#19,D0ŒTRAPƒ#1 ŒIFTHEN.SŽMOVE.WPON_ACO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4);ŽOUTPUTBADREAD,BADREADEƒ***STARTOUTPUTPULSEABORTED***ŽBRA.L‚SHOW_D0ŒENDI 3ŒOUTPUTMESS11,MESS11Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDI **‰3=READSTATUScommand:*ŠIF.BD0#3THEN.L /ŒOUTPUTMESS10,MESS10Eƒ<<<ƒStartingcommandƒ>>> ŒLEA„CMRBLK(PC),A00ŒLEA„READ_ACO(PC),A1‚ReadstatusparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#RLEN_ACO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1ŒIFTHEN.SŽMOVE.WREAD_ACO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)4ŽOUTPUTBADREAD,BADREADEƒ***READSTATUSABORTED***ŒENDI ŒCLR.L‚D0;ŒMOVE.WREAD_ACO+4-PBA(A4),D0‚GetthestatusvaluereturnedŒBSR„BHLCVTConvertittoASCII9ŒMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŒMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytesŒOUTPUTMESS9,MESS9EŒOUTPUTNUMBER,NUMBER+7ŒOUTPUTCRLF,CRLFE 3ŒOUTPUTMESS11,MESS11Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDI**‰4=quitcommand:*ŠIF.BD0<EQ>#4THEN.S'BSR.L‚CLOSE_ALLˆGocloseallchannels. BRA.LEXITŠENDI ŠBRA.LGETCHANGostartover.ŠPAGEM*----------------------------------------------------------------------------**ƒOPENTHECHANNEL*M*----------------------------------------------------------------------------OPEN_CHANLEA„CMRBLK(PC),A0ŠLEA„OPEN_ACO(PC),A1BŠMOVE.WD0,OPEN_ACO+8-PBA(A4)‚Savetheopenconfigurationoptions.ŠMOVE.LA1,$14(A0)ŠMOVE.W#OLEN_ACO,$18(A0)5 7ŠMOVE.L#CMR,D0ŒHereweperformanexecutiverequesttoŠTRAPƒ#1‘invokeCMR.ŠIFTHEN.SŒMOVE.LD0,STATUS-PBA(A4)+ŒOUTPUTBADOPN,BADOPNE…***OPENABORTED***ŒBRA.S‚SHOW_D0ŠENDIŠRTS M*----------------------------------------------------------------------------*+*‚GETTHETIMEDURATIONFORANOUTPUTPULSE*M*----------------------------------------------------------------------------GET_TIMEŠOUTPUTMESS3,MESS3EŠINPUT‚INPUTBUF,INPUTBUF+8ŠLEA„INPUTBUF(PC),A0 ŠBSR„ASCVAL ŠTST.L‚D3 ŠBEQ„GET_TIME+ŠIF.LD3#0OR.LD3#$FFFFTHEN.S ŒBRA„GET_TIMEŠENDIŠAND.L‚#$0000FFFF,D3ŠRTS M*----------------------------------------------------------------------------**ƒOUTPUTTHEERRORCODE:*M*----------------------------------------------------------------------------:SHOW_D0ƒMOVE.LSTATUS(PC),D0†GetthestatusvaluereturnedŠBSR„BHLCVTConvertittoASCII9ŠMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŠMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytesŠOUTPUTSTATUSM,STATUSMEŠOUTPUTNUMBER,NUMBER+7ŠOUTPUTCRLF,CRLFE EXITŠBSR.S‚CLOSE_ALL"ŠMOVE.L#15,D0TerminatethistaskŠTRAPƒ#1ŠPAGEN*-----------------------------------------------------------------------------**‚CLOSEALLCHANNEL'SROUTINE:*N*-----------------------------------------------------------------------------CLOSE_ALL MOVE.W D0,-(A7) ŠLEA„CMRBLK(PC),A0ŠLEA„CLSBLK(PC),A1ŠMOVE.LA1,$14(A0)ŠMOVE.W#CLOSLEN,$18(A0)7ŠMOVE.L#CMR,D0ŒTellCMRtoclosetheACOUTPUTchannelŠTRAPƒ#1ŠIFTHEN.SŒMOVE.LD0,STATUS-PBA(A4),ŒOUTPUTBADCLS,BADCLSE…***CLOSEABORTED***ŒMOVE.W(A7)+,D0‰Restorestack.%ŒBRA.L‚SHOW_D0ŠOutputtheerrorcode.ŠENDI ŠMOVE.W(A7)+,D0ŠRTS M*----------------------------------------------------------------------------*A*ƒTABLETOCONVERTTHECHANNELNUMBER(0-7)TOIT'SCORRESPONDING**ƒBITMAPPEDVALUE(1,2,4,8,16,32,64,128).*M*----------------------------------------------------------------------------$BIT_NUMBER‚DC.B‚1,2,4,8,16,32,64,128 ŠEND„PROGSTRTééééééé5 B*„ThisisTESTAC,arelocatableprogramthatteststheACOdriver.*$*„Copyrighted1983byMotorola,Inc.E**********************************************************************B*‚ThisprogramsetsupfortaskACO1andverifiesitexists.Ifit;*‚doesitproceedswiththetest,ifnotittrystaskACO2./*‚Ifeithertaskismissing,itskipsthetest.*:*‚Thisprogramperformsthefollowingtestsonthedriver:*9*ˆTEST1‚-‚individuallyopenseachchannel,outputstoit,-*’checksstatus,turnsitoff,checksstatus, *’andcloses.9*ˆTEST2‚-‚individuallyopenseachchannel,outputstoit,1*’checksstatus,continuesuntilallareon.Then,*’individuallyturnsoffeachchannel,checks0*’status,continuesuntilallareoff.Turnsall%*’channelsbackonforthenexttest.7*ˆTEST3‚-‚closesthechannels,OPERATORmustcheckthey *’turnedoff.4*ˆTEST4‚-‚opensallchannels,turnsallchannelson,-*’delays,turnsallchannelsoff,andcloses.9*ˆTEST5‚-‚individuallyopenseachchannel,commandspulse*’output,delays,andcloses.7*ˆTEST6‚-‚opensfourchannels,commandspulseoutputof3*’differentlengthstoeachsimultaneously,delays,*’closeschannels.;*ˆTEST7-ƒopenschanneltwowithqueueeventconfiguration,'*’pulsesoutput,waitsforqueueevent,)*’verifiesmessagesent,closeschannels.:*ˆTEST8‚-‚openschannelonewithwaitforwake-upconfig.,'*’pulsesoutput,waitsforwake-up,and*’closeschannels.:*ˆTEST9‚-‚trysoutputONwithchannelsclosedandverifies*’error.3*’trysoutputOFFwithchannelsclosedandverifies*’error./*’tryscheckingstatuswithchannelsclosedand*’verifieserror.,*’tryspulseoutputwithchannelsclosedand*’verifieserror.<*ˆTEST10-‚trysopeninginvalidchannelnumbersandverifies3*’errors.(ZEROchannels,morethaneightchannels,"*’channel#9,sametwochannels).:*ˆTEST11-‚openschannelandtrysinvalidcommands(0,6,*’7,>8)andverifieserrors. ¨/±P¹PÁPÉVÑ\Ù\áUéWñPùYZ YRR!W)b1=*ˆTEST12-‚trysopeningchannelswhentheyarealreadyopened*’andverifieserror.*>*ˆIfitpassedthesetestsitreturnstothetoptosetupfor2*’taskACO2.IfthiswasfortaskACO2,itsetsup$*’totestbothtaskssimultaneously.7*ˆIFALLTESTSARESUCCESSFUL,printsmessageattesting0*’tothatfact.Ifanytestfails,ERRORmessage$*’isprintedandtestisterminated.*D********************************************************************‰PAGE*5IOADR0ƒEQU‡$F80000VM02basememmapI/Ochanaddress5IOADR1ƒEQU‡$FA0000VM03basememmapI/Ochanaddress7IOADR2ƒEQU‡$FE6000VME110basememmapI/Ochanaddress7IOADR3ƒEQU‡$F1C000VME/10basememmapI/Ochanaddress* ‰SECTIONƒ0*TEST…LEA‡STACK(PC),A7‰LEA‡INITIO(PC),A0.‰CLR.W…DUALFG-INITIO(A0)ƒcleardualtestflags‰CLR.W…DUALCK-INITIO(A0)**SETUPA.S.Q.*!‰MOVE.L„#31,D0Žstagecommandcode-‰LEA‡ASQBLOCK(PC),A0…stagecommandparameters.‰LEA‡TESTIRQ(PC),A1†initializesaddr.ofasync*‰MOVE.L„A1,ASQLA-ASQBLOCK(A0)‚servicertn.‰TRAP†#1 ‰BNE‡FAULT11*‰MOVE.L„#'ACO1',D0(TNAME„LEA‡INITIO(PC),A0‡SETUPTASKNAME‰MOVE.L„D0,ACOPAR-INITIO(A0)‰MOVE.L„D0,TMSG-INITIO(A0)*!TRYBTHƒLEA‡SMSG24(PC),A1‡spaceup‰LEA‡EMSG24(PC),A2 ‰BSR‡MSGOUT*‰LEA‡SMSG24(PC),A1†again‰LEA‡EMSG24(PC),A2 ‰BSR‡MSGOUT*.‰LEA‡SMSG1(PC),A1ˆoutputstartoftestmessage‰LEA‡EMSG1(PC),A2 ‰BSR‡MSGOUT*‰LEA‡SMSG24(PC),A1‡spaceup‰LEA‡EMSG24(PC),A2 ‰BSR‡MSGOUT*‰LEA‡INITIO(PC),A0‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)+‰MOVE.W„#CLSLNG,A1ŠINSURECHANNEL(S)CLOSED$‰MOVE.W„A1,CMDL-INITIO(A0)‚TOSTART.‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT16*‰PAGE* *…OPENTHECHANNELSINDIVIDUALLY*5TEST1„LEA‡SMSG2(PC),A1‡output'open&output'message6 ‰LEA‡EMSG2(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*‰LEA‡EVNTCNT(PC),A0"‰CLR.W…0(A0)initializeparameters‰LEA‡INITIO(PC),A0*‰MOVE.W„#1,ONCMD1-INITIO(A0)'ON'bitmask,‰MOVE.W„#1,OFFCMD1-INITIO(A0)'OFF'bitmask2‰MOVE.W„#1,STATSHF-INITIO(A0)statusreq.bitmask;OPNLP„MOVE.W„EVNTCNT(PC),D0†OPENCHANNEL(eventcountholds‰LEA‡INITIO(PC),A0‡channel#)+‰MOVE.W„D0,OPNCH-INITIO(A0)channeltoopen‰LEA‡OPNCMDS(PC),A1,‰MOVE.L„A1,CMDA-INITIO(A0)‚parameterstoCMR‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*+‰LEA‡INITIO(PC),A0‡OUTPUTTOCHANNELOPENED‰LEA‡ONCMD(PC),A1,‰MOVE.L„A1,CMDA-INITIO(A0)‚parameterstoCMR ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT2*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#500,A0500MS‰TRAP†#1 ‰BNE‡FAULT15*!‰LEA‡OPNLP(PC),A1ˆloopbackaddr.&‰LEA‡TEST1B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*%TEST1BƒLEA‡INITIO(PC),A0‡CHECKSTATUS/‰MOVE.W„STATSHF(PC),D0†movechanneltocheckto1‰MOVE.W„D0,STAT-INITIO(A0)‚statusparameterblock‰LEA‡STATCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT3*3‰MOVE.W„STAT(PC),D0‰doesstatuscheckwithbitthat"‰CMP.W…ONCMD1(PC),D0‡shouldbeon? ‰BNE‡FAULT4*#‰LEA‡INITIO(PC),A0‡TURNOFFCHANNEL‰LEA‡OFFCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT5*‰LEA‡INITIO(PC),A0‡CHECKSTATUS/‰MOVE.W„STATSHF(PC),D0†movechanneltocheckto1‰MOVE.W„D0,STAT-INITIO(A0)‚statusparameterblock‰LEA‡STATCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT3*.‰MOVE.W„STAT(PC),D0‰doesstatuscheckshowbit#‰BNE‡FAULT4Žstillon?ifso,error.*#‰LEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST1B(PC),A1‡loopbackaddr.&‰LEA‡TEST1C(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*TEST1CƒLEA‡INITIO(PC),A0>‰ASL.W…ONCMD1-INITIO(A0)ƒshift'ON'channelbitmaskoneplace/‰ASL.W…OFFCMD1-INITIO(A0)‚shift'OFF'ƒ"…"ƒ"„"„"0‰ASL.W…STATSHF-INITIO(A0)‚shiftstatus‚"…"ƒ"„"„"‰LEA‡EVNTCNT(PC),A0'‰ADD.W…#1,0(A0)Œincrementeventcounter‰MOVE.W„EVNTCNT(PC),D0‰CMPI.W„#8,D0done? ‰BMI‡OPNLP*‰PAGE*2*„OUTPUTTOCHANNELSSEQUENTIALLYUNTILALLAREON*5TEST2„LEA‡SMSG3(PC),A1‡output'outputtoall'message‰LEA‡EMSG3(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*‰LEA‡EVNTCNT(PC),A0"‰CLR.W…0(A0)initializeparameters‰LEA‡INITIO(PC),A06‰MOVE.W„#1,ONCMD1-INITIO(A0)‚bitmaskfor'ON'channel9‰MOVE.W„#1,STATSHF-INITIO(A0)bitmaskforstatuschannel)OPNLP2ƒMOVE.W„EVNTCNT(PC),D0†OPENCHANNEL‰LEA‡INITIO(PC),A0‰MOVE.W„D0,OPNCH-INITIO(A0)/‰LEA‡INITIO(PC),A0‡pointtoCMRparameterblock‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*+‰LEA‡INITIO(PC),A0‡OUTPUTTOCHANNELOPENED‰LEA‡ONCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT2*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#500,A0500MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡OPNLP2(PC),A1‡loopbackaddr.&‰LEA‡TEST2A(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*1TEST2AƒLEA‡INITIO(PC),A0‡CHECKSTATUSOFCHANNELS‰MOVE.W„STATSHF(PC),D0‰MOVE.W„D0,STAT-INITIO(A0)‰LEA‡STATCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT3*&‰MOVE.W„STAT(PC),D0‰doesstatuscheck?‰CMP.W…STATSHF(PC),D0 ‰BNE‡FAULT4*"‰LEA‡TEST2A(PC),A16 ‡loopbackaddr.&‰LEA‡TEST2B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*TEST2BƒLEA‡INITIO(PC),A0>‰ASL.W…ONCMD1-INITIO(A0)ƒshift'ON'channelbitmaskoneplace‰ORI‡#$10,CCRŒsetXbit/‰ROXL.W„STATSHF-INITIO(A0)‚addstatusƒ"…"ƒ"„"„"‰LEA‡EVNTCNT(PC),A0'‰ADD.W…#1,0(A0)Œincrementeventcounter‰MOVE.W„EVNTCNT(PC),D0‰CMPI.W„#8,D0done? ‰BMI‡OPNLP2*7TEST2CƒLEA‡SMSG39(PC),A1‡output'turnoffseq.'message‰LEA‡EMSG39(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*‰LEA‡EVNTCNT(PC),A0"‰CLR.W…0(A0)initializeparameters‰LEA‡INITIO(PC),A08‰MOVE.W„#1,OFFCMD1-INITIO(A0)‚bitmaskfor'OFF'channel9‰MOVE.W„#1,STATSHF-INITIO(A0)bitmaskforstatuschannel*)OPNLP3ƒLEA‡INITIO(PC),A0‡TURNOFFCHANNEL‰LEA‡OFFCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT5*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#500,A0500MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡OPNLP3(PC),A1‡loopbackaddr.&‰LEA‡TEST2D(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*0TEST2DƒLEA‡INITIO(PC),A0‡CHECKSTATUSOFCHANNEL‰MOVE.W„STATSHF(PC),D0‰MOVE.W„D0,STAT-INITIO(A0)‰LEA‡STATCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT3*&‰MOVE.W„STAT(PC),D0‰doesstatuscheck? ‰BNE‡FAULT4*"‰LEA‡TEST2D(PC),A1‡loopbackaddr.&‰LEA‡TEST2E(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*TEST2EƒLEA‡INITIO(PC),A0@‰ASL.W…OFFCMD1-INITIO(A0)‚shift'OFF'channelbitmaskoneplace0‰ASL.W…STATSHF-INITIO(A0)‚shiftstatus‚"…"ƒ"„"„"‰LEA‡EVNTCNT(PC),A0'‰ADD.W…#1,0(A0)Œincrementeventcounter‰MOVE.W„EVNTCNT(PC),D0‰CMPI.W„#8,D0done? ‰BMI‡OPNLP3*+TEST2FƒLEA‡INITIO(PC),A0‡OUTPUTTOCHANNELS‰LEA‡ONCMDA(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT2*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡TEST2F(PC),A1‡loopbackaddr.%‰LEA‡TEST3(PC),A2ˆcontinueonforward‰BRA‡FLOPtestfortoggle**%**************************************ƒCLOSETEST–*%**************************************-TEST3„LEA‡SMSG4(PC),A1‡output'close'message‰LEA‡EMSG4(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*)TEST3AƒLEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST3A(PC),A1‡loopbackaddr.%‰LEA‡TEST4(PC),A2ˆcontinueonforward‰BRA‡FLOPtestfortoggle*‰PAGE$*„TURNONALLOUTPUTS,THENTURNOFF*9TEST4„LEA‡SMSG5(PC),A1‡output'turnon,turnoff'message‰LEA‡EMSG5(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15**TEST4AƒLEA‡INITIO(PC),A0‡OPENALLCHANNELS/‰LEA‡OPNCMD(PC),A1‡pointtoCMRparameterblock‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*,‰LEA‡INITIO(PC),A0‡OUTPUTTOCHANNELSOPENED‰LEA‡ONCMDA(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT2*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡TEST4A(PC),A1‡loopbackaddr.&‰LEA‡TEST4B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle**TEST4BƒLEA‡INITIO(PC),A0‡TURNOFFCHANNELS‰LEA‡OFFCMDA(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT5*#‰LEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST4B(PC),A1‡loopbackaddr.%‰LEA‡TEST5(PC),A7 2ˆcontinueonforward‰BRA‡FLOPtestfortoggle*‰PAGE*„PULSEEACHOUTPUTINTURN*2TEST5„LEA‡SMSG6(PC),A1‡output'pulseeach'message‰LEA‡EMSG6(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*‰LEA‡EVNTCNT(PC),A0‰CLR.W…0(A0)initializeevntcnt)OPNLP4ƒMOVE.W„EVNTCNT(PC),D0†OPENCHANNEL/‰LEA‡INITIO(PC),A0‡pointtoCMRparameterblock+‰MOVE.W„D0,OPNCH-INITIO(A0)channeltoopen,‰MOVE.W„D0,PLSO1-INITIO(A0)channeltopulse‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*‰LEA‡INITIO(PC),A0‰LEA‡PLSO(PC),A1‰PULSEOUTPUT‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#12,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT10*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡OPNLP4(PC),A1‡loopbackaddr.&‰LEA‡TEST5A(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*)TEST5AƒLEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST5A(PC),A1‡loopbackaddr.&‰LEA‡TEST5B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*TEST5BƒLEA‡EVNTCNT(PC),A0'‰ADD.W…#1,0(A0)Œincrementeventcounter‰MOVE.W„EVNTCNT(PC),D0‰CMPI.W„#8,D0done? ‰BMI‡OPNLP4*‰PAGE#*„PULSEFOUROUTPUTSSIMULTANEOUSLY*6TEST6„LEA‡SMSG32(PC),A1†output'pulsesimult.'message‰LEA‡EMSG32(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1500,A0Œ1500MS‰TRAP†#1 ‰BNE‡FAULT15*&TEST6AƒLEA‡INITIO(PC),A0‡OPENCHANNELS‰LEA‡OPNCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*‰LEA‡INITIO(PC),A0‰LEA‡PLSTWO(PC),A1‰PULSEOUTPUT‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#PLSTLG,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT10*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#500,A0500MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡TEST6A(PC),A1‡loopbackaddr.&‰LEA‡TEST6B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*TEST6BƒMOVE.L„#21,D0ŽDELAY‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*)TEST6CƒLEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST6C(PC),A1‡loopbackaddr.%‰LEA‡TEST7(PC),A2ˆcontinueonforward‰BRA‡FLOPtestfortoggle*‰PAGE+*„PULSEOUTPUTTWOANDGENERATEQUEUEEVENT*6TEST7„LEA‡SMSG7(PC),A1‡output'pulseoutput2'message‰LEA‡EMSG7(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*1TEST7AƒLEA‡RCVBUF(PC),A0‡ensureRCVBUFzeroedout‰MOVE.L„#0,0(A0)‰MOVE.L„#0,4(A0)‰MOVE.L„#0,8(A0)*‰LEA‡INITIO(PC),A09‰MOVE.W„#0,OPNCNF-INITIO(A0)setupconfig.(queueevent)‰MOVE.W„#2,D0OPENCHANNELTWO+‰MOVE.W„D0,OPNCH-INITIO(A0)‚channeltoopen,‰MOVE.W„D0,PLSO1-INITIO(A0)‚channeltopulse‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*‰LEA‡INITIO(PC),A0‰LEA‡PLSO(PC),A1‰PULSEOUTPUT‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#12,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT10*+WAITQ„MOVE.L„#36,D0Žrequestwaitforevent.$‰TRAP†#1’tobeissuedbyACOdriver. ‰BNE‡FAULT13*4‰MOVE.L„RCVBUF(PC),D0‡verifymessagereturnedbyASQ4‰CMP.L…#$0C010002,D0‡$0C01 ‰BNE‡FAULT6‰MOVE.L„RCVBUF+4(PC),D0‰CMP.L…ACOPAR(PC),D0‡ACO-ID ‰BNE‡FAULT6‰MOVE.L„RCVBUF+8(PC),D0,‰AND.L…#$FFFFFF00,D0‡maskoffloworderbyte0‰CMP.L…#IOADR0,D0ŠVM02memorymappedI/Oaddress ‰BEQ.S…TEST710‰CMP.L…#IOADR1,D0ŠVM03memorymappedI/Oaddress ‰BEQ.S…TEST722‰CMP.L…#IOADR2,D0ŠVME110memorymappedI/Oadd7 ress ‰BEQ.S…TEST732‰CMP.L…#IOADR3,D0ŠVME/10memorymappedI/Oaddress ‰BNE‡FAULT6*‰LEA‡SMSG43(PC),A1‰LEA‡EMSG43(PC),A2 ‰BSR‡MSGOUT ‰BRA.S…TEST74TEST71ƒLEA‡SMSG40(PC),A1‰LEA‡EMSG40(PC),A2 ‰BSR‡MSGOUT ‰BRA.S…TEST74TEST72ƒLEA‡SMSG41(PC),A1‰LEA‡EMSG41(PC),A2 ‰BSR‡MSGOUT ‰BRA.S…TEST74TEST73ƒLEA‡SMSG42(PC),A1‰LEA‡EMSG42(PC),A2 ‰BSR‡MSGOUT2TEST74ƒLEA‡SMSG38(PC),A1‡output'asqverified'msg‰LEA‡EMSG38(PC),A2 ‰BSR‡MSGOUT*"‰LEA‡TEST7A(PC),A1‡loopbackaddr.&‰LEA‡TEST7B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*)TEST7BƒLEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST7B(PC),A1‡loopbackaddr.&‰LEA‡TEST7C(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*6TEST7CƒMOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*‰PAGE'*…PULSEOUTPUTONEANDGENERATEWAKE-UP3TEST8„LEA‡SMSG8(PC),A1‡output'pulseled1'message‰LEA‡EMSG8(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*1TEST8AƒLEA‡INITIO(PC),A0‡pointtoCMRpara.block5‰MOVE.W„#1,OPNCNF-INITIO(A0)setupconfig.(wake-up)‰MOVE.W„#1,D0OPENCHANNELONE+‰MOVE.W„D0,OPNCH-INITIO(A0)‚channeltoopen,‰MOVE.W„D0,PLSO1-INITIO(A0)‚channeltopulse‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*‰LEA‡INITIO(PC),A0‰LEA‡PLSO(PC),A1‰PULSEOUTPUT‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#12,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT10*-WAITW„MOVE.L„#19,D0Žrequestwaitforwake-up.$‰TRAP†#1’tobeissuedbyACOdriver. ‰BNE‡FAULT130‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡TEST8A(PC),A1‡loopbackaddr.&‰LEA‡TEST8B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*)TEST8BƒLEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST8B(PC),A1‡loopbackaddr.&‰LEA‡TEST8C(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*6TEST8CƒLEA‡INITIO(PC),A0‡restoredefaultconfiguration ‰MOVE.W„#$8000,OPNCNF-INITIO(A0)2‰MOVE.W„#0,OPNCH-INITIO(A0)restorechannelselect1‰MOVE.W„#1,STAT-INITIO(A0)‚restorestatuschannel3‰MOVE.W„#1,OFFCMD1-INITIO(A0)‚restoreoffcmdchan.*‰PAGE#*„TRYCOMMANDSWITHCHANNELSCLOSED7TEST9„LEA‡SMSG9(PC),A1‡output'trywithclosed'message‰LEA‡EMSG9(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*1TEST9AƒLEA‡INITIO(PC),A0‡OUTPUTTOCLOSEDCHANNEL‰LEA‡ONCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1)‰MOVE.W„ONCMD(PC),D0ˆreadreturnedstatus(‰CMP.W…#$F2,D0verifycorrecterrorcode ‰BNE‡FAULT2 ‰LEA‡SMSG12(PC),A1‡outputokmsg‰LEA‡EMSG12(PC),A2 ‰BSR‡MSGOUT*#‰LEA‡INITIO(PC),A0‡TURNOFFCHANNEL‰LEA‡OFFCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1*‰MOVE.W„OFFCMD(PC),D0‡readreturnedstatus(‰CMP.W…#$F2,D0verifycorrecterrorcode ‰BNE‡FAULT5‰LEA‡SMSG14(PC),A1‡offokmsg‰LEA‡EMSG14(PC),A2 ‰BSR‡MSGOUT*‰LEA‡INITIO(PC),A0‡CHECKSTATUS‰LEA‡STATCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1+‰MOVE.W„STATCMD(PC),D0†readreturnedstatus(‰CMP.W…#$F2,D0verifycorrecterrorcode ‰BNE‡FAULT3 ‰LEA‡SMSG16(PC),A1‡statusokmsg‰LEA‡EMSG16(PC),A2 ‰BSR‡MSGOUT*‰LEA‡INITIO(PC),A0‰LEA‡PLSO(PC),A1‰PULSEOUTPUT‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#12,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1(‰MOVE.W„PLSO(PC),D0‰readreturnedstatus(‰CMP.W…#$F6,D0verifycorrecterrorcode ‰BNE‡FAULT10*"‰LEA‡TEST9A(PC8 ),A1‡loopbackaddr.&‰LEA‡TEST9B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*%TEST9BƒLEA‡SMSG18(PC),A1‡pulseokmsg‰LEA‡EMSG18(PC),A2 ‰BSR‡MSGOUT*‰PAGE*ƒTRYTOOPENINVALIDCHANNELS6TEST10ƒLEA‡SMSG11(PC),A1‡output'tryinvalidchannels'‰LEA‡EMSG11(PC),A2 ‰BSR‡MSGOUT0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*3TEST10A‚LEA‡INITIO(PC),A0‡TRYTOOPENZEROCHANNELS‰LEA‡OPNCH0(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNCHL,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1%‰MOVE.W„OPNCH0(PC),D0‡readcmdstatus‰CMP.W…#$F7,D0 ‰BNE‡FAULT7*3‰LEA‡INITIO(PC),A0‡TRYTOOPENMORETHAN8CHANNELS‰LEA‡OPNMOR(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNML,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1%‰MOVE.W„OPNMOR(PC),D0‡readcmdstatus‰CMP.W…#$F7,D0 ‰BNE‡FAULT7*,‰LEA‡INITIO(PC),A0‡TRYTOOPENCHANNEL#>8‰LEA‡OPNCH9(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNC9L,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1%‰MOVE.W„OPNCH9(PC),D0‡readcmdstatus‰CMP.W…#$F6,D0 ‰BNE‡FAULT7*0‰LEA‡INITIO(PC),A0‡TRYTOOPENSAMETWOCHANNELS‰LEA‡OPNTW(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNTL,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1$‰MOVE.W„OPNTW(PC),D0ˆreadcmdstatus‰CMP.W…#$FE,D0 ‰BNE‡FAULT7*#‰LEA‡TEST10A(PC),A1†loopbackaddr.'‰LEA‡TEST10B(PC),A2†continueonforward‰BRA‡FLOPtestfortoggle*6TEST10B‚LEA‡SMSG36(PC),A1‡output'invalidchannelsok'‰LEA‡EMSG36(PC),A2 ‰BSR‡MSGOUT*‰PAGE*„TRYTOUSEINVALIDCOMMANDS*2TEST11ƒLEA‡SMSG25(PC),A1‡output'tryinvalidcmds'‰LEA‡EMSG25(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*&TEST11A‚LEA‡INITIO(PC),A0‡OPENCHANNEL‰MOVE.W„#1,OPNCH-INITIO(A0)‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*$‰LEA‡INITIO(PC),A0‡INVALIDCOMMAND0‰LEA‡INVCM0(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#4,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1*‰MOVE.W„INVCM0(PC),D0‡readreturnedstatus‰CMP.W…#$F4,D0 ‰BNE‡FAULT9*$‰LEA‡INITIO(PC),A0‡INVALIDCOMMAND6‰LEA‡INVCM6(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#4,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1*‰MOVE.W„INVCM6(PC),D0‡readreturnedstatus‰CMP.W…#$F4,D0 ‰BNE‡FAULT9*$‰LEA‡INITIO(PC),A0‡INVALIDCOMMAND7‰LEA‡INVCM7(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#4,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1*‰MOVE.W„INVCM7(PC),D0‡readreturnedstatus‰CMP.W…#$F4,D0 ‰BNE‡FAULT9*&‰LEA‡INITIO(PC),A0‡INVALIDCOMMAND>8‰LEA‡INVCM9(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#4,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1*‰MOVE.W„INVCM9(PC),D0‡readreturnedstatus‰CMP.W…#$F4,D0 ‰BNE‡FAULT9*#‰LEA‡TEST11A(PC),A1†loopbackaddr.'‰LEA‡TEST11B(PC),A2†continueonforward‰BRA‡FLOPtestfortoggle*-TEST11B‚LEA‡SMSG26(PC),A1‡invalidcmdsokmsg‰LEA‡EMSG26(PC),A2 ‰BSR‡MSGOUT*‰PAGE*„TRYOPENANDALREADYOPENED9TEST12ƒLEA‡SMSG20(PC),A1†output'trywithopened'message‰LEA‡EMSG20(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*6TEST12A‚LEA‡INITIO(PC),A0‡pointtoCMRparameterblock(‰MOVE.W„#0,OPNCH-INITIO(A0)OPENCHANNEL‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*/‰LEA‡INITIO(PC),A0‡pointtoCMRparameterblock‰LEA‡OPNCMDS(PC),A1)‰MOVE.L„A1,CMDA-INITIO(A0)‚TRYOPENagain‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1+‰MOVE.W„OPNCMDS(PC),D0‡readreturnedstatus‰CMP.W…#$FE,D0 ‰BNE.S…FAULT1*#‰LEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡C8 LSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*#‰LEA‡TEST12A(PC),A1†loopbackaddr.%‰LEA‡TESTC(PC),A2ˆcontinueonforward‰BRA‡FLOPtestfortoggle*1**************************************************„TESTCOMPLETED*1************************************************* TESTC„LEA‡SMSG24(PC),A1‡spaceup‰LEA‡EMSG24(PC),A2 ‰BSR‡MSGOUT*1‰LEA‡SMSG23(PC),A1†output'testcomplete'message‰LEA‡EMSG23(PC),A2 ‰BSR‡MSGOUT*‰LEA‡SMSG24(PC),A1†spaceup‰LEA‡EMSG24(PC),A2 ‰BSR‡MSGOUT*#NEXT…MOVE.W„DUALFG(PC),D0‡flagset? ‰BNE‡TERM.NEXTA„MOVE.L„ACOPAR(PC),D0‡tryforsecondtask‰CMP.L…#'ACO1',D0‰BNE‡TERMAdone‰MOVE.L„#'ACO2',D0‰BRA‡TNAMEsetupsecondtask*‰PAGE*#FAULT1ƒLEA‡SMSG22(PC),A1‡openerror‰LEA‡EMSG22(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM%FAULT2ƒLEA‡SMSG13(PC),A1‡outputerror‰LEA‡EMSG13(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM%FAULT3ƒLEA‡SMSG17(PC),A1‡statuserror‰LEA‡EMSG17(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM+FAULT4ƒLEA‡SMSG28(PC),A1‡statuscheckerror‰LEA‡EMSG28(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM"FAULT5ƒLEA‡SMSG15(PC),A1‡offerror‰LEA‡EMSG15(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM*FAULT6ƒLEA‡SMSG10(PC),A1‡ASQmessageerror‰LEA‡EMSG10(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM.FAULT7ƒLEA‡SMSG21(PC),A1‡invalidchannelerror‰LEA‡EMSG21(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM$FAULT8ƒLEA‡SMSG33(PC),A1‡closeerror‰LEA‡EMSG33(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM.FAULT9ƒLEA‡SMSG27(PC),A1‡invalidcmderrormsg‰LEA‡EMSG27(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM%FAULT10‚LEA‡SMSG19(PC),A1‡pulseerror‰LEA‡EMSG19(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM#FAULT11‚LEA‡SMSG30(PC),A1‡ASQerror‰LEA‡EMSG30(PC),A2 ‰BSR‡MSGOUT ‰BRA.S…TERM#FAULT12‚LEA‡SMSG29(PC),A1‡ASQerror‰LEA‡EMSG29(PC),A2 ‰BSR.S…MSGOUT ‰BRA.S…TERM6FAULT13‚LEA‡SMSG31(PC),A1‡WAKE-UPorQUEUEEVENTerror‰LEA‡EMSG31(PC),A2 ‰BSR.S…MSGOUT ‰BRA.S…TERM2FAULT14‚LEA‡SMSG34(PC),A1‡IOS(trap#2)callerror‰LEA‡EMSG34(PC),A2 ‰BSR.S…MSGOUT ‰BRA.S…TERM*FAULT15‚LEA‡SMSG35(PC),A1‡calldelayerror‰LEA‡EMSG35(PC),A2 ‰BSR.S…MSGOUT ‰BRA.S…TERM/FAULT16‚LEA‡SMSG37(PC),A1‡non-existanttaskmsg‰LEA‡EMSG37(PC),A2 ‰BSR.S…MSGOUT(‰LEA‡DUALFG(PC),A0‡setflagtoeliminate‰ADD.W…#1,(A0)dualtest ‰BRA‡NEXTA**„DE-ACTIVATESELF*0TERMA„LEA‡INITIO(PC),A0‡testfordualboardtest‰TST.W…DUALFG-INITIO(A0) ‰BNE.S…TERM4‰MOVE.W„#1,DUALFG-INITIO(A0)‚setupfordualbdtest‰MOVE.W„#1,DUALCK-INITIO(A0)!‰MOVE.L„#'ACO1',ACOPAR-INITIO(A0)*‰MOVE.L„#'ACO1',TMSG-INITIO(A0)‚setupmsg‰MOVE.W„#'&2',TMSG+4-INITIO(A0) ‰BRA‡TRYBTH*%TERM…MOVE.L„#32,D0ŽDE-ALLOCATEA.S.Q.‰TRAP†#1**‰MOVE.L„#15,D0ŽNOWDE-ACTIVATESELF(EXIT)‰TRAP†#1**„MESSAGEOUTPUTSUBROUTINE*/MSGOUTƒLEA‡MSG(PC),A0Šoutputmessagepointedto(‰MOVE.L„A1,X1-MSG(A0)‡byA1,endedbyA2‰MOVE.L„A2,X2-MSG(A0)‰TRAP†#2 ‰BNE‡FAULT14‰RTS*1FLOP…LEA‡INITIO(PC),A0‡togglebetweenACO1&ACO2‰MOVE.W„DUALCK-INITIO(A0),D0 ‰BEQ.S…FLOP2continueonifzero‰CMP.W…#1,D0seeif=1 ‰BNE.S…FLOP11‰MOVE.W„#2,DUALCK-INITIO(A0)‚is=1,setupfor2!‰MOVE.L„#'ACO2',ACOPAR-INITIO(A0)‰JMP‡(A1)loopback6FLOP1„MOVE.W„#1,DUALCK-INITIO(A0)‚is=2,setupfor1!‰MOVE.L„#'ACO1',ACOPAR-INITIO(A0))FLOP2„JMP‡(A2)continueonwithnexttest*-*ƒMOVETHEASQMESSAGEFROMTHEASQTORCVBUF*8TESTIRQ‚EQU‡*‰entrypointmovingdatafromASQtoRCVBUF!‰MOVE.L„#34,D0„stagecommandcode‰LEA‡RCVBUF(PC),A0‰TRAP†#1 ‰BNE‡FAULT12*„RETURNFROMEVENT!‰MOVE.L„#37,D0„stagecommandcode ‰MOVE.W„#1,A0‰TRAP†#1*‰PAGE**„CMRparameterblock*INITIOƒDC.B†7,0,0,0ACOPARƒDC.L†'ACO1'„TASKNAME ‰DC.L†0,0,0*CMDA…DC.L†0‰addressofACOparameterblockCMDL…DC.W†0‰commandlength**„A.S.Q.parameterblock*ASQBLOCKEQU‡*‰DC.L†0‰taskname‰DC.L†0‰dummyfield*‰DC.B†5‰ASQ&ASRenabled=initialstatus"‰DC.B†16ˆlengthofmessageforASQ‰DC.L†16ˆstoragefor4events?ASQLA„DC.L†TESTIRQƒlogicaladdressoftargettaskasync9 svcrtn‰DC.L†0‰dummyfieldASQLNGƒEQU‡*-ASQBLOCK*0*„ACOparameterblocktoopenindividualchannel*OPNCMDS‚DC.W†0‰returnedstatus‰DC.W†1‰OPENcommandcode‰DC.W†1‰open1channelOPNCH„DC.W†0‰channel#/OPNCNFƒDC.W†$8000…DefaultchannelconfigurationOPNLNGS‚EQU‡*-OPNCMDSlength***„ACOparameterblocktoopenALLchannels*OPNCMDƒDC.W†0‰returnedstatus‰DC.W†1‰OPENcommandcode‰DC.W†8‰open8channels*‰DC.W†0,$8000ƒCHAN0,defaultconfiguration‰DC.W†1,$8000ƒCHAN1,ƒ"‰"‰DC.W†2,$8000ƒCHAN2,ƒ"‰"‰DC.W†3,$8000ƒCHAN3,ƒ"‰"‰DC.W†4,$8000ƒCHAN4,ƒ"‰"‰DC.W†5,$8000ƒCHAN5,ƒ"‰"‰DC.W†6,$8000ƒCHAN6,ƒ"‰"‰DC.W†7,$8000ƒCHAN7,ƒ"‰"OPNLNGƒEQU‡*-OPNCMD‚length*#*ƒparameterblockforCLOSEcommand*CLSCMDƒDC.W†0‰returnedstatus‰DC.W†2‰CLOSEcommand(CLSLNGƒEQU‡*-CLSCMD‚closecommandlength*$*…ACOparameterblockforONcommand* ONCMD„EQU‡*‰DC.W†0‰returnedcommandstatus‰DC.W†3‰OUTPUTONcommand,ONCMD1ƒDC.W†1‰bitmaskofchanneltoturnON* ONCMDAƒEQU‡*‰DC.W†0‰returnedcommandstatus‰DC.W†3‰OUTPUTONcommand,‰DC.W†$00FF…bitmasktoturnONallchannels*%*…ACOparameterblockforOFFcommand* OFFCMDƒEQU‡*&‰DC.W†0‰returncommandstatuslocation‰DC.W†4‰OFFcommand.OFFCMD1‚DC.W†1‰bitmaskofchanneltoturnOFF* OFFCMDA‚EQU‡*&‰DC.W†0‰returncommandstatuslocation‰DC.W†4‰OFFcommand-‰DC.W†$00FF…bitmasktoturnOFFallchannels*$*„parameterblockforSTATUScommand* STATCMD‚EQU‡*‰DC.W†0‰returnedcommandstatus‰DC.W†5‰STATUScommand2STAT…DC.W†1‰bitmask&readstatusofchannels0-7*:*„ACOparameterblocktodo1000msPULSEonselectedchan*PLSO…DC.W†0‰returnedcmdstatus‰DC.W†8‰PULSEcommandcode‰DC.W†1‰onechannelPLSO1„DC.W†1‰pulsechannel#‰DC.L†500‡500mspulse*7*„parameterblocktoPULSEfourchannelssimultaneously*!PLSTWOƒDC.W†0‰returnedcmdstatus‰DC.W†8‰PULSEcommandcode‰DC.W†4‰fourchannels‰DC.W†4‰chan.#4‰DC.L†250‡250ms‰DC.W†5‰chan.#5‰DC.L†500‡500ms‰DC.W†6‰chan.#6‰DC.L†750‡750ms‰DC.W†7‰chan.#7‰DC.L†1000†1000msPLSTLGƒEQU‡*-PLSTWO*"*„INVALIDCHANNELparameterblocks*!OPNCH0ƒDC.W†0‰returnedcmdstatus‰DC.W†1‰OPENcommandcode‰DC.W†0‰openzerochannels‰DC.W†0‰channel0‰DC.W†$8000…config.OPNCHLƒEQU‡*-OPNCH0*!OPNCH9ƒDC.W†0‰returnedcmdstatus‰DC.W†1‰OPENcmdcode‰DC.W†1‰openonechannel‰DC.W†9‰openchannel#9‰DC.W†$8000…config.OPNC9LƒEQU‡*-OPNCH9* OPNTW„DC.W†0‰returnedcmdstatus‰DC.W†1‰OPENcmdcode‰DC.W†3‰openthreechan.‰DC.W†1,$8000ƒchan,config.‰DC.W†2,$8000ƒchan,config.‰DC.W†2,$8000ƒchan,config.OPNTL„EQU‡*-OPNTW*!OPNMORƒDC.W†0‰returnedcmdstatus‰DC.W†1‰OPENcmdcode‰DC.W†9‰open9channels‰DC.W†0,$8000ƒchan,config.‰DC.W†1,$8000ƒchan,config.‰DC.W†2,$8000ƒchan,config.‰DC.W†3,$8000ƒchan,config.‰DC.W†4,$8000ƒchan,config.‰DC.W†5,$8000ƒchan,config.‰DC.W†6,$8000ƒchan,config.‰DC.W†7,$8000ƒchan,config.‰DC.W†8,$8000ƒchan,config.OPNML„EQU‡*-OPNMOR*#*…INVALIDCOMMANDSparameterblocks*!INVCM0ƒDC.W†0‰returnedcmdstatus‰DC.W†0‰invalidcommand0*!INVCM6ƒDC.W†0‰returnedcmdstatus‰DC.W†6‰invalidcommand6*!INVCM7ƒDC.W†0‰returnedcmdstatus‰DC.W†7‰invalidcommand7*!INVCM9ƒDC.W†0‰returnedcmdstatus"‰DC.W†9‰invalidcmdgreaterthan8**„IOSMESSAGEparameterblock*MSG†DC.B†0‰Dataxfercode=0‰DC.B†2‰Writedata‰DC.W†0‰Options-none‰DC.B†0‰Status ‰DC.B†6‰LUN‰DC.W†0‰reserved‰DC.L†0‰randomrecordcountX1‡DC.L†0‰bfrstartaddr.X2‡DC.L†0‰bfrendaddr.‰DC.L†0‰lengthofdataxfer ‰DC.L†0‰completion/serviceaddr.*‰PAGE *„MESSAGES*6SMSG1„DC.W†'**********ACOUTPUTTESTPROGRAM******'TMSG…DC.W†'ACO1‚' EMSG1„EQU‡*-1*8SMSG2„DC.W†'‚OPEN&OUTPUTTOEACHCHANNELINDIVIDUALLY' EMSG2„EQU‡*-1*9SMSG3„DC.W†'‚OPEN&OUTPUTEACHCHANNELUNTILALLAREON' EMSG3„EQU‡*-1*5SMSG4„DC.W†'‚CLOSECHANNELS,OUTPUTSSHOULDTU9 RNOFF' EMSG4„EQU‡*-1*0SMSG5„DC.W†'‚TURNONALLOUTPUTS,THENTURNOFF' EMSG5„EQU‡*-1*'SMSG6„DC.W†'‚PULSEEACHOUTPUTINTURN' EMSG6„EQU‡*-1*5SMSG7„DC.W†'‚PULSEOUTPUT2ANDGENERATEQUEUEEVENT' EMSG7„EQU‡*-1*1SMSG8„DC.W†'‚PULSEOUTPUT1ANDGENERATEWAKE-UP' EMSG8„EQU‡*-1*/SMSG9„DC.W†'‚TRYCOMMANDSWITHCHANNELSCLOSED' EMSG9„EQU‡*-1**SMSG10ƒDC.W†'‚INVALIDASQMESSAGE-ERROR'EMSG10ƒEQU‡*-1*+SMSG11ƒDC.W†'‚TRYTOOPENINVALIDCHANNELS'EMSG11ƒEQU‡*-1*4SMSG12ƒDC.W†'‚CALLOUTPUTANDCHANNELSCLOSED-OK!'EMSG12ƒEQU‡*-1*"SMSG13ƒDC.W†'‚CALLOUTPUT-ERROR'EMSG13ƒEQU‡*-1*1SMSG14ƒDC.W†'‚CALL‚OFFƒANDCHANNELSCLOSED-OK!'EMSG14ƒEQU‡*-1*SMSG15ƒDC.W†'‚CALLOFF-ERROR'EMSG15ƒEQU‡*-1*4SMSG16ƒDC.W†'‚CALLSTATUSANDCHANNELSCLOSED-OK!'EMSG16ƒEQU‡*-1*"SMSG17ƒDC.W†'‚CALLSTATUS-ERROR'EMSG17ƒEQU‡*-1*3SMSG18ƒDC.W†'‚CALLPULSE‚ANDCHANNELSCLOSED-OK!'EMSG18ƒEQU‡*-1*!SMSG19ƒDC.W†'‚CALLPULSE-ERROR'EMSG19ƒEQU‡*-1*4SMSG20ƒDC.W†'‚TRYCALLOPENANDALREADYOPENED-OK!'EMSG20ƒEQU‡*-1*&SMSG21ƒDC.W†'‚INVALIDCHANNEL-ERROR'EMSG21ƒEQU‡*-1* SMSG22ƒDC.W†'‚CALLOPEN-ERROR'EMSG22ƒEQU‡*-1*9SMSG23ƒDC.W†'‚******TESTCOMPLETEDSUCCESSFULLY*******'EMSG23ƒEQU‡*-1*SMSG24ƒDC.W†'‚'EMSG24ƒEQU‡*-1**SMSG25ƒDC.W†'‚TRYTOUSEINVALIDCOMMANDS'EMSG25ƒEQU‡*-1**SMSG26ƒDC.W†'‚CALL„INVALID„COMMANDS„-‚OK!'EMSG26ƒEQU‡*-1*&SMSG27ƒDC.W†'‚INVALIDCOMMAND-ERROR'EMSG27ƒEQU‡*-1*#SMSG28ƒDC.W†'‚STATUSCHECK-ERROR'EMSG28ƒEQU‡*-1*"SMSG29ƒDC.W†'‚A.S.Q.MOVE‚-ERROR'EMSG29ƒEQU‡*-1*SMSG30ƒDC.W†'‚A.S.Q.-ERROR'EMSG30ƒEQU‡*-1*$SMSG31ƒDC.W†'‚WAKEUPORQUEUEERROR'EMSG31ƒEQU‡*-1*9SMSG32ƒDC.W†'‚PULSECHANNELS4,5,6,&7SIMULTANEOUSLY'EMSG32ƒEQU‡*-1*!SMSG33ƒDC.W†'‚CALLCLOSE-ERROR'EMSG33ƒEQU‡*-1*#SMSG34ƒDC.W†'‚TRAP#2(IOS)ERROR'EMSG34ƒEQU‡*-1*!SMSG35ƒDC.W†'‚CALLDELAY-ERROR'EMSG35ƒEQU‡*-1**SMSG36ƒDC.W†'‚CALL„INVALID„CHANNELS„-‚OK!'EMSG36ƒEQU‡*-1*‰PAGE*:SMSG37ƒDC.W†'---NON-EXISTANTTASK/BOARD-------^'EMSG37ƒEQU‡*-1*&SMSG38ƒDC.W†'‚A.S.Q.MESSAGEVERIFIED'EMSG38ƒEQU‡*-1*-SMSG39ƒDC.W†'‚TURNOFFCHANNELSSEQUENTIALLY'EMSG39ƒEQU‡*-1*SMSG40ƒDC.W†'‚VM02'EMSG40ƒEQU‡*-1*SMSG41ƒDC.W†'‚VM03'EMSG41ƒEQU‡*-1*SMSG42ƒDC.W†'‚VME110'EMSG42ƒEQU‡*-1*SMSG43ƒDC.W†'‚VME/10'EMSG43ƒEQU‡*-1*‰PAGE*EVNTCNT‚DS.W†1‰eventcounter!STATSHF‚DS.W†1‰statusbitshifter1DUALFGƒDS.W†1‰dualboardtestflag(1=donottest)ŠMOVE.LA0,IOSOUT+16-PBA(A4)SettheendingaddressofmessageŠLEA„IOSOUT(PC),A0ŠTRAPƒ#2ŠENDM ŠPAGE 2ŠOPT„PCSWeuseaPCSoptionsotheassemblerwill%*£forcePCrelativeaddressingwithin(*£SECTION.‚ForcesPCrelativeaddressing-*£(wheneversuchanaddressingmodeislegal))*£inaninstructionwhichoccurswithina'*£relocatableSECTIONandreferencesan,*£operandinarelocatableSECTION(neednot**£bethesameSECTIONastheinstruction).,*£Failuretoresolvesucnareferenceintoa-*£16-bitdisplacementfromthePCwillresult)*£inanerror.‚Thisoptionmaybeusedto+*£forcepositionindependentcode;however,(*£thisoptiondoesnotforcePCrelative,*£addressingofabsoluteoperandsorunknown*£forwardreferences. ŠPAGE N*******************************************************************************Ì**™DATAƒSECTIONœ**Ì*N****************************************************************************** ŠSECTIONDATA $PBA‡EQU„*’ProgramBaseAddress(PBA)%*£Thislabelisusedtodesignatethe+*£beginningoftheprogram.‚Thisisusedto'*£makereferencestootherpartsofthe*£program,relocatable. 9ŠDS.WƒSTACKLEN‹ThisisthestackareafortheVME625test2STACK…EQU„*’program.‚Registersandotherimportant,*£informationwillbestoredonthestackas)*£theprogramisexecuted.‚Thestackarea'*£isdynamicandwillchangeduringthe *£executionofthetestprogram. =INPUTBUF‚DS.WƒSTRNGLEN‹Thisisthestorageareafortheinput*£stringsthatareentered. 9STATUS„DS.Lƒ1’Thiswillbethestorageareforthestatus,*£codethatisreturnedfromCMR.‚Thisvalue-*£willbedisplayedtoshowtheuserwhatthe*£errorcodewas. 6NUMBER„DS.Lƒ2’SaveareafortheASCIIvalueofSTATUS.ŠPAGE N*******************************************************************************Ì*!*–PARAMETERƒBLOCKS—**Ì*N****************************************************************************** ŠNEXTWB”ForceevenboundaryIOSOUTŠDC.Bƒ0’Requestcode"ŠDC.BƒWRITEŽFunctionspecificationŠDC.Wƒ8’OptionsŠDC.Bƒ0’StatusŠDC.BƒCRTLogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress   ŠNEXTWB”ForceevenboundaryIOSINŠDC.Bƒ0’Requestcode!ŠDC.BƒREADFunctionspecificationŠDC.Wƒ0’OptionsŠDC.Bƒ0’Status"ŠDC.BƒKEYBOARD‹LogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress  CMRBLK„DC.Bƒ7’InitiateI/OŠDC.BƒUNUSEDUnusedŠDC.WƒUNUSEDUnusedŠDC.Lƒ'DCO1'ChannelnameŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnused$ŠDC.Lƒ0’AddressofI/Ocontrolblock#ŠDC.Lƒ0’LengthofI/OcontrolblockŠPAGE*8*‚OPENcommandparameterblockfortheDCOUTPUTdriver:+OPEN_DCO‚DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒOPENOpencommandcodeŠDC.Wƒ1’#ofchannelstoopen-ŠDC.Wƒ0’Channeltoopen(Dynamicallychanged)-ŠDC.WƒDEFAULTŒChannelconfiguration(Dynamic)6OLEN_DCO‚EQU„*-OPEN_DCO‰LengthofOPENparameterblock*C*‚STARTOUTPUTONcommandparameterblockfortheDCOUTPUTdriver:)ON_DCO„DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒON‘ONcommandcode2ŠDC.Wƒ0’Bitmaskforchannelstoturnon(Dynamic)2NLEN_DCO‚EQU„*-ON_DCO‹LengthofONparameterblock*C*‚TURNOUTPUTOFFcommandparameterblockfortheDCOUTPUTdriver:*OFF_DCOƒDC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒOFFOffcommandcode3ŠDC.Wƒ0’Bitmaskforchannelstoturnoff(Dynamic)4FLEN_DCO‚EQU„*-OFF_DCOŠLengthofOFFparameterblock*< A*‚PULSEDOUTPUTcommandparameterblockfortheDCOUTPUTdriver:*PON_DCOƒDC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒPULSEŽPulsecommandcodeŠDC.Wƒ1’#ofchannels,ŠDC.Wƒ0’Channelnumber(Dynamicallychanged)/ŠDC.Lƒ0’Timeofpulseinmilliseconds(Dynamic)6PLEN_DCO‚EQU„*-PON_DCOŠLengthofPULSEparameterblock*F*‚READOUTPUTSTATUScommandparameterblockfortheDCOUTPUTdriver:+READ_DCO‚DC.Wƒ0’Returnedstatusfromdriver*ŠDC.WƒREAD_STATUSˆReadstatuscommandcode.ŠDC.Wƒ0’Bitmaskforchannelstoreadandupon(*£returnholdstheactualchannelstatus=RLEN_DCO‚EQU„*-READ_DCO‰LengthofREADSTATUSparameterblock*9*‚CLOSEcommandparameterblockfortheDCOUTPUTdriver:)CLSBLK„DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒCLOSEŽClosecommandcodeCLOSLENƒEQU„*-CLSBLKŠNEXTWBŠPAGE N*******************************************************************************Ì**œMESSAGES¡**Ì*N****************************************************************************** ŠSECTIONMESSAGES 9HEAD†DC.BƒCR,LF,LF,'MVME625DriverTestProgram',CR,LF,LF HEADE…EQU„*-1ŠNEXTWB1MESS1…DC.Bƒ'…Numberofthechanneltoconvertˆ>'MESS1E„EQU„*-1ŠNEXTWB(MESS2…DC.Bƒ'…Enteroneoftheabove...'MESS2E„EQU„*-1ŠNEXTWB8MESS3…DC.Bƒ'…Time(inmilliseconds)foroutputpulse>'MESS3E„EQU„*-1ŠNEXTWB+MESS4…DC.BƒCR,LF,LF,'…0=OUTPUTON.',CR,LFMESS4E„EQU„*-1ŠNEXTWB#MESS5…DC.Bƒ'…1=OUTPUTOFF.',CR,LFMESS5E„EQU„*-1ŠNEXTWB=MESS6…DC.Bƒ'…2=PULSEANOUTPUTFORASPECIFIEDTIME.',CR,LFMESS6E„EQU„*-1ŠNEXTWB7MESS7…DC.Bƒ'…3=READTHECURRENTOUTPUTSTATUS.',CR,LFMESS7E„EQU„*-1ŠNEXTWB MESS8…DC.Bƒ'…4=QUIT.',CR,LF,LFMESS8E„EQU„*-1ŠNEXTWB4MESS9…DC.BƒCR,LF,'STATUSOFALLCHANNELS(ASCII)='MESS9E„EQU„*-1ŠNEXTWB2MESS10„DC.BƒCR,LF,'<<>>',CR,LFMESS10EƒEQU„*-1ŠNEXTWB1MESS11„DC.BƒCR,LF,'<<>>',CR,LF,LFMESS11EƒEQU„*-1ŠNEXTWBŠPAGE,BADOPN„DC.BƒCR,LF,'***OPENABORTED***--'BADOPNEƒEQU„*-1ŠNEXTWB6BADON…DC.BƒCR,LF,'***STARTOUTPUTONABORTED***--'BADONE„EQU„*-1ŠNEXTWB7BADOFF„DC.BƒCR,LF,'***TURNOUTPUTOFFABORTED***--'BADOFFEƒEQU„*-1ŠNEXTWB:BADPLS„DC.BƒCR,LF,'***STARTOUTPUTPULSEABORTED***--'BADPLSEƒEQU„*-1ŠNEXTWB4BADREADƒDC.BƒCR,LF,'***READSTATUSABORTED***--'BADREADE‚EQU„*-1ŠNEXTWB-BADCLS„DC.BƒCR,LF,'***CLOSEABORTED***--'BADCLSEƒEQU„*-1ŠNEXTWB+STATUSMƒDC.Bƒ'ErrorcodereturnedinD0='STATUSME‚EQU„*-1ŠNEXTWBCRLF†DC.BƒCR,LF CRLFE…EQU„*-1ŠNEXTWBŠPAGE N*******************************************************************************Ì**–PROGRAMƒSECTION™**Ì*N****************************************************************************** ŠSECTIONCODEPROGSTRTŠLEA„STACK(PC),A7.ŠLEA„PBA(PC),A4‰GetProgramBaseAddress(PBA) &ŠOUTPUTHEAD,HEADE‰Displaytheheading N*-----------------------------------------------------------------------------***‰Getthenumberofthechanneltoconvert*N*-----------------------------------------------------------------------------GETCHAN.ŠOUTPUTMESS1,MESS1E‡ChannelnumbertoconvertŠINPUT‚INPUTBUF,INPUTBUF+8ŠLEA„INPUTBUF(PC),A0)ŠBSR„CVT2ConvertASCIIdecimaltobinary'ŠIF.LD0#0OR.LD0#7THEN.S ŒBRAGETCHANŠENDI8ŠMOVE.WD0,OPEN_DCO+6-PBA(A4)Savethechannelnumber...ŠMOVE.WD0,PON_DCO+6-PBA(A4) <ŠLEA„BIT_NUMBER(PC),A0‚Convertthechannelnumber(0-7)into?ŠMOVE.B(A0,D0.W),D0‡thecorrespondingbitnumber(1,2,4,8...).6ŠMOVE.WD0,ON_DCO+4-PBA(A4)Savethebitmaskvalue...ŠMOVE.WD0,OFF_DCO+4-PBA(A4)ŠMOVE.WD0,READ_DCO+4-PBA(A4) N*-----------------------------------------------------------------------------*4*‰Get„0=OUTPUTON„1=OUTPUTOFFƒ2=PULSEDOUTPUT*3=READSTATUS‚4=QUIT*N*-----------------------------------------------------------------------------GETCLST'ŠOUTPUTMESS4,MESS4E…Putupthemenu...ŠOUTPUTMESS5,MESS5EŠOUTPUTMESS6,MESS6EŠOUTPUTMESS7,MESS7E< ŠOUTPUTMESS8,MESS8EFGET_CHOICE‚OUTPUTMESS2,MESS2E…Asktheusertoenteroneoftheabove. +ŠINPUT‚INPUTBUF,INPUTBUF+8GettheirchoiceŠLEA„INPUTBUF(PC),A0)ŠBSR„CVT2ConvertASCIIdecimaltobinary'ŠIF.WD0#0OR.WD0#4THEN.SBRA.SGET_CHOICEŠENDIŠPAGE**‰0=StartoutputONcommand:*ŠIF.BD0#0THEN.S 'ŒBSR.L‚CLOSE_ALLˆGocloseallchannels./ŒOUTPUTMESS10,MESS10Eƒ<<<ƒStartingcommandƒ>>> >ŒMOVE.W#DEFAULT,D0†Usethedefaultconfigurationfortheopen$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A02ŒLEA„ON_DCO(PC),A1„StartoutputONparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#NLEN_DCO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1ŒIFTHEN.SŽMOVE.WON_DCO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)4ŽOUTPUTBADON,BADONE…***STARTOUTPUTONABORTED***ŽBRA.L‚SHOW_D0ŒENDI 3ŒOUTPUTMESS11,MESS11Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDI **‰1=TurnoutputOFFcommand:*ŠIF.BD0#1THEN.S 'ŒBSR.L‚CLOSE_ALLˆGocloseallchannels./ŒOUTPUTMESS10,MESS10Eƒ<<<ƒStartingcommandƒ>>> >ŒMOVE.W#DEFAULT,D0†Usethedefaultconfigurationfortheopen$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A03ŒLEA„OFF_DCO(PC),A1ƒTurnoutputOFFparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#FLEN_DCO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1ŒIFTHEN.SŽMOVE.WOFF_DCO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)6ŽOUTPUTBADOFF,BADOFFE„***TURNOUTPUTOFFABORTED***ŽBRA.L‚SHOW_D0ŒENDI 3ŒOUTPUTMESS11,MESS11Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDI **‰2=PULSEanoutputcommand:*ŠIF.BD0#2THEN.L3ŒBSR„GET_TIME‰Getthepulseduration(milliseconds)+ŒMOVE.LD3,PON_DCO+8-PBA(A4)Storethetime 'ŒBSR.L‚CLOSE_ALLˆGocloseallchannels./ŒOUTPUTMESS10,MESS10E…<<<ƒStartingcommandƒ>>> 7ŒMOVE.W#WAKEUP_O,D0…UsetheWAKEUPoptionfortheopen$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A06ŒLEA„PON_DCO(PC),A1ƒStartoutputpulseparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#PLEN_DCO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1*(*ƒDoawaituntilthedriverwakesusup*ŒMOVE.L#19,D0ŒTRAPƒ#1 ŒIFTHEN.SŽMOVE.WPON_DCO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4);ŽOUTPUTBADREAD,BADREADEƒ***STARTOUTPUTPULSEABORTED***ŽBRA.L‚SHOW_D0ŒENDI 3ŒOUTPUTMESS11,MESS11Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDI **‰3=READSTATUScommand:*ŠIF.BD0#3THEN.L /ŒOUTPUTMESS10,MESS10Eƒ<<<ƒStartingcommandƒ>>> ŒLEA„CMRBLK(PC),A00ŒLEA„READ_DCO(PC),A1‚ReadstatusparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#RLEN_DCO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1ŒIFTHEN.SŽMOVE.WREAD_DCO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)4ŽOUTPUTBADREAD,BADREADEƒ***READSTATUSABORTED***ŒENDI ŒCLR.L‚D0;ŒMOVE.WREAD_DCO+4-PBA(A4),D0‚GetthestatusvaluereturnedŒBSR„BHLCVTConvertittoASCII9ŒMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŒMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytesŒOUTPUTMESS9,MESS9EŒOUTPUTNUMBER,NUMBER+7ŒOUTPUTCRLF,CRLFE 3ŒOUTPUTMESS11,MESS11Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDI**‰4=quitcommand:*ŠIF.BD0#4THEN.S'BSR.L‚CLOSE_ALLˆGocloseallchannels. BRA.LEXITŠENDI ŠBRA.LGETCHANGostartover.ŠPAGEM*----------------------------------------------------------------------------**ƒOPENTHECHANNEL*M*----------------------------------------------------------------------------OPEN_CHANLEA„CMRBLK(PC),A0ŠLEA„OPEN_DCO(PC),A1BŠMOVE.WD0,OPEN_DCO+8-PBA(A4)‚Savetheopenconfigurationoptions.ŠMOVE.LA1,$14(A0)ŠMOVE.W#OLEN_DCO,$18(A0)7ŠMOVE.L#CMR,D0ŒHereweperformanexecutiverequesttoŠTRAPƒ#1‘invokeCMR.ŠIFTHEN.SŒMOVE.LD0,STATUS-PBA(A4)+ŒOUTPUTBADOPN,BADOPNE…***OPENABORTED***ŒBRA.S‚SHOW_D0ŠENDIŠRTS = M*----------------------------------------------------------------------------*+*‚GETTHETIMEDURATIONFORANOUTPUTPULSE*M*----------------------------------------------------------------------------GET_TIMEŠOUTPUTMESS3,MESS3EŠINPUT‚INPUTBUF,INPUTBUF+8ŠLEA„INPUTBUF(PC),A0 ŠBSR„ASCVAL ŠTST.L‚D3 ŠBEQ„GET_TIME+ŠIF.LD3#0OR.LD3#$FFFFTHEN.S ŒBRA„GET_TIMEŠENDIŠAND.L‚#$0000FFFF,D3ŠRTS M*----------------------------------------------------------------------------**ƒOUTPUTTHEERRORCODE:*M*----------------------------------------------------------------------------:SHOW_D0ƒMOVE.LSTATUS(PC),D0†GetthestatusvaluereturnedŠBSR„BHLCVTConvertittoASCII9ŠMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŠMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytesŠOUTPUTSTATUSM,STATUSMEŠOUTPUTNUMBER,NUMBER+7ŠOUTPUTCRLF,CRLFE EXITŠBSR.S‚CLOSE_ALL"ŠMOVE.L#15,D0TerminatethistaskŠTRAPƒ#1ŠPAGEN*-----------------------------------------------------------------------------**‚CLOSEALLCHANNEL'SROUTINE:*N*-----------------------------------------------------------------------------CLOSE_ALL MOVE.W D0,-(A7) ŠLEA„CMRBLK(PC),A0ŠLEA„CLSBLK(PC),A1ŠMOVE.LA1,$14(A0)ŠMOVE.W#CLOSLEN,$18(A0)7ŠMOVE.L#CMR,D0ŒTellCMRtoclosetheDCOUTPUTchannelŠTRAPƒ#1ŠIFTHEN.SŒMOVE.LD0,STATUS-PBA(A4),ŒOUTPUTBADCLS,BADCLSE…***CLOSEABORTED***ŒMOVE.W(A7)+,D0‰Restorestack.%ŒBRA.L‚SHOW_D0ŠOutputtheerrorcode.ŠENDI ŠMOVE.W(A7)+,D0ŠRTS M*----------------------------------------------------------------------------*A*ƒTABLETOCONVERTTHECHANNELNUMBER(0-7)TOIT'SCORRESPONDING**ƒBITMAPPEDVALUE(1,2,4,8,16,32,64,128).*M*----------------------------------------------------------------------------$BIT_NUMBER‚DC.B‚1,2,4,8,16,32,64,128 ŠEND„PROGSTRTB*„ThisisTESTDC,arelocatableprogramthatteststheDCOdriver.*$*„Copyrighted1983byMotorola,Inc.E**********************************************************************B*‚ThisprogramsetsupfortaskDCO1andverifiesitexists.Ifit;*‚doesitproceedswiththetest,ifnotittrystaskDCO2./*‚Ifeithertaskismissing,itskipsthetest.*:*‚Thisprogramperformsthefollowingtestsonthedriver:*9*ˆTEST1‚-‚individuallyopenseachchannel,outputstoit,-*’checksstatus,turnsitoff,checksstatus, *’andcloses.9*ˆTEST2‚-‚individuallyopenseachchannel,outputstoit,1*’checksstatus,continuesuntilallareon.Then,*’individuallyturnsoffeachchannel,checks0*’status,continuesuntilallareoff.Turnsall%*’channelsbackonforthenexttest.7*ˆTEST3‚-‚closesthechannels,OPERATORmustcheckthey *’turnedoff.4*ˆTEST4‚-‚opensallchannels,turnsallchannelson,-*’delays,turnsallchannelsoff,andcloses.9*ˆTEST5‚-‚individuallyopenseachchannel,commandspulse*’output,delays,andcloses.7*ˆTEST6‚-‚opensfourchannels,commandspulseoutputof3*’differentlengthstoeachsimultaneously,delays,*’closeschannels.;*ˆTEST7-ƒopenschanneltwowithqueueeventconfiguration,'*’pulsesoutput,waitsforqueueevent,)*’verifiesmessagesent,closeschannels.:*ˆTEST8‚-‚openschannelonewithwaitforwake-upconfig.,'*’pulsesoutput,waitsforwake-up,and*’closeschannels.:*ˆTEST9‚-‚trysoutputONwithchannelsclosedandverifies*’error.3*’trysoutputOFFwithchannelsclosedandverifies*’error./*’tryscheckingstatuswithchannelsclosedand*’verifieserror.,*’tryspulseoutputwithchannelsclosedand*’verifieserror.<*ˆTEST10-‚trysopeninginvalidchannelnumbersandverifies3*’errors.(ZEROchannels,morethaneightchannels,"*’channel#9,sametwochannels).:*ˆTEST11-‚openschannelandtrysinvalidcommands(0,6,*’7,>8)andverifieserrors.=   /©P±P¹PÁVÉ\Ñ\ÙUáWéPñYùZY RRW!b)=*ˆTEST12-‚trysopeningchannelswhentheyarealreadyopened*’andverifieserror.*>*ˆIfitpassedthesetestsitreturnstothetoptosetupfor2*’taskDCO2.IfthiswasfortaskDCO2,itsetsup$*’totestbothtaskssimultaneously.7*ˆIFALLTESTSARESUCCESSFUL,printsmessageattesting0*’tothatfact.Ifanytestfails,ERRORmessage$*’isprintedandtestisterminated.*D********************************************************************‰PAGE*5IOADR0ƒEQU‡$F80000VM02basememmapI/Ochanaddress5IOADR1ƒEQU‡$FA0000VM03basememmapI/Ochanaddress7IOADR2ƒEQU‡$FE6000VME110basememmapI/Ochanaddress7IOADR3ƒEQU‡$F1C000VME/10basememmapI/Ochanaddress* ‰SECTIONƒ0*TEST…LEA‡STACK(PC),A7‰LEA‡INITIO(PC),A0.‰CLR.W…DUALFG-INITIO(A0)ƒcleardualtestflags‰CLR.W…DUALCK-INITIO(A0)**SETUPA.S.Q.*!‰MOVE.L„#31,D0Žstagecommandcode-‰LEA‡ASQBLOCK(PC),A0…stagecommandparameters.‰LEA‡TESTIRQ(PC),A1†initializesaddr.ofasync*‰MOVE.L„A1,ASQLA-ASQBLOCK(A0)‚servicertn.‰TRAP†#1 ‰BNE‡FAULT11*‰MOVE.L„#'DCO1',D0(TNAME„LEA‡INITIO(PC),A0‡SETUPTASKNAME‰MOVE.L„D0,DCOPAR-INITIO(A0)‰MOVE.L„D0,TMSG-INITIO(A0)*!TRYBTHƒLEA‡SMSG24(PC),A1‡spaceup‰LEA‡EMSG24(PC),A2 ‰BSR‡MSGOUT*‰LEA‡SMSG24(PC),A1†again‰LEA‡EMSG24(PC),A2 ‰BSR‡MSGOUT*.‰LEA‡SMSG1(PC),A1ˆoutputstartoftestmessage‰LEA‡EMSG1(PC),A2 ‰BSR‡MSGOUT*‰LEA‡SMSG24(PC),A1‡spaceup‰LEA‡EMSG24(PC),A2 ‰BSR‡MSGOUT*‰LEA‡INITIO(PC),A0‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)+‰MOVE.W„#CLSLNG,A1ŠINSURECHANNEL(S)CLOSED$‰MOVE.W„A1,CMDL-INITIO(A0)‚TOSTART.‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT16*‰PAGE* *…OPENTHECHANNELSINDIVIDUALLY*5TEST1„LEA‡SMSG2(PC),A1‡output'open&output'message‰LEA‡EMSG2(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*‰LEA‡EVNTCNT(PC),A0"‰CLR.W…0(A0)initializeparameters‰LEA‡INITIO(PC),A0*‰MOVE.W„#1,ONCMD1-INITIO(A0)'ON'bitmask,‰MOVE.W„#1,OFFCMD1-INITIO(A0)'OFF'bitmask2‰MOVE.W„#1,STATSHF-INITIO(A0)statusreq.bitmask;OPNLP„MOVE.W„EVNTCNT(PC),D0†OPENCHANNEL(eventcountholds‰LEA‡INITIO(PC),A0‡channel#)+‰MOVE.W„D0,OPNCH-INITIO(A0)channeltoopen‰LEA‡OPNCMDS(PC),A1,‰MOVE.L„A1,CMDA-INITIO(A0)‚parameterstoCMR‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*+‰LEA‡INITIO(PC),A0‡OUTPUTTOCHANNELOPENED‰LEA‡ONCMD(PC),A1,‰MOVE.L„A1,CMDA-INITIO(A0)‚parameterstoCMR ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT2*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#500,A0500MS‰TRAP†#1 ‰BNE‡FAULT15*!‰LEA‡OPNLP(PC),A1ˆloopbackaddr.&‰LEA‡TEST1B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*%TEST1BƒLEA‡INITIO(PC),A0‡CHECKSTATUS/‰MOVE.W„STATSHF(PC),D0†movechanneltocheckto1‰MOVE.W„D0,STAT-INITIO(A0)‚statusparameterblock‰LEA‡STATCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT3*3‰MOVE.W„STAT(PC),D0‰doesstatuscheckwithbitthat"‰CMP.W…ONCMD1(PC),D0‡shouldbeon? ‰BNE‡FAULT4*#‰LEA‡INITIO(PC),A0‡TURNOFFCHANNEL‰LEA‡OFFCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT5*‰LEA‡INITIO(PC),A0‡CHECKSTATUS/‰MOVE.W„STATSHF(PC),D0†movechanneltocheckto1‰MOVE.W„D0,STAT-INITIO(A0)‚statusparameterblock‰LEA‡STATCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT3*.‰MOVE.W„STAT(PC),D0‰doesstatuscheckshowbit#‰BNE‡FAULT4Žstillon?ifso,error.*#‰LEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(> PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST1B(PC),A1‡loopbackaddr.&‰LEA‡TEST1C(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*TEST1CƒLEA‡INITIO(PC),A0>‰ASL.W…ONCMD1-INITIO(A0)ƒshift'ON'channelbitmaskoneplace/‰ASL.W…OFFCMD1-INITIO(A0)‚shift'OFF'ƒ"…"ƒ"„"„"0‰ASL.W…STATSHF-INITIO(A0)‚shiftstatus‚"…"ƒ"„"„"‰LEA‡EVNTCNT(PC),A0'‰ADD.W…#1,0(A0)Œincrementeventcounter‰MOVE.W„EVNTCNT(PC),D0‰CMPI.W„#8,D0done? ‰BMI‡OPNLP*‰PAGE*2*„OUTPUTTOCHANNELSSEQUENTIALLYUNTILALLAREON*5TEST2„LEA‡SMSG3(PC),A1‡output'outputtoall'message‰LEA‡EMSG3(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*‰LEA‡EVNTCNT(PC),A0"‰CLR.W…0(A0)initializeparameters‰LEA‡INITIO(PC),A06‰MOVE.W„#1,ONCMD1-INITIO(A0)‚bitmaskfor'ON'channel9‰MOVE.W„#1,STATSHF-INITIO(A0)bitmaskforstatuschannel)OPNLP2ƒMOVE.W„EVNTCNT(PC),D0†OPENCHANNEL‰LEA‡INITIO(PC),A0‰MOVE.W„D0,OPNCH-INITIO(A0)/‰LEA‡INITIO(PC),A0‡pointtoCMRparameterblock‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*+‰LEA‡INITIO(PC),A0‡OUTPUTTOCHANNELOPENED‰LEA‡ONCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT2*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#500,A0500MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡OPNLP2(PC),A1‡loopbackaddr.&‰LEA‡TEST2A(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*1TEST2AƒLEA‡INITIO(PC),A0‡CHECKSTATUSOFCHANNELS‰MOVE.W„STATSHF(PC),D0‰MOVE.W„D0,STAT-INITIO(A0)‰LEA‡STATCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT3*&‰MOVE.W„STAT(PC),D0‰doesstatuscheck?‰CMP.W…STATSHF(PC),D0 ‰BNE‡FAULT4*"‰LEA‡TEST2A(PC),A1‡loopbackaddr.&‰LEA‡TEST2B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*TEST2BƒLEA‡INITIO(PC),A0>‰ASL.W…ONCMD1-INITIO(A0)ƒshift'ON'channelbitmaskoneplace‰ORI‡#$10,CCRŒsetXbit/‰ROXL.W„STATSHF-INITIO(A0)‚addstatusƒ"…"ƒ"„"„"‰LEA‡EVNTCNT(PC),A0'‰ADD.W…#1,0(A0)Œincrementeventcounter‰MOVE.W„EVNTCNT(PC),D0‰CMPI.W„#8,D0done? ‰BMI‡OPNLP2*7TEST2CƒLEA‡SMSG39(PC),A1‡output'turnoffseq.'message‰LEA‡EMSG39(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*‰LEA‡EVNTCNT(PC),A0"‰CLR.W…0(A0)initializeparameters‰LEA‡INITIO(PC),A08‰MOVE.W„#1,OFFCMD1-INITIO(A0)‚bitmaskfor'OFF'channel9‰MOVE.W„#1,STATSHF-INITIO(A0)bitmaskforstatuschannel*)OPNLP3ƒLEA‡INITIO(PC),A0‡TURNOFFCHANNEL‰LEA‡OFFCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT5*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#500,A0500MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡OPNLP3(PC),A1‡loopbackaddr.&‰LEA‡TEST2D(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*0TEST2DƒLEA‡INITIO(PC),A0‡CHECKSTATUSOFCHANNEL‰MOVE.W„STATSHF(PC),D0‰MOVE.W„D0,STAT-INITIO(A0)‰LEA‡STATCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT3*&‰MOVE.W„STAT(PC),D0‰doesstatuscheck? ‰BNE‡FAULT4*"‰LEA‡TEST2D(PC),A1‡loopbackaddr.&‰LEA‡TEST2E(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*TEST2EƒLEA‡INITIO(PC),A0@‰ASL.W…OFFCMD1-INITIO(A0)‚shift'OFF'channelbitmaskoneplace0‰ASL.W…STATSHF-INITIO(A0)‚shiftstatus‚"…"ƒ"„"„"‰LEA‡EVNTCNT(PC),A0'‰ADD.W…#1,0(A0)Œincrementeventcounter‰MOVE.W„EVNTCNT(PC),D0‰CMPI.W„#8,D0done? ‰BMI‡OPNLP3*+TEST2FƒLEA‡INITIO(PC),A0‡OUTPUTTOCHANNELS‰LEA‡ONCMDA(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT2*0‰MOVE.L„#21,D0ŽDELAYS> OOPERATORCANSEECHANNEL‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡TEST2F(PC),A1‡loopbackaddr.%‰LEA‡TEST3(PC),A2ˆcontinueonforward‰BRA‡FLOPtestfortoggle**%**************************************ƒCLOSETEST–*%**************************************-TEST3„LEA‡SMSG4(PC),A1‡output'close'message‰LEA‡EMSG4(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*)TEST3AƒLEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST3A(PC),A1‡loopbackaddr.%‰LEA‡TEST4(PC),A2ˆcontinueonforward‰BRA‡FLOPtestfortoggle*‰PAGE$*„TURNONALLOUTPUTS,THENTURNOFF*9TEST4„LEA‡SMSG5(PC),A1‡output'turnon,turnoff'message‰LEA‡EMSG5(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15**TEST4AƒLEA‡INITIO(PC),A0‡OPENALLCHANNELS/‰LEA‡OPNCMD(PC),A1‡pointtoCMRparameterblock‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*,‰LEA‡INITIO(PC),A0‡OUTPUTTOCHANNELSOPENED‰LEA‡ONCMDA(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT2*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡TEST4A(PC),A1‡loopbackaddr.&‰LEA‡TEST4B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle**TEST4BƒLEA‡INITIO(PC),A0‡TURNOFFCHANNELS‰LEA‡OFFCMDA(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT5*#‰LEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST4B(PC),A1‡loopbackaddr.%‰LEA‡TEST5(PC),A2ˆcontinueonforward‰BRA‡FLOPtestfortoggle*‰PAGE*„PULSEEACHOUTPUTINTURN*2TEST5„LEA‡SMSG6(PC),A1‡output'pulseeach'message‰LEA‡EMSG6(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*‰LEA‡EVNTCNT(PC),A0‰CLR.W…0(A0)initializeevntcnt)OPNLP4ƒMOVE.W„EVNTCNT(PC),D0†OPENCHANNEL/‰LEA‡INITIO(PC),A0‡pointtoCMRparameterblock+‰MOVE.W„D0,OPNCH-INITIO(A0)channeltoopen,‰MOVE.W„D0,PLSO1-INITIO(A0)channeltopulse‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*‰LEA‡INITIO(PC),A0‰LEA‡PLSO(PC),A1‰PULSEOUTPUT‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#12,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT10*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡OPNLP4(PC),A1‡loopbackaddr.&‰LEA‡TEST5A(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*)TEST5AƒLEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST5A(PC),A1‡loopbackaddr.&‰LEA‡TEST5B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*TEST5BƒLEA‡EVNTCNT(PC),A0'‰ADD.W…#1,0(A0)Œincrementeventcounter‰MOVE.W„EVNTCNT(PC),D0‰CMPI.W„#8,D0done? ‰BMI‡OPNLP4*‰PAGE#*„PULSEFOUROUTPUTSSIMULTANEOUSLY*6TEST6„LEA‡SMSG32(PC),A1†output'pulsesimult.'message‰LEA‡EMSG32(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1500,A0Œ1500MS‰TRAP†#1 ‰BNE‡FAULT15*&TEST6AƒLEA‡INITIO(PC),A0‡OPENCHANNELS‰LEA‡OPNCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*‰LEA‡INITIO(PC),A0‰LEA‡PLSTWO(PC),A1‰PULSEOUTPUT‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#PLSTLG,CMDL-INITIO(A0)‰MOVE.? L„#60,D0‰TRAP†#1 ‰BNE‡FAULT10*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#500,A0500MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡TEST6A(PC),A1‡loopbackaddr.&‰LEA‡TEST6B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*TEST6BƒMOVE.L„#21,D0ŽDELAY‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*)TEST6CƒLEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST6C(PC),A1‡loopbackaddr.%‰LEA‡TEST7(PC),A2ˆcontinueonforward‰BRA‡FLOPtestfortoggle*‰PAGE+*„PULSEOUTPUTTWOANDGENERATEQUEUEEVENT*6TEST7„LEA‡SMSG7(PC),A1‡output'pulseoutput2'message‰LEA‡EMSG7(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*1TEST7AƒLEA‡RCVBUF(PC),A0‡ensureRCVBUFzeroedout‰MOVE.L„#0,0(A0)‰MOVE.L„#0,4(A0)‰MOVE.L„#0,8(A0)*‰LEA‡INITIO(PC),A09‰MOVE.W„#0,OPNCNF-INITIO(A0)setupconfig.(queueevent)‰MOVE.W„#2,D0OPENCHANNELTWO+‰MOVE.W„D0,OPNCH-INITIO(A0)‚channeltoopen,‰MOVE.W„D0,PLSO1-INITIO(A0)‚channeltopulse‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*‰LEA‡INITIO(PC),A0‰LEA‡PLSO(PC),A1‰PULSEOUTPUT‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#12,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT10*+WAITQ„MOVE.L„#36,D0Žrequestwaitforevent.$‰TRAP†#1’tobeissuedbyDCOdriver. ‰BNE‡FAULT13*4‰MOVE.L„RCVBUF(PC),D0‡verifymessagereturnedbyASQ4‰CMP.L…#$0C010002,D0‡$0C01 ‰BNE‡FAULT6‰MOVE.L„RCVBUF+4(PC),D0‰CMP.L…DCOPAR(PC),D0‡DCO-ID ‰BNE‡FAULT6‰MOVE.L„RCVBUF+8(PC),D0,‰AND.L…#$FFFFFF00,D0‡maskoffloworderbyte0‰CMP.L…#IOADR0,D0ŠVM02memorymappedI/Oaddress ‰BEQ.S…TEST710‰CMP.L…#IOADR1,D0ŠVM03memorymappedI/Oaddress ‰BEQ.S…TEST722‰CMP.L…#IOADR2,D0ŠVME110memorymappedI/Oaddress ‰BEQ.S…TEST732‰CMP.L…#IOADR3,D0ŠVME/10memorymappedI/Oaddress ‰BNE‡FAULT6*‰LEA‡SMSG43(PC),A1‰LEA‡EMSG43(PC),A2 ‰BSR‡MSGOUT ‰BRA.S…TEST74TEST71ƒLEA‡SMSG40(PC),A1‰LEA‡EMSG40(PC),A2 ‰BSR‡MSGOUT ‰BRA.S…TEST74TEST72ƒLEA‡SMSG41(PC),A1‰LEA‡EMSG41(PC),A2 ‰BSR‡MSGOUT ‰BRA.S…TEST74TEST73ƒLEA‡SMSG42(PC),A1‰LEA‡EMSG42(PC),A2 ‰BSR‡MSGOUT2TEST74ƒLEA‡SMSG38(PC),A1‡output'asqverified'msg‰LEA‡EMSG38(PC),A2 ‰BSR‡MSGOUT*"‰LEA‡TEST7A(PC),A1‡loopbackaddr.&‰LEA‡TEST7B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*)TEST7BƒLEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST7B(PC),A1‡loopbackaddr.&‰LEA‡TEST7C(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*6TEST7CƒMOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*‰PAGE'*…PULSEOUTPUTONEANDGENERATEWAKE-UP3TEST8„LEA‡SMSG8(PC),A1‡output'pulseled1'message‰LEA‡EMSG8(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*1TEST8AƒLEA‡INITIO(PC),A0‡pointtoCMRpara.block5‰MOVE.W„#1,OPNCNF-INITIO(A0)setupconfig.(wake-up)‰MOVE.W„#1,D0OPENCHANNELONE+‰MOVE.W„D0,OPNCH-INITIO(A0)‚channeltoopen,‰MOVE.W„D0,PLSO1-INITIO(A0)‚channeltopulse‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*‰LEA‡INITIO(PC),A0‰LEA‡PLSO(PC),A1‰PULSEOUTPUT‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#12,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT10*-WAITW„MOVE.L„#19,D0Žrequestwaitforwake-up.$‰TRAP†#1’tobeissuedbyDCOdriver. ‰BNE‡FAULT130‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEECHANNEL‰MOVE.L„#1000,A0Œ1000MS‰TRAP†#1 ‰BNE‡FAULT15*"‰LEA‡TEST8A(PC),A1‡loopbackaddr.&‰LEA‡TEST8B(PC),A2‡continueonfor? ward‰BRA‡FLOPtestfortoggle*)TEST8BƒLEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*"‰LEA‡TEST8B(PC),A1‡loopbackaddr.&‰LEA‡TEST8C(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*6TEST8CƒLEA‡INITIO(PC),A0‡restoredefaultconfiguration ‰MOVE.W„#$8000,OPNCNF-INITIO(A0)2‰MOVE.W„#0,OPNCH-INITIO(A0)restorechannelselect1‰MOVE.W„#1,STAT-INITIO(A0)‚restorestatuschannel3‰MOVE.W„#1,OFFCMD1-INITIO(A0)‚restoreoffcmdchan.*‰PAGE#*„TRYCOMMANDSWITHCHANNELSCLOSED7TEST9„LEA‡SMSG9(PC),A1‡output'trywithclosed'message‰LEA‡EMSG9(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*1TEST9AƒLEA‡INITIO(PC),A0‡OUTPUTTOCLOSEDCHANNEL‰LEA‡ONCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#6,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1)‰MOVE.W„ONCMD(PC),D0ˆreadreturnedstatus(‰CMP.W…#$F2,D0verifycorrecterrorcode ‰BNE‡FAULT2 ‰LEA‡SMSG12(PC),A1‡outputokmsg‰LEA‡EMSG12(PC),A2 ‰BSR‡MSGOUT*#‰LEA‡INITIO(PC),A0‡TURNOFFCHANNEL‰LEA‡OFFCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1*‰MOVE.W„OFFCMD(PC),D0‡readreturnedstatus(‰CMP.W…#$F2,D0verifycorrecterrorcode ‰BNE‡FAULT5‰LEA‡SMSG14(PC),A1‡offokmsg‰LEA‡EMSG14(PC),A2 ‰BSR‡MSGOUT*‰LEA‡INITIO(PC),A0‡CHECKSTATUS‰LEA‡STATCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#6,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1+‰MOVE.W„STATCMD(PC),D0†readreturnedstatus(‰CMP.W…#$F2,D0verifycorrecterrorcode ‰BNE‡FAULT3 ‰LEA‡SMSG16(PC),A1‡statusokmsg‰LEA‡EMSG16(PC),A2 ‰BSR‡MSGOUT*‰LEA‡INITIO(PC),A0‰LEA‡PLSO(PC),A1‰PULSEOUTPUT‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#12,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1(‰MOVE.W„PLSO(PC),D0‰readreturnedstatus(‰CMP.W…#$F6,D0verifycorrecterrorcode ‰BNE‡FAULT10*"‰LEA‡TEST9A(PC),A1‡loopbackaddr.&‰LEA‡TEST9B(PC),A2‡continueonforward‰BRA‡FLOPtestfortoggle*%TEST9BƒLEA‡SMSG18(PC),A1‡pulseokmsg‰LEA‡EMSG18(PC),A2 ‰BSR‡MSGOUT*‰PAGE*ƒTRYTOOPENINVALIDCHANNELS6TEST10ƒLEA‡SMSG11(PC),A1‡output'tryinvalidchannels'‰LEA‡EMSG11(PC),A2 ‰BSR‡MSGOUT0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*3TEST10A‚LEA‡INITIO(PC),A0‡TRYTOOPENZEROCHANNELS‰LEA‡OPNCH0(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNCHL,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1%‰MOVE.W„OPNCH0(PC),D0‡readcmdstatus‰CMP.W…#$F7,D0 ‰BNE‡FAULT7*3‰LEA‡INITIO(PC),A0‡TRYTOOPENMORETHAN8CHANNELS‰LEA‡OPNMOR(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNML,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1%‰MOVE.W„OPNMOR(PC),D0‡readcmdstatus‰CMP.W…#$F7,D0 ‰BNE‡FAULT7*,‰LEA‡INITIO(PC),A0‡TRYTOOPENCHANNEL#>8‰LEA‡OPNCH9(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNC9L,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1%‰MOVE.W„OPNCH9(PC),D0‡readcmdstatus‰CMP.W…#$F6,D0 ‰BNE‡FAULT7*0‰LEA‡INITIO(PC),A0‡TRYTOOPENSAMETWOCHANNELS‰LEA‡OPNTW(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNTL,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1$‰MOVE.W„OPNTW(PC),D0ˆreadcmdstatus‰CMP.W…#$FE,D0 ‰BNE‡FAULT7*#‰LEA‡TEST10A(PC),A1†loopbackaddr.'‰LEA‡TEST10B(PC),A2†continueonforward‰BRA‡FLOPtestfortoggle*6TEST10B‚LEA‡SMSG36(PC),A1‡output'invalidchannelsok'‰LEA‡EMSG36(PC),A2 ‰BSR‡MSGOUT*‰PAGE*„TRYTOUSEINVALIDCOMMANDS*2TEST11ƒLEA‡SMSG25(PC),A1‡output'tryinvalidcmds'‰LEA‡EMSG25(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*&TEST11A‚LEA‡INITIO(PC),A0‡OPENCHANNEL‰MOVE.W„#1,OPNCH-INITIO(A0)‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„@ A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*$‰LEA‡INITIO(PC),A0‡INVALIDCOMMAND0‰LEA‡INVCM0(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#4,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1*‰MOVE.W„INVCM0(PC),D0‡readreturnedstatus‰CMP.W…#$F4,D0 ‰BNE‡FAULT9*$‰LEA‡INITIO(PC),A0‡INVALIDCOMMAND6‰LEA‡INVCM6(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#4,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1*‰MOVE.W„INVCM6(PC),D0‡readreturnedstatus‰CMP.W…#$F4,D0 ‰BNE‡FAULT9*$‰LEA‡INITIO(PC),A0‡INVALIDCOMMAND7‰LEA‡INVCM7(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#4,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1*‰MOVE.W„INVCM7(PC),D0‡readreturnedstatus‰CMP.W…#$F4,D0 ‰BNE‡FAULT9*&‰LEA‡INITIO(PC),A0‡INVALIDCOMMAND>8‰LEA‡INVCM9(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0) ‰MOVE.W„#4,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1*‰MOVE.W„INVCM9(PC),D0‡readreturnedstatus‰CMP.W…#$F4,D0 ‰BNE‡FAULT9*#‰LEA‡TEST11A(PC),A1†loopbackaddr.'‰LEA‡TEST11B(PC),A2†continueonforward‰BRA‡FLOPtestfortoggle*-TEST11B‚LEA‡SMSG26(PC),A1‡invalidcmdsokmsg‰LEA‡EMSG26(PC),A2 ‰BSR‡MSGOUT*‰PAGE*„TRYOPENANDALREADYOPENED9TEST12ƒLEA‡SMSG20(PC),A1†output'trywithopened'message‰LEA‡EMSG20(PC),A2 ‰BSR‡MSGOUT*0‰MOVE.L„#21,D0ŽDELAYSOOPERATORCANSEEMESSAGE‰MOVE.L„#1200,A0Œ1200MS‰TRAP†#1 ‰BNE‡FAULT15*6TEST12A‚LEA‡INITIO(PC),A0‡pointtoCMRparameterblock(‰MOVE.W„#0,OPNCH-INITIO(A0)OPENCHANNEL‰LEA‡OPNCMDS(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1 ‰BNE‡FAULT1*/‰LEA‡INITIO(PC),A0‡pointtoCMRparameterblock‰LEA‡OPNCMDS(PC),A1)‰MOVE.L„A1,CMDA-INITIO(A0)‚TRYOPENagain‰MOVE.W„#OPNLNGS,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0ŽCMR‰TRAP†#1+‰MOVE.W„OPNCMDS(PC),D0‡readreturnedstatus‰CMP.W…#$FE,D0 ‰BNE.S…FAULT1*#‰LEA‡INITIO(PC),A0‡CLOSECHANNEL(S)‰LEA‡CLSCMD(PC),A1‰MOVE.L„A1,CMDA-INITIO(A0)‰MOVE.W„#CLSLNG,A1‰MOVE.W„A1,CMDL-INITIO(A0)‰MOVE.L„#60,D0‰TRAP†#1 ‰BNE‡FAULT8*#‰LEA‡TEST12A(PC),A1†loopbackaddr.%‰LEA‡TESTC(PC),A2ˆcontinueonforward‰BRA‡FLOPtestfortoggle*1**************************************************„TESTCOMPLETED*1************************************************* TESTC„LEA‡SMSG24(PC),A1‡spaceup‰LEA‡EMSG24(PC),A2 ‰BSR‡MSGOUT*1‰LEA‡SMSG23(PC),A1†output'testcomplete'message‰LEA‡EMSG23(PC),A2 ‰BSR‡MSGOUT*‰LEA‡SMSG24(PC),A1†spaceup‰LEA‡EMSG24(PC),A2 ‰BSR‡MSGOUT*#NEXT…MOVE.W„DUALFG(PC),D0‡flagset? ‰BNE‡TERM.NEXTA„MOVE.L„DCOPAR(PC),D0‡tryforsecondtask‰CMP.L…#'DCO1',D0‰BNE‡TERMAdone‰MOVE.L„#'DCO2',D0‰BRA‡TNAMEsetupsecondtask*‰PAGE*#FAULT1ƒLEA‡SMSG22(PC),A1‡openerror‰LEA‡EMSG22(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM%FAULT2ƒLEA‡SMSG13(PC),A1‡outputerror‰LEA‡EMSG13(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM%FAULT3ƒLEA‡SMSG17(PC),A1‡statuserror‰LEA‡EMSG17(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM+FAULT4ƒLEA‡SMSG28(PC),A1‡statuscheckerror‰LEA‡EMSG28(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM"FAULT5ƒLEA‡SMSG15(PC),A1‡offerror‰LEA‡EMSG15(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM*FAULT6ƒLEA‡SMSG10(PC),A1‡ASQmessageerror‰LEA‡EMSG10(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM.FAULT7ƒLEA‡SMSG21(PC),A1‡invalidchannelerror‰LEA‡EMSG21(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM$FAULT8ƒLEA‡SMSG33(PC),A1‡closeerror‰LEA‡EMSG33(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM.FAULT9ƒLEA‡SMSG27(PC),A1‡invalidcmderrormsg‰LEA‡EMSG27(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM%FAULT10‚LEA‡SMSG19(PC),A1‡pulseerror‰LEA‡EMSG19(PC),A2 ‰BSR‡MSGOUT ‰BRA‡TERM#FAULT11‚LEA‡SMSG30(PC),A1‡ASQerror‰LEA‡EMSG30(PC),A2 ‰BSR‡MSGOUT ‰BRA.S…TERM#FAULT12‚LEA‡SMSG29(PC),A1‡ASQerror‰LEA‡EMSG29(PC),A2 ‰BSR.S…MSGOUT ‰BRA.S…TERM6FAULT13‚LEA‡SMSG31(PC),A1‡WAKE-UPorQUEUEEVENTerror‰LEA‡EMSG31(PC),A2 ‰BSR.S…MSGOUT ‰BRA.S…TERM2FAULT14‚LEA‡SMSG34(PC),A1‡IOS(trap#2)callerror‰LEA‡EMSG34(PC),A2 ‰B@ SR.S…MSGOUT ‰BRA.S…TERM*FAULT15‚LEA‡SMSG35(PC),A1‡calldelayerror‰LEA‡EMSG35(PC),A2 ‰BSR.S…MSGOUT ‰BRA.S…TERM/FAULT16‚LEA‡SMSG37(PC),A1‡non-existanttaskmsg‰LEA‡EMSG37(PC),A2 ‰BSR.S…MSGOUT(‰LEA‡DUALFG(PC),A0‡setflagtoeliminate‰ADD.W…#1,(A0)dualtest ‰BRA‡NEXTA**„DE-ACTIVATESELF*0TERMA„LEA‡INITIO(PC),A0‡testfordualboardtest‰TST.W…DUALFG-INITIO(A0) ‰BNE.S…TERM4‰MOVE.W„#1,DUALFG-INITIO(A0)‚setupfordualbdtest‰MOVE.W„#1,DUALCK-INITIO(A0)!‰MOVE.L„#'DCO1',DCOPAR-INITIO(A0)*‰MOVE.L„#'DCO1',TMSG-INITIO(A0)‚setupmsg‰MOVE.W„#'&2',TMSG+4-INITIO(A0) ‰BRA‡TRYBTH*%TERM…MOVE.L„#32,D0ŽDE-ALLOCATEA.S.Q.‰TRAP†#1**‰MOVE.L„#15,D0ŽNOWDE-ACTIVATESELF(EXIT)‰TRAP†#1**„MESSAGEOUTPUTSUBROUTINE*/MSGOUTƒLEA‡MSG(PC),A0Šoutputmessagepointedto(‰MOVE.L„A1,X1-MSG(A0)‡byA1,endedbyA2‰MOVE.L„A2,X2-MSG(A0)‰TRAP†#2 ‰BNE‡FAULT14‰RTS*1FLOP…LEA‡INITIO(PC),A0‡togglebetweenDCO1&DCO2‰MOVE.W„DUALCK-INITIO(A0),D0 ‰BEQ.S…FLOP2continueonifzero‰CMP.W…#1,D0seeif=1 ‰BNE.S…FLOP11‰MOVE.W„#2,DUALCK-INITIO(A0)‚is=1,setupfor2!‰MOVE.L„#'DCO2',DCOPAR-INITIO(A0)‰JMP‡(A1)loopback6FLOP1„MOVE.W„#1,DUALCK-INITIO(A0)‚is=2,setupfor1!‰MOVE.L„#'DCO1',DCOPAR-INITIO(A0))FLOP2„JMP‡(A2)continueonwithnexttest*-*ƒMOVETHEASQMESSAGEFROMTHEASQTORCVBUF*8TESTIRQ‚EQU‡*‰entrypointmovingdatafromASQtoRCVBUF!‰MOVE.L„#34,D0„stagecommandcode‰LEA‡RCVBUF(PC),A0‰TRAP†#1 ‰BNE‡FAULT12*„RETURNFROMEVENT!‰MOVE.L„#37,D0„stagecommandcode ‰MOVE.W„#1,A0‰TRAP†#1*‰PAGE**„CMRparameterblock*INITIOƒDC.B†7,0,0,0DCOPARƒDC.L†'DCO1'„TASKNAME ‰DC.L†0,0,0*CMDA…DC.L†0‰addressofDCOparameterblockCMDL…DC.W†0‰commandlength**„A.S.Q.parameterblock*ASQBLOCKEQU‡*‰DC.L†0‰taskname‰DC.L†0‰dummyfield*‰DC.B†5‰ASQ&ASRenabled=initialstatus"‰DC.B†16ˆlengthofmessageforASQ‰DC.L†16ˆstoragefor4events?ASQLA„DC.L†TESTIRQƒlogicaladdressoftargettaskasyncsvcrtn‰DC.L†0‰dummyfieldASQLNGƒEQU‡*-ASQBLOCK*0*„DCOparameterblocktoopenindividualchannel*OPNCMDS‚DC.W†0‰returnedstatus‰DC.W†1‰OPENcommandcode‰DC.W†1‰open1channelOPNCH„DC.W†0‰channel#/OPNCNFƒDC.W†$8000…DefaultchannelconfigurationOPNLNGS‚EQU‡*-OPNCMDSlength***„DCOparameterblocktoopenALLchannels*OPNCMDƒDC.W†0‰returnedstatus‰DC.W†1‰OPENcommandcode‰DC.W†8‰open8channels*‰DC.W†0,$8000ƒCHAN0,defaultconfiguration‰DC.W†1,$8000ƒCHAN1,ƒ"‰"‰DC.W†2,$8000ƒCHAN2,ƒ"‰"‰DC.W†3,$8000ƒCHAN3,ƒ"‰"‰DC.W†4,$8000ƒCHAN4,ƒ"‰"‰DC.W†5,$8000ƒCHAN5,ƒ"‰"‰DC.W†6,$8000ƒCHAN6,ƒ"‰"‰DC.W†7,$8000ƒCHAN7,ƒ"‰"OPNLNGƒEQU‡*-OPNCMD‚length*#*ƒparameterblockforCLOSEcommand*CLSCMDƒDC.W†0‰returnedstatus‰DC.W†2‰CLOSEcommand(CLSLNGƒEQU‡*-CLSCMD‚closecommandlength*$*…DCOparameterblockforONcommand* ONCMD„EQU‡*‰DC.W†0‰returnedcommandstatus‰DC.W†3‰OUTPUTONcommand,ONCMD1ƒDC.W†1‰bitmaskofchanneltoturnON* ONCMDAƒEQU‡*‰DC.W†0‰returnedcommandstatus‰DC.W†3‰OUTPUTONcommand,‰DC.W†$00FF…bitmasktoturnONallchannels*%*…DCOparameterblockforOFFcommand* OFFCMDƒEQU‡*&‰DC.W†0‰returncommandstatuslocation‰DC.W†4‰OFFcommand.OFFCMD1‚DC.W†1‰bitmaskofchanneltoturnOFF* OFFCMDA‚EQU‡*&‰DC.W†0‰returncommandstatuslocation‰DC.W†4‰OFFcommand-‰DC.W†$00FF…bitmasktoturnOFFallchannels*$*„parameterblockforSTATUScommand* STATCMD‚EQU‡*‰DC.W†0‰returnedcommandstatus‰DC.W†5‰STATUScommand2STAT…DC.W†1‰bitmask&readstatusofchannels0-7*:*„DCOparameterblocktodo1000msPULSEonselectedchan*PLSO…DC.W†0‰returnedcmdstatus‰DC.W†8‰PULSEcommandcode‰DC.W†1‰onechannelPLSO1„DC.W†1‰pulsechannel#‰DC.L†500‡500mspulse*7*„parameterblocktoPULSEfourchannelssimultaneously*!PLSTWOƒDC.W†0‰returnedcmdstatus‰DC.W†8‰PULSEcommandcode‰DC.W†4‰fourchannels‰DC.W†4‰chan.#4‰DC.L†250‡25A 0ms‰DC.W†5‰chan.#5‰DC.L†500‡500ms‰DC.W†6‰chan.#6‰DC.L†750‡750ms‰DC.W†7‰chan.#7‰DC.L†1000†1000msPLSTLGƒEQU‡*-PLSTWO*"*„INVALIDCHANNELparameterblocks*!OPNCH0ƒDC.W†0‰returnedcmdstatus‰DC.W†1‰OPENcommandcode‰DC.W†0‰openzerochannels‰DC.W†0‰channel0‰DC.W†$8000…config.OPNCHLƒEQU‡*-OPNCH0*!OPNCH9ƒDC.W†0‰returnedcmdstatus‰DC.W†1‰OPENcmdcode‰DC.W†1‰openonechannel‰DC.W†9‰openchannel#9‰DC.W†$8000…config.OPNC9LƒEQU‡*-OPNCH9* OPNTW„DC.W†0‰returnedcmdstatus‰DC.W†1‰OPENcmdcode‰DC.W†3‰openthreechan.‰DC.W†1,$8000ƒchan,config.‰DC.W†2,$8000ƒchan,config.‰DC.W†2,$8000ƒchan,config.OPNTL„EQU‡*-OPNTW*!OPNMORƒDC.W†0‰returnedcmdstatus‰DC.W†1‰OPENcmdcode‰DC.W†9‰open9channels‰DC.W†0,$8000ƒchan,config.‰DC.W†1,$8000ƒchan,config.‰DC.W†2,$8000ƒchan,config.‰DC.W†3,$8000ƒchan,config.‰DC.W†4,$8000ƒchan,config.‰DC.W†5,$8000ƒchan,config.‰DC.W†6,$8000ƒchan,config.‰DC.W†7,$8000ƒchan,config.‰DC.W†8,$8000ƒchan,config.OPNML„EQU‡*-OPNMOR*#*…INVALIDCOMMANDSparameterblocks*!INVCM0ƒDC.W†0‰returnedcmdstatus‰DC.W†0‰invalidcommand0*!INVCM6ƒDC.W†0‰returnedcmdstatus‰DC.W†6‰invalidcommand6*!INVCM7ƒDC.W†0‰returnedcmdstatus‰DC.W†7‰invalidcommand7*!INVCM9ƒDC.W†0‰returnedcmdstatus"‰DC.W†9‰invalidcmdgreaterthan8**„IOSMESSAGEparameterblock*MSG†DC.B†0‰Dataxfercode=0‰DC.B†2‰Writedata‰DC.W†0‰Options-none‰DC.B†0‰Status ‰DC.B†6‰LUN‰DC.W†0‰reserved‰DC.L†0‰randomrecordcountX1‡DC.L†0‰bfrstartaddr.X2‡DC.L†0‰bfrendaddr.‰DC.L†0‰lengthofdataxfer ‰DC.L†0‰completion/serviceaddr.*‰PAGE *„MESSAGES*6SMSG1„DC.W†'**********DCOUTPUTTESTPROGRAM******'TMSG…DC.W†'DCO1‚' EMSG1„EQU‡*-1*8SMSG2„DC.W†'‚OPEN&OUTPUTTOEACHCHANNELINDIVIDUALLY' EMSG2„EQU‡*-1*9SMSG3„DC.W†'‚OPEN&OUTPUTEACHCHANNELUNTILALLAREON' EMSG3„EQU‡*-1*5SMSG4„DC.W†'‚CLOSECHANNELS,OUTPUTSSHOULDTURNOFF' EMSG4„EQU‡*-1*0SMSG5„DC.W†'‚TURNONALLOUTPUTS,THENTURNOFF' EMSG5„EQU‡*-1*'SMSG6„DC.W†'‚PULSEEACHOUTPUTINTURN' EMSG6„EQU‡*-1*5SMSG7„DC.W†'‚PULSEOUTPUT2ANDGENERATEQUEUEEVENT' EMSG7„EQU‡*-1*1SMSG8„DC.W†'‚PULSEOUTPUT1ANDGENERATEWAKE-UP' EMSG8„EQU‡*-1*/SMSG9„DC.W†'‚TRYCOMMANDSWITHCHANNELSCLOSED' EMSG9„EQU‡*-1**SMSG10ƒDC.W†'‚INVALIDASQMESSAGE-ERROR'EMSG10ƒEQU‡*-1*+SMSG11ƒDC.W†'‚TRYTOOPENINVALIDCHANNELS'EMSG11ƒEQU‡*-1*4SMSG12ƒDC.W†'‚CALLOUTPUTANDCHANNELSCLOSED-OK!'EMSG12ƒEQU‡*-1*"SMSG13ƒDC.W†'‚CALLOUTPUT-ERROR'EMSG13ƒEQU‡*-1*1SMSG14ƒDC.W†'‚CALL‚OFFƒANDCHANNELSCLOSED-OK!'EMSG14ƒEQU‡*-1*SMSG15ƒDC.W†'‚CALLOFF-ERROR'EMSG15ƒEQU‡*-1*4SMSG16ƒDC.W†'‚CALLSTATUSANDCHANNELSCLOSED-OK!'EMSG16ƒEQU‡*-1*"SMSG17ƒDC.W†'‚CALLSTATUS-ERROR'EMSG17ƒEQU‡*-1*3SMSG18ƒDC.W†'‚CALLPULSE‚ANDCHANNELSCLOSED-OK!'EMSG18ƒEQU‡*-1*!SMSG19ƒDC.W†'‚CALLPULSE-ERROR'EMSG19ƒEQU‡*-1*4SMSG20ƒDC.W†'‚TRYCALLOPENANDALREADYOPENED-OK!'EMSG20ƒEQU‡*-1*&SMSG21ƒDC.W†'‚INVALIDCHANNEL-ERROR'EMSG21ƒEQU‡*-1* SMSG22ƒDC.W†'‚CALLOPEN-ERROR'EMSG22ƒEQU‡*-1*9SMSG23ƒDC.W†'‚******TESTCOMPLETEDSUCCESSFULLY*******'EMSG23ƒEQU‡*-1*SMSG24ƒDC.W†'‚'EMSG24ƒEQU‡*-1**SMSG25ƒDC.W†'‚TRYTOUSEINVALIDCOMMANDS'EMSG25ƒEQU‡*-1**SMSG26ƒDC.W†'‚CALL„INVALID„COMMANDS„-‚OK!'EMSG26ƒEQU‡*-1*&SMSG27ƒDC.W†'‚INVALIDCOMMAND-ERROR'EMSG27ƒEQU‡*-1*#SMSG28ƒDC.W†'‚STATUSCHECK-ERROR'EMSG28ƒEQU‡*-1*"SMSG29ƒDC.W†'‚A.S.Q.MOVE‚-ERROR'EMSG29ƒEQU‡*-1*SMSG30ƒDC.W†'‚A.S.Q.-ERROR'EMSG30ƒEQU‡*-1*$SMSG31ƒDC.W†'‚WAKEUPORQUEUEERROR'EMSG31ƒEQU‡*-1*9SMSG32ƒDC.W†'‚PULSECHANNELS4,5,6,&7SIMULTANEOUSLY'EMSG32ƒEQU‡*-1*!SMSG33ƒDC.W†'‚CALLCLOSE-ERROR'EMSG33ƒEQU‡*-1*#SMSG34ƒDC.W†'‚TRAP#2(IOS)ERROR'EMSG34ƒEQU‡*-1*!SMSG35ƒDC.W†'‚CALLDELAY-ERROR'EMSG35ƒEQU‡*-1**SMSG36ƒDC.W†'‚CALL„INVALID„CHANNELA S„-‚OK!'EMSG36ƒEQU‡*-1*‰PAGE*:SMSG37ƒDC.W†'---NON-EXISTANTTASK/BOARD-------^'EMSG37ƒEQU‡*-1*&SMSG38ƒDC.W†'‚A.S.Q.MESSAGEVERIFIED'EMSG38ƒEQU‡*-1*-SMSG39ƒDC.W†'‚TURNOFFCHANNELSSEQUENTIALLY'EMSG39ƒEQU‡*-1*SMSG40ƒDC.W†'‚VM02'EMSG40ƒEQU‡*-1*SMSG41ƒDC.W†'‚VM03'EMSG41ƒEQU‡*-1*SMSG42ƒDC.W†'‚VME110'EMSG42ƒEQU‡*-1*SMSG43ƒDC.W†'‚VME/10'EMSG43ƒEQU‡*-1*‰PAGE*EVNTCNT‚DS.W†1‰eventcounter!STATSHF‚DS.W†1‰statusbitshifter1DUALFGƒDS.W†1‰dualboardtestflag(1=donottest)500ƒFORMAT('OPEN&OUTPUTTOEACHCHANNELUNTILALLAREON')C †DO600I=1,8 †OPN(3)=1 †OPN(4)=I-1†OPN(5)=IHEX(10)†CALLDCOPEN(ID,OPN)1q:cB(†OUT(3)=IHEX(I)†CALLDCOOUT(ID,OUT)C †CALLDELAYC†STATUS(3)=MSK(I)†CALLDCOSTA(ID,STATUS)"†IF(STATUS(3)-MSK(I))550,600,550550ƒCALLERRPR1(I-1) 600ƒCONTINUEC†WRITE(6,620)7620ƒFORMAT('CLOSECHANNELS,OUTPUTSSHOULDTURNOFF') †CALLDELAY†CALLDCOCLS(ID,CLSE) †CALLDELAYC†WRITE(6,750)2750ƒFORMAT('TURNONALLOUTPUTS,THENTURNOFF')C †OPN(3)=8†K=0†DO800I=4,18,2 †OPN(I)=K†OPN(I+1)=IHEX(10)†K=K+1 800ƒCONTINUE†CALLDCOPEN(ID,OPN)†OUT(3)=IHEX(9)†CALLDCOOUT(ID,OUT)C †CALLDELAY†OFF(3)=IHEX(9)†CALLDCOOFF(ID,OFF)†CALLDCOCLS(ID,CLSE)C†WRITE(6,950))950ƒFORMAT('PULSEEACHOUTPUTINTURN')C†DO1000I=1,8 †OPN(3)=1 †OPN(4)=I-1†OPN(5)=IHEX(10)†CALLDCOPEN(ID,OPN) †PULSE(3)=1†PULSE(4)=I-1 †PULSE(5)=0†PULSE(6)=500†CALLDCOPLS(ID,PULSE)C †CALLDELAY †CALLDELAY 1000‚CONTINUE†CALLDCOCLS(ID,CLSE)C†WRITE(6,1030)11030‚FORMAT('TRYCOMMANDSWITHCHANNELSCLOSED')C†CALLDCOCLS(ID,CLSE)†IF(CLSE(1))1090,1070,10901070‚WRITE(6,1080)31080‚FORMAT('CALLCLOSEANDCHANNELSCLOSED--OK') †GOTO10951090‚WRITE(6,1093)#1093‚FORMAT('CALLCLOSE-ERROR')C1095‚OUT(3)=1†CALLDCOOUT(ID,OUT)†IF(OUT(1))1040,1060,10401040‚WRITE(6,1050)01050‚FORMAT('CALL‚OUT‚ANDCHANNELSCLOSED--OK') †GOTO10651060‚WRITE(6,1063)!1063‚FORMAT('CALLOUT-ERROR')C1065‚OFF(3)=1†CALLDCOOFF(ID,OFF)†IF(OFF(1))1100,1120,11001100‚WRITE(6,1110)11110‚FORMAT('CALL‚OFF‚ANDCHANNELSCLOSED--OK') †GOTO11251120‚WRITE(6,1123)!1123‚FORMAT('CALLOFF-ERROR')C1125‚STATUS(3)=1†CALLDCOSTA(ID,STATUS)†IF(STATUS(1))1130,1150,11301130‚WRITE(6,1140)21140‚FORMAT('CALLSTATUSANDCHANNELSCLOSED-OK') †GOTO11551150‚WRITE(6,1153)$1153‚FORMAT('CALLSTATUS-ERROR')C1155‚PULSE(3)=1 †PULSE(4)=1 †PULSE(5)=0†PULSE(6)=10†CALLDCOPLS(ID,PULSE)†IF(PULSE(1))1160,1180,11601160‚WRITE(6,1170)21170‚FORMAT('CALLPULSEANDCHANNELSCLOSED--OK') †GOTO11851180‚WRITE(6,1183)#1183‚FORMAT('CALLPULSE-ERROR')C1185‚OPN(3)=1 †OPN(4)=1†OPN(5)=IHEX(10)†CALLDCOPEN(ID,OPN)C†WRITE(6,1190)01190‚FORMAT('TRYCALLOPENANDALREADYOPENED')C †OPN(3)=1 †OPN(4)=1†OPN(5)=IHEX(10)†CALLDCOPEN(ID,OPN)†IF(OPN(1))1200,1220,12001200‚WRITE(6,1210)21210‚FORMAT('CALLOPENANDCHANNELSAREOPEN-OK') †GOTO12251220‚WRITE(6,1222)"1222‚FORMAT('CALLOPEN-ERROR')C1225‚WRITE(6,60)C†WRITE(6,1300)31300‚FORMAT('*********TESTCOMPLETED**********')C †WRITE(6,60)CCˆSEEIFSECONDBOARDTOTESTC#1350‚IF(ID.EQ.'DCO2')GOTO15001400‚ID='DCO2'†GOTO5C 1500‚STOP†ENDééB ééC:C ********************************************************C†SUBROUTINEDELAY C–DELAYAPPROXIMATELYONESECOND†DO30J=1,100†DO20K=1,350 20„CONTINUE 30„CONTINUE†RETURN†ENDéééééééJ C:C ********************************************************C†SUBROUTINEERRPR1(I)†WRITE(6,10)I#10„FORMAT('STATUSERROR-BIT',I1)†RETURN†ENDééééC éééS=/*=/*†M625DRV.TEST625.AF=/*,=/*†TEST625testprogramassemblychainfile=/*6=/*†Thecommandlinewillacceptargumentsasfollows:=/*;=/*‹Argument01…\1=Outputfileassemblylistingordevice=/*H=/*†Thefollowingshowstheassemblychainsequence.‚InthisexampletheH=/*†NULLdevicewaschosenasArgument01,however,theusercouldifhe5=/*†sodesiredhaverequestedanoutputlistingfile.=/*#=/*=CHAINM625DRV.TEST625.AF#NULL=/*-=/*†Defaultargument01isM625DRV.TEST625.LS=/*=/IFC \1ƒ=ARGM625DRV.TEST625.LS=/ENDIF=/*4=ASM M625DRV.TEST625.SA,M625DRV.TEST625.RO,\1;RZ=100=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDééééé\=/*=/*†M625DRV.TESTDC.AF=/*;=/* Chain file to assemble DCO driver test routine 'TESTDC'=/*:=/* If no output argument is specified for the listing the0=/* chain file will default to M625DRV.TESTDC.LS=/*=/IFC \1ƒ=ARGM625DRV.TESTDC.LS=/ENDIF=/*2=ASM M625DRV.TESTDC.SA,M625DRV.TESTDC.RO,\1;MRZ=70=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDéC ééééée'RIODRV TESTE SAzzbbTESTRIO SA££WbbTESTE AFüübbTESTRIO AF  bbŠOPT„EQU5*This is TESTE the version that tests wait for event. ŠSECTION0 PBA‡EQU„*TEST†LEA„PBA(PC),A6ŠLEA„STACK-PBA(A6),A7+ŠCLR.L‚EVENTCNT-PBA(A6)ƒcleareventcounter* *‚GETA.S.Q.1ŠLEA„ASQBLOCK-PBA(A6),A0stagecommandparametersŠLEA„TESTIRQ-PBA(A6),A1ŠMOVE.LA1,ASQBLOCK+14-PBA(A6)!ŠMOVE.L#31,D0‚stagecommandcodeŠTRAPƒ#1 ŠBNE„FAULT2*‚OPENTHECHANNELS 3ŠLEA„INITIO-PBA(A6),A0‚pointtoCMRparameterblockŠLEA„OPNCMD-PBA(A6),A1ŠMOVE.LA1,CMDA-PBA(A6)ŠMOVE.W#OPNLNG,CMDL-PBA(A6)ŠMOVE.L#60,D0ŠTRAPƒ#1 ŠBNE„FAULT1**** WAIT EQU **‚REQUESTWAITFOREVENTŠMOVE.L#36,D0ŠTRAPƒ#1 ŠBNE„FAULT3**RUNTEST*‚readstatusofchannel‚10**‚stagecodeforreadcommandŠLEA„STATCMD-PBA(A6),A1ŠMOVE.LA1,CMDA-PBA(A6)-ŠMOVE.W#6,CMDL-PBA(A6)„setupcommandlengthŠMOVE.L#60,D0setupCMRcallŠTRAPƒ#1 ŠBNE„FAULT7ŠSPC„2*Pulse channel 7ŠLEA„PLS7-PBA(A6),A1ŠMOVE.LA1,CMDA-PBA(A6)ŠMOVE.W#12,CMDL-PBA(A6)ŠMOVE.L#60,D0ŠTRAPƒ#1 ŠBNE„FAULT10ŠSPC2*Pulse channel 8ŠLEA„PLS8-PBA(A6),A1éD éér7{Fƒ ‹M“FŠMOVE.LA1,CMDA-PBA(A6)ŠMOVE.W#12,CMDL-PBA(A6)ŠMOVE.L#60,D0ŠTRAPƒ#1 ŠBNE„FAULT11*Pulse channel 9ŠLEA„PLS9-PBA(A6),A1ŠMOVE.LA1,CMDA-PBA(A6)ŠMOVE.W#12,CMDL-PBA(A6)ŠMOVE.L#60,D0ŠTRAPƒ#1 ŠBNE„FAULT12* *Inc EVENTCNTŠADD.L‚#1,EVENTCNT-PBA(A6)**If EVENTCNT = 10 THENŠCMP.L‚#10,EVENTCNT-PBA(A6) ŠBEQ.S‚TEST1*DO*‚disablechannel1interupts*‚waitforevent*END*IF EVENTCNT >= 20 THENŠCMP.L‚#20,EVENTCNT-PBA(A6) ŠBGE.S‚TEST2*DO*‚EVENTCNT=0*‚enablechannel1interrupts*‚waitforevent*END*ELSE*DO ŠBRA.S‚TEST3#*‚toggleoutputonsucessiveevents*END** TEST1…EQU„*!*Stage code for disable channel 1ŠLEA„INITIO-PBA(A6),A0ŠLEA„DSA1-PBA(A6),A1ŠMOVE.LA1,CMDA-PBA(A6)ŠMOVE.W#6,CMDL-PBA(A6)ŠMOVE.L#60,D0ŠTRAPƒ#1 ŠBNE„FAULT8 ŠBRA„WAIT* TEST2…EQU„*ŠCLR.L‚EVENTCNT"* Stage code for enable interruptsŠLEA„INITIO-PBA(A6),A0ŠLEA„ENA1-PBA(A6),A1ŠMOVE.LA1,CMDA-PBA(A6)ŠMOVE.W#6,CMDL-PBA(A6)ŠMOVE.L#60,D0ŠTRAPƒ#1 ŠBNE.S‚FAULT9 ŠBRA„WAIT* TEST3…EQU„*-*toggle EVENTCNT & output on sucessive eventsBŠBTSTƒ#0,EVENTCNT+3-PBA(A6)MickyMousewaytotestLSbyteinmem ŠBNE.S‚LAMPON*Stage code for OFF-ŠLEA„INITIO-PBA(A6),A0‚pointtocommandtableŠLEA„OFFCMD-PBA(A6),A1;ŠMOVE.LA1,CMDA-PBA(A6)„passaddressofRIOparameterblock+ŠMOVE.W#6,CMDL-PBA(A6)„passcommandlengthéé)ŠMOVE.L#60,D0setuptrap1servicecodeŠTRAPƒ#1‘callforservice"ŠBNE.S‚FAULT6branchontraperror ŠBRA„WAITŠSPC„3#LAMPONEQU*‚turnoutput(lamp)on.**Stage code for ON-ŠLEA„INITIO-PBA(A6),A0‚pointtocommandtableŠLEA„ONCMD-PBA(A6),A1;ŠMOVE.LA1,CMDA-PBA(A6)„passaddressofRIOparameterblockéééD ééé#ŠMOVE.W#6,CMDL-PBA(A6)„passlength/ŠMOVE.L#60,D0setuptrap1servicerequestcodeŠTRAPƒ#1 ŠBNE.S‚FAULT5ŠBRA„WAITwaitfornexteventŠSPC„8*‚CLOSECHANNELSŠLEA„CLSCMD-PBA(A6),A1ŠMOVE.LA1,CMDA-PBA(A6)ŠMOVE.W#CLSLNG,CMDL-PBA(A6)ŠMOVE.L#60,D0ŠTRAPƒ#1 FAULT1„NOP FAULT2„NOP FAULT3„NOP FAULT4„NOP FAULT5„NOP FAULT6„NOP FAULT7„NOP FAULT8„NOP FAULT9„NOP FAULT10ƒNOP FAULT11ƒNOP FAULT12ƒNOP*‚DE-ACTIVATESELF ŠMOVE.L#15,D0ŠTRAPƒ#1ŠSPC„10A*ƒ---ƒ---ƒ---MOVETHEASQMESSAGEFROMTHEASQTORCVBUF‚---‚---ŠSPC„18TESTIRQƒEQU„*‚entrypointmovingdatafromASQtoRCVBUFŠLEA„RCVBUF-PBA(A6),A0!ŠMOVE.L#34,D0„stagecommandcodeŠTRAPƒ#1 ŠBNE.S‚FAULT4*‚RETURNFROMEVENT ŠMOVE.W#1,A0!ŠMOVE.L#37,D0„stagecommandcodeŠTRAPƒ#1ŠRTS  ASQBLOCK‚EQU„*ŠDC.Lƒ0‰tasknameŠDC.Lƒ0‰dummyfield1ŠDC.B†5‰initialstatusofASQ=ASQ&ASRenabled"ŠDC.B†16ˆlengthofmessageforASQŠDC.L†64ˆstoragefor4events4ŠDC.L†0‰logicaladdressoftargettaskasyncsvcrtnŠDC.L†0‰dummyfield*%RCVBUFƒDS.L†64ˆdefinerecieverbufferEVENTCNTDS.L†1‰eventcounter**‚CMRPARAMETERBLOCK*INITIO„DC.Bƒ7,0,0,0ŠDC.Lƒ'RI01'†TASKNAME ŠDC.Lƒ0,0,0*CMDA†DC.Lƒ0‹addressofRIOparameterblockCMDL†DC.Wƒ0‹commandlength*&*‚RIOPARAMETERBLOCKtoopenchannels*OPNCMD„DC.Wƒ0,1ŠDC.Wƒ9‘open9channels1ŠDC.Wƒ0,$7F00‹CHAN0IRQonfall,512msdebounce1ŠDC.Wƒ1,$3F04‹CHAN1IRQonfall,255msdebounce)ŠDC.Wƒ2,4CHAN2interruptonrisingedge*ŠDC.Wƒ3,0CHAN3interruptonfallingedge&*¢CHAN4ˆ{{‚CH4ISNOGOODONHARDWAR0ŠDC.Wƒ5,1CHAN5output{{hardwarecheckedok}}ŠDC.Wƒ7,1CHAN7outputŠDC.Wƒ8,1CHAN8outputŠDC.Wƒ9,1CHAN9outputŠDC.Wƒ10,0CHAN10INPUTéOPNLNG„EQU„*-OPNCMD„lengthCLSCMD„DC.Wƒ0,2‰closecommand(CLSLNG„EQU„*-CLSCMD„closecommandlength*$*ˆRIOparameterblockforONcommand ONCMD EQU *ŠDC.W…0‰returnedcommandstatusŠDC.W…3‰OUTPUTONcommandŠDC.W…$0020…turnonchannel#5‰SPC5%*ˆRioparameterblockforOFFcommand‰SPC1 OFFCMD EQU *&ŠDC.W…0‰returncommandstatuslocationŠDC.W…4‰offcommandŠDC.W…$0020…turnoffchannel5ŠSPC5 STATCMD EQU *ŠDC.W…0‰returnedcommandstatusŠDC.W…5‰readcommandŠDC.W…$0400…readchannel10*:*ƒRIOparameterblockforDISABLEINTERRUPTSonchannel1:* DSA1…EQU*‰DC.W†0‰returnedstatus‰DC.W†7‰disableinterruptcode$‰DC.W†2‰bitmaskselectingchannel1**8*‚RIOparameterblockforENABLEINTERRUPTSonchannel1* ENA1…EQU*‰DC.W†0‰returnedstatus‰DC.W†6‰enableinterruptcode$‰DC.W†2‰bitmaskselectingchannel1******†stack‚definition* ŠDS.Bƒ$400 STACK…EQU„**PLS7:2* RIO parameter block to do 200 ms pulse on chan 7‰DC.W†0‰returnedcmdstatus‰DC.W†8‰pulsecommandcode‰DC.W†1‰onechannels‰DC.W†7‰pulsechannel7‰DC.L†200ˆ200mspulse‰SPC2PLS8:1*RIO parameter block to do 300 ms pulse on chan 8‰DC.W†0‰returnedcmdstatus‰DC.W†8‰pulsecommandcode‰DC.E W†1‰onechannels‰DC.W†8‰pulsechannel8‰DC.L†300ˆ300mspulsePLS9:1*RIO parameter block to do 550 ms pulse on chan 9‰DC.W†0‰returnedcmdstatus‰DC.W†8‰pulsecommandcode‰DC.W†1‰onechannels‰DC.W†9‰pulsechannel9‰DC.L†550‡550mspulse ŠENDTESTéN*******************************************************************************Ì**Ì**™RIO1…TestProgramž**Ì**Ì*N********************************************************************************2* This program was written to test the RIO driver.**    *‰ModificationHistoryN*-----------------------------------------------------------------------------*11/02/84‡DUHInitialwriting   *1.‚Introduction*D*‰ThisprogramwaswrittentotesttheRIOdriver.‚ThisprogramwillJ*‚askforthechannelnumber.‚Itwillthenputupamenuforthefollowing *‚functions:*…1.‚Turnanoutputchannelon. *…2.‚Turnanoutputchanneloff.*…3.‚Pulseanoutputchannel.)*…4.‚Readthestatusofaninputchannel.:*…5.‚Enableandwaitforaninterruptonaninputchannel.*6*‰Thisprogramassumestheboardisjumperedasshown:*%*„J9‚1,2‚3,4‚7,8…addressoffset$0021=*„Theinterruptlevelforall4interruptsshouldbeonINT3.*ŠPAGE ,*£ASCVAL,BHLCVT,andCVT2arecommonlyused**£functionswhicharemodulesinalibrary(*£filecalledUTILIB.RO.‚Acalltothese'*£functionsareincludedinthissource)*£program,whichisprovidedwithanXREF&*£declaration.‚Thisalsorequiresthat'*£UTILIB.RObeavailabletothelinkage$*£editorduringthelinkingprocess.!*£SeeRIO.LFforlinkchainfile. -ŠXREFƒASCVALConvertsASCIItoabinaryvalue$*£ThisroutinewillconvertanASCII,*£characterstringrepresentingadecimalor,*£hexidecimalvaluetotheequivalentbinary,*£value.‚Ifadollarsign($)isencountered&*£hexidecimalconversionisperformed;,*£otherwisedecimalconversionisperformed.+*£Anemptycharacterstringfieldpassedto,*£thisfunctioninA0producesazerobinary'*£value.‚Conversionterminateswhenthe)*£firstinvalidcharacterisencountered.'*£ENTRY:‚A0-StartingaddressofASCII*°characterstringtoconvert#*£EXIT:‚D1-Characterthatcaused *°termination%*«D2-Classcodeofterminatingchar›B¤;¬?´G¼IÄ7ÌOÔCÜWäXìB"*«D3-Binaryresultofconversion*«A0-Addressofthecharacter *°followingtheterminatingchar 8ŠXREFƒBHLCVTConverts4-bytebinaryvaluetoASCIIdigit)*£Thisroutinewillconvertalongbinary-*£wordvaluetoahexadecimalvalueexpressed)*£asan8characterASCIIstring.‚Leading*£zerosaresuppressed.,*£ENTRY:‚D0.L-Binaryvaluetobeconverted(*£EXIT:‚D2.L-Fourhighorderbytesof*²convertedvalue *«D3.L-Fourloworderbytesof*²convertedvalue 6ŠXREFƒCVT2ConvertstwoASCIIdecimaldigitstobinary-*£ThisroutinewillconverttwoASCIIdecimal(*£digitstotheequivalentbinaryvalue.+*£Anemptycharacterstringfieldpassedto,*£thisfunctioninA0producesazerobinary**£value.‚Conversionterminateswhenanon-*£decimaldigitisencountered)*£ENTRY:‚A0-Addressofmostsignificant*°ASCIIdecimaldigit)*£EXIT:‚D0-Binaryresultofconversion!*«A0-Addressoftheterminating *°character ŠPAGEŠMOVE.LA0,IOSOUT+16-PBA(A4)SettheendingaddressofmessageŠLEA„IOSOUT(PC),A0ŠTRAPƒ#2ŠENDM ŠPAGE 2ŠOPT„PCSWeuseaPCSoptionsotheassemblerwill%*£forcePCrelativeaddressingwithin(*£SECTION.‚ForcesPCrelativeaddressing-*£(wheneversuchanaddressingmodeislegal))*£inaninstructionwhichoccurswithina'*£relocatableSECTIONandreferencesan,*£operandinarelocatableSECTION(neednot**£beF thesameSECTIONastheinstruction).,*£Failuretoresolvesucnareferenceintoa-*£16-bitdisplacementfromthePCwillresult)*£inanerror.‚Thisoptionmaybeusedto+*£forcepositionindependentcode;however,(*£thisoptiondoesnotforcePCrelative,*£addressingofabsoluteoperandsorunknown*£forwardreferences. ŠPAGE N*******************************************************************************Ì**™DATAƒSECTIONœ**Ì*N****************************************************************************** ŠSECTIONDATA $PBA‡EQU„*’ProgramBaseAddress(PBA)%*£Thislabelisusedtodesignatethe+*£beginningoftheprogram.‚Thisisusedto'*£makereferencestootherpartsofthe*£program,relocatable. 6ŠDS.WƒSTACKLEN‹ThisisthestackareafortheRIOtest2STACK…EQU„*’program.‚Registersandotherimportant,*£informationwillbestoredonthestackas)*£theprogramisexecuted.‚Thestackarea'*£isdynamicandwillchangeduringthe *£executionofthetestprogram. =INPUTBUF‚DS.WƒSTRNGLEN‹Thisisthestorageareafortheinput*£stringsthatareentered. 9STATUS„DS.Lƒ1’Thiswillbethestorageareforthestatus,*£codethatisreturnedfromCMR.‚Thisvalue-*£willbedisplayedtoshowtheuserwhatthe*£errorcodewas. 6NUMBER„DS.Lƒ2’SaveareafortheASCIIvalueofSTATUS.ŠPAGE N*******************************************************************************Ì*!*–PARAMETERƒBLOCKS—**Ì*N****************************************************************************** ŠNEXTWB”ForceevenboundaryIOSOUTŠDC.Bƒ0’Requestcode"ŠDC.BƒWRITEŽFunctionspecificationŠDC.Wƒ8’OptionsŠDC.Bƒ0’StatusŠDC.BƒCRTLogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress   ŠNEXTWB”ForceevenboundaryIOSINŠDC.Bƒ0’Requestcode!ŠDC.BƒREADFunctionspecificationŠDC.Wƒ0’OptionsŠDC.Bƒ0’Status"ŠDC.BƒKEYBOARD‹LogicalunitnumberŠDC.Wƒ0’ReservedŠDC.Lƒ0’RandomrecordnumberŠDC.Lƒ0’StartaddressŠDC.Lƒ0’EndaddressŠDC.Lƒ0’LengthofdatatransferŠDC.Lƒ0’Completionaddress  CMRBLK„DC.Bƒ7’InitiateI/OŠDC.BƒUNUSEDUnusedŠDC.WƒUNUSEDUnusedŠDC.Lƒ'RI01'ChannelnameŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnusedŠDC.LƒUNUSEDUnused$ŠDC.Lƒ0’AddressofI/Ocontrolblock#ŠDC.Lƒ0’LengthofI/OcontrolblockŠPAGE*2*‚OPENcommandparameterblockfortheRIOdriver:+OPEN_RIO‚DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒOPENOpencommandcodeŠDC.Wƒ1’#ofchannelstoopen-ŠDC.Wƒ0’Channeltoopen(Dynamicallychanged)-ŠDC.WƒDEFAULTŒChannelconfiguration(Dynamic)6OLEN_RIO‚EQU„*-OPEN_RIO‰LengthofOPENparameterblock*=*‚STARTOUTPUTONcommandparameterblockfortheRIOdriver:)ON_RIO„DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒON‘ONcommandcode2ŠDC.Wƒ0’Bitmaskforchannelstoturnon(Dynamic)2NLEN_RIO‚EQU„*-ON_RIO‹LengthofONparameterblock*=*‚TURNOUTPUTOFFcommandparameterblockfortheRIOdriver:*OFF_RIOƒDC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒOFFOffcommandcode3ŠDC.Wƒ0’Bitmaskforchannelstoturnoff(Dynamic)4FLEN_RIO‚EQU„*-OFF_RIOŠLengthofOFFparameterblock*;*‚PULSEDOUTPUTcommandparameterblockfortheRIOdriver:*PON_RIOƒDC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒPULSEŽPulsecommandcodeŠDC.Wƒ1’#ofchannels,ŠDC.Wƒ0’Channelnumber(Dynamicallychanged)/ŠDC.Lƒ0’Timeofpulseinmilliseconds(Dynamic)6PLEN_RIO‚EQU„*-PON_RIOŠLengthofPULSEparameterblock*?*‚READINPUTSTATUScommandparameterblockfortheRIOdriver:+READ_RIO‚DC.Wƒ0’Returnedstatusfromdriver*ŠDC.WƒREAD_STATUSˆReadstatuscommandcode.ŠDC.Wƒ0’Bitmaskforchannelstoreadandupon(*§returnholdstheactualchannelstatus=RLEN_RIO‚EQU„*-READ_RIO‰LengthofREADSTATUSparameterblock*?*‚ENABLEINTERRUPTScommandparameterblockfortheRIOdriver:+ENAB_RIO‚DC.Wƒ0’RetuF rnedstatusfromdriver-ŠDC.WƒENAB_INT‹Enableinterruptscommandcode2ŠDC.Wƒ0’BitmaskforchannelstoenableinterruptsCELEN_RIO‚EQU„*-ENAB_RIO‰LengthofENABLEINTERRUPTSparameterblock*?*‚ENABLEINTERRUPTScommandparameterblockfortheRIOdriver:+DISB_RIO‚DC.Wƒ0’Returnedstatusfromdriver.ŠDC.WƒDISAB_INTŠEnableinterruptscommandcode3ŠDC.Wƒ0’Bitmaskforchannelstodisableinterrupts>DLEN_RIO‚EQU„*-DISB_RIO‰LengthofDISABLEINTERRUPTSparameter*3*‚CLOSEcommandparameterblockfortheRIOdriver:)CLSBLK„DC.Wƒ0’ReturnedstatusfromdriverŠDC.WƒCLOSEŽClosecommandcodeCLOSLENƒEQU„*-CLSBLKŠNEXTWBŠPAGE N*******************************************************************************Ì**œMESSAGES¡**Ì*N****************************************************************************** ŠSECTIONMESSAGES 5HEAD†DC.BƒCR,LF,LF,'RIODriverTestProgram',CR,LF,LF HEADE…EQU„*-1ŠNEXTWB+MESS1…DC.BƒCR,LF,LF,'…0=OUTPUTON.',CR,LFMESS1E„EQU„*-1ŠNEXTWB#MESS2…DC.Bƒ'…1=OUTPUTOFF.',CR,LFMESS2E„EQU„*-1ŠNEXTWB=MESS3…DC.Bƒ'…2=PULSEANOUTPUTFORASPECIFIEDTIME.',CR,LFMESS3E„EQU„*-1ŠNEXTWB6MESS4…DC.Bƒ'…3=READTHECURRENTINPUTSTATUS.',CR,LFMESS4E„EQU„*-1ŠNEXTWB0MESS5…DC.Bƒ'…4=ENABLEFORANINTERRUPT.',CR,LFMESS5E„EQU„*-1ŠNEXTWBMESS6…DC.Bƒ'…5=QUIT.',CR,LFMESS6E„EQU„*-1ŠNEXTWB5MESS10„DC.BƒCR,LF,'STATUSOFALLCHANNELS(ASCII)='MESS10EƒEQU„*-1ŠNEXTWB2MESS11„DC.Bƒ'…Numberofthechanneltoconvertˆ>'MESS11EƒEQU„*-1ŠNEXTWB)MESS12„DC.Bƒ'…Enteroneoftheabove...'MESS12EƒEQU„*-1ŠNEXTWB9MESS13„DC.Bƒ'…Time(inmilliseconds)foroutputpulse>'MESS13EƒEQU„*-1ŠNEXTWB2MESS14„DC.BƒCR,LF,'<<>>',CR,LFMESS14EƒEQU„*-1ŠNEXTWB1MESS15„DC.BƒCR,LF,'<<>>',CR,LF,LFMESS15EƒEQU„*-1ŠPAGEŠNEXTWB6BADON…DC.BƒCR,LF,'***STARTOUTPUTONABORTED***--'BADONE„EQU„*-1ŠNEXTWB7BADOFF„DC.BƒCR,LF,'***TURNOUTPUTOFFABORTED***--'BADOFFEƒEQU„*-1ŠNEXTWB:BADPLS„DC.BƒCR,LF,'***STARTOUTPUTPULSEABORTED***--'BADPLSEƒEQU„*-1ŠNEXTWB,BADOPN„DC.BƒCR,LF,'***OPENABORTED***--'BADOPNEƒEQU„*-1ŠNEXTWB8BADEN…DC.BƒCR,LF,'***ENABLEINTERRRUPTABORTED***--'BADENE„EQU„*-1ŠNEXTWB:BADDIS„DC.BƒCR,LF,'***DISABLEINTERRRUPTABORTED***--'BADDISEƒEQU„*-1ŠNEXTWB4BADREADƒDC.BƒCR,LF,'***READSTATUSABORTED***--'BADREADE‚EQU„*-1ŠNEXTWB-BADCLS„DC.BƒCR,LF,'***CLOSEABORTED***--'BADCLSEƒEQU„*-1ŠNEXTWB+STATUSMƒDC.Bƒ'ErrorcodereturnedinD0='STATUSME‚EQU„*-1ŠNEXTWBCRLF†DC.BƒCR,LF CRLFE…EQU„*-1ŠNEXTWBŠPAGE N*******************************************************************************Ì**–PROGRAMƒSECTION™**Ì*N****************************************************************************** ŠSECTIONCODEPROGSTRTŠLEA„STACK(PC),A7.ŠLEA„PBA(PC),A4‰GetProgramBaseAddress(PBA) &ŠOUTPUTHEAD,HEADE‰Displaytheheading N*-----------------------------------------------------------------------------***‰Getthenumberofthechanneltoconvert*N*-----------------------------------------------------------------------------GETCHAN0ŠOUTPUTMESS11,MESS11E…ChannelnumbertoconvertŠINPUT‚INPUTBUF,INPUTBUF+8ŠLEA„INPUTBUF(PC),A0)ŠBSR„CVT2ConvertASCIIdecimaltobinary(ŠIF.LD0#0OR.LD0#15THEN.S ŒBRAGETCHANŠENDI8ŠMOVE.WD0,OPEN_RIO+6-PBA(A4)Savethechannelnumber...ŠMOVE.WD0,PON_RIO+6-PBA(A4) =ŠLEA„BIT_NUMBER(PC),A0‚Convertthechannelnumber(0-15)into7ŠLSL.B‚#1,D0Žthecorrespondingbitnumber(1,2,4,8...).ŠMOVE.W(A0,D0.W),D08ŠMOVE.WD0,READ_RIO+4-PBA(A4)Savethebitmaskvalue...ŠMOVE.WD0,ENAB_RIO+4-PBA(A4)ŠMOVE.WD0,DISB_RIO+4-PBA(A4)ŠMOVE.WD0,ON_RIO+4-PBA(A4)ŠMOVE.WD0,OFF_RIO+4-PBA(A4) N*-----------------------------------------------------------------------------*3*‰Get„0=OUTPUTON„1=OUTPUTOFFŠ2=PULSEOUTPUT0*3=READSTATUS‚4=ENABLEINTG ERRUPTSƒ5=QUIT*N*-----------------------------------------------------------------------------GETCLST'ŠOUTPUTMESS1,MESS1E…Putupthemenu...ŠOUTPUTMESS2,MESS2EŠOUTPUTMESS3,MESS3EŠOUTPUTMESS4,MESS4EŠOUTPUTMESS5,MESS5EŠOUTPUTMESS6,MESS6EHGET_CHOICE‚OUTPUTMESS12,MESS12EƒAsktheusertoenteroneoftheabove. +ŠINPUT‚INPUTBUF,INPUTBUF+8GettheirchoiceŠLEA„INPUTBUF(PC),A0)ŠBSR„CVT2ConvertASCIIdecimaltobinary'ŠIF.WD0#0OR.WD0#5THEN.SBRA.SGET_CHOICEŠENDIŠPAGE**‰0=StartoutputONcommand:*ŠIF.BD0#0THEN.S 'ŒBSR.L‚CLOSE_ALLˆGocloseallchannels./ŒOUTPUTMESS14,MESS14Eƒ<<<ƒStartingcommandƒ>>> >ŒMOVE.W#DEFAULT,D0†Usethedefaultconfigurationfortheopen$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A02ŒLEA„ON_RIO(PC),A1„StartoutputONparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#NLEN_RIO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1ŒIFTHEN.SŽMOVE.WON_RIO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)4ŽOUTPUTBADON,BADONE…***STARTOUTPUTONABORTED***ŽBRA.L‚SHOW_D0ŒENDI 3ŒOUTPUTMESS15,MESS15Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDIŠPAGE**‰1=TurnoutputOFFcommand:*ŠIF.BD0#1THEN.S 'ŒBSR.L‚CLOSE_ALLˆGocloseallchannels./ŒOUTPUTMESS14,MESS14Eƒ<<<ƒStartingcommandƒ>>> >ŒMOVE.W#DEFAULT,D0†Usethedefaultconfigurationfortheopen$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A03ŒLEA„OFF_RIO(PC),A1ƒTurnoutputOFFparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#FLEN_RIO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1ŒIFTHEN.SŽMOVE.WOFF_RIO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)6ŽOUTPUTBADOFF,BADOFFE„***TURNOUTPUTOFFABORTED***ŽBRA.L‚SHOW_D0ŒENDI 3ŒOUTPUTMESS15,MESS15Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDIŠPAGE**‰2=PULSEanoutputcommand:*ŠIF.BD0#2THEN.L3ŒBSR„GET_TIME‰Getthepulseduration(milliseconds)+ŒMOVE.LD3,PON_RIO+8-PBA(A4)Storethetime 'ŒBSR.L‚CLOSE_ALLˆGocloseallchannels./ŒOUTPUTMESS14,MESS14Eƒ<<<ƒStartingcommandƒ>>> 6ŒMOVE.W#DEFAULT,D0†UsetheWAKEUPoptionfortheopen$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A06ŒLEA„PON_RIO(PC),A1ƒStartoutputpulseparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#PLEN_RIO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1*7*ƒDRIVERDOESNOTSUPPORTWAKEUPAFTERANOUTPUTPULSE.**‹MOVE.L#19,D0 *‹TRAPƒ#1 ŒIFTHEN.SŽMOVE.WPON_RIO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)9ŽOUTPUTBADPLS,BADPLSEƒ***STARTOUTPUTPULSEABORTED***ŽBRA.L‚SHOW_D0ŒENDI 3ŒOUTPUTMESS15,MESS15E…***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDIŠPAGE* *‰3=Readinputstatuscommand:*ŠIF.BD0#3THEN.L /ŒOUTPUTMESS14,MESS14Eƒ<<<ƒStartingcommandƒ>>> ŒBSR.L‚CLOSE_ALL'ŒMOVE.W#$000E,D0ˆSetforinputchannel$ŒBSR.L‚OPEN_CHANˆGoopenthechannel ŒLEA„CMRBLK(PC),A06ŒLEA„READ_RIO(PC),A1‚ReadinputstatusparameterblockŒMOVE.LA1,$14(A0)ŒMOVE.W#RLEN_RIO,$18(A0)ŒMOVE.L#CMR,D0ŒTRAPƒ#1ŒIFTHEN.SŽMOVE.WREAD_RIO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)4ŽOUTPUTBADREAD,BADREADEƒ***READSTATUSABORTED***ŒENDI ŒCLR.L‚D0<ŒMOVE.WREAD_RIO+4-PBA(A4),D0‚Getthestatusvaluereturned.ŒBSR„BHLCVTConvertittoASCII9ŒMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŒMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytesŒOUTPUTMESS10,MESS10EŒOUTPUTNUMBER,NUMBER+7ŒOUTPUTCRLF,CRLFE 3ŒOUTPUTMESS15,MESS15E…***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDIŠPAGE* *‰4=Enableinterruptscommand:*ŠIF.BD0#4THEN.S /ŒOUTPUTMESS14,MESS14Eƒ<<<ƒStartingcommandƒ>>> ŒBSR.L‚CLOSE_ALL 3ŒMOVE.W#$7F0C,D0ˆEnableinterrupts,WAKEUPoption,8*‡softwaredebounce=508mSec,triggeronpositiveedge.$ŒBSR.L‚OPEN_CHANˆGoopenthechannel *(*‚DoawaituntilthedriverwakesuG sup*ŒMOVE.L#19,D0ŒTRAPƒ#1 ŒIFTHEN.SŽMOVE.WENAB_RIO(PC),D0ŽMOVE.LD0,STATUS-PBA(A4)6ŽOUTPUTBADEN,BADENE„***ENABLEINTERRUPTSABORTED***ŒENDI 3ŒOUTPUTMESS15,MESS15Eƒ***‚<<>>‚***ŒBRA.LGETCHANGostartover. ŠENDI    **‰5=quitcommand:*ŠIF.BD0#5THEN.S BRA.LEXITŠENDI ŠBRA.LGETCHANGostartover.ŠPAGEM*----------------------------------------------------------------------------*+*‚GETTHETIMEDURATIONFORANOUTPUTPULSE*M*----------------------------------------------------------------------------GET_TIMEŠOUTPUTMESS13,MESS13EŠINPUT‚INPUTBUF,INPUTBUF+8ŠLEA„INPUTBUF(PC),A0 ŠBSR„ASCVAL+ŠIF.LD3#1OR.LD3#$FFFFTHEN.S ŒBRA„GET_TIMEŠENDIŠAND.L‚#$0000FFFF,D3ŠRTS M*----------------------------------------------------------------------------**ƒOPENTHECHANNEL*M*----------------------------------------------------------------------------OPEN_CHANLEA„CMRBLK(PC),A0ŠLEA„OPEN_RIO(PC),A1BŠMOVE.WD0,OPEN_RIO+8-PBA(A4)‚Savetheopenconfigurationoptions.ŠMOVE.LA1,$14(A0)ŠMOVE.W#OLEN_RIO,$18(A0)7ŠMOVE.L#CMR,D0ŒHereweperformanexecutiverequesttoŠTRAPƒ#1‘invokeCMR.ŠIFTHEN.SŒMOVE.LD0,STATUS-PBA(A4)+ŒOUTPUTBADOPN,BADOPNE…***OPENABORTED***ŒBRA.S‚SHOW_D0ŠENDIŠRTS M*----------------------------------------------------------------------------**ƒOUTPUTTHEERRORCODE:*M*----------------------------------------------------------------------------:SHOW_D0ƒMOVE.LSTATUS(PC),D0†GetthestatusvaluereturnedŠBSR„BHLCVTConvertittoASCII9ŠMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŠMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytesŠOUTPUTSTATUSM,STATUSMEŠOUTPUTNUMBER,NUMBER+7ŠOUTPUTCRLF,CRLFE EXIT:ŠBSR.S‚CLOSE_ALL +EXIT_OUT:MOVE.L#15,D0TerminatethistaskŠTRAPƒ#1ŠPAGEN*-----------------------------------------------------------------------------**‚CLOSEALLCHANNEL'SROUTINE:*N*----------------------------------------------------------------------------- CLOSE_ALLŠLEA„CMRBLK(PC),A0ŠLEA„CLSBLK(PC),A1ŠMOVE.LA1,$14(A0)ŠMOVE.W#CLOSLEN,$18(A0)-ŠMOVE.L#CMR,D0ŒTellCMRtoclosethechannelŠTRAPƒ#1ŠIFTHEN.SŒBSR„BHLCVTConvertittoASCII9ŒMOVE.LD2,NUMBER-PBA(A4)‚SavetheupperfourASCIIbytes;ŒMOVE.LD3,NUMBER+4-PBA(A4)SavethelowerfourASCIIbytes,ŒOUTPUTBADCLS,BADCLSE…***CLOSEABORTED***ŒOUTPUTNUMBER,NUMBER+7ŒOUTPUTCRLF,CRLFE&ŒBRA.S‚EXIT_OUT‰Outputtheerrorcode.ŠENDI ŠRTS M*----------------------------------------------------------------------------*B*ƒTABLETOCONVERTTHECHANNELNUMBER(0-15)TOIT'SCORRESPONDING-*ƒBITMAPPEDVALUE(1,2,4,8,....$4000,$8000).*M*----------------------------------------------------------------------------'BIT_NUMBER‚DC.W‚1,2,4,8,$10,$20,$40,$805ŒDC.W‚$0100,$0200,$0400,$0800,$1000,$2000,$4000,$8000 ŠEND„PROGSTRT=/*=/*†RIODRV.TESTE.AF=/*:=/* Chain file to assemble RIO driver test routine 'TESTE'=/*:=/* If no output argument is specified for the listing the.=/* chain file will default to RIODRV.TESTE.LS=/*=/IFC \1ƒ=ARGRIODRV.TESTE.LS=/ENDIF=/*)=ASM RIODRV.TESTE.SA,RIODRV.TESTE.RO,\1;R=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDééH ééééô=/*=/*†RIODRV.TESTRIO.AF=/*,=/*†TESTRIOtestprogramassemblychainfile=/*6=/*†Thecommandlinewillacceptargumentsasfollows:=/*;=/*‹Argument01…\1=Outputfileassemblylistingordevice=/*H=/*†Thefollowingshowstheassemblychainsequence.‚InthisexampletheH=/*†NULLdevicewaschosenasArgument01,however,theusercouldifhe5=/*†sodesiredhaverequestedanoutputlistingfile.=/*"=/*=CHAINRIODRV.TESTRIO.AF#NULL=/*,=/*†Defaultargument01isRIODRV.TESTRIO.LS=/*=/IFC \1ƒ=ARGRIODRV.TESTRIO.LS=/ENDIF=/*2=ASM RIODRV.TESTRIO.SA,RIODRV.TESTRIO.RO,\1;RZ=100=/*{ Included files are:=/*ƒ--none--=/*}=/*=ENDéééééý' ACIADRV SA  dobbARTDRV SA { {ÙbbH >ACIADRVƒIDNTƒ4,1‡VERSADOSACIATERMINALDRIVERWITHTYPE-AHEAD;ŠTTL„ACIADRV:‚VERSADOSACIATERMINALDRIVERWITHTYPE-AHEAD ŠLLENƒ120J**************************************************************************J***************************************************************************9*‰ACIADRV:‚VERSAdosACIAterminaldriverwithtype-ahead.*8*‰Purpose:‚VERSAdosdevicedrivertohandleasynchronous/*terminals(ofanytype)overtheACIAchipon*thefollowingboards:*’DEBUG(EXORmacs),…MVME110**‰Revisionhistory:*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*šChangedUNSTOProutinetofixbugwhereachar(*šisdestroyedintheUSEXOFF/XONmode.2*šChangedGET_STATroutinetotestCTSbitinstead *šofDCDbit.*»KEG05/23/84 / X ? #F +6 3> ;B CN KG SK [J cH k<7*08/05/83‚ChangedToDriveAnACIAinsteadofNEC7201*šByTomAngert*7*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%***†XREF†TERM_UNRDYŠNotusedbyACIA.$***†XREF†MARK_DOWN‹NotusedbyACIA. *?*‚Masksdelineatingallrecognized(REC)andunrecognized(UNR)(*‚attributes(ATT)andparameters(PAR).*C*REC_ATTƒEQU„%1000111111111111‚1bitsrepresentdefinedattributes.D*UNR_ATTƒEQU„$FFFF-REC_ATT†The1'scomplementofthatareundefined. C*REC_PARƒEQU„%0111111111111111‚1bitsrepresentdefinedparameters.D*UNR_PARƒEQU„$FFFF-REC_PAR†The1'scomplementofthatareundefined.***‚Equatefilesincluded:**‰STR*‰TCB*‰CCB*ˆ9995..BAB.EQ*‰IOE*‰NIO*‰LV5#*‰TERMINAL.EQˆEquatesforterminals *‰UTILITY.MC:*‰TERMCCB.EQ‰OffsetsandequatesforCCBDDPforterminals.*ŠPAGE**‚I 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****‡PAGEŠNOLIST ŠTTL…STR.EQŠINCLUDE9995.&.STR.EQŠNOLISTŠINCLUDE9995.&.TCB.EQŠNOLISTŠINCLUDE9995.&.CCB.EQŠNOLISTŠINCLUDE9995.&.IOE.EQ‰NOLISTŠINCLUDE9995.&.NIO.EQŠNOLISTŠINCLUDE9995.&.LV5.EQ‰NOLIST‰INCLUDEƒ9995.&.BAB.EQŠLISTŠINCLUDE9995.&.TERMINAL.EQ‰PAGEŠINCLUDE9995.&.UTILITY.MCŠINCLUDE9995.&.TERMCCB.EQŠLIST‰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ƒ'121784'‹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,I 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-independentstuff*%%%%%%%%%%%%%%ƒbwn‚8/13/842‰IFƒƒTHEN…SomethingwentwrongwithTERM_INIT.4‰IFƒƒTHEN„Theexeccallfailedandwecannotget!*œthescheduler'sentrypoint!!!ŽTR0$.KILLER‚,‰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: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‘BrancJ hifreceivedacharacter. +‰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ˆCallthedeviceindependentroutine*£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'wehandlediJ t,' Š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*‰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<--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'rK eusingparity,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‰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_BRK EAK:‰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  éééADARTDRVƒIDNTƒ4,0‡VERSADOSSCN2681TERMINALDRIVERWITHTYPE-AHEAD>ŠTTL„DARTDRV:‚VERSADOSSCN2681TERMINALDRIVERWITHTYPE-AHEAD ŠLLENƒ120J**************************************************************************J**************************************************************************J**************************************************************************J***************************************************************************<*‰DARTDRV:‚VERSAdosSCN2681terminaldriverwithtype-ahead.*8*‰Purpose:‚VERSAdosdevicedrivertohandleasynchronous2*terminals(ofanytype)overtheSCN2681chipon*thefollowingboards:2*“MVME115„MVME115-A(Thisonenotimplementedyet)**‰Revisionhistory:1*‘10/23/84‚AllBSR'stoTERMLIBnowJSR'sincase.*›TERMLIBislocatedmorethan32Kbytesaway.**‘10/17/84‚InitialreleasebyJulieHoban.*J**************************************************************************J**************************************************************************J**************************************************************************J************************************************************************** **‚XREF'sfromTERMLIB* ‰XREF†LOG_ERR‰XREF†MARK_DOWN ‰XREF†RESET‰XREF†TERML _BREAK‰XREF†TERM_COMMAND‰XREF†TERM_GOT_CHAR‰XREF†TERM_INIT‰XREF†TERM_TBE‰XREF†TERM_UNRDY **‚Equatefilesincluded:* *‰STR.EQ*‰TCB.EQ*‰CCB.EQ*‰IOE.EQ*‰NIO.EQ*‰LV5.EQ0*‰BAB.EQBackgroundActivationBlockdescription:*‰TERMCCB.EQ‰OffsetsandequatesforCCBDDPforterminals.#*‰TERMINAL.EQˆEquatesforterminals*‰SCN2681.EQ‰Devicedescription*‰UTILITY.MC‰Macros*ŠNOLISTŠINCLUDE9995.&.STR.EQŠNOLISTŠINCLUDE9995.&.TCB.EQŠNOLISTŠINCLUDE9995.&.CCB.EQŠNOLISTŠINCLUDE9995.&.IOE.EQŠNOLISTŠINCLUDE9995.&.NIO.EQŠNOLISTŠINCLUDE9995.&.LV5.EQŠNOLISTŠINCLUDE9995.&.BAB.EQŠNOLISTŠINCLUDE9995.&.UTILITY.MCŠLISTŠINCLUDE9995.&.SCN2681.EQŠINCLUDE9995.&.TERMINAL.EQ sI |A „B Œ8 ”4 œ< ¤6 ¬8 ´9 ¼3 Ä9 Ì> Ô> ÜO ä? ìIŠINCLUDE9995.&.TERMCCB.EQŠLIST>ŠTTL„DARTDRV:‚VERSADOSSCN2681TERMINALDRIVERWITHTYPE-AHEADŠPAGEŠOFFSET„TERMDDP*>*‚Thedevice-dependentvariablesoftheCCBaredefinedbelow.* :RESERVE.4SAV_SPR’Addressofthesupervisor'sdriverCCB.%*§Wemustsavethisbecauseinterrupt&*§processingreturnstothesupervisor *§driver. ;RESERVE.4SAV_ISR’Imageof2681interruptstatusregister. *§Usedtokeeptrackofanybits#*§(interrupts)lefttoserviceupon%*§returntothesupervisor.Longword*§notrequired,butitmakesit *§simple. :RESERVE.1SAV_CREG‘Imageof2681commandregister,needed#*§tokeeptrackofthestateofthe%*§transmitterand‚receiver.‚Togivea$*§commandotherthanRX/TXOn/Offor$*§Reset,readthecurrentstatefrom#*§here,ORinthebitsforthemisc*§commands,thentellthechip. *ƒfortheDARTdriver.‚CMRautomaticallyallocatesonepageofA*ƒmemory($100bytes)fortheCCB,andourvariableEXTCCBSZwillB*ƒresideintheCMRparametertableatthebeginningofthedriver8*ƒtotellCMRhowmanyextrapagesofmemoryareneeded.**CCBSIZEBEQU‡*PAGESIZEEQU‡$100L1‡SET‡CCBSIZEB+PAGESIZE-1CCBSIZE‚EQU‡L1/PAGESIZEEXTCCBSZEQU‡CCBSIZE-1‰PAGEJ***************************************************************************+*‰SERVICEVECTORTABLE,REVISIONINFO,ETC.*@*‰ThistableisexaminedbyCMRwhenthechannelisallocatedtoC*‰determinewheretogoforinterrupts,commands,&initialization.<*‰Itmustalwaysbeattheverytopofthedrivercode.‚Also>*‰includedisaparametertellingthenumberofextrapagesof>*‰memorytoincludeintheCCB,andinformationdescribingthe*‰revisionofthedriver.*L**************************************************************************** ŠSECTION‚0ŠOPT„BRS DARTDRV: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!*=ŠDC.LƒINTERRUPT-DARTDRV‚Addressofinterruptserviceroutine.9ŠDC.LƒCOMMAND-DARTDRV„Addressofcommandserviceroutine.5ŠDC.LƒINIT-DARTDRV‡Addressofinitializationroutine.ŠDC.Lƒ0’Reserved. **‚OtherCMRparameters.*7ŠDC.BƒEXTCCBSZ‹#ofextraL pagesintheCCB.‚TheCCBmay)*§beanysizefrom1to256pages(apage'*§is256bytes):‚ifthisfieldis0,it*§willbe1page,etc.ŠDC.Bƒ0,0,0ŽReserved.ŠDC.Lƒ0,0,0ŽReserved. **‚Revisioninfo:*/ŠDC.Bƒ'110784'‹DateoflastassemblyasMMDDYY.1ŠDC.Bƒ''Spaceindicatesnopatchesto.LOfile.)ŠDC.Bƒ'4'MajorVERSAdosrevisionnumber.*‰PAGEO********************************************************************************+*ˆJumptableforusebythegenericTERMLIB*O******************************************************************************* ‰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:*@*‹1.Device-IndependentinitializationinthecalltoTERM_INIT.3*‹2.Device-Dependentinitializationofthedevice.*@*‰WegotherethroughaJSRfromCMR,andwillexitwithanRTS.>*‰AllregistershavebeensavedbyCMRandmaybeusedfreely.?*‰Entryisatinterruptlevel0,andweareinsupervisormode.**‰Entry:…A5=addressofCCB.*6*‰Calls:…TERM_INITingenericterminaldriverTERMLIB.*'*‰Exitsto:‚CMR(viaRTS)ifallisOK.'*”KILLERifexecwon'tallocatememory,.*•orcan'tgetbackgroundroutineentrypoint.*J**************************************************************************J**************************************************************************J**************************************************************************ŠDS…0INIT:*>*‚Performthedevice-independentinitializationbycallingthe'*‚genericroutineTERM_INITinTERMLIB.*.‰JSR‡TERM_INIT‹Dothedevice-independentstuff2‰IFƒƒTHEN…SomethingwentwrongwithTERM_INIT.4‰IFƒƒTHEN„Theexeccallfailedandwecannotget!*œthescheduler'sentrypoint!!!ŽTR0$.KILLER‚,‰ELSERTSThechannelisdown!!‰ENDI‰ENDI*;*‚Performtheminimumdevice-dependentinitializationusing@*‚callguardedtotheEXECforaroutineresidentinbackground.*5‰LEA‡DO_INIT(PC),A0†Device-dependentroutineaddress.-‰MOVE.L„#T0GUARD,D0‰CallguardedtotheEXEC.‰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*9*‰Calls:TERM_COMMANDingenericterminaldriverTERMLIB.*3*‰Exit:‚D0=resultsofparameterblockvalidation:3*•always0inourcase,indicatingitwasOK,since2*•IOSwillnotsendusanyrequestexceptHALTI/O/*•ifwearealreadybusy,andCMRmakesallthe*•otherchecks.**J**************************************************************************J**************************************************************************J********************************************************************M ****** COMMAND: *,*‚Performanydevice-dependentstuffhere...*9‰ST.BƒTBE_FLAG(A5)‹Settheflagtoindicatebufferempty.*I*‚Performthedevice-independentcommandhandlerbycallingTERM_COMMAND.* %ŠJSR…TERM_COMMAND†PerformthecommandŠRTS—returntoCMR.ŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INTERRUPTHANDLINGROUTINE*<*‰ThisroutinecompletesI/Orequestsstartedbythecommand:*‰serviceroutine.‚Itisenteredattheinterruptpriority;*‰levelofinterruptsonthischannel,andisessentiallya9*‰subroutinetothefirstlevelinterrupthandlerinCMR.=*‰Remember,however,thatthisisasubordinatedriver--hence=*‰theinterruptwasfieldedfirstbythesupervisorusedwith(*‰whatevertypeofboardwe'rehandling.*5*‰Entry:A0=addressofthesupervisordriver'sCCB.*A5=addressofourCCB.3*D1=CopyofInterruptStatusRegisterfrom2681.*"*D0,A0,A1havebeensavedbyCMR.-*D1‡hasbeensavedbythesupervisordriver.*D0,A1„areavailabletouse.8*A0‡mustbereturnedtothesupervisorwiththeaddress*šofthesupervisor'sCCB.4*D1‡mustbereturnedtothesupervisorwiththebit(*špatternofinterruptslefttoservice.*>*‰Exit:‚alwaysviaRTS,whichtakesusbacktothesupervisor.**‰Stack:*(A7)+8... *(A7)+4longwordreturnaddress6*(A7)ƒlongwordsavedcontentsofD1(mustberestored*—beforeexittoCMR)*J**************************************************************************J**************************************************************************J************************************************************************** INTERRUPT: *‚NOTE:*?*‚ThisdriverrequiresasupervisordriversinceithandlestheA*‚SCN2681.‚ThesupervisordriverwrittenforusewiththisoneisC*‚DARTSPR,whichbranchestotheappropriatelongwordinthistableC*‚dependingoninterrupttype.‚ThesupervisorwillnotpasscontrolA*‚tothisdriverunlessthereisinfactaninterruptonmyport.**‚ENTRYPOINTS:*%ŠBRA.S‚RCACharacterreceivedforme.ŠNOP'ŠBRA.S‚TBEMytransmitbufferisready.ŠNOP-ŠBRA.L‚BCIChangeinBREAKstatusonmyport.ŠNOP&ŠBRA.L‚IP2InputPort2Statuschange.ŠPAGEJ***************************************************************************)*‰TRANSMITBUFFEREMPTYINTERRUPTHANDLER*@*‰TheSCN2681'stransmitbufferjustbecameempty,soifwehave+*‰morecharacterstosendwecandoitnow.*5*‰Entry:A0=addressofthesupervisordriver'sCCB.*A5=addressofCCB7*D1=copyofInterruptStatusRegisterfromthe2681.*9*‰Calls:TERM_TBEinthegenericterminaldriverTERMLIB.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*O******************************************************************************* TBE:.ŠMOVE.LCCBCHB(A5),A1†A1<--addrofourport.<ŠMOVE.LA0,SAV_SPR(A5)…Saveaddressofthesupervisor'sCCB. 4ŠBCLRƒ#CLRTBE,D1‰ClearinterruptbitincopyofISR.*ŠMOVE.LD1,SAV_ISR(A5)…SaveitintheCCB. ?ŠTST.B‚BRK_FLAG(A5)‡IsthisTBEbecausewe'retransmittingbrk?+ŠIF…THENŠTheflagissetifyes,so...(‹MOVEQ‚#0,D0PutsomenullsintoD0,and:‹MOVE.BD0,DREG(A1)‡Outputacharactertoclearinterrupt.)‹BRA.L‚INT_EXITŠExitfromthisinterrupt.ŠENDI 3ŠPUT_BYTETXOFF,D0‰Setdisabletransmittercommand.5ŠMOVE.BD0,SAV_CREG(A5)„ReplacecurrentvalueinCCB.=ŠMOVE.BD0,CREG(A1)ˆClearinterruptbydisablingtransmitter.5ŠST.BƒTBE_FLAG(A5)‡Setflagtoindicatebufferempty.*D*‚Nowcallthedevice-independentroutinethattestsfortransparent/*‚modeandinvokestheXMITbackgroundroutine.*ŠJSR„TERM_TBE‹JSRintoTREMLIB.(ŠBRA.L‚INT_EXIT‹Exitfromtheinterrupt.ŠPAGEJ**M *************************************************************************(*‰RECEIVEDCHARACTERAVAILABLEINTERRUPT*@*‰TheSCN2681hasjustreceivedacharacter,anditisavailable=*‰forreading.‚Wewilldothatnow,andtheresultwillgoin$*‰thereceivequeueifthere'sroom.*5*‰Entry:A0=addressofthesupervisordriver'sCCB.*A5=addressofCCB7*D1=copyofInterruptStatusRegisterfromthe2681.*>*‰Calls:TERM_GOT_CHARinthegenericterminaldriverTERMLIB.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** RCA:.ŠMOVE.LCCBCHB(A5),A1†A1<--addrofourport.<ŠMOVE.LA0,SAV_SPR(A5)…Saveaddressofthesupervisor'sCCB.*7*‚Getthecharacterfromthe2681andcheckforerrors.*>ŠMOVE.BDREG(A1),D0ˆClearinterruptbygettingcharfrom2681.2ŠBCLRƒ#CLRRCA,D1‰ClearbitinworkingcopyofISR.*ŠMOVE.LD1,SAV_ISR(A5)…SaveitintheCCB. 3ŠMOVE.BSREG(A1),D1ˆGetthestatusfortheprocess./ŠAND.B‚#$70,D1ŒMaskoutallbuttheerrorbits.1ŠBNE.S‚INTERRBranchifanyerrorbitsturnedon.*D*‚Callthedeviceindependentroutinetocheckfortransparentmode,D*‚andanyspecialcharacterssuchasXON,XOFF,BREAKEQUIVALENT,or?*‚DISCARDOUTPUTandinvoketheappropriatebackgroundroutine.9*‚Otherwise,justputthecharacterinthereceivequeue.*"ŠJSRƒTERM_GOT_CHAR‡JSRtoTERMLIB.(ŠBRA.L…INT_EXITˆExitfromtheinterrupt.ŠPAGEJ***************************************************************************#*‰FOUNDERRORONRECEIVEDCHARACTER*=*‰TheSCN2681detectedanerrorintheprocessofreceivinga<*‰character.‚Weneedtorecordthisinformationsothatwhen<*‰thecorrespondingdataisrequestedfromthereceivequeue*‰wecanreportanerror.*0*‰Entry:D0.B=characterwhichgeneratederror.0*D1.B=statusregistervalue(errorbitsonly)*A1ƒ=addressofourport*A5ƒ=addressofCCB*8*‰Calls:LOG_ERRinthegenericterminaldriverTERMLIB.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** INTERR:ŠSWAPƒD0‘Makeroom.:ŠMOVE.BSAV_CREG(A5),D0„Currentvalueofcommandregister.0ŠOR.Bƒ#RSTEST,D0‰Setthereseterrorstatusbit.(ŠMOVE.BD0,CREG(A1)ˆTellittothechip.ŠSWAPƒD0‘Restorecharacter. )ŠBTSTƒ#SPARER,D1‰Wasthisaparityerror?-ŠIF…THENŠIftheparityerrorbitisset,8‹PUT_BYTEPAR_FRAM,D0…PuttheVERSAdoserrorcodeinD0,‹JSR„LOG_ERR‹Logtheerror.-‹BRA.L‚INT_EXITŠAndexitfromthisinterrupt.ŠENDI )ŠBTSTƒ#SDAOVR,D1‰Wasthisadataoverrun?3ŠIF…THENŠIfthedataoverrunerrorbitisset,7‹PUT_BYTEOVERRUN,D0†PuttheVERSAdoserrorcodeinD0,‹JSR„LOG_ERR‹Logtheerror.-‹BRA.L‚INT_EXITŠAndexitfromthisinterrupt.ŠENDI *ŠBTSTƒ#SFRMER,D1‰Wasthisaframingerror?.ŠIF…THENŠIftheframingerrorbitisoff,-‹BRA.L‚INT_EXITŠWeshouldn'tbeheresoexit."ŠELSE–Theframingerrorbitison,3‹TST.B‚D0Solet'sseeifitreallyisacharacter.9‹IF…THEN‰Characterisreal,andsoisframingerror.8ŒPUT_BYTEPAR_FRAM,D0„PuttheVERSAdoserrorcodeinD0,ŒJSR„LOG_ERRŠLogtheerror.-ŒBRA.L‚INT_EXIT‰Andexitfromthisinterrupt.‹ENDIŠENDI‰PAGE*$*‚Thismusthavereallybeenabreak*7ŠMOVE.BSAV_CREG(A5),D0„GetcurrentvaluefromtheCCB.0ŠOR.Bƒ#RSTBCI,D0‰Settheresetbreakstatusbit..ŠMOVE.BD0,CREG(A1)ˆThisclearstheinterrupt. *ŠMOVE.LSAV_ISR(A5),D1…GetvaluefromCCB.4ŠBCLRƒ#CLRBCI,D1‰ClearinterruptbitincopyofISR.*ŠMOVE.LD1,SAV_ISR(A5)…SaveitintheCCB. ŠBKGRNDBREAKŠBRA.L‚INT_EXITŠPAGEJ****************************************************************************‰BREAKCHANGEINTERRUPT*9*‰Thisinterruptfromthe2681iscausedwheneitherport6*‰hasdeN tectedthebeginningorendofabreaksignal.9*‰Theonlyconditionwecareaboutiswhenabreaksignal:*‰starts(detectedfromthestatusregisterforourport),:*‰inwhichcasewehavetogetanappropriateeventtothe9*‰attachedtask(IOS).Forbothinterrupts,wemustissue7*‰a'resetbreakchangeinterrupt'commandtoclearthe*‰interruptbitintheISR.*.*‰Entry:A0=addressofthesupervisor'sCCB.*A5=addressofCCB?*D1=workingcopyofInterruptStatusRegisterfromthe2681.*;*‰Calls:TERM_BREAKinthegenericterminaldriverTERMLIB.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** BCI:.ŠMOVE.LCCBCHB(A5),A1†A1<--addrofourport.<ŠMOVE.LA0,SAV_SPR(A5)…Saveaddressofthesupervisor'sCCB. DŠMOVE.BSREG(A1),SAV_SREG(A5)Savecurrentvalueofstatusregister. ,ŠMOVE.BSAV_CREG(A5),D0„Getcurrentcommand.3ŠOR.Bƒ#RSTBCI,D0‰Settheresetbreakstatuschange.6ŠMOVE.BD0,CREG(A1)ˆThisclearstheBCIinterruptbit.2ŠBCLRƒ#CLRBCI,D1‰ClearbitinworkingcopyofISR.ŠMOVE.BD1,SAV_ISR(A5)…Saveit. **‚CleartheFIFO...*?CLRFIFOƒMOVE.B6(A1),D0‹ReadtheFIFO...upto3bytestoclear.ŠMOVE.B6(A1),D0‹*ŠMOVE.B6(A1),D0‹* 2ŠBCLRƒ#CLRRCA,D1‰ClearbitinworkingcopyofISR.*ŠMOVE.LD1,SAV_ISR(A5)…SaveitintheCCB. ;ŠMOVE.BSAV_SREG(A5),D0„Getsavedvalueofstatusregister.4ŠBTSTƒ#SRXBRK,D0‰Thisbitindicatesbegin/endbreak..ŠBEQ„INT_EXIT‹Ifitwastheend,soexit. 7ŠJSR„TERM_BREAK‰JSRtoTERMLIBtohandledev-indbreak.&ŠBRA„INT_EXIT‹Exitfromtheinterrupt.ŠPAGEO*********************************************************************************‰IP2INTERRUPT*<*‰TheInputPort2hasmadeatransition(active-to-inactive>*‰orinactive-to-active).TheInputPort2isjumperedtoPort>*‰Bandhard-wiredtoRS232line20.IP2ismonitoredfromthe;*‰InputPortChangeRegister(IPCR)oftheSCN2681.TheIP2<*‰interruptisenabledformodemoperationonly(theIOAMODM<*‰bitinIOSATWisset).‚Itislikelythattheuserwillfix;*‰theMVME115sothatpin8oftheRS232interfacecomesin *‰onIP2.*>*‰TheIPCRisread,anddependingonthecurrentstateofIP2,C*‰theappropriatebackgroundroutineisactivated(IP2activelow).*@*‰IfIP2wentinactive-to-active,thenamodemprobablyanswered@*‰thephoneandweactivateBREAKinthebackground.‚IfIP2wentA*‰active-to-inactive,thenthemodemhunguportheterminalwentA*‰unready,andwemayhavetoqueueaneventiftherewasI/O.We.*‰activateIPCinthebackgroundtohandleit.***‰Entry:A0=addressofsupervisor'sCCB.*A5=addressofCCB?*D1=workingcopyofInterruptStatusRegisterfromthe2681.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*O******************************************************************************* IP2:4ŠBCLRƒ#CLRIP2,D1‰ClearinterruptbitincopyofISR.*ŠMOVE.LD1,SAV_ISR(A5)…SaveitintheCCB.<ŠMOVE.LA0,SAV_SPR(A5)…Saveaddressofthesupervisor'sCCB. ŠMOVE.LADRSIDEA(A5),A0>ŠMOVE.BIPCR(A0),D0ˆD0<--currentinputportchangeregister.**£(readingthisregisterclearsinterrupt) 9ŠBTSTƒ#STAIP2,D0‰TestIP2toindicateactiveorinactive.)ŠBNE.S‚IPC20ŽIP2islow,deviceisready.8ŠBKGRNDBREAKŽHandledevicereadywithbackgroundBREAK.ŠBRA.S‚INT_EXIT 9IPC20…BKGRNDIPCHandledeviceunreadyinbackgroundIPC.8*‰BRA.L‚INT_EXIT‹Fallthroughtointerruptexitroutine.ŠPAGEO*********************************************************************************‰INTERRUPTEXITROUTINE*;*‰Allinterruptsreturntothesupervisorviathisroutine.6*‰HerewelookatourflagSAV_ISRintheCCB.‚SAV_ISR7*‰startedoutlookingexactlyliketheInterruptStatus;*‰Registerfromthe2681.‚N AsweclearedinterruptbitsfromA*‰thevarioussourcesofinterrupts,weclearedbitsinourflag.A*‰Thefunctionofthisroutineistoletussetupforourreturn*‰tothesupervisor.*O******************************************************************************* INT_EXIT:;‰MOVE.LSAV_SPR(A5),A0‰Restoreaddressofsupervisor'sCCB.0‰MOVE.LSAV_ISR(A5),D1‰RestoreourflagintoD1.+‰RTS›Andwemustgobacktothesupervisor.  SPC 15O********************************************************************************"*ˆENDOFINTERRUPTSERVICEROUTINE*O*******************************************************************************ŠPAGEO*********************************************************************************!*ROUTINES„CALLED„BY**–TERMLIB**O*******************************************************************************‰PAGEL******************************************************************************ˆTRANSMITTHECHARACTER*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledA*ˆatthebeginningofthedriver.‚ThefunctionofthisroutineisC*ˆwritethecharactercontainedinD0tothetransmitdataregister*ˆofthedevice.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*-*ˆEntry:A1=addressofoursideofthechip*A5=addressofCCB*D0.B=charactertotransmit**Interruptlevelonentryis0**ˆExit:‚RTStocaller.*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*J************************************************************************** PUT_CHAR:ŠINHIBIT>ŠMOVE.B#TXON,SAV_CREG(A5)„SaveenabletransmittercmdinCCB.2ŠMOVE.BSAV_CREG(A5),CREG(A1)Tellittothechip.+ŠMOVE.BD0,DREG(A1)‹Transmitthecharacter.6ŠSF.BƒTBE_FLAG(A5)ŠClearflagtoindicatebufferfull.'ŠUNMASK—Mustexitatinterruptlevel0.ŠRTSŠPAGEM******************************************************************************$*ˆCHECKTHEDEVICE'STRANSMITBUFFER*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoF*ˆcheckthatthetransmitbufferisemptybeforeallowinganytransmit *ˆactivity.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*-*ˆEntry:A1=addressofoursideofthechip*A5=addressofCCB**Interruptlevelonentryis0*/*ˆExit:‚RTStocallerwithConditioncodesset:"*=transmitbuffernotempty*=transmitbufferempty*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*M***************************************************************************** CK_TBE:*E*‚Testtheflagtosimulatetransmitbufferemptystatus.‚TheflagisJ*‚setwhenacharacterisoutputandclearedwhenthetranmitbufferempty*‚interruptisreceived.*ŠTST.B‚TBE_FLAG(A5)ŠRTSŠPAGEH************************************************************************* *ˆDEVICEDEPENDENTRESETROUTINE*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoC*ˆperformaminimumresetofthedevice.FortheSCN2681thismeans6*ˆclearinganyerrorstatusandenablingthereceiver.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.**ˆEntry:A5=addressofCCB**Interruptlevelonentryis0**ˆExit:‚RTStocaller*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*E********************************************************************* DDP_RESET:6ŠMOVEM.LD0/A1,-(A7)‹Saveusedregistersonthestack.1ŠMOVE.LCCBCHB(A5),A1ŠA1<--addressofourport..ŠPUT_BYTERXON,D0ŽBesureweturnreceiveron.5ŠMOVE.BD0,SAV_CREG(A5)ˆSaveaO scurrentvalueinCCB.4ŠOR.Bƒ#RSTEST,D0Setreseterrorstatuscommandbit.(ŠMOVE.BD0,CREG(A1)ŒTellittothechip./ŠMOVEM.L(A7)+,D0/A1‹Restoreworkingregisters.ŠRTSŠPAGEJ***************************************************************************@*ˆSUBROUTINETOSETUPTHEDEVICEACCORDINGTOTHECONFIGURATION*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoE*ˆsetupthedeviceaccordingtotheworkingconfigurationintheCCB3*ˆandsomeconfiguration-relatedfieldsintheCCB.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.**ˆEntry:A5=addressofCCB**Interruptlevelonentryis0**ˆExit:‚RTStocaller*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*J************************************************************************** SETUP:2ŠMOVEM.LD0-D2/A0-A2,-(A7)„Saveworkingregisters.ŠPUSHƒSR **‚Firstsetupaddresses.*4ŠLEA„CONFIG(A5),A0†A0<--addrofCCBconfiguration..ŠMOVE.LCCBCHB(A5),A1†A1<--addrofourport..ŠMOVE.LADRSIDEA(A5),A2„A2<--addrofportA. */*‚InsurethatRTSifoff(unready)forourport*3‹BTST.B#0,CCBTYPE(A5)‡Ifwe'rehandlingtheAport ‹IF…THENŒ(we'retheA-side)7ŒMOVE.B#RTSAOFF,OPRR(A2)ƒsettheRTSlineHIGHviaOP0‹ELSE˜(we'retheB-side)7ŒMOVE.B#RTSBOFF,OPRR(A2)ƒsettheRTSlineHIGHviaOP1‹ENDI˜* **‚Performsomeresets.*3ŠMOVE.BSAV_CREG(A5),D0‡GetcurrentvaluefromCCB.,ŠOR.Bƒ#RSTEST,D0ŒSetreseterrorstatusbit.(ŠMOVE.BD0,CREG(A1)‹Tellittothechip. PAGE**‚ProgramModeRegister1"*ˆstartwith:flowcontrolenabled*”interruptuponFIFOfull*”charactererrormode3*ˆdetermineotherfieldsfromcurrentconfiguration*ˆworkingregisterisD0 !‰PUT_BYTE‚RXIRDY+CRXRTS+EMCHAR,D0 * Parity Mode [4:3]>ŠBTSTW‚#IOAUSEP,IOSATW(A0)ƒIfwe'reusingparity,enableit... ŠIF…THEN)ŠOR.Bƒ#PAROFF,D0ŒMustsetnoparitybits.ŠELSE+ŠOR.Bƒ#PARENB,D0ŒOrsetenableparitybits.ŠENDI* Parity Type [2]:ŠBTSTW‚#IOAPRTY,IOSATW(A0)ƒAndifwe'reusingevenparity,ŠIF…THENsetitup.ŠOR.Bƒ#PAREVN,D0ŠENDI * Character Length [1:0]1ŠBTSTW‚#IOABITS,IOSATW(A0)ƒAddinbits/charinfo. ŠIF…THENŠOR.Bƒ#DTBPC7,D0Œ(7bits/char)ŠELSEŠOR.Bƒ#DTBPC8,D0Œ(8bits/char)ŠENDI *!*‚ProgramModeRegister2(MREG2)*ˆstartwith:‚normalmode*•NoTxRTScontrol*•NoTxCTScontrol(*ˆdeterminestopbitsfromconfiguration*ˆworkingregisterisD1 ‰PUT_BYTECMNORM,D1 * Stop Bit Length [3:0]:ŠBTSTW‚#IOASTPB,IOSATW(A0)ƒAddinthenumberofstopbits. ŠIF…THENŠOR.Bƒ#SB1,D1(1stopbit)ŠELSEŠOR.Bƒ#SB2,D1(2stopbits)ŠENDI PAGE$‰INHIBIT—Inhibitinterruptswhile...3‰MOVE.BSAV_CREG(A5),D2ˆGetcurrentvaluefromCCB.1‰OR.Bƒ#RSTMRP,D2Setresetmoderegisterpointer.(‰MOVE.BD2,CREG(A1)ŒTellittothechip./‰MOVE.B„D0,MREG1(A1)ˆProgrammoderegister1...)‰MOVE.B„D1,MREG2(A1)ˆandmoderegister2.‰ENABLE *C*‚ClockSelectRegister(CSEL)andAuxiliaryControlRegister(ACR)6*‡setsthebaudrateforthereceiverandtransmitter.*‡workingregisterD0andD1 *‰MOVEQ.L#0,D0‘Cleartheworkingregister.6‰MOVE.B‚IOSBRT(A0),D0‰GettheVERSAdosbaudrateCODE.,‰LSL.Lƒ#1,D0‘DoubleittouseinBAUD_TABLE.<‰MOVE.W‚BAUD_TABLE(PC,D0.W),D1GettheRx/Txbaudratecodes%*§andbaudratesetbitfromtheBaud(*§RateConversionTableforthisdevice. *3*‚NowwritetotheAuxiliaryControlRegister(ACR)(*‚(AccessedfromchannelAaddressonly)*?‰BTSTW‚#IOAMODM,IOSATW(A0)‚Ifthisisamodemwe'retalkingto,‰IF…THEN*7ŠOR.B„#INTIP2,D1‰AllowinterruptsthroughInputPort2.‰ENDI<‰MOVE.B‚D1,ACR(A2)ŠTellthechipwhichbaudratesettouse. <*‚NowwritetotheClockSelectRegisterforthebaudrates. .‰ROR.Wƒ#8,D1‘PutthebaudraO tecodesinto‚LSB.9‰MOVE.B‚D1,CSEL(A1)‹MoveLSB(baudratecodes)intoCSEL. *+*‚ProgramtheInterruptMaskRegister(IMR)=*ˆThedriverselectedwhichISRbitswillcauseaninterrupt.-*ˆTheseare:changeinbreak,channelAandB*“RxRDY,channelAandB*“TxRDY,channelAandB*“InputPortChangeonIP21*ˆThecounter/timerinterruptbitisturned'off' 3ŠBTST.B#0,CCBTYPE(A5)ˆIfwe'rehandlingtheAport ŠIF…THEN(we'retheA-side)0‹MOVE.B#$07,D0ŽallowinterruptsonA-sideonly.ŠELSE™(we'retheB-side)2‹MOVE.B#$F7,D0ŽallowinterruptsonAandBsides.ŠENDI™*'ŠMOVE.BD0,IMR(A2)ŒTellittothechip. ŠBRA.S‚SET10 PAGEO********************************************************************************"*‰TABLEFORTRANSLATINGBAUDRATES*O******************************************************************************* **-----------------DefinesSet1orSet2*|&*|---------------Baudratesetcode*||*VV BAUD_TABLEŠDC.Bƒ$00,0‡50ŠDC.Bƒ$00,1‡75ŠDC.Bƒ$11,0†110ŠDC.Bƒ$22,0†134.5ŠDC.Bƒ$33,1†150ŠDC.Bƒ$44,0†300ŠDC.Bƒ$55,0†600ŠDC.Bƒ$66,0…1200ŠDC.Bƒ$AA,1…1800ŠDC.Bƒ$77,1…2000ŠDC.Bƒ$88,0…24000ŠDC.Bƒ$88,0…3600…Wedon'thaveitsoweuse2400ŠDC.Bƒ$99,0…4800ŠDC.Bƒ$AA,0…7200ŠDC.Bƒ$BB,0…9600ŠDC.Bƒ$CC,1„19200 SET10…DS.Wƒ0 PAGE*!*‚ProgramCommandRegister(CREG)+*ˆcurrentstateis:RTSlinehigh(unready)#*šreceiverandtransmitterdisabled5*ˆWemustmakeusreadyandenabletheReceiveronly.  "* Make us ready by setting RTS low 3ŠBTST.B#0,CCBTYPE(A5)‡Ifwe'rehandlingtheAport ŠIFTHEN(we'retheA-side)5‹MOVE.B#RTSAON,OPSR(A2)„settheRTSlineLOWviaOP0ŠELSE˜(we'retheB-side)5‹MOVE.B#RTSBON,OPSR(A2)„settheRTSlineLOWviaOP1ŠENDI˜* %* See if the user wants us offhook...7‰BTSTW‚#IOAOFFH,IOSATW(A0)ƒIftheguywantsitoffhook,&‰IF…THENMakeourport'unready'.3‰BTST.B#0,CCBTYPE(A5)ˆIfwe'rehandlingtheAport ‰IF…THEN(we'retheA-side)7ŠMOVE.B#RTSAOFF,OPRR(A2)„settheRTSlineHIGHviaOP0‰ELSE™(we'retheB-side)7ŠMOVE.B#RTSBOFF,OPRR(A2)„settheRTSlineHIGHviaOP1‰ENDI™*‰ENDI )* Now enable the receiver and we're done..ŠPUT_BYTERXON,D0ŠSetenablereceivercommand.5ŠMOVE.BD0,SAV_CREG(A5)„ReplacecurrentvalueinCCB.(ŠMOVE.BD0,CREG(A1)ˆTellittothechip. **‚Restoreregistersandreturn.*ŠPOP…SR8ŠMOVEM.L(A7)+,D0-D2/A0-A2Restoreregistersfromstack.ŠRTSŠPAGEO*********************************************************************************ˆRESETTHECLOCK*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto3*ˆchangetheclockspeedbacktoitsdefaultvalue.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*.*ˆEntry:A1=addressofoursideofthechip.*A5=addressofourCCB.**Interruptlevelonentryis0**ˆExit:‚RTStocaller*éééé