IMD 1.17: 11/11/2014 15:15:50 82VKXBVERDOS C* VERSADOS/RMS68K OBJECT 4.4 SN=48634 21 OF 22  BT21\82VKXBVERDOS 0420¼=-AND.L#1<MOVE.LQTAIL(A5),A0„getcurrentqueuepointer(evenifempty)(CMPA.LQHEAD(A5),A0„isthequeueempty?BNE.S‚INTROK3‰br=no.LEA.L‚CONFINFO(A5),A4ƒyes,thequeueisempty,MOVE.LDVDCBPTR(A4),A4ƒsosetA4<=BUSDCB'SUB.L‚A3,A3setupdummyIOSPBaddress BRA.S INTROK4*4INTROK3MOVE.LDCBQOFST(A0),A4ƒA4<==addressofDCB7MOVE.LIPBQOFST(A0),A3ƒA3<==addressofcurrentIOSPB*.*ˆGiveDMAcompleteinterrupthighestpriority*DINTROK4BTST.L#IOCINT,D0‚didanI/Ocomplete(DMA)interruptoccur?BEQ.SINTR100‚yes*, BTST #TMSINT,D0 was it a TMS9914 interrupt? BEQ INTR500 br = yes*'*ˆElseitmustbeaBUSERRORinterrupt*E********************************************************************** *ƒBUSERROR*:*ˆTheBuserrorinterruptisgeneratedbytheMVME300cardB*ˆwheneveraDMAbuserrorconditionoccursduringatransmission.8*ˆIftherewasnoI/Oinprogress,theinterruptwillbe>*ˆconsideredspuriousandwillgenerateanunsolicitedchannel?*ˆinterrupttoIOS.‚IfI/Owasinprogress,thecurrentcommand=*ˆwillbeabortedandahardwaremalfunctionerroreventsent *ˆtoIOS.*6BSET.B#VBIMENAB,CONTREG2(A1)‚enableBuserrorvector(MOVE.LQTAIL(A5),A0‚isI/Oinprogress? CMPA.L QHEAD(A5),A0BEQINTREXIT‰branchifno*@*ƒIfanSRQwasinprogress,abortallSRQprocessingandsenda$*ƒHardwareMalfunctionerrortoIOS.*B*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<* *ˆ4/24/84ƒbwn*9*ˆMustinhibitTMS9914A‚interrupts‚duringDMAoperations.*ˆMustre-enablehere.*4BSET.B#VBIMENAB,CONTREG0(A1)‚re-enable9914intrps*?*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>. MOVEQ #ISTABUS,D1 indicate hardware bus errorBSRPROCMERR‚processerrorBRAINTREXIT‚normalexit6 TTL GPIB DRIVER - INTERRUPT PROCESSING (DMA COMPLETE) PAGEG*************************************************************************ƒI/OCOMPLETE*:*ˆThisinterruptisgeneratedbytheMVME300cardwhenever>*ˆaDMAWRITEorDMAREADhascompleted.Threemajorfunctions<*ˆareaccomplishedinthissectionandtheyare:(1)I/Opost6*ˆformatting(ifspecified)afteraDMAWRITE/READhas;*ˆcompleted,(2)menuprocessingandinitiationand(3)SRQ *ˆprocessing.*8*ˆForpostI/Oformatting,theusermayspecifyaformatD*ˆroutinestobeexecuteduponcompletingthedesiredDMAoperation.<*ˆTheseroutinesmustbespecifiedatsysgentimeandshould*ˆreporterrors.*<*ˆThemenuprocessingsectionisdesignedtoeitherinitiate;*ˆthenextmenuitemor,ifatendofmenu,toqueueanI/O:*ˆcompletioneventbacktoIOSandinitiateannewmenuif7*ˆthereareotheroperationswaitingontheGPIBqueue.*;*ˆThelastmajorsectionoftheI/Ocompleteportionofthe8*ˆinterrupthandleristohandleprogramflowofservice;*ˆrequestfunctions(SRQ)whenreceivedincontrollermode.?*ˆTheprocessorwillrunstatusmenuestoeachdeviceconnected;*ˆtotheGPIBuntilthedevicerequestingserviceisfound.;*ˆOncefound,anSRQASQeventwillbesentbacktoIOSfor*ˆexamination.*INTR100:5 MOVE.B #1<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>/MOVE.LQTAIL(A5),A0‚currentmenuqueuepointer)CMPA.LQHEAD(A5),A0‚isI/Oinprogress?BEQINTREXIT‰br=no*5BTSTW#CAC_S,BUSACTIV(A5)ƒareweincontrollermode?BEQ.SINTR115br=no*4BTST#LADS_B,ADDRSTAT(A1)ƒis9914inlistenermode?BEQ.SINTR110br=no7MOVE.B#TCS,AUXCMD(A1)†sotakecontrol(synchronously)2MOVE.BDATAIO(A1),D0ˆreadregtogetthingsgoing BRA.S INTR115**ƒAlldataDMAsequencesrequirethelengthofthetransfertoD*ƒbereportedbackintheIOSparameterblockoriginatingthiscall.**>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>**<*‚ChecktoseeifthiswastheINorOUTprocessor.Ifitis8*‚calculatethelengthofthelasttransferbasedonthe=*‚contentsoftheGPIBCmemoryaddressregister(MAR)andtheC*‚typeofI/Ooperationperformed,elsenolengthcalcs.arereq'd.*?MOVE.LMENUCPOS(A5),A0‚getaddressofmenuitemjustcompleted1CMPI.B#OUT,(A0)„wastheOUTprocessorexecuted?BEQ.SINTR150…br=yes*/CMPI.B#IN,(A0)„wastheINprocessorexecuted?1BNE.SINTR200„br=TERMorSEOIprocessfinished*I* Check for the one command that uses the secondary buffer instead of the* primary buffer for data xfer.*GINTR130CMPI.W#IOOWIN,IOSFCT(A3)ƒisthisanoutoutwithinputcommand?BNE.SINTR150ƒbr=noGSUB.LD6,D0‚D0=currentM.A.R.minus(secondary)bufferstartaddress BRA.S INTR160*LINTR150 SUB.L D7,D0 D0 = current M.A.R. minus (primary) buffer start address*;INTR160 MOVE.L D0,IOSLEN(A3) store I/O xfer length in IOSPB*C*ƒChecktoseeifthereisaspecialpostformatterstobeexecuted*CMOVE.LIOSFMTA+DCBDEV(A4),D1‚getpointertouserdefinedformatter1 BEQ.S INTR200 br = no user defined I/O formatter*B*‚ChecktoseewhetherinputoroutputmenuprocessorwasexecutedA*‚andthenseeifthereisauserdefinedpostprocessorforthis *‚device.*@MOVE.W#PST_OFMT,D0ƒD0<==preloadpostoutputformatteroffset5CMPI.B#OUT,(A0)…arewedoing"OUT"menuprocessing?BEQ.SINTR180„branchifyes7MOVE.W#PST_IFMT,D0ƒD0<==postinputformatteroffset*:INTR180MOVE.LD1,A0†A0<==baseaddressofallformatters8TST.L0(A0,D0.W)ƒdiduserdefineapostdataformatter?BEQ.SINTR200ƒbranch=no*+MOVEM.LD1-D7/A0-A6,-(A7)‚saveenvironment.JSR0(A0,D0.W)‚executeuserdefinedformatter MOVEM.L (A7)+,D1-D7/A0-A6,TST.BD0ƒcheckerrorcodefromuserroutine!BEQ.SINTR200‚branchifnoerror*B*‚Anerrorhasbeendetectedintheuser'sinputformatterroutine*-MOVEQ‚#ISTAINFE,D1‚setinputformattererrorBSRPROCMERR‚processerror+ BRA.S INTR250 exit DMA interrupt processor*INTR200:'BSRPROCMENU„processnextmenuitem(s)*INTR250:6 MOVE.W (A7)+,D5 retrieve previous TMS9914 status regs (TST.WD5ˆwasthereapendinginterrupt? BEQ INTREXIT br = no BRA.SINTR510‚elsegohandleit  ; TTL GPIB DRIVER - INTERRUPT PROCESSING (TMS9914 INTERRUPT) PAGEE***********************************************************************ƒTMS9914AINTERRUPTSECTION*<*„Enteringthissectionoftheinterruptprocessorindicates8*„thatoneormoreinterruptconditionsenabledhasbeen;*„received.Readingtheinterruptmaskregsiters(INTR0and9*„INTR1)oftheTMS9914Awillindicatewhichcondition(s) *„occurred.*;*„TheGPIBcanbeinoneandonlyoneofthefourfollowing<*„states:(1)controllermode,(2)talkermode,(3)listener%*„mode,or(4)idlemode.‚Thesemodes@*„arestoredin'BUSACTIV'andmaychangedependingonwhattype=*„ofinterruptoccurred.‚Also,differentactionsmaybetaken?*„dependingonthecurrentstateoftheBUS.‚Allinterruptbits8*„willbecheckedeachtimeaTMS9914Ainterruptoccurs.* INTR500:5MOVEP.WINTR0(A1),D5ƒreadinterruptstatusregisters6AND.W‚TMSMASK(A5),D5ƒD5=validinterruptstatusbitsINTR510:B BSET.B #VBIMENAB,CONTREG0(A1) reset interrupt enable for TMS9914A***0***†MyAddressChange(MAC)checkandprocessing***$BTST#MACBIT,D5†istheMACbitset?BEQ.SINTR600ƒbr=no*I AND.W #$FFFF-(1< BTSTW #SRQPROG,BUSACTIV(A5) USER I/O or SRQ polling sequence?(BNE.SINTR605br=SRQpollingsequenceJ MOVE.B SRQBYTE(A5),IOSSAD-1(A3) else move serial poll byte to user's IOPB-INTR605BSRPROCMENU‰continueprocessingmenu BRA INTR700*+*ˆCheckifwehaveanyTaskI/Oreadytogo*8INTR610MOVE.L#READPEND,D3‚setupforI/Opendingcheck0BSRCHECKIOPgolookfortasklevelI/Opending***0***„ByteOut(BO)interruptcheckandprocessing***)INTR700BTST#BOBIT,D5„istheBObitset? BEQ.S INTR800*9BTSTW#CAC_S,BUSACTIV(A5)ƒistheBUSincontrollermode?BEQ.SINTR750br=no*5*‚Acommandstringmightbeinprogress.‚Sendoutthe"*‚nextcommandbytewithATNtrue.*/TST.LCMDCOUNT(A5)‰falseorlastBOinterrupt?(BEQ.SINTR800Žbranchifyes(ignoreit)*5SUB.L#1,CMDCOUNT(A5)†decrementcommandstringcount5BEQ.SINTR730Žbranchiffinishedwithcommandstring4MOVE.LCMDBFPTR(A5),A0…getptrtonextcommandbyte&MOVE.B(A0)+,D1Œgetnextcommandbyte5MOVE.LA0,CMDBFPTR(A5)…updatecommandbufferpointer%BSRCOMCMD‘outputcommandontheBUSBRA.SINTR800Žcontinue*@*ƒCommandprocessingiscompletefornow.Continuewiththenext=*ƒmenuitemafterthecommandoutmenuitemprocessorforthe*ƒcurrentcommand.*1INTR730BSRPROCMENUˆcontinuewithnextmenuitemBRA.SINTR800Žcontinue*!* We are not the active cntroller*8INTR750MOVE.L#WRITPEND,D3‚setupforpendingI/Ocheck.BSRCHECKIOPcheckforpendingtasklevelI/O*** 8***†ServiceRequest(SRQ)interruptcheckandprocessing***BINTR800BTST#SRQBIT,D5ƒisadeviceonourBUSrequestingservice?BEQ.SINTR900„br=no*: BSETW #SRQWAIT,BUSACTIV(A5) indicate SRQ intrp processing3MOVE.LQHEAD(A5),D1‡yes,getcurrentqueuepointer'CMP.LQTAIL(A5),D1ˆisthequeueempty?(BNE.SINTR900Žbranchifno,busisbusy*A*‚SincetheGPIBisidle,initiatetheservicerequestprocessing2*‚todeterminewhichdeviceisrequestingservice.*9*ˆFirstbuildadummyqueueentryforstandardprocessing** MOVEM.L A3-A4/D4-D7,-(A7) save intrp regs SUB.L A3,A3 dummy IOSPB address LEA.L CONFINFO(A5),A4L MOVE.L DVDCBPTR(A4),A4 A4 <= to BUS DCB (serial polling is a BUS operation)* LEA.L SRQBYTE(A5),A0 input buffer pointer,MOVEQ#1,D4‚Statusbyteresponselength=1/ MOVE.L A3,D5 dummy length for secondary buffer2 MOVE.L A0,D6 dummy primary buffer address pointer4 MOVE.L A3,D7 dummy secondary buffer address pointer' BSR PSHGPIBQ go put entry on the queue- MOVEM.L (A7)+,A3-A4/D4-D7 restore intrp regs1 BEQ.S INTR900 br = queue full, process SRQ later&BSRPROCMSRQ‚startuptheSRQprocess***<***ƒRemote/LocalChange(RLC)interruptcheckandprocessing***6INTR900BTST#RLCBIT,D5ƒremote/localchangeinterrupt?BEQ.SINTR1000ƒbranchifno*@MOVE.BADDRSTAT(A1),D1‡D1<==‚currentaddressstateofTMS9914A6AND.W#1<*‚bitmaskandchecktoseeifweevenneedtorespondtothis*‚secondaryaddress.*8LEA.LCONFINFO(A5),A0„A0<==ptrtoconfigurationareas?MOVE.LCNFIGPTR(A0),A0ƒA0<==ptrtoconfigurationareaofBUS*=*‚Readthecommandpassthruregistertoobtainthesecondary*‚addressthatisrequired.*DMOVE.BCMDPTHRU(A1),D2†D2=secondaryaddrcontrollerisrequesting$AND.L#SECMASK,D2‹maskaddressbitsAMOVE.LIOSSAMW(A0),D1‡D1<==maskofvalidsecondarywriteaddrsDBTST#TADS_B,ADDRSTAT(A1)ƒAreweinprimarytalkeraddressedstate?BEQ.SINTR1140ŽBranchifno*@MOVE.LIOSSAMR(A0),D1‡D1<==maskofvalidsecondaryreadaddrs*.INTR1140BTST.LD2,D1ˆvalidsecondaryaddress?BNE.SINTR1150branchifyes*(*‚Thisisnotavalidsecondaryaddress.*?MOVE.B#DACR0,AUXCMD(A1)‚releasehdshk&don'tenterLADS/TADSBRA.SINTR1200ƒcontinue*AINTR1150 MOVE.B #DACR1,AUXCMD(A1) release hdshk & enter TADS/LADS4OR.B#1<BRA.SCKIO040gosendeventtouserabouttypeofpendingI/O*&*ˆTaskI/Oispending,checkformatch.*’onoperationtype&secondaryaddr.ifreq'd*8CKIO010 BTST.B D3,IOPEND(A5) Is it a a matching request?.BEQ.SCKIO030Br=no,abortTaskI/Orequest*C BTST.B #SECONDAR,IOPEND(A5) Is there a secondary address involved?)BEQ.SCKIO050Br=no,gostartthemenu5MOVE.LQTAIL(A5),A0‰getpointertocurrentoperation2MOVE.LIPBQOFST(A0),A0†AO<==I/Oparameterblock9CMP.W#IORSEC,IOSFCT(A0)„Isitasecondaryreadcommand?BEQ.SCKIO015br=yes:CMP.W#IOWSEC,IOSFCT(A0)„Isitssecondarywritecommand?.BNE.SCKIO030br=no,abortpendingtaskI/O*CKIO015 MOVEQ #SECMASK,D1@AND.BIOPEND(A5),D1‰D1=activecontrollerrequestedsec.addr.HCMP.BIOSSAD-1(A0),D1‡isitthesameasrheTask'srequestedsecaddr.?'BEQ.SCKIO050br=yes,startthemenu*.CKIO030BSRHLTCMD‹killthetaskrequestedI/O CKIO050BSETW#BUSIOP,BUSACTIV(A5)ƒsetINTRPlevelI/Opending&BSRPROCMENU‘InitiateI/Oonthemenu* CKIO060 RTS PAGEH**************************************************************************—CANCELPENDINGI/O*;*ˆAneventhasoccurredontheBUSthatforcesustocancel9*ˆanypendingI/Oregardlessofsource.‚Thecauseofthis&*ˆeventwillalsobesenttotheuser.**/*ˆENTER:„A1<==‚baseaddressofGPIBCregisters*’A3<==‚addressofIOSPB*’A4<==‚addressofDCB*’A5<==‚addressofCCB*.*’D5.W<==current9914intrpreg(INTRLEVEL)**’D3.B<==I/Ooperationtype(READ/WRITE)* CANCLIOP:#BSRHLTALL’HaltallI/OontheBUS, MOVE.B #0,IOPEND(A5) cancel any pending I/OHAND.W‚#$FFFF-(1<PROCMENAMOVE.LQTAIL(A5),A6‰A6<==ptrtocurrentqueueentry1BTSTW#HALTED,CSTQOFST(A6)‚wasthismenuHalted?BNEPROCM020br=yesK MOVE.L MENUNPOS(A5),MENUCPOS(A5) update: next item is now the current item6MOVE.LMENUNPOS(A5),A0ƒgetnextmenupositionpointer#MOVE.B(A0)+,D0ƒgetnextmenuitem5MOVE.LA0,MENUNPOS(A5)ƒupdatenextmenuitempointer* *ƒchecktoseeifatendofmenu*CMP.B#END,D0Œendofmenu?BEQ.SPROCM020‹yes* * Initiate I/O on next menu item*;LEA.LMENUCTBL(PC),A0ƒA0<--menufunctioncodejumptable(CMP.B#MENUCLEN,D0‚validfunctioncode?BGTPROCMERB‚branchifno*/AND.W#$FF,D0ƒmasktheoffsetofroutineindex"ASL.W#1,D0…maketablecompatibleAMOVE.W0(A0,D0.W),D0‚relativedistancebetweentableandroutineAMOVEM.LD0/D2-D7/A0-A6,-(A7)‚saveeverythingexceptD1forerror,MOVE.LCCBCHB(A5),A1‚getbaseaddrofGPIBC)JSR0(A0,D0.W)‚initiateI/Oonmenuitem3MOVEM.L(A7)+,D0/D2-D7/A0-A6‚restoreallregisters TST.BD1‚setconditionalreturn2BNE‚PROCMERA‚gotoprocessormenuerrorprocessor*C*…Thesepreviousmenuitemwassuccessfullyinitiated/completed.If;*…themenuitemwasaClassIIorClassIIItype(auxiliary5*…commandorspecialfunctiontype)nointerruptwill9*…begeneratedsocheckthatheretokeepthingsrolling.*5MOVE.LMENUCPOS(A5),A0ƒgetcurrentmenuitempointer/CMPI.B#AUXTYPE,(A0)‚wasitanauxiliarytype?,BGE.SPROCMENA‚yes,continuewithnextitem*:*‚Thefollowingisaspecialcasecheckforthemenuitems9*„DATAXFRTERM/SEOI.Ifeitherprocessorwasperformedin7*„theimagemodeorperformedinformattedmodewithno>*„EORcharactersenabled,thennointerruptwillbegenerated.*;BCLRW#TERMINT,CSTQOFST(A6)ˆareweexpectinganinterrupt?-BNE.SPROCMENA•br=no,gotonextmenuitem*6PROCMRTNMOVEM.L(A7)+,D2-D7/A1-A6‚restoreenvironment RTS  PAGE*>*‚IthasbeendeterminedthatweareattheendofthecurrentB*‚operationmenuitemtableorthisI/OoperationhasbeenHALTED.*8PROCM020BTSTW#SRQPROG,BUSACTIV(A5)‚isSRQinprogress?BNEPROCM200•yes7MOVEQ‚#ISTAOK,D1setoperationcompletionstatustook PROCM050 MOVEQ #0,D0+MOVE.BDCBCDV(A4),D0‚getthedevicenumber1MOVE.WD1,-(A7)ˆsaveoperationcompletionstatus9MOVE.WDEVQBSY(A5),D1‚D1<==currentdevicebusybitmap(BCLRD0,D1clearthatdevice'sbusybit%MOVE.WD1,DEVQBSY(A5)‚updatebitmapMOVE.W(A7)+,D1ˆrestorestatus: BTSTW #HALTED,CSTQOFST(A6) was this operation terminated?BNE.SPROCM055Žbr=yesH BTSTW #SRQFAIL,CSTQOFST(A6) if an SRQ poll, did the device not respond?BEQ.SPROCM060‰br=O.K.*5PROCM055MOVEQ#ISTATO,D1„elsesettimeouterrorcode*2PROCM060 MOVE.B D1,IOSSTA(A3) save status in IOSPB2MOVE.B#XPSNRM,D4ƒD4<==seteventtypetonormalBSRQEVENT‚sendeventtoIOS/BTSTW#SRQWAIT,BUSACTIV(A5)†isanSRQwaiting?BEQ.SPROCM100”no*7*‚Overlaythecurrentcompletedqueueentry(operation)1*‚withdummySRQprocessinginformationpointers.* LEA.L CONFINFO(A5),A1J MOVE.L DVDCBPTR(A1),DCBQOFST(A6) set to DCB of the BUS for SRQ processing'CLR.WCSTQOFST(A6)ŠInitcommandstatus-CLR.LIPBQOFST(A6)ŠcleardummyIOSPBpointer LEA.L SRQBYTE(A5),A16MOVE.LA1,PBPAOFST(A6)†setdummyinputbufferaddress5MOVE.B#1,PBLNOFST(A6)†setdummyinputbufferlength(CLR.LSBPAOFST(A6)Šnosecondarybuffer!'CLR.WSBLNOFST(A6)Šanditslengthis0 BRA.S PROCSRQA  PAGE*3*ˆENTRYPOINTFORSRQPROCESSINGATINTERRUPTLEVEL*?*‚ThereisanSRQrequestwaitingtobehandledsoinitiatethe@*‚statusmenuforthefirstdevicenumberconnectedtothisCCB.=*‚Also,sendanI/Ocompleteeventbackforpreviousfunction%*‚sincewegototherthingstodonow* PROCMSRQ: +MOVEM.LD2-D7/A1-A6,-(A7)…saveenvironment*>PROCSRQAMOVE.LQTAIL(A5),A6ŠA6<==ptrtocurrentqueueentry2BCLRW#SRQWAIT,BUSACTIV(A5)„takeoutofwaitmode8BSETW#SRQPROG,BUSACTIV(A5)„putinSRQinprogressmode3LEA.LCOND_SP(PC),A0‹A0<==serialpollmenutable+MOVE.LA0,MENU(A5)settopofmenupointer=MOVE.BCSPDEVNM(A5),D0‰getdevicenumberoflastserialpoll>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>(BRA.SPROCM227‘initiateI/OonSRQmenu* PAGE$PROCM100BSRPOPGPIBQƒpopGPIBqueue;BEQPROCMRTN‚branchifqueueisempty(nothingelsetodo)*:*‚Setupthenecessarypointersfromthequeueinformation-*‚andthenbuildthemenuforthenewcommand**MOVE.LQTAIL(A5),A6‚getnewqueuepointer3*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *ˆ4/24/84ƒbwn#*ˆSetupregistersbeforebranching?MOVE.LIPBQOFST(A6),A3‚A3<==addressofIOSPBfornewcommand=MOVE.LDCBQOFST(A6),A4‚A4<==addressofDCBfornewcommand*6*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>EBTSTW#HALTED,CSTQOFST(A6)‚wasthiscommandentrypreviouslyhalted?BNEPROCM020ƒbranchifyes2*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *ˆ4/24/84ƒbwn**ƒThesemovesdoneabovenow.*?*MOVE.LIPBQOFST(A6),A3‚A3<==addressofIOSPBfornewcommand=*MOVE.LDCBQOFST(A6),A4‚A4<==addressofDCBfornewcommand*8*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*(BSRGETCMDP…getpointertonextcommand+BNEPROCM020„BR=invalidcommand,discard4BSRVALOPER…validateoperationalmodeandabilities)BNEPROCM020„Error,invalidcmd,discard(BSRBUILDMEN„buildmenufornewcommandBNEPROCM020„Branchiferror&BRAPROCMENA„initiateI/Oonnewmenu**‚SRQProcessingandDetection*7PROCM200 BTSTW #HALTED,CSTQOFST(A6) SRQ polling halted?&BNE.SPROCM300„br=yes,termpolling+MOVE.BSRQBYTE(A5),D1ƒreadthestatusbyte*.BTST#6,D1ƒisthisdevicerequestingservice? BNE.S PROCM400 branch if yes*A*‚Getnextindexdevicenumberofthenextdevicetoserialpoll.?*‚Thetechniqueusedallowswraparoundsothatnodeviceonthe:*‚BUSwillhaveagreaterpriorityofbeingserialpolled.*1PROCM220MOVE.BCSPDEVNM(A5),D0‚getcurrentindex2ADD.B#1,D0ƒbumpbyonetogetnextdevicenumber+CMPI.B#MAXDEVNM+1,D0ƒendofdevicechain?BNE.SPROCM225‚notyet MOVEQ#1,D0‚resettodevice#1*I*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<* *‡10/9/84…SJF*A*‡Wewillinsertcodeinheretoimplementtheconceptoflooping?*‡twicethroughalldevicesonabustolocatethesourceofan=*‡SRQ.‚ThiswasnecessaryduetodevicespulsingtheSRQline1*‡andthenmissingtrueSRQ'sfromotherdevices.*J*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>EPROCM225MOVE.B‚FSPDEVNM(A5),D2…D2<--device#westartedSRQ'swith(AND.Bƒ#$0F,D2Maskouttheloopcounter5CMP.BƒD0,D2HavewereachedthestartingSRQdevice?BNE.SƒPROCM227ŒNotyet7BSET.B‚#7,FSPDEVNM(A5)…Setthepotemtiallapindicator.BNE.SƒPROCM300ŒBranchifwehavelappedtwice*?PROCM227MOVE.LCCBCHB(A5),A1‚A1<--baseGPIBaddressofboard.BTST.B‚#BUSSRQ,BUSSTAT(A1)ƒisSRQstilltrue?1BEQ.SƒPROCM300Žbranchifnot,exitSRQprocesses =*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<* *10/9/84…sjf*+*ˆThiscodewasreplacedbytheabovelogic*L*PROCM225CMP.BFSPDEVNM(A5),D0‚havewedoneacompleteturnaroundtheBUS?**BEQ.SPROCM300ƒyes,wemayhaveproblems*@*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *-*‚Checktoseeifthisdevicenumberisvalid**PROCM240ANDI.L#$FF,D0ƒgetridofgarbage4MOVE.BD0,CSPDEVNM(A5)ƒupdatecurrentdevicenumber /ASL.L#3,D0ƒcalcoffsetintoconfiginfotable5LEA.LCONFINFO(A5),A0ƒbaseaddrofconfiginfotable6MOVE.LDVDCBPTR(A0,D0.L),A4ƒgetpointertodeviceDCBJMOVE.LCNFIGPTR(A0,D0.L),A0ƒgetptrtocurrentdeviceconfigurationblock MOVE.L A0,D0 set cond codes:BEQ.SPROCM220ƒbranchifdevicenotpresentorconfiguredF MOVE.L A4,DCBQOFST(A6) save new DCB pointer at current queue locationCBTSTW#IOASPOC,IOSATW(A0)‚doesdevicehaveserialpollcapability?BEQ.SPROCM220ƒbranchifno*>MOVE.LMENU(A5),MENUNPOS(A5)‚resetstatusmenupointertotopBRAPROCMENAƒinitiateI/O*>PROCM300 BCLRW #SRQPROG,BUSACTIV(A5) clear SRQ in progress bit(BRAPROCM100„continuenormalprocessing*.*ƒFoundadeviceonthebusrequestingservice*5PROCM400MOVEQ‚#SRQTYPE,D0‚seteventtypetoSRQtypeBSRSENDUEVS‚sendevent>*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>* *’10/9/84„sjf*5*ˆThislogicisnowperformedaboveaftereachdevice *ˆisqueried.*-*MOVE.LCCBCHB(A5),A1‚getbaseaddrofGPIBC/*BTST.B#BUSSRQ,BUSSTAT(A1)ƒisSRQstillTRUE?7*BEQ.SPROCM300‚no,cleanupandcontinuenormaloper.*>*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *5*ˆResetthelapindicatorandthefirstdevicepolled5*ˆforthisnextSRQseries.EachtimeanSRQisfound4*ˆwemustlapatleasttwicetocatchdevicesmissed*ˆbytogglingSRQ's.*** MOVEQ #1,D0 set to first device index of configuration blocks*DPROCM520 MOVE.B D0,FSPDEVNM(A5) set start of serial poll index chainABRA.SPROCM227‚startoveragain…***10/9/84sjf‚WASPROCM240*****5*‚ProcessMenuentrypointwhenanerrorhasoccurred#*‚withthereasonfroerrorinD1.B* PROCMERR:+MOVEM.LD2-D7/A1-A6,-(A7)…saveenvironment*>PROCMERAMOVE.LQTAIL(A5),A6ƒA6<==ptrtocurrentqueueentry1 BCLRW #SRQPROG,BUSACTIV(A5) was SRQ in progress?4BEQPROCM050ƒbr=NO,terminateUSERI/Oprocessing-BRAPROCM100ƒelsepopSRQmenuandterminate*:PROCMERBMOVEQ#ISTADRVE,D1‚setdriverrun-timeerrorcode% BRA.S PROCMERA go to error processor 8 TTL GPIB DRIVER - INTERRUPT PROCESSOR (MENU PROCESSORS) PAGEE***********************************************************************’MENUITEMCOMMANDPROCESSES*>*ˆThefollowingroutinesaretheindividualmenuitemroutinesA*…thatwhencombinedmakeupamenuforeachGPIBfunction.TheseE*…menuitemsaredispatchedbythemenuprocessorateitherinterrupt;*…levelorcommandlevel.Allregistershavebeenpreserved?*…beforeenteringexceptforD0andA0whichmayalwaysbeused@*…asworkregisters.Thefollowingregisterdescriptionentryis$*…trueforallmenuitemprocessors:*-*’ENTER:‚A1=BaseAddressofGPIBCregisters%*šA3=AddressofIOSParameterBlock,*šA4=AddressofDeviceControlBlock(DCB)-*šA5=AddressofChannelControlBlock(CCB)1*šA6=AddressofUser'sTaskControlBlock(TCB)* *’EXIT:ƒIfD1=0…THENƒNoerrors*œELSED1=errorcode9*Note:TheINITIOprocessorhassavedallregistersupon)*”entrysoallregistersarefreetouse.*G*********************************************************************** ! TTL CLASS I MENU ITEM PROCESSORS PAGEF************************************************************************ˆCLASSIMENUITEMPROCESSORS*1*’Thisclassofmenuitemsinitiatevarioustypes>*ˆofI/OinbothDMAandnon-DMAmodes.AllclassImenuitems-*ˆwillgenerateaninterruptafterexecution.*F********************************************************************** **ˆPROCESSOR:WriteData*:*ˆPURPOSE:TosetupthewriterequestaccordingtotheIOS0*‘options,setuptheDMAregisters,andthento*‘initiatetheI/O.* WRITDATA: 9 MOVEQ #1<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>& MOVE.B D2,UNICMD(A1) initiate the I/O*3WRITD025MOVEQ‚#ISTAOK,D1setreturnstatustoO.K.*WRITDRTNRTS…exitwritedata*<*ˆSpecialprocessingforDMAtransferofonly1byte(either&*ˆdataorterminationchar.sequence).*HWRITD030 BSETW #TERMINT,CSTQOFST(A6) let PROCMENU know no intrp expected‰BRA.SWRITD025Žtakegoodexit**‚WriteFormattedMode;*ˆSinceDMAwriterequestsaretransfereddirectlyfromthe;*ˆusersbuffer,andWriteFormattedEORcharacteristics(if8*ˆenabled)willbesentoutbytheterminationprocessor'*ˆuponcompletionofthisDMAtransfer.*>WRITDFMTMOVE.BWEORFMT(A2),D1‚getEORreqforWriteFormatted2BTST.L#FIXTERM,D1‚fixedlengthtransferenabled?BEQ.SWRITD060„branchifnoF MOVE.W IOSFBWF(A2),D0 yes change transfer length to fixed requirement*G*ƒIfanyoftheCR,LF,orEOScharactersareenabled,EOI(ifenabled);*ƒmustbeheldoffforthistransferandtransmittedbythe*ƒterminationprocessor.*WRITD060 MOVE.B D1,D37 AND.B #1<*„terminateonthehighestpriorityterminatorwithEOShaving:*„thehighestpriorityfollowedbyLFandCRrespectively.*0READ115MOVEQ#0,D2ŠclearDMAoperationregister#BTST.L#EOSTERM,D1ŠisEOSenabled?BEQ.SREADD060branchifno; MOVE.B IOSEOSR(A2),EOSCOMP(A1) yes, set EOS read character+BRA.SREADD080andbypassCR/LFEOSchecks)READD060BTST.L#LFTERM,D1‚isLFenabled?BEQ.SREADD070branchifno1MOVE.B#LF,EOSCOMP(A1)…yes,setLFasterminator'BRA.SREADD080andbypassCREOScheck)READD070BTST.L#CRTERM,D1ƒisCRenabled?6*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *ˆ4/24/84ƒbwn*=*ˆFixsothatreadwillterminateonfixedlengthdatainput. *ˆInsertedREADD090labelbelow.**BEQ.SREADD020branchifno BEQ.S READD090*?*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>1MOVE.B#CR,EOSCOMP(A1)…yes,setCRasterminator@READD080BSET.L#EOSBIT,D2‚enableEOSdetectionforDMAtransfer2READD090BTST.L#FIXTERM,D1‰fixedlengthtransfer?BEQ.SREADD020branchifno1TST.WD3“diduserreallyspecifyafixedlength?3BEQ.SREADD020br=no,useIOSPBspecifiedlength;CMP.WD0,D3‘compareuser'srealbufferlengthtoDEVICE'S!8BGE.SREADD011Žbr=user'sbuffersize.GE.todevice's4MOVEQ‚#ISTAADD,D1Šbr=hisbufferisnotbigenoughBRA.SREADDRTNŽabort*BREADD011MOVE.WD3,D0ˆsetupDMAfordevice'sfixedlengthrecord!4READD020:BSRSETUPDMA†setupDMAbytecountandMAR+MOVE.B#LON1,AUXCMD(A1)…setupListenmode .BSET.L#DMAWRITE,D2ˆenableDMAwritecommmand6BCLRW#BIBIT,TMSMASK(A5)ƒdisableBIinterruptsonDMA7MOVE.WTMSMASK(A5),D1†resetinterruptmaskonTMS9914A MOVEP.W D1,INTR0(A1)*MOVE.B#GTS,AUXCMD(A1)…lowertheATNlineB*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<* *ˆ4/24/84ƒbwn*9*ˆMustinhibitTMS9914A‚interrupts‚duringDMAoperations.*2BCLR.B#VBIMENAB,CONTREG0(A1)‚disable9914intrps*?*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>&MOVE.BD2,UNICMD(A1)‡initiatetheI/O+MOVEQ‚#ISTAOK,D1ŠsetreturnstatustoO.K.READDRTNRTSexitreaddata PAGE(*ˆPROCESSOR:SendTerminationCharacters*6*ˆPURPOSE:ThisprocessorwillsendtheEORcharacters,*‘inDMAmodetocompletethepreviouswrite*‘formattedtransfer.* SENDTERM:%MOVE.WIOSOPT(A3),D1‚getIOSoptions.AND.W#IOPIMG,D1‚datatransferinimagemode?>BNE.SSENDTRM9ƒbranchifyes(noEOScharactersinthismode)*3BSRGETCNFIGƒgetptrtocurrentconfigurationdataB MOVE.B WEORFMT(A0),D1 get EOR characteristics for Write Formatted$ MOVE.B IOSEOSW(A0),D2 get EOS char.7LEA.LTERMBUF(A5),A0‚A0<==terminationbufferpointer*?*ƒOnceagain,justasinthereadprocessor,theEORcharacters8*ƒmaybemultiplysetandaresoftwarepriorityencoded.>*ƒIfenabled,theCRcharacterwillbesentoutfirstfollowed1*ƒbytheLFcharacterandthentheEOScharacter.** MOVEQ #0,D0 reset EOS string byte counter+BTST.L#CRTERM,D1ƒisCRcharacterenabled?BEQ.SSENDTRM2„branchifno0MOVE.B#CR,(A0)+‚storeCRinterminationbufferADDQ.L#1,D0ˆbumpbytecount*3SENDTRM2BTST.L#LFTERM,D1ƒisLFcharacterenabled?BEQ.SSENDTRM4„branchifno?MOVE.B#LF,(A0)+‚yes,storeLFcharacterinterminationbufferADDQ.L#1,D0ˆbumpbytecount*;SENDTRM4BTST.L#EOSTERM,D1‚iswriteEOScharacterenabled?BEQ.SSENDTRM8„branchifno:MOVE.BD2,(A0)+ƒstoreEOScharacterinterminationbufferADDQ.L#1,D0ˆbumpcount*1SENDTRM5 MOVEQ #0,D2 initialize DMA transfer type SUB.LD0,A0‡setstartofbuffer*0*ˆSetupfordataxfer:‰A0<--terminatorstring*¦D0=ƒstringlength*¦D1=ƒEORoptions*¦D2=ƒDMAcommand*,BRAWRITD010†dotheterminatorstringwrite*(SENDTRM8TST.LD0‚anyEOSchar.tosend? BNE.S SENDTRM5*?SENDTRM9 BSETW #TERMINT,CSTQOFST(A6) set no interrupt expected!+MOVEQ‚#ISTAOK,D1setreturnstatustoO.K.)RTS„exitterminationcharacterprocessor  PAGE***ˆPROCESSOR:SendEOI*<*ˆPURPOSE:ƒSendsthelastcharacterofadata(OUT)transfer3*“withtheEOIlineTrue(usesTMS9914EOIcontrol)**SENDEOI:)BSRGETCNFIGgetpointertoconfig.data2MOVE.BWEORFMT(A0),D1‡getWriteFormattedoptions MOVE.W IOSOPT(A3),D0.AND.W#IOPIMG,D0ŒwasdataxferinImagemode?.BEQ.SSENDEOI2Žbr=NO,useFormattedoptions*.MOVE.BWEORIMG(A0),D1‡getWriteImageoptions*ASENDEOI2BTST#EOITERM,D1„doweneedtosendlastchar.withEOI?BEQ.SSENDEOI4Žbr=no,exit*-*ƒSendthelastdatabyteofthestring(DMA)*BMOVE.B#FEOI,AUXCMD(A1)…setTMS9914tosendEOIcoincidentw/data;MOVE.B#$FE,BCNTLSB(A1)…setupBCRto1'scompl.of1byteFMOVE.B#$FF,BCNTMSB(A1)…THEMARISSTILLSETFROMPREVIOUSXFER!!!!!!#MOVEQ#0,D2‘setupfordataoutput(BRAWRITD022godotheoutputoperation*LSENDEOI4 BSETW #TERMINT,CSTQOFST(A6) set no intrp expected flag for PROCMENU>BTSTW#CAC_S,BUSACTIV(A5)ƒNomoreoutputistotakeplace,so?BEQ.SSENDEOI5ŽifweareaController,takecontroloftheBUSHMOVE.B#TCA,AUXCMD(A1)†NOW!causeitwon'tbedoneatnormalintrptime*SENDEOI5 MOVEQ #ISTAOK,D1 RTS ‰PAGE*ˆPROCESSOR:Untalk‚(UNT)*:*ˆPURPOSE:TosendtheuniversalUNTALKcommandoutonthe*‘BUSwiththeATNlinetrue.*SENDUNT:&MOVE.B#UNT_CMD,D1‚setUntalkcommand!BRACOMOUT…sendoutcommandbyte **ˆPROCESSOR:Unlisten‚(UNL)*<*ˆPURPOSE:TosendtheuniversalUNLISTENcommandoutonthe *‘BUSwiththeATNlinetrue.*SENDUNL:(MOVE.B#UNL_CMD,D1‚setUnlistencommand!BRACOMOUT…sendoutcommandbyte *'*ˆPROCESSOR:ListenAddressGroup(LAG)*;*ˆPURPOSE:Tosendtheprimarylistenaddressofthedevice1*‘specifiedintheLUNparameteroftheIOSPBout#*‘ontheBUSwiththeATNlinetrue*SENDLAG:3BSRGETPADDR‚gettheprimaryaddressofthedevice/OR.B#$20,D1ˆconverttoprimarylistenaddress!BRACOMOUT…sendoutcommandbyte *%*ˆPROCESSOR:OtherTalkAddress(OTA)*9*ˆPURPOSE:Tosendtheprimarytalkaddressofthedevice1*‘specifiedintheLUNparameteroftheIOSPBout#*‘ontheBUSwiththeATNlinetrue*SENDOTA:K MOVE.B #TON0,AUXCMD(A1) UNTALK the GPIB, send aux command talk only (cs=0)3BSRGETPADDR‚gettheprimaryaddressofthedevice-OR.B#$40,D1ƒconverttoprimarytalkaddress!BRACOMOUT…sendoutcommandbyte ***ˆPROCESSOR:OtherSecondaryAddress(OSA)*9*ˆPURPOSE:Tosendthesecondaryaddressspecifiedinthe.*‘secondaryaddressparameteroftheIOSPBout$*‘ontheBUSwiththeATNlinetrue.*SENDOSA:5MOVE.BIOSSAD-1(A3),D1‚getdesiredsecondaryaddress AND.B#$1F,D1ƒmaskaddressbits8 OR.B #PPE_CMD,D1 set into secondary address group range!BRACOMOUT…sendoutcommandbyte *,*ˆPROCESSOR:ParallelPollUnconfigure(PPU)*:*ˆPURPOSE:Tosendtheuniversalparallelpollunconfigure1*‘commandoutontheBUSwiththeATNlinetrue.t*SENDPPU:ILEA.LCONFINFO(A5),A0‚A0<==startofconfigurationareaforalldevices*;*‚ResetthecurrentparallelpollconfigurationoftheBUS.*0MOVE.LCNFIGPTR(A0),A2‚A2<==cnfigptrforBUS6BSET.B#PPIS,IOSPOLC(A2)‚setParallelPollIdleState> MOVE.B #0,PARLPOLL(A1) clear the GPIBC parallel poll register#MOVE.B#PPU_CMD,D1‚setPPUcommand+BRACOMOUTƒsendthecommandoutontheBUS *'*ˆPROCESSOR:ParallelPollEnable(PPE)*:*ˆPURPOSE:Tosendparallelpollconfigurationinformation3*‘(PPPandSbitssetupinPPEparameterofIOSPB)*‘outontheBUS.*SENDPPE:1MOVE.BIOSSAD-1(A3),D1‚getPPconfigurationinfo"AND.B#$0F,D1†maskPPPandSbits*8*‚Settheparallelpollconfigurationregistertoactive *ˆandsetthenewconfiguration.*9BSRGETCNFIGƒA0<==ptrtoconfigurationareafordevice8MOVE.BD1,IOSPOLC(A0)‚saveindeviceconfigurationarea*3OR.B#PPE_CMD,D1„encodebitstomakeaPPEcommand+BRACOMOUT…sendoutcommandbytetodevice ***ˆPROCESSOR:ParallelPollConfigure(PPC)*8*ˆPURPOSE:Tosendtheuniversalparallelpollconfigure0*‘commandoutontheBUSwiththeATNlinetrue.*SENDPPC:*MOVE.B#PPC_CMD,D1‚setupthePPCcommand!BRACOMOUT…sendoutcommandbyte *(*ˆPROCESSOR:ParallelPollDisable(PPD)*6*ˆPURPOSE:Tosendtheuniversalparallelpolldisable0*‘commandoutontheBUSwiththeATNlinetrue.*SENDPPD:*MOVE.B#PPD_CMD,D1‚setupthePPDcommand!BRACOMOUT…sendoutcommandbyte *%*ˆPROCESSOR:SerialPollEnable(SPE)*3*ˆPURPOSE:Tosendtheuniversalserialpollenable0*‘commandoutontheBUSwiththeATNlinetrue.*SENDSPE:*MOVE.B#SPE_CMD,D1‚setuptheSPEcommand!BRACOMOUT…sendoutcommandbyte *&*ˆPROCESSOR:SerialPollDisable(SPD)*4*ˆPURPOSE:Tosendtheuniversalserialpolldisable0*‘commandoutontheBUSwiththeATNlinetrue.*SENDSPD:*MOVE.B#SPD_CMD,D1‚setuptheSPDcommand!BRACOMOUT…sendoutcommandbyte *$*ˆPROCESSOR:ClearAllDevices(DCL)*5*ˆPURPOSE:Tosendtheuniversaldeviceclearcommand(*‘outontheBUSwiththeATNlinetrue.*SENDDCL:*MOVE.B#DCL_CMD,D1‚setuptheDCLcommand!BRACOMOUT…sendoutcommandbyte * *ˆPROCESSOR:LocalLockout(LLO)*6*ˆPURPOSE:Tosendtheuniversallocallockoutcommand(*‘outontheBUSwiththeATNlinetrue.*SENDLLO:*MOVE.B#LLO_CMD,D1‚setuptheLLOcommand!BRACOMOUT…sendoutcommandbyte **ˆPROCESSOR:TakeControl(TCT)* 5*ˆPURPOSE:Tosendtheaddressedtakecontrolcommand(*‘outontheBUSwiththeATNlinetrue.*SENDTCT:*MOVE.B#TCT_CMD,D1‚setuptheTCTcommand!BRACOMOUT…sendoutcommandbyte *)*ˆPROCESSOR:SelectiveDeviceClear(SDC)*7*ˆPURPOSE:Tosendtheaddressedselectivedeviceclear/*‘commandoutontheBUSwiththeATNlinetrue*‘toallcurrentlisteners.*SENDSDC:*MOVE.B#SDC_CMD,D1‚setuptheSDCcommand!BRACOMOUT…sendoutcommandbyte **ˆPROCESSOR:GoToLocal(GTL)*4*ˆPURPOSE:Tosendtheuniversalgotolocalcommand(*‘outontheBUSwiththeATNlinetrue.*SENDGTL:*MOVE.B#GTL_CMD,D1‚setuptheGTLcommand!BRACOMOUT…sendoutcommandbyte *(*ˆPROCESSOR:GroupExecuteTrigger(GET)*6*ˆPURPOSE:Tosendtheuniversalgroupexecutetrigger0*‘commandoutontheBUSwiththeATNlinetrue.*SENDGET:*MOVE.B#GET_CMD,D1‚setuptheGETcommand!BRACOMOUT…sendoutcommandbyte *)*ˆPROCESSOR:ReadSerialPollstatusbyte*0*ˆPURPOSE:ThisprocessorispartoftheCOND_SP)*‘(ConductSerialPoll)menu.Itspurpose+*‘istosetupforByte-Ininterrupt‚toget!*‘thestatusbytedesireddevice.*READSP:)BSRMTFIFO’cleartheFIFO(VME-300bug!)3MOVEM.LD0-D7/A0-A6,-(A7)ƒsaveregsonTrap0call1LEASP_TO(PC),A0ŒsetPATforserialpolltimeout"MOVE.L#1000,A1waitfor1second MOVEQ #0,D1EMOVE.BCCBISR(A5),D1ˆgetintrplevelfromhighbyteofCCBS.R.wordAND.B#$0F,D1maskoffgarbage)MOVE.LA5,D2setCCBaddressasPATI.D.TR0$.RQPA,‘starttimerBRA.SREADSP1br=timergoing*#TR0$.KILLER,elsebombthesystem !READSP1 MOVEM.L (A7)+,D0-D7/A0-A6/ BSETW #SPTIMER,BUSACTIV(A5) mark timer running4MOVE.B#LON1,AUXCMD(A1)…setuptoreadSPdatabyte3MOVE.B#GTS,AUXCMD(A1)†DropATNtolethimsendit#MOVEQ#ISTAOK,D1Œsetreturnstatus RTS  PAGE .*ˆSerialPollReadStatusByteTimeoutRoutine*=*ˆIfauserhasrequestedtheserialpollfunction,atimeout=*ˆerrorstatuswillbereturned.‚Elseifthetimeoutoccurred;*ˆasaresultofthedriverpollingadeviceinresponseto<*ˆanSRQinterrupt,theSerialPollstatusbyte(intheCCB)<*ˆwillbesettozeroandthecurrentdevicewillbeskipped*ˆinthepollingsequence.*+SP_TO:ƒMOVEM.LA3-A5,-(A7)‹saveimmed.regs‰MOVE.LD1,A5’setCCBpointer‰MOVE.LQTAIL(A5),A07‰CMPA.LQHEAD(A5),A0‹isthereanoperationinprogress?/‰BEQ.SSP_TO2’br=no,musthavebeencancelled9‰BCLRW#SPTIMER,BUSACTIV(A5)ƒwastimeralreadycancelled?‰BEQ.SSP_TO2’br=yes,ignore*1*ˆSetupregisterstolooklikeVME-300interrupt*"‰MOVE.LDCBQOFST(A0),A4ˆA4<--DCB#‰MOVE.LIPBQOFST(A0),A3ˆA3<--IOPB+‰MOVE.LCCBCHB(A5),A1ŠA1=hardwareaddress<‰MOVE.B#TCS,AUXCMD(A1)ˆtakecontrolofBUSnow,sincethere)‰MOVE.BDATAIO(A1),D1Šisnointrpcoming!)‰BTSTW#SRQPROG,BUSACTIV(A5)ƒSRQpolling?‰BNE.SSP_TO1’br=no,userI/O;‰BSETW#SRQFAIL,CSTQOFST(A0)ƒmarkSRQpollresponsefailure*SP_TO1ƒCLR.BSRQBYTE(A5)resetstatusbyte3‰BSRPROCMENU’andprocessasnormalstatusresponse'SP_TO2ƒMOVEM.L(A7)+,A3-A5‹restoreregs‰RTE*?*ˆRoutinetocancel‚thecurrentlyrunningSerialPollI/Otimer* KILLSPTO:5‰BCLRW#SPTIMER,BUSACTIV(A5)ƒcleartimerrunningflag3‰MOVEM.LD0-D7/A0-A6,-(A7)…saveregsonTrap0call.‰LEASP_TO(PC),A0Žsetupparmstocanceltimer‰SUBA.LA1,A1’interval‰MOVE.LA5,D2’setCCBI.D.1‰MOVE.BCCBISR(A5),D1Šgetintrplevelforrequest#‰AND.L#$0F,D1‘clearexcessgarbage(‰OR.L#$8000,D1options=cancelrequest‰TR0$.RQPA,“gocancel$‰BRA.SKILLSP1‘br=requestaccepted$‰TR0$.KILLER,‘elsecrashthesystem*.KILLSP1‚MOVEM.L(A7)+,D0-D7/A0-A6…restoreregs‰RTS  PAGE*1*ˆPROCESSOR:SendAuxiliaryCommandBufferString*4*ˆPURPOSE:Thisgeneralprocessorwillsimplyoutput-*‘whateverisintheusersauxiliarycommand+*‘stringbufferoutontheBUSwiththeATN *‘linetrue.* SENDAUXS:8BSRGETXFRAD‹getphysicalI/Oaddressforthisfunction ,MOVE.LD6,A0‹A0<==startingbufferaddress1 MOVE.L D5,CMDCOUNT(A5) set command string length+MOVE.B(A0)+,D1Špreloadfirstcommandbyte?MOVE.LA0,CMDBFPTR(A5)‚setcommandbufferpointertonextbyteBRACOMCMDsendcommand  " TTL CLASS I MENU ITEM SUBROUTINES PAGE**‚TLPROC*&*ˆTALKER/LISTENERWRITE/READPROCESSOR*6*ˆThepurposeofthisroutineistodetermineifitis9*ˆO.K.toinitiatethecurrentRead/Writecommandatthis1*ˆtime.‚Ifnot,thecurrentoperationwillsetup%*ˆaTasklevelI/Ooperationpending.*.*’ENTER:‚D0.B=‚typeofoperation-Read/Write#*šA1=baseaddrofGPIBCregisters'*šA3=addressofIOCBforthisrequest*šA5=addressofCCB*:*’EXIT:‚IFCCthenO.K.toinitiateI/O(D0.b=don'care)*™ELSE(IFCSANDD1=0)2*œTHEN‚taskwaitingforcontrollertomakerequest$*™ELSE(IFCSANDD1.B=errorcode)*œTHENcommandisaborted* *’RegisterUsageƒ01234567 *¡D*R***¡A*TLPROC:5BTSTW#CAC_S,BUSACTIV(A5)„isBUSincontrollermode?+BNE.STLP20‘br=yes,O.K.toinitiateI/O*=BTSTW#BUSIOP,BUSACTIV(A5)ƒisthereINTRPlevelI/Opending?6BNE.STLP10‘br=yes,gocheckformatchingoperation*6MOVE.BD0,IOPEND(A5)ˆelsemarkTasklevelI/OpendingDMOVE.LMENUCPOS(A5),MENUNPOS(A5)‚backupmenupointertore-execute(MOVEQ#ISTAOK,D1Œsetreturncode=O.K. BRA.STLP40‘andexitwithC=1*>TLP10MOVE.BIOPEND(A5),D2ƒD2=INTRPlevelI/Opendingstatus MOVE.B D0,D11AND.BD2,D1‘D1=INTRP^TASKI/Opendingstatus1BEQ.STLP30‘br=operationtypemismatch-error*/BTST#SECONDAR,D2‹secondaryaddressoperation?*BEQ.STLP20‘br=no,O.K.toinitiateI/O* MOVEQ #SECMASK,D3 MOVE.B IOSSAD-1(A3),D1-AND.BD3,D1‘D1=taskrequestedsec.address0AND.BD2,D3‘D3=INTRPlevelpendingsec.addr.CMP.BD1,D3‘aretheythesame?4BNE.STLP30‘br=no,gokilltaskrequestedcommand*,TLP20BSRMTFIFOO.K.toinit.I/O!LET'SGO'BNE.STLP40‘oops,hardwaremalfunction*6CLR.BIOPEND(A5)ŒclearINTRPlevelI/Opendingstatus/BCLRW#BUSIOP,BUSACTIV(A5)ƒandassociatedflag&MOVEQ#ISTAOK,D1ŒsetreturncodeO.K.ANDI#$FE,CCRclearCarrybit RTS*'TLP30MOVEQ#ISTAIRPI,D1…seterrorcode* TLP40ORI#$01,CCR‹setCarrybit RTS  PAGE* *ƒSETUPDMA*>*‡ThisroutineisusedbytheREADDATA,WRITDATA,andSENDTERM<*„processorstosetupthememoryaddressregister(MAR)andA*„thebytecountregister(BCR)ontheMVME300card.Thesesimply8*„setuptheDMAtransferregistersbutinitiatenoI/O.*-*ˆENTER:‚A1=baseaddressofGPIBCregisters,*A0=bufferaddresstoread/writeto/from."*D0=numberofbytestotransfer*!*ˆRegisterUsage:†01234567*šD‚P*šA‚P* SETUPDMA: MOVE.L D0,-(A7).NOT.WD0…convertbytecountto1'scompliment-MOVE.BD0,BCNTLSB(A1)‚saveLSBofbytecount LSR.W#8,D0‡getnexteigthbits-MOVE.BD0,BCNTMSB(A1)‚saveMSBofbytecount*#MOVE.LA0,D0†D0<==bufferaddressB*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *ˆ4/24/84ƒbwn*8*ˆTheaddresswegetinD0istheaddressasseenbythe *ˆdriver.4*ˆIfweareusingdualportedram‚ontheVME/10,and5*ˆifthisaddressisinon-boardram,thenitmustbe;*ˆtranslatedtoanon-boardaddressastheMVME300seesit.1*ˆWedothisbyaddingtheRAM_SKEWoffsettothe%*ˆaddress,usingtheGO_OFF_BDmacro.* ‰GO_OFF_BDD0*>*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>%MOVE.BD0,MARLSB(A1)‚saveLSBofMAR LSR.L#8,D0„getnexteightbits%MOVE.BD0,MARISB(A1)‚saveISBofMAR LSR.L#8,D0„getnexteightbits%MOVE.BD0,MARMSB(A1)‚saveMSBofMAR MOVE.L (A7)+,D0 RTS…exit PAGE**‚COMOUT*7*ˆSincecommandsbytes(ATN=true)cannotbesentout=*„inDMAmode,thisprocessorwillsendoutabyteatatime.'*„ItassumesthattheATNlineistrue.*-*ˆENTER:„A1=baseaddressofGPIBCregisters*’A5=addressofCCB *’D1.B=commandbytetobesent*  ' ED!<):189:A-I5Q4Y.a1iJqMy?:‰/‘2™:¡=©>±6¹DÁ7É !*ˆRegisterUsage:„01234567*˜D„P‡P*˜A„P*COMOUT:FMOVE.L#1,CMDCOUNT(A5)ƒsetcommandcountto1forinterruptprocessor*C*‚EntryPointusedbytheCommandOut/DataOutandtheCommandOut/*‚DataInprocessors**ƒspaceintheCCBfornewblockandstoringnewconfiguration=*ƒinformation.‚Inactuality,thespaceforallconfigurations<*ƒattachedtothisCCBhavealreadybeenallocatedanditis+*ƒjustamatterofadjustingsomepointers.=*‡SinceIOIisinitiatingthiscall,A1looksliketheuser's?*ƒbufferbutisreallyapointertothedefaultconfigurationof *ƒtheDCB.;*‡TheBUSactivityflag(BUSACTV)issetupatthistimeto$*ƒindicateitsinitialstartupmode.*+MOVE.LA2,-(A7)‚saveaddressofGPIBCregs6LEA.LCONFINFO(A5),A2‚configuration/DCBpointertable MOVEQ #0,D0'MOVE.BDCBCDV(A4),D0‚getdevicenumber"ASL.L#3,D0‡calculatetableindex@MOVE.LNEXTCNFG(A5),A0‚A0<==nextavailableconfigurationarea=MOVE.LA0,CNFIGPTR(A2,D0.L)‚setconfigurationptrfordevice3MOVE.LA4,DVDCBPTR(A2,D0.L)„setDCBptrfordevice*I*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*8*ˆ10/16/84‚SETSERVICEREQUESTWAITINGFLAGTOCATCHANY2*’SRQ'SPENDINGONTHEBUSATTIMEOFBOOT/STARTUP6*’SINCETHATSRQINTERRUPTWILLBELOSTINTHETMS9914$*’ATTIMEOFCHANNELINITIALIZATION.*‰BSETW…#SRQWAIT,BUSACTIV(A5)*I*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>JMOVE.WIOSVARL+DCBDEV(A4),D0„D0<==lengthofvariableconfigurationarea BTST#0,D0…oddnumberofbytes?BEQ.SCDEVA„branch  ifnoBADDQ#1,D0…allocateinevenbyamountsforaddressingconsistency*KCDEVALEA.LIOSILN(A0,D0.W),A2‚calculatetotallengthofconfigurationareaDMOVE.LA2,NEXTCNFG(A5)ƒupdatenextavailableconfigurationareaptr.MOVE.L(A7)+,A2‚restoreaddressofGPIBCregs*?*ƒThenextcheckwilldetermineiftheGPIBisbeingconfigured4*ƒwithsystemcontrollercapabilities.‚Ifthisisso=*ƒthenthebusinterfacewilltakecontroloftheBUSatthis?*ƒpoint.‚OtherwiseitsmodewillbesetaccordingtothedeviceB*ƒattributesword(IOSATW)passedintheconfigurationdatablock.E*ƒIftheBUSisconfiguredforTalker/Listeneronly,NOOTHERDEVICESI*ƒWILLBEALLOWEDTOBECONFIGUREDATSYSTEMINTIALIZATIONTIME.‚AttemptsG*ƒtoaccessthesedevicesatalatertimewillcauseaDEVICENOTREADY(*ƒerrorconditiontobereturnedbyIOS.*&TST.BDCBCDV(A4)”configuringtheBUS?BNE.SCOMNCNFG”branchifno MOVE.L A1,-(A7)9BSRRESETIO—correctforintrpstoanun-attachedchannel MOVE.L (A7)+,A1ABTSTW#IOASCTC,IOSATW(A1)‰isBUSbeingconfig.withS.C.capab?BEQ.SCOMNCNFG•branchifno*2*ˆElsetestinterfaceforcompatibleconfiguration*:*ˆNOTE!!!‚Thedevicewillbestrippedofsystemcontroller8*ˆcapabilitieswithoutnotifyingthecalleronthefirst9*ˆtimeconfigurationonly.Thisallowsasuccessfulfirst:*ˆtimeconfigurationandwillnotmarkthisdeviceOFFLINE*ˆuponreturn.*.TST.BADDRREG(A2)‘isMVME300cardinSCmode?BPL.SCDEVB—branchifyes9BCLRW#IOASCTC,IOSATW(A1)‰donotallowS.C.capabilities BRA.S COMNCNFG*>*ˆSoftware&hardwareS.C.configurationsagree,TAKECONTROL!*CDEVB MOVE.L A1,-(A7)#MOVE.LA2,A1•setupA1forSENDIFC&BSRSENDIFC–TakecontrolofBUS,NOW! MOVE.L (A7)+,A1*/*‚Continuewithnormalconfigurationprocessing*"*ˆCheckforunsupportedattributes*MCOMNCNFGMOVE.W#CECUAP,D2ƒpreloadunsupportedattribute/parametererrorcode*3MOVE.W#NVALBATM,D0ƒgetmaskofinvalidattributes8AND.WIOSATM(A1),D0ƒtryingtochangeinvalidattribute?"BNECNFGERR†branchifyes(error)*1MOVE.W#NVALBPRM,D0‚getmaskofvalidparameters8AND.WIOSPRM(A1),D0‚tryingtochangeinvalidparameter?"BNECNFGERR…branchifyes(error)*9*‚Settheattributesintotheuser'sconfigurationbuffer"*‚thathedoesnotwanttochange.*0MOVE.WIOSATM(A1),D0‚D0<==hisattributesmask;AND.WD0,IOSATW(A1)ƒZeroouttheattributesofhisthathe9NOT.WD0Ždoesn'twanttochange,zeroouttheattributes=AND.WIOSATW(A0),D0ƒofminethathedoeswanttochange,and.OR.WD0,IOSATW(A1)„combinetheminhisspace.* *‚Dothesamefortheparameters*3COMN010MOVEQ#0,D0ƒbesureupper16bitsareclearKMOVE.WIOSPRM(A1),D0‚D0<==maskofparametersthathedoeswanttochange7MOVEM.LA0-A2,-(A7)„saveconfigurationblockaddresses4LEA.LIOSREC(A0),A0„A0<==addrof1stparaminCCB@LEA.LIOSREC(A1),A1„A1<==addrof1stparaminuserdatablock2LEA.LPAR_SIZ,A2…A2<==addroftableparamsizes*NXTPARM MOVEQ #0,D11MOVE.B(A2)+,D1‚get#ofbytesinnextparameter%BEQ.SCHKPARM„branchifendoftable*+LSR.W#1,D0…wanttochangenextparameter?BCS.SINCPARMƒbranchifyesASUBQ#1,D1†doesnotwanttochangeitsomoveparameterfromCCB2*totheuser'sbuffersothathewillhaveacopy)MOVPARMMOVE.B(A0)+,(A1)+‚movenextbyte)DBRAD1,MOVPARMƒuntilbytecountexpires'BRA.SNXTPARMƒcheckthenextparameter*?INCPARMADD.LD1,A0‚hedoeswanttochangeitsoleavehiscopy4ADD.LD1,A1‰aloneandjustgotothenextparameter BRA NXTPARM*>*ƒChecktoseeifhe'sdoinganyconfigurationthatisillegal*:CHKPARMMOVEM.L(A7)+,A0-A2‚restoreconfigurationpointers=MOVE.W#CECIPA,D2‚preloadinvalidprimaryaddresserrorcode*2MOVE.BIOSPRMA(A1),D0‚getcurrentprimaryaddress0CMP.B#$1E,D0…valid?(MUSTBE0<=ADDR.<=$1E)BHICNFGERR…branch=‚error*"TST.BDCBCDV(A4)‚isthisthebus?BNE.SCHKPRM2…branchifno*=*‚Chec  ktoseeiftheprimaryaddressconfiguredmatcheswhat-*‚issetontheswitchesoftheMVME300card.*CMOVE.BADDRREG(A2),D1ƒD1<==primaryaddrreadfromboardswitches+NOT.BD1‰usecomplementofswitchregister AND.B#$1F,D1„maskprimaryaddr?CMP.B#$1F,D1„isswitchregister=$1F(INVALIDGPIBADDRESS!)CBNE.SCHKPRM1„BR=no,usehardwareswitchregisterasBUSaddress)MOVE.BD0,D1…elseuseSYSGENBUSaddress*@CHKPRM1MOVE.BD1,ADDRREG(A2)‚setTMS9914Aprimaryaddrregister, MOVE.B D1,IOSPRMA(A1) update config. buffer9BTSTW#IOSPOLCB,IOSPRM(A1)‚localppconfiguringthebus?BEQ.SCHKPRM2ƒbranchifno*=MOVE.BIOSPOLC(A1),D0‚D0<==newparallelpollconfiguration/BMI.SCHKPRM2ƒbr=noconfigurationsetforPP;AND.B#$1F,D0ƒmaskPPP,SandIbits,BUSisinPPSSstate+MOVE.BD0,IOSPOLC(A1)‚saveinusersbuffer+BSRSETPPREG‚setupparallelpollregister*JCHKPRM2ANDI.L#$7FFFFFFF,IOSSAMR(A1)ƒmaskoutbit31ofboththeReadand*‚Theonlythingthatremainsnowissec.addr.validationandD*‚toupdatetheTMS9914AinterruptmaskregistertoenablesecondaryI*‚addressingifvalidsecondaryaddresseswerenewlydefinedfortheBUS.*8OKCNFGTST.LIOSSAMR(A1)‚anysec.Readaddr'sspecified?SNED0“D0=Yes/No3TST.LIOSSAMW(A1)ˆanysec.Writeaddr'sspecified?SNED1“D1=Yes/No$MOVEQ#CECSADR,D2ˆpreseterrorcode$EOR.BD0,D1ŽBothmustbespecified! BNECNFGERRŽelseitisanerror*" TST.B DCBCDV(A4) is this the BUS? BNE.S OKCNFG3 br = noBMOVE.WTMSMASK(A5),D0‚setthecurrentstateofthe9914Amaskreg5 BSET #APTBIT,D0 set up to enable secondary adressing0 TST.L IOSSAMR(A1) any sec read addresses valid?BNE.SOKCNFG2ƒbranchifyes:BCLR#APTBIT,D0ƒelsedisablesecondaryaddressinterrupts5OKCNFG2MOVE.WD0,TMSMASK(A5)‚saveinmaskstatusreg8 MOVEP.W D0,INTR0(A2) update TMS9914A interrupt mask reg*OKCNFG3 MOVEQ #0,D0FMOVE.WIOSVARL+DCBDEV(A4),D0„D0<==lengthofvariableparameterarea@ADD.L#(IOSILN-IOSATW)/2-1,D0ƒaddinrestofconfigurationarea*MOVEM.LA0/A1,-(A7)ƒsavestartofbuffers5LEA.LIOSATW(A0),A0‚setpointerstostartofbuffers LEA.L IOSATW(A1),A1*?OKCNFG5MOVE.W(A1)+,(A0)+‚copyhisvalidatedbuffertotheCCB#DBRAD0,OKCNFG5„configurationarea*5MOVEM.L(A7)+,A0/A1ƒrestorestartofbufferpointers.EXGA0,A1‰setA0=hisbuffer,A1=CCBbuffer5BSR.SSTATYP1…setupstatusandconfigurationheaderFMOVE.B#1,DCBCCF(A4)ƒsetflagindicatingthataCONFIGUREoraCHANGE *®DEFAULTCONFIGURATIONwasdone*A*ˆThistestisperformedatthistimesoaninitialconfigurationC*ˆwilloccurevenifthereisaS.C.switch/sysgenincompatibility.*-TST.BDCBCDV(A4)‚areweconfiguringtheBUS?#BNE.SOKCNFG7‚branch=notthebus*2EXGA0,A1ƒsetA0=CCBbufferandA1=hisbuffer4MOVEQ‚#CECSCE,D2ƒpreloadinvalidS.C.configurationBBTSTW#IOASCTC,IOSATW(A0)‚areweconfiguringforS.C.capability?6 BEQ.S OKCNFG7 branch = no, else test hardware config.9 TST.B ADDRREG(A2) is the MVME300 card switch in SC mode?'BMI.SCNFGERR‚branch=no  ,gotoerror*0OKCNFG7MOVEQ‚#ISTAOK,D1‚setreturnstatustoOK RTSƒexit*CCNFGERR MOVE.B D2,IOSCEC(A1) save specific configuration error codeBMOVEQ‚#ISTACNF,D1‚setinvalidconfigurationfordeviceerrorcode(RTSƒexitcommonconfigurationprocessor  TTL COMMON SUBROUTINES PAGE**‚STATYP*A*ˆThisroutineisusedbyCONFIGURE,CHANGEDEFAULTCONFIGURATION;*…andREQUESTSTATUSprocessorstostorethecurrentstatus8*…informationinthestandardconfigurationareaheader.*,*ˆENTER:‚A2=baseaddressofGPIBregisters*A4=addressofDCB*A5=addressofCCB*5*ˆEXIT:ƒA0=addressofconfigurationareafordevice*!*‹RegisterUsage:ƒ01234567*›D* *›AR‡PP*STATYP:0BSR.SGETCNFIGƒA0<==currentconfigurationptr*STATYP1: MOVEQ #0,D0"TST.BDCBCDV(A4)‰isthistheBUS?BNE.SSTATYP2Œbr=no'MOVE.BADDRSTAT(A2),D0ƒgetGPIBstatusAND.B#$FE,D0Œmaskoutgarbage*6STATYP2 MOVE.B D0,IOSDST(A0) put dev. status in buffer9 MOVE.B DCBDEV+IOSCTP(A4),IOSCTP(A0) set the channel type8 MOVE.B DCBDEV+IOSDTP(A4),IOSDTP(A0) set the device type/ MOVE.B #IODGPIB,IOSDRC(A0) set the driver code RTSƒexit  PAGE* *„SETPPREG*:*ˆThissubroutinewillsetorclearthedesiredbitofthe?*…parallelpollregisterforwhenaparallelpollisperformed.A*…IfboththeIndividualStatusbitandtheSensebitsareequal,>*…thebitspecifiedwillbesetintheparallelpollregister.8*…otherwisetheparallelpollregisterwouldbecleared.*;*ˆThePPregwillnotbesetifthesystemisinPPISstate.**,*ˆENTER:‚A0=pointertoconfigurationtable*A5=addressofCCB**ˆEXIT:ƒnoerrorsreturn*!*‹RegisterUsage:ƒ01234567*›D*ƒ**›AƒP* SETPPREG:!MOVE.LA1,-(A7)‚Saveenvironment MOVEQ #0,D23 MOVE.B IOSPOLC(A0),D0 get current PP configuration3BMI.SSETPR025ˆbr=InPPISstate,don'tsetPPreg'BTST#PPSENSE,D0‚isthesensebitset?BNE.SSETPR020‚branchifyes*:*‚Thesensebitisequaltozero,sotheindividualstatus8*‚mustalsobezerotosettheparallelpollstatusto1*2BTST#INDIVST,D0‚istheindividualstatusbitsetBNE.SSETPR015ƒno*$SETPR010AND.L#7,D0‚maskbitnumber'BSETD0,D2‚settoparallelpollstatus*6SETPR015MOVE.LCCBCHB(A5),A1‚A1<==ptrtoGPIBCregs:MOVE.BD2,PARLPOLL(A1)‚storeresultsinParallelpollreg$MOVE.L(A7)+,A1ƒrestoreenvironment SETPR025 RTS*:*‚Thesensebithasbeendeterminethatitisequaltoone*7SETPR020BTST#INDIVST,D0‚isindividualstatusbitset?BNE.SSETPR010„branchifyesBRA.SSETPR015„no,exit PAGE* *ƒGETCNFIG*5*ˆGetapointertothecurrentconfigurationareafor*…thedesireddevice.**ˆENTER:‚A4=addressofDCB*A5=addressofCCB*5*ˆEXIT:ƒA0=addressofconfigurationareafordevice*!*‹RegisterUsage:ƒ01234567*›D* *›AR‡PP* GETCNFIG: MOVEQ #0,D0  IOCB*'*ˆONEXIT:‚D2.WISTABLEOFFSET(INDEX)+*’D1.B&=OPERATIONSTATUS(0=O.K)*8*‚FindthefunctioninthetableofvalidGPIBfunctions*GETCMDP:!ˆMOVEM.LA0/D0/D6,-(A7)saveregs5MOVE.W#NUMCMDS-1,D0ƒnumberofvalidGPIBcommands-14LEA.LIOSCMDTB(PC),A0ƒsetptrtoGPIBcommandtable1MOVE.WIOSFCT(A3),D6ƒpickupfunctionfromIOSPB8MOVEQ‚#ISTAIF,D1ƒsetinvalidcommanderrorjustincase*&GETCMD50CMP.W(A0)+,D6ƒfoundcommand?.DBEQD0,GETCMD50ƒbranchifno,looksomemore*,BNE.SGETCMDX„exitwitherror,endoftable4MOVE.W#NUMCMDS-1,D2ƒcalculaterelativetableindexSUB.WD0,D2‚D2<==tableindex"ASL.W#1,D2‚Calculatewordoffset*0MOVEQ‚#ISTAOK,D1setprocessO.K.returnstatus*GETCMDX TST.B D1 set return condition code$ MOVEM.L (A7)+,A0/D0/D6 restore regs RTS* 6 TTL GPIB DRIVER - COMMON SUBROUTINES (QUEUE HANDLING) PAGE**‚POPGPIBQUEUEENTRY*6*ˆIfI/Oisabortedoranoperationiscompleted,this9*…routinewillpopthatoperationfromtheGPIBqueueand9*…updatethenecessaryqueuepointers.Itisassumedthat:*…thecallerhaspreviouslyinhibitedallinterruptssince*…thisiscriticalprocessing.**’ENTER:ƒA5-addressofCCB*#*’EXIT:ƒIF„THEN‚queueisempty)*œELSE‚queuestillhasatleastoneentry*!*ŽRegisterUsage:ƒ01234567*žD *žA**‡P* POPGPIBQ:1LEA.LGPIBQEND(A5),A0‚A0<==ptrtoendofqueue.MOVE.LQTAIL(A5),A1„getcurrentqueuepointer2CMPA.LQHEAD(A5),A1„isthereanentrytoPOPoff?,BEQ.SPOPG15ŒBR=no,exitwithproper?ADDA.L#GPIBQLEN,A1„advancepointerbylengthofaqueueentryCMPA.LA0,A1…atendofqueue?BNE.SPOPG10ƒno*%* time to wrap around to top of queue*5LEA.LGPIBQ(A5),A1…setqueuepointertotopofqueue*APOPG10MOVE.LA1,QTAIL(A5)ƒupdatecurrentoperationqueuepointer„THENƒnoerrors*•ELSE„queueisfull*!*RegisterUsage:ƒ01234567 * D*‡PPPP* A*PƒPPPP* PSHGPIBQ:!MOVE.LA1,-(A7)ƒsaveenvironment4LEA.LGPIBQEND(A5),A1„A1<==endofGPIBqueuearea4MOVE.LQHEAD(A5),A0†A0<==nextavailablequeueptr*CLR.W‚CSTQOFST(A0)†setentrystatustoOK+MOVE.LA4,DCBQOFST(A0)ƒsaveaddressofDCB6MOVE.LA3,IPBQOFST(A0)ƒsavephysicaladdressofIOSPB?MOVE.LD7,PBPAOFST(A0)ƒsavephysicaladdressofprimarybufferIMOVE.LD6,SBPAOFST(A0)ƒsavephysicaladdressofsecondary/config.buffer2MOVE.WD4,PBLNOFST(A0)ƒsaveprimarybufferlength4MOVE.WD5,SBLNOFST(A0)ƒsavesecondarybufferlength;ADDA.L#GPIBQLEN,A0„incrementbylengthofonequeueentry"CMPA.LA1,A0…timetowraparound?BNE.SPSHQ010„branchifno*0LEA.LGPIBQ(A5),A0‚setptrtotopofqueuearea**PSHQ010CMPA.LQTAIL(A5),A0‚isqueuefull?5BEQ.SPSHQRTN‚yes,butthisshouldnothavehappened4 MOVE.L A0,QHEAD(A5) update next available queue ptr4MOVEQ#1,D0‚setconditioncodeforO.K.return*PSHQRTNMOVE.L(A7)+,A1ƒrestore RTSA TTL GPIB DRIVER - COMMON SUBROUTINES (VALIDATE OPERATIONAL MODE) PAGE**‚VALIDATEOPERATIONALMODE*9*ˆThisroutinewillbecalledatthepointwhenacommand:*ˆisabouttobescheduledforI/Oinitiation.Thepurpose;*ˆistodetermineiftheBUSisinthepropermodeforthis:*ˆcommandandtodetermineiftheBUSordevice(depending:*ˆonwhothiscommandisdirectedto)hastheca  pabilities3*ˆ(ifanyarenecessary)toperformthisoperation.*3*’ENTER:‚A3=addressofIOSPBforcurrentfunction*šA4=addressoftheDCB*šA5=addressoftheCCB%*šD2.W=indexofcommandinVALPARTB*'*’EXIT„D1=errorcode(0ifnoerrors)* *RegisterUsage…01234567 *¡D*R****¡A**VALOPER:FLEA.LVALPARTB(PC),A0ƒA0<==baseaddressofcommandvalidationtableDMOVE.W0(A0,D2.W),D4‚D4<==bitmapofnecessarycommandparameters*?CMP.B#XDSGDEV,IOSDTP+DCBDEV(A4)‚isthiscommandforadevice?BNE.SVALOP050ƒbranchifno*@*‚SincethiscommandisdirectedtowardsadeviceandthevaluesB*‚inVALPARTBarerelativetotheBUS,theREAD/WRITEbitstakeonA*‚theoppositemeaningthantheydidfortheBUS.‚Forexample,ifB*‚thereisawritecommandtoadevice,thevalueinVALPARTBwillB*‚indicatethatthetalkerability(VALTALK)willbenecessaryforA*‚thiscommand.‚However,thisbitwassetrelativetotheBUS.SoA*‚ifthewritecommandisdirectedtoadevice,thisrequirestheC*‚BUStobeinthetalkermodeandthedevicetobeinthelistenerB*‚mode.‚ItisforthesereasonsthattheTALKandLISTENabilitiesA*‚(VALTALKandVALLISTrespectively)areexclusiveor'dwith'11' *‚soastoinverttheirmeaning.*BMOVEQ#VALTALK+VALLIST,D0‚setupspecificcapabilitiestolookat MOVE.B D0,D39AND.BD4,D3D3=Talker/Listenercapabilityrequirements#BEQ.SVALOP050br=none,continueCMP.BD0,D3arebothrequired?-BEQ.SVALOP050br=yes,sononeedtoalter6EOR.WD0,D4else,changemeaningrelativetoadevice*C*ƒNowthatwehavethemeaningoftheabilitybitscorrectrelative;*ƒtothecommand,checkthecurrentattributeswordfortheB*ƒspecifieddevicetoseeifthedeviceorBUSiscapableofdoing*ƒthatcommand.*,VALOP050MOVE.WD4,D2‡D2<==WorkingbitmapHAND.W#VALTALK+VALLIST+VALCTL+VALSCTL+VALSRQ,D2‚anyabilitiesrequired?BEQ.SVALOP100branchifno8BSRGETCNFIGgetapointertouser'sconfigurationarea-MOVE.WD2,D3D3<==currentdeviceabilities5AND.WIOSATW(A0),D3ˆmaskabilitiesthatarerequired;CMP.BD2,D3doesthisdevice/BUShavetherightabilities.BNE.SVALOP250branchifno*C*‚Nowthattheabilityhasbeenverified,checktoseethattheBUS,*‚isinthenecessarymodeforthiscommand.**VALOP100MOVE.WD4,D2…savecurrentbitmap?AND.W#VALTMOD+VALLMOD+VALCMOD+VALBTLM,D2‚anymodesnecessary?BEQ.SVALOP500ƒbranchifno*3MOVE.WBUSACTIV(A5),D0‚D0<==currentbusactivity3CMP.B#XDSGDEV,IOSDTP+DCBDEV(A4)‚isthisadevice?BEQ.SVALOP200‚branchifyes8BTST#BVALBTLM,D4‚doweneedtobeinT/LmodeforBUS?BNE.SVALOP300‚branchifyes*5VALOP200BTST#CAC_S,D0ƒistheBUSincontrollermode/BNE.SVALOP500‚branchifyes,everythingisOK*"*‚ERROR:Amodeerrorhasoccurred*?VALOP250MOVEQ#ISTAIVCM,D1ƒsetinvalidcommandmodeerrorcodeBRA.SVALOPRTNƒexitwitherror*6VALOP300BTST#CAC_S,D0‚istheBUSincontrollermode?FBNE.SVALOP250‚branchifyes-error-can(tbeincontrollerforcmd*?*‚SincethiscommandisdirectedtotheBUS,itmayrequirethe>*‚BUStobeeitherinTalkerorListenermode.‚Checktoseeif>*‚thosemodesarerequiredforthiscommandandifsocheckto=*‚seethattheBUSisintheappropriatemode.‚TheproperT/L>*‚modecheckisskippediftheBUSisIDLE.‚Theoperationwill#*‚subsequentlybequeuedinTLPROC.*4 AND.W #1<*‚Thischeckwill  seeifasecondaryaddressistobeverified<*‚forthiscommandandcheckagainstvaliddeviceaddresses.*?VALOP500BTST#BVALSADR,D4ƒcheckGPIBdevicesecondaryaddress?BEQ.SVALOP600ƒbranchifno*3 CMP.B #XDSGDEV,IOSDTP+DCBDEV(A4) Is this a device? BEQ.S VALOP520*?BTSTW#APTBIT,TMSMASK(A5)‚operatinginsecondaryaddressmode?$BEQ.SVALOP250‚branchifno(error)*5VALOP520BSRGETCNFIG‰getconfigurationptrofdeviceDMOVE.LIOSSAMR(A0),D2„D2<==bitmaskofconfiguredvalidreadS.A./BTST‚#BVALLIST,D4‚isthisasecreadfunction?BNE.SVALOP540‚branchifyesEMOVE.LIOSSAMW(A0),D2ƒD2<==bitmaskofconfiguredvalidwriteS.A.*DVALOP540‚MOVE.BIOSSAD-1(A3),D0‚getS.A.fromIOSPBforthisrequest@MOVEQ#ISTAIVSA,D1‚preloadinvalid/unconfiguredS.A.errorcode?BTST.LD0,D2„isthisaddrconfiguredtobevalidinthismode?'BEQ.SVALOPRTN‚exitwitherrorinD1.B*NVALOP600 BTST #BVALBCHG,D4 does commmand reequire user to be in charge of BUS?, BEQ.S VALOP700 br = no, all checks complete% MOVEQ #ISTAIVBD,D1 preset error code LEA.L CONFINFO(A5),A0*MOVE.LDVDCBPTR(A0),A0‚A0<---DCbofBUS" TST.L DCBWNT(A0) is the BUS open?/BEQ.SVALOPRTNƒbr=no,returnwitherrorcode*;*‚Themodeanddeviceisnowcapableofcompletingthetask*/VALOP700MOVEQ#ISTAOK,D1„setreturncodetoOKVALOPRTNRTS„exit @ TTL GPIB DRIVER - COMMON SUBROUTINES (HALT ALL I/O IN PROGRESS) PAGE*%*•HALTI/OTOBUSORSPECIFIEDDEVICE*>*ˆThisroutineisdesignedtohaltallI/Othatisinprogress?*ˆandanyI/OthatiswaitingtobeexecutedontheGPIBqueue.=*ˆThisroutinemaybeenvokedatinterruptorcommandlevels.>*ˆIfatcommandlevel,aHALTcommandwasreceiveddirectedto;*ˆtheBUS.Atinterruptlevel,aIFC,DCL,orTCTinterrupt<*ˆwasencountered.‚TheseinterruptscauseallpendingI/Oto *ˆbeaborted.*2*’ENTER:„A4=addressofDCBforcurrentoperation*œA5=addressofCCB*)*’EXIT:…IfD1.B=0ƒThenallentrieswere%*œmarked'Halted'andtheappropriate+*œeventsweresentforthewaitingcommands*œonthequeue.*˜ELSE*œtherewasnoI/Otohalt.*!*ŽRegisterUsage:†01234567*ŸDƒ*R*ŸA‹PP*HLTALL:+MOVEM.LD2-D7/A1-A6,-(A7)ƒsaveenvironment6MOVE.LQTAIL(A5),A6‰A6<==ptrtocurrentqueueentry(CMPA.LQHEAD(A5),A6‰isthequeueempty?+BEQHLTERR’branchifyes(nothingtohalt)*BSRRESETIO‘doasoftreset1BSRKILLSPTOcancelSerialPolltimerifrunning>LEA.LGPIBQEND(A5),A0‡A0<==addressofphysicalendofqueue*CHLTALL10BSETW#HALTED,CSTQOFST(A6)‚setthisentrystatustohalted5ADDA.L#GPIBQLEN,A6‰bumppointertonextqueueentry&CMPA.LA6,A0attheendofthequeue?BNE.SHLTALL20Žbr=no6LEA.LGPIBQ(A5),A6Šelsewraparoundtostartofqueue*>HLTALL20 CMPA.L QHEAD(A5),A6 at the end of all queued entries?'BNE.SHLTALL10Žbranchifno-continue*< BCLRW #SRQWAIT,BUSACTIV(A5) clear any potential SRQ waiting=BTSTW#BUSIOP,BUSACTIV(A5)‚isthependingI/Ointerruptset?BNE.SHLTALL30Žbranchifyes-CLR.BIOPEND(A5)ŒresetpendingtaskI/Oflag*>HLTALL30 MOVE.L QTAIL(A5),A6 A6 <== current operation on queueMOVE.LDCBQOFST(A6),A4†getDCB!MOVE.LIPBQOFST(A6),A3†getIOSPB8BSRPROCMENUcleanupandsendhaltstoqueuedcommands BRA.S HLTOK 4 TTL GPIB DRIVER - COMMON SUBROUTINES (HALT COMMAND) PAGE*6*ˆHaltI/OtoaspecificdeviceortheBUSinT/Lmode*HLTCMD:1MOVE.LQTAIL(A5),A6ƒgetpointertocurrententry(CMPA.LQHEAD(A5),A6‰isthequeueempty?(BEQ.SHLTXITbr=yes(nothingtohalt)*+MOVEM.LD2-D7/A1-A6,-(A7)ƒsaveenvironment9*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *ˆ4/24/84ƒbwn**ˆFixanOOPS!#*LEA.LGPIBQEND,A0‹setend-of-queue LEA.L GPIBQEND(A5),A0*>*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<**ˆLocatethecommand*1HLTC60 CMPA.L DCBQOFST(A6),A4 is this the device?BEQ.SHLTC80br=yes*'ADD  A.L#GPIBQLEN,A6‰bumptonextentryCMPA.LA6,A0endofqueue?BNE.SHLTC70br=no*0LEA.LGPIBQ(A5),A6Šelseresettostartofqueue*HLTC70CMPA.LQHEAD(A5),A6ƒendofentries?(BNE.SHLTC60br=no,continuechecking:BRA.SHLTERRentrynotfound,returnerrortoIOSrequest*5HLTC80 BSETW #HALTED,CSTQOFST(A6) mark command halted+CMPA.LQTAIL(A5),A6‰isitthecurrentI/O?BNE.SHLTOK‘br=no**BSRRESETIO‘terminateanyI/Oinprogress3MOVE.LIPBQOFST(A6),A3†setpointertouser'sIOSPBBSRPROCMENUcancelcommand0BTSTW#BUSIOP,BUSACTIV(A5)‚anyBUSI/Opending?BNE.SHLTOK‘br=yes8AND.B#$3F,IOPEND(A5)‡elseclearpendingtaskI/OFLAGS*3HLTOKMOVEM.L(A7)+,D2-D7/A1-A6ƒrestoreenvironment2HLTXITMOVEQ#ISTAOK,D1†setgooderrorreturncode RTS*+HLTERRMOVE.B#$FF,D1ˆseterrorreturncode.MOVEM.L(A7)+,D2-D7/A1-A6ƒrestoreenvironment RTS 7 TTL GPIB DRIVER - COMMON SUBROUTINES (BUILD NEXT MENU) PAGE**ƒBUILDNEWMENUITEM*:*ˆThisroutinewillsetupallthemenupointersnecessary<*ˆtoexecutethenextcommand.Sincethecommandhasalready9*ˆbeenvalidated,ifitisnotnowfoundintheIOSCMDTB,;*ˆthisroutinewillreturnaruntimeerrorcodetoIOSand*ˆthecommandwillbeaborted.*3*ENTER:‚A3=addressofIOSPBforcurrentfunction*—A5=addressofCCB*!*RegisterUsage:…01234567*žD‚** *žA‚*…PƒP* BUILDMEN:6MOVE.WIOSFCT(A3),D0ˆextractcurrentfunctioncommand4LEA.LIOSCMDTB(PC),A0‡tableofvalidGPIBfunctions;MOVE.L#NUMCMDS-1,D1ˆD1=numberofcommandsinGPIBtable*<*‚FindthefunctioninthetableofavailableGPIBfunctions*9BUILDM10CMP.W(A0)+,D0…comparetonextfunctionintableBEQ.SBUILDM20foundfunction?%DBRAD1,BUILDM10‹no,continuesearch*=*‚ERROR:Thisisanirrecoverableerrorbecausethisfunction9*‰wasvalidatedpreviouslyandnowamatchdidnotoccur.(*‰Somebodyoverrantheparameterbuffer.*:BUILDM15MOVEQ‚#ISTADRVE,D1‚setdriverruntimeerrorcodeRTSšexitwitherror*.*‚Matchhasbeenfoundsosetupmenupointers*JBUILDM20 MOVE.L #NUMCMDS-1,D0 subtract index from total number of commands SUB.L D1,D0ASL.L#1,D0getwordoffset9LEA.LCTLCFTBL(PC),A0…tableofcontrollermenufunctions3BTSTW#CAC_S,BUSACTIV(A5)‚GPIBincontrollermode?BNE.SBUILDM30ŒbranchifyesELEA.LTLCFTBL(PC),A0†no,settableoftalker/listenermenufunctions*;BUILDM30MOVE.W0(A0,D0.W),D1ƒgetrelativedistanceofmenu?BEQ.SBUILDM15ŠthisshouldneverhappenbutdothisifitdoesILEA.L0(A0,D1.W),A0…getabsolutepointertomenutableforthisfunction+MOVE.LA0,MENU(A5)†settopofmenupointer2MOVE.LA0,MENUNPOS(A5)‚setnextmenuitempointerMOVEQ‚#ISTAOK,D1‡goodreturn RTS•exit3 TTL GPIB DRIVER - COMMON SUBROUTINES (QUEUE EVENT) PAGED*********************************************************************5*‰QUEUEACOMPLETIONEVENTTOTHEATTACHEDTASK(IOS)*;*‰ThisroutinecallstheexectosendasmalleventtoIOS.9*‰UsesQEVNTIifwe'reprocessinganinterruptandQEVNTT*‰ifwe'renot.*8*‰NOTE:‚Thisroutineiscompletelyre-entrantandmaybe2*runatanytime.‚Allworkiscompletelyregister3*oriented.‚Allmessagesareassumedtobe10bytes*inlength!!!!!!**‰Entry:D1.W=eventstatus*D4.B=eventtype*A4=addressofDCB.*A5=addressofCCB.**‰Exit:‚D0=garbage.*D1=garbage.*;*‰Thestructureoftheeventyoumustsupplyisasfollows:*‹BYTES‚MEANING@*‰*ƒ1„eventlengthassumingnoserviceaddress(always10bytes)4*‰*ƒ1„eventcode(1ifnoserviceaddress,else$81)*1„eventtype*‰*ƒ1„channelkey<*‰*ƒ4„ID(DCBaddressforussincewe'reastandardchannel)*2„statusvalue*@*‰Fieldsmarkedby*areplacedintheeventbythisroutineand%*‰neednotbepreparedbythecaller.@*‰IfaserviceaddresswasspecifiedfortheI/O,itisinsertedD*‰beforetheeventtypefield,andeventlengthisu pdateby4bytes>*‰andtheeventcodewillbemodifiedtoindicateacompletion:*‰serviceaddressispresent(MSBofeventcodeisa"1").*J************************************************************************** QEVENT:>ŠMOVEM.LD2-D7/A0-A6,-(A7)Savetheregisterswe'llblowaway.*0*‚Startsettingthosevalueswhichneverchange.*!ŠMOVE.WD1,D6’D6<==eventstatusBŠMOVE.W#(10*256)+IOEVCD,D2„D2<==prepareeventlength/eventcode#ŠMOVE.LA4,D5’D5<==addressofDCB3ŠASL.W#8,D4“shifteventtypetoupperbyteofword7ŠMOVE.BCCBKEY(A5),D4ŠSetthechannelkeyinlowerbyte0ŠAND.L#$FF,D6‘clearupperbytesofeventstatus*C*‚Iftherewasaserviceaddressspecified,gobackandfixthings.*AŠMOVE.LCCBSVVC(A5),D3…isacompletionserviceaddressspecified?ŠBEQ.SQEVT010branchifno*-ŠADDI.W#4*256,D2ŠadjusteventlengthforCSA7ŠMOVE.B#$80+IOEVCD,D2…adjusteventcodetosetCSAbit***ˆStageallregistersforeventprocessing*-QEVT010ƒSWAPD2“stageeventlength/eventcodeŠTST.LD3’anyCSAspecified?ŠBEQ.SQEVT020branchifno*,*ˆStageregistersforeventwithCSAaddress*ŠSWAPD3 ŠMOVE.WD3,D2 ŠMOVE.WD4,D3 ŠMOVE.LD5,D4 ŠMOVE.LD6,D5ŠSWAPD5ŠBRA.SQEVT030*3*ˆStageallregistersforeventwithnoCSAaddress*QEVT020ƒMOVE.WD4,D2 ŠMOVE.LD5,D3 ŠMOVE.LD6,D4ŠSWAPD4 ŠCLR.LD5*&*‚Dotheexeccalltoqueuetheevent.*FQEVT030ƒMOVE.LCCBRQSTA(A5),A0„A0<--addressofTCBofattachedtask.0ŠMOVEQ‚#T0QEVNTI,D0‡D0<--theQEVNTIdirective.7ŠTST.B‚BINTCNT(A5)ˆIfwe'renotqueueingtheeventfrom(ŠIF…THENŠwithintheinterrupttour,0ŠMOVEQ‚#T0QEVNTT,D0‡D0<--theQEVNTTdirective.ŠENDI–* *ŠTRAPƒ#0‘Calltheexectoqueuetheevent. ŠBRA„OKEVENTŒIfgood,goreturn.(ŠTR0$.KILLER,Ifbad,crashthesystem. COKEVENTƒMOVEM.L(A7)+,D2-D7/A0-A6Restoretheregistersandreturn.ŠRTS—* 4 TTL GPIB DRIVER - INTERRUPT PROCESSING (SEND EVENT) PAGEF*********************************************************************** *‚SENDUEVT*5*ˆThepurposeofthistask‚istosendaneventtothe9*„usertaskfromthedeviceI/Odriver.‚Thistaskmustbe7*„runatinterruptlevelorelsethesystemwillcrash.:*„Currentlythereare7reasonsforthiseventontheGPIB>*„andtheyare:SRQ,RLC,DCL,TCT,GET,IFC,andI/Opending.**ˆENTER:‚D0.B=eventtype*D1.B=eventstatus3*A4.L=addressofDCBofdeviceassoc.withevent*A5.L=addressofCCB*.*ˆEXIT:ƒeventwassentorelsesystemcrashed.* *’RegisterUsage‚01234567* D** * A*‡PP*9*ˆNOTE:ƒTheentrypointSENDUEVS:isusedwhenanon-zero6*eventstatus(passedinD1.B)willbesentinevent.%*OtherwiseuseSENDUEVTentrypoint.*6*ˆNOTE:‚Thisroutinewillchecktoseethatthedevice-*specifiedbytheDCBpointerisopenbefore0*tryingtosendtheevent.‚Ifthedeviceisnot1*open,anattemptwillbemadetosendtheevent.*totheBUS.‚IftheBUSisnotopentheevent*willbediscarded.*C******************************************************************* SENDUEVT:&MOVEQ#0,D1‰preloadzeroeventstatus*DSENDUEVS: MOVEM.L D2-D7/A0-A6,-(A7) save regs that may get destroyed6TST.B‚BINTCNT(A5)ƒmakesureweareatinterruptlevelBBEQ.S‚SENDUEOK†br=no,fatalerror!BUTDON'TCRASH,justignore; MOVE.L DCBAID(A4),A2 A2 = DCB I.D. of event causing device*9SENDUE05 TST.L DCBTSK(A4) is this device claiming Events?/BNE.SSENDUE07‹branch=yes,gosendtheevent1TST.BDCBCDV(A4)‰isthisdevicealreadytheBUS?3BEQ.SSENDUEOKbr=yes,thenthrowtheeventaway)MOVE.LDCBSUP(A4),A4‡elsegotrytheBUSBRA.SSENDUE05Žgotryagain!*7SENDUE07ASL.W#8,D0‡putAsynceventtypeinhighbyte,&MOVE.BD1,D0†addineventstatusbyteMOVE.WD0,-(A7)ƒsaveonstack/MOVE.LA2,-(A7)ƒsavedeviceI.D.dataonstackK MOVE.W #(AILNG*256)+AIEVCD,-(A7) PUSH event length + Async event type code*.MOVE.LDCBSES(A4),D1‚D1=tas ksessionnumber$MOVE.LDCBTSK(A4),A0‚A0=taskname.MOVEQ#13,D0†Call'GTXTCB'fortherightinfo TRAP #0) BRA.S SENDUE10 good, A0 = address of TCB'MOVEM.L(A7)+,D2-D3‚Cleanupthestack( BRA.S SENDUEOK bad, go throw away event*BSENDUE10MOVEM.L(A7)+,D2-D3ƒstagetheregistersforRMS68KQEVENT.MOVEQ#T0QEVNTI,D0‚initiateQEVENTIdirective TRAP #0NOPŒgoodevent*5*ƒIfwereturnheredirectlytheeventwasn'tqueued!!*ˆIgnoretheerrorandkeepgoing*6SENDUEOK MOVEM.L (A7)+,D2-D7/A0-A6 restore environment RTS éééééé' TTL GPIB MENU ITEM TABLE - GPIB TABLES PAGEE********************************************************************** *COMMANDI/OMENUDRIVERTABLES*E**********************************************************************=*…THEFOLLOWINGCOMMANDI/OMENUSAREUSEDTOCOORDINATEGPIB<*…TRANSMISSIONPROTOCOLONTHEBUS.MENUSAREGENERATEDEACH:*…TIMEAREQUESTFROMIOSISMADETOTHEDRIVER.EACHMENU=*…CONSISTSOFSEVERALMENUITEMSEACHOFWHICHHASASPECIFIC?*…TASKTOACCOMPLISHORINITIATE.ONLYONEMENUMAYBEEXECUTED?*…ATATIMEANDANYREQUESTSFORI/OTHATOCCURWHILEEXECUTINGA*…AMENUAREQUEUEDUPANDWILLBEPROCESSEDWHENITSTURNCOMES.9*…MENUITEMSCONSISTOFESSENTIALLYFOURDIFFERENTTYPES:**…1.COMMANDITEMS(BUSCMD)*?*ˆTHESEWILLSENDIEEE-488COMMANDSTOTHEGPIBCINTERFACEWITH@*ˆTHEATNLINETRUE.ALLTHESETYPESAREDESIGNATEDBYTHEMACRO*ˆBUSCMD.*&*…2.AUXILLIARYCOMMANDITEMS(AUXCMD)*5*ˆAUXILLIARYCOMMANDSAREMENUITEMSTHATAREWRITTEN<*ˆDIRECTLYTOTHEAUXILIARYCOMMANDREGISTEROFTHETMS9914A?*ˆREGARDLESSOFTHETHESTATEOFTHEATNLINEANDAREGENERATED*ˆBYAUXCMDMACROCALL.*,*…3.DATAINPUT/OUTPUTMENUITEMS(DATAXFER)*@*ˆTHESEINITIATETHEACTUALDATADMATRANSFER.THECOMPLETIONOF@*ˆTHESECOMMANDSISPROMPTEDBYANI/OCOMPLETEINTERRUPTBYTHE3*ˆGPIBC.THESETYPESARECALLEDWITHDATAXFR.*#*…4.FUNCTIONMENUITEMS(FUNCTION)*7*ˆTHESECAUSESOMESORTOFMENUFUNCTIONTOTAKEPLACE.>*ˆFOREXAMPLE,THEFUNCTIONMENUITEMSIGNIFIESTHETHIS>*ˆMENUPACKETISCOMPLETEANDTHATTHEMENUPROCESSORISREADY?*ˆFORANEWMENU.ALLTHESETYPESOFCOMMANDSAREPREFIXEDWITH *ˆTHEMACROCALLFUNCTION.*D************ ******************************************************** SECTION 0 DS 0*D**********************************************************************ˆFUNCTION:INPUTDATA*?*ˆFUNCTIONCODETOINITIATEMENU:IOREAD‚(CONTROLLERMODEONLY)* Ñ6ÚBâ?êAò@úB@ DCF"?*02+:0B<J5R(Z/<*ˆPURPOSE:TOINITIATEDMAWRITE(WRITEINTOMEMORY)OFDATA*C********************************************************************INP_DATABUSCMDUNT„UNTALKˆBUSCMDUNL„UNLISTEN%ˆBUSCMDOTA„SENDPRIMARYTALKADDRESSˆDATAXFRIN„DMAWRITE(INPUT)ˆBUSCMDUNT„UNTALKˆFUNCTIONEND„ENDOFMENUˆDS.W0ŠASSUREWORDALIGNMENT*C*********************************************************************ˆFUNCTION:OUTPUTDATA*?*ˆFUNCTIONCODETOINITIATEMENU:IOWRIT(CONTROLLERMODEONLY)*:*ˆPURPOSE:TOINITIATEDMAREAD(READFROMMEMORY)OFDATA*D*********************************************************************OUT_DATABUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN'‰BUSCMDLAGˆSENDPRIMARYLISTENADDRESS‰DATAXFROUT‡DMAREAD(OUTPUT)#‰DATAXFRTERM†SENDTERMINATINGCHAR'‰DATAXFRSEOI†SEND'EOI'WITHLASTBYTE‰BUSCMDUNLˆUNLISTEN‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*D**********************************************************************ˆFUNCTION:OUTPUTWITHINPUT*?*ˆFUNCTIONCODETOINITIATEMENU:IOOWIN‚(CONTROLLERMODEONLY)*8*ˆPURPOSE:TOPERFORMANDOUTPUTFUNCTIONFOLLOWEDBYAN'*‘INPUTFUNCTIONWITHONEMENUREQUEST.*D*********************************************************************OWI_DATABUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN'‰BUSCMDLAGˆSENDPRIMARYLISTENADDRESS'‰DATAXFROUT‡INITIATEDMAREAD(OUTPUT)&‰DATAXFRTERM†SENDTERMINATINGCHAR(S)'‰DATAXFRSEOI†SEND'EOI'WITHLASTBYTE‰BUSCMDUNLˆUNLISTEN%‰BUSCMDOTAˆSENDPRIMARYTALKADDRESS&‰DATAXFRINˆINITIATEDMAWRITE(INPUT)‰BUSCMDUNTˆUNTALK‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E***********************************************************************ˆFUNCTION:REQUESTSTATUS*3*ˆFUNCTIONCODETOINITIATEMENU:IOSTATƒ(ANYMODE)*7*ˆPURPOSE:‚STANDARDIOSREQUESTSTATUSFUNCTIONCOMMAND*E**********************************************************************)REQ_STATFUNCTIONFREQSTATƒREQUESTSTATUS‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E********************************************************************** *ˆFUNCTION:CHANGECONFIGURATION*3*ˆFUNCTIONCODETOINITIATEMENU:IOCNFGƒ(ANYMODE)*=*ˆPURPOSE:‚STANDARDIOSCHANGECONFIGURATIONFUNCTIONCOMMAND*E**********************************************************************6CNFG_DEVFUNCTIONFCNFGDEVƒCHANGEDEVICECONFIGURATION‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E**********************************************************************(*ˆFUNCTION:CHANGEDEFAULTCONFIGURATION*3*ˆFUNCTIONCODETOINITIATEMENU:IOCHDC‚(ANYMODE)*7*ˆPURPOSE:‚STANDARDIOSCHANGEDEFAULTFUNCTIONCOMMAND*E**********************************************************************7CH_DEFLTFUNCTIONFCHDEFLTƒCHANGEDEFAULTCONFIGURATION‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*D*********************************************************************"*ˆFUNCTION:COMMANDOUT/DATAOUT*?*ˆFUNCTIONCODETOINITIATEMENU:IOCODO‚(CONTROLLERMODEONLY)*9*ˆPURPOSE:TOALLOWTHEUSERTOSENDNON-STANDARDCOMMAND1*‘SEQUENCES(ATNTRUE)FOLLOWEDBYADATASTRING.*D*********************************************************************7CDAT_OUTBUSCMDAUXˆSENDCOMMANDSTRINGFROMAUXBUFFER‰BUSCMDUNTˆUNTALK'‰DATAXFROUT‡INITIATEDMAREAD(OUTPUT)#‰DATAXFRTERM†SENDTERMINATINGCHAR'‰DATAXFRSEOI†SEND 'EOI'WITHLASTBYTE‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E**********************************************************************!*ˆFUNCTION:COMMANDOUT/DATAIN*?*ˆFUNCTIONCODETOINITIATEMENU:IOCODI‚(CONTROLLERMODEONLY)*;*ˆPURPOSE:TOALLOWTHEUSERTOSENDANON-STANDARDCOMMAND-*‘SEQUENCE(ATNTRUE)FOLLOWEDBYANINPUTOF*‘DATACOMMAND.*E**********************************************************************6CDAT_IN‚BUSCMDAUXˆSENDCOMMANDSTRINGFROMAUXBUFFER%‰DATAXFRINˆINTIATEDMAWRITE(INPUT)‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E***********************************************************************ˆFUNCTION:COMMANDOUT*?*ˆFUNCTIONCODETOINITIATEMENU:IOCMDO‚(CONTROLLERMODEONLY)*;*ˆPURPOSE:TOALLOWTHEUSERTOSENDANON-STANDARDCOMMAND*‘SEQUENCE(ATNTRUE).*E**********************************************************************6CMD_OUT‚BUSCMDAUXˆSENDCOMMANDSTRINGFROMAUXBUFFER‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E**********************************************************************"*ˆFUNCTION:READSECONDARYADDRESS*?*ˆFUNCTIONCODETOINITIATEMENU:IORSEC‚(CONTROLLERMODEONLY)*8*ˆPURPOSE:SIMILARTOINPUTDATAEXCEPTTHATASECONDARY*‘ADDRESSMUSTBESPECIFIED.*E**********************************************************************READ_SECBUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN ‰BUSCMDOTAˆPRIMARYTALKADDRESS‰BUSCMDOSAˆSECONDARYADDRESS&‰DATAXFRINˆINITIATEDMAWRITE(INPUT)‰BUSCMDUNTˆUNTALK‰FUNCTIONEND…ENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENTE**********************************************************************#*ˆFUNCTION:WRITESECONDARYADDRESS*?*ˆFUNCTIONCODETOINITIATEMENU:IOWSEC‚(CONTROLLERMODEONLY)*9*ˆPURPOSE:SIMILARTOOUTPUTDATAEXCEPTTHATASECONDARY*‘ADDRESSMUSTBESPECIFIED*D*********************************************************************WRITE_SECBUSCMDUNT‡UNTALK‰BUSCMDUNLˆUNLISTEN"‰BUSCMDLAGˆPRIMARYLISTENADDRESS‰BUSCMDOSAˆSECONDARYADDRESS'‰DATAXFROUT‡INITIATEDMAREAD(OUTPUT)2‰DATAXFRTERM†SENDTERMINATIONCHAR(IFNECESSARY)'‰DATAXFRSEOI†SEND'EOI'WITHLASTBYTE‰BUSCMDUNLˆUNLISTEN‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*C********************************************************************%*ˆFUNCTION:UNCONFIGUREPARALLELPOLL*>*ˆFUNCTIONCODETOINITIATEMENU:IOPPU‚(CONTROLLERMODEONLY)*1*ˆPURPOSE:TORESETALLDEVICESOFTHEIRPARALLEL*‘POLLCONFIGURATIONSTATE.*C********************************************************************5PP_UNCFGBUSCMDPPUˆPARALLELPOLLUNCONFIGURECOMMAND‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*B*******************************************************************#*ˆFUNCTION:CONFIGUREPARALLELPOLL*>*ˆFUNCTIONCODETOINITIATEMENU:IOPPC‚(CONTROLLERMODEONLY)*6*ˆPURPOSE:TOCONFIGUREWHICHOF8PARALLELPOLLLINES+*‘THESPECIFIEDDEVICEISTORESPONDONWHEN*‘PARALLELPOLLED.*A******************************************************************PP_CNFIGBUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN"‰BUSCMDLAGˆPRIMARYLISTENADDRESS+‰BUSCMDPPCˆPARALLELPOLLCONFIGURECOMMAND(‰BUSCMDPPEˆSENDPOLLANDSENSEBITINFO‰BUSCMDUNLˆUNLISTEN‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*@*****************************************************************!*ˆFUNCTION:CONDUCTPARALLELPOLL*?*ˆFUNCTIONCODETOINITIATEMENU:IOPPOL(CONTROLLERMODEONLY)*=*ˆPURPOSE:ALLOWACTIVECONTROLLERTOPARALLELALLCONFIGURED-*‘DEVICES(I.E.DEVICESWHOAREPARALLELPOLL'*‘CONFIGURED)ANDRECEIVETHEIRSTATUS.*B*******************************************************************-COND_PP‚AUXCMDTCSŠTAKECONTROLSYNCHRONOUSLY,‰FUNCTIONFRPP‡REQUESTPARALLELPOLLROUTINE‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSURE WORDALIGNMENT*E**********************************************************************$*ˆFUNCTION:SETPARALLELPOLLSTATUS*8*ˆFUNCTIONCODETOINITIATEMENU:IOSPPS‚(T/LMODEONLY)*:*ˆPURPOSE:‚SETUPTHEPARALLELPOLLRESPONSEBIT(PPR)AND*’THESENSEBIT(S).*E**********************************************************************/SET_PPƒFUNCTIONFSETPP…SETPARALLELPOLLSTATUS‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*E**********************************************************************"*ˆFUNCTION:SETSERIALPOLLSTATUS*8*ˆFUNCTIONCODETOINITIATEMENU:IOSSPS(T/LMODEONLY)*5*ˆPURPOSE:‚SETTHEVALUETOBERETURNEDTOTHEACTIVE'*’CONTROLLERWHENWEARESERIALPOLLED.*E**********************************************************************-SET_SPƒFUNCTIONFSETSP…SETSERIALPOLLSTATUS‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*C********************************************************************'*ˆFUNCTION:DEVICESTATUS(SERIALPOLL)*?*ˆFUNCTIONCODETOINITIATEMENU:IOSPOL(CONTROLLERMODEONLY)*2*ˆPURPOSE:CONDUCTSERIALPOLLOFSPECIFIEDDEVICE*B*******************************************************************COND_SP‚BUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN#‰BUSCMDSPEˆSENDSERIALPOLLENABLE%‰BUSCMDOTAˆSENDPRIMARYTALKADDRESS%‰DATAXFRSPB‡RECEIVESERIALPOLLBYTE"‰BUSCMDSPDˆLEAVESERIALPOLLMODE‰BUSCMDUNTˆUNTALK‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*C********************************************************************!*ˆFUNCTION:PARALLELPOLLDISABLE*>*ˆFUNCTIONCODETOINITIATEMENU:IOPPD‚(CONTROLLERMODEONLY)*@*ˆPURPOSE:TODISABLEADEVICEFROMSENDINGASTATUSBITMESSAGE!*‘INRESPONSETOAPARALLELPOLL.*C********************************************************************PP_DISABBUSCMDUNTˆUNTALK‰BUSCMDUNLˆUNLISTEN ‰BUSCMDLAGˆLISTENADDRESSGROUP#‰BUSCMDPPCˆPARALLELPOLLCONFIGURE)‰BUSCMDPPDˆPARALLELPOLLDISABLECOMMAND‰BUSCMDUNLˆUNLISTEN‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*C*********************************************************************ˆFUNCTION:INTERFACECLEAR*C*ˆFUNCTIONCODETOINITIATEMENU:IOSIFC(SYSCONTROLLERMODEONLY)*1*ˆPURPOSE:TOALLOWTHESYSTEMCONTROLLERTOSEND**‘THEINTERFACECLEARCOMMANDTOTHEGPIBC*C********************************************************************'INTF_CLRFUNCTIONFSIC…SENDIFCCOMMAND‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*C*********************************************************************ˆFUNCTION:REMOTEENABLE*C*ˆFUNCTIONCODETOINITIATEMENU:IOSREN(SYSCONTROLLERMODEONLY)*1*ˆPURPOSE:TOALLOWTHESYSTEMTOSENDTHEREMOTE*‘ENABLEMESSAGETOTHEGPIBC.*C********************************************************************.REM_ENABAUXCMDSRE1ˆSENDREMOTEENABLE(CS=1)‰FUNCTIONEND‰ENDOFMENU‰DS.W0ASSUREWORDALIGNMENT*C*********************************************************************ˆFUNCTION:REMOTEDISABLE*C*ˆFUNCTIONCODETOINITIATEMENU:IOCREN(SYSCONTROLLERMODEONLY)*1*ˆPURPOSE:TOALLOWTHESYSTEMTOSENDTHEREMOTE*‘DISABLEMESSAGETOTHEGPIBC.*C********************************************************************/REM_DNABAUXCMDSRE0ˆSENDREMOTEDISABLE(CS=0)‰FUNCTIONEND‰ENDOFMENU‰DS.W0ASSUREWORDALIGNMENT*C********************************************************************2*ˆFUNCTION:ENTRYI:ABORTBUSANDDEVICEMESSAGES*’ENTRYII:‚CLEARALLDEVICES*F*ˆFUNCTIONCODETOINITIATEMENU:I.IOABT1(SYSCONTROLLERMODEONLY)#*¨II.IOSDCL(CONTROLLERMODEONLY)*7*ˆPURPOSE:TOHALTALLACTIVITYONTHEGPIBCBYSENDING/*‘THEINTERFACECLEARANDDEVICECLEARMESSAGES*C********************************************************************2S_IFCDCLFUNCTIONFSIC‡SENDINTEFACECLEARCOMMAND*S_ DCL„BUSCMDDCLŠSENDDEVICECLEARCOMMAND‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*C********************************************************************%*ˆFUNCTION:LOCALLOCKOUTALLDEVICES*?*ˆFUNCTIONCODETOINITIATEMENU:IOSLLO‚(CONTROLLERMODEONLY)*-*ˆPURPOSE:ALLOWUSERTOSENDOUTLLOCOMMAND*C********************************************************************$S_LOCLOKBUSCMDLLOŠSENDLLOCOMMAND‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*C********************************************************************!*ˆFUNCTION:ABORTDEVICEMESSAGES*?*ˆFUNCTIONCODETOINITIATEMENU:IOABT2(CONTROLLERMODEONLY)*0*ˆPURPOSE:TOHALTANYI/OTODEVICES‚BYSENDING"*‘THEUNTALKANDUNLISTENCOMMANDS*B*******************************************************************S_UNTUNLBUSCMDUNTŠSENDUNTALK‰BUSCMDUNLŠSENDUNLISTEN‰FUNCTIONENDŠENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*A*******************************************************************ˆFUNCTION:TAKECONTROL*?*ˆFUNCTIONCODETOINITIATEMENU:IOTCTL(CONTROLLERMODEONLY)*1*ˆPURPOSE:TOALLOWUSERTOREGAINCONTROLOFTHE)*‘BUSATANYTIMEPROVIDEDHEHASCONTROL-*‘OFTHEBUSANDHASCONTROLLERCAPABILITIES.*A******************************************************************/TAKE_CTLFUNCTIONFTAKCTL‚TAKECONTROLFUNCTION‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*A*******************************************************************ˆFUNCTION:GOTOSTANDBY*>*ˆFUNCTIONCODETOINITIATEMENU:IOGTS(CONTROLLERMODEONLY)*2*ˆPURPOSE:TOALLOWUSERTORELEASECONTROLOFTHE)*‘BUSATANYTIMEPROVIDEDHEHASCONTROL-*‘OFTHEBUSANDHASCONTROLLERCAPABILITIES.*A******************************************************************,GO_STBY‚FUNCTIONFGTS…GOTOSTANDBYFUNCTION‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT    A*******************************************************************ˆFUNCTION:REQUESTCONTROL*(*ˆFUNCTIONCODETOINITIATEMENU:IORQCL*5*ˆPURPOSE:TOALLOWUSERTOINITIALLYTAKECONTROLOF-*‘THEBUSAFTERTHESYSTEMISINITIALIZEDAND'*‘THEMVME-300HASCOMEUPINT/LMODE./*‘THISCOMMANDWILLPUTTHETMS9914INTO'CACS'.*‘ANDALLOWNORMALCONTROLLERFUCTIONSWITHOUT!*‘HAVETOBEASYSTEMCONTROLLER.*A******************************************************************1REQ_CTL‚FUNCTIONFREQCTL‚REQUESTCONTROLFUNCTION‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*A*******************************************************************ˆFUNCTION:RELEASECONTROL*(*ˆFUNCTIONCODETOINITIATEMENU:IORLCL*2*ˆPURPOSE:TOALLOWUSERTOGIVEUPCONTROLOFTHE)*‘BUSATANYTIMEPROVIDEDHEHASCONTROL+*‘OFTHEBUS.‚THISCOMMANDSIMPLYDROPSTHE+*‘ATNLINEONTHEBUSANDSWITCHESTHEGPIB%*‘DRIVERFROMCONTROLLERTOT/LMODE.#*‘(THE9914GOESINTO'CIDS'STATE)*A******************************************************************1REL_CTL‚FUNCTIONFRELCTL‚RELEASECONTROLFUNCTION‰FUNCTIONEND†ENDOFMENU‰DS.W0ŒASSUREWORDALIGNMENT*A*******************************************************************ˆFUNCTION:PASSCONTROL*?*ˆFUNCTIONCODETOINITIATEMENU:IOPCTL(CONTROLLERMODEONLY)*3*ˆPURPOSE:TOALLOWUSERTOPASSCONTROLTOANOTHER)*‘DEVICEONTHEBUSCAPABLEOFCONTROLLER*‘RESPONSIBILITIES.*B*******************************************************************PASS_CTLBUSCMDUNTŠSENDUNTALK‰BUSCMDUNLŠSENDUNLISTEN%‰BUSCMDOTAŠSENDPRIMARYTALKADDRESS‰BUSCMDTCTŠSENDTAKECONTROL/‰FUNCTIONFRELCTL„ISSUERELEASECONTROLCOMMAND‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*A******************************************************************"*ˆFUNCTION:CLEARSPECIFIEDDEVICE*?*ˆFUNCTIONCODETOINITIATEMENU:IOSSDC‚(CONTROLLERMODEONLY)*$*ˆPURPOSE: TOCLEARSPECIFIEDDEVICE*B*******************************************************************SPEC_CLRBUSCMDUNTŠUNTALK‰BUSCMDUNLŠUNLISTEN"‰BUSCMDLAGŠPRIMARYLISTENADDRESS"‰BUSCMDSDCŠSELECTIVEDEVICECLEAR‰BUSCMDUNLŠUNTALK‰FUNCTIONENDŠENDOFMENU‰DS.W0ŽASSUREWORDALIGNMNET*A******************************************************************%*ˆFUNCTION:CLEARADDRESSEDLISTENERS*?*ˆFUNCTIONCODETOINITIATEMENU:IODSDC‚(CONTROLLERMODEONLY)*!*ˆPURPOSE:TOCLEARALLLISTENERS*B********************************************************************ADDR_CLRBUSCMDSDCŠSELECTIVEDEVICECLEAR‰FUNCTIONENDŠENDOFMENU‰DS.W0ŽASSUREWORDALIGNMNET*A******************************************************************!*ˆFUNCTION:SPECIFIEDGOTOLOCAL*A*ˆFUNCTIONCODETOINITIATEMENU:IOSGTL‚(CONTROLLER&T/LMODES)*2*ˆPURPOSE:TOPUTSPECIFIEDLISTENERINLOCALMODE*B*******************************************************************SPEC_GTLBUSCMDUNTŠUNTALK‰BUSCMDUNLŠUNLISTEN"‰BUSCMDLAGŠPRIMARYLISTENADDRESS‰BUSCMDGTLŠGOTOLOCALCOMMAND‰BUSCMDUNLŠUNLISTEN‰FUNCTIONENDŠENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*A******************************************************************+*ˆFUNCTION:ADDRESSEDLISTENERSGOTOLOCAL*A*ˆFUNCTIONCODETOINITIATEMENU:IODGTL‚(CONTROLLER&T/LMODES)*3*ˆPURPOSE:TOPUTADDRESSEDLISTENERSINLOCALMODE*B*******************************************************************'ADDR_GTLBUSCMDGTLŠGOTOLOCALCOMMAND‰FUNCTIONENDŠENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*B*********************************************************************ˆFUNCTION:REMOTEENABLESPECIFIEDDEVICE*?*ˆFUNCTIONCODETOINITIATEMENU:IODREM‚(CONTROLLERMODEONLY)*5*ˆPURPOSE:TOPLACEASPECIFIEDDEVICEINREMOTEMODE*B*******************************************************************'SPEC_REMAUXCMDSRE1‰SENDREMOTEENABLE‰BUSCMDUNTŠUNTALK‰BUSCMDUNLŠUNLISTEN"‰BUSCMDLAGŠPRIMARYLISTENADDRESS‰BUSCMDUNLŠUNLISTEN‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*A******************************************************************$*ˆFUNCTION:TRIGGERSPECIFIEDDEVICE*?*ˆFUNCTIONCODETOINITIATEMENU:IOSGET‚(CONTROLLERMODEONLY)*(*ˆPURPOSE:TOTRIGGERASPECIFIEDDEVICE*>***************************************************************SPEC_GETBUSCMDUNTŠUNTALK‰BUSCMDUNLŠUNLISTEN"‰BUSCMDLAGŠPRIMARYLISTENADDRESS&‰BUSCMDGETŠSENDGROUPEXECUTETRIGGER‰BUSCMDUNLŠUNLISTEN‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*A******************************************************************'*ˆFUNCTION:TRIGGERADDRESSEDLISTENERS*?*ˆFUNCTIONCODETOINITIATEMENU:IODGET‚(CONTROLLERMODEONLY)*-*ˆPURPOSE:TOTRIGGERALLADDRESSEDLISTENERS*>***************************************************************.ADDR_GETBUSCMDGETŠSENDGROUPEXECUTETRIGGER‰FUNCTIONENDˆENDOFMENU‰DS.W0ŽASSUREWORDALIGNMENT*B*******************************************************************-*ˆFUNCTION:PRIMARYANDSECONDARYREADTOBUS*’ENTRYPOINTI:‚SECONDARYREAD*’ENTRYPOINTII:PRIMARYREAD*;*ˆFUNCTIONCODETOINITIATEMENU:I:IORSEC‚(T/LMODEONLY)*§II:IOREAD‚(T/LMODEONLY)*1*ˆPURPOSE:‚ALLOWOWNEROFBUSTOMAKEPRIMARYAND-*’SECONDARYREADREQUESTSFROMTHECONTROLLER *’INCHARGE.B*******************************************************************$RSEC_TLEQU*READSECONDARYADDRESS8INTL_DATDATAXFRINŠREADDATA‚(WHENCONTROLLERREQUESTS)FUNCTIONENDENDOFMENUDS.W0–ASSUREWORDALLIGNMENT*E**********************************************************************0*ˆFUNCTION:PRIMARYANDSECONDARYWRITEFROMBUS *’ENTRYPOINTI:‚SECONDARYWRITE*’ENTRYPOINTII:PRIMARYWRITE*;*ˆFUNCTIONCODETOINITIATEMENU:I:IOWSEC‚(T/LMODEONLY)*§II:IOWRIT‚(T/LMODEONLY)*1*ˆPURPOSE:‚ALLOWOWNEROF THEBUSTOMAKEPRIMARY0*’ANDSECONDARYWRITEREQUESTSTOTHECONTROLLER *’INCHARGE.*D*********************************************************************%WSEC_TLEQU*WRITESECONDARYADDRESS:OUTL_DATDATAXFROUT‰WRITEDATA‚(WHENCONTROLLERREQUESTS)8DATAXFRTERMSENDTERMINATIONCHARACTERS(IFNECESSARY)'DATAXFRSEOISEND'EOI'WITHLASTBYTEFUNCTIONENDENDOFMENUDS.W0–ASSUREWORDALLIGNMENT*B*******************************************************************1*ˆFUNCTION:OUTPUTWITHINPUTCOMMANDINT/LMODE*8*ˆFUNCTIONCODETOINITIATEMENU:IOOWIN‚(T/LMODEONLY)*7*ˆPURPOSE:‚COMBINATIONOFTHEPRIMARYWRITEFOLLOWEDBY%*’PRIMARYREADOPERATIONINT/LMODE.*B*******************************************************************:OITL_DATDATAXFROUTƒWRITEDATA(WHENCONTROLLERREQUESTS)&DATAXFRTERMŠSENDMESSAGETERMINATORS'DATAXFRSEOIŠSEND'EOI'WITHLASTBYTE0DATAXFRINŒREADDATA(WHENCONTROLLERREQUESTS)FUNCTIONENDŠENDOFMENUDS.W0ASSUREWORDALLIGNMENT TTL GPIB DRIVER - DRIVER TABLES PAGEB*************************************************************************´********’MENUITEMCODEJUMPTABLE•**À*/*†THISTABLEISINDEXEDBYTHEMENUELEMENTS.*7*†THEORDEROFTHISTABLEMUSTREMAINCONSISTENTWITH‡*%*†THEVALUESASSIGNEDTOEACHITEM.™********´*******B****************************************************************** MENUCTBL:DC.W0‘ENDOFMENUINDICATOR*DC.WSENDUNT-MENUCTBL‚UNTALKROUTINEADDR,DC.WSENDUNL-MENUCTBL‚UNLISTENROUTINEADDR:DC.WSENDLAG-MENUCTBL‚PRIMARYLISTENADDRROUTINEADDRESS8DC.WSENDOTA-MENUCTBL‚PRIMARYTALKADDRROUTINEADDRESS6DC.WSENDOSA-MENUCTBL‚SECONDARYR/WADDRROUTINEADDR=DC.WSENDPPU-MENUCTBL‚PARALLELPOLLUNCONFIGUREROUTINEADDR;DC.WSENDPPC-MENUCTBL‚PARALLELPOLLCONFIGUREROUTINEADDR8DC.WSENDPPE-MENUCTBL‚PARALLELPOLLENABLEROUTINEADDR9DC.WSENDPPD-MENUCTBL‚PARALLELPOLLDISABLEROUTINEADDR6DC.WSENDSPE-MENUCTBL‚SERIALPOLLENABLEROUTINEADDR7DC.WSENDSPD-MENUCTBL‚SERIALPOLLDISABLEROUTINEADDR0DC.WSENDDCL-MENUCTBL‚DEVICECLEARROUTINEADDR1DC.WSENDLLO-MENUCTBL‚LOCALLOCKOUTROUTINEADDR0DC.WSENDTCT-MENUCTBL‚PASSCONTROLROUTINEADDR:DC.WSENDSDC-MENUCTBL‚SELECTIVEDEVICECLEARROUTINEADDR/DC.WSENDGTL-MENUCTBL‚GOTOLOCALROUTINEADDR9DC.WSENDGET-MENUCTBL‚GROUPEXECUTETRIGGERROUTINEADDR5 DC.W SENDAUXS-MENUCTBL SEND AUXILIARY COMMAND STRINGC DC.W READDATA-MENUCTBL INITIATE DMA WRITE ROUTINE ADDR (READ DATA)C DC.W WRITDATA-MENUCTBL INITIATE DMA READ ROUTINE ADDR (WRITE DATA)B DC.W SENDTERM-MENUCTBL SEND TERMINATION CHARACTER(S) ROUTINE ADDR+DC.WREADSP-MENUCTBLƒREADSERIALPOLLBYTE5DC.WSENDEOI-MENUCTBL‚SEND'EOI'WITHLASTDATABYTE=DC.WAUXPROC-MENUCTBL‚GENERALAUXILIARYCOMMANDROUTINEADDR=DC.WSENDIFC-MENUCTBL‚SENDIFCCOMMANDROUTINEFUNCTIONADDRGDC.WSENDRPP-MENUCTBL‚SENDREQUESTPARALLELPOLLROUTINEFUNCTIONADDRDDC.WSENDRLC-MENUCTBLƒPERFORMRELEASECONTROLROUTINEFUNCTIONADDRADC.WSENDTCA-MENUCTBLƒPERFORMTAKECONTROLROUTINEFUNCTIONADDRDDC.WSENDRQC-MENUCTBLƒPERFORMREQUESTCONTROLROUTINEFUNCTIONADDR2DC.WREQSTAT-MENUCTBL‚REQUESTSTATUSROUTINEADDR4DC.WCNFGDEV-MENUCTBL‚CONFIGUREDEVICEROUTINEADDR@DC.WCHDEFLT-MENUCTBL‚CHANGEDEFAULTCONFIGURATIONROUTINEADDR:DC.WSETPP-MENUCTBL„SETPARALLELPOLLSTATUSROUTINEADDR8DC.WSETSP-MENUCTBL„SETSERIALPOLLSTATUSROUTINEADDR5DC.WSENDGTS-MENUCTBL‚GOTOSTANDBYFUNCTIONROUTINE*6MENUCLEN EQU (*-MENUCTBL)/2 NUMBER OF ENTRIES IN TABLE  PAGEC**************************************************************************µ********˜CONTROLLERŸ*'*ŒCODE/FUNCTIONMENUTABLEJUMPTABLE’**Á*1*†THISTABLECONTAINSTHEADDRESSESOFTHEMENUŽ*7*†TABLESFOREACHOFTHEGPIBCIOSFUNCTIONSTHATAREˆ*8*†VALIDINCONTROLLERONLYMODE.THISTABLEISINDEXED‡*8*†BYAMATCHIN'IOSCMDTB'.IFTHEENTRYISZERO,THIS‡*'*†MENUISINVALID INCONTROLLERMODE.˜**Á********µ*******C*******************************************************************%CTLCFTBLDC.WINP_DATA-CTLCFTBL‚INPUTDC.WOUT_DATA-CTLCFTBLƒOUTPUT)DC.WOWI_DATA-CTLCFTBLƒOUTPUTWITHINPUT&DC.WREQ_STAT-CTLCFTBLƒREQUESTSTATUS,DC.WCNFG_DEV-CTLCFTBLƒCHANGECONFIGURATION4DC.WCH_DEFLT-CTLCFTBLƒCHANGEDEFAULTCONFIGURATION,DC.WCDAT_OUT-CTLCFTBLƒCOMMANDOUT/DATAOUT*DC.WCDAT_IN-CTLCFTBL„COMMANDOUT/DATAIN"DC.WCMD_OUT-CTLCFTBL„COMMANDOUT&DC.WREAD_SEC-CTLCFTBLƒREADSECONDARY(DC.WWRITE_SEC-CTLCFTBLƒWRITESECONDARY1DC.WPP_UNCFG-CTLCFTBLƒPARALLELPOLLUNCONFIGURE/DC.WPP_CNFIG-CTLCFTBLƒPARALLELPOLLCONFIGURE,DC.WCOND_PP-CTLCFTBL„CONDUCTPARALLELPOLL.DC.WSET_PP-CTLCFTBL…SETPARALLELPOLLSTATUS,DC.WSET_SP-CTLCFTBL…SETSERIALPOLLSTATUS*DC.WCOND_SP-CTLCFTBL„CONDUCTSERIALPOLL-DC.WPP_DISAB-CTLCFTBLƒPARALLELPOLLDISABLE'DC.WINTF_CLR-CTLCFTBLƒINTERFACECLEAR%DC.WREM_ENAB-CTLCFTBLƒREMOTEENABLE&DC.WREM_DNAB-CTLCFTBLƒREMOTEDISABLE&DC.WS_DCL-CTLCFTBL†CLEARALLDEVICES3DC.WADDR_CLR-CTLCFTBLƒCLEARALLLISTENINGDEVICES%DC.WS_LOCLOK-CTLCFTBLƒLOCALLOCKOUT$DC.WPASS_CTL-CTLCFTBLƒPASSCONTROL-DC.WADDR_GTL-CTLCFTBLƒLISTENERSGOTOLOCAL)DC.WADDR_GET-CTLCFTBLƒLISTENERSTRIGGER2DC.WS_IFCDCL-CTLCFTBLƒINTERFACEANDDEVICECLEAR+DC.WS_UNTUNL-CTLCFTBLƒUNTALKANDUNLISTEN$DC.WTAKE_CTL-CTLCFTBLƒTAKECONTROLDC.W0“REQUESTCONTROL&DC.WREL_CTL-CTLCFTBL„RELEASECONTROL$DC.WGO_STBY-CTLCFTBL„GOTOSTANDBY.DC.WSPEC_CLR-CTLCFTBLƒSPECIFIEDCLEARDEVICE/DC.WSPEC_REM-CTLCFTBLƒSPECIFIEDREMOTEDEVICE0DC.WSPEC_GET-CTLCFTBLƒSPECIFIEDTRIGGERDEVICE-DC.WSPEC_GTL-CTLCFTBLƒSPECIFIEDGOTOLOCAL  PAGEC**************************************************************************TALKER/LISTENER–*******'*ŒCODE/FUNCTIONMENUTABLEJUMPTABLE’**Á*6*†THISTABLECONTAINSTHEADDRESSESOFTHEMENUITEM‰*6*†TABLEFOREACHOFTHEGPIBCIOSFUNCTIONSTHATARE‰*8*†VALIDINTALKER/LISTENERMODE.THISTABLEISINDEXED‡*7*†BYAMATCHIN'IOSCMDTB'.IFANENTRYISZERO,THENˆ*/*†THATMENUISINVALIDINTALK/LISTENERMODE.**Á********µ*******C*******************************************************************#TLCFTBLDC.WINTL_DAT-TLCFTBL‚INPUTDC.WOUTL_DAT-TLCFTBLƒOUTPUT(DC.WOITL_DAT-TLCFTBLƒOUTPUTWITHINPUT%DC.WREQ_STAT-TLCFTBLƒREQUESTSTATUS+DC.WCNFG_DEV-TLCFTBLƒCHANGECONFIGURATION3DC.WCH_DEFLT-TLCFTBLƒCHANGEDEFAULTCONFIGURATIONDC.W0’COMMANDOUT/DATAOUTDC.W0’COMMANDOUT/DATAINDC.W0’COMMANDOUT$DC.WRSEC_TL-TLCFTBL„READSECONDARY%DC.WWSEC_TL-TLCFTBL„WRITESECONDARY!DC.W0’PARALLELPOLLUNCONFIGUREDC.W0’PARALLELPOLLCONFIGUREDC.W0’CONDUCTPARALLELPOLL-DC.WSET_PP-TLCFTBL…SETPARALLELPOLLSTATUS+DC.WSET_SP-TLCFTBL…SETSERIALPOLLSTATUSDC.W0’CONDUCTSERIALPOLLDC.W0’PARALLELPOLLDISABLE&DC.WINTF_CLR-TLCFTBLƒINTERFACECLEARDC.W0’REMOTEENABLEDC.W0’REMOTEDISABLEDC.W0’CLEARALLDEVICES#DC.W0’CLEARALLLISTENINGDEVICESDC.W0’LOCALLOCKOUTDC.W0’PASSCONTROLDC.W0’LISTENERSGOTOLOCALDC.W0’LISTENERSTRIGGER"DC.W0’INTERFACEANDDEVICECLEARDC.W0’UNTALKANDUNLISTENDC.W0’TAKECONTROL%DC.WREQ_CTL-TLCFTBL„REQUESTCONTROLDC.W0’RELEASECONTROLDC.W0’GOTOSTANDBYDC.W0’SPECIFIEDCLEARDEVICEDC.W0’SPECIFIEDREMOTEDEVICE DC.W0’SPECIFIEDTRIGGERDEVICEDC.W0’SPECIFIEDGOTOLOCAL  PAGEC**************************************************************************µ*******!*’CODE/FUNCTIONIOSMATCHTABLE’**Á*6*†THISTABLECONTAINSTHECOMBINEDCODEANDFUNCTION‰*;*†FOREACHCOMMANDAVAILABLEINIOSTOABUSSABLEDEVICE.„*7*†WHENANIOSPARAMETERBLOCKISRECEIVED,THISTABLEˆ*8*†WILLBESCANNEDFORAMATCH.WHENFOUNDTHERELATIVE‡*5*†OFFSETINTHETABLEWILLINDEXINTO'CFMENUTB'TOŠ*:*†POINTTOTHEAPPRIORIATEMENUDRIVERFORTHATFUNCTION…*1*†THESECOMMANDSAREPASSEDINTHEIOSPBINTHEŽ**† PARAMETER'IOSFCT'.¨**Á********µ*******C*******************************************************************IOSCMDTBDC.WIOREAD„INPUTDC.WIOWRIT‡OUTPUTDC.WIOOWIN‡OUTPUTWITHINPUTDC.WIOSTAT‡REQUESTSTATUS!DC.WIOCNFG‡CHANGECONFIGURATION)DC.WIOCHDC‡CHANGEDEFAULTCONFIGURATION!DC.WIOCODO‡COMMANDOUT/DATAOUT DC.WIOCODI‡COMMANDOUT/DATAINDC.WIOCMDO‡COMMANDOUTDC.WIORSEC‡READSECONDARYDC.WIOWSEC‡WRITESECONDARY%DC.WIOPPUˆPARALLELPOLLUNCONFIGURE#DC.WIOPPCˆPARALLELPOLLCONFIGURE"DC.WIOPPOL‡CONDUCTPARALLELPOLL%DC.WIOSPPS‡SETPARALLELPOLLSTATUS#DC.WIOSSPS‡SETSERIALPOLLSTATUS DC.WIOSPOL‡CONDUCTSERIALPOLL!DC.WIOPPDˆPARALLELPOLLDISABLEDC.WIOSIFC‡INTERFACECLEARDC.WIOSREN‡REMOTEENABLEDC.WIOCREN‡REMOTEDISABLEDC.WIOSDCL‡CLEARALLDEVICES(DC.WIOSSDC‡CLEARALLLISTENINGDEVICESDC.WIOSLLO‡LOCALLOCKOUTDC.WIOPCTL‡PASSCONTROL"DC.WIOSGTL‡LISTENERSGOTOLOCALDC.WIOSGET‡LISTENERSTRIGGER'DC.WIOABT1‡INTERFACEANDDEVICECLEAR DC.WIOABT2‡UNTALKANDUNLISTENDC.WIOTCTL‡TAKECONTROLDC.WIORQCL‡REQUESTCONTROLDC.WIORLCL‡RELEASECONTROLDC.WIOGTSˆGOTOSTANDBY#DC.WIODSDC‡SPECIFIEDCLEARDEVICE$DC.WIODREM‡SPECIFIEDREMOTEDEVICE%DC.WIODGET‡SPECIFIEDTRIGGERDEVICE"DC.WIODGTL‡SPECIFIEDGOTOLOCAL*6NUMCMDSEQU(*-IOSCMDTB)/2‚NUMBEROFCOMMANDSINTABLE  PAGEF***********************************************************************.*ŽCOMMANDBUFFER/MODE/ABILITYVALIDATIONTABLE*:*ˆThistableisusedbyVALIDATESandVALOPERtodetermine4*ˆwhethercertainparameters/modesneedbevalidated:*ˆforthedesiredcommand.Thistableisindexedaccording9*ˆtotheindexforIOSCMDTB.Thestructureisasfollows:**ˆ|--|--|--|--|--|--|--|--|*ˆ|7|6|5|4|3|2|1|0|*ˆ|--|--|--|--|--|--|--|--|:*‰|‚|‚|‚|‚|‚|‚|‚|___musthavetalkerability(VALTALK)**=*‰|‚|‚|‚|‚|‚|‚|______musthavelistenerability(VALLIST)**<*‰|‚|‚|‚|‚|‚|_________musthavecontrollerability(VALCTL)C*‰|‚|‚|‚|‚|____________musthavesys.controllerability(VALSCTL)7*‰|‚|‚|‚|_______________musthaveSRQability(VALSRQ)@*‰|‚|‚|__________________validateprimarybufferaddr.(VALPBUF)C*‰|‚|_____________________validatesecondarybufferaddr.(VALSBUF)G*‰|________________________validateconfigurationbuf.addr.(VALCBUF)**ˆ|--|--|--|--|--|--|--|--|*ˆ|15|14|13|12|11|10|9|8|*ˆ|--|--|--|--|--|--|--|--|2*‰|‚|‚|‚|‚|‚|‚|‚|___validintalkermode(VALTMOD)5*‰|‚|‚|‚|‚|‚|‚|______validinlistenermode(VALLMOD):*‰|‚|‚|‚|‚|‚|_________mustbeincontrollermode(VALCMOD)?*‰|‚|‚|‚|‚|____________validonlyforBUSinT/Lmode(VALBTLM) *‰|‚|‚|‚|ŸordeviceonCTLmode.@*‰|‚|‚|‚|_______________validonlyforbussabledevice(VALBDEV)C*‰|‚|‚|__________________commandvalidonlyforBUSitself(VALBUS)?*‰|‚|_____________________validatesecondaryaddress(VALSADR)>*‰|________________________mustbeincharge(control)ofBUS*A*ˆNOTE:‚DONOTCHANGETHEORDEROFBITS0-4BECAUSETHEYDIRECTLY8*CORRESPONDTOTHEATTRIBUTESWORDINTHECONFIGURATION*BLOCKFOREACHDEVICE.*@*…**NOTE:‚THESECAPABILITIESWHENDESIGNATEDINTHETABLEBELOW9*AREWITHRESPECTTOTHEBUS.‚IFTHATPARTICULARCOMMAND9*ISUSEDANDITISDIRECTEDTOWARDSADEVICERATHERTHAN6*THEBUS,THEBITBEINGSETWILLTAKEONITSOPPOSITE3*MEANING.‚THATIS,IF'VALTALK'ISSPECIFIEDFORA:*COMMAND,IFTHECOMMANDISDIRECTEDTOWARDSTHEBUSTHAT8*IMPLIESTHATTHEBUSHASTALKERABILITIES.HOWEVER,IF?*THATSAMECOMMANDWASDIRECTEDTOWARSADEVICE,THE'VALTALK'=*BITIMPLIESTHATTHEDEVICEMUSTHAVELISTENERCAPABILITIES<*BECAUSETHEBUSWILLBETRYINGTOTALKTOIT.THEOPPOSITE**ISALSOTRUEFORTHE'VALLIST'BITALSO.* 3VALPARTBDC.WVALLIST+VALPBUF+VALBTLM+VALLMOD‡INPUT,DC.WVALTMOD+VALTALK+VALPBUF+VALBTLMOUTPUTGDC.WVALTALK+VALLIST+VALPBUF+VALSBUF+VALBTLM+VALTMOD‚OUTPUTWITHINPUTDC.WVA LCBUF§REQUESTSTATUS"DC.WVALCBUF§CHANGECONFIGURATION'DC.WVALCBUF§CHANGEDEF.CONFIGURATION@DC.WVALCTL+VALBUS+VALPBUF+VALSBUF+VALCMOD‰COMMANDOUT/DATAOUT?DC.WVALCTL+VALBUS+VALPBUF+VALSBUF+VALCMOD‰COMMANDOUT/DATAIN/DC.WVALCTL+VALBUS+VALSBUF+VALCMOD‘COMMANDOUT*‚PARAMETERBLOCKELEMENTSIZETABLEFORCONFIGURATIONREQUEST*@****************************************************************PAR_SIZDC.B2…RECORDLENGTHDC.B4ŒDEVICESIZEDC.B4ŒWRITETIMEOUTVALUEDC.B4ŒREADTIMEOUTVALUEDC.B4ŒEORREQUIREMENTSDC.B2ŒEOSWRITE/READCHAR#DC.B1ŒPARALLELPOLLCONFIGURATIONDC.B1ŒPRIMARYADDRESS3DC.B4Œ#OFBYTESINFIXEDWRITE-FORMATTED/IMAGE2DC.B4Œ#OFBYTESINFIXEDREAD-FORMATTED/IMAGE#DC.B4ŒREADSECONDARYADDRESSMASK$DC.B4ŒWRITESECONDARYADDRESSMASK(DC.B8ŒRESERVEDFORLATERUSE/EXPANSIONDC.B0ŒENDOFCONFIGURATION* DS 0 ‰IFEQ†DTYPE‰TTL‡INTERRUPTHANDLER O*******************************************************************************O*******************************************************************************O*********************************************************************************ˆSASIINTERRUPTHANDLER*E*ˆControlcancometotheSASIinterrupt‚handlerwhenCMRreceivesanG*ˆinterruptontheinterruptlevelthatisusedbytheSASIcontroller.B*ˆIfthe‚interruptisa‚SASIinterrupt,the‚SASI‚interrupthandlerF*ˆsetstheCbitoftheSR,andlowerstheinterruptmasklevelbyone*ˆleveluponreturn.*D*ˆEntry:„A1=physicaladdressoftheSASIinterrupthandlerroutine"*’A5=physicaladdressoftheCCB1*’SR=MaskedattheleveloftheSASIinterrupt.*O*******************************************************************************O*******************************************************************************O******************************************************************************* -‰PAGEš#######################################O******************************************************************************** *ˆSASIINTERRUPTPOLLINGROUTINE*%*ˆEntry:„A5=physicaladdressofCCB*<*ˆExit:…ReturntoCMRviaRTSifitISNOTaSASIinterrupt.4*’FallthroughtoSASIINTifitISaSASIinterrupt.*O******************************************************************************* *¨Time >INTERUPTMOVE.LƒCCBCHB(A5),A0ˆ16(4/0)‡PointA0‚tothe MVME4201‰MOVEQ„#REQINT,D0Œ4(1/0)…memory-mappedƒI/O‚area,4‰AND.B„FLAGS(A0),D0Š8(2/0)…and‚checktheSASI‚FLAGS0‰BNE.S„SASIINT8(1/0)…register‚toseeifaSASI&‰RTS›16(3/0)…interruptispending.ƒIf$*¦--------…there‚isn'taSASIinter-$*¦52(11/0)…ruptpending,‚returnwith*³SR.C=0‚toindicatethat*³theinterrupt‚isn'tours.*³TheAND‚instructionauto-*³maticallyclearsthe‚SR.C *³bitforus. $*¨Ifwe'reusinganEXORmacssystem,%*¦thetimeforthepollingroutineis[b4k7s9{8ƒ6‹1“8›3£A«C³0»2Ã/Ë4Ó5Û5ã2ë5ó4û3< 027#<+>3:;9C3K<*¦computedasfollows. &*¦Time=52+11*3+0*1=85cycles„{*«=85*(0.125)microsecondsˆ{*«=10.625microseconds. #*¨TheEXORmacstypicallyrequires3)*¦waitcyclesforareadcycleand1wait)*¦cycleforawritecycle,andthemicro-'*¦processorinastandardEXORmacsruns&*¦at8.0megahertzforacycletimeof*¦0.125microseconds. %*¨NoticethatthelabelINTERUPTthat)*¦weusehereisintentionallymisspelled"*¦soitwon'texceed8characters. -‰PAGEš#######################################O********************************************************************************#*ˆSASIINTERRUPTCO-ROUTINELINKAGE*C*ˆControlreachesthispointwhenwe'vesuccessfullyidentifiedtheA*ˆinterruptasa‚SASIinterrupt.‚ThisroutineisalsocalledasaB*ˆsubroutinewhenthe‚command-processingroutinewantstoactivateB*ˆinterruptprocessing.‚WhenevertheinterrupthandleremptiestheB*ˆI/Oqueue,wedeactivateinterruptprocessing.‚Whenthecommand-B*ˆprocessingroutine‚putsanewqueueentryintoaemptyqueue,it5*ˆmustcallSASIINTtoactivateinterruptprocessing.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*PP *™A‚P*ƒPPP*"*ˆExit:…Jumptoco-routinesegment*O******************************************************************************* 2SASIINT‚EQU†*–WeknowwehaveaSASIinterrupt,so>L0420„EQU†DSABLINT+LEDOFF†disabletheinterruptattheMVME420?‰MOVE.Bƒ#L0420,CONTROL(A0)ƒSASIPeripheralAdapter.‚Thenenable<‰MOVE.WƒCCBSR(A5),SR‰68000interruptsatourinterruptlevel'*¦sothatotherinterruptsatourlevel'*¦won'tbedelayedwhileweprocessour$*¦interrupt.‚Everyinterrupthandler)*¦shouldmaskitsinterruptatthesource)*¦oftheinterruptandthenquicklylower(*¦thesysteminterruptmaskbyonelevel)*¦toallowthesystemtorespondtoother#*¦interruptsthatoccuratthesame*¦prioritylevel. @L0430„REG†A4/A3/A2/D3/D2/D1†A5,A1,A0,andD0havealreadybeen;‰MOVEM.L‚L0430,-(SP)ŠsavedbyCMR.‚Herewesavetherestof'*¦theregistersthatweneedtouse.‚We(*¦saveonlytheregistersthatwereally%*¦needbecausewedon'twanttowaste(*¦timeorstackspace.‚Time,especially,'*¦isimportantinaninterrupthandler. <‰MOVE.LƒIOQUEUE(A5),A1‰SetA1=LOC(Drive'svariableblock).)*¦ThefirstentryoftheIOQUEUEcontains)*¦apointertothevariableblockforthe)*¦discdrivethatweshouldbeaccessing. =‰MOVE.LƒINTSWTCH(A5),A3ˆBranchtotheco-routinesegmentthat"‰JMP†(A3)‘shouldbeexecutednext. %*¨Controlwilleventuallyreturnfrom(*¦theselectedco-routinesegmenttothe&*¦INTRTNroutine,whichimplementsthe*¦returnlinkagetothesystem. -‰PAGEš#######################################O*********************************************************************************ˆSASIOPCODETABLE*@*ˆThistable‚containsthe‚SASI-definedopcode‚valuesfortheI/OD*ˆoperationsthatwecurrentlyusewiththeSA1403DSASIcontroller.*O******************************************************************************* 2*’---------------------------SASIOpcodevalue.Œ{*’|¹{!*’|”------IOFUNCTindexvalue .Š{*’|”|¤{*’|”|¤{*’V”V¤{‰DC.B…$0A’-1=Writedisc.–{!OPTBL„DC.B…$04“0=Formatdisc.•{/‰DC.B…$C0’+1=Defineformatforfloppydisc.ƒ{‰DC.B…$08’+2=Readdisc.—{ 5FTRACKƒDC.B…$06”Theopcodeforaformat-trackcommand)*¦isnotindexedbytheIOFUNCTvaluefor%*¦aformat-trackcommand.‚Theformat-$*¦trackcommandhasthesameIOFUNCT&*¦valuethatisusedforaformat-disc'*¦command,andweuniquelyidentifythe'*¦format-trackcommandbythefactthat(*¦itsIOOPTSvalueisdifferentfromthe)*¦IOOPTSvaluethatisusedforaformat-(*¦disccommand.‚Thenwecomputeapseudo'*¦IOFUNCTvaluethatindexesfromOPTBL *¦toFTRACK. '‰DS.W…0–Thisstatementensuresthatthe'*¦locationcounterisalignedtoaword *¦boundary.-‰PAGEš#######################################3SENSECMDEQU†$03”ThislabeldefinestheSASIopcode(*¦valueforarequest-sensecommand.‚The$*¦SASIdriverissuesarequest-sense&*¦commandwhenevertheSASIcontroller'*¦returnsastatusvaluethatindicates$*¦anerror.‚Thecontrollerreturnsa&*¦statusvalueattheendofeveryI/O(*¦transaction,andthedriverchecksthe%*¦statusvaluetoseeifanerrorhas(*¦occurred.‚Ifanerrorhasoccurred,we)*¦issuearequest-sensecommandtoobtain'*¦detailedinformationabouttheerror. "*¨Auser'sprogramcannotdirectly&*¦generatearequest-sensecommand,so(*¦theopcodevaluefortherequest-sense)*¦commandisn'tintheSASIopcodetable.&*¦TheSASIdriverautomaticallyissues)*¦request-sensecommandsasnecessaryfor*¦erroranalysis. -‰PAGEš#######################################O*********************************************************************************ˆPROCESSNEXTQUEUEENTRY*E*ˆControlcomestothisco-routinesegmenttoprocessthefrontentryD*ˆoftheIOQUEUE.‚Weareguaranteedthatthequeueinnon-emptywhen *ˆcontrolcomestothisroutine.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*9*ˆExitsto:‚SendacommandpackettotheSASIcontroller.*O******************************************************************************* =PROCQUE‚LEA†CMDEND(A5),A3ŠWewanttoexaminethevariablesin(*¦thedrive'sI/Opacket,andwewantto'*¦constructacommandpacketforaSASI)*¦commandthatwillimplementpartorall&*¦ofthefunctionthatisspecifiedin$*¦thedrive'sI/Opacket.‚Thenwe'll)*¦transmitthecommandpackettotheSASI *¦controller. %*¨WestartbypointingA3tothebyte(*¦thatimmediatelyfollowsthelastbyte(*¦ofthecommandpacketinmemory.‚We'll(*¦useautodecrementaddressingtoaccess*¦thecommandpacket.-‰PAGEš####################################### /***********************************************-*MODFORDTC520ASASICONTROLLER11/16/83ƒ**(* Modified for both controllers 12/12/83*/***********************************************(‰CMP.B…#1,IOFUNCT(A1)†TESTFORCONFIGURE!‰BNE.S…PROQ1BRAIFNOTCONFIGURE-‰BTSTW…#IOASIZE,CONFGBLK+IOSATW(A1)‚8"DRIVE?‰BNE.S…PROQ1BRAIF8"DRIVE6‰LEA‡DTCCMD(A5),A3‡POINTTOCONFIGUREDRIVECMD.PCKT.‰BRA.S…L0490AŽGOSENDDATA/************************************************ENDOFMOD—11/17/83ƒ*/*********************************************** ‰PAGEDPROQ1„MOVE.BƒCTRLCODE(A1),-(A3)…Copythecontrol-codevaluefromthe2L1‡SET†CMDCTRLŽdrive'sI/OpacketintotheCMDCTRL%*¦fieldofthecommandpacket.‚Notice'*¦theuseoftheSETpseudoinstruction)*¦togenerateaconcordanceentryforthe&*¦CMDCTRLfieldthatismodifiedhere. ;‰MOVE.LƒIOSCTCNT(A1),D0ˆNowusetheIOSCTCNTvaluefromthe<‰MOVE.Lƒ#MAXSECTS,D1‰drive'sI/OpackettofilltheCMDSECTS0‰CMP.L„D1,D0fieldofthecommandpacket.‚Ifthe3‰BLS.S„L0470countofremainingsectorsexceedsthe3‰MOVE.LƒD1,D0maximumnumberofsectorsthatcanbe>16,(A3)+ƒdiscdrive'sI/Opackettosetupthe;‰MOVE.BƒDRIVENUM(A1),D1†logicalsectornumberintheCMDLSN8‰LSL.B„#LUNFIELD,D1‰fieldofthecommandpacket.‚Wealso6‰OR.B…D1,-(A3)usetheDRIVENUMvaluefromthedrive's1L1‡SET†CMDLSNI/OpackettosettheLUN(Logical-#*¦Unit-Number)fieldinthecommand&*¦packet.‚NoticethattheLUNfieldin)*¦thecommandpacketoccupiesthetopfew&*¦bitsofthefirstbyteoftheCMDLSN%*¦(Logical-Sector-Number)field.‚Also'*¦noticetheuseoftheSETinstruction)*¦togenerateaconcordanceentryforthe*¦CMDLSNfield.-‰PAGEš#######################################9‰ADD.L„D0,IOSECTOR(A1)ˆIncreasetheIOSECTORvalueinthe%*¦drive'sI/Opacketbythenumberof%*¦sectorsthatwillbeprocessedasa%*¦resultofthiscommandpacket.‚This(*¦adjustmentcausesIOSECTORtopointto)*¦thesectorthatshouldbespecifiedfor(*¦thenext(ifany)commandpacketafter *¦thisone. ;‰MOVE.BƒIOFUNCT(A1),D0‰GettheIOFUNCTcodeintoD0.Wsowe+‰EXT.W„D0“canuseittoindexintotheSASI1‰BNE.S„L0490opcodetable.‚IftheIOFUNCTcodeis(*¦nonzero,wearen'tprocessingaformat'*¦command.‚Inthiscase,wecanusethe&*¦IOFUNCTvaluedirectly.‚Foraformat#*¦command,however,wemustdosome*¦specialprocessing. >L0480„EQU†CONFGBLK+IOSILVˆForaformatcommandwemustinstall@‰MOVE.BƒL0480(A1),CMDILV(A5)aninterleavevalueintotheCMDILV$*¦field,whichoverlaystheCMDSECTS'*¦fieldofthecommandpacket.‚Thereis'*¦nosectorcountforaformatcommand,'*¦butthecontrollerrequiresaninter-%*¦leavecodeinplaceoftheCMDSECTS*¦fieldforaformatcommand. :‰BTSTW„#IOPTRKB,IOOPTS(A1)„IftheIOOPTSvalueinthedisc4‰BEQ.S„L0490drive'sI/Opacketindicatesthatwe're:‰MOVEQWƒFTRACK-OPTBL,D0†processingaformat-trackcommand,'*¦adjustD0.Wtoindextheformat-track!*¦entryoftheSASIopcodetable.%*¦Otherwise,D0.Walreadyindexesthe&*¦format-discentryoftheSASIopcode*¦table. #*¨WeuseasingleIOFUNCTvaluefor&*¦boththeformat-disccommandandthe&*¦format-trackcommand.‚Wedistinguish)*¦onecommandfromtheotherbyexamining*¦theirIOOPTSvalues. FL0490„MOVE.BƒOPTBL(PC,D0.W),-(A3)ƒFinally,filltheCMDOPfieldofthe4L1‡SET†CMDOPcommandpacketfromtheproperentryof'*¦theSASIopcodetable.‚NoticethatA3&*¦nowpointstotheCMDOPfieldofthe'*¦commandpacket,sowecanuseA3with)*¦autoincrementaddressingaswesendthe(*¦commandpackettotheSASIcontroller.'*¦AlsonoticetheuseoftheSETpseudo'*¦instructiontogenerateaconcordance*¦entryfortheCMDOPfield.-‰PAGEš#######################################6L0490AƒBSR†SENDCMDSendthecommandpackettotheSASI&*¦controllertotellthecontrollerto&*¦startprocessing.‚SubroutineSENDCMD'*¦usesA3withautoincrementaddressing(*¦tosendthecommandpackettotheSASI)*¦controller,andsubroutineSENDCMDalso'*¦assumesthatA0pointstothememory-)*¦mappedI/OareafortheSASIperipheral *¦adapter. O*********************************************************************************ˆREADO RWRITENEXTSECTOR*B*ˆControl‚comestothetopofthis‚co-routinewhentheSASIdriverD*ˆisreadytoreadorwritethedataforthenextsectorthatshould@*ˆbetransferred.‚Controlalso‚comestothis‚routine‚immediately=*ˆafter‚anycommand‚sequence‚hasbeen‚transmitted‚to‚the‚SASI *ˆcontroller.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*1*ˆExitsto:‚Branchestointerruptreturnroutine.*O******************************************************************************* 8NEXTSECTBSR†INTRTN‘TheSASIcontrollerneedstimetodo$*¦itsjobbeforewecantransferany(*¦data,soreturncontroltothesystem.'*¦WhentheSASIcontrollerhasfinished$*¦itscurrenttask,we'llreceivean&*¦interruptthatwillcausecontrolto(*¦comebackhere.‚Theco-routinelinkage)*¦convenientlyallowsustocalltherest&*¦ofthesystemasifitweresimplya)*¦subroutinetobeexecutedwhilewehave*¦nothingbettertodo. *Â(Continued)-‰PAGEš########################################*¨Ifwe'vejusttransmittedawrite%*¦commandtotheSASIcontroller,the'*¦interruptshouldoccurquickly(since(*¦thecontrollershouldsoonbereadyto'*¦copyasectorofoutputdataintoits$*¦databuffer).‚However,experiments&*¦haveshownthatthecontrollerneeds'*¦enoughtimeeveninthiscasetomake(*¦itworthwhileforustoreturncontrol*¦tothesystem. %*¨Ifwe'vejusttransmittedareador'*¦formatcommandtothecontroller,the%*¦controllerwillobviouslyrequirea&*¦substantialamountoftimebeforeit*¦interruptsthesystemagain. 9L0530„EQU†CONFGBLK+IOSPSMˆControlreachesthisco-routine;‰MOVE.WƒL0530(A1),D1‰segmentwhenthecontrollerinterrupts(*¦toindicatethatit'sreadytoproceed'*¦withtheI/Ooperation.‚WegetIOSPSM&*¦intoD1.W,soD1.Wnowindicatesthe!*¦logicalsectorsize(inbytes). 9‰TST.B„HALFSCTS(A1)‹Ifthenextsectortobeprocessedis2‰BEQ.S„L0535ahalfsector,dividethesectorsize2‰LSR.W„#1,D1bytwotoaccountforthefactthata>‰SUB.B„#1,HALFSCTS(A1)†halfsectorhasonlyhalfasmanybytes(*¦asanormalsector.‚Thendecrementthe(*¦countofthehalfsectorsremainingto%*¦beprocessed.‚Halfsectorsarisein'*¦trackzeroofadouble-densityfloppy(*¦discbecausethesectorsintrackzero%*¦ofadouble-densityfloppydiscare*¦recordedwithsingledensity.-‰PAGEš#######################################‰MOVEP.L‚DATA0(A0),D0†|‚thememorymap.‚Therefore,theMOVEP.L5‰MOVE.LƒD0,(A3)+Š|‚instructionaccessesthesamedata(*§|‚registerfourconsecutivetimeswith/‰DBRA…D3,L0550Š----‚themaximumpossiblespeed. #*¨IftheSASIcontrollerhappensto$*¦sufferfromacatastrophicfailure)*¦duringthisloop,we'llgetabuserror*¦toindicatetheproblem. 4‰DBRA…D1,READDATAŒIfwehaven'tfinishedreadingthe&*¦currentsectorofdata,loopbackto(*¦readthenextchunkofLCDSCTSZbytes.$*¦ByreadingLCDSCTSZbytesandthen)*¦checkingthecontroller,wecanprevent&*¦thecarelessuserfromcausingabus*¦error. 0‰BRA.S„RWCOMMONWe'vefinishedreadinganentire(*¦sectorofinputdata,sonowgotothe#*¦commonroutinethatcompletesthe&*¦processingofasectorforbothread"*¦operationsandwriteoperations. -‰PAGEš#######################################O*********************************************************************************ˆWRITEASECTOROFDATA*O******************************************************************************* GWRTDATA‚MOVEQBƒSELECTED+REQWRITE,D3ƒWe'reperformingawriteoperation,4‰BSR†CHKFLAGSsochecktheSASIcontrollertoverify)*¦thatthecontrollerisreadytoreceive'*¦outputdata.‚SubroutineCHKFLAGSsets)*¦theCC.Zbitifthecontrollerisready&*¦fortheoperationindicatedinD3.B.-‰PAGEš#######################################>L0560„SNE.B„NOFINISH(A1)‹Ifthecontrollerisn'treadyforthe7‰BNE.S„READSTATproperoperation,settheNOFINISHflag%*¦andgotrytoreadthecontroller's$*¦statusreport.‚WeusetheNOFINISH'*¦flagtoindicatethatareadorwrite$*¦I/Ooperationhasfailedtofinish$*¦correctlyforsomeunknownreason. &*¨Controlcomesthroughthissamecode$*¦segmentifthecontrollerfailsto'*¦becomereadyfortheproperoperation*¦duringareadtransaction. .L0561„EQU†4*8”Eachiterationoftheinnerloop=L0562„EQU†LCDSCTSZ/L0561‡belowtransfers4*8=32databytes,=L0563„EQU†L0562*L0561Šandeachiterationoftheouterloopis9‰IFNE…LCDSCTSZ-L0563‡supposedtotransferLCDSCTSZbytes./‰FAIL…0”[****ERROR****ERROR****ERROR****]+‰ENDCšTherefore,wemustverifythat4*8is#*¦anexactdivisorofLCDSCTSZ.‚The#*¦instructionthatisconditionally&*¦assembledheregeneratesanassembly)*¦errorif4*8isnotanexactdivisorof%*¦LCDSCTSZ.‚Ifthiserroroccurs,the(*¦maintenanceprogrammerwillbealerted(*¦tochangetheinnerloopbelowtomake(*¦ittransfe rsomeothernumberofbytes)*¦sothatasingleiterationoftheouter#*¦loopcantransferLCDSCTSZbytes. @‰MOVEQWƒLCDSCTSZ/L0561-1,D3„InitializeD3.Wtocontroltheinner'*¦loop.‚We'llperformenoughiterations(*¦oftheinnerlooptotransferLCDSCTSZ*¦bytesofdata.-‰PAGEš#######################################?L0570„MOVE.Lƒ(A3)+,D0Š----‚Eachcompleteiterationofthisloop>‰MOVEP.L‚D0,DATA0(A0)†|‚transfers4*8=32databytesfromthe(*§|‚outputbuffertotheSASIcontroller8‰MOVE.Lƒ(A3)+,D0Š|‚andweperformjustenoughiterations>‰MOVEP.L‚D0,DATA0(A0)†|‚ofthisinnerlooptotransferatotal *§|‚ofLCDSCTSZbytesduringone1‰MOVE.Lƒ(A3)+,D0Š|‚iterationoftheouterloop.‹{‰MOVEP.L‚D0,DATA0(A0)†|©{#*§|„WeuseaMOVEP.Linstructionto7‰MOVE.Lƒ(A3)+,D0Š|‚transferfourconsecutivedatabytes?‰MOVEP.L‚D0,DATA0(A0)†|‚withthemaximumpossiblespeed,andwe&*§|‚replicatethecodeinthisloopto7‰MOVE.Lƒ(A3)+,D0Š|‚reducetheeffectsofloopoverhead.;‰MOVEP.L‚D0,DATA0(A0)†|‚Wecouldreplicatethecodeinthis'*§|‚loopmoretimesforevenmorespeed8‰MOVE.Lƒ(A3)+,D0Š|‚butdiminishingreturnsbegintomake?‰MOVEP.L‚D0,DATA0(A0)†|‚furtherreplicationslessattractive.{*§|¤{8‰MOVE.Lƒ(A3)+,D0Š|„TheSASIcontrolleractuallyhasjust<‰MOVEP.L‚D0,DATA0(A0)†|‚onedataregister,butthatregister'*§|‚appearsat4differentlocationsin9‰MOVE.Lƒ(A3)+,D0Š|‚thememorymap.‚Therefore,theMOVEP.L:‰MOVEP.L‚D0,DATA0(A0)†|‚instructionaccessesthesamedata%*§|‚register4consecutivetimeswith/‰DBRA…D3,L0570Š----themaximumpossiblespeed. #*¨IftheSASIcontrollerhappensto$*¦sufferfromacatastrophicfailure)*¦duringthisloop,we'llgetabuserror*¦toindicatetheproblem. 3‰DBRA…D1,WRTDATAIfwehaven'tfinishedwritingthe&*¦currentsectorofdata,loopbackto)*¦writethenextchunkofLCDSCTSZbytes.$*¦BywritingLCDSCTSZbytesandthen)*¦checkingthecontroller,wecanprevent&*¦thecarelessuserfromcausingabus*¦error. &*¨We'vefinishedtransferringasector&*¦ofoutputdata,sonowcontrolfalls(*¦intothecommonroutinethatcompletes%*¦theprocessingofasectorforboth'*¦readoperationsandwriteoperations. -‰PAGEš#######################################O********************************************************************************#*ˆCOMPLETEPROCESSINGOFREAD/WRITE*#*ˆEnteredfrom:READDATAorWRTDATA* *ˆExitsto:*O******************************************************************************* @RWCOMMONMOVE.LƒA3,IOBUFPTR(A1)ˆUpdatetheI/Obufferpointerto#*¦pointtothenextbyteoftheI/O&*¦buffer.‚Ifthere'sanothersectorof'*¦datatobetransferred,IOBUFPTRwill'*¦beusedtoaddresstheI/Obuffer.‚If'*¦thereisn'tanothersectorofdatato'*¦betransferred,we'lluseIOBUFPTRto)*¦calculatethenumberofbytesthatwere*¦actuallytransferred. :‰SUB.B„#1,CMDSECTS(A5)ˆDecrementthecountofsectorsthat4‰BHI†NEXTSECTremaintobeprocessedforthecurrent&*¦SASIcommandsequence.‚Ifwehaven't(*¦finishedprocessingallofthesectors(*¦forthecurrentSASIcommandsequence,'*¦loopbacktoprocessthenextsector. .‰TST.B„D2•We'vefinishedprocessingallofthe5‰BGT.S„RDSTAT1Žsector(s)forthecurrentSASIcommand&*¦sequence.‚Ifwe'reperformingaread%*¦operation,goreadthecontroller's&*¦statusreport.‚Thecontrollershould#*¦havethestatusreportforaread$*¦operationreadyalmostimmediately(*¦afterthelastsectorofdatahasbeen%*¦read,sothere'snoadvantagetobe$*¦gainedbyreturningcontroltothe(*¦systemtowaitforastatus-readySASI(*¦interrupt.‚RecallthatD2.B=+1fora)*¦readtransactionandthatD2.B=-1for*¦awritetransaction. $*¨Ifwe'reperformingawriteopera-)*¦tion,fallintothetopoftheREADSTAT%*¦routine.‚Controlwillreturntothe)*¦system,andwe'llgetcontrolbackwhen&*¦astatus-readyinterruptoccurs.‚The'*¦controller willrequireasignificant)*¦amountoftimebeforeithasitsstatus%*¦reportreadybecauseitmustdothe(*¦physicalwritingofthelastsectorof'*¦databeforeitcanprepareitsstatus *¦report. -‰PAGEš#######################################O********************************************************************************!*ˆREADTHESASICONTROLLERSTATUS*O******************************************************************************* 7READSTATBSR.S„INTRTN‘Returncontroltothesystem,and)*¦waitforastatus-readySASIinterrupt.&*¦We'llgetcontrolbackwhentheSASI)*¦controllerhasitsstatusreportready. 5RDSTAT1‚BSR†GETSTATGetthestatusbitsfromtheSASI6‰BNE.S„STATERRŽcontroller'sstatusbyteintoD0.B,and(*¦reportanerrorifthestatusbitsare&*¦nonzero.‚Astatusbitthatissetin(*¦thecontroller'sstatusbyteindicates&*¦anerror.‚SubroutineGETSTATreturns$*¦theconditioncodesreflectingthe(*¦statusbitsfromtheSASIcontroller's*¦statusbyte.-‰PAGEš#######################################6‰MOVEQBƒISTACFG,D1IftheNOFINISHflagisnonzero,we8‰TST.B„NOFINISH(A1)‰returnastatuscodeindicatingthat4‰BNE.S„SASIDONEtheactualconfigurationofthedisc(*¦doesn'tmatchtheconfigurationinthe%*¦currentconfigurationblock.‚AnI/O)*¦operationfailedtofinishproperly,so&*¦thesectorsizeonthediscprobably&*¦doesn'tmatchthesectorsizeinthe*¦configurationblock. 8‰TST.L„IOSCTCNT(A1)‹TheSASIcontrollerhassuccessfully1‰BNE†PROCQUEŽcompletedtheentireI/Otransaction(*¦thatwasspecifiedbythelastcommand(*¦sequencethatwegaveit.‚Ifthereare'*¦anysectorsremainingtobeprocessed)*¦forthecurrententryoftheI/Oqueue,'*¦loopbacktoprocessanotherchunkof*¦theentireI/Otransfer. %*¨RecallthatIOSCTCNTisalwayszero&*¦foranyI/Otransactionthatdoesn't(*¦involvethetransferofanyread/write*¦data. 9‰MOVE.BƒEOVFLAG(A1),D1‰We'venowcompletedtheentireI/O'*¦transactionthatwasspecifiedbythe$*¦commandthatgeneratedthecurrent%*¦entryoftheI/Oqueue.‚TheEOVFLAG'*¦valuethatwegetintoD1.Bherewill#*¦bereturnedtotheuserasanI/O&*¦statuscode.‚IftheI/Otransferwas'*¦truncatedtoavoidrunningbeyondthe(*¦endofthedisc,wereturntheISTAEOV'*¦statuscode.‚Otherwise,wereturnthe)*¦ISTAOKstatuscodetoindicatethatthe!*¦entireoperationwentsmoothly. %*¨ControlnowfallsintotheSASIDONE"*¦routinetofinishprocessingthe!*¦currententryoftheI/Oqueue. -‰PAGEš#######################################O*********************************************************************************ˆFINISHPROCESSINGQUEUEENTRY*B*ˆControlcomes‚tothetop‚ofthis‚co-routinewhentheSASIdriverC*ˆisreadytofinish‚processing‚thecurrententryofthe‚I/Oqueue.E*ˆEitherwe'vecompletedtheI/OtransactionthatisspecifiedbytheC*ˆcurrentwntryofthe‚queue,orelsewe've‚runintosomeunreason-G*ˆableproblemthatwecan'tsolve.We'llqueueanI/OcompletioneventC*ˆtotheattachedtask,andwe'll‚removethe‚currententryfromtheD*ˆI/Oqueue.‚IftheI/Oqueuehasanotherentry,we'llloopbackand*ˆstartprocessingit.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB*’A5=physicaladdressofCCB*D1.B=statusvalue*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*3*ˆExitsto:‚IDLELOOProutineifI/Oqueueisempty.4*“PROCQUEiftheI/Oqueuecontainsanactiveentry.*O******************************************************************************* 3SASIDONEEQU†*–WeuseaMOVEM.Linstructiontopull=L0630„REG†D0/D2/A1/A3/A4‡severalvariablesoutofthecurrentA‰MOVEM.L‚IOBUFLOC(A1),L0630ƒI/Opacketinonestep.‚Thisinstruc-(*¦tionsetsuptheregistersasfollows. L1‡SET†IOBUFLOCD0=IOBUFLOC.L1‡SET†IOBUFPT RD2=IOBUFPTR.L1‡SET†IOBUFTCBA1=IOBUFTCB.5L1‡SET†DCBPNTRŽA3=DCBPNTR.‚(ForsubroutineQEVENTI)5L1‡SET†IOCBPTRŽA4=IOCBPTR.‚(ForsubroutineQEVENTI) $*¨TheSETinstructionsthatareused'*¦herearejustdummyinstructionsthat&*¦generateartificiallabelreferences%*¦fortheconcordancelisting.‚Future)*¦maintenanceprogrammerswillbeableto)*¦usetheconcordancelistingtodiscover$*¦thatthissegmentofcodeaccesses*¦thesevariables.-‰PAGEš#######################################1‰SUB.L„D0,D2’Nowcomputethenumberofdatabytes=‰MOVE.LƒD2,IOSLEN(A4)ˆthatweactuallytransferred,andstore&*¦thatnumberintotheIOSLENfieldof%*¦theIOCB.‚ForanI/Ooperationthat%*¦doesn'tinvolvethetransferofany%*¦read/writedata,wehaveIOBUFLOC=)*¦IOBUFPTR,soweproperlysetIOSLEN=0*¦inthiscase. 8‰LEA†ERRDISK(PC),A2‰UsetheVersadoserrorcodetocheck:WHEEL„MOVE.Bƒ(A2)+,D2whethertheIOSRRNfieldoftheIOCB2‰BEQ.S„NOCOPYneedsupdating.Iftheerrorcodeis4‰CMP.B„D2,D1foundinthetableERRDISK,thenupdate3‰BNE.S„WHEELtheIOSRRNfieldintheIOCB.Thelast1‰MOVE.LƒD3,IOSRRN(A4)ˆentryinthetableiszero. 3NOCOPYƒBSR†QEVENTISubroutineQEVENTIqueuesanI/O(*¦completioneventtotheattachedtask.)*¦RegistersA5,A4,A3,andD1.Bmustall)*¦besetproperlywhenwecallsubroutine *¦QEVENTI. 9‰SUB.B„#1,TCBIOCNT(A1)ˆDecrementthecountofoutstanding'*¦I/Ooperationsforthetaskthatowns)*¦theI/Obuffer(ortheIOCBinthecase%*¦ofaformatcommandoraconfigure-*¦floppycommand). 6L0640„REG†A1/A3/A4HereweremovethefrontentryfromA‰MOVEM.L‚IOQUEUE+4(A5),L0640‚theI/Oqueue,andwesimultaneouslyA‰MOVEM.L‚L0640,IOQUEUE(A5)„setA1topointtothedriveblockfor(*¦thediscdrivethatisassociatedwith$*¦thenext(ifany)entryoftheI/O%*¦queue.‚Sincethereareamaximumof(*¦fourentriesintheI/Oqueue,weneed'*¦tomovenomorethanthreeentriesto(*¦removethefirstentryfromthequeue. 6‰SUB.W„#4,IOQCNT(A5)ŠReducethequeue-countpointerto1‰BHI†PROCQUEŽaccountforthefactthatwe'vejust(*¦removedafour-byteentryfromtheI/O$*¦queue.‚Ifthereisstillanactive&*¦entryintheI/Oqueue,loopbackto"*¦startprocessingthenextentry. $*¨IftheI/Oqueueisempty,control(*¦fallsintotheco-routinesegmentthat%*¦ispotentiallyactivewhentheSASI'*¦controlleriscaughtupandshouldbe*¦idle. -‰PAGEš#######################################O*********************************************************************************ˆIDLELOOPROUTINE*C*ˆControlfallsintothisco-routine‚segmentwhenthe‚I/OqueuehasD*ˆbeenemptied.‚TheSASIcontrolleriscompletelycaughtupwithall?*ˆofitsrequests,‚andthe‚controller‚should‚nowbe‚idle.‚We'llB*ˆsimplyreturncontroltothe‚systemto‚idlethe‚SASI‚controller.*=*ˆEntry:„A0=physicaladdressofSASIMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P*D*ˆExitsto:‚Staysinloopuntilthedriverreceivesanothercommand.*O******************************************************************************* :IDLELOOPBSR.S„INTRTN‘TheI/Oqueueisempty,sowesimply%*¦returncontroltothesystem.‚We've)*¦caughtupwithalloftherequeststhat'*¦havebeensetupforprocessingunder*¦interruptcontrol. *ˆExitsto:‚SASIDONEtoterminateprocessingfortheactivity.*O******************************************************************************* 7CTRLERR1ADDQ.Lƒ#4,SP’Controlcomestothisentrypoint%*¦whenacontrollererrorisdetected%*¦fromwithinasubroutine.‚Weremove&*¦thesubroutine'sreturnaddressfrom(*¦thestack,s othestackisrestoredto&*¦theconditionthatithadbeforethe*¦subroutinewascalled.-‰PAGEš####################################### >CTRLERR‚ST.B…SASIDOWN(A5)‹DowntheSASIchannelbysettingthe"*¦variablethatindicatesthatthe#*¦controllerisdown.‚Ifthesystem(*¦triestoaccesstheSASIchannelagain#*¦withoutresettingitfirst,we'll%*¦reportanerrorindicatingthatthe$*¦channelisdown.‚Thesystemreally"*¦shouldn'ttrytoaccesstheSASI'*¦channelagainwithoutfirstresetting$*¦thecontroller.‚Evenresettingthe)*¦controllermaynotcorrecttheproblem,'*¦butwe'llletthesystemtryasoften*¦asitwishes. 5‰MOVEQBƒISTACNT,D1SetupD1.Bforreportingastatus5‰BRA†SASIDONEcodethatindicatesacontrollererror,%*¦andgoterminateprocessingforthe!*¦currententryoftheI/Oqueue. -‰PAGEš#######################################O******************************************************************************** *ˆCHKFLAGS.AL*O******************************************************************************* GREADRDY‚MOVEQBƒSELECTED+REQREAD,D3„Thisspecialentrypointisusedfor(*¦checkingtheSASIcontrollertoseeif(*¦ithasinputdatareadytotransferto(*¦us.‚WegettheproperFLAGSvalueinto'*¦D3.B,andthencontrolfallsdirectly'*¦intothemainentrypointforsubrou-*¦tineCHKFLAGS. -‰PAGEš#######################################:*ˆControlsometimesfallsintothissubroutinefromabove.  ½GÅ8Í*Õ;Ý6å8í2õý*8 484%P-L5T=@E.M(U%]eE'*¦processorinastandardEXORmacsruns&*¦at8.0megahertzforacycletimeof*¦0.125microseconds.‰PAGEO*********************************************************************************ˆINTERRUPTCO-ROUTINELINKAGE*D*ˆThisroutineisenteredeitherduetoaWDCinterruptorjumpedtoD*ˆfromthecommandprocessorifWDCisexecutingapreviouscommand.@*ˆWe'llturnofftheinterrupts,saveregisters,andjumpto‚the*ˆexpectedco-routine.*<*ˆEntry:„A0=physicaladdressofWDCMemory-MappedI/Oarea*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567%*™D„####=Savedtouseasworking#*™A‚P*ƒ##Pregistersthroughout.*=*ˆExit:…Jumptoco-routinesegmentaddressedbyINTSWTCH(A5).*O************ ******************************************************************* .SASIINT‚EQU‡*•WeknowwehaveaWDCinterrupt.5‰MOVE.Bƒ#DSBLDINT,INTCTRL(A0)‚Disabledatainterrupt.)‰BTST.Bƒ#BITCB,FLAGS(A0)‡IstheWDCbusy?+‰BNE.S„L0431’Yes.Mustbeadatainterrupt.@‰MOVE.BƒSENSE(A0),SENSBYT0(A5)TheWDCisnotbusy,soclearthe"*¨commandcompletioninterruptand"*¨theDRQbyreadingSENSEbyte0. @L0430„REG†A4/A3/A2/D3/D2/D1†A5,A1,A0,andD0havealreadybeen@L0431„MOVEM.L‚L0430,-(SP)ŠsavedbyCMR.‚Herewesavetherestof'*¦theregistersthatweneedtouse.‚We(*¦saveonlytheregistersthatwereally%*¦needbecausewedon'twanttowaste(*¦timeorstackspace.‚Time,especially,'*¦isimportantinaninterrupthandler. <‰MOVE.LƒIOQUEUE(A5),A1‰SetA1=LOC(Drive'svariableblock).)*¦ThefirstentryoftheIOQUEUEcontains)*¦apointertothevariableblockforthe)*¦discdrivethatweshouldbeaccessing. =‰MOVE.LƒINTSWTCH(A5),A3ˆBranchtotheco-routinesegmentthat0‰JMP†(A3)‘shouldbeexecutednext.‚Theregisters*¦aresetupasfollows. *¦A5=LOC(CCB).˜{*¦A4=Scratch.™{*¦A3=Scratch.™{%*¦A1=LOC(Drive'svariableblock).…{"*¦A0=LOC(SELECT)=LOC(FLAGS).ˆ{ %*¨Controlwilleventuallyreturnfrom(*¦theselectedco-routinesegmenttothe&*¦INTRTNroutine,whichimplementsthe*¦returnlinkagetothesystem. PAGEO*********************************************************************************ˆWINCHESTEROPCODETABLE*E*ˆTheWinchesteropcodetablecontainstheWDC-definedvaluesforthe9*ˆI/OoperationsthatarecurrentlysupportedbytheWDC.*O******************************************************************************* 1*’---------------------------WDCOpcodevalue.{*’|¹{!*’|”------IOFUNCTindexvalue.Š{*’|”|¤{*’|”|¤{*’V”V¤{‰DC.B…$0A’-1=Writedisc.–{!OPTBL„DC.B…$04“0=Formatdisc.•{ ‰DC.B…$C0’+1=Configuredrive’{‰DC.B…$08’+2=Readdisc.—{5FTRACKƒDC.B…$06”Theopcodeforaformat-trackcommand)*¦isnotindexedbytheIOFUNCTvaluefor%*¦aformat-trackcommand.‚Theformat-$*¦trackcommandhasthesameIOFUNCT&*¦valuethatisusedforaformat-disc'*¦command,andweuniquelyidentifythe'*¦format-trackcommandbythefactthat(*¦itsIOOPTSvalueisdifferentfromthe)*¦IOOPTSvaluethatisusedforaformat-(*¦disccommand.‚Thenwecomputeapseudo'*¦IOFUNCTvaluethatindexesfromOPTBL *¦toFTRACK.K*****************************************************************************ˆBWN‡2/13/84ƒPJD‡9/19/84*0ALTSECƒDC.B†$07‘Here'stheopcodefortheformat*¦alternatesectorscommand.#*¦We'lldothesametrickasabove.*J**************************************************************************  '‰DS.W…0–Thisstatementensuresthatthe'*¦locationcounterisalignedtoaword ‰PAGEO*********************************************************************************ˆPROCESSNEXTQUEUEENTRY*E*ˆControlcomestothisco-routinesegmenttoprocessthefrontentryA*ˆoftheIOQUEUE.‚WeareguaranteedthattheIOQUEUEisnon-empty%*ˆwhencontrolcomestothisroutine.*<*ˆEntry:„A0=physicaladdressofWDCMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚** *™A„Pƒ*ƒP**ˆExit:*O******************************************************************************* =PROCQUE‚LEA†CMDEND(A5),A3ŠWestartbypointingA3tothebyte(*¦thatimmediatelyfollowsthelastbyte(*¦ofthecommandpacketinmemory.‚We'll(*¦useautodecrementaddressingtoaccess*¦thecommandpacket. ?‰MOVE.BƒCTRLCODE(A1),-(A3)…Copythecontrol-codevaluefromthe%*¦drive'sI/OpacketintotheCMDCTRL*¦fieldofthecommandpacket. ;* WE'LL ASSUME A READ OR WRITE COMMAND, SINCE MOST WILL BE. ‰CLR.L„D07‰MOVE.BƒHALFSCTS(A1),D0†Areanyhalfsectorsspecified?)‰BNE.S„L0470YES.READHALFSECTORSFIRST >‰MOVE.LƒIOSCTCNT(A1),D0† Getthetotal#ofsectorstotransfer‰MOVE.Lƒ#MAXSECTS,D12‰CMP.L„D1,D0Is#required<=MAXperWDCcommand?*‰BLS.S„L0470Yes.Thisrequires1command.0‰MOVE.LƒD1,D0NO.TransferMax.inthiscommand.9L0470„MOVE.BƒD0,-(A3)Move#ofsectorstocommandpacket PAGE%*¨Ifwe'reprocessingacommand(such#*¦asaformatcommand)thatdoesn't)*¦involveanactualI/Otransfer,wehave*¦IOSCTCNT=0. <‰SUB.L„D0,IOSCTCNT(A1)ˆReducethecountofremainingsectors'*¦bythenumberofsectorsthatwillbe'*¦processedasaresultofthiscommand'*¦packet.‚Ifthiscommandpacketisthe(*¦last(oronly)commandpacketforthis'*¦I/Otransaction,wehaveIOSCTCNT=0*¦now. =‰MOVE.LƒIOSECTOR(A1),-(A3)…WeusetheIOSECTORvaluefromthe?‰AND.W„#LSNMASK>>16,(A3)+ƒdiscdrive'sI/Opackettosetupthe<‰MOVE.BƒDRIVENUM(A1),D1†logicalsectornumberinthecommand:‰LSL.B„#LUNFIELD,D1‰packet.‚WealsousetheDRIVENUMvalue5‰OR.B…D1,-(A3)fromthedrive'sI/Opackettosetthe(*¦LUN(Logical-Unit-Number)fieldinthe%*¦commandpacket.‚NoticethattheLUN&*¦fieldinthecommandpacketoccupies'*¦thetopfewbitsofthefirstbyteof(*¦theLSN(Logical-Sector-Number)field. 9‰ADD.L„D0,IOSECTOR(A1)ˆIncreasetheIOSECTORvalueinthe%*¦drive'sI/Opacketbythenumberof%*¦sectorsthatwillbeprocessedasa%*¦resultofthiscommandpacket.‚This(*¦adjustmentcausesIOSECTORtopointto)*¦thesectorthatshouldbespecifiedfor(*¦thenext(ifany)commandpacketafter *¦thisone. ;‰MOVE.BƒIOFUNCT(A1),D0‰GettheIOFUNCTcodeintoD0.Wsowe*‰EXT.W„D0“canuseittoindexintotheWDC1‰BNE.S„L0481opcodetable.‚IftheIOFUNCTcodeis(*¦nonzero,wearen'tprocessingaformat'*¦command.‚Inthiscase,wecanusethe&*¦IOFUNCTvaluedirectly.‚Foraformat#*¦command,however,wemustdosome*¦specialprocessing. PAGE>L0480„EQU†CONFGBLK+IOSILVˆForaformatcommandwemustinstall@‰MOVE.BƒL0480(A1),CMDILV(A5)aninterleavevalueintotheCMDILV$*¦field,whichoverlaystheCMDSECTS'*¦fieldofthecommandpacket.‚Thereis'*¦nosectorcountforaformatcommand,'*¦butthecontrollerrequiresaninter-%*¦leavecodeinplaceoftheCMDSECTS*¦fieldforaformatcommand.* I***************************************************************************ˆBWN‡2/13/84ƒPJD‡9/19/84*>****…BTSTW„#IOPTRKB,IOOPTS(A1)„IftheIOOPTSvalueinthedisc8****…BEQ.S„L0490drive'sI/Opacketindicatesthatwe're*'‰CMP.W…#IOPDSK,IOOPTS(A1)‚Formatdisk?‰BEQ.S…L0490Branchifyes.*>*ˆUseacompareinsteadtoseeifwehaveaplainformattrack *ˆcommand.*-‰CMP.W…#IOPTRK,IOOPTS(A1)‚Plainformattrack?,‰IF‚‚THEN.SŽIfnot,seeifit'saformat *¦alternatesectortypecommand.*"ŽIFƒIOOPTS(A1)‚<EQ>‚#IOPBAD…THEN.S +“MOVEQB„ALTSEC-OPTBL,D0‡Ifalternatesector*²typecommand,then*²setuptogetALTSEC *²command. “BRA.S…L0490 ŽENDI ‰ENDI*H************************************************************************:‰MOVEQWƒFTRACK-OPTBL,D0†processingaformat-trackcommand,'*¦adjustD0.Wtoindextheformat-track *¦entryoftheWDCopcodetable.%*¦Otherwise,D0.Walreadyindexesthe%*¦format-discentryoftheWDCopcode*¦table. #*¨WeuseasingleIOFUNCTvaluefor&*¦boththeformat-disccommandandthe&*¦format-trackcommand.‚Wedistinguish)*¦onecommandfromtheotherbyexamining*¦theirIOOPTSvalues.L0481;L0483„EQU†CONFGBLK+IOSSPTˆForallcommands,change6thbyte(*¦tosingle-density,128bytes/sectorif(*¦weareontrack0(floppydiscsonly).*/‰CLR.L„D1•Comparethe#ofsectorspertrackto=‰MOVE.BƒL0483(A1),D1‰thestartingsector#inthecmdpacket.8‰CMP.W„1(A3),D1Whenit'swithinTrack0,changeCMDCTRL1‰BLE.S„L0490tosingledensity,128bytes/sector.4CHGSSCƒEQU†$C7”NoticeA3ispointingtothe2ndbyte+‰AND.B„#CHGSSC,4(A3)ˆofthecommandpacket.&*¨Thisisvalidforafloppyonly.‚The)*¦startingsector#willneverbegreater!*¦thanawordvalueforafloppy. L0490„EQU‡* I************************************************************************** *ˆBWN‡2/13/84*?*ˆBecauseoftheaddedcode,wegetadisplacementerroronthe*ˆcommentedoutstatement.*‰LEA‡OPTBL(PC),A4‰MOVE.B„0(A4,D0.W),-(A3)D***†MOVE.BƒOPTBL(PC,D0.W),-(A3)ƒFinally,filltheCMDOPfieldofthe**O********************************************************************************)*¦commandpacketfromtheproperentryof&*¦theWDCopcodetable.‚NoticethatA3&*¦nowpointstotheCMDOPfieldofthe'*¦commandpacket,sowecanuseA3with)*¦autoincrementaddressingaswesendthe(*¦commandpackettotheSASIcontroller.#***********************************ééGSENDNEW‚BTSTW„#IOPRTYB,IOOPTS(A1)ƒcheckfornoretryoptiononthiscmd‰BNE.S„SENDNEW12‰MOVE.Bƒ#RETRYCNT,RETRY(A5)„Initializeretrycount‰BRA.S„SENDAGN@SENDNEW1MOVE.Bƒ#$01,RETRY(A5)ˆtellfirmware'noretriesplease'%*************************************7SENDAGN‚BSR†SENDCMDSendthecommandpackettotheWDC.$*¦controller,andsubroutineSENDCMD'*¦assumesthatA0pointstothememory-*¦mappedI/OareafortheWDC.* *¨Controlfallsthrutothedata*¦handlingpartofthedriver.‰PAGEO*********************************************************************************ˆDATAHANDLER*B*ˆWeassumethatthecommandisadatatransfertype(i.e.reador?*ˆwrite)andsetuptotransferasector.‚ThisiswastediftheéééééB*ˆcommandisaconfigureorformatbutsincemostcomandsareR/W,*ˆwewon'tworryaboutit.*<*ˆEntry:„A0=physicaladdressofWDCMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ*ƒP**ˆExit:*O******************************************************************************* NEXTSECTEQU†*L0491„EQU†CONFGBLK+IOSPSM3‰MOVE.WƒL0491(A1),D1‹Getthenumberofbytes/sector2‰TST.B„HALFSCTS(A1)‹Doesthiscommandinvolvehalf *¦sectors?‰BEQ.S„L0530’No.)‰LSR.W„#1,D1’Yes.Dividesectorsizeby2 7‰IFNE…LCDSCTSZ-128‹ThedriverdependsonLCDSCTSZtobe‰FAIL…0”equalto128.‰ENDCœIfthiserroroccurs,the(*¦mainte nanceprogrammerwillbealerted*¦oftheerror. PAGE;L0530„LSR.W„#LCDSCTBT,D1‰D1.B=numberofblocks/sectorfor*¨thecurrentcommand.%‰MOVE.BƒD1,BLKCNT(A5)ˆSavethecount. 7NEXTSEC1BSR†INTRTN‘TheWDCcontrollerneedstimetodo$*¦itsjobbeforewecantransferany(*¦data,soreturncontroltothesystem.&*¦WhentheWDCcontrollerhasfinished$*¦itscurrenttask,we'llreceivean&*¦interruptthatwillcausecontrolto(*¦comebackhere.‚Theco-routinelinkage)*¦convenientlyallowsustocalltherest&*¦ofthesystemasifitweresimplya)*¦subroutinetobeexecutedwhilewehave*¦nothingbettertodo.  *¦THEINTERRUPTENTERSHERE<‰MOVE.LƒIOBUFPTR(A1),A3ˆPointA3tothenextbyteoftheI/O&*¦buffer.‚WenowhavebothA3andD1.W%*¦setupproperlyforareadorwrite'*¦transaction.‚Ifwe'reperformingsome&*¦otherkindoftransaction(suchasa(*¦formatcommand),we'vesimplywasteda(*¦littletimebysettingupA3andD1.W. ;‰MOVE.BƒIOFUNCT(A1),D2‰SetD2.B=+1forareadtransaction2‰ASR.B„#1,D2or-1forawritetransaction.‚WesetO*********************************************************************************ˆBWN‡2/15/84ƒPJD‡9/19/84**ˆCommentedoutthisline:3****…BEQ†RDSTAT1ŽD2.B=0foranyotherkindofI/O#*¦transaction.‚Ifthecommandwe're&*¦processingisneitherareadcommand(*¦norawritecommand,wehaveaCOMMAND"*¦COMPLETIONandcancheckstatus.**ˆInstead,dothisbranch:*‰BNE.S…RD_WRIfthisisareadorawrite, *¦godoit*%*ˆNowtakecareoftheformatcommand**/‰IF.B†IOFUNCT(A1)‚‚#FMTFUNCƒTHEN.S„Format?*9*ˆTheeffectofformattingsectorsasgoodisthesameas<*ˆtheusualformattingtrack,sowedecidedtoleaveitout.* *ˆFormattracksectorsas"good"**/**ŒCMP.WŠ#IOPGOOD,IOOPTS(A1)„"Formatasgood?"**ŒIFƒƒTHEN.S‘Yes.....'**‘MOVE.B„#GOODCODE,D5D5.B<---Opcode-**‘MOVE.B„#32,D2ŽD2.B<---First"bad"sector*°Ifgreaterthanorequalto*°32,thennobadsectors.*'**‘BSR‡SEND_BYTESŠSendthe256bytesof*°formatdescriptortothe *°controller.*?*ˆWewanttodisablethedatainterruptbecausewearealldoneC*ˆsendingdata.TheCMDSECTSfield,whichisthesameastheCMDILVA*ˆ(interleavefactor)field,mustbesetto0,asitistestedin *ˆINTRTN.***‘SF.B†CMDSECTS(A5)**‘BRA‡READSTATŒGoreadstatus*°(justlikeadatatransfer)***ŒENDI***ˆFormattracksectorsas"bad"** )ŽCMP.WŠ#IOPBAD,IOOPTS(A1)‚Formatasbad?ŽIFƒƒTHEN.S–Yes...,“MOVE.W„ALTCYL(A1),D0…D0.W<---cylinderno.*°ofalternatesector6“MOVE.B„ALTHEAD(A1),D1„D1.B<---headno.ofalternate3“MOVE.B„BADSEC(A1),D2…D2.B<---firstbadsectorin*°track.*,“MOVE.B„#GOODCODE,D5ˆD5.B<---Opcode(good)+“BSR‡SEND_BYTESŠSend256bytestocontrolle*°tomarksectors0through*°sectorno.-1‚as‚"good",*°andthesectorsfrom *°sectorno.*°through31as"bad",*°designatingcorresponding*°sectorsonthealternate*°trackas"alternates".**?*ˆWewanttodisablethedatainterruptbecausewearealldoneC*ˆsendingdata.TheCMDSECTSfield,whichisthesameastheCMDILVA*ˆ(interleavefactor)field,mustbesetto0,asitistestedin *ˆINTRTN.*“SF.B†CMDSECTS(A5)(“BSR‡INTRTNŽWaitforcontrollertodoit**3“BTST.B„#BITCB,FLAGS(A0)„IsWDCbusy?Shouldn'tbe. “BNE‡CTRLERR/“TST.B…SENSBYT0(A5)ˆAnyerrorsonthiscommand?“BNE.L…CHECKERR***ˆMarksectorsas"alternates"*>*ˆWemustrestoretheinterleavefactorinthecommandpacket.**&“MOVE.B„CONFGBLK+IOSILV(A1),CMDILV(A5) )“BSR‡SET_UP_ALTŠSetup"formatalternate"*°commandpacket.*;*ˆSENDCMDexpectstofindtheaddressofthecommandpacket*ˆinA3.*“LEA‡CMDOP(A5),A3 “BSR‡SENDCMD “BSR‡INTRTN 2“MOVE.B„#ALTCODE,D5‡D5.B<---Opcodeforalternate*)“MOVE.B„#32,D2ŽD2.B<---firstsectorno.*°tobemarked"bad".,“BSR‡SEND_BYTES‡Send256bytestocontroller*°tomarkallsect orsofthe *°alternatetrackas"alternate"*?*ˆWewanttodisablethedatainterruptbecausewearealldoneC*ˆsendingdata.TheCMDSECTSfield,whichisthesameastheCMDILVA*ˆ(interleavefactor)field,mustbesetto0,asitistestedin *ˆINTRTN.*“SF.B†CMDSECTS(A5) “BRA‡READSTATŽENDI ‰ENDI*‰BRA‡RDSTAT1—Ifcontrolreachesthispoint*°wehaveacommandcompletion*°andcancheckstatus. RD_WR„EQU‡*K*************************************************************************** 8‰MOVE.BƒFLAGS(A0),D0‹Ifwe'reperformingadatatransfer *¦thecontrollershouldbeBUSY.éé*%%%%%%%%%%%%ƒBWN‚12/21/84**‚Here'stheproblem:*?*‚HowdowegetthecorrectsectornumbertobereturnedtoIOS>*‚whenthereisanerrorhere(liketrack/sectorIDnotfound)G*‚andalsowhenthereisanothererrorlateronafterwehaveuppedtheB*‚LSNanddecrementedtheCMDSECTSinthecommandpacket,andalsoD*‚keepthecorrectsectornumberforretriesandcorrectibleerrors?*B*‚Ifanerroroccurshere,wewillnotreadorwriteanydatainto?*‚theuserbuffer,soretriesandcorrectibilitydonotmatter.-*‚Wewilldefinitelyhaveanerrortoreport.*D*‚SinceatthispointwehavethecurrentLSNinthecommandpacket,?*‚wearegoingtogorighttoSTATERR.‚Ifwehavetoupdatethe6*‚RRNfortheIOSparameterblock,itwillbecorrect.*,**‡BPL†CHECKERRNOTBUSY.Gotocheckerror. ‰BPL‡STATERR*D*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ‰BTST…#BITDRQ,D0IsDRQon.3‰BEQ†CTRLERRŽWedon'tknowwhythere'saninterrupt*@*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>* *ˆbwn‡3/5/84*=*ˆDoublecheckthat‚wewillnotreadorwritepasttheendof$*ˆthebufferonournextread/write.1*ˆStartingaddressisinA3,endingaddressisin8*ˆIOBUFEND,andweareabouttotransferLCDSCTSZbytes.**(‰MOVE.L„A3,D0™D0<---Startingaddress+‰ADD.L…#LCDSCTSZ-1,D0˜128-1‰CMP.L…IOBUFEND(A1),D0'‰IFˆƒTHEN.S‘Abouttogopastuser's*°buffer?NOTNICE!!!“TST.B…D2’Ifthisisaread,thenéé*“IFƒƒTHEN.SŒReadbytesintobitbucket˜BSR.S…READJUNK˜BRA‡RWCOMMON‡Thencontinueon.“ENDI*C*ˆIfthiswasawrite,andyoumiscalculated,youaregoingtomess*ˆupthedisk.* ‰ENDI*D*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> *‰TST.B„D2•Checkforreadorwritecommand.'‰BLT.S„WRTDATAŽBRANCHIFWRITECOMMAND.*¨FALLTHRUONREAD ‰PAGEO********************************************************************************C*ˆREADDATAROUTINEenteredafteraWDCinterrupt(DRQ)foraread.*<*ˆEntry:„A0=physicaladdressofWDCMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB)*’A3=pointertonextbyteofI/Obuffer*’A5=physicaladdressofCCB*!*ˆRegi sterusage:…01234567*™D‚*…**™A‚P…**9*ˆExit:…Branchestoread/writecommonroutine(RWCOMMON).*O******************************************************************************* READDATAEQU†*.L0546„EQU†4*8”Eachiterationoftheinnerloop%*¦belowtransfers4*8=32databytes @‰MOVEQWƒLCDSCTSZ/L0546-1,D3„InitializeD3.Wtocontroltheinner'*¦loop.‚We'llperformenoughiterations(*¦oftheinnerlooptotransferLCDSCTSZ(*¦bytesofdata,whichmustandhasbeen*¦checkedtobe=128 PAGEDL0550„MOVEP.L‚DATA0(A0),D0†----ƒEachcompleteiterationofthisloop9‰MOVE.LƒD0,(A3)+Š|ƒtransfers4*8=32databytesfromthe'*§|ƒWDCcontrollertotheinputbuffer,=‰MOVEP.L‚DATA0(A0),D0†|ƒandweperformjustenoughiterations9‰MOVE.LƒD0,(A3)+Š|ƒofthisinnerlooptotransferatotal *§|ƒofLCDSCTSZbytesduringone4‰MOVEP.L‚DATA0(A0),D0†|ƒiterationoftheouterloop.‰MOVE.LƒD0,(A3)+Š|#*§|ƒWeuseaMOVEP.Linstructionto<‰MOVEP.L‚DATA0(A0),D0†|ƒtransferfourconsecutivedatabytes:‰MOVE.LƒD0,(A3)+Š|ƒwiththemaximumpossiblespeed,andwe&*§|ƒreplicatethecodeinthisloopto<‰MOVEP.L‚DATA0(A0),D0†|ƒreducetheeffectsofloopoverhead.6‰MOVE.LƒD0,(A3)+Š|ƒWecouldreplicatethecodeinthis'*§|ƒloopmoretimesforevenmorespeed=‰MOVEP.L‚DATA0(A0),D0†|ƒbutdiminishingreturnsbegintomake8‰MOVE.LƒD0,(A3)+Š|ƒfurtherreplicationslessattractive.*§|<‰MOVEP.L‚DATA0(A0),D0†|…TheWDCcontrolleractuallyhasjust7‰MOVE.LƒD0,(A3)+Š|ƒonedataregister,butthatregister'*§|ƒappearsat4differentlocationsin>‰MOVEP.L‚DATA0(A0),D0†|ƒthememorymap.Therefore,theMOVEP.L9‰MOVE.LƒD0,(A3)+Š|ƒinstructionactuallyaccessesthesame%*§|ƒdataregisterfourtimeswiththe+‰DBRA…D3,L0550Š----‚maximumpossiblespeed.  1‰BRA.S„RWCOMMONWe'vefinishedreadingacomplete'*¦blockofinputdata,sonowgotothe#*¦commonroutinethatcompletesthe*¦processingforbothread"*¦operationsandwriteoperations.‰PAGEO********************************************************************************B*ˆREADJUNK‚ROUTINEenteredafteraWDCinterrupt(DRQ)foraread.D*ˆwhenwerealizethatweareabouttowritepasttheuser'sbuffer.2*ˆWewilljustreadthebytesintothebitbucket.*<*ˆEntry:„A0=physicaladdressofWDCMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB)*’A3=pointertonextbyteofI/Obuffer*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚*…**™A‚P…**9*ˆExit:…Branchestoread/writecommonroutine(RWCOMMON).*O******************************************************************************* READJUNKEQU†* @‰MOVEQWƒLCDSCTSZ/L0546-1,D3„InitializeD3.Wtocontroltheinner'*¦loop.‚We'llperformenoughiterations(*¦oftheinnerlooptotransferLCDSCTSZ(*¦bytesofdata,whichmustandhasbeen*¦checkedtobe=128 PAGEFRD_LOOP‚MOVEP.L‚DATA0(A0),D0†----ƒEachcompleteiterationofthisloop**£|ƒtransfers4*8=32databytesfromthe$*§|ƒWDCcontrollertotheBITBUCKET=‰MOVEP.L‚DATA0(A0),D0†|ƒandweperformjustenoughiterations**£|ƒofthisinnerlooptotransferatotal *§|ƒofLCDSCTSZbytesduringone4‰MOVEP.L‚DATA0(A0),D0†|ƒiterationoftheouterloop.*£|#*§|ƒWeuseaMOVEP.Linstructionto<‰MOVEP.L‚DATA0(A0),D0†|ƒtransferfourconsecutivedatabytes+*£|ƒwiththemaximumpossiblespeed,andwe&*§|ƒreplicatethecodeinthisloopto<‰MOVEP.L‚DATA0(A0),D0†|ƒreducetheeffectsofloopoverhead.'*£|ƒWecouldreplicatethecodeinthis'*§|ƒloopmoretimesforevenmorespeed=‰MOVEP.L‚DATA0(A0),D0†|ƒbutdiminishingreturnsbegintomake)*£|ƒfurtherreplicationslessattractive.*§|<‰MOVEP.L‚DATA0(A0),D0†|…TheWDCcontrolleractuallyhasjust(*£|ƒonedataregister,butthatregister'*§|ƒappearsat4differentlocationsin>‰MOVEP.L‚DATA0(A0),D0†|ƒthememorymap.Therefore,theMOVEP.L**£|ƒinstructionactuallyaccessesthesame%*§|ƒdataregisterfourtimeswiththe-‰DBRA…D3,RD_LOOPˆ----‚maxi mumpossiblespeed.  ‰RTSO*******************************************************************************   ‰PAGEO********************************************************************************K*…WRITEDATAROUTINEenteredwhenwehaveaWDCinterupt(DRQ)forawrite.*<*ˆEntry:„A0=physicaladdressofWDCMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB)*’A3=pointertonextbyteinI/Obuffer*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚*…**™A‚P…**=*ˆExit:…Fallthroughtoread/writecommonroutine(RWCOMMON).*O******************************************************************************* WRTDATA‚EQU†* .L0561„EQU†4*8”Eachiterationoftheinnerloop&*¦belowtransfers4*8=32databytes. @‰MOVEQWƒLCDSCTSZ/L0561-1,D3„InitializeD3.Wtocontroltheinner'*¦loop.‚We'llperformenoughiterations(*¦oftheinnerlooptotransferLCDSCTSZ*¦bytesofdata.ei.128bytes PAGE?L0570„MOVE.Lƒ(A3)+,D0Š----‚Eachcompleteiterationofthisloop>‰MOVEP.L‚D0,DATA0(A0)†|ƒtransfers4*8=32databytesfromthe'*§|ƒoutputbuffertotheWDCcontroller8‰MOVE.Lƒ(A3)+,D0Š|ƒandweperformjustenoughiterations>‰MOVEP.L‚D0,DATA0(A0)†|ƒofthisinnerlooptotransferatotal *§|ƒofLCDSCTSZbytesduringone/‰MOVE.Lƒ(A3)+,D0Š|ƒiterationoftheouterloop.‰MOVEP.L‚D0,DATA0(A0)†|#*§|…WeuseaMOVEP.Linstructionto7‰MOVE.Lƒ(A3)+,D0Š|ƒtransferfourconsecutivedatabytes?‰MOVEP.L‚D0,DATA0(A0)†|ƒwiththemaximumpossiblespeed,andwe&*§|ƒreplicatethecodeinthisloopto7‰MOVE.Lƒ(A3)+,D0Š|ƒreducetheeffectsofloopoverhead.;‰MOVEP.L‚D0,DATA0(A0)†|ƒWecouldreplicatethecodeinthis'*§|ƒloopmoretimesforevenmorespeed8‰MOVE.Lƒ(A3)+,D0Š|ƒbutdiminishingreturnsbegintomake=‰MOVEP.L‚D0,DATA0(A0)†|ƒfurtherreplicationslessattractive.*§|7‰MOVE.Lƒ(A3)+,D0Š|…TheWDCcontrolleractuallyhasjust<‰MOVEP.L‚D0,DATA0(A0)†|ƒonedataregister,butthatregister'*§|ƒappearsat4differentlocationsin9‰MOVE.Lƒ(A3)+,D0Š|ƒthememorymap.‚Therefore,theMOVEP.L:‰MOVEP.L‚D0,DATA0(A0)†|ƒinstructionaccessesthesamedata%*§|ƒregister4consecutivetimeswith/‰DBRA…D3,L0570Š----‚themaximumpossiblespeed. %*¨We'vefinishedtransferringablock&*¦ofoutputdata,sonowcontrolfalls(*¦intothecommonroutinethatcompletes*¦theprocessingforboth'*¦readoperationsandwriteoperations.‰PAGEO********************************************************************************<*ˆREAD/WRITECOMMONROUTINE‚enteredafterreadingorwriting*£ablockofdata(128bytes)*<*ˆEntry:„A0=physicaladdressofWDCMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB-*’A3=pointertonextbyteintheI/Obuffer*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™D *™A‚PPƒPƒP*=*ˆExit:…FallthroughtoSASIDONEroutinetofinishprocessing%*’thecurrententryoftheI/Oqueue.*O******************************************************************************* @RWCOMMONMOVE.LƒA3,IOBUFPTR(A1)ˆUpdatetheI/Obufferpointerto#*¦pointtothenextbyteoftheI/O%*¦buffer.‚Ifthere'sanotherblockof'*¦datatobetransferred,IOBUFPTRwill'*¦beusedtoaddresstheI/Obuffer.‚If&*¦thereisn'tanotherblockofdatato'*¦betransferred,we'lluseIOBUFPTRto)*¦calculatethenumberofbytesthatwere&*¦actuallytransferredortoperforma*¦retryonreaddataerrors. PAGE9‰SUB.B…#1,BLKCNT(A5)‰Subtract1fromblockcountforthis *¦sector.0‰BNE†NEXTSEC1Wehaven'tfinishedasectorsogo(*¦tocontinuethetransferiftheWDCis*¦requestingdatatransfer. *¨We'llfinishedthesector,So*%%%%%%%%‚BWN12/21/84=*‚HEREWEINCREMENTTHELSNANDDECREMENTTHECMDSECTSFIELDS*‚OFTHECOMMANDPACKET**  ééééé7‰ADD.L„#1,CMDOP(A5)‹IncrementtheLSN.Thismaybeused%*¦toretryifsectorisfoundtohave*¦anECC/CRCerror.:‰SUB.B„#1,CMDSECTS(A5)ˆDecrementthecountofsectorsthat4‰BHI†NEXTSECTremaintobeprocessedforthecurrent**%%%%%%%%%%%%%%%%%%%%%%%%%% %*¦WDCcommandsequence.‚Ifwehaven't(*¦finishedprocessingallofthesectors'*¦forthecurrentWDCcommandsequence,$*¦loopbacktoprocessthenextone. =‰BTST.Bƒ#BITCB,FLAGS(A0)‡We'vefinishedprocessingallofthe'*¦sector(s)forthecurrentWDCcommand *¦sequence. 1‰BNE.S„READSTATTheWDCmaystillbeBUSYbecause(*¦ofadataECCerrorinthelastsector%*¦read.Inthiscaselet'sreturnand$*¦waitforthecompletioninterrupt. #*¨IftheWDCisdone.(normalcase)A‰MOVE.BƒSENSE(A0),SENSBYT0(A5)ReadSENSEBYTE0toclearCCint."‰BRA.S„RDSTAT1Gotocheckstatus. 7READSTATBSR.S„INTRTN‘Returncontroltothesystem,and(*¦waitforastatus-readyWDCinterrupt.%*¦We'llgetcontrolbackwhentheWDC)*¦controllerhasitsstatusreportready. PAGEO********************************************************************************$*ˆWegethereafteraWDCinterrupt.2*ˆWeareexpectingacommandcompletioninterrupt.*O******************************************************************************* 6‰BTST.Bƒ#BITCB,FLAGS(A0)…IsWDCBUSY?Itshouldn'tbe.4‰BNE†CTRLERRŽYES.MustbeaDRQinterruptthatwe're*¦notexpecting.ARDSTAT1‚TST.B„SENSBYT0(A5)‰Werethereanyerrorsinthiscommand?é'‰BNE.L„CHECKERRYES.Gotocheckerror. =XFERDONECLR.B„HALFSCTS(A1)‹Thisclearsthehalfsectorcount"*¦sinceallhalfsectorshavebeen%*¦transferedanyadditionaltransfers&*¦forthisI/Opacketwillbesectors.7‰TST.L„IOSCTCNT(A1)‹TheWDCcontrollerhassuccessfully1‰BNE†PROCQUEŽcompletedtheentireI/Otransaction(*¦thatwasspecifiedbythelastcommand(*¦sequencethatwegaveit.‚Ifthereare'*¦anysectorsremainingtobeprocessed)*¦forthecurrententryoftheI/Oqueue,'*¦loopbacktoprocessanotherchunkof*¦theentireI/Otransfer. %*¨RecallthatIOSCTCNTisalwayszero&*¦foranyI/Otransactionthatdoesn't(*¦involvethetransferofanyread/write*¦data. 9‰MOVE.BƒEOVFLAG(A1),D1‰We'venowcompletedtheent  ireI/O'*¦transactionthatwasspecifiedbythe$*¦commandthatgeneratedthecurrent%*¦entryoftheI/Oqueue.‚TheEOVFLAG'*¦valuethatwegetintoD1.Bherewill#*¦bereturnedtotheuserasanI/O&*¦statuscode.‚IftheI/Otransferwas'*¦truncatedtoavoidrunningbeyondthe(*¦endofthedisc,wereturntheISTAEOV'*¦statuscode.‚Otherwise,wereturnthe)*¦ISTAOKstatuscodetoindicatethatthe!*¦entireoperationwentsmoothly. $*¨ControlnowfallsintotheWDCDONE"*¦routinetofinishprocessingthe!*¦currententryoftheI/Oqueue.‰PAGEO*********************************************************************************ˆFINISHPROCESSINGQUEUEENTRY*F*ˆControlcomesherewhen‚thedriverisreadytofinishprocessingtheE*ˆcurrententryofthe‚I/Oqueue.‚We'llqueueanI/OcompletioneventC*ˆtotheattached‚task,andwe'll‚removethe‚currententry‚fromtheF*ˆqueue.‚IftheI/Oqueuehasanotherentry,we'llloopbackandstart*ˆprocessingthatentry.*%*ˆEntry:„A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚*ƒ* *™A„*ƒ**P*=*ˆExit:…Branchestoprocessnextqueueentryifthereisone.0*’Fallsthroughtoidleloopifthereisn'tone.*O******************************************************************************* 3SASIDONEEQU†*–WeuseaMOVEM.Linstructiontopull=L0630„REG†D0/D2/A1/A3/A4‡severalvariablesoutofthecurrentA‰MOVEM.L‚IOBUFLOC(A1),L0630ƒI/Opacketinonestep.‚Thisinstruc-(*¦tionsetsuptheregistersasfollows. L1‡SET†IOBUFLOCD0=IOBUFLOC.L1‡SET†IOBUFPTRD2=IOBUFPTR.L1‡SET†IOBUFTCBA1=IOBUFTCB.5L1‡SET†DCBPNTRŽA3=DCBPNTR.‚(ForsubroutineQEVENTI)5L1‡SET†IOCBPTRŽA4=IOCBPTR.‚(ForsubroutineQEVENTI) $*¨TheSETinstructionsthatareused'*¦herearejustdummyinstructionsthat&*¦generateartificiallabelreferences%*¦fortheconcordancelisting.‚Future)*¦maintenanceprogrammerswillbeableto)*¦usetheconcordancelistingtodiscover$*¦thatthissegmentofcodeaccesses*¦thesevariables. PAGE1‰SUB.L„D0,D2’Nowcomputethenumberofdatabytes=‰MOVE.LƒD2,IOSLEN(A4)ˆthatweactuallytransferred,andstore&*¦thatnumberintotheIOSLENfieldof%*¦theIOCB.‚ForanI/Ooperationthat%*¦doesn'tinvolvethetransferofany%*¦read/writedata,wehaveIOBUFLOC=)*¦IOBUFPTR,soweproperlysetIOSLEN=0*¦inthiscase. 3‰LEA‡ERRDISK(PC),A2ˆTesttheVersadoserrorcodeto=BERNARD‚MOVE.B„(A2)+,D2ŒdeterminewhethertheIOSRRNfieldof6‰BEQ.S…NOCOPYŽtheIOCBneedstobeupdated.Ifamatch0‰CMP.B…D2,D1isfoundinthetableERRDISK,then4‰BNE.S…BERNARDupdatetheIOSRRNfieldwithVersados*‰MOVE.L„D3,IOSRRN(A4)‡sectornumberinD3. 3NOCOPYƒBSR†QEVENTISubroutineQEVENTIqueuesanI/O(*¦completioneventtotheattachedtask.)*¦RegistersA5,A4,A3,andD1.Bmustall)*¦besetproperlywhenwecallsubroutine *¦QEVENTI. 9‰SUB.B„#1,TCBIOCNT(A1)ˆDecrementthecountofoutstanding'*¦I/Ooperationsforthetaskthatowns)*¦theI/Obuffer(ortheIOCBinthecase%*¦ofaformatcommandoraconfigure-*¦floppycommand). 6L0640„REG†A1/A3/A4HereweremovethefrontentryfromA‰MOVEM.L‚IOQUEUE+4(A5),L0640‚theI/Oqueue,andwesimultaneouslyA‰MOVEM.L‚L0640,IOQUEUE(A5)„setA1topointtothedriveblockfor(*¦thediscdrivethatisassociatedwith$*¦thenext(ifany)entryoftheI/O%*¦queue.‚Sincethereareamaximumof(*¦fourentriesintheI/Oqueue,weneed'*¦tomovenomorethanthreeentriesto(*¦removethefirstentryfromthequeue. 6‰SUB.W„#4,IOQCNT(A5)ŠReducethequeue-countpointerto1‰BHI†PROCQUEŽaccountforthefactthatwe'vejust(*¦removedafour-byteentryfromtheI/O$*¦queue.‚Ifthereisstillanactive&*¦entryintheI/Oqueue,loopbackto"*¦startprocessingthenextentry. $*¨IftheI/Oqueueisempty,control(*¦fallsintotheco-routinesegmentthat%*¦ispotentiallyactivewhentheSASI'*¦controlleriscaughtupandshouldbe*¦idle.‰PAGEO! ********************************************************************************@*ˆIDLELOOPROUTINEenteredwhentheI/Oqueuehasbeenemptied.B*ˆThecontrolleriscompletelycaughtupwithallofitsrequests,D*ˆandthecontrollershouldnowbeidle.‚We'llsimplereturncontrol'*ˆtothesystemtoidlethecontroller.*<*ˆEntry:„A0=physicaladdressofWDCMemory-MappedI/Oarea*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D„*** *™A‚P…**P**ˆExit:…ReturntoCMRviaRTS*O******************************************************************************* :IDLELOOPBSR.S„INTRTN‘TheI/Oqueueisempty,sowesimply%*¦returncontroltothesystem.‚We've)*¦caughtupwithalloftherequeststhat'*¦havebeensetupforprocessingunder*¦interruptcontrol. ƒD2ƒDO.S‰Markgooduptosectno.-1*°ormarkalternate +MOVE.B„D5,DATA0(A0)ˆMoveopcode(00or40)'MOVE.B„D3,DATA0(A0)ˆMovesectornumber&MOVE.B„#0,DATA0(A0)ˆMove3morebytesMOVE.B„#0,DATA0(A0)MOVE.B„#0,DATA0(A0) ,ADDQ.B„#1,D3ŽGetnextsectornumberintoD3 SUBQ.W„#5,D6 ‰ENDW ‰MOVE.W„D0,D4-‰LSR.W…#8,D4D4.W‚<---MSBofcylindernumber ,‰LSL.B…#5,D1Getheadnumberintobits7,6,52‰ADD.B…D2,D1Getsectornumberintobits0-4ofD1 5‰WHILE.BƒD3‚‚#32‚DO.S„Marksectorsto31as"bad" &MOVE.B„#BADCODE,DATA0(A0)ˆSendopcode'MOVE.B„D3,DATA0(A0)ŽSendsectornumber-MOVE.B„D4,DATA0(A0)ŽSendMSBofcylinderno.-MOVE.B„D0,DATA0(A0)ŽSendLSBofcylinderno.,MOVE.B„D1,DATA0(A0)ŽSendHead+sectornumber ADD.B…#1,D3 ADD.B…#1,D1 SUBQ.W„#5,D6 ‰ENDW*=*ˆWehavenowsent5*32=160‚bytes.Thecontrollerwants256"*ˆsowesend96more,4atatime.*‰REPEAT MOVEP.LƒD3,DATA0(A0) SUBQ.W„#4,D6 ‰UNTIL… *‰MOVEM.Lƒ(SP)+,SEND_REGS…Restoreregisters ‰RTS   ‰PAGEF*********************************************************************** *ˆSET_UP_ALT*;*ˆSetupacommandpacketfortheformatalternatecommand.;*ˆJusttakethecommandpacketyouhavenow,andsubstitute<*ˆthealternatesectornumberforthesectornumberinthere*ˆnow.**/*ˆEntry:„A1=addressofdrive'svariableblock*’A5=a" ddressofCCB*!*ˆRegisterusage:…01234567*™D„**™A„P‡P*ˆP=parameterregister!*ˆ*=savedandrestoredregister**ˆExit:…sameasentry*O*******************************************************************************SET_UP_ALT‰EQU‡**!‰MOVE.L„D1,-(SP)ŒSaveregisterD15‰MOVE.L„CMDOP(A5),D1ˆSavebytes0-3ofcommandpacket*¦inD1.*2‰AND.L…#LSNMSKNOT,D1‡Maskoutlower21bitsofD1.#*¦Thesebitscontaintheoldsector *¦number.%*¦ThestuffwewanttosaveisinD1.*3‰MOVE.L„IOALTSEC(A1),CMDOP(A5)ˆPutalternatesector*¦numberintocommandpacket.B‰AND.L…#LSNMASK,CMDOP(A5)‚Maskoutupper11bitsofcommandpacket$*¦ThesebitscontainOpcodeandLUN.*1‰OR.L†D1,CMDOP(A5)ˆCombinetheoldOpcodeandlun!*¦withthenew(alternate)sector *¦number.$‰MOVE.L„(SP)+,D1‚RestoreregisterD1**‰RTS  ‰PAGEO*********************************************************************************ˆCHECKERRORROUTINE***ˆSomeerrorhasbeendetectedbytheWDC.**ˆForaREADcommand:>*IftheerrorisanECCerror(correctableoruncorrectable),+*’1.‚Comparecurrenterrorwithlasterror.<*’2.‚Ifretrycountisnotexhausted,retryfrombadsector.;*’3.‚Ifretrycountisexhausted,erroriscorrectable,and7*–thelasttwoerrorswereidentical,we'llcorrectthe4*–errorinmemoryandissuetherestofthecommand.*’4.‚Elsereporttheerror.*+*ˆForallothercommands,reporttheerror.*<*ˆEntry:„A0=physicaladdressofWDCMemory-MappedI/Oarea/*’A1=pointertodrive'svariableblockinCCB<*’A3=pointertoI/Obuffer(exceptonlastsectorofxfer)*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D‚*** *™A‚PPƒ**P**ˆExit:…Reporttheerror.*O******************************************************************************* CHECKERREQU†*%‰SUB.B„#1,RETRY(A5)‰DECR.RETRYCOUNT)UNCORREREQU†$12’UNCORRECTABLEDATAERROR%CORRERƒEQU†$13’CORRECTABLEDATAERROR0‰MOVE.Wƒ#8,D0LOOPCOUNTERTOREAD&COMPARETHE*§REMAINING9SENSEBYTES. %*£NOTE:THATTHEREISNONEEDTOINIT#*§THESAVEAREAFORTHESENSEBYTES&*§SINCETHECOMPAREISONLYUSEDAFTER*§ALLRETRIESHAVEBEENDONE 9‰LEA†SENSBYT0(A5),A4†POINTERTOSENSEBYTE0.NOTICETHAT$*§THE10SENSEBYTESAREACCESSEDIN *§ORDER(ei.0..9)BYSEQUENTIAL!*§READSOFTHESAMEMEMORYMAPPED!*§BYTEINTHEWDC.WEHAVEDONEA#*§READOFSENSEBYTE0TOCLEARTHE&*§INTERRUPT.WE'LLGETBYTE0FROMTHE *§SAVEAREA,THENACCESS1THRU9 !‰MOVE.Bƒ(A4)+,D1GETSENSEBYTE07‰EOR.B„#CORRER,D1‹D1.BWILL=0IFERRORISCORRECTABLE8‰OR.B…RETRY(A5),D1‰D1.B=0IFCORRECTABLE&RETRYCOUNT*«=0(L0552„MOVE.BƒSENSE(A0),D2‰GETSENSEBYTE‰CMP.B„(A4),D2 PAGE0‰BEQ.S„L0553BRANCHIFBYTEFORCURRENTERRORIS*§THESAMEASLASTERROR‰OR.B…#1,D1SETD1TONON-ZERO2L0553„MOVE.BƒD2,(A4)+SAVETHECURRENTERRORBYTES‰DBRA…D0,L0552 )*¦D1.B=0IF(LASTERROR=CURRENTERROR)*±&(ERRORISCORRECTABLE)*±&(RETRYCOUNT=0) ‰TST.B„D1&‰BNE.S„L0555BRANCHIFNOTCORRECTABLE  $* HERE TO CORRECT DATA IN THE BUFFERL0554„EQU†CONFGBLK+IOSPSM:‰MOVE.LƒIOBUFPTR(A1),A3†POINTERTONEXTLOCATIONINBUFFER7‰SUB.W„L0554(A1),A3‰A3POINTSTO1STBYTEINBADSECTOR ‰CLR.L„D1=‰MOVE.BƒSENSBYT7(A5),D1†GETBYTEOFFSETFROMTHESTARTOFTHE"*§THESECTORTOTHE1STERRORBYTE-‰ADD.W„D1,A3BUFFERADDRESSOF1STERRORBYTE>‰MOVE.BƒSENSBYT8(A5),D1†CORRECTIONMASKFORTHE1STERRORBYTE‰EOR.B„D1,(A3)+CORRECTBYTE)‰MOVE.BƒSENSBYT9(A5),D1†SAMEFOR2NDBYTE‰EOR.B„D1,(A3)0‰LEA†CMDOP(A5),A3‰POINTA3TOTHECOMMANDPACKET9‰TST.B„CMDSECTS(A5)‰AREANYMORESECTORSTOBETRANSFERED*§FORTHISCOMMAND?'‰BNE†SENDNEWŽYES.SENDCOMMANDFORREST‰BRA†XFERDONENO.ALLDONE * HERE FOR OTHER ERRORS*%%%%%%%%%%%%%%%ƒBWN‚12/21/84*H*‚WeonlygettoCHECKERRifwereadorwrotethedataanduppedtheLSN3*‚andCMDSECTSinthecommandpacketinpreparation" *‚forgoingtoSENDNEW.*(*‚However,atthispointwewilleither:**ˆ(1)branchtoSTATERRifnomoreretries7*ˆ(2)branchtoSTATERRiferrorisnotcode$12or$!#*ˆ(3)doaretry*E*‚IneachofthesecaseswewanttohavethecurrentLSNandCMDSECTSE*‚inthecommandpacket,sowehavetoadd1toCMDSECTSandsubtract*‚1fromtheLSN.*L0555:‰ADDQ.B…#1,CMDSECTS(A5)‰SUBQ.L…#1,CMDOP(A5)*D*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%‰TST.B„RETRY(A5)ŒISRETRYCOUNT=0?%‰BEQ.S„STATERR&REPORTERRORIFZERO‰MOVE.Bƒ#$FE,D1:‰AND.B„SENSBYT0(A5),D1†MASKLSBSOCODES$12AND$13=$12‰CMP.B„#UNCORRER,D12‰BNE.S„STATERRŽREPORTERRORIFNOTCODE$12OR$13 -* HERE TO DO A RETRY OF THE LAST SECTOR READ.E* THE BAD SECTOR HAS BEEN READ INTO THE BUFFER AND THE COMMAND PACKET0* IS POINTING TO THE NEXT SECTOR. (BWN 12/21/84)é ‰CLR.L„D1%‰MOVE.WƒL0554(A1),D1‰GETBYTES/SECTOR*‰TST.B„HALFSCTS(A1)‰ISTHISAHALFSECTOR?‰BEQ.S„L0556NO.*‰LSR.W„#1,D1YES.BYTE/SECTORDIVIDEDBY2lastentryintableare *¦undefined. ‰BLS.S„L0955‰MOVE.Bƒ#ISTAICE,D1 ‰BRA†SASIDONE EL0955„MOVE.BƒERRCODE(PC,D2.W),D1‚Usethaterrorcodeasanindexinto(*¦theWDCerror-codetable,andwegeta)*¦Versadoserrorcodefromthetableinto%*¦D1.B.‚Oncewe'vetra# nslatedtheWDC(*¦errorcodeintoaVersadoserrorcode,%*¦wetransfercontroltotheSASIDONE&*¦routine,whichwillreporttheerror*¦codeinD1.Btotheuser. PAGE 3‰LEA‡ERRDISK(PC),A4ˆTesttheVersadoserrorcodeto$43 AND /=$80 ARE REPORTED AS "ISTAICE". CODE $80 IS A SELF-G* TEST ERROR AND IS REPORTED AS "ISTAUNR". THESE CHECKS ARE MADE IN THE* STATERR ROUTINE. ‰PAGEO*********************************************************************************ˆCONTROLLERERRORROUTINE*@*ˆThepurposeofthisroutineistoreport"state'errorsofthe*ˆcontroller,forexample:>*Š1.‚TheWDCwantstobereadorwrittenbutthedriverisnot%*Žexpectingtotransfermoredata,orD*Š2.‚TheWDCgeneratedaninteruptbuttheconditionhaschanged,orC*Š3.‚TheWDCwent'busy'beforetheentirecommandpackedwassent.**ˆThereare2entrypoints:6*ŠCTRLERR1:Iftheerrorwasdetectedinasubroutine.2*ŠCTRLERR:Iftheerrorwasdetectedinthemain.*O******************************************************************************* 7CTRLERR1ADDQ.Lƒ#4,SP’Controlcomestothisentrypoint%*¦whenacontrollererrorisdetected%*¦fromwithinasubroutine.‚Weremove&*¦thesubroutine'sreturnaddressfrom(*¦thestack,sothestackisrestoredto&*¦theconditionthatithadbeforethe*¦subroutinewascalled.  =CTRLERR‚ST.B…SASIDOWN(A5)‹DowntheWDCchannelbysettingthe"*¦variablethatindicatesthatthe#*¦controllerisdown.‚Ifthesystem'*¦triestoaccesstheWDCchannelagain#*¦withoutresettingitfirst,we'll%*¦reportanerrorindicatingthatthe$*¦channelisdown.‚Thesystemreally!*¦shouldn'ttrytoaccesstheWDC'*¦channelagainwithoutfirstresetting$*¦thecontroller.‚Evenresettingthe)*¦controllermaynotcorrecttheproblem,'*¦butwe'llletthesystemtryasoften*¦asitwishes. 5‰MOVEQBƒISTACNT,D1SetupD1.Bforreportingastatus5‰BRA†SASIDONEcodethatindicatesacontrollererror,%*¦andgoterminateprocessingforthe!*¦currententryoftheI/Oqueue.‰PAGEO*********************************************************************************ˆSENDCOMMANDROUTINE*G*ˆThepurposeofthisroutineistosendthecommandpackettotheWDC.*8*ˆEntry:„A0=addressof1stbyteofthecommandpacket.5*’A3=physicaladdressofWDCMemory-MappedI/Oarea*!*ˆRegisterusage:…01234567*™D‚***™A‚P…**"*ˆExit:…Returntocallingroutine.*O******************************************************************************* SENDCMD‚EQU‡*&‰MOVEQW„CMDLEN-1,D1‰Numberofbytes-1"L0521„EQU‡(1<‰BTST.B„#BITCB,FLAGS(A0)„TheWDCshouldbeBUSY.‚However,ifa6*ˆBEQ‡CTRLERR1Œhigherlevelinterruptoccurshere,the&*¦thecontrollerwillnotbeBUSYupon**¦returnandthecheckisnolongervalid.'*¦That'swhyithasbeencommentedout.‰RTS ‰ENDC-‰TTL‡ExtendedDCB'sforeachnetworkterminal‰PAGE ‰OFFSET0 TNMSGTƒDS.B†1TNMIORƒEQU‰1ˆI/OrequestTNMIOCƒEQU‰2‡I/OcompleteTNMUB„EQU‰3‡unsolicitedbreakTNMHIOƒEQU‰4‡haltIOrequest/‰DS.Bˆ1‡unused-neededtoword-alignIOSblock-TNIOS„DS.B†IOSBLN„messagetype1--I/OrequestTNWDATA‚DS.B†0‰writedatastart )‰OFFSET„TNIOS…messagetype-2I/OcompleteTNSTATƒDS.B†1‰status#‰DS.B†1‰alignmentforevenboundary(TNDLENƒDS.L†1‰lengthofdata(forreads)TNRDATA‚DS.B†0‰data(forrea$ ds)                  ééééé†#=/*=/*†ACIADRV.AF=/*-=/* Chain file to assemble ACIA serial driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to ACIADRV.LS=/*=/IFC \1ƒ=ARGACIADRV.LS=/ENDIF=/*$=ASM ACIADRV.SA,ACIADRV.RO,\1;RZ=150=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.BAB.EQ=/*ƒ9995.&.TERMINAL.EQ=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.TERMCCB.EQ=/*}=/*=ENDééééé% =/*=/*†DARTDRV.AF=/*I=/* Chain file to assemble SCN2681 SUBORDINATE serial port driver for the$=/* local port on the MVME115 board.=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to DARTDRV.LS=/*=/IFC \1ƒ=ARGDARTDRV.LS=/ENDIF=/*$=ASM DARTDRV.SA,DARTDRV.RO,\1;RZ=140=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.BAB.EQ=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.SCN2681.EQ=/*ƒ9995.&.TERMINAL.EQ=/*ƒ9995.&.TERMCCB.EQ=/*}=/*=ENDééééé˜=/*=/*†DARTSPR.AF=/*H=/* Chain file to assemble SCN2681 SUPERVISOR serial port driver for the$=/* local port on the MVME115 board.=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to DARTSPR.LS=/*=/IFC \1ƒ=ARGDARTSPR.LS=/ENDIF=/*$=ASM DARTSPR.SA,DARTSPR.RO,\1;RZ=100=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.SCN2681.EQ=/*ƒ9999.M68230.M68230.EQ=/*}=/*=ENDééééé% é¡=/*=/*†EPCIDRV.AF=/**=/* Chain file to assemble SIG 2661 driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to EPCIDRV.LS=/*=/IFC \1ƒ=ARGEPCIDRV.LS=/ENDIF=/*$=ASM EPCIDRV.SA,EPCIDRV.RO,\1;RZ=150=/*{ Included files are:=/*ƒ9995.&.SIG2661.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.BAB.EQ=/*ƒ9995.&.TERMINAL.EQ=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.TERMCCB.EQ=/*}=/*=ENDéééééª=/* =/*†IPCDRV.AF=/*)=/* Chain file to assemble the IPC driver=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to IPCDRV.LS=/*=/IFC \1ƒ=ARGIPCDRV.LS=/ENDIF=/*#=ASM IPCDRV.SA,IPCDRV.RO,\1;MRZ=160=/*{ Included files are:=/*ƒ9995.&.TRACE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.DUALPORT.MC=/*ƒ9995.&.UTILITY.MC=/*}=/*=ENDééé& ééé³=/*=/*†M300DRV.AF=/*.=/* Chain file to assemble the IEEE-488 driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M300DRV.LS=/*=/IFC \1ƒ=ARGM300DRV.LS=/ENDIF=/*&=ASM M300DRV.SA,M300DRV.RO,\1;-WRZ=160=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.DUALPORT.MC=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.M300DRV.EQ=/*ƒM300TABL.AI=/*ƒM300INIT.AI=/*ƒM300INTR.AI=/*ƒM300CMND.AI=/*}=/*=ENDééééé¼=/*=/*†M315DRV.AF=/*==/* Chain file to assemble the MVME315 disk controller driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M315DRV.LS=/*=/IFC \1ƒ=ARGM315DRV.LS=/ENDIF=/*$=ASM M315DRV.SA,M315DRV.RO,\1;RZ=180=/*{ Included files are:=/*ƒ9995.&.DUALPORT.MC=/*ƒ9995.&.TRACE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*}=/*=ENDé& éééééÅ=/*=/*†M320DRV.AF=/*==/* Chain file to assemble the MVME320 disk controller driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M320DRV.LS=/*=/IFC \1ƒ=ARGM320DRV.LS=/ENDIF=/*&=ASM M320DRV.SA,M320DRV.RO,\1;-WRZ=186=/*{ Included files are:=/*ƒ9995.&.DUALPORT.MC=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*}=/*=ENDééééééÎ=/*=/*†M420DRV.AF=/*/=/* Chain file to assemble VME420 (SASI) driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M420DRV.LS=/*=/IFC \1ƒ=ARGM420DRV.LS=/ENDIF=/*$=ASM M420DRV.SA,' M420DRV.RO,\1;RZ=186=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ =/*ƒCOMCMD.AI=/*ƒM420INT.AI=/*}=/*=ENDéééééé×=/*=/*†M435DRV.AF=/*.=/* Chain file to assemble the MAG tape driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to M435DRV.LS=/*=/IFC \1ƒ=ARGM435DRV.LS=/ENDIF=/*&=ASM M435DRV.SA,M435DRV.RO,\1;-WRZ=150=/*{ Included files are:=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*}=/*=END éééééé' à=/* =/*†MFPDRV.AF=/*H=/* Chain file to assemble MK68910 serial port driver for local ports on=/* VME120 and VME128 boards.=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to MFPDRV.LS=/*=/IFC \1ƒ=ARGMFPDRV.LS=/ENDIF=/*"=ASM MFPDRV.SA,MFPDRV.RO,\1;RZ=140=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.BAB.EQ=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.TERMCCB.EQ=/*ƒ9995.&.TERMINAL.EQ=/*ƒ9999.MK68901.MK68901.EQ=/*}=/*=ENDéééééé=/*=/*†MPCCDRV.AF=/*G=/* Chain file to assemble R68560 serial port driver for the local port*=/* on the VME050 system controller board.=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to MPCCDRV.LS=/*=/IFC \1ƒ=ARGMPCCDRV.LS=/ENDIF=/*$=ASM MPCCDRV.SA,MPCCDRV.RO,\1;RZ=140=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.BAB.EQ=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.TERMCCB.EQ=/*ƒ9995.&.TERMINAL.EQ=/*}=/*=ENDééé( ééò=/*=/*†MPSCDRV.AF=/*6=/* Chain file to assemble NEC 7201 subordinate driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to MPSCDRV.LS=/*=/IFC \1ƒ=ARGMPSCDRV.LS=/ENDIF=/*$=ASM MPSCDRV.SA,MPSCDRV.RO,\1;RZ=150=/*{ Included files are:=/*ƒ9995.&.MVME400.EQ=/*ƒ9995.&.NEC7201.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.BAB.EQ=/*ƒ9995.&.TERMINAL.EQ=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.TERMCCB.EQ=/*}=/*=ENDéééééû=/*=/*†MPSCSPR.AF=/*K=/* Chain file to assemble NEC 7201 supervisor driver for the MVME400 board=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to MPSCSPR.LS=/*=/IFC \1ƒ=ARGMPSCSPR.LS=/ENDIF=/*$=ASM MPSCSPR.SA,MPSCSPR.RO,\1;RZ=106=/*{ Included files are:=/*ƒ9995.&.NEC7201.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.CCB.EQ=/*}=/*=ENDéé( éééé=/*=/*†MPSCSUP.AF=/*B=/* Chain file to assemble NEC 7201 supervisor driver for the VM02=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to MPSCSUP.LS=/*=/IFC \1ƒ=ARGMPSCSUP.LS=/ENDIF=/*$=ASM MPSCSUP.SA,MPSCSUP.RO,\1;RZ=106=/*{ Included files are:=/*ƒ9995.&.NEC7201.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.CCB.EQ=/*}=/*=ENDéééééé ' P050DRV AF""bbP115DRV AF++bbPIADRV AF44bbPV01DRV AF==bbRWINDRV AFFFbbSIODRV AFOObbTERMLIB AFXXbbTNTDRV AFaabbVM22DRV AFjjbb) =/*=/*†P050DRV.AF=/*>=/* Chain file to assemble printer driver for the VME050 board=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to P050DRV.LS=/*=/IFC \1ƒ=ARGP050DRV.LS=/ENDIF=/*%=ASM P050DRV.SA,P050DRV.RO,\1;MRZ=146=/*{ Included files are:=/*ƒ9995.&.TRACE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*}=/*=ENDéééééé=/*=/*†P115DRV.AF=/*B=/* Chain file to assemble the printer driver for the VME115 board=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to P115DRV.LS=/*=/IFC \1ƒ=ARGP115DRV.LS=/ENDIF=/*%=ASM P115DRV.SA,P115DRV.RO,\1;MRZ=146=/*{ Included files are:=/*ƒ9995.&.TRACE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9999.M68230.M68230.EQ=/*}=/*=ENDééé) ééé#=/* =/*†PIADRV.AF=/*8=/* Chain file to assemble the printer driver for a PIA.=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to PIADRV.LS=/*=/IFC \1ƒ=ARGPIADRV.LS=/ENDIF=/*#=ASM PIADRV.SA,PIADRV.RO,\1;MRZ=146=/*{ Included files are:=/*ƒ9995.&.TRACE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*}=/*=ENDéééééé,=/*=/*†PV01DRV.AF=/*@=/* Chain file to assemble the printer driver for the VM01 board=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to PV01DRV.LS=/*=/IFC \1ƒ=ARGPV01DRV.LS=/ENDIF=/*%=ASM PV01DRV.SA,PV01DRV.RO,\1;MRZ=146=/*{ Included files are:=/*ƒ9995.&.TRACE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*}=/*=ENDé* ééééé5=/*=/*†RWINDRV.AF=/*:=/* Chain file to assemble the RWIN disk controller driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to RWINDRV.LS=/*=/IFC \1ƒ=ARGRWINDRV.LS=/ENDIF=/*&=ASM RWINDRV.SA,RWINDRV.RO,\1;-WRZ=186=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ =/*ƒCOMCMD.AI=/*ƒRWININT.AI=/*}=/*=ENDéééééé>=/* =/*†SIODRV.AF=/*H=/* Chain file to assemble MK68564 serial port driver for the local port=/* on the VM04 board.=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to SIODRV.LS=/*=/IFC \1ƒ=AR* GSIODRV.LS=/ENDIF=/*"=ASM SIODRV.SA,SIODRV.RO,\1;RZ=140=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.BAB.EQ=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.TERMINAL.EQ=/*ƒ9995.&.TERMCCB.EQ=/*}=/*=ENDéééééG=/*=/*†TERMLIB.AF=/*0=/* Chain file to assemble library for terminals=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to TERMLIB.LS=/*=/IFC \1ƒ=ARGTERMLIB.LS=/ENDIF=/*$=ASM TERMLIB.SA,TERMLIB.RO,\1;RZ=150=/*{ Included files are:=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.TERMINAL.EQ=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.TERMCCB.EQ=/*ƒ9995.&.BAB.EQ=/*}=/*=ENDééééé+ P=/* =/*†TNTDRV.AF=/*B=/* Chain file to assemble the Transparent Network Terminal driver=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to TNTDRV.LS=/*=/IFC \1ƒ=ARGTNTDRV.LS=/ENDIF=/*"=ASM TNTDRV.SA,TNTDRV.RO,\1;RZ=110=/*{ Included files are:=/*ƒ9995.&.TR1.EQ=/*ƒ9995.&.TR1RTCD.EQ=/*ƒ9995.&.EXE.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.NTS.TR1X.EQ=/*ƒ9995.NTS.NTS.EQ =/*ƒTNTMF.AI=/*}=/*=ENDééééééY=/*=/*†VM22DRV.AF=/**=/* Chain file to assemble the VM22 driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to VM22DRV.LS=/*=/IFC \1ƒ=ARGVM22DRV.LS=/ENDIF=/*$=ASM VM22DRV.SA,VM22DRV.RO,\1;RZ=130=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*}=/*=ENDéééé+ ééb' DRVLIB LOGPHY SAwwGbbQEVENT SA€€K¾bbSETTIME SAÑÑ kbbLOGPHY AFââbbQEVENT AFëëbbSETTIME AFôôbb:LOGPHYƒIDNT†4,4‡DRIVERLIBRARYLOGICAL-PHYSICALSUBROUTINE* *ˆINCLUDES**ˆ9995.&.TCB.EQ*ˆ9995.&.STR.EQ*ˆ9995.&.UTILITY.MC*‰NOLIST‰INCLUDEƒ9995.&.UTILITY.MC‰NOLIST‰INCLUDEƒ9995.&.TCB.EQ‰NOLIST‰INCLUDEƒ9995.&.STR.EQ‰LIST‰PAGEK****************************************************************************/*‰LOGPHY--DOLOGICALTOPHYSICALCALLTOEXEC*6*‰DoesanexecLOGPHYcalltocheckouttheaddressof*‰abufferorparameterblock.*$*‰Entry:D5=bufferlengthinbytes-*D6=bufferlogicalstartaddr(toconvert)/*A0=addressofTCBoftaskcontainingbuffer*A5=addressofCCB*0*‰Exit:‚CCR:=physicaladdressisinD6.L.**•=addressisinvalidforthistask.*D6=Logicaladdress**K*************************************************************************** ‰SECTIONƒ15‰OPT‡BRS ‰XDEF†LOGPHY LOGPHY: 6ŠMOVEM.LD0-D5/D7/A0-A5,-(A7)‚Saveregistersonstack. 2ŠPUSHƒ#1‘Initializeflag(onthestack)tononzero*§toindicateBADADDRESS. **‚Validateandconvertaddress.*&ŠBTSTƒ#0,D6ŽIftheaddressisnotodd,ŠIF…THENŠ* !ŠTST.L‚D5‘Ifthelengthisnot0,ŠIF…THENŠ* ?ŠMOVE.LTCBTST(A0),A0†A0<--addressofhistasksegmenttable.9ŠTR0$.LOGPHY,Callexectovalidateandconvertaddress.5ŠCLR„(SP)Ifgood,setflagto0toindicatesuccess.ŠNOP—Ifbadlength,+ŠNOP—orbadaddress,fallthroughtoerror. ŠENDI ŠENDI  **‚Setconditioncodesandexit.*2ŠPOP„D0‘Setconditioncodesaccordingtotheflag.;ŠMOVEM.L(A7)+,D0-D5/D7/A0-A5ƒRestoreregistersandreturn.ŠRTS—*‰ENDéoH, ‰PAGE3QEVENTƒIDNT†4,4ƒQUEUEEVENTSFROMDRIVERS(TRAP#0)‰OPT‡BRS,PCS,CREH************************************************************************H**************************************************************************ˆQEVENT*@*ˆSubroutineQEVENTqueuesaneventmessagefromadrivertothe'*ˆtaskthatisattachedtothechannel.*B*ˆThereareseveralentrypointstothisroutine,dependingonthe"*ˆtypeofeventyouneedtoqueue.**ˆEXIT::*ŒConditioncodes=theeventwassuccessfullyqueued5*ŒConditioncodes=badreturnfromTRAP#0call*‰PAGEH**************************************************************************ˆENTRYPOINTSANDDESCRIPTIONS*J***************************************************************************-*ˆEntrypoint“Descriptionofeventtobesent-*ˆ-----------“--------------------------------*ˆ1.N_NRM_QEVENTNormalI/Ocompletionevent*¦Queuedfromcommandlevel(0)*-*ˆ2.I_NRM_QEVENTNormalI/Ocompletionevent*¦Queuedfrominterrupthandler* *ˆ3.N_HLT_QEVENTHALTI/Oevent*¦Queuedfromcommandlevel(0)* *ˆ4.I_HLT_QEVENTHALTI/OEVENT*¦Queuedfrominterrupthandler*!*ˆForentrypoints1.through4.:*‹Registersuponentry:6*’A0=addrofplacetocopyevent(musthaveatleast*œ20bytesreserved)*—or'*—0ifyoudonotwanttheeventcopied*’A5=addrofCCB*’D1.B=errormessage*’D3.L=addrofDCB***ˆ5.N_UNS_QEVENTUnsolicited‚deviceevent*¦Queuedfromcommandlevel(0)*¦Statusvalue0(DCBknown)***ˆ6.I_UNS_QEVENTUnsoliciteddeviceevent*¦Queuedfrominterrupthandler*¦Statusvalue0(DCBknown)**ˆForentrypoints5.and6.:**‹Registersuponentry:6*’A0=addrofplacetocopyevent(musthaveatleast*œ20bytesreserved)*—or'*—0ifyoudonotwanttheeventcopied*’A5=addrofCCB*’D3.L=addrofDCB*’D4.W=devicestatusandtype*7*ˆNOTE:Theunsolicitedchannelevent(type$FF)isnotxEB‰B‘W™B¡E©R±T¹MÁ%6*ˆhandledbythisroutine.‚ItwasonlyusedintheIPC5*ˆinterpreteddriverasfarasIcoulddetermine,and0*ˆIdecideditwasnotworthcodinguphere.ƒbwn*4*ˆNOTE:Theunsoliciteddeviceevent(type$80)with2*ˆstatusvalue1isnothandledbythisroutine.‚I*ˆdon'tknowwhoneedsit.**‰PAGED*********************************************************************)*ˆEVENT…WITH†NO…ALTERNATE**‘SERVICE…ADDRESS*N********************************************************************************ˆEventasseenbyexec:*ˆ---------------------)*’Eventwithnoalternateserviceaddress*+*’+---------+---------+---------+---------+$*ˆD2‚=…|length‚|‚$01„|‚typeƒ|‚key„|+*’+---------+---------+---------+---------+**ˆD3‚=…|‚DCBaddress‚orchannelmnemonic…|+*’+---------------------------------------+&*ˆD4‚=…|‚continuationofmessage...Š|+*’+---------------------------------------+ *ˆD5‚=…|§|+*’+---------------------------------------+ *ˆD6‚=…|§|+*’+---------------------------------------+*H************************************************************************‰PAGEJ****************************************************************************’NormalI/Ocompletionevent#*’withnoalternateserviceaddress*+*’+---------+---------+---------+---------+*ˆD2‚=…|‚$A…|‚$01„|‚$70„|‚key„|+*’+---------+---------+---------+---------+*ˆD3‚=…|‹DCBaddress‘|+*’+---------------------------------------+*ˆD4‚=…|ƒ0…|errorƒ|*’+-------------------+***’I/OHALTevent#*’withnoalternateserviceaddress*+*’+---------+---------+---------+---------+*ˆD2‚=…|‚$A…|‚$01„|‚$71„|‚key„|+*’+---------+---------+---------+---------+*ˆD3‚=…|‹DCBaddress‘|+*’+-----, ----------------------------------+*ˆD4‚=…|ƒ0…|errorƒ|*’+-------------------+**’Unsoliciteddeviceevent#*’withnoalternateserviceaddress**’andstatusvalue=0(DCBaddressknown)*+*’+---------+---------+---------+---------+*ˆD2‚=…|‚$C…|‚$01„|‚$80„|‚key„|+*’+---------+---------+---------+---------+*ˆD3‚=…|‹DCBaddress‘|+*’+---------------------------------------+$*ˆD4‚=…|ƒ0…|ƒ0…|dev.stat|dev.type|+*’+-------------------+---------+---------+***‰PAGEI**************************************************************************)*ˆEVENT…WITH„AN„ALTERNATE**‘SERVICE…ADDRESS*J***************************************************************************)*’Eventwithanalternateserviceaddress*+*’+---------+---------+---------+---------++*ˆD2‚=…|length‚|‚$81„|upperwordofaddr|+*’+---------+---------+---------+---------+)*ˆD3‚=…|lowerwordofaddr|‚typeƒ|‚key„|+*’+---------------------------------------+**ˆD4‚=…|DCBaddressorchannelmnemonic‡|+*’+---------------------------------------+"*ˆD5‚=…|continuationofmessage|+*’+---------------------------------------+ *ˆD6‚=…|§|+*’+---------------------------------------+*‰PAGED**********************************************************************’NormalI/Ocompletionevent#*’withanalternateserviceaddress*+*’+---------+---------+---------+---------+'*ˆD2‚=…|‚$E…|‚$81„|compaddrupperwd|+*’+---------+---------+---------+---------+(*ˆD3‚=…|compaddrlowerwd|‚$70„|‚key„|+*’+-------------------+---------+---------+*ˆD4‚=…|‹DCBaddress‘|+*’+---------------------------------------+*ˆD5‚=…|ƒ0…|errorƒ|*’+-------------------+***’I/OHALTevent#*’withanalternateserviceaddress*+*’+---------+---------+---------+---------+'*ˆD2‚=…|‚$E…|‚$81„|compaddrupperwd|+*’+---------+---------+---------+---------+(*ˆD3‚=…|comp.addrlowerw|ƒ$71ƒ|‚key„|+*’+-------------------+---------+---------+*ˆD4‚=…|‹DCBaddress‘|+*’+---------------------------------------+*ˆD5‚=…|ƒ0…|errorƒ|*’+-------------------+**’Unsoliciteddeviceevent#*’withanalternateserviceaddress**’andstatusvalue=0(DCBaddressknown)*+*’+---------+---------+---------+---------+(*ˆD2‚=…|‚$10„|‚$81„|compaddrupperwd|+*’+---------+---------+---------+---------+(*ˆD3‚=…|compaddrlowerwd|‚$80„|‚key„|+*’+-------------------+---------+---------+*ˆD4‚=…|‹DCBaddress‘|+*’+---------------------------------------+$*ˆD5‚=…|ƒ0…|ƒ0…|dev.stat|dev.type|+*’+-------------------+---------+---------+***J**************************************************************************‰PAGEK*****************************************************************************ˆCallingtheexec:*ˆ-----------------**ˆfrominterrupthandler:**ŠMOVE.L‚#24,D0*ŠLEA‚,A0 *ŠTRAPƒ#0*ŠBRA.Sƒƒreturn1*Їreturn2**ˆfromnon-interrupthandler:**ŠMOVE.L‚#23,D0*ŠLEA‚,A0 *ŠTRAPƒ#0*ŠBRA.Sƒƒreturn1*Їreturn2**H************************************************************************* *‚EQUATES* EXEC…EQU‡07EVNTSVSZEQU‡4‰Numberofbytesaddedtoeventlengthif**œthealternateserviceaddressisneeded.6EVNTCMSZEQU‡10ˆSizeofanormalcompletioneventwith*œnoextrafields.(EVNTMXSZEQU‡18ˆMaximumsizeofanevent6EVNTIOƒEQU‡1‰Eventcodeforaneventwithnoalternate*œserviceaddress.:EVNTIOSAEQU‡$81‡Eventcodeforaneventwithanalternate*œserviceaddress***ˆXDEF'S*‰XDEF†N_NRM_QEVENT‰XDEF†I_NRM_QEVENT‰XDEF†N_HLT_QEVENT‰XDEF†I_HLT_QEVENT‰XDEF†N_UNS_QEVENT‰XDEF†I_UNS_QEVENT* *ˆINCLUDES**ˆ9995..CCB.EQ*ˆ9995..STR.EQ*ˆ9995..LV5.EQ*ˆ9995..UTILITY.MC*‰NOLIST‰INCLUDEƒ9995.&.CCB.EQ‰NOLIST‰INCLUDEƒ9995.&.STR.EQ‰NOLIST‰INCLUDEƒ9995.&.LV5.EQ‰NOLIST‰INCLUDEƒ9995.&.UTILITY.MC‰LIST ‰SECTIONƒ15QEVENT_REGSˆRE- G‡D0-D7/A0-A5‰PAGEE**********************************************************************+*ˆNORMAL„COMPLETION†EVENT*D******************************************************************** N_NRM_QEVENT:)‰MOVEM.LƒQEVENT_REGS,-(SP)Saveregisters‰MOVE.L„#T0QEVNTT,D0‰BRA‡NRM_QEVENT I_NRM_QEVENT:)‰MOVEM.LƒQEVENT_REGS,-(SP)Saveregisters‰MOVE.L„#T0QEVNTI,D0 L1‡SET‡XPSNRM<<80NRM_QEVENT‰MOVE.W„#L1,D5‹D5.W<---eventtypein*°upperbyte,0'sinlower*=*‚Thefollowingcodeisusedbothbythenormaleventroutine$*‚andbythehaltI/Oeventroutine.A*‚Onentry,D5.W‚containstheappropriateeventtypeinitsupper!*‚byte,and00initslowerbyte:*+*’+---------------------------------------+*ˆD5‚=…|ƒ?…|ƒ?…|‚typeƒ|„0„|+*’+-------------------+---------+---------+*NRM_HLT*?*‚Firstwefindoutofthereisanalternatecompletionservice *‚address.*‰MOVE.L„CCBSVVC(A5),D2 ‰IF„„THEN‰PAGEJ***************************************************************************+*ˆNORMAL„COMPLETION‡EVENT**ˆOR„HALTƒI/O„EVENT*-*ˆWITH…AN…ALTERNATE…ADDRESS*E**********************************************************************@*‚Atthispointweknowthereisacompletionserviceaddressin<*‚D2.‚WehavetogetitsupperwordinthelowerwordofD2,@*‚anditslowerwordintheupperwordofD3.‚Butfirst,wemove;*‚theDCBaddresswhichiscurrentlyinD3intoD4whereit"*‚belongs,andwecopyD2intoD3.* MOVE.LƒD3,D4 MOVE.LƒD2,D3*#*‚Nowtheregisterslooklikethis:*+*’+---------------------------------------+*ˆD1‚=…|…?ƒ|„?„|ƒ?…|error„|+*’+-------------------+---------+---------+*+*’+---------+---------+---------+---------+0*ˆD2‚=…|compaddrupperwd|compaddrlowerwd|+*’+---------+---------+---------+---------+0*ˆD3‚=…|compaddrupperwd|compaddrlowerwd|+*’+-------------------+---------+---------+*ˆD4‚=…|‹DCBaddress‘|+*’+---------------------------------------+*ˆD5‚=…|ˆ?Š|type„|ƒ0…|+*’+---------------------------------------+*+*‚Remember,wewantthemtolooklikethis:*+*’+---------+---------+---------+---------+'*ˆD2‚=…|‚$E…|‚$81„|compaddrupperwd|+*’+---------+---------+---------+---------+)*ˆD3‚=…|compaddrlowerwd|‚typeƒ|‚key„|+*’+-------------------+---------+---------+*ˆD4‚=…|‹DCBaddress‘|+*’+---------------------------------------+*ˆD5‚=…|ƒ0…|errorƒ|*’+-------------------+*@*‚NowtofixupD3.‚WewillSWAPitandthenmovetheeventtype,*‚fromD5.Wupperbyte‚intoD3.Wupperbyte.+*‚ThenwewillputtheCCBKEYbyteintoD3.*SWAPŠD3 MOVE.WˆD5,D3MOVE.BˆCCBKEY(A5),D3*#*‚Theregistersnowlooklikethis:**+*’+---------------------------------------+*ˆD1‚=…|…?ƒ|„?„|ƒ?…|error„|+*’+-------------------+---------+---------+*+*’+---------+---------+---------+---------+0*ˆD2‚=…|compaddrupperwd|compaddrlowerwd|+*’+---------+---------+---------+---------+)*ˆD3‚=…|compaddrlowerwd|type„|‚key„|+*’+-------------------+---------+---------+*ˆD4‚=…|‹DCBaddress‘|+*’+---------------------------------------+*ˆD5‚=…|ˆ?Š|‚typeƒ|ƒ0…|+*’+---------------------------------------+**=*‚NowtofixupD2.‚Weneedtomovethelengthandeventcode$*‚($0E81)intoD2.W,thendoaSWAP.*L1‡SET‡EVNTCMSZ+EVNTSVSZ%L1‡SET‡L1<<8+EVNTIOSAD2.W<---$0E81MOVE.W„#L1,D2SWAP†D2*#*‚THEREGISTERSNOWLOOKLIKETHIS:**+*’+---------------------------------------+*ˆD1‚=…|…?ƒ|„?„|ƒ?…|error„|+*’+-------------------+---------+---------+*+*’+---------+---------+---------+---------+&*ˆD2‚=…|‚$0Eˆ$81ƒ|compaddrupperwd|+*’+---------+---------+---------+---------+)*ˆD3‚=…|compaddrlowerwd|‚typeƒ|‚key„|+*’+-------------------+---------+---------+*ˆD4‚=…|‹DCBaddress‘|+*’+---------------------------------------+*ˆD5‚=…|ˆ?Š|‚typeƒ|ƒ0…|+*’+-------------------------- --------------+*@*‚NowtofixupD5.‚WeneedtogettheerrorcodeintothelowerB*‚byteoftheupperword,anda0intotheupperbyteoftheupper*‚word.* CLR.WƒD5 MOVE.B‚D1,D5SWAP„D5* *‚Theeventisnowreadytosend)*‚Seeifweneedtocopyintouser'sarea*‰IF.L„A0‚‚#0ƒTHENŽBSRƒCOPY4_EVENT‰ENDI* ‰PAGE‰ELSEJ***************************************************************************+*ˆNORMAL„COMPLETION‡EVENT**ˆOR„HALTƒI/O„EVENT*-*ˆWITH…NO…ALTERNATE…ADDRESS*E**********************************************************************?* We arrive here because we have a normal completion event or a>* halt I/O event with no alternate completion service address.N*‚ThusregisterD3isallset,andweonlyhavetofixupregistersD2andD4.**#*‚THEREGISTERSNOWLOOKLIKETHIS:**+*’+---------------------------------------+*ˆD1‚=…|…?ƒ|„?„|ƒ?…|errorƒ|+*’+-------------------+---------+---------+*+*’+---------+---------+---------+---------+ *ˆD2‚=…|?—|+*’+---------+---------+---------+---------+*ˆD3‚=…|‹DCBaddress‘|+*’+-------------------+---------+---------+ *ˆD4‚=…|?–|+*’+---------------------------------------+*ˆD5‚=…|‰?‰|type„|ƒ0…|+*’+---------------------------------------+**L1‡SET‡EVNTCMSZ<<24+EVNTIO<<16* MOVE.Lˆ#L1,D2‡D2<---$0A010000 MOVE.WˆD5,D2MOVE.BˆCCBKEY(A5),D2 CLR.W‰D4 MOVE.BˆD1,D4SWAPŠD4 *#*‚THEREGISTERSNOWLOOKLIKETHIS:**+*’+---------------------------------------+*ˆD1‚=…|…?ƒ|„?„|ƒ?…|errorƒ|+*’+-------------------+---------+---------+*+*’+---------+---------+---------+---------+*ˆD2‚=…|‚$0Aˆ$01ƒ|‚typeƒ|‚key„|+*’+---------+---------+---------+---------+*ˆD3‚=…|‹DCBaddress‘|+*’+-------------------+---------+---------+*ˆD4‚=…|„0„|errorƒ|‰?‰|+*’+---------------------------------------+*+*’+---------------------------------------+*ˆD5‚=…|ˆ?Š|‚typeƒ|ƒ0…|+*’+---------------------------------------+**!*‚Theeventisnowreadytosend.0*‚Seeiftheuserwantsustocopyitsomewhere.*ŒIF.LƒA0‚‚#0ƒTHEN‘BSRƒCOPY3_EVENTŒENDI‰ENDI ‰PAGEK****************************************************************************0*ˆSEND„THEƒEVENT…IN…D2-D4‚OR„D2-D5*M******************************************************************************!*‚Theeventisnowreadytosend.* SEND_EVENT**‚SetupfortheTRAP#0call.*‰MOVE.L„CCBRQSTA(A5),A0‰TRAP‚#0 ‰BRAƒEVENT_OK ‰MOVEQ#1,D0‰BRAƒRESTORE_REGSEVENT_OK„CLRƒD0 RESTORE_REGS‰MOVEM.L„(SP)+,QEVENT_REGS‰RTS‰PAGEJ***************************************************************************1*ˆCOPY…THE…EVENT„TO„USER'S„AREA*H************************************************************************ COPY3_EVENT:‰MOVEM.L„D2-D4,(A0)‰RTS COPY4_EVENT:‰MOVEM.L„D2-D5,(A0)‰RTS  ‰PAGEI***************************************************************************ˆHALT„I/O†EVENT*K*************************************************************************** N_HLT_QEVENT)‰MOVEM.LƒQEVENT_REGS,-(SP)Saveregisters‰MOVE.L„#T0QEVNTT,D0‰BRAƒHLT_QEVENT I_HLT_QEVENT)‰MOVEM.LƒQEVENT_REGS,-(SP)Saveregisters‰MOVE.L„#T0QEVNTI,D0L1‡SET‡XPSHLT<<8 HLT_QEVENT*‰MOVE.W„#L1,D5ŽD5.W<---eventtype*$100 ‰BRA‡NRM_HLT L**************************************************************************** ‰PAGEG************************************************************************-*ˆUNSOLICITED…DEVICE…EVENT*H************************************************************************ N_UNS_QEVENT:‰MOVEM.L„QEVENT_REGS,-(SP)‰MOVE.L„#T0QEVNTT,D0‰BRA‡UNS_QEVENT I_UNS_QEVENT:‰MOVEM.L„QEVENT_REGS,-(SP)‰MOVE.L…#T0QEVNTI,D0 )*‚Onentry,theregisterslooklikethis:**+*’+---------------------------------. ------+ *ˆD2‚=…|“?“|+*’+---------+---------+---------+---------+*ˆD3‚=…|‹DCBaddress‘|+*’+-------------------+---------+---------+ *ˆD4‚=…|‰?‰|devstat|devtype|+*’+---------------------------------------+* UNS_QEVENT‰MOVE.L„CCBSVVC(A5),D2 ‰IFƒ„THEN‰PAGEM******************************************************************************-*ˆUNSOLICITED†DEVICE„EVENT*)*ˆWITH…ALTERNATE„ADDRESS*C********************************************************************G*‚Wehavetomovethingsuptosqueezethealternatecompletionaddress0*‚intotheregistersD2andD3aswedidbefore.* ŽCLR.LŠD5 ŽMOVE.W‰D4,D5 ŽMOVE.L‰D3,D4 ŽMOVE.L‰D2,D3ŽSWAPD3 $*ƒNow,theregisterslooklikethis:**+*’+---------------------------------------+0*ˆD2‚=…|compaddrupperwd|compaddrlowerwd|+*’+---------------------------------------+0*ˆD3‚=…|compaddrlowerwd|compaddrupperwd|+*’+---------+---------+---------+---------+*ˆD4‚=…|‹DCBaddress‘|+*’+-------------------+---------+---------+$*ˆD5‚=…|„0„|„0„|devstat|devtype|+*’+---------------------------------------+*L1‡SET‡XPSUNS<<8ŽMOVE.W‰#L1,D3ŽD3.W‚<---‚$8000ŽMOVE.B‰CCBKEY(A5),D3L1‡SET‡EVNTCMSZ+EVNTSVSZ+2%L1‡SET‡L1<<8+EVNTIOSAD2.W‚<---$1081ŽMOVE.W‰#L1,D2 ŽSWAPD2$*ƒNow,theregisterslooklikethis:**+*’+---------------------------------------+(*ˆD2‚=…|‚$10„|ƒ$81ƒ|compaddrupperwd|+*’+---------------------------------------+(*ˆD3‚=…|compaddrlowerwd|‚$80„|‚key„|+*’+---------+---------+---------+---------+*ˆD4‚=…|‹DCBaddress‘|+*’+-------------------+---------+---------+$*ˆD5‚=…|„0„|ƒ0…|devstat|devtype|+*’+---------------------------------------+***!*‚Theeventisnowreadytosend.%*‚Let'sseeiftheuserwantsacopy.*IF.L‚A0‚‚#0‚THEN.L‘BSR‚COPY4_EVENTENDI‰ELSE ‰PAGED*********************************************************************-*ˆUNSOLICITED…DEVICE…EVENT*&*ˆWITH„NO„ALTERNATE„COMPLETION„ADDRESS*C******************************************************************* L1‡SET‡EVNTCMSZ+2"L1‡SET‡L1<<24+EVNTIO<<16+XPSUNS<<8 ‰MOVE.L„#L1,D2“D2<---$0C018000‰MOVE.B„CCBKEY(A5),D2*$*‚Now,theregisterslooklikethis:**+*’+---------------------------------------+*ˆD2‚=…|‚$0C„|‚01…|‚$80„|‚key„|+*’+---------+---------+---------+---------+*ˆD3‚=…|‹DCBaddress‘|+*’+-------------------+---------+---------+ *ˆD4‚=…|‰?‰|devstat|devtype|+*’+---------------------------------------+*‰AND.L#$0000FFFF,D4*$*‚Now,theregisterslooklikethis:**+*’+---------------------------------------+*ˆD2‚=…|‚$0C„|‚01…|‚$80„|‚key„|+*’+---------+---------+---------+---------+*ˆD3‚=…|‹DCBaddress‘|+*’+-------------------+---------+---------+#*ˆD4‚=…|ƒ0…|„0„|devstat|devtyp‚|+*’+---------------------------------------+*!*‚Nowtheeventisreadytosend.%*‚Let'sseeiftheuserwantsacopy.*ŽIF.LƒA0‚‚#0„THEN.L’BSRƒCOPY3_EVENTŽENDI‰ENDI ‰BRA‡SEND_EVENT ‰ENDééé. é‰PAGE5SETTIME‚IDNT†4,4‡SETUPPERIODICACTIVATION(TRAP#0)‰OPT‡PCS,BRS,CREN******************************************************************************N******************************************************************************* *ˆSET_TIME*;*ˆThisroutinesetsupanddoesatrap0calltogeneratea;*ˆwakeupcall.‚Thedriverwritermaywanttodothisbefore>*ˆgivingacommandtothecontrollerasatimeout,sothatthe>*ˆsystemwillnothangwaitingforaninterruptthatmaynever*ˆcome.*<*ˆThisroutinewillnotdotheTRAP#0callifthenumberof!*ˆmillisecondsaskedforiszero.**ˆSubroutinescalled:**ˆEntry:„A5=addressofCCB *’A3=addressofwakeuproutine.*’D3=numberofmillisecondsforwakeupcall.*"*ˆRegistersusage:†0‚1‚2‚3‚4‚5‚6‚7 *™D„*‚*‚*‚P *™A„*‚*…P…P**™P=parameterregister*™R=returnregister!*™*=savedandrestoredregister*6*ˆExit:…CCR:=periodicactivationcallsucceeded)*—=periodicactivationcalldidnot *žsucceed*žornumberofmilliseconds=0*"*ˆExitsto:RTStocallingroutine*L******************************************************************************…NOTESonusingthisroutine:*?*…TheaddressyousendinA3istheaddresswheretheexecwill.*…startyouexecutingwhenthetimergoesoff.*@*…Whenyoustartexecuting,theregisterssavedbytheexecare:*ˆD0,D1,A0,andA1.>*…Thisisdifferentfromtheregistersthataresavedwhenyou2*…ordinarilygetaninterrupt,namely‚D0,A0,A1,A5.*D*…InD1youfindanIDthatyoutoldtheexecaboutwhenyoudidthe;*…trapcall.‚Inourcase,theIDistheaddressoftheCCB.*B*…SothefirstthingtodouponwakeupistopushA5andanyother<*…registersyoumightuseonthestack,andmoveD1intoA5.**3*…Also,youmustreturnwithanRTEfromthiscall.*M*****************************************************************************É<Ò0M****************************************************************************** *ˆINCLUDES**ˆ9995.&.UTILITY.MC*ˆ9995.&.STR.EQ*ˆ9995.&.CCB.EQ*‰NOLIST‰INCLUDEƒ9995.&.UTILITY.MC‰NOLIST‰INCLUDEƒ9995.&.STR.EQ‰NOLIST‰INCLUDEƒ9995.&.CCB.EQ‰LIST ‰SECTIONƒ15 SET_TIME:*SET_REGSREG„D0-D2/A0-A1&SAVE‡SET_REGSŽSaveregistersusedfor *°trapcall* PUSH‡#1”SetflagforbadreturnTST.L†D3”Areweaskingfor0*°milliseconds?#BEQ.S†SET_RETIfso,therewillbe*°noexeccall.$MOVE.L…#T0RQPA,D0ŒD0<---directiveCLRˆD1/MOVE.B…CCBPPRIO(A5),D1‡D1<---interruptlevel!MOVE.L…A5,D2‘D2<---CCBaddress'MOVE.L…A3,A0‘A0<---addressofwakeup,MOVE.L…D3,A1‘A1<---no.ofmillisecondsto*¸waitforwakeupTRAP‡#0 BRA.S†SET_WAT1Žrequestaccepted#BRA.S†SET_RETrequestnotaccepted'SET_WAT1ˆCLRˆ(SP)’ClearflagtoshowOK**'SET_RET‰POPˆD0”FixCCRbypoppingstackRESTORE„SET_REGS ‰RTS‰END L**************************************************************************** é/ éé=/*=/*†DRVLIB.LOGPHY.AF=/*B=/* Chain file to assemble DRVLIB.LOGPHY.SA, a driver library file=/*:=/* If no output argument is specified for the listing the/=/* chain file will default to DRVLIB.LOGPHY.LS=/*=/IFC \1ƒ=ARGDRVLIB.LOGPHY.LS=/ENDIF=/*.=ASM DRVLIB.LOGPHY.SA,DRVLIB.LOGPHY.RO,\1;Z=75=/*{ Included files are:=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.STR.EQ=/*}=/*=ENDééééééÚ=/*=/*†DRVLIB.QEVENT.AF=/*B=/* Chain file to assemble DRVLIB.QEVENT.SA, a driver library file=/*:=/* If no output argument is specified for the listing the/=/* chain file will default to DRVLIB.QEVENT.LS=/*=/IFC \1ƒ=ARGDRVLIB.QEVENT.LS=/ENDIF=/*.=ASM DRVLIB.QEVENT.SA,DRVLIB.QEVENT.RO,\1;Z=75=/*{ Included files are:=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.UTILITY.MC=/*}=/*=ENDééé/ éééã=/*=/*†DRVLIB.SETTIME.AF=/*C=/* Chain file to assemble DRVLIB.SETTIME.SA, a driver library file=/*:=/* If no output argument is specified for the listing the0=/* chain file will default to DRVLIB.SETTIME.LS=/*=/IFC \1ƒ=ARGDRVLIB.SETTIME.LS=/ENDIF=/*0=ASM DRVLIB.SETTIME.SA,DRVLIB.SETTIME.RO,\1;Z=75=/*{ Included files are:=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.CCB.EQ=/*}=/*=ENDééééééì' VMES10 CRTINIT SAóbbEDITMODESA""~ubbFEEDER SA££%bbINCHAR SAÌ̤bbOUTCHS SAååÏÙbbPAGEMODESA¶¶ rbbPOUTCHS SAǸò bbERMDRV SAÁ ²0 ybb0 4CRTINIT‚IDNT†1,00†Configurethevirtualdisplayarea <*************************************************************º**Routinename:ŽCRTINIT—*<*----------------------------------------------------------*-*Currentrevision.....................1.00*1*Datewritten.........................12-21-82Œ*2*Writtenby...........................S.Pri-Tal‹*)*Datechanged.........................”*)*Changedby...........................”**º**Descriptionofchange:£**º**º**º**º**º**º*<************************************************************.*Function:InitializealltheCRTconstants*<*----------------------------------------------------------**Inputparameters:none£*<*----------------------------------------------------------**Registersaffected:none¡*<*----------------------------------------------------------* *Externalroutinesused:none*<************************************************************‰PAGE ‰XDEF†CRTINIT‰XDEF†SCRNINIT *‰XDEF†FACSFieldAttributeCodesineffect 5‰XDEF†CPERLINEŒNumberofcharactersperabsoluteline+‰XDEF†BPERLINEŒNumberofbytesperRAMline2‰XDEF†LPERSCRNŒNumberoflinesperabsolutescreen "‰XDEF†S.SCRNŽVirtualhomeposition*‰XDEF†E.SCRNŽEndaddressofvirtualscreen 3‰XDEF†C.LINEŽNumberofcharactersinavirtualline.‰XDEF†B.LINEŽNumberofbytesinavirtualline/‰XDEF†PB.LINENumberofblankedbytesinaline2‰XDEF†S.LINEŽStartaddressofvirtualcurrentline0‰XDEF†E.LINEŽEndaddressofvirtualcurrentline0‰XDEF†L.SCRNŽNumberoflinesinavirtualscreen (‰XDEF†SCREENŽBaseaddressofdisplayRAM<‰XDEF†CRTCADD,CRTCREG…AddressesofCRTcontrollerregisters. +‰XDEF†LEFTCOLLeftcolumnofvirtualscreen-‰XDEF†RIGHTCOLŒRightcolumnofvirtualscreen*$*Š0<=LEFTCOL/RIGHTCOL<=CPERLINE-1*(‰XDEF†TOPLINEToplineofvirtualscreen+‰XDEF†BOTLINEBottomlineofvirtualscreen*#*Š0<=TOPLINE/BOTLINE<=LPERSCRN-1*#‰XDEF†PAGEFLAGŒ0=scroll;$FFFF=page ù?F E*.SCREENƒEQU‡$F17000BaseaddressofdisplayRAM(CRTCADD‚EQU‡$F1A021BaseaddressofCRTC1CRTCREG‚EQU‡$F1A023AddressofCRTCregisterfile‰PAGE ‰SECTIONƒ16CPERLINEDC.W†80’Numberofcharactersinabsoluteline3LPERSCRNDC.W†25’Numberoflinesinabsolutescreen6BPERLINEDC.L†160‘NumberofbytesinabsoluteRAMline*G* The following 4 constants can be changed by using escape sequences or* their eqivalents.*,LEFTCOL‚DC.W†0“Defaultvalueforleftcolumn/RIGHTCOLDC.W†79’Defaultvalueforrightcolumn)TOPLINE‚DC.W†0“Defaultvaluefortopline-BOTLINE‚DC.W†23’Defaultvalueforbottomline 7S.SCRNƒDC.L†$F17000InittobethesameasstartofRAM7E.SCRNƒDC.L†$F17F00Endaddressofvirtualdisplayarea&C.LINEƒDC.W†79’AdjustedforDBRAloopsB.LINEƒDC.L†160)S.LINEƒDC.L†$F17000Startofcurrentline'E.LINEƒDC.L†$F170A0EndofcurrentlinePB.LINE‚DC.W†00&L.SCRNƒDC.W†23’AdjustedforDBRAloops)*C.SCRNƒDC.L†1919AdjustedforDBRAloopsFACS…DC.W†$4400#PAGEFLAGDC.W†0“Inittoscrollmode‰PAGE‰SECTIONƒ11’ProgramareaSCRNINITDS.W†0-‰MOVE.W„#80,CPERLINEˆ80charactersperscreen1‰MOVE.W„#25,LPERSCRNˆ24linesinthedisplayarea‰CLR.W…TOPLINE‰MOVE.W„#23,BOTLINE‰CLR.W…LEFTCOL‰MOVE.W„#79,RIGHTCOL‰CLR.W…PAGEFLAG SPC 1 CRTINIT‚EQU‡*'‰MOVEM.LƒD0/A0,-(A7)‰Saveuser'svalues‰CLR.L…D0’HSKP ** Init the FACs register*‰MOVE.W„#$4400,FACS**ˆD15†clearedforunprotect*ˆD14†setfordisplay*ˆD13†clearedfornon-blink*ˆD12†clearedfo0 rnounderline$*ˆD11†clearedfornoninvertedvideo<*ˆD10-D08‚setforhalfbrightness(111=maximumbrightness)*ˆD07†clearedfornoTAB*ˆD06-D00‚nullcharacter* *9* Init number of RAM bytes required for one absolute line**’BPERLINE=CPERLINE*2*:‰MOVE.W„CPERLINE,D0‰Maximumnumberofcharactersinaline‰LSL.L…#1,D0Ž*2,‰MOVE.L„D0,BPERLINEˆ=Bytesperabsoluteline *M* Init the number of character per line in the virtual display area - C.LINE.*!*’C.LINE=RIGHTCOL-LEFTCOL+1*>* (adjusted for DBRA loops, expressed in characters on screen)* ‰CLR.L…D0;‰MOVE.W„RIGHTCOL,D0‰Requestedlastcolumninvirtualscreen;‰SUB.W…LEFTCOL,D0‰-Requestedfirstcolumninvirtualscreen9‰MOVE.W„D0,C.LINEŠ=Numberofcharactersinavirtualline*¦-1toadjustforDBRAloops ‰ADD.W…#1,D0 ‰LSL.W…#1,D0-‰MOVE.L„D0,B.LINE‹Initbytespervirtualline *1* Init the number of blanked bytes in a RAM line.* *’PB.LINE=[CPERLINE-C.LINE]*2* ‰CLR.L…D0<‰MOVE.W„CPERLINE,D0‰Numberofcharactersinanabsoluteline8‰SUB.W…C.LINE,D0Š-Numberofcharactersinavirtualline)‰SUB.W…#1,D0ToadjustfortheDBRAvalue‰LSL.W…#1,D0Times29‰MOVE.W„D0,PB.LINE‰=NumberofblankedbytesinaRAMline *@* Init the number of lines in the virtual display area - L.SCRN.**’L.SCRN=BOTLINE-TOPLINE+1** Adjusted for DBRA loops* ‰CLR.L…D0(‰MOVE.W„BOTLINE,D0ŠRequestedbottomline%‰SUB.W…TOPLINE,D0‰-Requestedtopline6‰MOVE.W„D0,L.SCRNŠ=Numberoflinesinavirtualscreen *D* Init the number of character in the virtual display area - C.SCRN.*#*’C.SCRN=[C.LINE+1]*[L.SCRN+1]*H* (adjusted for DBRA loops, expressed in number of characters in screen)* *ˆCLR.L…D09*ˆMOVE.W„C.LINE,D0‹Numberofcharactersinavirtualline$*ˆADD.W…#1,D0ToadjustfortheDBRA*ˆMOVE.W„D0,C.SCRN6*ˆMOVE.W„L.SCRN,D0‹Numberoflinesinavirtualscreen$*ˆADD.W…#1,D0ToadjustfortheDBRA<*ˆMULU.W„C.SCRN,D0Š=Numberofcharactersinavirtualscreen*ˆMOVE.W„D0,C.SCRN-*ˆSUB.W…#1,C.SCRNŠ-1toadjustforDBRAloops *H* Init the absolute address of home position in the virtual display area*0*ˆS.SCRN=SCREEN+TOPLINE*BPERLINE+LEFTCOL*2* ,‰MOVE.L„BPERLINE,D0ˆ=Bytesperabsoluteline0‰MULU.W„TOPLINE,D0‰=Unusedareaontopofscreen‰ADD.W…LEFTCOL,D00‰ADD.W…LEFTCOL,D0‰+Unusedbytesatstartofline.‰ADD.L…#SCREEN,D0‰+BaseaddressofdisplayRAM+‰MOVE.L„D0,S.SCRNŠ=VirtualhomeRAMaddress *B* Init the absolute address of the end of the virtual display area*1*ˆE.SCRN=SCREEN+BOTLINE*BPERLINE+RIGHTCOL*2*,‰MOVE.L„BPERLINE,D0ˆ=Bytesperabsoluteline9‰MULU.W„BOTLINE,D0‰=Numberofbytestostartoflastline‰ADD.W…RIGHTCOL,D07‰ADD.W…RIGHTCOL,D0ˆ=Numberofbytestoendoflastline&‰ADD.L…#SCREEN,D0‰=BaseaddressofRAM ‰ADD.L…#2,D01‰MOVE.L„D0,E.SCRNŠ=EndofvirtualscreeninRAM+1 *?* Init S.LINE to point to start address of cursor virtual line.=* Init E.LINE to point to end address of cursor virtual line.*‰CLR.L…D0’HSKP ‰MOVE.B„#$E,CRTCADD‰PointtoR14‰MOVE.B„CRTCREG,D0 ‰LSL.W…#8,D0‰MOVE.B„#$F,CRTCADD2‰MOVE.B„CRTCREG,D0ŠD0.W=absoluteaddressofcursor ‰LSL.W…#1,D0 ‰MOVE.L„D0,A02‰ADD.L…#SCREEN,A0ŠA0.L=addressofcursoronscreen ‰LSR.W…#1,D0‰DIVU†CPERLINE,D0‰D0.L=00cc00ll‰SWAP†D0’D0.W=00cc7‰SUB.W…LEFTCOL,D0ŠD0.W=numberofspotstostartofline‰LSL.W…#1,D0Tomakeitbytes ‰SUB.W…D0,A0‰MOVE.L„A0,S.LINE ‰ADD.W…C.LINE,A0‰ADD.W…C.LINE,A0 ‰ADD.W…#2,A0‰MOVE.L„A0,E.LINE‰MOVEM.Lƒ(A7)+,D0/A0‰RTS‰END é1 éé9EDITMODE‚IDNTƒ1,0„VME/10editmodeemulationforTERMDRV.O*v*****************************************************************************O*******************************************************************************O**********************************************************************************É***=***†FILENAME:‚EDITMODE--EDITMODEEMULATIONFORTERMDRV******É***8***†ENVIRONMENT:‚LinkedintoTERMDRVfortheVME/10.’******É***E***†FUNCTION:‚Whenthekeyboard/screenisputintoeditmode,any…***?***‰charactersreceivedfromthekeyboardaresentherefor‰******‰specialinterpretation.©******É***B***†NOTES:‚OnlyRETURNCOMMANDmodeisimplemented;NON-RETURNˆ***D***‰COMMANDmodeisnotsincetheVERSAdoseditor(E.LO)doesn't„******‰useit.¹******É***,***†EXTERNALDATASTRUCTURESREFERENCED:Ÿ*** ***‰CCBforterminaldriver.¨***(***‰VariousparametersfromCRTINIT. ******É***)***†EXTERNALENTRYPOINTSREFERENCED:¢******‰OUTCHSº******É***"***†SERVICESCALLEDVIATRAPS:©******É***O*******************************************************************************O*******************************************************************************O*^***************************************************************************** *,*‚Revisionhistory(addnewchangestotop).*…Date†Author‰ChangesG*…--------‚-------------‚----------------------------------------------;*†1/30/85‚MikeDuh‡SetRING_BELLflagwhen$07isdetected.2*†7/19/83‚SteveFranckƒSeparatedoutFEEDERstuff.'*†4/31/83‚SteveFranckƒInitialwriting.*ŠPAGE* *‚XDEF's.*:ŠXDEFƒEDITMODE‹Entrypt.forchar'sreceivedineditmode.5ŠXDEFƒKB_LOCKŒFlagindicatingwhetherthekeyboardis(*§locked(fromhavingsentatermination*§packetineditmode).7ŠXDEFƒDUP_CHAR‹Thisisawordfield,$FFFFiftherewas%*§noDUPLICATECHARspecifiedwhenwe'*§gotputintocommandmode,else$00dd%*§($dd=theDUPLICATECHAR)ifonewas *§specified.    * 8#?+F3:;3C*K)S,[)c'k1s>{GƒO‹@“80*‚XREF's(indicatewheretheXDEFis,ifknown).*8ŠXREFƒOUTCHSRoutineinOUTCHStooutputcharonscreen./*ž(AllofthefollowingareXDEF'edinCRTINIT)9ŠXREFƒBPERLINE‹#ofbytesperabsolutedisplayline(.L).$*§Notethatsincethisisalongword#*§theaddressBPERLINE+2isusedin%*§DIVUinstructions(whichuseonlya"*§wordforthedivisor).‚Theupper*§wordisalways0.3ŠXREFƒC.LINE#ofchar'spervirtualline-1(.W).DŠXREFƒS.LINE,E.LINEStart/endaddr+1ofcurrentvirtualline(.L).>ŠXREFƒS.SCRN,E.SCRN†Start/endaddr+1ofvirtualscreen(.L).4ŠXREFƒSCREENBaseaddressofscreenRAM(anequate).?ŠXREFƒCRTCADD,CRTCREG„Addr'sofCRTcontrollerreg's(equates)..*ž(AllofthefollowingareXDEF'edinFEEDER)3ŠXREFƒFEEDEREntrypointandsomevariablesforthe>ŠXREFƒFEEDER_ADDRESS…FEEDERmodulewhichtakesourpacketsand)ŠXREFƒFEEDER_COUNT‡givesthemtoTERMDRV. 0ŠXREFƒRING_BELL‹Flagsetwhen$07isdetectedin&*žordertoringthebellinKEYBRD.AG.ŠPAGEO*********************************************************************************‰INCLUDEFILESANDEQUATES*O******************************************************************************* *=*‚DefinetheenvironmentasEXORMACS/Sinaswitcht1 ocontrol*‚conditionalassemblies.*2ENVIRONMENTEQU‚'EX/S'ThisisfortheEXORMACS/S.  **‚Includefiles:5*‰UTILITY.MC‹Generalpurposemacros(e.g.PUSH,POP).,*‰IOE.SAEquatesforIOS-relatedstructures.7*‰EQUCCB.EQŒEquatesfordevice-independentpartofCCB.9*‰TERMDRV.EQ‹Equatesforthegeneralizedterminaldriver.*ŠNOLISTŠINCLUDE‚9995.&.UTILITY.MCŠINCLUDE‚9995.&.IOE.EQŠINCLUDE‚9995.&.CCB.EQŠINCLUDE‚9995.VMES10.TERMDRV.EQŠLIST  .FALSE…EQU„$00ValueFALSEforaflagvariable.,TRUE†EQU„$FFValueTRUE‚foraflagvariable.  4BSˆEQU„$08DefinitionsforcertainASCIIcharacters. LFˆEQU„$0A* CRˆEQU„$0D*SPACE…EQU„$20*DELETE„EQU„$7F*  5HOME†EQU„$C0Definitionsforcertaincharacterswhich7UPARROWƒEQU„$C1arerecognizedbytheEXORTERM155(and4DOWNARROWEQU„$C2henceOUTCHS)asspecialcommands.ERASE_EOLEQU„$D5*DEL_LINE‚EQU„$D7*  :START_OF_DATAEQU$DDDefinitionsforcertainpartsofthe1FILLER_BYTEEQU‚$FFpacketreturnedineditmode.END_OF_DATAEQU‚$DE*ŠPAGEO*********************************************************************************‰MISCELLANEOUSMACROS*O*******************************************************************************  *G*‚TheOUTPUTandOUTPUT_D0macrosinvoketheexternalsubroutineOUTCHSF*‚tooutputacharactertotheEXORMACS/Sscreen.‚OUTPUT_D0justcallsC*‚theroutinetooutputwhateverisinD0.B,whileOUTCHShasasanH*‚argumentthevalueofacharacter.‚ThischaractermustbeintherangeH*‚$00-$FF,ofcourse,andmustbeanimmediatevaluespecifiedWITHOUT*‚THE'#'.‚Forexample,7*‰OUTPUT'A'ƒcausesan'A'tobewrittentothescreen.*OUTPUT_D0 MACRO ŠBSR.L‚OUTCHSŠENDM OUTPUT„MACRO ŠIFGEƒ\1-$80ŠMOVEQ‚#$FFFFFF00+\1,D0ŠENDC ŠIFLTƒ\1-$80 ŠMOVEQ‚#\1,D0ŠENDC ŠBSR.L‚OUTCHSŠENDMŠPAGEO*********************************************************************************‰DATAVARIABLES*O******************************************************************************* ŠSECTION0 **‚Flags.*THENŠIfthereisone,1ŠCMP.B‚D0,D1Ž.‚Ifthischaracterisoneofthose,&ŠBEQ.L‚ERASE_LINE‰.‚goerasetheline.ŠENDI–. ,ŠCLR„D1‘D1.W<--offsetfromtable,whichis4ŠMOVE.BEDIT_TBL(PC,D0),D1(routineaddr-JMPBASE).;ŠLEA„JMPBASE(PC),A0…Jumptothespecifiedroutine:‚thatis,4ŠJMP„0(A0,D1)‹toJMPBASE+(routineaddr-JMPBASE).ŠPAGEO********************************************************************************:*‰TABLEOFACTIONTOTAKEFOREACHCHARWHILEINEDITMODE*O******************************************************************************* EDIT_TBL: ***************7*‚$00-$1F‚*ƒRoutineoffsetˆCharƒDescriptionofactionF***************ƒ----------------†----ƒ--------------------------------&ŠDC.BƒIGNORE-JMPBASE…$00--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$01--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$02--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$03--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$04--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$05--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$06--Ignoreit.ŠDC.BƒBELL-JMPBASE‡$07--Bell.,ŠDC.BƒPRINT-JMPBASE†$08--Printasis.(BS)-ŠDC.BƒPRINT-JMPBASE†$09--Printasis.(TAB)7ŠDC.BƒDO_LF-JMPBASE†$0A--Specialprocessingfor(LF).@ŠDC.BƒPRINT_TERM-JMPBASE$0B--Printandsendpacket.(UPLINE)6ŠDC.BƒPRINT-JMPBASE†$0C--Printasis.(CURSORRIGHT)7ŠDC.BƒDO_CR-JMPBASE†$0D--Specialprocessingfor(CR).&ŠDC.BƒIGNORE-JMPBASE…$0E--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$0F--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$10--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$11--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$12--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$13--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$14--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$15--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$16--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$17--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$18--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$19--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$1A--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$1B--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$1C--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$1D--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$1E--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$1F--Ignoreit.ŠPAGE***************7*‚$20-$3F‚*ƒRoutineoffsetˆCharƒDescriptionofactionF***************ƒ----------------†----ƒ--------------------------------0ŠDC.B‚PRINT_LOOK-JMPBASE$20--Printasis.‚()0ŠDC.B‚PRINT_LOOK-JMPBASE$21--Printasis.‚(!)0ŠDC.B‚PRINT_LOOK-JMPBASE$22--Printasis.‚(")0ŠDC.B‚PRINT_LOOK-JMPBASE$23--Printasis.‚(#)0ŠDC.B‚PRINT_LOOK-JMPBASE$24--Printasis.‚($)0ŠDC.B‚PRINT_LOOK-JMPBASE$25--Printasis.‚(%)0ŠDC.B‚PRINT_LOOK-JMPBASE$26--Printasis.‚(&)0ŠDC.B‚PRINT_LOOK-JMPBASE$27--Printasis.‚(')0ŠDC.B‚PRINT_LOOK-JMPBASE$28--Printasis.‚(()0ŠDC.B‚PRINT_LOOK-JMPBASE$29--Printasis.‚())0ŠDC.B‚PRINT_LOOK-JMPBASE$2A--Printasis.‚(*)0ŠDC.B‚PRINT_LOOK-JMPBASE$2B--Printasis.‚(+)0ŠDC.B‚PRINT_LOOK-JMPBASE$2C--Printasis.‚(,)0ŠDC.B‚PRINT_LOOK-JMPBASE$2D--Printasis.‚(-)0ŠDC.B‚PRINT_LOOK-JMPBASE$2E--Printasis.‚(.)0ŠDC.B‚PRINT_LOOK-JMPBASE$2F--Printasis.‚(/)0ŠDC.B‚PRINT_LOOK-JMPBASE$30--Printasis.‚(0)0ŠDC.B‚PRINT_LOOK-JMPBASE$31--Printasis.‚(1)0ŠDC.B‚PRINT_LOOK-JMPBASE$32--Printasis.‚(2)0ŠDC.B‚PRINT_LOOK-JMPBASE$33--Printasis.‚(3)0ŠDC.B‚PRINT_LOOK-JMPBASE$34--Printasis.‚(4)0ŠDC.B‚PRINT_LOOK-JMPBASE$35--Printasis.‚(5)0ŠDC.B‚PRINT_LOOK-JMPBA2 SE$36--Printasis.‚(6)0ŠDC.B‚PRINT_LOOK-JMPBASE$37--Printasis.‚(7)0ŠDC.B‚PRINT_LOOK-JMPBASE$38--Printasis.‚(8)0ŠDC.B‚PRINT_LOOK-JMPBASE$39--Printasis.‚(9)0ŠDC.B‚PRINT_LOOK-JMPBASE$3A--Printasis.‚(:)0ŠDC.B‚PRINT_LOOK-JMPBASE$3B--Printasis.‚(;)0ŠDC.B‚PRINT_LOOK-JMPBASE$3C--Printasis.‚(<)0ŠDC.B‚PRINT_LOOK-JMPBASE$3D--Printasis.‚(=)0ŠDC.B‚PRINT_LOOK-JMPBASE$3E--Printasis.‚(>)0ŠDC.B‚PRINT_LOOK-JMPBASE$3F--Printasis.‚(?)ŠPAGE***************7*‚$40-$5F‚*ƒRoutineoffsetˆCharƒDescriptionofactionF***************ƒ----------------†----ƒ--------------------------------0ŠDC.B‚PRINT_LOOK-JMPBASE$40--Printasis.‚(@)0ŠDC.B‚PRINT_LOOK-JMPBASE$41--Printasis.‚(A)0ŠDC.B‚PRINT_LOOK-JMPBASE$42--Printasis.‚(B)0ŠDC.B‚PRINT_LOOK-JMPBASE$43--Printasis.‚(C)0ŠDC.B‚PRINT_LOOK-JMPBASE$44--Printasis.‚(D)0ŠDC.B‚PRINT_LOOK-JMPBASE$45--Printasis.‚(E)0ŠDC.B‚PRINT_LOOK-JMPBASE$46--Printasis.‚(F)0ŠDC.B‚PRINT_LOOK-JMPBASE$47--Printasis.‚(G)0ŠDC.B‚PRINT_LOOK-JMPBASE$48--Printasis.‚(H)0ŠDC.B‚PRINT_LOOK-JMPBASE$49--Printasis.‚(I)0ŠDC.B‚PRINT_LOOK-JMPBASE$4A--Printasis.‚(J)0ŠDC.B‚PRINT_LOOK-JMPBASE$4B--Printasis.‚(K)0ŠDC.B‚PRINT_LOOK-JMPBASE$4C--Printasis.‚(L)0ŠDC.B‚PRINT_LOOK-JMPBASE$4D--Printasis.‚(M)0ŠDC.B‚PRINT_LOOK-JMPBASE$4E--Printasis.‚(N)0ŠDC.B‚PRINT_LOOK-JMPBASE$4F--Printasis.‚(O)0ŠDC.B‚PRINT_LOOK-JMPBASE$50--Printasis.‚(P)0ŠDC.B‚PRINT_LOOK-JMPBASE$51--Printasis.‚(Q)0ŠDC.B‚PRINT_LOOK-JMPBASE$52--Printasis.‚(R)0ŠDC.B‚PRINT_LOOK-JMPBASE$53--Printasis.‚(S)0ŠDC.B‚PRINT_LOOK-JMPBASE$54--Printasis.‚(T)0ŠDC.B‚PRINT_LOOK-JMPBASE$55--Printasis.‚(U)0ŠDC.B‚PRINT_LOOK-JMPBASE$56--Printasis.‚(V)0ŠDC.B‚PRINT_LOOK-JMPBASE$57--Printasis.‚(W)0ŠDC.B‚PRINT_LOOK-JMPBASE$58--Printasis.‚(X)0ŠDC.B‚PRINT_LOOK-JMPBASE$59--Printasis.‚(Y)0ŠDC.B‚PRINT_LOOK-JMPBASE$5A--Printasis.‚(Z)0ŠDC.B‚PRINT_LOOK-JMPBASE$5B--Printasis.‚([)0ŠDC.B‚PRINT_LOOK-JMPBASE$5C--Printasis.‚(\)0ŠDC.B‚PRINT_LOOK-JMPBASE$5D--Printasis.‚(])0ŠDC.B‚PRINT_LOOK-JMPBASE$5E--Printasis.‚(^)0ŠDC.B‚PRINT_LOOK-JMPBASE$5F--Printasis.‚(_)ŠPAGE***************7*‚$60-$7F‚*ƒRoutineoffsetˆCharƒDescriptionofactionF***************ƒ----------------†----ƒ--------------------------------0ŠDC.B‚PRINT_LOOK-JMPBASE$60--Printasis.‚(`)0ŠDC.B‚PRINT_LOOK-JMPBASE$61--Printasis.‚(a)0ŠDC.B‚PRINT_LOOK-JMPBASE$62--Printasis.‚(b)0ŠDC.B‚PRINT_LOOK-JMPBASE$63--Printasis.‚(c)0ŠDC.B‚PRINT_LOOK-JMPBASE$64--Printasis.‚(d)0ŠDC.B‚PRINT_LOOK-JMPBASE$65--Printasis.‚(e)0ŠDC.B‚PRINT_LOOK-JMPBASE$66--Printasis.‚(f)0ŠDC.B‚PRINT_LOOK-JMPBASE$67--Printasis.‚(g)0ŠDC.B‚PRINT_LOOK-JMPBASE$68--Printasis.‚(h)0ŠDC.B‚PRINT_LOOK-JMPBASE$69--Printasis.‚(i)0ŠDC.B‚PRINT_LOOK-JMPBASE$6A--Printasis.‚(j)0ŠDC.B‚PRINT_LOOK-JMPBASE$6B--Printasis.‚(k)0ŠDC.B‚PRINT_LOOK-JMPBASE$6C--Printasis.‚(l)0ŠDC.B‚PRINT_LOOK-JMPBASE$6D--Printasis.‚(m)0ŠDC.B‚PRINT_LOOK-JMPBASE$6E--Printasis.‚(n)0ŠDC.B‚PRINT_LOOK-JMPBASE$6F--Printasis.‚(o)0ŠDC.B‚PRINT_LOOK-JMPBASE$70--Printasis.‚(p)0ŠDC.B‚PRINT_LOOK-JMPBASE$71--Printasis.‚(q)0ŠDC.B‚PRINT_LOOK-JMPBASE$72--Printasis.‚(r)0ŠDC.B‚PRINT_LOOK-JMPBASE$73--Printasis.‚(s)0ŠDC.B‚PRINT_LOOK-JMPBASE$74--Printasis.‚(t)0ŠDC.B‚PRINT_LOOK-JMPBASE$75--Printasis.‚(u)0ŠDC.B‚PRINT_LOOK-JMPBASE$76--Printasis.‚(v)0ŠDC.B‚PRINT_LOOK-JMPBASE$77--Printasis.‚(w)0ŠDC.B‚PRINT_LOOK-JMPBASE$78--Printasis.‚(x)0ŠDC.B‚PRINT_LOOK-JMPBASE$79--Printasis.‚(y)0ŠDC.B‚PRINT_LOOK-JMPBASE$7A--Printasis.‚(z)0ŠDC.B‚PRINT_LOOK-JMPBASE$7B--Printasis.‚({)0ŠDC.B‚PRINT_LOOK-JMPBASE$7C--Printasis.‚(|)0ŠDC.B‚PRINT_LOOK-JMPBASE$7D--Printasis.‚(})0ŠDC.B‚PRINT_LOOK-JMPBASE$7E--Printasis.‚(~)7ŠDC.BƒDO_DEL-JMPBASE…$7F--Specialhandlingfor(DEL).ŠPAGE************3 ***7*‚$80-$9F‚*ƒRoutineoffsetˆCharƒDescriptionofactionF***************ƒ----------------†----ƒ--------------------------------&ŠDC.BƒIGNORE-JMPBASE…$80--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$81--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$82--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$83--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$84--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$85--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$86--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$87--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$88--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$89--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$8A--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$8B--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$8C--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$8D--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$8E--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$8F--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$90--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$91--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$92--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$93--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$94--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$95--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$96--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$97--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$98--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$99--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$9A--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$9B--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$9C--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$9D--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$9E--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$9F--Ignoreit.ŠPAGE***************7*‚$A0-$BF‚*ƒRoutineoffsetˆCharƒDescriptionofactionF***************ƒ----------------†----ƒ--------------------------------9ŠDC.BƒTERMINATE-JMPBASE‚$A0--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$A1--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$A2--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$A3--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$A4--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$A5--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$A6--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$A7--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$A8--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$A9--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$AA--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$AB--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$AC--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$AD--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$AE--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$AF--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$B0--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$B1--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$B2--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$B3--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$B4--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$B5--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$B6--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$B7--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$B8--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$B9--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$BA--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$BB--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$BC--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$BD--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$BE--Functionkey:sendpacket.9ŠDC.BƒTERMINATE-JMPBASE‚$BF--Functionkey:sendpacket.ŠPAGE***************7*‚$C0-$DF‚*ƒRoutineoffsetˆCharƒDescriptionofactionF***************ƒ----------------†----ƒ--------------------------------=ŠDC.BƒPRINT_TERM-JMPBASE$C0--Printandsendpacket.‚(HOME)BŠDC.BƒPRINT_TERM-JMPBASE$C1--Printandsendpacket.‚(CURSORUP)DŠDC.BƒPRINT_TERM-JMPBASE$C2--Printandsendpacket.(CURSORDOWN)5ŠDC.BƒPRINT-JMPBASE†$C3--Printasis.‚(CURSORLEFT)6ŠDC.BƒPRINT-JMPBASE†$C4--Printasis.‚(CURSORRIGHT)&ŠDC.BƒIGNORE-JMPBASE…$C5--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$C6--Ignoreit.&ŠDC.BƒIG3 NORE-JMPBASE…$C7--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$C8--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$C9--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$CA--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$CB--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$CC--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$CD--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$CE--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$CF--Ignoreit.DŠDC.BƒPRINT_CHANGE-JMPBASE$D0--Print&change.(CHARACTERINSERT)DŠDC.BƒPRINT_CHANGE-JMPBASE$D1--Print&change.(CHARACTERDELETE)&ŠDC.BƒIGNORE-JMPBASE…$D2--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$D3--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$D4--Ignoreit.BŠDC.BƒERASE_LINE-JMPBASE$D5--Specialhandlingfor(ERASELINE).DŠDC.BƒPRINT_TERM-JMPBASE$D6--Printandsendpacket.(LINEINSERT)DŠDC.BƒPRINT_TERM-JMPBASE$D7--Printandsendpacket.(LINEDELETE)&ŠDC.BƒIGNORE-JMPBASE…$D8--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$D9--Ignoreit.5ŠDC.BƒPRINT-JMPBASE†$DA--Printasis.‚(FORWARDTAB)6ŠDC.BƒPRINT-JMPBASE†$DB--Printasis.‚(BACKWARDTAB)&ŠDC.BƒIGNORE-JMPBASE…$DC--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$DD--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$DE--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$DF--Ignoreit.ŠPAGE***************7*‚$E0-$FF‚*ƒRoutineoffsetˆCharƒDescriptionofactionF***************ƒ----------------†----ƒ--------------------------------&ŠDC.BƒIGNORE-JMPBASE…$E0--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$E1--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$E2--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$E3--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$E4--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$E5--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$E6--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$E7--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$E8--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$E9--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$EA--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$EB--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$EC--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$ED--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$EE--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$EF--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$F0--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$F1--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$F2--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$F3--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$F4--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$F5--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$F6--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$F7--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$F8--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$F9--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$FA--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$FB--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$FC--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$FD--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$FE--Ignoreit.&ŠDC.BƒIGNORE-JMPBASE…$FF--Ignoreit.ŠPAGEO*v*****************************************************************************O**********************************************************************************É***7***GET_CURSOR_ADDRESS--RETURNSADDRESSOFCURSOR******É***=***†FUNCTION:‚ThisroutinereturnstheaddressoftheCRT***?***‰controllercursor,relativetothebaseoftheRAMused‰***C***‰toholdthecharacterstobedisplayed(calledscreenRAM).…******É******†NOTES:½******É******É***E***†REGISTERUSAGE:‚(A)rgument‚(D)estroyed‚(P)reserved‚(R)eturned‚***)***Œ0ƒ1ƒ2ƒ3ƒ4ƒ5ƒ6ƒ7‡SRhi„SRlo(CCR)…******‡D:ƒRƒ.ƒ.ƒ.ƒ.ƒ.ƒ.ƒ.‡.ˆD******‡A:ƒ.ƒ.ƒ.ƒ.ƒ.ƒ.ƒ.ƒ. ******É******†ENTRYCONDITIONS:²******É***-***†EXITCONDITIONSDIFFERENTFROMENTRY:ž***@***‰D0.L=theaddressofthecursorrelativetoscreenRAM.ˆ******É***O*^*****************************************************************************O******************************************************************************* GET_CURSOR_ADDRESS: !ŠMOVEQ‚#0,D0ŽD0<--$00000000. 9ŠMOVE.B#$0E,CRTCADD‡D0<--$0000hh00,wherehhisthe7ŠMOVE.BCRTCREG,D0‰highaddressbytetakenfromtheCRTŠLSL„#8,D0Žcontroller. 9ŠMOVE.B#$0F,CRTCADD‡D0<--$0000hhll,wherellisthe<ŠMOVE.BCRTCREG,D0‰lowaddressbytefromtheCRTcontroller. 4ŠADD.L‚D0,D0ŽConvertfromcharaddresstobyteaddr. ŠRTS—Return.ŠPAGEO*v****************************4 ****************************************************;***…CODETOPERFORMACTIONSFORCHAR'SENTEREDINEDITMODE*** ***…FUNCTION:F***‡ExceptforDUPLICATE,theseareallroutinesspecifiedinEDIT_TBLC***‡forthehandlingofincomingcharactersineditmode.‚DUPLICATEE***‡isdifferentinthatitischeckedforseparatelysinceitisnotE***‡knownatassemblytimewhichcharacterwillbetheDUPLICATEchar)***‡(andtheEDIT_TBLshouldbeROMable).****** ***…NOTES:*********…ENTRYCONDITIONS:***‡D0.B=thecharentered."***‡A5ƒ=addressofTERMDRV'sCCB.***O*^*****************************************************************************  **********6*‚Duplicateonthislinethecharfromthelineabove.* DUPLICATE:=ŠMOVE.LS.LINE(PC),D0†Ifwe'reonthetopline(startofthis=ŠCMP.L‚S.SCRN(PC),D0†line=startofscreen),justignoretheŠBEQ.L‚IGNOREDUPLICATEchar. =ŠBSR„GET_CURSOR_ADDRESSWe'renotonthetopline,sogetthe6ŠADD.L‚#SCREEN,D0‰addressofthecursorinscreenRAM.?ŠSUB.L‚BPERLINE(PC),D0„A0<--addrofthecharacterabovethis.ŠMOVE.LD0,A0Ž*4ŠMOVEQ‚#$7F,D0ŒD0.B<--thecharthere(bits0-6).ŠAND„(A0),D0Œ*-ŠBRA„PRINT_LOOKˆGoactlikehetypedthatin.  *J*‚JMPBASEisusedinconstructingthetableEDIT_TBL.‚ThetabledesignatesM*‚theroutinetobeexecutedforagivencharbystoringtheroutine'soffsetH*‚fromJMPBASE.‚Sincetheoffsetistreatedasanunsigned8-bitnumber,?*‚theroutineentrypointsmustallbefairlyclosetoJMPBASE.* JMPBASEƒEQU„*  **********&*‚Movethecursordownwithpagewrap.*DO_LF:>ŠMOVEQIDOWNARROW,D0‡TranslatetheLFtoaDOWNARROWsoweget)*£pagewrapandfallthroughtoprintit.  ********** *‚Outputthecharandterminate.* PRINT_TERM:2ŠBSR.L‚MAKE_PACKETˆConstructaterminationpacket. ŠOUTPUT_D0‘Outputthecharacter.&ŠBRA.L‚SEND_PACKETˆGosendthepacket.  ***********‚Justterminate.* TERMINATE:5ŠBSR.L‚MAKE_PACKETˆConstructaterminationpacketandŠBRA.L‚SEND_PACKETˆgosendit.  **********"*‚Erasethelinethecursorison.* ERASE_LINE:0ŠOUTPUTCR‘Gobacktothebeginningoftheline.'ŠOUTPUTERASE_EOLŠErasetoendofline.3ŠBRA„CHANGE_EXITˆMarkchangetothislineandexit.  **********,*‚Deletethechartotheleftofthecursor.*DO_DEL:BŠBSR„GET_CURSOR_ADDRESSIfwe'renotonthe1stcolumnoftheline9ŠADD.L‚#SCREEN,D0‰(cursoraddr<>startofcurrentline),ŠIF.LD0S.LINE(PC)THEN#ŠOUTPUTBS‘outputabackspacechar.ŠENDI–* 6ŠOUTPUTSPACEŽOutputaspacecharandabackspacechar/ŠOUTPUTBS‘todeletethecharunderthecursor. >CHANGE_EXIT:ST‚CHANGEDŒMarkthatwechangedsomethingonthisŠBRA„EXITlineandexit.  **********@*‚OutputthecharandfakeaCRifwewrappedaroundthescreen.* PRINT_LOOK:(ŠST…CHANGEDŒMarkchangetothislineandŠOUTPUT_D0‘outputthechar.DŠBSR.L‚GET_CURSOR_ADDRESSIfwe'renotonthe1stcolumnoftheline<ŠADD.L‚#SCREEN,D0‰(cursoraddress<>startofcurrentline),ŠCMP.L‚S.LINE(PC),D0†*ŠBNE„EXITjustexit. :ŠOUTPUTUPARROWŒWewrapped,somoveusbacktothelinewe,ŠBRA„DO_CRŽwereonandactlikehehitaCR.  **********D*‚MarkthatthelinewaschangedandfallthroughtoPRINTandEXIT.* PRINT_CHANGE: ŠST…CHANGED  **********0*‚JustoutputthecharandfallthroughtoEXIT.*PRINT: ŠOUTPUT_D0  **********1*‚JustignorethischarandreturnfromEDITMODE.*IGNORE:5EXIT:…RESTORED0/D1/A0/A1‡Restoreregistersandexit.ŠRTS—*  ***********‚DoaCRLFsequence.*DO_CR:.ŠBSR„MAKE_PACKETˆPrepareaterminationpacket. >ŠMOVE.LE.LINE(PC),D0†Ifwe'reonthelastlineofthevirtualHˆIF.LD0E.SCRN(PC)THENscreen(endofthisline=endofscreen),9ŠMOVE.B#$D9,PKT_TERM†puta$D9terminatorinthepacket,(ŠELSE–Else(we'renotonthelastline),9ŠMOVE.B#$DF,PKT_TERM†puta$DFterminatorinthepacket,ŠENDI–* 4 ŠOUTPUTCR‘OutputaCR,LF. ŠOUTPUTLF‘* &ŠBRA.L‚SEND_PACKETˆGosendthepacket.  ************ 07 = CTRL G = BELL*ADDED‚01/30/85*8* RING_BELL flag is set so that the interrupt routine in9* KEYBRD.AG will output an ALARM command to the keyboard.*BELL: ŠSTˆRING_BELL ŠBRA‡EXITŠPAGEO*v*****************************************************************************O**********************************************************************************É***3***ŽMAKE_PACKET--PREPAREATERMINATIONPACKET******É***@***†FUNCTION:‚WhenakeyisstruckwhichnecessitatesthataŠ***@***‰packetbesenttothedriver,thisroutineiscalled.‚It‡***C***‰willprepareapacket,includingdataiftherewasachange…***D***‰ontheline,andsetupthevariablesfortheFEEDERroutine„******‰tosenditlater.¯******É******†NOTES:½******É******É******É***E***†REGISTERUSAGE:‚(A)rgument‚(D)estroyed‚(P)reserved‚(R)eturned‚***)***Œ0ƒ1ƒ2ƒ3ƒ4ƒ5ƒ6ƒ7‡SRhi„SRlo(CCR)…******‡D:ƒAP‚.ƒ.ƒ.ƒ.ƒ.ƒ.ƒ.‡.ˆD******‡A:ƒPƒPƒ.ƒ.ƒ.ƒ.ƒ.ƒP ******É******†ENTRYCONDITIONS:²***)***‰D0.B=theterminatingcharacter.Ÿ******É***-***†EXITCONDITIONSDIFFERENTFROMENTRY:ž******É******É***O*^*****************************************************************************O******************************************************************************* MAKE_PACKET: .ŠSAVEƒD0/A0/A1‹Saveregisterswe'llblowaway.ŠST…KB_LOCKŒLockthekeyboard. **‚Constructthepacketheader.*4ŠLEA„PKT_CFLAG,A1‡A1<--addressofstartofpacket.0ŠST…(A1)+ŽSetthechangeflagto$FF(nochange)%*§fornow.‚Wemayoverwriteitlater.4ŠMOVE.BD0,(A1)+‹Puttheterminatingcharoutthere. DŠBSR.L‚GET_CURSOR_ADDRESSD0<--cursoraddrrelativetoscreenRAM.BŠDIVUƒBPERLINE+2(PC),D0‚D0<--$00xx00rr;rr=line,xx=2*column.9ŠADD.B‚#$20,D0ŒConverttoASCIIandputitinthebuffer.ŠMOVE.BD0,(A1)+‹*ŠSWAPƒD0‘D0.B<--column#. ŠLSR„#1,D0Ž*9ŠADD.B‚#$20,D0ŒConverttoASCIIandputitinthebuffer.ŠMOVE.BD0,(A1)+‹* *B*‚Ifwechangedanythingonthisline,addthedatatothepacket.*,ŠTST.B‚CHANGEDŒIfthelinehasbeenchanged,ŠIF…THENŠ* 1ŠSF…CHANGEDŒResettheCHANGEDflagfornexttime. >ŠMOVE.BPKT_LINE,PKT_CFLAGMovetheline#tothechangeflag. *1*‚MovethelinefromscreenRAMtopacketbuffer.*@ŠMOVE.LS.LINE(PC),A0†A0<--addrofcurrentlineinscreenRAM.DŠMOVEƒC.LINE(PC),D0D0<--#ofchar'sperline(adjustedforDBRA). AFILL_LOOPMOVEQ‚#$7F,D1ŒGetthenextcharfromscreenRAMandand)ŠAND„(A0)+,D1‹offallbutthelow7bits.0ŠMOVE.BD1,(A1)+‹Putthatvalueintothepacket.;ŠDBRAƒD0,FILL_LOOP‡Keepgoinguntilthefulllineismoved. *!*‚Getridofthetrailingblanks.*DŠMOVEƒC.LINE(PC),D0D0<--#ofchar'sperline(adjustedforDBRA)..ŠMOVEQ‚#SPACE,D1ŠD1<--spacecharforsearch. >TRAIL_LOOPCMP.B-(A1),D1‹Searchbackwardthroughthepacket's2ŠDBNEƒD0,TRAIL_LOOP†dataareaforanonblankchar.2ŠADD.L‚#1,A1ŽA1<--addressofthefollowingchar. ŠENDI *5*‚Finishupthepacket,preparethefeeder,andexit.*BŠMOVE.B#END_OF_DATA,(A1)‚Addtheend-of-dataindicatortopacket. 5ŠLEA„PACKET,A0ŠSetfeederaddresstostartofpacket.ŠMOVE.LA0,FEEDER_ADDRESS‚*5ŠSUB.L‚A0,A1ŽSetfeedercountto#ofbytesinpacket)ŠADD„#1,A1Ž*†=‚endaddr-startaddr+1.ŠMOVEƒA1,FEEDER_COUNT„* -ŠRESTORED0/A0/A1ŠRestoreregistersandexit.ŠRTSŠPAGEO*v********************************************************************************5***†SEND_PACKET--SENDTERMINATIONPACKETTOTERMDRV***F***†FUNCTION:‚Thiscodesendstheterminationpacket,alreadypreparedC***‰inthebufferPACKET,tothedriverTERMDRV.‚BeforedoingsoitB***‰storesthecurrentcursorline#inthepacket.‚FEEDER_ADDRESS)***‰andFEEDER_COUNTmustalreadybeset.*** ***†NOTES:*********†ENTRYCONDITIONS:"***‰A5=addressofTERMDRV'sCCB.***O*^************5 ***************************************************************** SEND_PACKET: BŠBSR„GET_CURSOR_ADDRESSD0<--cursoraddrrelativetoscreenRAM.AŠDIVUƒBPERLINE+2(PC),D0‚D0<--$xxxx00rr.‚rr=line#,xx=trash.9ŠADD.B‚#$20,D0ŒConverttoASCIIandputitinthepacket.ŠMOVE.BD0,PKT_LINEˆ* 8ŠBSR.L‚FEEDERCallthefeedertogivethistothedriverŠBRA„EXITandexit.   ŠENDé>FEEDER„IDNTƒ1,0„VME/10subroutinetofeedabuffertoTERMDRV.O*v*****************************************************************************O*******************************************************************************O**********************************************************************************É***4***†FILENAME:‚FEEDER--FEEDABUFFERTOTERMDRV–******É***8***†ENVIRONMENT:‚LinkedintoTERMDRVfortheVME/10.’******É***G***†FUNCTION:‚TERMDRVbasicallyonlyacceptsacharacteratatime.ƒ***D***‰Ifyouhaveabufferfullofcharacterstosend,youcanuse„***=***‰thisroutinetogivethem,oneatatime,toTERMDRV.‹******É***E***†NOTES:‚Whencontrolisreturnedtothecaller,thebufferhas…***@***‰notnecessarilybeencompletelysent.‚Nonotificationis‡***;***‰providedtoindicatethatthebufferhasbeensent.******É***,***†EXTERNALDATASTRUCTURESREFERENCED:Ÿ*** ***‰CCBforterminaldriver.¨******É***)***†EXTERNALENTRYPOINTSREFERENCED:¢******‰GOT_CHAR¸******É***"***†SERVICESCALLEDVIATRAPS:©******É***O*******************************************************************************O*******************************************************************************O*^***************************************************************************** *,*‚Revisionhistory(addnewchangestotop).*…Date†Author‰ChangesG*…--------‚-------------‚----------------------------------------------'*†7/19/83‚SteveFranckƒInitialwriting.*ŠPAGE* *‚XDEF's.*6ŠXDEFƒSTOP_ITŒEntrypt.forbackgroundroutinetostop'*§usfromtryingtofeedmorechar'sto *§thedriver.6ŠXDEFƒUNSTOPEntrypt.forustoresumefeedingchar's"*§tothedriverifwehadstopped.6ŠXDEFƒFEEDEREntrypt.forroutinethatfeedsabuffer!*§abyteatatimetothedriver.?ŠXDEFƒFEEDER_ADDRESS,FEEDER_COUNT,FEEDER_WAITING‚Variablesused%*§indealingwiththefeederroutine.>ŠXDEFƒREL_FLAG,REL_ADDR,REL_PAGES‚Variablestouseifyouwant›1¤C¬:´<¼/&*§FEEDERtoreleasememorytotheexec*§whenitisdonefeeding.   *0*‚XREF's(indicatewheretheXDEFis,ifknown).*6ŠXREFƒGOT_CHAR‹Entrypt.inTERMDRVtoprocessachar.ŠPAGEO*********************************************************************************‰INCLUDEFILESANDEQUATES*O******************************************************************************* *=*‚DefinetheenvironmentasEXORMACS/Sinaswitchtocontrol*‚conditionalassemblies.*2ENVIRONMENTEQU‚'EX/S'ThisisfortheEXORMACS/S.  **‚Includefiles:5*‰UTILITY.MC‹Generalpurposemacros(e.g.PUSH,POP).,*‰IOE.SAEquatesforIOS-relatedstructures.7*‰EQUCCB.EQŒEquatesfordevice-independentpartofCCB.9*‰TERMDRV.EQ‹Equatesforthegeneralizedterminaldriver.(*‰STR.EQEquatesfortrap#0calls,etc.*ŠNOLISTŠINCLUDE‚9995.&.UTILITY.MCŠINCLUDE‚9995.&.IOE.EQŠINCLUDE‚9995.&.CCB.EQŠINCLUDE‚9995.VMES10.TERMDRV.EQŠINCLUDE‚9995.&.STR.EQŠLIST  .FALSE…5 EQU„$00ValueFALSEforaflagvariable.,TRUE†EQU„$FFValueTRUE‚foraflagvariable.ŠPAGEO*********************************************************************************‰DATAVARIABLES*O******************************************************************************* ŠSECTION0 *I*‚ThesevariablesareusedasargumentstotheFEEDERroutinewhichgives-*‚bytesinabufferoneatatimetoTERMDRV.*@FEEDER_ADDRESSDC.L0Addressofnextbyteforfeedersubroutine*§tofeedtothedriver.;FEEDER_COUNTDC.W0‘#ofbytesremainingtofeedtodriver.CFEEDER_WAITINGDC.BFALSE‹Flagindicatingwhetherornotthefeeder$*§iswaitingforroominthereceive"*§queue.‚UsedbyUNSTOProutineto'*§restartthefeederifithadtostop. =REL_FLAG‚DC.BƒFALSEŽFlagindicatingwhetherornotthefeeder(*§shouldreleasememorytotheexecwhen)*§itisdonefeedingabuffertoTERMDRV.4REL_ADDR‚DC.Lƒ0’Startaddrofbuffertobereleased.5REL_PAGESDC.Lƒ0’#ofpagesinbuffertobereleased.ŠPAGEO*v*****************************************************************************O**********************************************************************************É***4***FEEDER--FEEDSABUFFERBYTEWISETOTERMDRV******É***G***†FUNCTION:‚Thisroutine,whoseentrypointisXDEF'ed,willtakeƒ***@***ˆthebufferdescribedbythevariablesFEEDER_ADDRESSand‰***E***ˆFEEDER_COUNTandtransferitabyteatatimetotheterminal„***C***ˆdriver,TERMDRV.‚ItsenseswhentheSTOPPEDflagintheCCB…***G***ˆgetsset,whichmeansthatthedriver'sreceivequeueisalmost‚***A***ˆfull,andstopssending.‚Provisionsmustbemadeforthis‡***C***ˆroutinetobeinvokedagainlaterwhenthereisroominthe†******ˆreceivequeue.³******É******†NOTES:½******É******É***E***†REGISTERUSAGE:‚(A)rgument‚(D)estroyed‚(P)reserved‚(R)eturned‚***)***Œ0ƒ1ƒ2ƒ3ƒ4ƒ5ƒ6ƒ7‡SRhi„SRlo(CCR)…******‡D:ƒPƒPƒ.ƒ.ƒ.ƒ.ƒ.ƒ.‡.ˆD******‡A:ƒPƒPƒ.ƒ.ƒPƒAƒ.ƒP ******É******†ENTRYCONDITIONS:²***&***ˆA5ƒ=addressofTERMDRV'sCCB.¡******É***-***†EXITCONDITIONSDIFFERENTFROMENTRY:ž******É******É***O*^*****************************************************************************O******************************************************************************* ŠDS…0ŠOPT„BRS ŠSECTION0 FEEDER: ;ŠSAVEƒD0/D1/A0/A1/A4…Saveregisterswe,orthedriver,use.AŠMOVE.LFEEDER_ADDRESS,A4‚A4<--addrof1stbytetofeeddriver.  ŠREPEAT ;ŠSUB„#1,FEEDER_COUNT„Decrementthecountofbytesremaining$ŠBMI„DONEandgetoutifwe'redone. -ŠMOVE.B(A4)+,D0‹D0<--nextbytefordriver.5ŠPEA„RETURN(PC)‰Callthedriveratthepointwherehe6ŠPUSH.LD1‘hasthecharacterandstartstoprocessit.ŠBRA.L‚GOT_CHAR‹* @RETURN„TST.B‚STOPPED(A5)ˆHavingreturnedfromthedriver,seeif-ŠUNTIL‚he'sfullandrepeatifhe'snot.  *D*‚Thedrivercan'ttakeanymorecharactersnow,sowehavetoexit.*@ŠMOVE.LA4,FEEDER_ADDRESS‚Saveaddressofnextbytetofeedhim.6ŠST…FEEDER_WAITING…Remindsomeonethatwe'renotdone. 4ŠBRA„EXITJustexitfornow;we'llgetcalledlater.  *H*‚Thebufferhasbeenfedtothedriver.‚Releasethebufferifnecessary *‚andexit.*:DONE†TST.B‚REL_FLAG‹Ifwe'resupposedtoreleaseabuffer,ŠIF…THENŠ* 7ŠSAVEƒD2-D7/A2-A3/A5…Saverestofregisters,exceptA6.;ŠMOVE.LREL_ADDR,A0ˆA0<--startaddrofbuffertorelease.1ŠMOVE.LREL_PAGES,D1‡D1<--#ofpagesinbuffer.(ŠTR0$.PGFR,Askexectofreethepages.ŠBRA„RELEASED‹Goodreturn.*ŠTR0$.KILLERBadreturn--crashthesystem. THENŠofhiswork(thisshouldbethecase),)ŠBSR„FEEDERcallhimtolethimcontinue.ŠENDI–* ŠRTS—Return.     ŠENDééHINCHAR„IDNTƒ1,0‚Routinetogetincomingchar'sandhandlespecialmodes.O*v*****************************************************************************O*******************************************************************************O**********************************************************************************É***I***…FILENAME:INCHAR--GETINCOMINGCHAR'SANDHANDLESPECIALMODES.ƒ******É***K***…ENVIRONMENT:PartofVERSAdoskeyboard/screendriverfortheVME/10.******É***G***…FUNCTION:ThesubroutineinthismoduleiscalledbyTERMDRVto…***#***‡handleincomingcharacters.§******É******…NOTES:¾******É***,***…EXTERNALDATASTRUCTURESREFERENCED: *******‡EDIT_FLAG„KB_LOCK„PAGEFLAG„PROMODE—******É***)***…EXTERNALENTRYPOINTSREFERENCED:£***"***‡GET_CHAR…EDITMODE…PAGEMODE ******É***"***…SERVICESCALLEDVIATRAPS:ª******É******É***O*******************************************************************************O******************************************6 *************************************O*^***************************************************************************** *,*‚Revisionhistory(addnewchangestotop).*…Date†Author‰ChangesG*…--------‚-------------‚----------------------------------------------'*†5/23/83‚SteveFranckƒInitialwriting.* * *‚XDEF's.*+ŠXDEFƒIN_CHARŒEntrypointforthisroutine. *0*‚XREF's(indicatewheretheXDEFis,ifknown).*2ŠXREFƒGET_CHAR‹Routinetogetascancodefromthe&*§keyboardandgenerateachar,update"*§modes,etc.;inmoduleKEYBOARD. 7ŠXREFƒEDITMODE‹Routinetohandleincomingcharactersif*§we'reineditmode. 8ŠXREFƒEDIT_FLAGŠFlagindicatingwhetherornotwearein *§editmode;inmoduleEDITMODE. 7ŠXREFƒPAGEMODE‹Routinetohandleincomingcharactersif%*§we'reinpagemodeorprotectmode. 7ŠXREFƒPAGEFLAG‹Flagindicatingwhetherornotwearein*§pagemode;inmoduleCRTINIT. 6ŠXREFƒPROMODEŒFlagindicatingwhetherornotweareinÄ;Í@Õ*!*§protectmode;inmoduleOUTCHS. 9ŠXREFƒKB_LOCKŒFlagindicatingwhetherornotthekeyboard'*§is'softwarelocked,'meaningthatno!*§charactersshouldbegenerated. **‚Equatefilesincluded:0*…UTILITY.MC„Utilitymacros(likePUSHandPOP).*ŠNOLISTŠINCLUDE9995.&.UTILITY.MCŠLISTŠPAGEO*v*****************************************************************************O**********************************************************************************É***7***IN_CHAR--HANDLECHARFROMTHEVME/10KEYBOARD******É***H***…FUNCTION:ThisroutineiscalledbyTERMDRV,thekeyboardscreen„***E***‡driver,whenscancodesarereceivedfromthekeyboard.‚After„***D***‡callingGET_CHARtofigureoutwhatthecharis,EDITMODEis†***D***‡calledifnecessary.‚'Softwarelock'ofthekeyboardisalso…*** ***‡handledbythisroutine.ª******É******…NOTES:¾******É***E***…REGISTERUSAGE:‚(A)rgument‚(D)estroyed‚(P)reserved‚(R)eturnedƒ***)***Œ0ƒ1ƒ2ƒ3ƒ4ƒ5ƒ6ƒ7‡SRhi„SRlo(CCR)…******‡D:ƒRƒPƒ.ƒ.ƒ.ƒ.ƒ.ƒ.‡.ˆR******‡A:ƒ.ƒ.ƒ.ƒ.ƒ.ƒAƒ.ƒP ******É******…ENTRYCONDITIONS:³***&***‡A5ƒ=addressofTERMDRV'sCCB.¢******É***-***…EXITCONDITIONSDIFFERENTFROMENTRY:Ÿ***I***‡CCR:=keystrokedidn'tgenerateacharorbreakforTERMDRV.***A***Œ:=generatedcharisinD0.W(bits8-15are0).„***%***’=abreakwasgenerated.š***(***‡D0isnotpreservedinanycase.¢******É***O*^*****************************************************************************O******************************************************************************* ŠDS…0 ŠSECTION0ŠOPT„BRS IN_CHAR: (ŠSAVEƒD1‘Saveregisterswe'llblowaway. 0ŠBSR.L‚GET_CHAR‹Getthecharacter(orwhatever).'ŠIF…THENŠIfitisacharorbreak, ŠIF…THENŠ.Ifit'sabreak, "ŠSF…KB_LOCKŒ.ƒUnlockthekeyboard; ŠELSE–.Else(it'sacharacter), 4ŠTST.B‚KB_LOCKŒ.ƒIfthekeyboardissoftwarelocked,ŠIF…THENŠ.ƒ* -ŠCLR„D0‘.…SetCCR:tosay'falsealarm.' *ŠELSE–.ƒElse(thekeyboardisnotlocked), *ŠTST.B‚EDIT_FLAGŠ.…Ifweareineditmode,ŠIF…THENŠ.…* 0ŠBSR.L‚EDITMODE‹.‡Calltheeditmodehandlerand-ŠCLR„D0‘.‡setCCR:tosay'falsealarm.' 'ŠELSE–.…Else(wearenotineditmode), 8ŠMOVE.BPAGEFLAG,D1ˆ.‡Ifweareinpageorprotectmode,ŠOR.BƒPROMODE,D1‰.‡*ŠIF…THENŠ.‡* 0ŠBSR.L‚PAGEMODE‹.‰Callthepagemodehandler;he*±willsettheconditioncodes. 'ŠELSE–.‡Else(wearenotinpagemode), /ŠMOVEQ‚#1,D1Ž.‰SetCCR:,tosay'there*±isacharinD0.' ŠENDI–. ŠENDI–. ŠENDI–. ŠENDI–. ŠENDI–.   7ŠRESTORED1Restoreregistersandreturnwithcondition7 ŠRTS—codesset.   ŠENDéééé7OUTCHSƒIDNT†1,00†OutputacharactertothedisplayRAM. <*************************************************************º**Routinename:ŽOUTCHS˜*<*----------------------------------------------------------*-*Currentrevision.....................1.00*1*Datewritten.........................12-18-82Œ*2*Writtenby...........................S.Pri-Tal‹*/*Datechanged.........................3-1-83Ž*2*Changedby...........................R.RUSTAD‹**º**Descriptionofchange:£**º**º*0*Datechanged.........................8-17-84*1*Changedby...........................B.NASONŒ**º**Descriptionofchange:£**ƒChangedallXREF.StoXREF**º*0*Datechanged........................10-24-84*1*Changedby...........................B.NASONŒ**º**Descriptionofchange:£*5*‚SystemwashangingwhenSHIFT/CLEARwashitwhile‡*7*‚therewasanoutput‚tothescreen.‚TheregistersA2ƒ*:*‚andD6werenotbeingsetupinCLEAR_SCREEN,whichis‚*;*‚calledbyBREAK_CLEARinGET_CHARintheKEYBOARDmodule*,*‚Sonowwesetuptheregistersproperly.**º*0*Datechanged.........................1-30-85*/*Changedby...........................M.DUHŽ**º**Descriptionofchange:£*7*ƒSetRING_BELLflagwhen$07istobeoutput(BELL).„**º**º*<************************************************************9*Function:OutputthecharacterinD0.Btothedisplay„*/*‹RAMifcharacterisprintable,elseperform„**‹therequiredfunction.™*<*----------------------------------------------------------*/*Inputparameters:‚D0.Bcharactertooutput.*<*----------------------------------------------------------**Registersaffected:none¡*<*----------------------------------------------------------* *Externalroutinesused:none*<************************************************************‰PAGE ‰XDEF†OUTCHS‰XDEF†EDIT_FLAG 4‰XDEF†RESET_SCREEN‚Alternateentryforresetcommand4‰XDEF†CLEAR_SCREEN‚AlternateentryforclearcommandÝ7æ9î?öBþ-,-0+&T.a6O>QFSNDVA^BfSn:vU~J†SŽK–>žF¦K‰XDEF†PROMODE‡Protectmodeflag )‰XDEF†RABSOLUT†Readabsoluteentrypoint. (‰XREF†CRTINITƒInitthescreenparameters‰XREF†SCRNINIT /‰XREF†FACS†Fieldattribute,wordsizedregister3‰XREF†PAGEFLAG‚Wordsizedflag.If=$FFFF,pagemode 5‰XREF†CPERLINE‚Numberofcharactersperabsoluteline0‰XREF†BPERLINE‚Numberofbytesperabsoluteline2‰XREF†LPERSCRN‚Numberoflinesperabsolutescreen 2‰XREF†C.LINE„Numberofcharacterspervirtualline-‰XREF†B.LINE„Numberofbytespervirtual7 line *‰XREF†S.LINE„Startaddressofcurrentline(‰XREF†E.LINE„Endaddressofcurrentline *‰XREF†PB.LINEƒUnusedpartofabsoluteline 2‰XREF†L.SCRN„Numberoflinesinthevirtualscreen <‰XREF†S.SCRN„Addressofhomecharacterinthevirtualscreen<‰XREF†E.SCRN„Addressoflastcharacterinthevirtualscreen (‰XREF†TOPLINEƒToplineofvirtualscreen+‰XREF†BOTLINEƒBottomlineofvirtualscreen,‰XREF†LEFTCOLƒLeftcollumnofvirtualscreen.‰XREF†RIGHTCOL‚Rightcollumnofvirtualscreen 9‰XREF†FEEDER„Addressofsubroutinetogivedatatodriver=‰XREF†FEEDER_ADDRESS†AddressofdatabuffertogivetoFEEDER,‰XREF†FEEDER_COUNTˆ#ofbytesindatabufferA‰XREF†REL_FLAG‚Flagwhichtellsfeedersubroutinetoreleasemem.7‰XREF†REL_ADDR‚Memoryaddressofbuffertobereleased.*‰XREF†REL_PAGESNumberofpagesinbuffer.‰XREF†DUP_CHAR (‰XREF†KB_LOCKKeyboardlock/unlockflag.‰XREF†POUTCHSOutputcharacterinprotectmode 0‰XREF†RING_BELL‹Flagsetwhen$07isdetectedin%*§ordertoringthebellinKEYBRD.AG‰PAGE .SCREENƒEQU‡$F17000BaseaddressofdisplayRAM0CRTCADD‚EQU‡$F1A021AddressregisteroftheCRTC-CRTCREG‚EQU‡$F1A023RegisterfileoftheCRTC)EPCIBASEEQU‡$F1A031BaseaddressofEPCIKBDADDR‚EQU‡$0C$LFCHARƒEQU‡$0A‘ASCIIlinefeedchar.0START_OF_DATAEQU‚$DDŽ'Startofdata'indicator./END_OF_DATAEQU„$DE‘Endofwrite/readindicator,END_OF_FIELDEQUƒ$F9‘Endoffieldindicator.$FALSE„EQU‡0“Indicateconditionfalse#TRUE…EQU‡-1’Indicatetruecondition"CLEARTABEQU‡$18‘Cleartabcommand#SPACE„EQU‡$20ŽASCIIspacecharacter#ESC_CHAR‚EQU„$1BASCIIescapechar.;NUMBER_PAGESEQU‚8‘Numberofpagestogivetofeederduring*£areadabsolute.6INIT_TAB‚EQU„10‘Initialtabspacing.‚Theresetcommand#*§($F1)willputtabsonthescreen*§withthisspacing. ** Register use:*’D0.L=generaluse+*’D1.W=absoluteaddressofinitialcursor/*’D2.W=chractertodecodeandwordtodisplay)*’D3.W=linespervirtualscreencounter+*’D4.W=characerspervirtuallinecounter *’D5.L=bytesperabsoluteline*’D6.L=bytespervirtualline*’D7.L=generaluse-*’A0.L=addressofcursorinthedisplayRAM*’A1.L=AddressofFACS*’A2.L=AddressofS.LINE*’A3.L-Generaluse*  ‰PAGE ‰SECTIONƒ11  **ˆDEFINESTORAGE*=ESC_FLAG‚DC.BƒFALSEŽThisflagistrueifsomeonehasreserved(*§acharandthefirstcharreceivedwas&*§anESC.‚Inthatcasewewaitforthe*§nextcharandsetitsbit7.:CHAR_RESERVEDDC.BFALSE…Nextcharacterreservedindicator(SAVE_CHAR…DS.B1‰Saveareaforcharacter:SAVE_CR1†DS.B1‰Saveareaforcharacter‚Theseareusedfor;SAVE_CR2†DS.B1‰Saveareaforcharacter‚readabsoluteonly.)SAVE_CR3†DS.B1‰Saveareaforcharacter‚*-SAVE_CURSORƒDS.L1‰CurrentcursorramaddressBCHAR_OWNER„DS.L1‰Addressofroutinethatownsnextincomingchar.4XTCHBUF‚DS.W†10ˆScratchbufferforfeedersubroutineEDIT_FLAGDC.B…FALSE‰DS.W†0,PROMODE‚DC.W†FALSE…Setprotectmodetofalse=COL_CNT‚DS.L†1‰Currentcolumnnumber,usedinsettabroutine‰DS.W†0;SAVEFACSDC.W†0‰SaveFACSinusewhenwriteabsoluteoccurs>LASTFAC‚DC.B†FALSE…Lastcharacterprocessed--indicatesifit*œwasaFACornot.THEN.S 8ŠTST.B‚ESC_FLAG‹IfthelastcharwereceivedwasanESC,ŠIF…THEN.Sˆ* 2ŠSF…ESC_FLAG‹Clearthe'lastcharwasanESC'flag5ŠBSETƒ#7,D0Žandsetbit7inD0andD2(bothofwhich-ŠBSETƒ#7,D2ŽholdthecharfollowingtheESC). (ŠELSE.S”Else(lastcharwasnotanESC), 6ŠIF.BD0#ESC_CHARTHEN.SIfthischarisanESC,0ŠST…ESC_FLAG‹setthe'lastcharwasanESC'flagŠBRA„RETURNandexit.ŠENDI–* ŠENDI /‰SFCHAR_RESERVEDŽResetcharacterreservedflag:‰MOVE.LCHAR_OWNER,A3ŠGettheaddressoftheroutinewhich*¨processthischaracter'‰JMP(A3)–Goprocessincomingcharacter ‰ENDI *(*ˆFindentryintableforthischaracter*OUTCH1(‰MOVE†D2,D0…Resetupperpartofregister5‰ADD‡D0,D0…Multiplybytwobecausetableiswordwide+‰MOVE†JUMPTABL(PC,D0),D0Getoffsetaddress2‰JMP‡JUMPTABL(PC,D0)„Goprocessincomingcharacter‰PAGEJUMPTABL,ŠDC.WƒRETURN-JUMPTABL„$00--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$01--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$02--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$03--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$04--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$05--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$06--Illegal--exit ŠDC.WƒBELL-JUMPTABL†$07--Bell.#ŠDC.WƒBS-JUMPTABLˆ$08--Backspace.(ŠDC.WƒHT-JUMPTABLˆ$09--Horizontaltab.#ŠDC.WƒLF-JUMPTABLˆ$0A--Linefeed.&ŠDC.WƒUP-JUMPTABLˆ$0B--Verticaltab.&ŠDC.WƒRIGHT-JUMPTABL…$0C--Formfeed.)ŠDC.WƒCR-JUMPTABLˆ$0D--Carriagereturn.,ŠDC.WƒRETURN-JUMPTABL„$0E--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$0F--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$10--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$11--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$12--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$13--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$14--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$15--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$16--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$17--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$18--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$19--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$1A--Illegal--exit!ŠDC.WƒESC-JUMPTABL‡$1B--Escape.,ŠDC.WƒRETURN-JUMPTABL„$1C--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$1D--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$1E--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$1F--Illegal--exit,ŠDC.WƒDISPLAY-JUMPTABLƒ$20--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$21--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$22--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$23--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$24--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$25--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$26--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$27--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$28--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$29--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2F--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$30--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$31--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$32--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$33--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$34--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$35--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$36--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$37--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$38--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$39--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3F--Displayasis.,ŠDC.8 WƒDISPLAY-JUMPTABLƒ$40--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$41--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$42--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$43--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$44--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$45--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$46--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$47--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$48--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$49--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4F--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$50--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$51--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$52--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$53--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$54--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$55--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$56--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$57--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$58--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$59--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5F--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$60--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$61--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$62--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$63--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$64--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$65--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$66--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$67--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$68--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$69--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6F--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$70--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$71--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$72--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$73--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$74--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$75--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$76--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$77--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$78--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$79--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7E--Displayasis.+ŠDC.WƒRETURN-JUMPTABL„$7F--Displayasis.'ŠDC.WƒRETURN-JUMPTABL„$80--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$81--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$82--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$83--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$84--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$85--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$86--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$87--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$88--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$89--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$8A--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$8B--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$8C--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$8D--Ignoreit.4ŠDC.WƒSTART_EDITMODE-JUMPTABLƒ$8E--Starteditmode1ŠDC.WƒSTOP_EDITMODE-JUMPTABL„$8F--Endeditmode'ŠDC.WƒRETURN-JUMPTABL„$90--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$91--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$92--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$93--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$94--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$95--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$96--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$97--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$98--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$999 --Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9A--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9B--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9C--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9D--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9E--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9F--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A0--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A1--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A2--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A3--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A4--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A5--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A6--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A7--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A8--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A9--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AA--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AB--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AC--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AD--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AE--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AF--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B0--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B1--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B2--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B3--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B4--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B5--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B6--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B7--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B8--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B9--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BA--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BB--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BC--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BD--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BE--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BF--Ignoreit.%ŠDC.WƒHOME-JUMPTABL†$C0=Cursorhome!ŠDC.WƒUP-JUMPTABLˆ$C1=Cursorup%ŠDC.WƒDOWN-JUMPTABL†$C2=Cursordown&ŠDC.WƒSEEKL-JUMPTABL…$C3=Cursorleft'ŠDC.WƒRIGHT-JUMPTABL…$C4=Cursorright$ŠDC.WƒC5-JUMPTABLˆ$C5=Writecursor#ŠDC.WƒC6-JUMPTABLˆ$C6=Readcursor(ŠDC.WƒSPAGE-JUMPTABL…$C7=Setpagemode*ŠDC.WƒRPAGE-JUMPTABL…$C8=Resetpagemode0ŠDC.WƒSETTOP-JUMPTABL„$C9=Settopdisplayline5ŠDC.WƒSETBOTOM-JUMPTABL‚$CA=Setbottomdisplayline5ŠDC.WƒSETLEFT-JUMPTABLƒ$CB=Setleftdisplaycollumn7ŠDC.WƒSETRIGHT-JUMPTABL‚$CC=Setrightdisplaycollumn,ŠDC.WƒSETPRO-JUMPTABL„$CD=Setprotectmode,ŠDC.WƒWABSOLUT-JUMPTABL‚$CE=Writeabsolute+ŠDC.WƒRABSOLUT-JUMPTABL‚$CF=Readabsolute5ŠDC.WƒICHAR-JUMPTABL…$D0=Insertcharacteratcursor5ŠDC.WƒDCHAR-JUMPTABL…$D1=Deletecharacteratcursor,ŠDC.WƒKEYENAB-JUMPTABLƒ$D2=Enablekeyboard.ŠDC.WƒKEYDSABL-JUMPTABL‚$D3=Disablekeyboard?ŠDC.WƒEEPAGE-JUMPTABL„$D4=Eraseallunprotectedtoendofpag?ŠDC.WƒEELINE-JUMPTABL„$D5=Eraseallunprotectedtoendoflin5ŠDC.WƒINS_LINE-JUMPTABL‚$D6=Insertalineatcursor5ŠDC.WƒDEL_LINE-JUMPTABL‚$D7=Deletealineatcursor:ŠDC.WƒCLEAR-JUMPTABL…$D8=Eraseallunprotectedinscreen5ŠDC.WƒRETURN-JUMPTABL„$D9=Sendpagetolineprinter'ŠDC.WƒSEEKFT-JUMPTABL„$DA=Forwardtab$ŠDC.WƒSEEKBT-JUMPTABL„$DB=Backtab#ŠDC.WƒSETTAB-JUMPTABL„$DC=SettabŠDC.WƒRETURN-JUMPTABL„$DD=ŠDC.WƒRETURN-JUMPTABL„$DE=0ŠDC.WƒRETURN-JUMPTABL„$DF=Sendlinetoprinter%ŠDC.WƒSBLINK-JUMPTABL„$E0=Setblink'ŠDC.WƒRBLINK-JUMPTABL„$E1=Resetblink-ŠDC.WƒSINVERT-JUMPTABLƒ$E2=Setvideoinvert/ŠDC.WƒRINVERT-JUMPTABLƒ$E3=Resetvideoinvert-ŠDC.WƒUPBRIGHT-JUMPTABL‚$E4=Sethalfbright/ŠDC.WƒDNBRIGHT-JUMPTABL‚$E5=Resethalfbright)ŠDC.WƒSULINE-JUMPTABL„$E6=Setunderline+ŠDC.WƒRULINE-JUMPTABL„$E7=Resetunderline,ŠDC.WƒNONDISP-JUMPTABLƒ$E8=Setnon-display(ŠDC.WƒSETDISP-JUMPTABLƒ$E9=Setdisplay-ŠDC.WƒPROTECT-JUMPTABLƒ$EA=Setprotectmode-ŠDC.WƒALLOW-JUMPTABL…$EB=ResetprotectmodeŠDC.WƒRETURN-JUMPTABL„$EC=ŠDC.WƒRETURN-JUMPTABL„$ED=ŠDC.WƒRETURN-JUMPTABL„$EE=ŠDC.WƒRETURN-JUMPTABL„$EF=ŠDC.WƒRETURN-JUMPTABL„$F0=2ŠDC.WƒRESET24-JUMPTABLƒ$F1=Reset24linescreen.ŠDC.WƒRETURN-JUMPTABL„$F2=ŠDC.WƒRETURN-JUMPTABL„$F3=ŠDC.WƒRETURN-JUMPTABL„$F4=ŠDC.WƒRETURN-JUMPTABL„$F5=ŠDC.WƒRETURN-JUMPTABL„$F6=2ŠDC.WƒRESET25-JUMPTA9 BLƒ$F7=Reset25linescreen.ŠDC.WƒRETURN-JUMPTABL„$F8=ŠDC.WƒRETURN-JUMPTABL„$F9=ŠDC.WƒRETURN-JUMPTABL„$FA=ŠDC.WƒRETURN-JUMPTABL„$FB=ŠDC.WƒRETURN-JUMPTABL„$FC=ŠDC.WƒRETURN-JUMPTABL„$FD=ŠDC.WƒRETURN-JUMPTABL„$FE=ŠDC.WƒRETURN-JUMPTABL„$FF=  ‰PAGE*'* $7F = DLE, delete character at cursor*DLE'‰AND.W…#$FF80,(A0)‰Nullcharacterspace)‰OR.B†#$20,(A0)‹Spacecharacteratcursor ‰BRA‡RETURN *** Send the command in D0 to this key board*'WKBD…OR.B†#KBDADDR,D0‰Tothiskeyboard‰MOVE.B„D0,EPCIBASE‰RTS ** 07 = CTRL G = BELL*ADDED‚01/30/85*8* RING_BELL flag is set so that the interrupt routine in9* KEYBRD.AG will output an ALARM command to the keyboard.*BELL ‰STˆRING_BELL ‰BRA‡RETURN ** 08 = CTRL H = BS, back space*:* Cursor moves left to first unprotected column, with line* and page rollover.**BS SEEKL„EQU‡*‰IF.L†A0S.LINEOR.L‰A0S.SCRNTHEN.S9‰MOVE.L„E.LINE,A0‹Ifstartoflineencounteredsettoend‰ENDI)‰SUBQ.L„#2,A0Backcursoruponeposition ‰BRA‡WRITCRSR‰PAGE*"* 09 = CTRL I = HT, horizontal tab*2* Seek a TAB at an un-protected spot to the right,* with line and page rollover.** If none found, move right*HT$SEEKFTƒEQU‡*“Seekatabtotheright!‰MOVE.L„A0,A3Setloopterminator*‰ADDQ.L„#2,A0Getoffofcurrentcharacter‰BRA.S…SEEKFT1‰REPEAT-‰MOVE.W„(A0)+,D0ŒScanforwardoncurrentline‰TST.B…D0’Isthetabbitset0‰BMI.S…SEEKFT2FoundtabpositionifbitwassetSEEKFT1‰IF.L†A0E.LINETHEN.S+‰MOVE.L„S.LINE,A0‹Onlywraponcurrentline‰ENDI (‰UNTIL.LƒA0A3ŠLoopforentireline%‰BRA‡RETURNŽJustexitifnotabfoundSEEKFT2)‰SUBQ.L„#2,A0Adjustbecauseofincrement,‰BRA‡WRITCRSRŒUpdatecurrentcursorposition‰PAGE**0A…LINEFEED**LF8‰MOVE.L„A0,D0…Absolutecursoraddressintoausablereg.‰SUB.L…#SCREEN,D04‰DIVU†BPERLINE+2,D0‡D0.Wistheabsolutelinenumber7‰IFˆBOTLINED0THEN.S‚IFweareonthebottomline‰BRA‡SCROLL1Scrollthescreen‰ENDI/‰BRA‡DOWNIfnotatbottommovethecursordown***0D…Carriagereturn*2* Position cursor at left most unprotected column.** FAC's are reset.*CR‰AND.W…#$4400,(A1)‰ResetFACs‰MOVE.L„S.LINE,A0‹Startofline ‰BRA‡WRITCRSR * *1B…Escape*(* Set high bit of next character output.* ESC†EQU‡*#‰BSR‡GET_CHARŒNeedanotercharacter ‰BSET†#7,D0‰BRA‡HAVE_CHAR‰PAGE**$8E„STARTEDITMODE*START_EDITMODE ‰BSR‡GET_CHAR‰IF.BD0#$FFTHEN.S‰MOVE†#$FFFF,DUP_CHAR‰ELSE.S‰MOVE†D2,DUP_CHAR‰ENDI ‰STˆEDIT_FLAG ‰BRA‡RETURN**$8F‚STOPEDITMODE* STOP_EDITMODE%‰SFˆEDIT_FLAG‹Turnoffeditmodeflag ‰BRA‡RETURN‰PAGE**$C0„cursorhome*A* Cursor moves to top left corner of screen, seeks an unprotected* space to the right.** HOME…EQU‡* ‰MOVE.L„S.SCRN,A0‹Topleftspace6‰MOVE.L„A0,S.LINE‹Modifystartandendofcurrentline‰MOVE.L„A0,E.LINE‰ADD.L…D6,4(A2) ‰BRA‡WRITCRSR * * C1 = Up*C* Cursor moves up one line in same column, seeks unprotected column+* to the left, with line and page rollover.**(UP‡SUB.L…D5,A0Samecolumninlineabove3‰SUB.L…D5,(A2)Modifystartandendofcurrentline‰SUB.L…D5,4(A2)‰CMP.L…S.SCRN,A0‹Outofscreen?‰BGE.S…UP.1No,doit‰MOVE.L„E.SCRN,A0‹Yes,rollover*‰MOVE.L„A0,S.LINE‹Updatestart/endofline‰SUB.L…D6,(A2)‰MOVE.L„A0,E.LINE ‰ADD.W…#1,D4!‰LSL.W…#1,D4Bytestoendofline(‰SUB.W…D4,A0Tostayinthesamecollumn +UP.1…EQU‡*“Modifystart/endofcurrentline ‰BRA‡WRITCRSR‰PAGE* * C2 = Down*A* Cursor seeks an unprotected spot to the right, starting at same+* collumn on next line, with page rollover.* DOWN…EQU‡*%‰ADD.L…D5,A0Samecolumnonnextline/‰ADD.L…D5,(A2)Modifystart/endofcurrentline‰ADD.L…D5,4(A2)#‰CMP.L…E.SCRN,A0‹Outofthescreen?‰BLT.S…DOWN1No,doit$‰MOVE.L„S.SCRN,A0‹Yes,pageroll: over‰MOVE.L„A0,S.LINE‰MOVE.L„A0,E.LINE&‰ADD.L…D6,4(A2)ŒD6=B.LINE,A2==>S.LINE ‰ADD.W…#1,D4$‰LSL.W…#1,D4D4=#ofbytestoe.line ‰SUB.L…D4,D5 ‰ADD.W…D5,A0DOWN13‰BRA‡WRITCRSRŒSeekanunprotectedspottotheright *** C3 = cursor left, same as back space 08.* * * C4 = Right*)* Seek an unprotected space to the right.*RIGHT'‰ADDQ.L„#2,A0Getoffofcurrentcolumn‰IF.LA0E.LINETHEN.S‰MOVE.L„S.LINE,A0‹Dolinewrap‰ENDI‰BRA‡WRITCRSRŒUpdatethecursor‰PAGE*+*$C5„Movethecursortotherequestedspot*C5: 'ŠBSR„GET_CHAR‹D0.B<--theline#char.'ŠMOVE.BD0,SAVE_CHAR‡Saveitforlater. )ŠBSR„GET_CHAR‹D0.B<--thecolumn#char.&ŠMOVEQ‚#0,D1ŽD1<--thecolumn#char.ŠMOVE.BD0,D1Ž*1ŠSUB.B‚#$20,D1ŒAdjustitso0isfirstline,etc. 4ŠCMP„LEFTCOL,D1‰Ensurethatthecolumn#isinrange2ŠBLO„RETURN(LEFTCOLbotline ‰BHI‡RETURN$‰MOVE.W„D2,TOPLINEŠStoreinconstantINITIT‰BSR‡CRTINITRe-configureCRT&‰BRA‡HOME†Putcursorinhomeposition. *-*$CA„Setbottomlineofvirtualdisplayarea*"*SameasC9forbottomline‚ESCJ*SETBOTOMEQU‡*‰BSR‡GET_CHARŒGetlinenumber!‰SUB.B…#$20,D2Adjustlinenumber+‰CMP.W…LPERSCRN,D2‰lperscrn>botline>topline ‰BHS‡RETURN‰CMP.W…TOPLINE,D2 ‰BLO‡RETURN‰MOVE.W„D2,BOTLINE ‰BRA‡INITIT *5*$CB„Setleftdisplaycolumnofvirtualscreen‚ESCK* SETLEFT‚EQU‡*‰BSR‡GET_CHARŒGetleftcolumn‰SUB.B…#$20,D2‰CMP.W…RIGHTCOL,D2 ‰BHI‡RETURN‰MOVE.W„D2,LEFTCOL ‰BRA‡INITIT‰PAGE*4*$CC„Setrightdisplaycolumnofdispalyarea‚ESCL*SETRIGHTEQU‡*‰BSR‡GET_CHA: RŒGetrightcolumn‰SUB.B…#$20,D2,‰CMP.W…CPERLINE,D2‰cperlineleftcol ‰BHS‡RETURN‰CMP.W…LEFTCOL,D2 ‰BLO‡RETURN‰MOVE.W„D2,RIGHTCOL ‰BRA‡INITIT SEEIFIN‚EQU‡*-‰LSR.W…#8,D0Checktoseeiftheuserdefined%‰TST.W…D0’thespotinthesecondbyte ‰BNE.S…RTSIT*:* The routine will calculate the current line and collumn.+* Left collumn is #00, and top line is #00.*2*InputŒA0.L=Addressofcursorindisplayscreen**Output‹A0.L=unchanged*’D0.L=00CC00LL&*™whereˆLL=Linenumber,topline=0'*¦CC=Collumnnumber,leftcollumn=0 GETSPOT‚EQU‡*‰CLR.L…D0’HSKP ‰MOVE.L„A0,D04‰SUB.L…#SCREEN,D0‰=Absolutecursoraddressonscreen ‰LSR.W…#1,D0*‰DIVU†CPERLINE,D0‰Thequotiant=linenumber RTSIT„RTS‰PAGE**$CD„erasetoendoffield*7* All contiguous unprotected characters are spaced out.** FACs are unaffected.* Cursor stays where is.* EEFIELD‚EQU‡*$‰MOVE.W„D6,D7Wordspervirtualline#‰LSR.W…#1,D7Bytespervirtualline-‰SUB.W…D4,D7Numberofbytestostartofline‰BRA.S…EEFIELD0 ‰CLR.W…D3 ‰CLR.W…D7&EEFIELD0TST.W…(A0)Isspotprotected?‰BMI‡RETURNŽYes,that'sit#‰AND.W…#$FF80,(A0)‰No,spaceitout‰OR.W†#$20,(A0)+'‰DBRA†D4,EEFIELD0‰Repeattoendofline$‰ADD.W…PB.LINE,A0ŠStartofnextline‰MOVE.W„C.LINE,D4‰CMP.L…E.SCRN,A0(‰BLE.S…EEFIELD1ŒArewearendofscreen?#‰MOVE.L„S.SCRN,A0‹Yes,rollitover.EEFIELD1DBRA†D3,EEFIELD0‰Repeatforalllines2‰MOVE.W„D7,D4Addthecharactersbeforethecursor‰DBRA†D7,EEFIELD0‰BRA‡RETURNŽAndthenreturn‰PAGE**$CE„writeabsolute* WABSOLUT: -ŠREPEAT”Waitfora'startofdata'indicator.ŠBSR„GET_CHAR‹*ŠUNTIL.BD0#START_OF_DATA .ŠMOVEƒ(A1),SAVEFACS†SaveFACScurrentlyinuse 'ŠBSR„GET_CHAR‹D0.B<--theline#char.'ŠMOVE.BD0,SAVE_CHAR‡Saveitforlater. )ŠBSR„GET_CHAR‹D0.B<--thecolumn#char.&ŠMOVEQ‚#0,D1ŽD1<--thecolumn#char.ŠMOVE.BD0,D1Ž*1ŠSUB.B‚#$20,D1ŒAdjustitso0isfirstline,etc. 5ŠCMP„CPERLINE,D1ˆEnsurethatthecolumn#isinrange-ŠBHS„RETURN(LEFTCOL#END_OF_DATATHEN.S6‰MOVE.L„SAVE_CURSOR,D0†Restorevirtualscreen'sS.LINE *°andE.LINE!‰MOVE.L„D0,D1Copycursoraddress‰SUB.L…#SCREEN,D0*‰DIVU†BPERLINE+2,D0‡Findlinecursorison*¦remainder=positioninline‰CLR‡D0’Forgetlineweareon‰SWAP†D0,‰SUB.L…D0,D1wenowknowtheabsolutes.line-‰MOVE†LEFTCOL,D0Šsoadjustitbythevaluein‰ADD‡D0,D0leftcol.‰ADD.L…D0,D1*1‰MOVE.L„D1,S.LINE‹bingowenowhavestartofline-‰ADD.L…B.LINE,D1‹addthenumberofbytes/line%‰MOVE.L„D1,E.LINE‹andsetendofline8‰MOVE.L„SAVE_CURSOR,A0†Setcursorbacktovirtualscreen‰MOVE†SAVEFACS,FACS‰BRA‡WRITCRSRŒ*ŠENDIŠST…CHAR_RESERVED‰IF.B„D2#$E0AND.B‘D2#$EBTHEN.S6‰TST.B…LASTFACSeeifthelastcharacterprocessedwas*¦aFAC.5‰IF„THEN.SIfitwasnotaFACthendestroywhat)*¦couldbeanotherFACcurrentlyonscrn.9‰MOVE.B„#$FF,1(A0)ŠFacprocessingchecksthecurrentchar%*¦todetermineifanewFACshouldbe'*¦declared.Ifwearecurrentl; ysitting**¦onaFACdefinitionitmustbedestroyed‰ENDI3‰STˆLASTFACTelltheloopwehavebeenherebefore. ‰BRAOUTCH1‰ENDI3‰TST.B…LASTFACIfthelastcharacterwasaFACthen"*¦thecursormustbemovedoffit.‰IFˆTHEN.S)‰ADD.L…#2,A0MovethecursorofftheFAC.4‰SFˆLASTFACIndicatethelastcharacterwas'taFAC.‰ENDI8‰MOVE.W„LPERSCRN,D0‰FINDTHEENDOFTHEABSOLUTEDISPLAY ‰MULU†D5,D0*‰ADD.L…#SCREEN,D0Š*5‰OR.W†FACS,D2Writethecurrentcharactertothescrn‰MOVE.W„D2,(A0)+Œ*‰IF.L†A0D0THEN.S&‰BRA‡RETURNŽExitifpastendofscreen‰ENDI,‰BRA‡WRITCRSRŒUpdatecurrentcursorposition **$CF„readabsolute**RABSOLUTEQU‡*8‰BSR‡GET_CHAR‚Getrowaddressforbeginningadr.ofread*‰MOVE.B„D0,SAVE_CHAR‚Savetherowaddress.8‰BSR‡GET_CHAR‚Getcol.addressofbeginingreadaddress. ‰MOVE.B„D0,SAVE_CR1‰Saveitalso0‰BSR‡GET_CHAR‚Getrowaddressofendingaddress.‰MOVE.B„D0,SAVE_CR2‰Saveit.0‰BSR‡GET_CHAR‚Getcol.addressofendingaddress‰MOVE.B„D0,SAVE_CR3‰Saveit.***ˆALLOCATEMEMORY--SAVETHEBUFFERADDRESS*0‰MOVE.L„#4,D0…ServicerequestcodeforPAGEALOC.7‰MOVE.L„#8,A0…Setupmemorydescriptorandget8pages. ‰SUB.L…A1,A1‰TRAP†#0&‰BRA.S…RABSO1„Branchifwegotmemory.#‰BRA‡RETURN„Justexitifwedidn't.**ˆSAVEBUFFERADDRESS*RABSO13‰STˆREL_FLAGŒTellfeedertoreleasemem.whendone.*‰MOVE.L„A0,REL_ADDR‰Feederbufferaddress.4‰MOVE.L„A0,FEEDER_ADDRESSƒBufferaddressforfeeder..‰MOVE.L„A0,A2Putaddressinuseableregister.@‰MOVE.L„#NUMBER_PAGES,REL_PAGES‚Tellfeederthenumberofpages.‰MOVE.B„#START_OF_DATA,(A2)+;‰MOVE†#1,FEEDER_COUNT…Updatethecharatercountforfeeder.*=*ˆFINDTHEBEGINNINGANDENDINGADDRESSESBASEDONTHECURSOR *ˆADDRESSES*/ˆMOVE‡SAVE_CR2,D0‰Convertendingaddressfirst.)‰SUB‡#$2020,D0‹Adjustthecursoraddress.‰BSR.S…CONVERT*'‰MOVE.L„A0,A1Putitintheproperreg.,‰MOVE†SAVE_CHAR,D0ˆNowdobeginningaddress.)‰SUB‡#$2020,D0‹Adjustthecursoraddress.‰BSR.S…CONVERT*6‰MOVE.L„A0,D1Thiswillbetheendofcurrentlineadr‰ADD.L…D5,D1*?*†A0=STARTINGADDRESS†A1=ENDINGADDRESS„A2=BUFFERADDRESS ‰REPEAT8‰IF.L†A0D1THEN.SƒIfweareattheendoftheline8‰MOVE.B„#END_OF_FIELD,(A2)+moveinthelineterminator.*‰ADDQ†#1,FEEDER_COUNT…Updatefeedercount. ‰ADD.L…D5,D1‰ENDI ‰TST.B…1(A0)5‰IF‚THEN.SEndoflinesareflaggedbyanendof,‰MOVE.B‚#END_OF_FIELD,(A2)+ƒfieldcharacter.*‰ADDQ†#1,FEEDER_COUNT…Adjustfeedercount.‰ENDI‰IF.B…1(A0)#01THEN.S!‰ADDQ.L„#2,A0Adjustthepointer. ‰BRA.S…RABSO2‰ENDI+‰MOVE.B„1(A0),D0ŒWecouldbeonatabstop.)‰AND.B…#$7F,D0Stripofthetabstopbit.*‰MOVE.B„D0,(A2)+ŒMovedatabytetobuffer.%‰ADDQ.L„#2,A0Bumptonextcharacter.3‰ADDQ†#1,FEEDER_COUNT…Bumpfeederscharactercount.RABSO2‰UNTIL.LƒA0A1D‰MOVE.B„#END_OF_DATA,(A2)Wearealldonemovingdatatothebuffer.;‰ADDQ†#1,FEEDER_COUNT…Bumpnumberofcharactersforfeeder.(‰BSR‡FEEDERŽSendthedatatothedriver./‰BRA‡RETURNŽWearealldone--thankyoukindly.*2* Convert the llcc value to a display RAM address.**ˆInputƒD0.W=llcc*ˆOutput‚A0.L=screenaddress* CONVERT‚EQU‡*%‰MOVE.L„D6,-(A7)ŒGetsomeellbowroom ‰CLR.L…D6 ‰MOVE.W„D0,D6‰AND.W…#$00FF,D0‰CMP.W…CPERLINE,D0 ‰BGT.S…CONRET‰LSR.L…#8,D6D6.L=000000ll‰CMP.W…LPERSCRN,D6 ‰BGT.S…CONRET ‰MULU.W„D5,D6 ‰LSL.W…#1,D0 ‰ADD.B…D0,D6‰ADD.L…#SCREEN,D6 ‰MOVE.L„D6,A0CONRETƒMOVE.L„(A7)+,D6‰RTS‰PAGE*8*‚$D0„Insertacharacteratthecurrentcursorposition.B*‰Startingatthecurrentcursorposition,charactersaremovedto@*‰therightuntiltheendoflineoraprotectedfieldishit.‚A>*‰spaceisputinthecurrentcursorposition.‚Thecursordoes *‰notmove.*7ICHAR:„MOVEQ‚#SPACE,D0ŠInitializeLASTCHARtoaspace. ICHAR12ŠMOVEQ‚#$7F,D1ŒD1<--thecharfromthisposition.ŠAND„(A0),D1Œ*9ŠAND„#$FF80,(A0)ˆPuttheLASTCHARoutthereinitsplac; e.ŠOR…D0,(A0)+‹andadvancetothenextposition.1ŠMOVEƒD1,D0ŽSetLASTCHARtothecharwejustgot;ŠDBRAƒD4,ICHAR1Š(fornextpass)andloopuntilendofline. ICHAR3„BRA„RETURNExit. *8*‚$D1„Deleteacharacteratthecurrentcursorposition.F*‰Startingjustpastthecurrentcursorposition,charactersaremovedB*‰totheleftuntiltheendoflineoraprotectedfieldishit.‚A@*‰spaceisputinthefinalmodifiableposition.‚Thecursordoes%*‰notmove.‚TheentrypointisDCHAR.*<DCHAR1„MOVEƒ2(A0),D0‹D0<--thecharfromthenextposition. *ŠAND„#$7F,D0ŒPutthecharinthisposition%ŠOR…D0,(A0)+‹andadvancetothenext. :DCHAR:„AND„#$FF80,(A0)ˆRemovethecharfromthisposition.2ŠDBRAƒD4,DCHAR1ŠLoopiftherearemorecharacters. 6DCHAR2„OR…#$20,(A0)ŠPutaspaceinthisfinalpositionŠBRA„RETURNandreturn.‰PAGE**‚$D2ƒENABLEKEYBOARD*KEYENAB ‰SFˆKB_LOCK ‰BRA‡RETURN   **‚$D3ƒDISABLEKEYBOARD*KEYDSABL ‰STˆKB_LOCK ‰BRA‡RETURN   ***$D4„eraseallunprotectedtoendofpage**ˆFACsarenotaffected!*ˆCursorpositionisnotaffected* EEPAGEƒEQU‡*‰BSR‡GETSPOTD0=00CC00LL‰SUB.W…TOPLINE,D0-‰SUB.W…D0,D3NumberoflinestoendofscreenEEPAGE1‚BSR‡ERASEErasethem ‰BRA‡RETURN  **$D5„Erasetoendofline* EELINEƒEQU‡*‰CLR.W…D3’Onlyoneline ‰BRA‡EEPAGE1  *3*‚$D6„Insertalineatthecurrentcursorposition.@*‰Startingatthebottomofthescreenandworkingup,copyeach=*‰linetothelinebelow.‚Thelinethecursorisonisfilled=*‰withblanksandthecursorispositionedattheleftofthe3*‰line.‚(Inallthis,'line'means'virtualline.')*INS_LINE6ŠMOVE.LE.SCRN,A0ŠA0<--addrjustpastendofscreen. AŠWHILE.LA0E.LINEDO.S‚WhileA0isnotonthecurrentline, 6ŠMOVE.LA0,A1ŽA1<--addrjustpastendoflineabove./ŠSUB.L‚D5,A1Ž*‡(D5isbytesperabsoluteline.)0ŠMOVE.LA0,-(SP)‹Savetheaddressforthisline. 6ŠMOVEƒC.LINE,D0ŠD0<--#ofcharsinvirtualline-1.@INS_LIN1‚MOVEƒ-(A1),-(A0)ˆMoveallwords(attributeandchar)in.ŠDBRAƒD0,INS_LIN1ˆthislinetothelinebelow. 3ŠMOVE.L(SP)+,A0‹Restoretheaddressforthisline.-ŠSUB.L‚D5,A0ŽA0<--addressfornextlineup. ŠENDW (*§AtthispointA0istheaddrjustpast&*§theendofthecurrentvirtualline.6ŠMOVEƒC.LINE,D0ŠD0<--#ofcharsinvirtualline-1.?INS_LIN2‚AND.B‚#$80,-(A0)‰Fillthecurrentlinewithspacesand%ŠOR.Bƒ#$20,(A0)Šinnocuousattributes.ŠMOVE.B#$44,-(A0)‰*ŠDBRAƒD0,INS_LIN2ˆ*%*§AtthispointA0istheaddrofthe(*§beginningofthecurrentvirtualline.,ŠBRA„WRITCRSR‹Gosetthenewcursoraddress.   **$D7‚DELETELINE*DEL_LINE;‰MOVE.L„S.LINE,A0BeginningaddressofcurrentvirtuallineDELINE;‰MOVE.L„A0,A1…Calculatetheaddressofthebeginningofthe‰ADD.L…D5,A1…nextline.4‰MOVE†C.LINE,D0Numberofbytesperlinetobemoved?‰CMP.L…E.SCRN,A1Seeifmovefromaddressispassedendofscrn-‰BHS.S…DELINE2ƒBranchifpassedendofscreen2‰MOVE.L„A0,-(A7)‚SavedestinationaddressonstackDELINE1*‰MOVE.W„(A1)+,(A0)+Movelineuponscreen‰DBRA†D0,DELINE1‚*,‰MOVE.L„(A7)+,A0‚Restoredestinationaddress'‰ADD.L…D5,A0‡Pointtonextvirtualline,‰BRA.S…DELINE„GomovenextlineuponscreenDELINE22‰MOVE.B„#$44,(A0)+ƒBlankthebottomlineofscreen.‰AND.B…#$80,(A0)„Savetabstopifthereisone+‰OR.B†#$20,(A0)+ƒSetspaceinthislocation‰DBRA†D0,DELINE2ƒ*9‰MOVE.L„S.LINE,A0„Setcursortobeginningofcurrentline‰BRA‡WRITCRSR…*   **$D8„clearscreen,cursorhome*B* All unprotected positions in display area are filled with nulls.* FAC's are not affected.* * Cursor moves to home position.** CLEAR_SCREENA‰MOVEM.LƒD0-D7/A0-A3,-(A7)ƒSetupthealternateentryforcommand6‰MOVE†L.SCRN,D3‹Setuptheregbecauseitisn'tsetip*%%%%%%%%%‚BWN‚10/24/84*6*ƒSetuptheotherregistersweneedforthisroutine.*‰LEA‡S.L< INE,A2‰MOVE.L„B.LINE,D6!*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLEAR„EQU‡*‰MOVE.L„S.SCRN,A0‹Startathome‰MOVE.W„C.LINE,D4‹Afullline"‰BSR.S…ERASEEraseallunprotected‰BRA‡HOMEPutcursorathome *%* Erase D4.W characters in D3.w lines* ERASE„EQU‡*‰IF‚PAGEFLAG#TRUETHEN.S0‰TST‡(A0)+Usedonlywhenalternateentrycalled ‰BMI.S…ERASE1‰ENDI$‰AND.W…#$0080,(A0)‰ClearcurrentFAC ‰OR.W†#$4400,(A0)+ˆWriteaspace/ERASE1ƒDBRA†D4,ERASEŒRepeatforD4.wcharacters)‰MOVE.W„C.LINE,D4‹Resetcharactercounter$‰ADD.W…PB.LINE,A0ŠStartofnextline$‰DBRA†D3,ERASEŒRepeatforD3.wlines‰RTS‰PAGE**$DA„Forwardtab* * Same as HT* ** DB = BT, back tab*@* Position cursor at first tab in first unprotected to the left.**  SEEKBTƒEQU‡*‰MOVE.L„A0,A3Loopterminator‰REPEAT‰IF.L†A0S.LINETHEN.S+‰MOVE.L„E.LINE,A0‹Wraponcurrentlineonly‰ENDI1‰MOVE.W„-(A0),D0ŒCharacterpreceedingcurrentone‰TST.B…D0’Isthisatabstop*‰BMI.S…SEEKBT2BranchifwehitatabstopSEEKBT1;‰UNTIL.LƒA0A3ŠScanlineuntilwegetwherewestartedSEEKBT2#‰BRA‡WRITCRSRŒUpdatecursoraddress‰PAGE** DC = set tab* SETTABƒEQU‡*/‰CLR.L…COL_CNTƒInitializecurrentcolumnnumber‰BRA.S…SETTAB2SETTAB1:‰ADD.L…#2,COL_CNTŠUpdatethecolumncountforthenextguy‰MOVE.L„COL_CNT,D0@‰IF.L‚D0BPERLINETHEN.SMakesurewedon'tgooutofrange<‰WHILED2#LFCHARDO.S„Ifoutofrangediscardincoming/‰BSRGET_CHAR’untilterminatedwithalinefeed‰ENDW‰BRA‡RETURNŽExit‰ENDISETTAB2.‰BSR‡GET_CHAR‚Getnextcharacteroftabstring6‰MOVE†LPERSCRN,D3‰Setloopcontrolforabsolutescreen‰SUBQ†#1,D3DBRAadjustment9‰CMP.B…#LFCHAR,D2ŠEndofstringisindicatedbylinefeed‰BNE.S…SETTAB2A‹**C*‡LINEFEEDCHARACTERDETECTED,‚IFITFOLLOWEDSETTABS--RESETALL*‡CURRENTTABS*SETTAB42‰TST.L…COL_CNTIfcolumncountzerothenlinefeed*°followedsetcommand‰IFTHEN.S+‰LEA‡SCREEN,A0‹Pointtobeginningofscreen+‰MOVE†LPERSCRN,D5‰Get#oflinesperscreen8‰MULU†CPERLINE,D5‰*charactersperline=#ofcharacter*©positionsonscreenCLRTAB‰AND.W…#$FF7F,(A0)+ˆResettab(‰DBRA†D5,CLRTAB‹Loopuntilendofscreen‰ENDI ‰BRA‡RETURNSETTAB2A4‰MOVE.L„COL_CNT,A0ŠPointtocurrentpositioninline‰ADD.L…#SCREEN,A0Š*-‰CMP.B…#SPACE,D2‹Isthisafillercharacter?5‰BEQ.S…SETTAB1Getnextcharacterifcurrentisspace'‰CMP.B…#CLEARTAB,D2ˆCleartabrequest?+‰BEQ.S…RESETTABŒBranchifcleartabrequest**„SETTABREQUEST*SETTAB37‰BSET.B„#7,1(A0)ŒSettabbitinhighnibbleofthedis-4‰ADD.L…D5,A0playedchar.foreverycolumnonscreen‰DBRA†D3,SETTAB3Š*‰BRA.S…SETTAB1RESETTAB1‰BCLR.B„#7,1(A0)ŒTurntabbitoffineverycolumn‰ADD.L…D5,A0*‰DBRA†D3,RESETTAB‰* ‰BRA‡SETTAB1‰PAGE*F* The characters $E0-$EF will set or reset the field attribute bits in'* the XREFed, word sized register FACS.* FACS is defined as follows:**ˆD15=Setforprotect*ˆD14=Setfordisplay*ˆD13=Setforblink*ˆD12=Setforunderline*ˆD11=Setforinversevideo*ˆD10=color/intensitybit1*ˆD09=color/intensitybit2*ˆD08=color/intensitybit3 *„D07-D00=0* ** E0 = set blink* SBLINKƒEQU‡*B‰IF.B1(A0)#01THEN.S…AllowanotherFACtobedefinedonly‚f&*¦ifwearecurrentlysittingonaFAC *¦definition.!‰BSET.B„#5,(A1)Settheblinkbit‰ELSE.S4‰MOVE.B„#$64,(A1)‹NotonacurrentFACdefinitionso*¦resettheFACS.‰ENDI#‰MOVE.B„FACS,(A0)‹PutFAConscreen9‰MOVE.B„#01,1(A0)‹SimulatecharacterpositionusedbyFAC ‰BRA‡RETURN ** E1 = reset blink* RBLINKƒEQU‡*#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyFACC‰IF.B‚1(A0)#01THEN.SƒAllowanotherFACtobedefinedonlyif#*¦wearecurrentlysittingonaFAC *¦definition.#‰BCLR.B„#5,(A1)Resettheblinkbit‰ELSE.S4‰MOVE.B„#44,(A1)ŒResetanyotherFACSforthisline.< ‰ENDI ‰BRA‡RETURN ** E2 = set video invert* SINVERT‚EQU‡*C‰IF.B‚1(A0)#01THEN.SƒAllowanotherFACtobedefinedonlyif#*¦wearecurrentlysittingonaFAC *¦definition.#‰BSET.B„#3,(A1)Settheinversebit‰ELSE.S7‰MOVE.B„#$4C,(A1)‹Setinvertonlybit.(plusdislayand *¦intensity.‰ENDI#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyFAC ‰BRA‡RETURN ** E3 = reset video invert* RINVERT‚EQU‡*#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyFACC‰IF.B‚1(A0)#01THEN.SƒAllowanotherFACtobedefinedonlyif#*¦wearecurrentlysittingonaFAC *¦definition.%‰BCLR.B„#3,(A1)Resettheinversebit‰ELSE.S#‰MOVE.B„#$44,(A1)‹Reseteverything.‰ENDI ‰BRA‡RETURN ** E4 = Set half bright*UPBRIGHTEQU‡*,‰MOVE.B„(A1),D2GettheMSBpartoftheFACs'‰AND.B…#$F8,D2Onlythebrightnessbits ‰OR.B†#$05,D2Settohalfbright‰MOVE.B„D2,(A1)* ‰BRA‡RETURN ** E5 = Reset half bright*DNBRIGHTEQU‡*,‰MOVE.B„(A1),D2GettheMSBpartoftheFACs'‰AND.B…#$F8,D2Turnoffbrightnessbits‰OR.B†#$02,D2Resethalfbright‰MOVE.B„D2,(A1)* ‰BRA‡RETURN ** E6 = set underline* SULINEƒEQU‡*C‰IF.B‚1(A0)#01THEN.SƒAllowanotherFACtobedefinedonlyif#*¦wearecurrentlysittingonaFAC *¦definition.%‰BSET.B„#4,(A1)Settheunderlinebit‰ELSE.S)‰MOVE.B„#$54,(A1)‹SetunderlineFAConly.‰ENDI#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyFAC ‰BRA‡RET.1 ** E7 = reset underline* RULINEƒEQU‡*#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyFACC‰IF.B‚1(A0)#01THEN.SƒAllowanotherFACtobedefinedonlyif#*¦wearecurrentlysittingonaFAC *¦definition.'‰BCLR.B„#4,(A1)Resettheunderlinebit‰ELSE.S.‰MOVE.B„#44,(A1)ŒResetallFACSforthisline.‰ENDI ‰BRA‡RET.1 ** E8 = set non display* NONDISP‚EQU‡*C‰IF.B‚1(A0)#01THEN.SƒAllowanotherFACtobedefinedonlyif#*¦wearecurrentlysittingonaFAC *¦definition.'‰BCLR.B„#6,(A1)Setthenon-displaybit‰ELSE.S(‰MOVE.B„#4,(A1)Turnoffthedispaybit.‰ENDI#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyFAC ‰BRA‡RETURN ** E9 = reset non-display* SETDISP‚EQU‡*#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyFACC‰IF.B‚1(A0)#01THEN.SƒAllowanotherFACtobedefinedonlyif#*¦wearecurrentlysittingonaFAC *¦definition.2‰BSET.B„#6,(A1)SetdisplayalongwithotherFACS.‰ELSE.S:‰MOVE.B„#$44,(A1)‹Setdisplaybitonly,turnoffallother*¦FACS.‰ENDI ‰BRA.S…RET.1 ** EA = set protect* PROTECT‚EQU‡*C‰IF.B‚1(A0)#01THEN.SƒAllowanotherFACtobedefinedonlyif#*¦wearecurrentlysittingonaFAC *¦definition.6‰BSET.B„#7,(A1)Setprotectbitanddon'tchangeother*¦FACsallreadythere.‰ELSE.S'‰MOVE.B„#$C4,(A1)‹SetprotectFAConly.‰ENDI#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyFAC ‰BRA.S…RET.1 ** EB = reset protect* ALLOW„EQU‡*#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyFACC‰IF.B‚1(A0)#01THEN.SƒAllowanotherFACtobedefinedonlyif#*¦wearecurrentlysittingonaFAC *¦definition.+‰BCLR.B„#7,(A1)ResetonlytheprotectFAC.‰ELSE.S!‰MOVE.B„#$44,(A1)‹ResetallFACs.‰ENDIRET.1„BRA‡RETURNŠPAGE* * F1 = reset*K* The display area is filled with spaces, all FAC's are reset, tabs are setL* every INIT_TAB spaces, the virtual screen is restored to its default size,* and the cursor is HOMEd.* RESET_SCREEN>‰MOVEM.LD0-D7/A0-A3,-(A7)Setupstacksowecanexitclean„T5‰LEA‡S.LINE,A2‡Fixuptheregistersbecausewedidn't*¢comethroughthenormalpath‰MOVE.L„= B.LINE,D6‡*$‰BRA.S…RESET25‰Clear25linescreen.RESET240‰MOVE†#24,NUMBER_LINESSetuptoclear24lines.RESET253ŠBSR„SCRNINIT‹Resetalltheparameterstodefaults. *‚Fillthescreenwithblanks.4ŠLEA„SCREEN,A0ŠA0<--startaddrofabsolutescreen.6ŠMOVEƒ#$4400,D2ŠD2<--defaultattributesandaendof#*¦linecharforfillingthescreen.:ŠMOVEƒNUMBER_LINES,D5„D5<--#ofcharactersonscreen-1<ŠMULUƒCPERLINE,D5ˆ*‚=linesperscreen*charsperline-1. ŠSUBQƒ#1,D5Ž* DO.SŠWhiletherearemoretabstoplace, 5ŠBSETW‚#7,(A0)ŒSetatabinthispositionandadvance%ŠADD.L‚#2*INIT_TAB,A0…INIT_TABchars. 0ŠSUBQƒ#1,D5ŽKeepgoinguntilalltabsareplacedŠENDW–onthisline. /ŠMOVEƒBPERLINE,A0ˆA0.L<--addressofnextline7ŠADD.L‚(SP)+,A0‹*„=addroflastline+bytesperline. 0ŠSUBQƒ#1,D2ŽKeepgoinguntilalllinesaredone. ŠUNTIL‚*ŠSF…EDIT_FLAGŠCleareditmodeŠSF…PAGEFLAG‹pagemodeŠSF…PROMODEŒandprotectmode.3ŠMOVE.LƒB.LINE,D6ˆHomeneedsbytespervirtualline?ŠMOVE…#25,NUMBER_LINESSetupthescreento25linesincasewe*£dida24linescreenclear.ŠBRA‡HOMEŒHomethecursor.‰PAGE* * DISPLAYL*---------------------------------------------------------------------------L* 1. Write the requested character in the display RAM at the current cursor.I* 2. Seek a non-protected spot to the right, with line and page rollover.6*„ifnonefound,soundbell,andstayatcurrentspot.,* 3. Update the cursor register of the CRTC.** Input parameters:*------------------4* A0.L = current cursor posiotion in the display RAM8* D2.L = $000000XX, where XX is the requested character.0* D3.W = Maximum number of characters on screen.F* FACS = An XREFed, word sized register containing the FACs in effect.* DISPLAY‚EQU‡*‰MOVE.LA0,A3’Initreg.‰WHILE.LA3S.LINEDO.S2‰MOVE.B-1(A3),D0ŽMoveendoflinetocurrentchar‰AND.B#$7F,D0‘couldbeatab7‰BNE.SDISPLAY1Branchifacharacteroccupiesposition0‰OR.B‚#$20,-1(A3)Spacefilltomoveendofline)‰SUBQ.L#2,A3’Backuptobeginningofline‰ENDWDISPLAY1‰IF.B‚1(A0)#01THEN.S5‰MOVE.B„#$44,FACS‹ResettheFACdefinedforthisline#*¦becauseitisbeingwrittenover.‰ENDI :‰MOVE.B„FACS,(A0)+ŠMovecurrentFACStocurrentScreenloc%‰AND.B…#$80,(A0)‹Keeptabinformation,‰OR.B†D2,(A0)+ŒWritecharactertothescreen  SCROLLƒEQU‡*‰IF.L†A0E.SCRN‚THEN.S!‰IF.B†EDIT_FLAG#TRUETHEN.S(‰BRAHOMEŒENDOFSCREENANDINEDITMODE‰ENDI*‰BRA.SƒSCROLL1‚Endofscreennoteditmode‰ENDI SEEKR2‰IF.L†A0E.LINETHEN.S#‰ADD.L…D5,(A2)Updatestartofline‰ADD.L…D5,4(A2)Œandendofline‰MOVE.L„S.LINE,A0‰ENDI‰BRA.S…WRITCRSR ** Scroll*)* Input parameters : A0.L > end of screen* SCROLL1‚EQU‡*2‰MOVE.L„E.SCRN,E.LINE‡Modifystartandendofline‰MOVE.L„E.SCRN,S.LINE‰SUB.L…D6,(A2) %‰MOVE.L„S.SCRN,A0‹Startoffirstline‰MOVE.L„S.SCRN,A3!‰ADD.L…D5,A3Startofsecondline&‰BRA.S…SCROLLRDonotscrolllastline ,SCROLL2‚MOVE.W„C.LINE,D4‹Charactersperline6SCROLLITMOVE.W„(A3)+,(A0)+‰Moveline#n+1toline#n.!‰DBRA†D4,SCROLLIT‰Scrolloneline$‰ADD.W…PB.LINE,A0ŠStartofnextline‰ADD.W…PB.LINE,A3SCROLLR%‰DBRA†D3,SCROLL2ŠRepeatforalllines $‰MOVE.L„S.LINE,A0‹Startoflastline7‰MOVE.W„C.LINE,D4‹Resetlastlinetonofacsandspaces‰MOVE.W„(A1),D2 ‰OR.B†#$20,D2 2SCROLL3‚AND.W…#$0080,(A0)‰Saveonlyapossibletab,‰OR.W†D2,(A0)+ŒInitFACsandspacecharacter‰DBRA†D4,SCROLL3ŠThewholel= ine $‰MOVE.L„S.LINE,A0‹Startoflastline WRITCRSREQU‡**9* Convert display RAM address to absolute cursor address,* and write into CRTC.** A0.L = Diaplay cursor address*/‰MOVE.L„A0,D1Calculatecursorabsoluteaddress‰SUB.L…#SCREEN,D1+‰LSR.L…#1,D1Totakecareofattributearea WRITEABSEQU‡**/* Write the absolute cursor address in the CRTC* * D1.W = absolute cursor address*!‰MOVE.B„#$0F,CRTCADDˆPointtoR152‰MOVE.B„D1,CRTCREGŠStoreLSBofnewcursoraddress ‰LSR.W…#8,D1Positionupperbyte!‰MOVE.B„#$0E,CRTCADDˆPointtoR143‰MOVE.B„D1,CRTCREGŠSroreMSBofnewcursorregister 6RETURNƒMOVEM.Lƒ(A7)+,D0-D7/A0-A3ƒRestoreuser'svalues‰RTS‰PAGEREADCRSREQU‡***‚Readthecursorposition*6*‚Thisroutineisforinternaluse,andisnotXDEFed.)*‚ForanexternalcontrolroutineseeC6.**‚Inputparametersƒ:none*>*‚Registersaffected:D1.W=Absoluteaddressofcursorspot.&*—A0.L=ScreenRAMaddressofcursor.*‰CLR.L…D1’HSKP!‰MOVE.B„#$0E,CRTCADDˆPointtoR14.‰MOVE.B„CRTCREG,D1ŠGetcurrentcursorposition‰ROL.W…#8,D1PutitinMSB!‰MOVE.B„#$0F,CRTCADDˆPointtoR154‰MOVE.B„CRTCREG,D1ŠGetlowerbyteofcursorposition-‰LSL.W…#1,D1AdjustforscreenRAMoperations ‰MOVE.L„D1,A0‰ADD.L…#SCREEN,A0‰RTS***GET_CHAR3‰STˆCHAR_RESERVED‡Reservenextcharacterforcaller>‰MOVE.L„(A7)+,CHAR_OWNER„Savecallersreturnaddressforlater'‰BRA‡RETURNŽWaitforthenextcharacter‰END9PAGEMODE‚IDNTƒ1,0„VME/10pagemodeemulationforTERMDRV.O*v*****************************************************************************O*******************************************************************************O**********************************************************************************É***=***†FILENAME:‚PAGEMODE--PAGEMODEEMULATIONFORTERMDRV******É***7***†ENVIRONMENT:‚LinkedintoTERMDRVfortheVME/10“******É***E***†FUNCTION:‚Whenthekeyboard/screenisputintopagemode,any…***?***‰charactersreceivedfromthekeyboardaresentherefor‰******‰specialinterpretation.©******É******†NOTES:½******É***,***†EXTERNALDATASTRUCTURESREFERENCED:Ÿ******É***)***†EXTERNALENTRYPOINTSREFERENCED:¢******‰OUTCHSº******É***"***†SERVICESCALLEDVIATRAPS:©******É******É***O*******************************************************************************O*******************************************************************************O*^***************************************************************************** *,*‚Revisionhistory(addnewchangestotop).*…Date†Author‰ChangesG*…--------‚-------------‚----------------------------------------------&*†5/23/83‚RussRustad„Initialwriting.*ŠPAGE* *‚XDEF's.*:ŠXDEFƒPAGEMODE‹Entrypt.forchar'sreceivedinpagemode.  *0*‚XREF's(indicatewheretheXDEFis,ifknown).*8ŠXREFƒOUTCHSRoutineinOUTCHStooutputcharonscreen./*ž(AllofthefollowingareXDEF'edinCRTINIT)ŠPAGEO*********************************************************************************‰INCLUDEFILESANDEQUATES*O******************************************************************************* **‚Includefiles:*  *.*‚Equatesforthevaluesofthefunctionkeys.*9FN_LOW„EQU„$A0Thesedefinetherangeofvaluesgenerated%FN_HIGHƒEQU„$BFbythefunctionkeys.ŠPAGEO*v*****************************************************************************®@·3O**********************************************************************************É***+***PAGEMODE--PAGEMODEINPUTHANDLER–******É***E***†FUNCTION:‚Whenanexternalroutinereceivesacharacterwhile…***:***‰thescreenisinpagemode,he> callsthisroutine.Ž******É******†NOTES:½******É***E***†REGISTERUSAGE:‚(A)rgument‚(D)estroyed‚(P)reserved‚(R)eturned‚***)***Œ0ƒ1ƒ2ƒ3ƒ4ƒ5ƒ6ƒ7‡SRhi„SRlo(CCR)…******‡D:ƒAR‚.ƒ.ƒ.ƒ.ƒ.ƒ.ƒ.‡.ˆR******‡A:ƒ.ƒ.ƒ.ƒ.ƒ.ƒ.ƒ.ƒP ******É******†ENTRYCONDITIONS:²***8***‰D0.W=$00ccwhereccisthereceivedcharacter.******É***-***†EXITCONDITIONSDIFFERENTFROMENTRY:ž***6***‰CCR:=keystrokedidnotgenerateachar.’***@***Ž,=generatedcharisinD0.W(bits8-15are0).ƒ***(***‰D0isnotpreservedinanycase. ******É***O*^*****************************************************************************O******************************************************************************* ŠDS…0ŠOPT„BRS ŠSECTION0  PAGEMODE: 1ŠMOVEM.LD1,-(SP)ŠSaveregisterswe'llblowaway. DŠIF.BD0#FN_LOWAND.BD0#FN_HIGHTHENƒIfthekeypressed*§wasafunctionkey, 9ŠMOVEQ‚#1,D1ŒSetCCRto,tosay'wegotachar.' %ŠELSE–Else(it'snotafunctionkey), 8ŠBSR.L‚OUTCHSCallOUTCHStooutputthecharandsetCCR3ŠMOVEQ‚#0,D1Žtotosay'ignorethekeystroke.' ŠENDI -ŠMOVEM.L(SP)+,D1ŠRestoreregistersandexit.ŠRTS—*   ŠENDéé8POUTCHSƒIDNT†1,00†OutputacharactertothedisplayRAM. <*************************************************************º**Routinename:POUTCHS˜*<*----------------------------------------------------------*-*Currentrevision.....................1.10*1*Datewritten.........................12-18-82Œ*2*Writtenby...........................S.Pri-Tal‹*/*Datechanged.........................3-1-83Ž*2*Changedby...........................R.RUSTAD‹**º**Descriptionofchange:£**º*0*Datechanged.........................8-17-84*1*Changedby...........................B.NASONŒ**º**Descriptionofchange:£**ƒChangedallXREF.StoXREF**º*0*Datechanged.........................8-30-84*3*ƒchangedtomask'tabstop'bit.....D.Vanderlinˆ**º*0*Datechanged.........................1-30-85*/*Changedby...........................M.DUHŽ**º**Descriptionofchange:£*7*ƒSetRING_BELLflagwhen$07istobeoutput(BELL).„**º*<************************************************************9*Function:OutputthecharacterinD0.Btothedisplay„*/*‹RAMifcharacterisprintable,elseperform„**‹therequiredfunction.™*<*----------------------------------------------------------*/*Inputparameters:‚D0.Bcharactertooutput.*<*----------------------------------------------------------**Registersaffected:none¡*<*----------------------------------------------------------* *Externalroutinesused:none*<************************************************************‰PAGE ‰XDEF†POUTCHS (‰XREF†CRTINITƒInitthescreenparameters‰XREF†SCRNINIT /‰XREF„FACS†Fieldattribute,wordsizedregister3‰XREF„PAGEFLAG‚Wordsizedflag.If=$FFFF,pagemode5‰XREF„PROMODEƒWordsizedflag.If=$FFFF,protectmode 5‰XREF„CPERLINE‚Numberofcharactersperabsoluteline0‰XREF„BPERLINE‚Numberofbytesperabsoluteline2‰XREF„LPERSCRN‚Numberoflinesperabsolutescreen 2‰XREF„C.LINE„Numberofcharacterspervirtualline¸¿7È<ÐEØ4à,è,ð/ø-FHNS N(S0T8<@JHLPIX;`BhTpCxZ€EˆEB˜; K¨L> -‰XREF„B.LINE„Numberofbytespervirtualline *‰XREF„S.LINE„Startaddressofcurrentline(‰XREF„E.LINE„Endaddressofcurrentline *‰XREF„PB.LINEƒUnusedpartofabsoluteline 2‰XREF„L.SCRN„Numberoflinesinthevirtualscreen <‰XREF„S.SCRN„Addressofhomecharacterinthevirtualscreen<‰XREF„E.SCRN„Addressoflastcharacterinthevirtualscreen (‰XREF„TOPLINEƒToplineofvirtualscreen+‰XREF„BOTLINEƒBottomlineofvirtualscreen,‰XREF„LEFTCOLƒLeftcollumnofvirtualscreen.‰XREF„RIGHTCOL‚Rightcollumnofvirtualscreen 9‰XREF†FEEDER„Addressofsubroutinetogivedatatodriver=‰XREF†FEEDER_ADDRESS†AddressofdatabuffertogivetoFEEDER,‰XREF†FEEDER_COUNTˆ#ofbytesindatabuffer ‰XREF†DUP_CHAR (‰XREF†KB_LOCKKeyboardlock/unlockflag 2‰XREF†RABSOLUTŒOutchsreadabsoluteentryaddress. 0‰XREF†RING_BELL‹Flagsetwhen$07isdetectedin%*§ordertoringthebellinKEYBRD.AG‰PAGE .SCREENƒEQU‡$F17000BaseaddressofdisplayRAM0CRTCADD‚EQU‡$F1A021AddressregisteroftheCRTC-CRTCREG‚EQU‡$F1A023RegisterfileoftheCRTC)EPCIBASEEQU‡$F1A031BaseaddressofEPCIKBDADDR‚EQU‡$0C$LFCHARƒEQU‡$0A‘ASCIIlinefeedchar.0START_OF_DATAEQU‚$DDŽ'Startofdata'indicator./END_OF_DATAEQU„$DE‘Endofwrite/readindicator$FALSE„EQU‡0“Indicateconditionfalse#TRUE…EQU‡-1’Indicatetruecondition"CLEARTABEQU‡$18‘Cleartabcommand#SPACE„EQU‡$20ŽASCIIspacecharacter#ESC_CHAR‚EQU„$1BASCIIescapechar.+END_OF_FIELDEQU$F9Endoffieldindicator6INIT_TAB‚EQU„10‘Initialtabspacing.‚Theresetcommand#*§($F1)willputtabsonthescreen*§withthisspacing.* *ˆFACEQUATES*3PROTECT_FACEQU„$C5‡Protectfacwithintensitycode3DISPLAY_FACEQU„$44‡Displayfacwithintensitycode/BLINK_FACƒEQU„$A5‡Blinkfacwithintensitycode7UNDERLINE_FACEQU‚$55‡Underlinefacwithintensitycode9INVERSE_FACEQU„$4D‡Inversevideofacwithintensitycode!NODIS_FACƒEQU„$05‡Setnon-display** Register use:*’D0.L=generaluse+*’D1.W=absoluteaddressofinitialcursor/*’D2.W=chractertodecodeandwordtodisplay)*’D3.W=linespervirtualscreencounter+*’D4.W=characerspervirtuallinecounter *’D5.L=bytesperabsoluteline*’D6.L=bytespervirtualline*’D7.L=generaluse-*’A0.L=addressofcursorinthedisplayRAM*’A1.L=AddressofFACS*’A2.L=AddressofS.LINE*’A3.L-Generaluse*  ‰PAGE ‰SECTIONƒ11  **ˆDEFINESTORAGE*=ESC_FLAG‚DC.BƒFALSEŽThisflagistrueifsomeonehasreserved(*§acharandthefirstcharreceivedwas&*§anESC.‚Inthatcasewewaitforthe*§nextcharandsetitsbit7.:CHAR_RESERVEDDC.BFALSE…Nextcharacterreservedindicator(SAVE_CHAR…DS.B1‰Saveareaforcharacter-SAVE_CURSORƒDS.L1‰CurrentcursorramaddressBCHAR_OWNER„DS.L1‰Addressofroutinethatownsnextincomingchar.5XTCHBUF‚DS.W†162‡ScratchbufferforfeedersubroutineEDIT_FLAGDC.B…FALSE=COL_CNT‚DS.L†1‰Currentcolumnnumber,usedinsettabroutine?PRO_FIELDDC.B…FALSE…Thisfieldusedtodeterminewheretostop(* whenaprotectedfieldisencountered.‰DS.W†00SAVEFACS‚DC.W…0‰FACSsavedduringwriteabsolute=LASTFACƒDC.B…FALSE…SetlastcharacterprocessedtonotaFAC.8NUMBER_LINESDC.Wƒ25‡Numberoflinestoclearonscreen.‰PAGE POUTCHS‚DS.W†0 HAVE_CHAR‰MOVE.B„D0,D2D2.B=Character ** Now find out what to do*:‰TST.B…CHAR_RESERVED‡Byteissetifaroutineexpectsmore*ªthanasinglecharacter‰IFTHEN.S 8ŠTST.B‚ESC_FLAG‹IfthelastcharwereceivedwasanESC,ŠIF…THEN.Sˆ* 2ŠSF…ESC_FLAG‹Clearthe'lastcharwasanESC'flag5ŠBSETƒ#7,D0Žandsetbit7inD0andD2(bothofwhich-ŠBSETƒ#7,D2ŽholdthecharfollowingtheESC). (ŠELSE.S”Else(lastcharwasnotanESC), 6ŠIF.BD0#ESC_CHARTHEN.SIfthischarisanESC,0ŠST…ESC_FLAG‹setthe'lastcharwasanESC'flagŠBRA„RETURNandexit.ŠENDI–* ŠENDI /‰SFCHAR_RESERVEDŽResetcharacterreservedflag? :‰MOVE.LCHAR_OWNER,A3ŠGettheaddressoftheroutinewhich*¨processthischaracter'‰JMP(A3)–Goprocessincomingcharacter ‰ENDI *(*ˆFindentryintableforthischaracter*OUTCH1(‰MOVE†D2,D0…Resetupperpartofregister5‰ADD‡D0,D0…Multiplybytwobecausetableiswordwide+‰MOVE†JUMPTABL(PC,D0),D0Getoffsetaddress2‰JMP‡JUMPTABL(PC,D0)„Goprocessincomingcharacter‰PAGEJUMPTABL,ŠDC.WƒRETURN-JUMPTABL„$00--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$01--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$02--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$03--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$04--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$05--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$06--Illegal--exit ŠDC.WƒBELL-JUMPTABL†$07--Bell.#ŠDC.WƒBS-JUMPTABLˆ$08--Backspace.(ŠDC.WƒHT-JUMPTABLˆ$09--Horizontaltab.%ŠDC.WƒDOWN-JUMPTABL†$0A--Linefeed.&ŠDC.WƒUP-JUMPTABLˆ$0B--Verticaltab.&ŠDC.WƒRIGHT-JUMPTABL…$0C--Formfeed.)ŠDC.WƒCR-JUMPTABLˆ$0D--Carriagereturn.,ŠDC.WƒRETURN-JUMPTABL„$0E--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$0F--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$10--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$11--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$12--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$13--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$14--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$15--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$16--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$17--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$18--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$19--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$1A--Illegal--exit!ŠDC.WƒESC-JUMPTABL‡$1B--Escape.,ŠDC.WƒRETURN-JUMPTABL„$1C--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$1D--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$1E--Illegal--exit,ŠDC.WƒRETURN-JUMPTABL„$1F--Illegal--exit,ŠDC.WƒDISPLAY-JUMPTABLƒ$20--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$21--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$22--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$23--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$24--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$25--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$26--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$27--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$28--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$29--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$2F--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$30--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$31--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$32--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$33--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$34--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$35--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$36--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$37--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$38--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$39--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$3F--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$40--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$41--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$42--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$43--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$44--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$45--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$46--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$47--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$48--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$49--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$4F--Displayasis.? ,ŠDC.WƒDISPLAY-JUMPTABLƒ$50--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$51--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$52--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$53--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$54--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$55--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$56--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$57--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$58--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$59--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$5F--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$60--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$61--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$62--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$63--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$64--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$65--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$66--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$67--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$68--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$69--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$6F--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$70--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$71--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$72--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$73--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$74--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$75--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$76--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$77--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$78--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$79--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7A--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7B--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7C--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7D--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7E--Displayasis.,ŠDC.WƒDISPLAY-JUMPTABLƒ$7F--Displayasis.'ŠDC.WƒRETURN-JUMPTABL„$80--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$81--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$82--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$83--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$84--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$85--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$86--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$87--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$88--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$89--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$8A--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$8B--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$8C--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$8D--Ignoreit.4ŠDC.WƒSTART_EDITMODE-JUMPTABLƒ$8E--Starteditmode1ŠDC.WƒSTOP_EDITMODE-JUMPTABL„$8F--Endeditmode'ŠDC.WƒRETURN-JUMPTABL„$90--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$91--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$92--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$93--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$94--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$95--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$96--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$97--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$98--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$99--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9A--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9B--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9C--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9D--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9E--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$9F--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A0--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A1--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A2--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A3--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A4--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A5--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A6--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A7--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A8--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$A9--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AA--Ignoreit.@ 'ŠDC.WƒRETURN-JUMPTABL„$AB--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AC--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AD--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AE--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$AF--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B0--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B1--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B2--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B3--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B4--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B5--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B6--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B7--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B8--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$B9--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BA--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BB--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BC--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BD--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BE--Ignoreit.'ŠDC.WƒRETURN-JUMPTABL„$BF--Ignoreit.%ŠDC.WƒHOME-JUMPTABL†$C0=Cursorhome!ŠDC.WƒUP-JUMPTABLˆ$C1=Cursorup%ŠDC.WƒDOWN-JUMPTABL†$C2=Cursordown&ŠDC.WƒSEEKL-JUMPTABL…$C3=Cursorleft'ŠDC.WƒRIGHT-JUMPTABL…$C4=Cursorright$ŠDC.WƒC5-JUMPTABLˆ$C5=Writecursor#ŠDC.WƒC6-JUMPTABLˆ$C6=Readcursor(ŠDC.WƒSPAGE-JUMPTABL…$C7=Setpagemode*ŠDC.WƒRPAGE-JUMPTABL…$C8=Setscrollmode0ŠDC.WƒSETTOP-JUMPTABL„$C9=Settopdisplayline5ŠDC.WƒSETBOTOM-JUMPTABL‚$CA=Setbottomdisplayline5ŠDC.WƒSETLEFT-JUMPTABLƒ$CB=Setleftdisplaycollumn7ŠDC.WƒSETRIGHT-JUMPTABL‚$CC=Setrightdisplaycollumn-ŠDC.WƒSETPROT-JUMPTABLƒ$CD=Setprotectmode,ŠDC.WƒWABSOLUT-JUMPTABL‚$CE=Writeabsolute+ŠDC.WƒREADABSO-JUMPTABL‚$CF=Readabsolute5ŠDC.WƒICHAR-JUMPTABL…$D0=Insertcharacteratcursor5ŠDC.WƒDCHAR-JUMPTABL…$D1=Deletecharacteratcursor,ŠDC.WƒKEYENAB-JUMPTABLƒ$D2=Enablekeyboard.ŠDC.WƒKEYDSABL-JUMPTABL‚$D3=Disablekeyboard?ŠDC.WƒEEPAGE-JUMPTABL„$D4=Eraseallunprotectedtoendofpag?ŠDC.WƒEELINE-JUMPTABL„$D5=Eraseallunprotectedtoendoflin3ŠDC.WƒINS_LINE-JUMPTABL‚$D6=Pagemodeinsertline3ŠDC.WƒDEL_LINE-JUMPTABL‚$D7=Pagemodedeleteline:ŠDC.WƒCLEAR-JUMPTABL…$D8=Eraseallunprotectedinscreen&ŠDC.WƒSNDPAGE-JUMPTABLƒ$D9=Sendpage'ŠDC.WƒSEEKFT-JUMPTABL„$DA=Forwardtab$ŠDC.WƒSEEKBT-JUMPTABL„$DB=Backtab#ŠDC.WƒSETTAB-JUMPTABL„$DC=SettabŠDC.WƒRETURN-JUMPTABL„$DD=ŠDC.WƒRETURN-JUMPTABL„$DE=(ŠDC.WƒSEND_LINE-JUMPTABL$DF=Sendline%ŠDC.WƒSBLINK-JUMPTABL„$E0=Setblink'ŠDC.WƒRBLINK-JUMPTABL„$E1=Resetblink-ŠDC.WƒSINVERT-JUMPTABLƒ$E2=Setvideoinvert/ŠDC.WƒRINVERT-JUMPTABLƒ$E3=Resetvideoinvert-ŠDC.WƒUPBRIGHT-JUMPTABL‚$E4=Sethalfbright/ŠDC.WƒDNBRIGHT-JUMPTABL‚$E5=Resethalfbright)ŠDC.WƒSULINE-JUMPTABL„$E6=Setunderline+ŠDC.WƒRULINE-JUMPTABL„$E7=Resetunderline,ŠDC.WƒNONDISP-JUMPTABLƒ$E8=Setnon-display(ŠDC.WƒSETDISP-JUMPTABLƒ$E9=Setdisplay-ŠDC.WƒPROTECT-JUMPTABLƒ$EA=Setprotectmode-ŠDC.WƒALLOW-JUMPTABL…$EB=ResetprotectmodeŠDC.WƒRETURN-JUMPTABL„$EC=ŠDC.WƒRETURN-JUMPTABL„$ED=ŠDC.WƒRETURN-JUMPTABL„$EE=ŠDC.WƒRETURN-JUMPTABL„$EF=ŠDC.WƒRETURN-JUMPTABL„$F0=2ŠDC.WƒRESET24-JUMPTABLƒ$F1=Reset24linescreen.ŠDC.WƒRETURN-JUMPTABL„$F2=ŠDC.WƒRETURN-JUMPTABL„$F3=ŠDC.WƒRETURN-JUMPTABL„$F4=ŠDC.WƒRETURN-JUMPTABL„$F5=ŠDC.WƒRETURN-JUMPTABL„$F6=2ŠDC.WƒRESET25-JUMPTABLƒ$F7=Reset25linescreen.ŠDC.WƒRETURN-JUMPTABL„$F8=ŠDC.WƒRETURN-JUMPTABL„$F9=ŠDC.WƒRETURN-JUMPTABL„$FA=ŠDC.WƒRETURN-JUMPTABL„$FB=ŠDC.WƒRETURN-JUMPTABL„$FC=ŠDC.WƒRETURN-JUMPTABL„$FD=ŠDC.WƒRETURN-JUMPTABL„$FE=ŠDC.WƒRETURN-JUMPTABL„$FF=  ‰PAGE*'* $7F = DLE, delete character at cursor*DLE'‰AND.W…#$FF80,(A0)‰Nullcharacterspace)‰OR.B†#$20,(A0)‹Spacecharacteratcursor ‰BRA‡RETURN *** Send the command in D0 to this key board*'WKBD…OR.B†#KBDADDR,D0‰Tothiskeyboard‰MOVE.B„D0,EPCIBASE‰RTS ** 07 = CTRL G = BELL*ADDED‚01/30/85*8* RING_BELL flag is set so that the interrupt routine in9* KEYBRD.AG will output an ALARM command to the keyboard.*BELL ‰STˆRING_BELL ‰BRA‡RETURN‰PAGE*@ * 08 = CTRL H = BS, back space*:* Cursor moves left to first unprotected column, with line* and page rollover.**BS SEEKL„EQU‡* ‰IF.B†PAGEFLAG#TRUETHEN.S‰IF.L†A0S.SCRNTHEN.S9‰MOVE.L„E.SCRN,A0‹Weneedtoputthecursoronthebottom7‰MOVE.L„A0,E.LINE‹lineandupdatethebeginningandend+‰MOVE.L„A0,S.LINE‹ofcurrentlinepointers.‰SUB.L…D6,S.LINE ‰BRA‡WRITCRSR‰ENDI‰IF.L†A0S.LINETHEN.S3‰SUB.L…D5,A0Findthebeginningaddressoftheline:‰MOVE.L„A0,S.LINE‹abovethecursorandupdatethepointer.0‰ADD.L…D6,A0Findtheendingaddressoftheline:‰MOVE.L„A0,E.LINE‹abovethecursorandupdatethepointer. ‰BRA‡WRITCRSRŒUpdatethecursor.‰ENDI0‰SUBQ.L„#2,A0Movethecursorleftoneposition.‰BRA‡WRITCRSRŒ*‰ENDI!‰MOVE.L„A0,A3Setloopterminator‰REPEAT‰IF.L†A0S.SCRNTHEN.S6‰MOVE.L„E.SCRN,A0‹Ifbacktostartgotoendofscreen1‰MOVE.L„A0,E.LINE‹Setendofcurrentvirtualline3‰MOVE.L„A0,S.LINE‹Setstartofcurrentvirtualline‰SUB.L…D6,(A2)*‰ELSE.S‰IF.L†A0S.LINETHEN.S'‰SUB.L…D5,A0Setstartofpreviousline‰MOVE.L„A0,S.LINE‹*$‰ADD.L…D6,A0Setendofvirtualline.‰MOVE.L„A0,E.LINE‹andA0pointstoendofline‰ENDI‰ENDI&‰TST‡-(A0)Iscurrentspotunprotected#‰BMI.S…SEEKL1ŽBranchifunprotected1‰TST.B…1(A0)Ifweareatendoflinemovecursor*¦backanotherposition.‰IFˆTHEN.S‰*‰BRA.S…SEEKL1Ž*‰ELSE.S2‰BRA.S…SEEKL2ŽGoupdatecursorbecausewefoundan*¦unprotectedspot.‰ENDISEEKL1‰UNTIL.LƒA0A35‰MOVE.L„S.SCRN,A0‹Putcursorinhomeposition--noun-$*¦protectedareasincurrentscreen.SEEKL2 ‰BRA‡WRITCRSR‰PAGE*"* 09 = CTRL I = HT, horizontal tab*2* Seek a TAB at an un-protected spot to the right,* with line and page rollover.**HT$SEEKFTƒEQU‡*“Seekatabtotheright2‰SFˆPRO_FIELD‹Havenotencounteredprotectedfield!‰MOVE.L„A0,A3Setloopterminator*‰ADDQ.L„#2,A0Getoffofcurrentcharacter‰BRA.S…SEEKFT2‰REPEAT(‰TST‡(A0)+Iscurrentlocationprotected!‰BPL.S…SEEKFT1Branchifitisn't*3*ˆCursorisinaprotectedfield--checktoseeif2*ˆencounteredearlierandwearestillinitorif*ˆthisisthefirsttime*0‰TST.B…PRO_FIELD‹Firsttimeinprotectedfield?‰IFTHEN.S0‰STˆPRO_FIELD‹Tellworldwehaveencounteredthe$*©protectedfieldforthefirsttime.‰BRA.S…SEEKFT2Nowmoveoutofprotectedfield‰ENDI7‰BRA.S…SEEKFT2Stillinprotectedfieldcontinuesearch*©forfirstunprotectedfield. SEEKFT16‰TST.B…PRO_FIELD‹Ifthisisanunprotectedfieldcheck$*¨toseeifwepassedthroughapro-"*¨tectedfieldfirst.‚Thetabmust"*¨moveoutofcurrentfieldtothe*¨nextunprotectedfield.‰IFTHEN.S/‰TST.B-1(A0)’Wecannotstoponanendofline.‰IFTHEN.S*/‰BRA.S‚SEEKFT2Branchifweareatendofline.‰ENDI'ŠSUBQ.L#2,A0‘Adjustthecursoraddress0ŠBRAWRITCRSR‘Foundourtabstopwhichreallyis"*ªjustanunprotectedfieldtothe*ªrightofthecurrentfield.‰ENDISEEKFT2ŒIF.L‚A0E.LINETHEN.S“ADD.L‚D5,A0ˆDolinerollover8“MOVE.LA0,E.LINE„Addabsolute#ofcharacterfore.line2“SUB.L‚D6,A0ˆS.line=e.line-#charinvirtline“MOVE.LA0,S.LINE„*7ŒSTPRO_FIELD‰Becausewewentoff-linefakeaprotected*¦fieldhitsocursorwillstop‰ENDI‰IF.LA0E.SCRNTHEN.S"ŒMOVE.LS.SCRN,A0…Dopagerollover'ŒMOVE.LA0,S.LINE…Setnewstartofline%ŒMOVE.LA0,E.LINE…SetnewendoflineŒADD.L‚D6,E.LINE…*7ŒSTPRO_FIELD‰Becausewewentoff-linefakeaprotected*¦fieldhitsocursorwillstop‰ENDISEEKFT3‰UNTIL.LƒA0A3 ‰BRARETURN‰PAGE***0D…Carriagereturn*2* Position cursor at left most unprotected column.** FAC's are reset.*CR‰AND.W…#$4400,(A1)‰ResetFACs‰MOVE.L„S.LINE,A0‹Startofline ‰BSR‡SEEKR ‰BRA‡WRITCRSR * *1B…Escape*(* Set high bit of next character output.* ESC†EQU‡*#‰BSR‡GET_CHARŒNeedanotercharacter ‰BSET†#7,D0‰BRA‡HAVE_CHAR‰PAGE*A *$8E„STARTEDITMODE*START_EDITMODE ‰BSR‡GET_CHAR‰IF.BD0#$FFTHEN.S‰MOVE†#$FFFF,DUP_CHAR‰ELSE.S‰MOVE†D2,DUP_CHAR‰ENDI ‰STˆEDIT_FLAG ‰SFˆPAGEFLAG ‰SFˆPROMODE ‰BRA‡RETURN**$8F‚STOPEDITMODE* STOP_EDITMODE%‰SFˆEDIT_FLAG‹Turnoffeditmodeflag ‰BRA‡RETURN‰PAGE**$C0„cursorhome*A* Cursor moves to top left corner of screen, seeks an unprotected* space to the right.* HOME…EQU‡* ‰MOVE.L„S.SCRN,A0‹Topleftspace6‰MOVE.L„A0,S.LINE‹Modifystartandendofcurrentline‰MOVE.L„A0,E.LINE‰ADD.L…D6,4(A2) ‰BSR‡SEEKR ‰BRA‡WRITCRSR * * C1 = Up*C* Cursor moves up one line in same column, seeks unprotected column+* to the left, with line and page rollover.**(UP‡SUB.L…D5,A0Samecolumninlineabove3‰SUB.L…D5,(A2)Modifystartandendofcurrentline‰SUB.L…D5,4(A2)‰CMP.L…S.SCRN,A0‹Outofscreen?‰BGE.S…UP.1No,doit4‰MOVE.L„A0,D0Rollscreenover--findcursorposition(*¦relativetothebeginningoftheline.4‰SUB.L…S.LINE,D0‹D0<--cursoroffsetintothisline,‰MOVE.L„E.SCRN,A0‹Pointtobottomofscreen.*‰MOVE.L„A0,S.LINE‹Updatestart/endofline‰SUB.L…D6,(A2)‰MOVE.L„A0,E.LINE%‰MOVE.L„S.LINE,A0‹Positionthecursor‰ADD.L…D0,A0* +UP.1…EQU‡*“Modifystart/endofcurrentline ‰LEA‡2(A0),A0 ‰BRA‡SEEKL‰PAGE* * C2 = Down*A* Cursor seeks an unprotected spot to the right, starting at same+* collumn on next line, with page rollover.* DOWN…EQU‡*%‰ADD.L…D5,A0Samecolumnonnextline/‰ADD.L…D5,(A2)Modifystart/endofcurrentline‰ADD.L…D5,4(A2)#‰CMP.L…E.SCRN,A0‹Outofthescreen?‰BLT.S…DOWN1No,doit4‰MOVE.L„A0,D0Rollscreenover--findcursorposition(*¦relativetothebeginningoftheline.4‰SUB.L…S.LINE,D0‹D0<--cursoroffsetintothisline/‰MOVE.L„S.SCRN,A0‹Pointtobeginningofscreen.'‰MOVE.L„A0,S.LINE‹Updatelinepointers.‰MOVE.L„A0,E.LINE‹*‰ADD.L…D6,4(A2)Œ* ‰ADD.L…D0,A0PositionthecursorDOWN10‰BSR‡SEEKRSeekanunprotectedspottotheright ‰BRA‡WRITCRSR *** C3 = cursor left, same as back space 08.* * * C4 = Right*D* Seek an unprotected space to the right with line and page rollover*RIGHT!‰MOVE.L„A0,A3Setloopterminator'‰ADDQ.L„#2,A0Getoffofcurrentcolumn ‰BRA.S…RIGHT1‰REPEAT-‰TST.W…(A0)+Pointingtounprotectedcolumn?‰IFTHEN.S/‰TST.B…-1(A0)ŽWecannotstoponanendofline.$‰IFƒTHEN.SŽEndoflineisa00. ‰BRA.S‚RIGHT2‰ENDI'‰SUBQ.L„#2,A0Adjustforautoincrement%‰BRA‡WRITCRSRŒUpdatecursoronscreen‰ENDIRIGHT1 ‰IF.B‚PAGEFLAG#TRUETHEN.S “BRAWRITCRSR‰ENDI‰IF.LA0E.SCRNTHEN.S ‰MOVE.LS.SCRN,A0„Doscreenwrap;‰MOVE.LA0,S.LINE„Updatebeginningandendinglinepointers‰MOVE.LA0,E.LINE„*‰ADD.L‚D6,E.LINE„*‰ENDI‰IF.LA0E.LINETHEN.S‰ADD.L…D5,A0Dolinewrap!‰MOVE.L„A0,E.LINE‹Newendofline‰SUB.L…D6,A0Newstartofline‰MOVE.L„A0,S.LINE‹*‰ENDIRIGHT2‰UNTIL.LƒA0A3)‰BRA‡RETURNŽNounprotectedsoleaveasis‰PAGE*+*$C5„Movethecursortotherequestedspot*C5: 'ŠBSR„GET_CHAR‹D0.B<--theline#char.'ŠMOVE.BD0,SAVE_CHAR‡Saveitforlater. )ŠBSR„GET_CHAR‹D0.B<--thecolumn#char.&ŠMOVEQ‚#0,D1ŽD1<--thecolumn#char.ŠMOVE.BD0,D1Ž*1ŠSUB.B‚#$20,D1ŒAdjustitso0isfirstline,etc. 4ŠCMP„LEFTCOL,D1‰Ensurethatthecolumn#isinrange2ŠBLO„RETURN(LEFTCOL#TRUETHEN.SƒDoaseekrightifscreenis“BSRSEEKRinprotectmode.‰ENDI ŠBRA„WRITCRSR‰PAGEC6‡EQU‡***$C6„Readthecursorposition.**‚Inputparametersƒ:none.*G*‚Registersaffected:D0.W=LLCC(seeC5foranexplanationofLLCC).**+‰BSR‡READCRSRŒGetcursor'sabsoluteaddress‰DIVU†D5,D1D1=00CC00LL‰SWAP†D1’D1=00LL00CC3‰LSL.W…#8-1,D1D1=00LLCC00(-1toconverttobytes)0‰ADD.L…#$DD2020DE,D1‡Addtheoffsetfortheuser*¦Setstartdataandenddata*‰LEA‡XTCHBUF(PC),A0†SetupforFEEDERcall‰MOVE.L„D1,(A0)Movetobuffer,‰MOVE.W„#4,FEEDER_COUNT…Setlengthofbuffer:‰MOVE.L„A0,FEEDER_ADDRESSƒSetaddressofbufferforFEEDER‰BSR‡FEEDERŽGivedatatodriver‰BRA‡RETURNŽReturntocaller***$C7„Setpagemode.* SPAGE„EQU‡*‰MOVE.W„#-1,PAGEFLAG ‰SFˆPROMODE ‰BRA‡HOME **$C8„Setscrollmode.* RPAGE„EQU‡*‰CLR.W…PAGEFLAG ‰SFˆPROMODE'‰MOVE.L„S.SCRN,A0Doascrollmodehome‰MOVE.LƒA0,S.LINE‚*‰MOVE.LƒA0,E.LINE‚*‰ADD.L„D6,4(A2)ƒ*‰BRA‡WRITCRSR‚***$CD„Setprotectmode*SETPROT‰STˆPROMODEƒSetprotectmode‰CLR‡PAGEFLAG‚Resetpagemode-‰BRA‡HOME†Setthecursortothehomeposition‰PAGE***$C9„Settoplineofvirtualdisplayarea*G* The top line is set by: 1. Bringing the cursor to the requested line,*œandthenenteringanESCI."*™2.EnteringoutchwithD0.W=LLC5 SETTOPƒEQU‡* ‰BSR‡GET_CHARŒGetnextcharacter‰SUB.B…#$20,D2$‰CMP.W…BOTLINE,D2Š0=botline ‰BHI‡RETURN$‰MOVE.W„D2,TOPLINEŠStoreinconstantINITIT‰BSR‡CRTINITRe-configureCRT&‰BRA‡HOME†Putcursorinhomeposition. *-*$CA„Setbottomlineofvirtualdisplayarea*"*SameasC9forbottomline‚ESCJ*SETBOTOMEQU‡*‰BSR‡GET_CHARŒGetlinenumber!‰SUB.B…#$20,D2Adjustlinenumber+‰CMP.W…LPERSCRN,D2‰lperscrn>botline>topline ‰BHS‡RETURN‰CMP.W…TOPLINE,D2 ‰BLO‡RETURN‰MOVE.W„D2,BOTLINE ‰BRA‡INITIT *5*$CB„Setleftdisplaycolumnofvirtualscreen‚ESCK* SETLEFT‚EQU‡*‰BSR‡GET_CHARŒGetleftcolumn‰SUB.B…#$20,D2‰CMP.W…RIGHTCOL,D2 ‰BHI‡RETURN‰MOVE.W„D2,LEFTCOL ‰BRA‡INITIT‰PAGE*4*$CC„Setrightdisplaycolumnofdispalyarea‚ESCL*SETRIGHTEQU‡*‰BSR‡GET_CHARŒGetrightcolumn‰SUB.B…#$20,D2,‰CMP.W…CPERLINE,D2‰cperlineleftcol ‰BHS‡RETURN‰CMP.W…LEFTCOL,D2 ‰BLO‡RETURN‰MOVE.W„D2,RIGHTCOL ‰BRA‡INITIT SEEIFIN‚EQU‡*-‰LSR.W…#8,D0Checktoseeiftheuserdefined%‰TST.W…D0’thespotinthesecondbyte ‰BNE.S…RTSIT*:* The routine will calculate the current line and collumn.+* Left collumn is #00, and top line is #00.*2*InputŒA0.L=Addressofcursorindisplayscreen**Output‹A0.L=unchanged*’D0.L=00CC00LL&*™whereˆLL=Linenumber,topline=0'*¦CC=Collumnnumber,leftcollumn=0 GETSPOT‚EQU‡*‰CLR.L…D0’HSKP ‰MOVE.L„A0,D04‰SUB.L…#SCREEN,D0‰=Absolutecursoraddressonscreen ‰LSR.W…#1,D0*‰DIVU†CPERLINE,D0‰Thequotiant=linenumber RTSIT„RTS‰PAGE**$CE„writeabsolute* WABSOLUT: -ŠREPEAT”Waitfora'startofdata'indicator.ŠBSR„GET_CHAR‹*ŠUNTIL.BD0#START_OF_DATA ,ŠMOVEƒ(A1),SAVEFACS†SavecurrentFACSinuse 'ŠBSR„GET_CHAR‹D0.B<--theline#char.'ŠMOVE.BD0,SAVE_CHAR‡Saveitforlater. )ŠBSR„GET_CHAR‹D0.B<--thecolumn#char.&ŠMOVEQ‚#0,D1ŽD1<--thecolumn#char.ŠMOVE.BD0,D1Ž*1ŠSUB.B‚#$20,D1ŒAdjustitso0isfirstline,etc. 5ŠCMP„CPERLINE,D1ˆEnsurethatthecolumn#isinrange-ŠBHS„RETURN(LEFTCOL#END_OF_DATATHEN.S6‰MOVE.L„SAVE_CURSOR,D0†Restorevirtualscreen'sS.LINE *°andE.LINE!‰MOVE.L„D0,D1Copycursoraddress‰SUB.L…#SCREEN,D0*‰DIVU†BPERLINE+2,D0‡Findlinecursorison*¦remainder=positioninline‰CLR‡D0’Forgetlineweareon‰SWAP†D0,‰SUB.L…D0,D1wenowknowtheabsolutes.line-‰MOVE†LEFTCOL,D0Šsoadjustitbythevaluein‰ADD‡D0,D0leftcol.‰ADD.L…D0,D1*1‰MOVE.L„D1,S.LINE‹bingowenowhavestartofline-‰ADD.L…B.LINE,D1‹addthenumberofbytes/line%‰MOVE.L„D1,E.LINE‹andsetendofline8‰MOVE.L„SAVE_CURSOR,A0†Setcursorbacktovirtualscreen/‰MOVE†SAVEFACS,(A1)‡ResetFACSforcurrentline‰BRA‡WRITCRSRŒ*ŠENDIŠST…CHAR_RESERVED‰IF.BD2#$E0AND.BŽD2#$EBTHEN.S6‰TST.B…LASTFACSeeifthelastcharacterprocessedwas*¦aFAC.5‰IF‚THEN.SIfitwasnotaFACthendestroywhat'*¦iscurrentlyonthescreenbecauseit*¦couldbeanotherFAC.:‰MOVE.B„#$FF,1(A0)ŠDestroycurrentcharacter.(ifaFACis&*¦writtenherethecodewillbea01.)‰ENDI3‰STˆLASTFACTelltheloopwehavebeenherebefore.‰BRA‚OUTCH1“ProcesstheFAC.‰ENDI3‰TST.B…LASTFACIfthelastcharacterwasaFACthen3‰IFƒTHEN.SŽthecursorhasnotbeenupdated,so-‰ADD.L…#2,A0let'sadd2andgetoffourFAC.)‰SFˆLASTFACLastcharacterwasnotaFAC.‰ENDI8‰MOVE.W„LPERSCRN,D0‰FINDTHEENDOFTHEABSOLUTEDISPLAY ‰MULU†D5,D0*‰ADD.L…#SCREEN,D0Š*5‰OR.W†FACS,D2Writethecurrentcharactertothescrn‰MOVE.W„D2,(A0)+Œ*‰IF.L†A0D0THEN.S&‰BRA‡RETURNŽExitifpastendofscreen‰ENDI,‰BRA‡WRITCRSRŒUpdatecurrentcursorposition **$CF„readabsolute*+*ˆUsesthereadabsoluteroutineinoutchs.*READABSOEQU‡* ‰JMP‡RABSOLUT *2* Convert the llcc value to a display RAM address.**ˆInputƒD0.W=llcc*ˆOutput‚A0.L=screenaddress* CONVERT‚EQU‡*%‰MOVE.L„D6,-(A7)ŒGetsomeellbowroom ‰CLR.L…D6 ‰MOVE.W„D0,D6‰AND.W…#$00FF,D0‰CMP.W…CPERLINE,D0 ‰BGT.S…CONRET‰LSR.L…#8,D6D6.L=000000ll‰CMP.W…LPERSCRN,D6 ‰BGT.S…CONRET ‰MULU.W„D5,D6 ‰LSL.W…#1,D0 ‰ADD.B…D0,D6‰ADD.L…#SCREEN,D6 ‰MOVE.L„D6,A0CONRETƒMOVE.L„(A7)+,D6‰RTS‰PAGE*8*‚$D0„Insertacharacteratthecurrentcursorposition.B*‰Startingatthecurrentcursorposition,charactersaremovedto@*‰therightuntiltheendoflineoraprotectedfieldishit.‚A>*‰spaceisputinthecurrentcursorposition.‚Thecursordoes *‰notmove.*7ICHAR:„MOVEQ‚#SPACE,D0ŠInitializeLASTCHARtoaspace. .ICHAR1„TST„(A0)Ifthispositionisprotected,ŠBMI.S‚ICHAR3getout. 2ŠMOVEQ‚#$7F,D1ŒD1<--thecharfromthisposition.ŠAND„(A0),D1Œ*9ŠAND„#$FF80,(A0)ˆPuttheLASTCHARoutthereinitsplace.ŠOR…D0,(A0)+‹andadvancetothenextposition.1ŠMOVEƒD1,D0ŽSetLASTCHARtothecharwejustgot;ŠDBRAƒD4,ICHAR1Š(fornextpass)andloopuntilendofline. ICHAR3„BRA„RETURNExit. *8*‚$D1„Deleteacharacteratthecurrentcursorposition.F*‰Startingjustpastthecurrentcursorposition,charactersaremovedB*‰totheleftuntiltheendoflineoraprotectedfieldishit.‚A@*‰spaceisputinthefinalmodifiableposition.‚Thecursordoes%*‰notmove.‚TheentrypointisDCHAR.*#TRUETHEN.S ŠBRARETURNŠENDI6ŠMOVE.LE.SCRN,A0ŠA0<--addrjustpastendofscreen. AŠWHILE.LA0E.LINEDO.S‚WhileA0isnotonthecurrentline, 6ŠMOVE.LA0,A1ŽA1<--addrjustpastendoflineabove./ŠSUB.L‚D5,A1Ž*‡(D5isbytesperabsoluteline.)0ŠMOVE.LA0,-(SP)‹Savetheaddressforthisline. 6ŠMOVEƒC.LINE,D0ŠD0<--#ofcharsinvirtualline-1.@INS_LIN1‚MOVEƒ-(A1),-(A0)ˆMoveallwords(attributeandchar)in.ŠDBRAƒD0,INS_LIN1ˆthislinetothelinebelow. 3ŠMOVE.L(SP)+,A0‹Restoretheaddressforthisline.-ŠSUB.L‚D5,A0ŽA0<--addressfornextlineup. ŠENDW (*§AtthispointA0istheaddrjustpast&*§theendofthecurrentvirtualline.6ŠMOVEƒC.LINE,D0ŠD0<--#ofcharsinvirtualline-1.?INS_LIN2‚AND.B‚#$80,-(A0)‰Fillthecurrentlinewithspacesand%ŠOR.Bƒ#$20,(A0)Šinnocuousattributes.ŠMOVE.B#$44,-(A0)‰*ŠDBRAƒD0,INS_LIN2ˆ*%*§AtthispointA0istheaddrofthe(*§beginningofthecurrentvirtualline.,ŠBRA„WRITCRSR‹Gosetthenewcursoraddress.   **$D7‚DELETELINE*DEL_LINE‰IF.BPROMODE#TRUETHEN.S ‰BRARETURN‰ENDI;‰MOVE.L„S.LINE,A0BeginningaddressofcurrentvirtuallineDELINE;‰MOVE.L„A0,A1…Calculatetheaddressofthebeginningofthe‰ADD.L…D5,A1…nextline.4‰MOVE†C.LINE,D0Numberofbytesperlinetobemoved?‰CMP.L…E.SCRN,A1Seeifmovefromaddressispassedendofscrn-‰BHS.S…DELINE2ƒBranchifpassedendofscreen2‰MOVE.L„A0,-(A7)‚SavedestinationaddressonstackDELINE1*‰MOVE.W„(A1)+,(A0)+Movelineuponscreen‰DBRA†D0,DELINE1‚*,‰MOVE.L„(A7)+,A0‚Restoredestinationaddress'‰ADD.L…D5,A0‡Pointtonextvirtualline,‰BRA.S…DELINE„GomovenextlineuponscreenDELINE22‰MOVE.B„#$44,(A0)+ƒBlankthebottomlineofscreen.‰AND.B…#$80,(A0)„Savetabstopifthereisone+‰OR.B†#$20,(A0)+ƒSetspaceinthislocation‰DBRA†D0,DELINE2ƒ*9‰MOVE.L„S.LINE,A0„Setcursortobeginningofcurrentline‰BRA‡WRITCRSR…* PAGE*+*$D5„Erasetoendofline‚(Pagemodeonly)* EELINEƒEQU‡*!‰MOVE†FACS,-(A7)ŠSavecurrentFAC‰IF.B1(A0)#01THEN.S ‰MOVE.Bƒ#$44,FACSŒResettoFACS.‰ELSE.S)‰MOVE.LƒA0,A3Savecurrentlineposition.‰WHILE.L‚A3S.LINEDO.S=‰IF.B…-1(A3)#01THEN.SƒFindtheFACcodeforthisfield.‰MOVE.Bƒ-2(A3),FACSŒPropogatethecurrentFAC.‰BRA.S„EELINE1‰ELSE.S5‰SUBQ.Lƒ#2,A3FindaFACdefinitionorthestartofa *¦*‚line.‰ENDI‰ENDW‰ENDIEELINE1‰WHILE.L‚A0E.LINEDO.S/‰MOVE.BƒFACS,(A0)+‹PropogateFACtoendofline%‰AND.B„#$80,(A0)ŒSavetabinformation3‰OR.B…#$20,(A0)+‹Moveendoflinemarkerbywriting*°spacestotheend.‰ENDW%‰MOVE†(A7)+,FACSŠRestorecurrentFAC. ‰BRA‡RETURN**$D8„clearscreen,cursorhome*C* All unprotected positions in display area are filled with spaces.* FAC's are not affected.* * Cursor moves to home position.** CLEAR„EQU‡*‰MOVE.L„S.SCRN,A0‹StartathomeC ‰MOVE.W„C.LINE,D4‹Afullline"‰BSR.S…ERASEEraseallunprotected‰BRA‡HOMEPutcursorathome *%* Erase D4.W characters in D3.w lines* ERASE„EQU‡*‰IF.BPROMODE#TRUETHEN.S‰TST.W…(A0)+Isitprotected?‰BMI.S…ERASE1ŽYes,keeplooking'‰AND.W…#$FF80,-2(A0)‡PreservetheFAC's!‰OR.W†#$0000,-2(A0)‡Writeaspace‰ELSE.S,‰AND‡#$0080,(A0)‰ResetFACbutsavetabinfo,‰ORˆ#$4400,(A0)+ˆWriteendoflinecharacter‰ENDI/ERASE1ƒDBRA†D4,ERASEŒRepeatforD4.wcharacters)‰MOVE.W„C.LINE,D4‹Resetcharactercounter$‰ADD.W…PB.LINE,A0ŠStartofnextline$‰DBRA†D3,ERASEŒRepeatforD3.wlines‰RTS‰PAGE**$D9„SENDPAGE**ˆSendallunprotectedfields*SNDPAGE9‰MOVE.L„S.SCRN,A0ŠStartatbeginningofthevirtualscrn.2‰MOVE.L„A0,-(A7)ŒSavebeginninglineadronstack.%‰LEA‡XTCHBUF,A1ŠFeederneedsabuffer9‰MOVE.L„A1,FEEDER_ADDRESSƒTellfeederwherehisbufferisA‰MOVE.B„#START_OF_DATA,(A1)+Bracketdatawithstartandenddata:‰MOVE†#1,FEEDER_COUNT…Bumpnumberofcharactersforfeeder*?*‡Findallunprotectedfieldsonthescreenandputtheminthe**‡feederbufferandshipthemtothehost.*3‰MOVE…L.SCRN,D2ŽWeonlywanttodo1screensworth.0‰MOVE…C.LINE,D1ŒWedo1screenalineatatime.SNDPAGE1+‰TST.B…(A0)Iscurrentpositionprotected?2‰BPL.S…SNDPAGE3ŒBranchifpositionisunprotected.#‰ADDQ.L„#2,A0Gotonextcharacter.%‰DBRA†D1,SNDPAGE1‰Dotheentireline.7‰ADD.L…D5,(A7)Findthestartofthenextvirtualline.‰MOVE.L„(A7),A0*4‰MOVE†C.LINE,D1‹Updatenumberofcharacterperline.:‰DBRA†D2,SNDPAGE1‰Findoutifweareattheendofscreen.6‰BRA.S…SNDPAGE4ŒEndofscreensofixfeederbufferand*¦shipthedataandexit.SNDPAGE2,‰TST.B…(A0)Iscurrentcharacterprotected?3‰BPL.S…SNDPAGE3ŒBranchifcharacterisunprotected.:‰MOVE.B„#END_OF_FIELD,(A1)+Markendofunprotectedfield.>‰ADDQ†#1,FEEDER_COUNT…Bumpthenumberofchars.forthedriver4‰BRA.S…SNDPAGE6ŒGospinthroughtheprotectedfield.SNDPAGE33‰MOVEQ…#$7F,D0Thecharisinbits0-6ofthebyte.‰AND.B…1(A0),D0$*¦Bit7isthe'tabstop'bitandis*¦nottobeconsidered"data"**‰BNE.S…SNDPAG35ŒBranchifnotendofline.7‰ADD.L…D5,(A7)Findthenextvirtuallinebeginningadr‰MOVE.L„(A7),A0*5‰MOVE†C.LINE,D1‹Updatenumberofcharactersperline.*B*…Checktoseeifwewereinaprotectedorunprotectedfieldwhen*…wegottotheendofline.*!‰IF.B†PRO_FIELD#TRUETHEN.S6‰BRA.S…SNDPAGE7ŒContinueprocessingaprotectedfield.‰ELSE.S*‰BRA.S…SNDPAG36ŒUnprotectedfieldwrapped.‰ENDISNDPAG355‰MOVE.B„D0,(A1)+ŒMoveunprotectedcharactertofeeder *ªbuffer.8‰ADDQ†#1,FEEDER_COUNT…Updatethenumberofcharactersto*ªgivetothedriver.&‰ADDQ.L„#2,A0Pointtonextcharacter.)‰SFˆPRO_FIELD‹Lastfieldwasunprotected.(‰DBRA†D1,SNDPAGE2‰Spinthroughtheline.5‰ADD.L…D5,(A7)Findthebeginningofthenextvirtual*©line.‰MOVE.L„(A7),A0*0‰MOVE†C.LINE,D1‹Updatenumberofcharacter/line.SNDPAG36:‰DBRA†D2,SNDPAGE2‰Checktoseeifweareattheendofthe *ªscreen.C‰MOVE.B„#END_OF_FIELD,(A1)+‚Moveendoffieldmarktofeederbuffer.‰ADDQ†#1,FEEDER_COUNT…Updatethefeedercount.SNDPAGE4A‰MOVE.B„#END_OF_DATA,(A1)„Moveendofdatamarktofeederbuffer..‰ADDQ†#1,FEEDER_COUNT…Updatethefeedercount. ‰BSR‡FEEDERŽShipdatatodriver.$‰MOVE.L„(A7)+,A0ŒCleanupthestack.‰BRA‡RETURNŽExit.SNDPAGE5$‰TST.B…(A0)Ischaracterprotected?#‰BPL.S…SNDPAGE3ŒBranchifitisn't.SNDPAGE6(‰ADDQ†#2,A0Pointtothenextcharacter.'‰STˆPRO_FIELD‹Lastfieldwasprotected.'‰DBRA†D1,SNDPAGE5‰Gothroughttheline.7‰ADD.L…D5,(A7)Findthenextvirtuallinebeginningadr‰MOVE.L„(A7),A0*+‰MOVE†C.LINE,D1‹Updatecharactersperline.SNDPAGE7/‰DBRA†D2,SNDPAGE5‰Gothroughtheentirescreen.0‰BRA‡SNDPAGE4ŒWeareattheendofthescreenso&*¦fixupfeedersbufferandshipitto*¦thedriverthenexit.‰PAGE**$DA„Forwardtab* * Same as HT* ** DB = BT, back tab*C =* Position cursor at first unprotected character to the left.** SEEKBTƒEQU‡*‰IF.LA0S.SCRNTHEN.S**ˆDOSCREENWRAP*7‰MOVE.L„E.SCRN,A0Endofscreenbecomesnewendofline‰MOVE.L„A0,E.LINE*2‰MOVE.L„A0,S.LINEUpdatethestartoflinepointer‰SUB.L…D6,S.LINE*‰ENDI‰IF.LA0S.LINETHEN.S**ˆDOLINEWRAP*‰SUB.L…D5,A0…Newstartofline‰MOVE.L„A0,S.LINE*‰ADD.L…D6,A0…Newendofline‰MOVE.L„A0,E.LINE*‰ENDI**ˆFINDANUNPROTECTEDFIELD*‰WHILE.LA0S.LINEDO.S,‰TST‡-(A0)…Checkpreviouscharacterposition<‰BPL.S…SEEKBT1ƒBranchifunprotected(hibitofwordisoff)‰ENDW**ˆSTARTOFLINEBUTPROTECTED* ‰BRA‡SEEKBT*'*ˆFINDPROTECTEDFIELDORSTARTOFLINE*SEEKBT1‰IF.LA0S.LINETHEN.S‰TST‡(A0)†Islocationprotected‰BMI.S…SEEKBT2ƒBranchifitis/‰BRA‡WRITCRSR‚BeginningoflineandunprotectedSEEKBT2‰IF.LA0S.SCRNTHEN.S**ˆDOSCREENWRAP*7‰MOVE.L„E.SCRN,A0Endofscreenbecomesnewendofline‰MOVE.L„A0,E.LINE*2‰MOVE.L„A0,S.LINEUpdatethestartoflinepointer‰SUB.L…D6,S.LINE*‰ENDI**ˆDOLINEWRAP*‰SUB.L…D5,A0…Newstartofline‰MOVE.L„A0,S.LINE*‰ADD.L…D6,A0…Newendofline‰MOVE.L„A0,E.LINE*‰ENDI'‰TST‡-(A0)…Searchforaprotectedfield$‰BPL.S…SEEKBT1ƒBranchifunprotected&‰ADDQ.L„#2,A0…Adjustforthedecrement‰BRA‡WRITCRSR‚Updatecursor‰PAGE** DC = set tab* SETTABƒEQU‡*/‰CLR.L…COL_CNTƒInitializecurrentcolumnnumber‰BRA.S…SETTAB2SETTAB1:‰ADD.L…#2,COL_CNTŠUpdatethecolumncountforthenextguy‰MOVE.L„COL_CNT,D0@‰IF.L‚D0BPERLINETHEN.SMakesurewedon'tgooutofrange<‰WHILED2#LFCHARDO.S„Ifoutofrangediscardincoming/‰BSRGET_CHAR’untilterminatedwithalinefeed‰ENDW‰BRA‡RETURNŽExit‰ENDISETTAB2.‰BSR‡GET_CHAR‚Getnextcharacteroftabstring6‰MOVE†LPERSCRN,D3‰Setloopcontrolforabsolutescreen‰SUBQ†#1,D3DBRAadjustment9‰CMP.B…#LFCHAR,D2ŠEndofstringisindicatedbylinefeed‰BNE.S…SETTAB2A‹**C*‡LINEFEEDCHARACTERDETECTED,‚IFITFOLLOWEDSETTABS--RESETALL*‡CURRENTTABS*SETTAB42‰TST.L…COL_CNTIfcolumncountzerothenlinefeed*°followedsetcommand‰IFTHEN.S+‰LEA‡SCREEN,A0‹Pointtobeginningofscreen+‰MOVE†LPERSCRN,D5‰Get#oflinesperscreen8‰MULU†CPERLINE,D5‰*charactersperline=#ofcharacter*©positionsonscreenCLRTAB‰AND.W…#$FF7F,(A0)+ˆResettab(‰DBRA†D5,CLRTAB‹Loopuntilendofscreen‰ENDI ‰BRA‡RETURNSETTAB2A4‰MOVE.L„COL_CNT,A0ŠPointtocurrentpositioninline‰ADD.L…#SCREEN,A0Š*-‰CMP.B…#SPACE,D2‹Isthisafillercharacter?5‰BEQ.S…SETTAB1Getnextcharacterifcurrentisspace'‰CMP.B…#CLEARTAB,D2ˆCleartabrequest?+‰BEQ.S…RESETTABŒBranchifcleartabrequest**„SETTABREQUEST*SETTAB37‰BSET.B„#7,1(A0)ŒSettabbitinhighnibbleofthedis-4‰ADD.L…D5,A0playedchar.foreverycolumnonscreen‰DBRA†D3,SETTAB3Š*‰BRA.S…SETTAB1RESETTAB1‰BCLR.B„#7,1(A0)ŒTurntabbitoffineverycolumn‰ADD.L…D5,A0*‰DBRA†D3,RESETTAB‰* ‰BRA‡SETTAB1‰PAGE**ˆ$DFƒSEND‚LINE* SEND_LINE"‰CLR‡D1ˆSetprotectedfieldswitch'‰LEA‡XTCHBUF,A1ŠPointtofeederbuffer.:‰MOVE.L„A1,FEEDER_ADDRESSƒTellfeederwherehisbufferis.:‰MOVE.B„#START_OF_DATA,(A1)+Startofdata($DD)required.5‰MOVE†#1,FEEDER_COUNT…Tellfeederhehas1character.5‰MOVE.L„S.LINE,A0ŠStartatthebeginningoftheline. ‰WHILE.LƒA0E.LINEDO ‰ADDQ.L„#1,A0…BumppasttheFAC.;‰MOVE.B„(A0)+,D0ƒFindoutifweareattheendoftheline.#‰AND.B…#$7F,D0„Couldbeatabstop.‰IFTHEN.SSENDL1C‰MOVE.B„#END_OF_DATA,(A1)Endofline,move($DE)tofeederbuffer.1‰ADDQ†#1,FEEDER_COUNTƒUpdatehis#ofcharacters.&‰BSR‡FEEDER„Shipbuffertothedriver.(‰BRA‡RETURN„Getoutbecausewearedone.‰ENDI,‰CMP.B…#01,D0„CheckforFACdefinitioncode.‰IFTHEN.S‰MOVE.B-1(A0),D0„GettheFAC"‰ROR.W…#2,D0…Gettotherightbits*D *ˆCHECKHALFBRIGHT*&‰ROR.W…#1,D0…Halfbrightbitonoroff‰IFTHEN.S*‰MOVE.B#$E5,(A1)+ƒSendresethalfbright.‰ELSE.S'‰MOVE.B#$E4,(A1)+ƒSendsethalfbright‰ENDI **ˆCHECKVIDEOINVERT*'‰ROR.W…#1,D0…Videoinvertbitonoroff‰IFTHEN.S)‰MOVE.B#$E2,(A1)+ƒSendsetvideoinvert.‰ELSE.S+‰MOVE.B#$E3,(A1)+ƒSendresetvideoinvert.‰ENDI**ˆCHECKUNDERLINE*$‰ROR.W…#1,D0…Underlinebitonoroff‰IFTHEN.S&‰MOVE.B#$E6,(A1)+ƒSendsetunderline.‰ELSE.S(‰MOVE.B#$E7,(A1)+ƒSendresetunderline.‰ENDI* *ˆCHECKBLINK* ‰ROR.W…#1,D0…Blinkbitonoroff‰IFTHEN.S"‰MOVE.B#$E0,(A1)+ƒSendsetblink.‰ELSE.S$‰MOVE.B#$E1,(A1)+ƒSendresetblink.‰ENDI**ˆCHECKDISPLAY*"‰ROR.W…#1,D0…Displaybitonoroff‰IFTHEN.S$‰MOVE.B#$E9,(A1)+ƒSendsetdisplay.‰ELSE.S&‰MOVE.B#$E8,(A1)+ƒSendresetdisplay.‰ENDI**ˆCHECKPROTECT*"‰ROR.W…#1,D0…Protestbitonoroff‰IFTHEN.S$‰MOVE.B#$EA,(A1)+ƒSendsetprotect.‰ELSE.S&‰MOVE.B#$EB,(A1)+ƒSendresetprotect.‰ENDI+‰ADDQ†#6,FEEDER_COUNTUpdateFeederscount. ‰BRA.S…SENDL2‰ENDI1‰MOVE.B„D0,(A1)+‚Movecharactertofeederbuffer.-‰ADDQ†#1,FEEDER_COUNTUpdatecharactercount.SENDL2‰ENDW4‰BRA‡SENDL1„Endoflineencountered--timetoquit.‰PAGE*F* The characters $E0-$EF will set or reset the field attribute bits in'* the XREFed, word sized register FACS.* FACS is defined as follows:**ˆD15=Setforprotect*ˆD14=Setfordisplay*ˆD13=Setforblink*ˆD12=Setforunderline*ˆD11=Setforinversevideo*ˆD10=color/intensitybit1*ˆD09=color/intensitybit2*ˆD08=color/intensitybit3 *„D07-D00=0* ** E0 = set blink* SBLINKƒEQU‡*9‰IF.B1(A0)#01THEN.S„IfweareonaFACdefinition8‰BSET.B„#5,(A1)justORthenewFACbitintocurrentFAC‰ELSE.S˜otherwise&‰MOVE.B„#$64,(A1)‹resetallotherFACS‰ENDI'‰MOVE.B„FACS,(A0)‹UpdateFAConscreen. :‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyfac4‰ORˆ#$8000,(A0)‰TellworldtheFACcodeisprotected*¦soitcannotbewrittenover.2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN ** E1 = reset blink* RBLINKƒEQU‡*#‰MOVE.B„FACS,(A0)‹PutFAConscreen9‰MOVE.B„#$01,(A0)‹Simulatecharacterpositionusedbyfac9‰IF.B1(A0)#01THEN.S„IfweareonaFACdefinition8‰BCLR.B„#5,(A1)justORthenewFACbitintocurrentFAC‰ELSE.S˜otherwise&‰MOVE.B„#$44,(A1)‹resetallotherFACS‰ENDI‰ORˆ#$8000,(A0)‰Setprotectbit2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN** E2 = set video invert* SINVERT‚EQU‡*9‰IF.B1(A0)#01THEN.S„IfweareonaFACdefinition8‰BSET.B„#3,(A1)justORthenewFACbitintocurrentFAC‰ELSE.S˜otherwise&‰MOVE.B„#$4C,(A1)‹resetallotherFACS‰ENDI'‰MOVE.B„FACS,(A0)‹UpdateFAConscreen.:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyfac‰ORˆ#$8000,(A0)‰Setprotectbit2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN ** E3 = reset video invert* RINVERT‚EQU‡*9‰IF.B1(A0)#01THEN.S„IfweareonaFACdefinition8‰BCLR.B„#3,(A1)justORthenewFACbitintocurrentFAC‰ELSE.S˜otherwise&‰MOVE.B„#$44,(A1)‹resetallotherFACS‰ENDI#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyfac‰ORˆ#$8000,(A0)‰Setprotectbit2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN ** E4 = Set half bright*UPBRIGHTEQU‡*,‰MOVE.B„(A1),D2GettheMSBpartoftheFACs'‰AND.B…#$F8,D2Onlythebrightnessbits ‰OR.B†#$04,D2Settohalfbright‰MOVE.B„D2,(A1)*#‰MOVE.B„FACS,(A0)‹PutFAConscreen9‰MOVE.B„#$01,(A0)‹Simulatecharacterpositionusedbyfac‰ORˆ#$8000,(A0)‰Setprotectbit2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN ** E5 = Reset half bright*DNBRIGHTEQU‡*,‰MOVE.B„(A1),D2GettheMSBpartoftheFACsD '‰AND.B…#$F8,D2Turnoffbrightnessbits‰OR.B†#$04,D2Resethalfbright‰MOVE.B„D2,(A1)*#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyfac‰ORˆ#$8000,(A0)‰Setprotectbit2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN ** E6 = set underline* SULINEƒEQU‡*9‰IF.B1(A0)#01THEN.S„IfweareonaFACdefinition8‰BSET.B„#4,(A1)justORthenewFACbitintocurrentFAC‰ELSE.S˜otherwise&‰MOVE.B„#$54,(A1)‹resetallotherFACS‰ENDI'‰MOVE.B„FACS,(A0)‹UpdateFAConscreen.:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyfac‰ORˆ#$8000,(A0)‰Setprotectbit2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN  ** E7 = reset underline* RULINEƒEQU‡*9‰IF.B1(A0)#01THEN.S„IfweareonaFACdefinition8‰BCLR.B„#4,(A1)justORthenewFACbitintocurrentFAC‰ELSE.S˜otherwise&‰MOVE.B„#$44,(A1)‹resetallotherFACS‰ENDI#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyfac(‰ORˆ#$8000,(A0)‰SetprotectbitforFAC.2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN ** E8 = set non display* NONDISP‚EQU‡*9‰IF.B1(A0)#01THEN.S„IfweareonaFACdefinition8‰BCLR.B„#6,(A1)justORthenewFACbitintocurrentFAC‰ELSE.S˜otherwise%‰MOVE.B„#$4,(A1)ŒresetallotherFACS‰ENDI'‰MOVE.B„FACS,(A0)‹UpdateFAConscreen.:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyfac‰ORˆ#$8000,(A0)‰Setprotectbit2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN  ** E9 = reset non-display* SETDISP‚EQU‡*#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyfac9‰IF.B1(A0)#01THEN.S„IfweareonaFACdefinition8‰BSET.B„#6,(A1)justORthenewFACbitintocurrentFAC‰ELSE.S˜otherwise&‰MOVE.B„#$44,(A1)‹resetallotherFACS‰ENDI‰ORˆ#$8000,(A0)‰Setprotectbit2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN ** EA = set protect* PROTECT‚EQU‡*9‰IF.B1(A0)#01THEN.S„IfweareonaFACdefinition8‰BSET.B„#7,(A1)justORthenewFACbitintocurrentFAC‰ELSE.S˜otherwise&‰MOVE.B„#$C4,(A1)‹resetallotherFACS‰ENDI'‰MOVE.B„FACS,(A0)‹UpdateFAConscreen.:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyfac‰ORˆ#$8000,(A0)‰Setprotectbit2‰BSR‡PROFACŽChecktoseeifFACmustbepropogated ‰BRA‡RETURN ** EB = reset protect* ALLOW„EQU‡*#‰MOVE.B„FACS,(A0)‹PutFAConscreen:‰MOVE.B„#$01,1(A0)ŠSimulatecharacterpositionusedbyfac9‰IF.B1(A0)#01THEN.S„IfweareonaFACdefinition8‰BCLR.B„#7,(A1)justORthenewFACbitintocurrentFAC‰ELSE.S˜otherwise&‰MOVE.B„#$64,(A1)‹resetallotherFACS‰ENDI0‰ORˆ#$8000,(A0)‰SetprotectbitforFACposition2‰BSR‡PROFACŽChecktoseeifFACmustbepropogatedRET.1„BRA‡RETURNŠPAGE* * F1 = reset*K* The display area is filled with spaces, all FAC's are reset, tabs are setL* every INIT_TAB spaces, the virtual screen is restored to its default size,* and the cursor is HOMEd.*RESET24?‰MOVE†#24,NUMBER_LINESSetupthesmallscreenreset.(24line) RESET253ŠBSR„SCRNINIT‹Resetalltheparameterstodefaults. *‚Fillthescreenwithblanks.4ŠLEA„SCREEN,A0ŠA0<--startaddrofabsolutescreen.5ŠMOVEƒ#$4400,D2ŠD2<--defaultattributesandaspace*§charforfillingthescreen.:ŠMOVEƒNUMBER_LINES,D5„D5<--#ofcharactersonscreen-1<ŠMULUƒCPERLINE,D5ˆ*‚=linesperscreen*charsperline-1. ŠSUBQƒ#1,D5Ž* DO.SŠWhiletherearemoretabstoplace, 5ŠBSETW‚#7,(A0)ŒSetatabinthispositionandadvance%ŠADD.L‚#2*INIT_TAB,A0…INIT_TABchars. 0ŠSUBQƒ#1,D5ŽKeepgoinguntilalltabsareplacedŠENDW–onthisline. /ŠMOVEƒBPERLINE,A0ˆA0.L<--addressofnextline7ŠADD.L‚(SP)+,A0‹*„=addroflastline+bytesperline. 0ŠSUBQƒ#1,D2ŽKeepgoinguntilalllinesaredone. ŠUNTIL‚*ŠSF…EDIT_FLAGŠCleareditmodeŠSF…PAGEFLAG‹pagemodeŠSF…PROMODEŒandprotectmode.;ŠMOVE.LƒB.LINE,D6ˆHomeroutineneedsbytespervirtuallineBŠMOVE…#25,NUMBER_LINESResetlines/screenbecausewemayhavedone*£a24linereset.ŠBRA‡HOMEŒHomethecursor.‰PAGE* * DISPLAYL*---------------------------------------------------------------------------L* 1. Write the requested character in the display RAM at the current cursor.I* 2. Seek a non-protected spot to the right, with line and page rollover.6*„ifnonefound,soundbell,andstayatcurrentspot.,* 3. Update the cursor register of the CRTC.** Input parameters:*------------------4* A0.L = current cursor posiotion in the display RAM8* D2.L = $000000XX, where XX is the requested character.0* D3.W = Maximum number of characters on screen.F* FACS = An XREFed, word sized register containing the FACs in effect.* DISPLAY‚EQU‡* ‰IF.B†PAGEFLAG#TRUETHEN.S“BRA.SDISPLAY1‰ENDI/‰TST‡(A0)Checkforcursorinaprotectedfield‰BPL.S…DISPLAY1ŒBranchifnot*<*„Cursorisinaprotectedfield--wecanonlyacceptaFAC*%‰TST.B…D2’CheckifcharacterisaFAC‰IFTHEN.S BRAOUTCH1‰ENDI*BSR.SSEEKRNotaFACsoseekunprotectedDISPLAY1‰BSR‡PROFACŽPropogateFAC:‰MOVE.B„FACS,(A0)+ŠMovecurrentFACStocurrentScreenloc%‰AND.B…#$80,(A0)‹Keeptabinformation,‰OR.B†D2,(A0)+ŒWritecharactertothescreen‰IF.LƒA0E.LINETHEN.S1‰ADD.L‚D5,S.LINEŽUpdatebeginningandendingline5‰ADD.L‚D5,E.LINEŽaddressesbecauseweareabouttogo‰ENDIštothenextline.3‰BSR.S…SEEKRIfprotectedfindanunprotectedchar.#‰BRA‡WRITCRSRŒUpdatecurrentcursor*?* Starting at the current display address, find an un-protected* spot to the right.* SEEKR„EQU‡* ‰IF.BPAGEFLAG#TRUETHEN.S“RTS‰ENDI ‰MOVE.L„A0,A3Setuptermination‰IF.L†A0S.LINETHEN.S‰REPEAT D*„IftheEndofLinecharacterisinthefirstcharacterpositionofB*„aline,whileweareinprotectmode,‚thecursorismoveddowna*„line. ‰IF.B‚1(A0)#00THEN.S!‰ADD.L…D5,A0Updatestartofline‰MOVE.L„A0,S.LINE‹*+‰ADD.L…D5,E.LINE‹Updateendofvirtualline‰ELSE.S4‰BRA.S…SEEKR1ŽIfEndofLineisnotatthebeginning'*¦oftheline--goaheadandseekright.‰ENDI‰UNTIL.LA0A3‰RTS‰ENDI*7*„Findanunprotectedcharacterpositiononthescreen.*SEEKR1‰REPEAT‰IF.L†A0E.SCRNTHEN.S9‰MOVE.L„S.SCRN,A0‹Wrapthesearchforanunprotectedchar2‰MOVE.L„A0,S.LINE‹Updatebeginningandendingadr.‰MOVE.L„A0,E.LINE‹*‰ADD.L…D6,E.LINE‹*,‰BRA.S…SEEKR2Ž*Checktoseeifwearedone.‰ENDI‰IF.L†A0E.LINETHEN.S#‰ADD.L…D5,(A2)Updatestartofline‰ADD.L…D5,4(A2)Œandendofline‰MOVE.L„S.LINE,A0,‰BRA.S…SEEKR2Ž*Checktoseeifwearedone.‰ENDI2‰TST.W…(A0)+Unprotectedfieldsaretheoneswhere*¦bit8isturnedoff.‰IFTHEN.S5‰TST.B‚-1(A0)‘Makesurewearen'tattheendofline.‰IF‚THEN.S5‰ADD.LƒD5,S.LINEInprotectmodethecursorcannotbe%*¦onanendofline--updatepointers.‰ADD.LƒD5,E.LINEƒ*‰MOVE.L‚S.LINE,A0*3‰BRA.SƒSEEKR2Gomakesurewedidn'tgooff-screen.‰ENDI3‰SUBQ.L„#2,A0Characternotprotectedupdatecursor*¦becauseofauto-increment.‰RTS‰ENDISEEKR2‰UNTIL.LA0A3*C*‚Therearenounprotectedfieldsonthescreensohomethecursor.**:‰MOVE.L„S.SCRN,A0‹Setcursoraddresstobeginningofscrn.8‰MOVE.L„A0,S.LINE‹Updatebeginningandendinglineptrs.‰ADD.L…D5,4(A2)Œ**‰RTS‡RETURNŽExitnounprotectedareafound‰PAGEWRITCRSREQU‡**E 9* Convert display RAM address to absolute cursor address,* and write into CRTC.** A0.L = Diaplay cursor address*/‰MOVE.L„A0,D1Calculatecursorabsoluteaddress‰SUB.L…#SCREEN,D1+‰LSR.L…#1,D1Totakecareofattributearea WRITEABSEQU‡**/* Write the absolute cursor address in the CRTC* * D1.W = absolute cursor address*!‰MOVE.B„#$0F,CRTCADDˆPointtoR152‰MOVE.B„D1,CRTCREGŠStoreLSBofnewcursoraddress ‰LSR.W…#8,D1Positionupperbyte!‰MOVE.B„#$0E,CRTCADDˆPointtoR143‰MOVE.B„D1,CRTCREGŠSroreMSBofnewcursorregister 6RETURNƒMOVEM.Lƒ(A7)+,D0-D7/A0-A3ƒRestoreuser'svalues‰RTS‰PAGEREADCRSREQU‡***‚Readthecursorposition*6*‚Thisroutineisforinternaluse,andisnotXDEFed.)*‚ForanexternalcontrolroutineseeC6.**‚Inputparametersƒ:none*>*‚Registersaffected:D1.W=Absoluteaddressofcursorspot.&*—A0.L=ScreenRAMaddressofcursor.*‰CLR.L…D1’HSKP!‰MOVE.B„#$0E,CRTCADDˆPointtoR14.‰MOVE.B„CRTCREG,D1ŠGetcurrentcursorposition‰ROL.W…#8,D1PutitinMSB!‰MOVE.B„#$0F,CRTCADDˆPointtoR154‰MOVE.B„CRTCREG,D1ŠGetlowerbyteofcursorposition-‰LSL.W…#1,D1AdjustforscreenRAMoperations ‰MOVE.L„D1,A0‰ADD.L…#SCREEN,A0‰RTS***GET_CHAR3‰STˆCHAR_RESERVED‡Reservenextcharacterforcaller>‰MOVE.L„(A7)+,CHAR_OWNER„Savecallersreturnaddressforlater'‰BRA‡RETURNŽWaitforthenextcharacter**ˆPROPOGATEFACCODE*PROFAC‰IF.L‚A0E.LINETHEN.S ‰MOVE.LA0,A10‰MOVE.B(A1),D0GettheFACwhichwillbemoved.'‰ADDQ.L#2,A1’Getoffcurrentlocation.‰WHILE.L‚A1E.LINEDO.S2‰IF.Bƒ1(A1)#00THEN.S‚Checkforendofline.7‰BRA.S‚PROFAC1Branchifweareattheendoftheline.‰ENDI3‰CMP.B‚#1,1(A1)StopifweareonaFACdefinition.‰BEQ.SPROFAC1A*1‰MOVE.BD0,(A1)MovetheFACcodetoendofline.‰ADDQ.L#2,A1’*‰ENDW‰BRA.SPROFAC1‰ENDIPROFAC1A)‰MOVE.L„A0,A1Savecurrentcursoraddress‰IF.L†A1S.LINETHEN.S‰RTS›Exit--nothingtodo‰ENDI1‰MOVE.B-1(A1),D3ŽTherecouldbeatabstophere.%*¦Let'sturnthebitoffbeforewego*¦on.‰AND.B#$7F,D3‘*%‰IF‚‚THEN.SŽExit--nothingtodo‰RTS‰ENDI‰WHILE.LA1S.LINEDO.S@‰IF.B-1(A1)#01THEN.SƒTrytofindwhereaFACwasdefined‰MOVE.B-2(A1),D0‰BRA.SƒPROFAC1‰ELSE.S ‰SUBQ.L‚#2,A1‰ENDI‰ENDW1‰MOVE.Bƒ#DISPLAY_FAC,D0‡UseadisplayFACbecause*©a01wasnotfound.8‰MOVE.BƒD0,FACSŽUpdatetheFACfortherestoftheline.PROFAC1 ‰MOVE.L‚A0,A1‰WHILE.LA1S.LINEDO.S'‰MOVE.B‚-(A1),D3Getpreviouscharacter,‰AND.Bƒ#$7F,D3Checkiflineendortabonly‰BNE.S„PROFAC2,‰OR.B„#$20,(A1)Removeendoflinecharacter!‰MOVE.B‚D0,-(A1)ŽUpdateFACcode.‰ENDWPROFAC2‰RTS‰ENDéééééF ǰ9TERMDRVƒIDNTƒ4,1‡VERSADOSTERMINALDRIVERWITHTYPE-AHEAD6ŠTTL„TERMDRV:‚VERSADOSTERMINALDRIVERWITHTYPE-AHEAD ŠLLENƒ120J**************************************************************************J**************************************************************************J**************************************************************************J***************************************************************************4*‰TERMDRV:‚VERSAdosterminaldriverwithtype-ahead.*?*‰Purpose:‚VERSAdosdevicedrivertohandletheVME/10keyboard *&screen.**‰Revisionhistory:4*‘1/15/85‚Addedcodetoreturnerrorcodetouserin,*šhaltI/Oparameterblock.Returnof$E6in*šoriginalI/Oparameterblock.ééééé ²¹Â%ÊGÒ6Ú6âTê=òOú6 B 1 : B "8 *< 2> :4 B9 J@ RC ZK b; jA rG zF ‚9 ŠD ’; šA ¢79*01/30/85‚Modified‚KEYBRD.AG,OUTCHS.SA,POUTCHS.SA,and.*šEDITMODE.SA‚tousetheBELLinthekeyboard.?*10/10/84‚Therewasaproblemifanyotherboardinthesystem0*šisconfiguredtousethesameinterruptlevel,-*šbecauseGET_CHARassumesthattheinterrupt*šisalwaysforhim.,*šFixedGET_CHARtosendbackbothZbitand)*šVbitsetiftheinterruptisnotours,+*šsothatIN_CHARwillpassitalongtothe1*šmaininterrupthandler,andwewillthenreturn4*štoCMRwiththecarrybitclearedtoindicatethat *štheinterruptisnotours.†bwn;*‘2/9/84‚FixedproblemwithREADTERMINATORinitialization*šinsubroutineSETUP.6*‘7/19/83‚ChangedRESETcommandsenttoOUTCHSto$F7.**‘6/3/83‚InitialwritingbySteveFranck.**‰RMS68Kroutinesused: *TR0$.RQPA *TR0$.QEVENT*TR0$.QEVENTI *TR0$.LOGPHY *TR0$.KILLER *TR0$.GETTCB**‰Othernotes:6*CurrentlythiscodeisneitherROMablenorposition-*’independent.'*AssembleusingchainfileTERMDRV.AF.*J**************************************************************************J**************************************************************************J**************************************************************************J**************************************************************************‰PAGE*F*‚Toassemblethiscodeforitspropertargetenvironment,changethisF ééA*‚equate,whichwillserveasaswitchinconditionalassemblies.2*‚Validvaluesfortheswitchare:‚'7201','EX/S'.(*‚FORNOW,THISSWITCHMUSTBE'EX/S'!!!*ENVIRONMENT EQU 'EX/S' * *‚XDEF's.*8ŠXDEFƒGOT_CHAR‹Entrypointfordrivertoreceiveachar.7ŠXDEFƒCHECK_WORK‰Backgroundexec'sentrypointtocheck*§formorework. * *‚XREF's.*=ŠXREFƒSTOP_IT,UNSTOP…Device-specificroutinestostopfurther&*§trafficfromthedeviceandtoallow *§itagain. ‰IFEQ†ENVIRONMENT-'EX/S'"*§Subroutinesforinitializingand'*§controllingVME/10keyboard&screen."ŠXREFƒINIT_KEYBOARD,IN_CHAR,OUTCHS‰ENDC  **‚Equatefilesincluded:**‰EQUSTR*‰EQUTCB*‰EQUCCB*‰VMES10.IOE.SA*‰NIO*‰LV5&*‰NEC7201‚onlyifENVIRONMENT='7201'*‰VMES10.TERMDRV.EQ*ŠNOLISTŠINCLUDE9995.&.STR.EQŠNOLISTŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠLISTŠPAGEO*********************************************************************************‰NOTESONCODINGSTANDARDS*O******************************************************************************* G*‚BecausethisisanI/Odriver,speedisoftheutmostimportance,andG*‚asaresulttradeoffsweremadedecreasingthestraightforwardnessofL*‚thecodeinfavoroflesstimespentprocessinginterrupts.‚Inparticular,F*‚theinterruptserviceportionofthisdriverisnotatallmodular--H*‚some'routines'havemultipleentryandexitpoints,andreturnisnot*‚alwaystothecaller.*G*‚OnevisualaidusedwhichmaysaveyousomeworkistheuseoflabelsD*‚inexecutablecode.‚Considerthefollowingsampleprogramsegment:*.*‰LABEL1:˜labelaloneonline,followedby':'*‘MOVE.B......7*‰LABEL2:ADD.B‚......Šlabelnotalone,followedby':'-*‰LABEL3‚CMP.B‚......Šlabelnotalone,no':'*F*‚Eachwayofwritingthelabelhasitsownsignificance.‚LABEL1marksC*‚thebeginningofalogicalmodule,andnothingfallsintoLABEL1.G*‚LABEL2isalabelbranchedtofromoutsidethelogicalmodule.‚LABEL3F*‚isa'local'label,branchedtoonlyfromwithinthelogicalmodule.  >*‚Foreachsubroutine,registerusageisspecifiedasfollows:**‰Entry:A5=addressofCCB**‰Exit:‚A0=garbage"*A1=addressofoursideof7201*G*‚TheentryconditionsspecifyonlytheREQUIREMENTSoftheroutine.‚InI*‚otherwords,aregistermaybeknowntocontainaparticularvalue,butI*‚ifitisnotusedbyaroutine,itisnotlistedasanentrycondition.J*‚TheexitconditionslistonlythoseregisterswhichCHANGE.‚IntheaboveH*‚example,thefactthatA5isnotlistedasanexitconditionindicates"*‚thatitstillpointstotheCCB.*J*‚Ifamoduledoesnotrepresentasubroutine(thatis,willnotreturntoK*‚thecodeitwasenteredfrom),theexitconditionsfortheregisterswill*‚notbespecified.ŠPAGEO******************************************************************************** *‰EQUATES*O******************************************************************************* *,* EQUATES FOR SOME SPECIAL ASCII CHARACTERS.*'NUL†EQU‡$00‡Nullchar.‚Usuallyignored..BEL†EQU‡$07‡Bellchar.‚Ringsbellonterminal.BS‡EQU‡$08‡Backspacechar.6LF‡EQU‡$0A‡Linefeedchar.‚Causescursortomovedown.=CR‡EQU‡$0D†Carriagereturnchar.‚Movescursortoleftmargin.SPACE„EQU‡$20‡Spacechar.$L_ARROW‚EQU‡$3C‡Left‚arrowchar'<'.%G R_ARROW‚EQU‡$3E‡Rightarrowchar'>'.#BKSLASH‚EQU‡$5C‡Backslashchar'\'.'CARET„EQU‡$5E‡Uparrow(caret)char'^'.8DEL†EQU‡$7F‡Deletechar(alsocalled'rubout').‚LikeBS. $HI_CTLƒEQU‡$1F‡Highestcontrolchar. IBS_SP_BSEQUBS<<24+SPACE<<16+BS<<8‚Backspace,space,backspaceallleft-*§justifiedin32bits. *?*‚Masksdelineatingallrecognized(REC)andunrecognized(UNR)(*‚attributes(ATT)andparameters(PAR).*‰IFEQ†ENVIRONMENT-'EX/S'BREC_ATTƒEQU„%1000001111000001‚1bitsrepresentdefinedattributes.CUNR_ATTƒEQU„$FFFF-REC_ATT†The1'scomplementofthatareundefined. BREC_PARƒEQU„%0111011111111111‚1bitsrepresentdefinedparameters.CUNR_PARƒEQU„$FFFF-REC_PAR†The1'scomplementofthatareundefined.‰ENDC ŠPAGE**‚Miscellaneousequates.* *IOEVCD„EQU„1’Eventcodewewilluse(I/O). ;BRK_LENƒEQU„300#ofmillisecondstomaintainbreaksignal. *I*‚Thisisasemi-arbitraryvaluethatcanbewrittenouttoaregisteronH*‚somedeviceandthenreadback,inordertotest(inaverysmallway)C*‚thedevice'shealth.‚Onthe7201,forexample,thisiswrittento*‚thevectorregister(2B).*TEST_VAL‚EQU„$17ŠPAGEK*****************************************************************************‰EQUATESFORTRANSPARENTMODE*K*************************************************************************** *F*‚EquatesdescribingthepartoftheCSBusedwhensettingTRANSPARENTH*‚MODE.‚WepassthedrivertheaddressofourbranchtableandhepassesI*‚usbacktheaddressofhisbranchtable,thevalueweshouldhaveinA5G*‚whenwecallhim,andtheSRthatweshoulduse.‚Actually,wemayuseG*‚adifferentSRaslongasthesupervisorbitissetandtheinterrupt9*‚levelisnotlowerthantheoneintheSRhepassesus.*7ŠOFFSETIOSTTMThisstuffwillbeintheCSBatIOSTTM.9IOSTMU„DS.Bƒ4’Heretheuserwillstore,beforemakingthe&*§CHANGEDEFAULTScall,theaddressof*§histableofbranches. 7ŠOFFSETIOSTTMThisstuffwillbeintheCSBatIOSTTM.9IOSTMD„DS.Bƒ4’theaddrofthedriver'stableofbranches;/IOSTMA„DS.Bƒ4’thevaluethedriverwantsinA5;5IOSTMS„DS.Bƒ2’theSRwiththeMINIMUMinterruptlevel*§set. 5ŠOFFSET0ŽThisdefinestheuser'sTMinterfacetable.*£WeJSRtothisentrywhen:#TM_RCA„DS.Bƒ4’...wereceiveachar.7TM_TBE„DS.Bƒ4’...webecomecapableofanothertransmit.2TM_BRK_RECVDS.B4’...wedetectanincomingbreak.