IMD 1.17: 25/11/2014 13:11:05 82VKXBVERDOS D* BT22:0 68K VERSADOS/RMS68K OBJECT 4.5 (DS,DD 96 tpi 5.1/4" DISK) REVISED: 04/22/86 DISK 22 OF 24  BT22 82VKXBVERDOS 0420²a-@=H7PAXG *‚Equatefilesincluded:* *‰NEC7201*‰EQUSTR*‰EQUCCB *‰KILL.MC *‰KILLDRV.EQ ŠNOLISTŠINCLUDE9995.&.NEC7201.EQŠINCLUDE9995.&.STR.EQŠNOLISTŠINCLUDE9995.&.CCB.EQŠNOLISTŠINCLUDE9995.&.KILL.MCŠNOLISTŠINCLUDE9995.&.KILLDRV.EQŠLISTŠPAGEJ***************************************************************************!*‰CCB--DEVICEDEPENDENTPORTION*>*‰Workingstorageforthedriverisdefinedinthebottompart *‰oftheCCB.*J************************************************************************** *D*‡AtafixedlocationintheCCBwewillhavesomefieldswhichwillD*‚interfaceustoSDLC.‚Whenthesystemisbooted,wemayinfactbeE*‚usingbothterminals.‚ButsometimelaterSDLCmaybebroughtup,atI*‚whichtimehewillcapturethevectorforthe7201andsettheSDLCACTVF*‚inourCCB.‚Whenaninterruptoccurs,then,hegetsit.‚IfitisnotF*‚forhim,heputsthecontentsofregister2B(whichmayonlybereadF*‚onceforagiveninterrupt)andputstheminourCCB,andthenjumps**‚intoourCCBsoastofakeaninterrupt.@*‡Whenwegetcontrol,wehavetolookattheSDLCACTVtoseeifF*‚weshouldreadtheactualchipornot.‚Fromtherethingshappenjust.*‚likealways(thesubordinateisn'tchanged).* ŠOFFSET$FE ŠIFGTƒCCBDDP-*'ŠFAILƒ499HavetomoveSDLCstuffdown!ŠENDC ;SDLCACTV‚DS.Bƒ1’FlagindicatingpresenceofSDLConsystem.&*§0=SDLCnotpresent;readthechip.&*§nonzero=SDLCpresent;getregister*§2BfromtheCCB.:REG2BSAVEDS.Bƒ1’IfSDLCisactiveandaninterruptforus&*§occurred,hereiswherehesavedthe*§contentsof7201register2B.‰PAGEO*********************************************************************************ˆMACROS*O******************************************************************************* *.*‚Macrostopushandpopusingthestack(A7).*‚e.g.,„PUSH.B#'*'ƒorƒPOP.LD0* PUSH…MACRO‰MOVE.\0ƒ\1,-(A7)‰ENDM POP†MACRO‰MOVE.\0ƒ(A7)+,\1‰ENDM *$*‚Macrostocreatetheoffsettable.M*‚GEN16OFFSETjustcallsGEN1OFFSET16timessoIdon'thavetotypesomuch.I*‚GEN1OFFSETincrementsVALUEandfiguresoutwhetherthatvalue,ifreadN*‚fromaPIAcontrolregister,wouldindicateaDSRinterrupt,aRIinterrupt,/*‚orboth,andgeneratesanappropriateoffset:?*„-4=nointerrupt…0=RIinterrupt…4=DSRinterrupt„8=bothC*‚Ifthecontrolregisterfits%1xxxxxx1,aDSRinterruptoccurred.K*‚Ifthecontrolregisterfits%x10x1xxx,aRI‚interruptoccurred(the0isB*‚toselectthatpinasaninterruptinputratherthananoutput).*GEN16OFFSET MACRO GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET GEN1OFFSET ENDM GEN1OFFSET MACRO OFFSET SET -4N IFEQ (%01101000&VALUE)-%01001000 if RI interrupts enabled and flag is set....OFFSET SET OFFSET+4 ENDCO IFEQ (%10000001&VALUE)-%10000001 if DSR interrupts enabled and flag is set....OFFSET SET OFFSET+8 ENDC LIST VALUE SET VALUE Control register DC.B OFFSET ... and offset. NOLISTVALUE SET VALUE+1 ENDMŠPAGE*4*‚EquatesrelatingtothePIAontheMVME400board.*?*‰offsetsfromtheaddressofthe7201A-sidecontrolregister:*6PIADDR_A‚EQU„-$CPIA'sA-sideDataDirectionRegister.*‰includedisaparametertellingthenumberofextrapagesof>*‰memorytoincludeintheCCB,andinformationdescribingthe*‰revisionofthedriver.*L**************************************************************************** ŠSECTION‚0ŠOPT„BRS MPSCSPR: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!*=ŠDC.LƒINTERRUPT-MPSCSPR‚Addressofinterruptserviceroutine.9ŠDC.LƒCOMMAND-MPSCSPR„Addressofcommandserviceroutine.5ŠDC.LƒINIT-MPSCSPR‡Addressofinitializationroutine.ŠDC.Lƒ0’Reserved. **‚OtherCMRparameters.*0ŠDC.Bƒ0’#ofextrapagesintheCCB.‚TheCCBmay)*§beanysizefrom1to256pages(apage'*§is256bytes):‚ifthisfieldis0,it*§willbe1page,etc.ŠDC.Bƒ0,0,0ŽReserved.ŠDC.Lƒ0,0,0ŽReserved. **‚Revisioninfo:*/ŠDC.Bƒ'121085'‹DateoflastassemblyasMMDDYY.1ŠDC.Bƒ''Spaceindicatesnopatchesto.LOfile.)ŠDC.Bƒ'4'MajorVERSAdosrevisionnumber.ŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INITIALIZATIONROUTINE*'*‰Entry:Allregistershavebeensaved.*A5=addressofCCB.**‰ExitstoCMR(viaRTS).*J**************************************************************************J**************************************************************************J**************************************************************************  INIT: *1*‚Wedon'thaveanythingtodoininitialization.*ŠRTSŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰COMMANDSERVICEROUTINE*J**************************************************************************J**************************************************************************J************************************************************************** COMMAND: *D*‚Weshouldneverbecalledforcommandservice!‚Sincewehavebeen,*‚crashthesystem.*-ŠKILL.DRIVERMPSCSPR_ID,NOCMD_SERV,A5,#NO_DCBŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INTERRUPTHANDLINGROUTINE*;*‰Thisroutinegetscontrolwheneveraninterruptoccurson ;*‰thisvector(unlessanotherhandler,earlieronthechain*‰forthisvector,claimedit).*+*‰Itisthetaskofthesupervisor(me)to:7*--determinewhethertheinterruptisfrommydevices*“(7201andPIA)2*--ifnot,returntoCMRwiththecarrybit0to)*“indicatethattheinterruptwasn'tmine7*--ifso,setuptheenvironmentforandpasscontrol3*“totheappropriatesubordinatehandler,depending3*“uponwhichdevice&sidetheinterruptcamefrom.*<*‰IfSDLCisactive,insteadofreadingregister2Bfromthe8*‰7201,wegetthecopysavedforusinourCCBbySDLC.*J**************************************************************************J**************************************************************************J************************************************************************** INTERRUPT: ŠPUSH.LD1‘SaveD1onthestack.4ŠMOVE.LCCBCHB(A5),A0†A0<--addrofAsideof7201. *.*‚IstheinterruptfromtheAsideofourPIA?*)ŠCLR.W‚D0‘D0<--A-sidecontrolregister.ŠMOVE.BPIACTL_A(A0),D0„*:ŠMOVE.BPIAPER_A(A0),D1„D1<--A-sideperipheralregister.!*§ThisalsoclearsthePIAA-side%*§interruptiftherewasonepending.AŠMOVE.BOFFSET_TABLE(PC,D0),D0‚D0<--theoffsetcorrespondingto%*§thecontrolregistervalueweread. 2ŠIF…THENŠIfit's>=0,we'vegotaninterrupt*§fortheAside,so ;ŠMOVE.LCCBSUB(A5),A5†A5<--addrofCCBofA-sidehandler.=ŠMOVE.LCCBRTNI(A5),A1…A1<--entrypointforA-sidehandler.:ŠJMP„8*4(A1,D0.W)‡Jumpintothebranchtable(the8*4gets'*§uspastthefirst8branchesintothe'*§PIA-causedbranchesfortheMVME400) ŠENDI *;*‚It'snotfromtheAsideofthePIA;isitfromour7201?L*‚IfSDLChastakenoverthevector,getthe7201vectorfromtheCCBratherK*‚thanfromthe7201.‚Besuretomaskofftheunwantedbitsfromthevector*‚ineithercase.*7ŠMOVEQ‚#$1C,D0ŒD0<--masktogetridofunwantedbits. &ŠTST.B‚SDLCACTV(A5)‡IfSDLCisactive,ŠIF…THENŠ* AŠAND.B‚REG2BSAVE(A5),D0ƒD0<--vectorfromCCBwhereSDLCputit. ŠELSE–else(SDLCnotup), :ŠMOVE.B#NCW0RG2,CREG+2(A0)Pointtoregister2onportB.1ŠAND.B‚SREG+2(A0),D0†D0<--vectorfromthe7201. ŠENDI–* :ŠBTST.B#1,SREG(A0)ˆIftheinterruptpendingbit(bit1of3ŠIF…THENŠstatusregister0A)isset,thenit's*§aninterruptfromour7201. ;ŠMOVE.LCCBSUB(A5),A5†A5<--addrofCCBofA-sidehandler.3ŠBCLRƒ#4,D0ŽCleartheB-side/A-sidebitofthe72017ŠIF…THENŠvector.‚Ifitwasalreadyclear(B-side),;ŠMOVE.LCCBSUB(A5),A5†A5<--addrofCCBofB-sidehandler.ŠENDI–* =ŠMOVE.LCCBRTNI(A5),A1…A1<--entrypointforchosenhandler.:ŠJMP„4*4(A1,D0.W)‡Branchintotheuser'sbranchtable(the$*§4*4getsuspasttheVM02branches*§intotheMVME400branches). ŠENDI *I*‚TheinterruptisnotfromtheAsideofourPIAorfromour7201;isit*‚fromtheBsideofourPIA?*7ŠMOVE.BPIACTL_B(A0),D0„D0<--B-sidecontrolregister.AŠMOVE.BOFFSET_TABLE(PC,D0),D0‚D0<--offsetcorrespondingtothe!*§controlregistervalueweread.4ŠIF…THENŠIfit's>=0,wehaveaninterrupt,so 6ŠTST.B‚PIAPER_B(A0)‡Cleartheinterruptbyreadingthe"*§B-sideperipheraldataregister.;ŠMOVE.LCCBSUB(A5),A5†A5<--addrofCCBofA-sidehandler.;ŠMOVE.LCCBSUB(A5),A5†A5<--addrofCCBofB-sidehandler.=ŠMOVE.LCCBRTNI(A5),A1…A1<--entrypointforB-sidehandler.:ŠJMP„8*4(A1,D0.W)‡Jumpintothebranchtable(the8*4gets'*§uspastthefirst8branchesintothe'*§PIA-causedbranchesfortheMVME400) ŠENDI *1*‚Theinterruptwasnotforme,soreturntoCMR.*1ŠPOP.L‚D1‘RestoreD1andreturntoCMR.‚Thecarry-ŠRTS—bitis0fromtheAND,whichwillsignal-*£toCMRthatwedidn'thandletheinterrupt.  *G*‚NOTE:‚thesubordinatechannel'sinterruptentrypointmustbeginwith*‚codelikethefollowing:* *‚INTERUPT:*‚*…VM03interrupts *ŒBRA.L‚TBE *ŒBRA.L‚ES *ŒBRA.L‚RCA  *ŒBRA.L‚SRC*‚*…MVME400interrupts*ŒBRA.L‚TBE400 *ŒBRA.L‚ES400*ŒBRA.L‚RCA400*ŒBRA.L‚SRC400 *ŒBRA.L‚RI *ŒBRA.L‚DSR3*ŒBRA.L‚RIANDDSR…(RIandDSRbothoccurredatonce)*E*‚Thesubordinatechannelmayusefreely(withoutPUSHing)anyofthe)*‚followingregisters:…D0,D1,A0,A1,A5*E*‚A0containstheaddressoftheAsidecontrolregisterofthe7201.3*‚A5containstheaddressofthesubordinate'sCCB.H*‚D1containsthecontentsofthePIA'sA-sideperipheraldataregister,A*…whichyoumightwanttosaveawayincaseDSRstatusisneeded.*C*‚D1mustberestored(viaaPOP.LD1)beforethesubordinateexits*‚fromitsinterrupttour.*ŠPAGEO*******************************************************************************O********************************************************************************.*‰OFFSETTABLEFORPIACONTROLREGISTERVALUES*<*‰ThefollowingprocedureisusedtodeterminewhetheraPIA$*‰isinterruptingonacertainside:=*‰1)the8-bitvaluefromthePIA'scontrolregisterisread.6*‰2)thecorrespondingoffsetisreadfromthistable.A*‰3)iftheoffsetis-4=$FC,thereisnointerruptonthatside;%*Œotherwisetheoffsetisasfollows:*Œ0=RIinterrupt.*Œ4=DSRinterrupt.*Œ8=RIandDSRinterrupts.*0*‰Readthehexpartofatableentryasfollows: *”000000XX*‰0YYYYYYYYZZ*,*‰XX=thecontrolregistervalue(00-FF).:*‰YYYYYYYY=thelocationofthisentrywithinthedriver.%*‰ZZ=theoffset(FC,00,04,or08)*O*******************************************************************************O******************************************************************************* OFFSET_TABLE: ŠNOLIST VALUE…SET„0 ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSET ŠGEN16OFFSETŠLIST ŠEND:MPSCSUPƒIDNTƒ45,0†NEC7201supervisordriverforVM03board6ŠTTL„MPSCSUP:‚NEC7201supervisordriverforVM03board ŠLLENƒ120J**************************************************************************J**************************************************************************J**************************************************************************J***************************************************************************<*‰MPSCSUP:‚SupervisorchanneldriverforNEC7201driverson*theVM03board.*=*‰Purpose:‚VERSAdosdevicedrivertotakeinterruptsfromthe1*NEC7201chiponaVM03andpasscontroltothe"*appropriatesubordinatechannel.**‰Revisionhistory:**‘9/16/82‚InitialreleasebySteveFranck.*7*12/10/85‚InstallNEWKillermodificationwhichleaves,*šTheDriverID(Number)andReason(Number)2*šinCRASHSAValongwiththeCCBandDCBpointers.*;*‰Interface:‚Thisdriverdoesnotservicecommands.‚Whenan4*interruptoccurs,thisdrivercheckswhetheritis3*fromthe7201forwhichitisresponsible.‚Ifso,1*itdetermineswhichsideofthe7201causedthe1*interruptandpassescontroltotheappropriate8*subordinatehandler,usingtheCCBSUBlinkintheCCB.**‰RMS68Kroutinesused:*TR0$.DRIVKILL**‰Othernotes:4*Thissupervisorrequiresthatsubordinatechannels6*forbothofthe7201portsbeallocatedandthatthe(*channelforportAbeallocatedfirst.*ThiscodeisROMable.'*AssembleusingchainfileMPSCSUP.AF.*J**************************************************************************J**************************************************************************J**************************************************************************J**************************************************************************  **‚Equatefilesincluded:* *‰NEC7201*‰9995.&.STR.EQ*‰CCB *‰KILL.MC *‰KILLDRV.EQ*ŠNOLISTŠINCLUDE9995.&.NEC7201.EQŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.CCB.EQ `:i?q@y45ŠINCLUDE9995.&.KILL.MCŠINCLUDE9995.&.KILLDRV.EQŠLIST‰PAGEO*********************************************************************************ˆMACROS*O******************************************************************************* *.*‚Macrostopushandpopusingthestack(A7).*‚e.g.,„PUSH.B#'*'ƒorƒPOP.LD0* PUSH…MACRO‰MOVE.\0ƒ\1,-(A7)‰ENDM POP†MACRO‰MOVE.\0ƒ(A7)+,\1‰ENDMŠPAGEJ***************************************************************************!*‰CCB--DEVICEDEPENDENTPORTION*>*‰Workingstorageforthedriverisdefinedinthebottompart *‰oftheCCB.*J************************************************************************** *D*‡AtafixedlocationintheCCBwewillhavesomefieldswhichwillD*‚interfaceustoSDLC.‚Whenthesystemisbooted,wemayinfactbeE*‚usingbothterminals.‚ButsometimelaterSDLCmaybebroughtup,atI*‚whichtimehewillcapturethevectorforthe7201andsettheSDLCACTVF*‚inourCCB.‚Whenaninterruptoccurs,then,hegetsit.‚IfitisnotF*‚forhim,heputsthecontentsofregister2B(whichmayonlybereadF*‚onceforagiveninterrupt)andputstheminourCCB,andthenjumps**‚intoourCCBsoastofakeaninterrupt.@*‡Whenwegetcontrol,wehavetolookattheSDLCACTVtoseeifF*‚weshouldreadtheactualchipornot.‚Fromtherethingshappenjust.*‚likealways(thesubordinateisn'tchanged).* ŠOFFSET$FE ŠIFGTƒCCBDDP-*'ŠFAILƒ499HavetomoveSDLCstuffdown!ŠENDC ;SDLCACTV‚DS.Bƒ1’FlagindicatingpresenceofSDLConsystem.&*§0=SDLCnotpresent;readthechip.&*§nonzero=SDLCpresent;getregister*§2BfromtheCC.:REG2BSAVEDS.Bƒ1’IfSDLCisactiveandaninterruptforus&*§occurred,hereiswherehesavedthe*§contentsof7201register2B.ŠPAGEJ***************************************************************************+*‰SERVICEVECTORTABLE,REVISIONINFO,ETC.*@*‰ThistableisexaminedbyCMRwhenthechannelisallocatedtoC*‰determinewheretogoforinterrupts,commands,&initialization.<*‰Itmustalwaysbeattheverytopofthedrivercode.‚Also>*‰includedisaparametertellingthenumberofextrapagesof>*‰memorytoincludeintheCCB,andinformationdescribingthe*‰revisionofthedriver.*L**************************************************************************** ŠSECTION‚0ŠOPT„BRS MPSCSUP: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!*=ŠDC.LƒINTERRUPT-MPSCSUP‚Addressofinterruptserviceroutine.9ŠDC.LƒCOMMAND-MPSCSUP„Addressofcommandserviceroutine.5ŠDC.LƒINIT-MPSCSUP‡Addressofinitializationroutine.ŠDC.Lƒ0’Reserved. **‚OtherCMRparameters.*0ŠDC.Bƒ0’#ofextrapagesintheCCB.‚TheCCBmay)*§beanysizefrom1to256pages(apage'*§is256bytes):‚ifthisfieldis0,it*§willbe1page,etc.ŠDC.Bƒ0,0,0ŽReserved.ŠDC.Lƒ0,0,0ŽReserved. **‚Revisioninfo:*/ŠDC.Bƒ'121085'‹DateoflastassemblyasMMDDYY.1ŠDC.Bƒ''Spaceindicatesnopatchesto.LOfile.)ŠDC.Bƒ'4'MajorVERSAdosrevisionnumber.ŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INITIALIZATIONROUTINE*'*‰Entry:Allregistershavebeensaved.*A5=addressofCCB.**‰ExitstoCMR(viaRTS).*J**************************************************************************J**************************************************************************J**************** **********************************************************  INIT: *1*‚Wedon'thaveanythingtodoininitialization.*ŠRTSŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰COMMANDSERVICEROUTINE*J**************************************************************************J**************************************************************************J************************************************************************** COMMAND: *D*‚Weshouldneverbecalledforcommandservice!‚Sincewehavebeen,*‚crashthesystem.*-ŠKILL.DRIVERMPSCSUP_ID,NOCMD_SERV,A5,#NO_DCBŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INTERRUPTHANDLINGROUTINE*;*‰Thisroutinegetscontrolwheneveraninterruptoccurson;*‰thisvector(unlessanotherhandler,earlieronthechain*‰forthisvector,claimedit).*+*‰Itisthetaskofthesupervisor(me)to:4*--determinewhethertheinterruptisfrommy72012*--ifnot,returntoCMRwiththecarrybit0to)*“indicatethattheinterruptwasn'tmine7*--ifso,setuptheenvironmentforandpasscontrol3*“totheappropriatesubordinatehandler,depending**“uponwhichsidetheinterruptcamefrom.*<*‰IfSDLCisactive,insteadofreadingregister2Bfromthe8*‰7201,wegetthecopysavedforusinourCCBbySDLC.*J**************************************************************************J**************************************************************************J************************************************************************** INTERRUPT: 4ŠMOVE.LCCBCHB(A5),A0†A0<--addrofAsideof7201. *L*‚IfSDLChastakenoverthevector,getthe7201vectorfromtheCCBratherK*‚thanfromthe7201.‚Besuretomaskofftheunwantedbitsfromthevector*‚ineithercase.*7ŠMOVEQ‚#$1C,D0ŒD0<--masktogetridofunwantedbits. &ŠTST.B‚SDLCACTV(A5)‡IfSDLCisactive,ŠIF…THENŠ* AŠAND.B‚REG2BSAVE(A5),D0ƒD0<--vectorfromCCBwhereSDLCputit. ŠELSE–else(SDLCnotup), :ŠMOVE.B#NCW0RG2,CREG+2(A0)Pointtoregister2onportB.1ŠAND.B‚SREG+2(A0),D0†D0<--vectorfromthe7201. ŠENDI–* **‚Istheinterruptforus?*:ŠBTST.B#1,SREG(A0)ˆIftheinterruptpendingbit(bit1of5ŠIF…THENŠstatusregister0A)isnotset,thenit)ŠRTS—isn'taninterruptfromour7201,so,ŠENDI–returntoCMR(thecarrybitis0from*§theANDoperation). ŠPUSH.LD1‘SaveD1onthestack.;ŠMOVE.LCCBSUB(A5),A5†A5<--addrofCCBofA-sidehandler.3ŠBCLRƒ#4,D0ŽCleartheB-side/A-sidebitofthe72017ŠIF…THENŠvector.‚Ifitwasalreadyclear(B-side),;ŠMOVE.LCCBSUB(A5),A5†A5<--addrofCCBofB-sidehandler.ŠENDI–* =ŠMOVE.LCCBRTNI(A5),A1…A1<--entrypointforchosenhandler.4ŠJMP„0(A1,D0.W)‰Branchintotheuser'sbranchtable. *G*‚NOTE:‚thesubordinatechannel'sinterruptentrypointmustbeginwith*‚codelikethefollowing:* *‚INTERRUPT: *ŒBRA.L‚TBE *ŒBRA.L‚ES *ŒBRA.L‚RCA *ŒBRA.L‚SRC*D*‚Thesubordinatechannelmayusefreely(withoutsaving)anyofthe)*‚followingregisters:…D0,D1,A0,A1,A5*E*‚A0containstheaddressoftheAsidecontrolregisterofthe7201.3*‚A5containstheaddressofthesubordinate'sCCB.*C*‚D1mustberestored(viaaPOP.LD1)beforethesubordinateexits*‚fromitsinterrupttour.* ŠENDN NŠPAGE1P050DRVƒIDNTƒ45,0ˆVERSAdosMVME050printerdriver-ŠTTL„P050DRV:„VERSAdosMVME050printerdriverNNNNNNN‰’Iš9¢<ª?²Gº@Â:ÊHÒ=Ú ŠLLENƒ120K***************************************************************************K***************************************************************************K***************************************************************************K****************************************************************************+*ˆP050DRV:‚VERSAdosMVME050printerdriver.**ˆRevisionhistory:**ˆ11/11/85‚Initialrelease.*K***************************************************************************K***************************************************************************K***************************************************************************K***************************************************************************ŠPAGEŠOPTCRE,PCS,BRS***‰XREF…PRNT_INIT‰XREF…PRNT_COMMAND‰XREF…INTR_REC‰XREF…FLT_TIMER **‚Equatefilesincluded:* *ˆ9995.&.STR.EQ*ˆ9995.&.TCB.EQ*ˆ9995.&.CCB.EQ*ˆ9995.&.IOE.EQ*ˆ9995.&.NIO.EQ*ˆ9995.&.LV5.EQ*ˆ9995.&.UTILITY.MC*ˆ9995.&.PRNT.EQ*ˆ9995.&.PRNTCCB.EQŠNOLISTŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠINCLUDE9995.&.UTILITY.MC ŠTTL…PRNT.EQŠLISTŠINCLUDE9995.&.PRNT.EQŠTTL…PRNTCCB.EQŠINCLUDE9995.&.PRNTCCB.EQŠTTL…P050DRV.SAŠPAGE/ŠOFFSET‚PCCBDDPContinuewithchannel-dependent*¦CCBvariablespace.  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  *%%%Å%%%*B*%%%„Device-dependent,channelrelated,variablesstarthere.‰%%%* *%%%Å%%%**%%%™(CCBSPACE)¡%%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* *%%%Å%%%*>*%%%„Endofdevicedependent,channelrelated,variables.%%%* *%%%Å%%%**%%%•ENDOFCCBSPACE %%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  3CCBSIZEBEQU†*–CCBSIZEBdefinesthesize(inbytes)$*¦ofacompleteCCBforthisdriver. %*¨CCBSIZEdefinesthesize(inpages)CL0080„EQU†CCBSIZEB+PAGESIZE-1‚ofaCCBforthedriver,andEXTCCBSZ=CCBSIZE‚EQU†L0080/PAGESIZE‡definesthesize(inpages)ofthe>EXTCCBSZEQU†CCBSIZE-1ŒextendedportionofaCCB.Theextended(*¦portionoftheCCBisusedexclusively)*¦fordevice-dependentvariablesthatare(*¦requiredbythedriver.‚Thereare$100'*¦bytesperpageofmemory,andtheCCB)*¦isdynamicallyallocatedasanintegral*¦numberofpages.‰PAGE** DEVICE EQUATES:*(DEV1AD„EQU†0“A-sidedata„registeroffset+DEV1AC„EQU†2“A-sidecontrolregisteroffset(DEV1BD„EQU†4“B-sidedata„registeroffset+DEV1BC„EQU†6“B-sidecontrolregisteroffset 6BIM_CTL3‚EQU†$FFFF10C7‹AddressofBIM#1controlreg35BIM_VEC3‚EQU†$FFFF10CF‹AddressofBIM#1vector‚reg3&IRE‡EQU†4“Interruptrequestenablebit **‚Definitions:*$*‚Name„AddressƒR/WƒLevel‡Description3*‚----„-------ƒ---ƒ-----‡--------------------------/*DEV1ADƒFFXX81„(W)Printeroutputdata(D0-D7)(*”(R)Puts$FFintoprinteroutregister6*DEV1ACƒFFXX83„(W)ƒhigh->lowƒD3=printerdatastrobe%*”(R)ClearsACKflagandprinterIRQ,*DEV1BDƒFFXX85„(W)Hardwarebufferconflict*”(R)Printerstatus*šhighŠD0=printerisselected*šhighŠD1=printerisbusy*šlow‹D2=faultfromprinter$*šhighŠD7=acknowledgefromprinter6*DEV1BCƒFFXX87„(W)ƒhigh->lowƒD3=printerinputprime*”(R)nooperation*‰PAGE ‰SECTION0O********************************************************************************1*ˆSERVICEVECTORTABLE,PARAMETERS,REVISIONINFO*@*ˆThefirst‚several‚locationsofevery‚I/OdrivermustcontainaB*ˆservicevectortabletocontainthe‚long-wordrelativeaddressesB*ˆofthethreedriversubroutinesthatCMRuses.‚TheCMRparameterC*ˆtableimmediatelyfollowstheservicevectortableandincludesaA*ˆfieldtelling‚CMR‚howmanyextrapages‚toallocatefortheCCB.E*ˆTherevisiontableimmediatelyfollowsthetheCMRparametertable.*O*******************************************************************************O******************************************************************************* ‰SECTION‚0 P050DRV: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!* <‰DC.L…INTERUPT-P050DRV…Addressofinterruptserviceroutine.:‰DC.L…COMMANDS-P050DRV…Addressofcommandserviceroutine.5‰DC.L…INIT-P050DRV‰Addressofinitializationroutine.‰DC.L…0”Reserved. **‚OtherCMRparameters.*3‰DC.B…EXTCCBSZŽ#ofextrapagesintheCCB.‚TheCCB(*§maybeanysizefrom1to256pages(a&*§pageis256bytes):‚ifthisfieldis*§0,itwillbe1page,etc.‰DC.B…0,0,0Reserved.‰DC.L…0,0,0Reserved. **‚Revisioninfo:*/‰DC.B…'111185'DateoflastassemblyasMMDDYY.1‰DC.B…''’Spaceindicatesnopatchesto.LOfile.)‰DC.B…'4'’MajorVERSAdosrevisionnumber.‰PAGEO********************************************************************************:*ˆJumptableforusebythegenericprinterdriverPRNTLIB*O******************************************************************************* ‰BRA.L„DDP_OUTPUT‰BRA.L„GET_STAT‰BRA.L„DDP_RESET‰BRA.L„DDP_ENA_INTR‰PAGEO*******************************************************************************O** *******************************************************************************ˆINITIALIZATIONROUTINE*B*ˆThis‚subroutineiscalledfromCMR‚whenCMRisinvokedbyataskB*ˆ(normallyIOI)to‚allocateachannel.‚ItspurposeistogivetheD*ˆdriverachancetosetupthingsforcommandserviceandinterrupt-*ˆservice.‚Thebasicfunctionsperformedare:*5*ˆ1.‚PutthestartaddressofthedriverintotheCCB*ŒvariableDRV_ADDR.?*ˆ2.‚Device-IndependentinitializationinthecalltoPRNT_INIT"*ŽtoinitializetheCCBvariables.?*ˆ3.‚Device-DependentinitializationinthecalltoDO_INITfor"*Ždevicedependentinitialization.*B*ˆThissubroutineisenteredthroughaJSRfromCMR,andwillexit7*ˆwithanRTS.‚Theprocessorisinthesupervisormode.*%*ˆEntry:„A6=physicaladdressofTCB*’A5=physicaladdressofCCB*5*ˆInterruptlevelis0.‚Registersmaybeusedfreely.*.*ˆRegistersusedinPRNT_INIT:…01234567*¦D*¦A‚*‰P**ˆExitsto:CMRviaRTS*O*******************************************************************************O******************************************************************************* INIT:*)*‚GetaddressofstartofdriverintoCCB*ŠLEA‡P050DRV(PC),A0ŠMOVE.L„A0,DRV_ADDR(A5)*>*‚Performthedevice-independentinitializationbycallingthe'*‚genericroutinePRNT_INITinPRNTLIB.*/‰JSR†PRNT_INITŒDothedevice-independentstuff.4‰IF‚‚THEN.SŽSomethingwentwrongwithPRNT_INIT.‹RTS™Thechannelisdown!!‰ENDI*8*‚Performanydevice-dependentinitializationinDO_INIT*/‰BSR.L„DO_INITŽDevicedependentinitialization.‰RTS‰PAGEO*******************************************************************************O*********************************************************************************ˆCOMMANDSERVICEROUTINE*C*ˆThissubroutineiscalledfromCMRwhenCMRreceivesacommandtoA*ˆinitiatean‚I/Otransaction‚withadevicethatiscontrolledby?*ˆthisdriver.‚Itsfunctionisto‚processthe‚givencommand‚andB*ˆqueuethecommandtothecontroller.‚Thesefunctionsarehandled(*ˆbythegenericprinterdriverPRNTLIB.*5*ˆEntry:„A2=physicaladdressofCMRparameterblock*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*5*ˆInterruptlevelis0.‚Registersmaybeusedfreely.*1*ˆRegistersusedbyPRNT_COMMAND:†01234567*ªD‚********ªA‚*****P**ˆExitsto:CMRviaRTS*O*******************************************************************************O******************************************************************************* COMMANDS: *,*‚Performanydevice-dependentstuffhere...* =*‚Wehavereceivedacommand,soweknowthereissomeoneout**‚theretotalkto.‚LetPRNTLIBhandleit.*&‰JSR†PRNT_COMMAND‹Performthecommand.‰RTSReturntoCMR.‰TTL‡MVME050INTERRUPTHANDLER‰PAGEO*******************************************************************************O*********************************************************************************ˆINTERRUPTSERVICEROUTINE**ˆEntry:„JSRfromISR(inCMR)*’A5=PhysicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚S********™A‚SS***S**(*ˆCalls:„DDP_RESET‚INTR_REC(inPRNTLIB)**ˆExit:…RTStoCMR*O*******************************************************************************O******************************************************************************* INTERUPT: .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress. 1ŠBTST.Bƒ#IRE,BIM_CTL3‡Aretheinterruptsenabled?!ŠBEQ.S„PRTI005Ifnot,thenexit.+ŠMOVE.BƒDEV1BD(A1),D0‡Readthestatusbits.2ŠBMI.S„PRTI010BranchifACKinterruptispending. 8PRTI005ƒAND.W„#$FFFE,SR‹Notforme,sosetconditionand ŠRTSšreturn.*K*‚Itwasforme,butifthechannelisoff-lineornotattached,justexit.*PRTIACKƒTST.B„DEV1AC(A1)ŠClearAcknowledgeinterruptIRQflag.6ŠBTST.Bƒ#7,DEV1BD(A1)‡Testforackpendingtogoaway.#ŠBEQ.S„PRTIACK1ŒBranchoutifgone..ŠDBRA…D1,PRTIACKŠNotgone,sodecrementtimer. APRTIACK1‚ADD.B„#1,INTR_CNT(A5)…Incrementpendinginterruptcount.$ŠJSR†INTR_RECŒLetPRNTLIBhandleit. *2* Printer interrupt handler exits from this point.* PRTINRTN:9ŠSUB.B„#1,INTR_CNT(A5)†Decrementpendinginterruptcount..ŠMOVEM.L‚(A7)+,INT_REGS‡Restoretheregisters.(ŠOR.W…#$0001,SRŒSetreturnconditionandŠRTS›returntoCMR.ŠTTL†P050DRV.SAŠPAGEO********************************************************************************!*’ROUTINESƒCALLEDƒBY**œPRNTLIB**O*******************************************************************************‰PAGEN*******************************************************************************0*ˆDDP_OUTPUTƒOUTPUTTHECHARACTERTOTHEPRINTER*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto.*ˆoutputthecharacterinD0.Btotheprinter.**6*ˆEntry:D0.B=charactertobeoutputtotheprinter.#*A5ƒ=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D‚P**™A„*‡P**ˆCalls:GET_STAT‚DDP_RESET*/*ˆExit:‚RTStocallerwithconditioncodesset:-*ˆCharacterwasoutputandacknowledged.=*,‚Characterwasoutputbutnotacknowledged(yet).2*,‚Printererrorconditionwasdetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** DDP_OUTPUT: 7ŠMOVEM.L‚D0-D1/A1,-(SP)†Savetheregisterswewilluse. 1ŠMOVE.LƒCCBCHB(A5),A1‡A1<--devicebaseaddress.'ŠBSR.L„GET_STATŒGetthecurrentstatus.ŠBEQ.S„PRNT_OKBranchifok.*9*‚Printererrorcondition(outofpaperornotselected):* =ERROR_RETBSR.L„DDP_RESET‹Reprogramdevicefornointerrupts.3ŠMOVE.Wƒ#1,D0Return,-->errordetected.6ŠMOVEM.L‚(SP)+,D0-D1/A1†Restoretheregistersweused.ŠRTSŠPAGE*J* Output the character; but before we output, see if we are to check BUSY.*,EQ410…EQU†CONFGBLK+IOSATW…User'sattributes. GPRNT_OKƒBTSTW„#IOABUSY,EQ410(A5)‚Seeiftheuserwantsustowaituntil6ŠIF‚‚THENtheprinterisnotBUSYbeforeprinting.ŒMOVE.BDEV1BD(A1),D1.ŒAND.B‚#$07,D1MaskFAULT,BUSY,andSELECTED.5ŒCMP.B‚#$07,D1WaitaslongasthereisNOFAULT,and0ŒBEQ.S‚PRNT_OKtheprinterisBUSYandSELECTED.ŒCMP.B‚#$05,D10ŒBNE.S‚ERROR_RET‹ErrorifFAULTornotSELECTED.ŠENDI +ŠMOVE.BƒD0,DEV1AD(A1)‡Outputthedatabyte.9ŠMOVE.BƒD0,DEV1AD(A1)‡Allowdatatosettlebeforestrobe.ŠMOVE.BƒD0,DEV1AD(A1)‡*ŠMOVE.BƒD0,DEV1AD(A1)‡*ŠMOVE.BƒD0,DEV1AD(A1)‡* >ŠMOVE.Bƒ#0,DEV1AC(A1)‡Strobepulsegoeslow(strobethedata)./ŠMOVE.Bƒ#0,DEV1AC(A1)‡Stretchthestrobepulse.ŠMOVE.Bƒ#0,DEV1AC(A1)‡*ŠMOVE.Bƒ#0,DEV1AC(A1)‡*ŠMOVE.Bƒ#0,DEV1AC(A1)‡* 1ŠMOVE.Bƒ#8,DEV1AC(A1)‡Strobepulsebackhighnow. 6ŠMOVE.Wƒ#32,D1ŽTestfortheprinteracknowledgepulse.CWAIT_ACK‚BTST.Bƒ#7,DEV1BD(A1)‡Iftheacknowledgearrivesbeforethe7ŠBNE.S„DEV_ACKlooptimesout(approx.100us)proceed.)ŠDBRA… D1,WAIT_ACK‰Otherwise,return. 0ŠMOVE.Wƒ#-1,D0ŽReturn,-->noACKyet.6ŠMOVEM.L‚(SP)+,D0-D1/A1†Restoretheregistersweused.ŠRTS 9DEV_ACKƒMOVE.Wƒ#100,D1Arbitrarytimeoutcount.‚Clearthe=DEVACK1ƒTST.B„DEV1AC(A1)Šacknowledgependingandtestforthe:ŠBTST.Bƒ#7,DEV1BD(A1)‡acknowledgependingtogoaway.‚When(ŠBEQ.S„OUT_OKŽitisgone,exitnormally.ŠDBRA…D1,DEVACK16ŠBRA.L„ERROR_RET‹Ifitdoesn'tgo,exitwithanerror. $OUT_OK„MOVE.Bƒ#0,D0Setstatus.6ŠMOVEM.L‚(SP)+,D0-D1/A1†Restoretheregistersweused.ŠRTSŠPAGEN*******************************************************************************'*ˆGET_STAT„DETERMINETHEPRINTERSTATUS*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto9*ˆchecktheprinterstatusforselectedandout-of-paper.****ˆEntry:A5=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™A„*‡P* *ˆCalls:none*/*ˆExit:‚RTStocallerwithconditioncodesset:3*‚Printerisselectedandisnotout-of-paper.2*‚Printerisnotselectedorisout-of-paper.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** GET_STAT: 0ŠMOVE.LƒA1,-(SP)ŒSavetheregisterswewilluse. .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress.2ŠMOVE.BƒDEV1BD(A1),D1‡Pickupthestatusregister.&ŠAND.B„#$05,D1Maskuninterestedbits.%ŠCMP.B„#$05,D1Selectedandnofault? /ŠMOVE.Lƒ(SP)+,A1ŒRestoretheregistersweused.&ŠRTSšReturntocallerwithstatusset.ŠPAGEN*******************************************************************************.*ˆDDP_RESETƒRESETTHEDEVICEFORNOINTERRUPTS*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto>*ˆsetupthedevicecontrolregistersandturnoffinterrupts.****ˆEntry:A5=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™A„*‡P* *ˆCalls:none**ˆExit:‚RTStocaller.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** DDP_RESET: ŠPUSH…SRŠINHIBIT–Disableinterrupts. 0ŠMOVE.LƒA1,-(SP)ŒSavetheregisterswewilluse. +ŠBCLR…#IRE,BIM_CTL3‡DisableACKinterrupts. .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress.+ŠTST.B„DEV1AC(A1)ŠClearACKinterruptflag. /ŠMOVE.Lƒ(SP)+,A1ŒRestoretheregistersweused.ŠPOP†SR ŠRTSšReturn.ŠPAGEN*******************************************************************************5*ˆDDP_ENA_INTRƒENABLEFORINTERRUPTSFROMTHEPRINTER*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto%*ˆenablethehardwareforinterrupts.****ˆEntry:A5=physicaladdressoftheCCB.*;*Interruptlevelatthehardwareinterruptlevel(masked).*!*ˆRegisterusage:…01234567*™D*™A„*‡P* *ˆCalls:none**ˆExit:‚RTStocaller.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** DDP_ENA_INTR: *ŠBSET…#IRE,BIM_CTL3‡EnableACKinterrupts.*K*‚SincethehardwaredoesnotsupportFAULTinterrupts,weuseatimercallH*‚tocheckforprinterfaults.‚TheroutineFLT_TIMERinPRNTLIBisused.J*‚Itspurposeistorequestanactivationcallforus.‚Whentheactivation;*‚callcomesin,anotherroutineinPRNTLIBwillhandleit.*L*‚IfwegetanACKNOWLEDGEinterruptbeforetheactivationcallcomesin,weJ*‚cleartheflagFLT_REQ(inourinterruptserviceroutine).‚ThistellsusJ*‚thatwenolongerneed theactivationcall.‚Ifhowever,noACKinterruptJ*‚isreceived,ourflagFLT_REQwillstillbesetwhentheactivationcallI*‚comesin.‚Thisforcesa'DEVICENOTREADY'errorcodetobereturnedto *‚theuser.*0ŠST.B…FLT_REQ(A5)‰SetFAULTrequestneededflag.'ŠJSR†FLT_TIMER‹UsethePRNTLIBroutine. ŠRTSšReturn.ŠPAGEN********************************************************************************‰FINISHOFFTHEINITIALIZATION*2*‰Theseotherdevice-dependentthingsMUSTbedone>*‰beforewecanhandlecommands.‚Theyprobablycouldhavebeen?*‰doneinINITatthestartofthedriverbutarehandledhere.*(*‰1.‚Clearthehardwareinterruptflags.%*‰2.‚Turnoffinterruptsatthechip.**‰Entry:A5=addressofCCB.* *‰Calls:none*N****************************************************************************** DO_INIT: ŠPUSH…SRŠINHIBIT–Disableinterrupts. 6ŠMOVE.BƒCCBVECT(A5),BIM_VEC3„Setupthevectornumber.9ŠMOVE.BƒCCBPPRIO(A5),BIM_CTL3ƒSetuptheinterruptlevel. 1ŠMOVE.LƒCCBCHB(A5),A1‡Setupdevicebaseaddress.+ŠBSET.Bƒ#3,DEV1AC(A1)‡SetdatastrobeHIGH.+ŠBSET.Bƒ#3,DEV1BC(A1)‡SetinputprimeHIGH. 1ŠBSR.S„DDP_RESET‹Dis-ableinterruptsatthechip. ŠPOP†SRŠRTS ŠDS.W…30ŠENDNNNNŠPAGE1P117DRVƒIDNTƒ45,0ˆVERSAdosMVME117printerdriverNNNNN NNâëóIû@: ;EC#<+>3K;-ŠTTL„P117DRV:„VERSAdosMVME117printerdriverNNNNNNN ŠLLENƒ120K***************************************************************************K***************************************************************************K***************************************************************************K****************************************************************************+*ˆP117DRV:‚VERSAdosMVME117printerdriver.**ˆRevisionhistory:**ˆ11/11/85‚Initialrelease.*K***************************************************************************K***************************************************************************K***************************************************************************K***************************************************************************ŠPAGEŠOPTCRE,PCS,BRS***‰XREF…PRNT_INIT‰XREF…PRNT_COMMAND‰XREF…INTR_REC **‚Equatefilesincluded:* *ˆ9995.&.STR.EQ*ˆ9995.&.TCB.EQ*ˆ9995.&.CCB.EQ*ˆ9995.&.IOE.EQ*ˆ9995.&.NIO.EQ*ˆ9995.&.LV5.EQ*ˆ9995.&.UTILITY.MC*ˆ9995.&.PRNT.EQ*ˆ9995.&.PRNTCCB.EQŠNOLISTŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠINCLUDE9995.&.UTILITY.MC ŠTTL…PRNT.EQŠLISTŠINCLUDE9995.&.PRNT .EQŠTTL…PRNTCCB.EQŠINCLUDE9995.&.PRNTCCB.EQŠTTL…P117DRV.SAŠPAGE/ŠOFFSET‚PCCBDDPContinuewithchannel-dependent*¦CCBvariablespace.  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* *%%%Å%%%*B*%%%„Device-dependent,channelrelated,variablesstarthere.‰%%%* *%%%Å%%%**%%%™(CCBSPACE)¡%%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* *%%%Å%%%*>*%%%„Endofdevicedependent,channelrelated,variables.%%%* *%%%Å%%%**%%%•ENDOFCCBSPACE %%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  3CCBSIZEBEQU†*–CCBSIZEBdefinesthesize(inbytes)$*¦ofacompleteCCBforthisdriver. %*¨CCBSIZEdefinesthesize(inpages)CL0080„EQU†CCBSIZEB+PAGESIZE-1‚ofaCCBforthedriver,andEXTCCBSZ=CCBSIZE‚EQU†L0080/PAGESIZE‡definesthesize(inpages)ofthe>EXTCCBSZEQU†CCBSIZE-1ŒextendedportionofaCCB.Theextended(*¦portionoftheCCBisusedexclusively)*¦fordevice-dependentvariablesthatare(*¦requiredbythedriver.‚Thereare$100'*¦bytesperpageofmemory,andtheCCB)*¦isdynamicallyallocatedasanintegral*¦numberofpages.‰PAGE** DEVICE EQUATES:*&PIO0…EQU‡0“Port0dataregisteroffset&PIO1…EQU‡2“Port1dataregisteroffset0PPCR…EQU‡4“Parallelportcontrolregisteroffset(MCR†EQU‡6“Modulecontrolregisteroffset'MSR†EQU‡8“Modulestatusregisteroffset0CP0FLAG‚EQU‡8“Clearport0flagsregisteroffset1CP1FLAG‚EQU†10“Clearport1flagsregisteroffset ,INTEN0ƒEQU‡0“Interruptenablebitforport0,INTEN1ƒEQU‡4“Interruptenablebitforport1 **‚Definitions:*$*‚Name‚AddressƒR/W‡Level…Description3*‚----‚-------ƒ---‡-----…--------------------------)*‚PIO0‚F44001„R/W‘Printerstatus(port0)*œhigh‡D5=printerisselected#*œhigh‡D6=printerisout-of-paper*œhigh‡D7=printerisbusy*5*‚PIO1‚F44003„R/W‘Printeroutputdata,D0-D7(port1)***‚PPCR‚F44005„R/W‘Printercontrolregister"*œlowˆD0=enablefaultinterrupts *œlowˆD4=enableackinterrupts"*œlow->hi„D6=printerdatastrobe%*œlowˆD7=programport1foroutputs*.*‚MSRƒF44009„RonlyŽPrinteracknowledgestatus'*§D7=ack(port1)acknowledgepending)*§D6=fault(port0)acknowledgepending*5*‚CP0ƒF44009„WonlyŽClearsfault(port0)acknowledge#*¦(mustwaitforMSR[6]togohigh)*3*‚CP1ƒF4400B„WonlyŽClearsack(port1)acknowledge#*¦(mustwaitforMSR[7]togohigh)*‰PAGE ‰SECTION0O********************************************************************************1*ˆSERVICEVECTORTABLE,PARAMETERS,REVISIONINFO*@*ˆThefirst‚several‚locationsofevery‚I/OdrivermustcontainaB*ˆservicevectortabletocontainthe‚long-wordrelativeaddressesB*ˆofthethreedriversubroutinesthatCMRuses.‚TheCMRparameterC*ˆtableimmediatelyfollowstheservicevectortableandincludesaA*ˆfieldtelling‚CMR‚howmanyextrapages‚toallocatefortheCCB.E*ˆTherevisiontableimmediatelyfollowsthetheCMRparametertable.*O*******************************************************************************O******************************************************************************* ‰SECTION‚0 P117DRV: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!* <‰DC.L…INTERUPT-P117DRV…Addressofinterruptserviceroutine.:‰DC.L…COMMANDS-P117DRV…Addressofcommandserviceroutine.5‰DC.L…INIT-P117DRV‰Addressofinitializationroutine.‰DC.L…0”Reserved. **‚OtherCMRparameters.*3‰DC.B…EXTCCBSZŽ#ofextrapagesintheCCB.‚TheCCB(*§maybeanysizefrom1to256pages(a&*§pageis256bytes):‚ifthisfieldis*§0,itwillbe1page,etc.‰DC.B…0,0,0Reserved.‰DC.L…0,0,0Reserved. **‚Revisioninfo:*/‰DC.B…'111185'Dateoflastasse mblyasMMDDYY.1‰DC.B…''’Spaceindicatesnopatchesto.LOfile.)‰DC.B…'4'’MajorVERSAdosrevisionnumber.‰PAGEO********************************************************************************:*ˆJumptableforusebythegenericprinterdriverPRNTLIB*O******************************************************************************* ‰BRA.L„DDP_OUTPUT‰BRA.L„GET_STAT‰BRA.L„DDP_RESET‰BRA.L„DDP_ENA_INTR‰PAGEO*******************************************************************************O*********************************************************************************ˆINITIALIZATIONROUTINE*B*ˆThis‚subroutineiscalledfromCMR‚whenCMRisinvokedbyataskB*ˆ(normallyIOI)to‚allocateachannel.‚ItspurposeistogivetheD*ˆdriverachancetosetupthingsforcommandserviceandinterrupt-*ˆservice.‚Thebasicfunctionsperformedare:*5*ˆ1.‚PutthestartaddressofthedriverintotheCCB*ŒvariableDRV_ADDR.?*ˆ2.‚Device-IndependentinitializationinthecalltoPRNT_INIT"*ŽtoinitializetheCCBvariables.?*ˆ3.‚Device-DependentinitializationinthecalltoDO_INITfor"*Ždevicedependentinitialization.*B*ˆThissubroutineisenteredthroughaJSRfromCMR,andwillexit7*ˆwithanRTS.‚Theprocessorisinthesupervisormode.*%*ˆEntry:„A6=physicaladdressofTCB*’A5=physicaladdressofCCB*5*ˆInterruptlevelis0.‚Registersmaybeusedfreely.*.*ˆRegistersusedinPRNT_INIT:…01234567*¦D*¦A‚*‰P**ˆExitsto:CMRviaRTS*O*******************************************************************************O******************************************************************************* INIT:*)*‚GetaddressofstartofdriverintoCCB*ŠLEA‡P117DRV(PC),A0ŠMOVE.L„A0,DRV_ADDR(A5)*>*‚Performthedevice-independentinitializationbycallingthe'*‚genericroutinePRNT_INITinPRNTLIB.*/‰JSR†PRNT_INITŒDothedevice-independentstuff.4‰IF‚‚THEN.SŽSomethingwentwrongwithPRNT_INIT.‹RTS™Thechannelisdown!!‰ENDI*8*‚Performanydevice-dependentinitializationinDO_INIT*/‰BSR.L„DO_INITŽDevicedependentinitialization.‰RTS‰PAGEO*******************************************************************************O*********************************************************************************ˆCOMMANDSERVICEROUTINE*C*ˆThissubroutineiscalledfromCMRwhenCMRreceivesacommandtoA*ˆinitiatean‚I/Otransaction‚withadevicethatiscontrolledby?*ˆthisdriver.‚Itsfunctionisto‚processthe‚givencommand‚andB*ˆqueuethecommandtothecontroller.‚Thesefunctionsarehandled(*ˆbythegenericprinterdriverPRNTLIB.*5*ˆEntry:„A2=physicaladdressofCMRparameterblock*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*5*ˆInterruptlevelis0.‚Registersmaybeusedfreely.*1*ˆRegistersusedbyPRNT_COMMAND:†01234567*ªD‚********ªA‚*****P**ˆExitsto:CMRviaRTS*O*******************************************************************************O******************************************************************************* COMMANDS: *,*‚Performanydevice-dependentstuffhere...* =*‚Wehavereceivedacommand,soweknowthereissomeoneout**‚theretotalkto.‚LetPRNTLIBhandleit.*&‰JSR†PRNT_COMMAND‹Performthecommand.‰RTSReturntoCMR.‰TTL‡MVME117INTERRUPTHANDLER‰PAGEO*******************************************************************************O*********************************************************************************ˆINTERRUPTSERVICEROUTINE**ˆEntry:„JSRfromISR(inCMR)*’A5=PhysicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚S********™A‚SS***S**(*ˆCalls:„DDP_RESET‚INTR_REC(inPRNTLIB)**ˆExit:…RTStoCMR*O**************************************************************************  *****O******************************************************************************* INTERUPT: .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress. +ŠMOVE.BƒMSR(A1),D0ŠPickupstatusregister.ŠNOT.B„D0’BITSAREACTIVELOW!#ŠAND.B„#$C0,D0Maskinterruptbits.1ŠBNE.S„PRTI010Branchifaninterruptispending. 1ŠAND.W„#$FFFE,SR‹Notforme,sosetconditionand ŠRTSšreturn.*K*‚Itwasforme,butifthechannelisoff-lineornotattached,justexit.*"PRTI010ƒBTSTW„#CCBFGOFF,CCBSTR(A5)"ŠBNE.S„PRTI020Branchifoff-line.ŠBTSTW„#CCBFGATH,CCBSTR(A5)1ŠBEQ.S„PRTI020Branchifchannelisnotattached.ŠTST.B„PRNTBUSY(A5)1ŠBNE.S„PRTI100BranchifwehaveI/Oinprogress. 2PRTI020ƒBSR.L„DDP_RESETDisabledeviceinterrupts.)ŠOR.W…#$0001,SRWehandledtheinterrupt.ŠRTSŠPAGE*:*‚Theinterruptisforme,andthereisI/Oinprogress...*INT_REGS‚REG…D1-D7/A2-A4/A6 PRTI100:;ŠMOVEM.LINT_REGS,-(SP)‡SavetheregistersnotsavebyCMR.+ŠBSR.LƒDDP_RESETŒDisabledeviceinterrupts. (ŠMOVE.Wƒ#100,D1Arbitrarytimeoutcount.CPRTIACKƒMOVE.Bƒ#0,CP1FLAG(A1)†ClearAcknowledgeinterruptIRQflag.3ŠBTST.Bƒ#7,MSR(A1)ŠTestforackpendingtogoaway.#ŠBNE.S„PRTIACK1ŒBranchoutifgone..ŠDBRA…D1,PRTIACKŠNotgone,sodecrementtimer. 0PRTIACK1‚MOVE.Wƒ#100,D1Arbitrarytimeoutcount.=PRTIFLTƒMOVE.Bƒ#0,CP0FLAG(A1)†ClearfaultinterruptIRQflag.-ŠBTST.Bƒ#6,MSR(A1)ŠTestforfaulttogoaway.ŠBNE.S„PRTIFLT1ŒBranchifgone..ŠDBRA…D1,PRTIFLTŠNotgone,sodecrementtimer. APRTIFLT1‚ADD.B„#1,INTR_CNT(A5)…Incrementpendinginterruptcount.$ŠJSR†INTR_RECŒLetPRNTLIBhandleit. *2* Printer interrupt handler exits from this point.* PRTINRTN:9ŠSUB.B„#1,INTR_CNT(A5)†Decrementpendinginterruptcount..ŠMOVEM.L‚(A7)+,INT_REGS‡Restoretheregisters.(ŠOR.W…#$0001,SRŒSetreturnconditionandŠRTS›returntoCMR.ŠTTL†P117DRV.SAŠPAGEO********************************************************************************!*’ROUTINESƒCALLEDƒBY**œPRNTLIB**O*******************************************************************************‰PAGEN*******************************************************************************0*ˆDDP_OUTPUTƒOUTPUTTHECHARACTERTOTHEPRINTER*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto.*ˆoutputthecharacterinD0.Btotheprinter.**6*ˆEntry:D0.B=charactertobeoutputtotheprinter.#*A5ƒ=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D‚P**™A„*‡P**ˆCalls:GET_STAT‚DDP_RESET*/*ˆExit:‚RTStocallerwithconditioncodesset:-*ˆCharacterwasoutputandacknowledged.=*,‚Characterwasoutputbutnotacknowledged(yet).2*,‚Printererrorconditionwasdetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** DDP_OUTPUT: 7ŠMOVEM.L‚D0-D1/A1,-(SP)†Savetheregisterswewilluse. 1ŠMOVE.LƒCCBCHB(A5),A1‡A1<--devicebaseaddress.'ŠBSR.L„GET_STATŒGetthecurrentstatus.ŠBEQ.S„PRNT_OKBranchifok.*9*‚Printererrorcondition(outofpaperornotselected):*(ŠMOVE.Wƒ#100,D1Arbitrarytimeoutcount.>WAIT_FLT‚MOVE.Bƒ#0,CP0FLAG(A1)†ClearfaultinterruptIRQflag.1ŠBTST.Bƒ#6,MSR(A1)ŠTestforthefaulttogoaway.ŠBNE.S„ERROR_RETŠDBRA…D1,WAIT_FLT =ERROR_RETBSR.L„DDP_RESET‹Reprogramdevicefornointerrupts.3ŠMOVE.Wƒ#1,D0Return,-->errordetected.6ŠMOVEM.L‚(SP)+,D0-D1/A1†Restoretheregistersweused.ŠRTSŠPAGE*J* Output the character; but before we output, see if we are to check BUSY.*,EQ410…EQU†CONFGBLK+IOSATW…User'sattributes. GPRNT_OKƒBTSTW„#IOABUSY,EQ410(A5)‚Seeiftheuserwantsustowaituntil6ŠIF‚‚THENtheprinterisnotBUSYbeforeprinting.ŒMOVE.BPIO0(A1),D14ŒAND  .B‚#$E0,D1MaskBUSY,OUT-OF-PAPERandSELECTED.0ŒCMP.B‚#$A0,D1WaitaslongasweareBUSY,have&ŒBEQ.S‚PRNT_OKpaperandareSELECTED.ŒCMP.B‚#$20,D17ŒBNE.S‚ERROR_RET‹ErrorifOUT-OF-PAPERornotSELECTED.ŠENDI )ŠMOVE.BƒD0,PIO1(A1)‰Outputthedatabyte.7ŠMOVE.BƒD0,PIO1(A1)‰Allowdatatosettlebeforestrobe.ŠMOVE.BƒD0,PIO1(A1)‰*ŠMOVE.BƒD0,PIO1(A1)‰*ŠMOVE.BƒD0,PIO1(A1)‰* :ŠBCLR…#6,PPCR(A1)‰Strobepulsegoeslow(strobethedata).+ŠBCLR…#6,PPCR(A1)‰Stretchthestrobepulse.ŠBCLR…#6,PPCR(A1)‰*ŠBCLR…#6,PPCR(A1)‰*ŠBCLR…#6,PPCR(A1)‰* -ŠBSET…#6,PPCR(A1)‰Strobepulsebackhighnow. 6ŠMOVE.Wƒ#32,D1ŽTestfortheprinteracknowledgepulse.@WAIT_ACK‚BTST.Bƒ#7,MSR(A1)ŠIftheacknowledgearrivesbeforethe7ŠBEQ.S„DEV_ACKlooptimesout(approx.100us)proceed.)ŠDBRA…D1,WAIT_ACK‰Otherwise,return. 0ŠMOVE.Wƒ#-1,D0ŽReturn,-->noACKyet.6ŠMOVEM.L‚(SP)+,D0-D1/A1†Restoretheregistersweused.ŠRTS 9DEV_ACKƒMOVE.Wƒ#100,D1Arbitrarytimeoutcount.‚CleartheBDEVACK1ƒMOVE.Bƒ#0,CP1FLAG(A1)†acknowledgependingandtestforthe7ŠBTST.Bƒ#7,MSR(A1)Šacknowledgependingtogoaway.‚When(ŠBNE.S„OUT_OKŽitisgone,exitnormally.ŠDBRA…D1,DEVACK16ŠBRA.L„ERROR_RET‹Ifitdoesn'tgo,exitwithanerror. $OUT_OK„MOVE.Bƒ#0,D0Setstatus.6ŠMOVEM.L‚(SP)+,D0-D1/A1†Restoretheregistersweused.ŠRTSŠPAGEN*******************************************************************************'*ˆGET_STAT„DETERMINETHEPRINTERSTATUS*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto9*ˆchecktheprinterstatusforselectedandout-of-paper.****ˆEntry:A5=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™A„*‡P* *ˆCalls:none*/*ˆExit:‚RTStocallerwithconditioncodesset:3*‚Printerisselectedandisnotout-of-paper.2*‚Printerisnotselectedorisout-of-paper.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** GET_STAT: 0ŠMOVE.LƒA1,-(SP)ŒSavetheregisterswewilluse. .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress.0ŠMOVE.BƒPIO0(A1),D1‰Port0containsstatusbits.&ŠAND.B„#$60,D1Maskuninterestedbits.-ŠCMP.B„#$20,D1SelectedandnotOut-of-Paper? /ŠMOVE.Lƒ(SP)+,A1ŒRestoretheregistersweused.&ŠRTSšReturntocallerwithstatusset.ŠPAGEN*******************************************************************************.*ˆDDP_RESETƒRESETTHEDEVICEFORNOINTERRUPTS*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto>*ˆsetupthedevicecontrolregistersandturnoffinterrupts.****ˆEntry:A5=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™A„*‡P* *ˆCalls:none**ˆExit:‚RTStocaller.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** DDP_RESET: ŠPUSH…SRŠINHIBIT–Disableinterrupts. 0ŠMOVE.LƒA1,-(SP)ŒSavetheregisterswewilluse. .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress.9ŠMOVE.Bƒ#$7F,PPCR(A1)‡Selectport1output,port0input,$*¦anddisableACK,FAULTinterrupts. 8ŠMOVE.Bƒ#00,CP0FLAG(A1)…ClearFAULTinterruptonport0.6ŠMOVE.Bƒ#00,CP1FLAG(A1)…ClearACKƒinterruptonport1.  /ŠMOVE.Lƒ(SP)+,A1ŒRestoretheregistersweused.ŠPOP†SR ŠRTSšReturn.ŠPAGEN*******************************************************************************5*ˆDDP_ENA_INTRƒENABLEFORINTERRUPTSFROMTHEPRINTER*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto%*ˆenablethehardwareforinterrup  ts.****ˆEntry:A5=physicaladdressoftheCCB.*;*Interruptlevelatthehardwareinterruptlevel(masked).*!*ˆRegisterusage:…01234567*™D*™A„*‡P* *ˆCalls:none**ˆExit:‚RTStocaller.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** DDP_ENA_INTR: 0ŠMOVE.LƒA1,-(SP)ŒSavetheregisterswewilluse. .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress.6ŠBCLR…#INTEN0,PPCR(A1)„EnabledeviceFAULTinterrupts.4ŠBCLR…#INTEN1,PPCR(A1)„EnabledeviceACKinterrupts. /ŠMOVE.Lƒ(SP)+,A1ŒRestoretheregistersweused. ŠRTSšReturn.ŠPAGEN********************************************************************************‰FINISHOFFTHEINITIALIZATION*2*‰Theseotherdevice-dependentthingsMUSTbedone>*‰beforewecanhandlecommands.‚Theyprobablycouldhavebeen?*‰doneinINITatthestartofthedriverbutarehandledhere.*(*‰1.‚Clearthehardwareinterruptflags.%*‰2.‚Turnoffinterruptsatthechip.**‰Entry:A5=addressofCCB.* *‰Calls:none*N****************************************************************************** DO_INIT: .ŠBSR.S„DDP_RESET‹Clearanddisableinterrupts.ŠRTS ŠDS.W…30ŠENDNNNNNŠPAGE,PIADRV„IDNTƒ45,0ˆVERSAdosPIAprinterdriverNNNN  NNNCLTK\6d9l@t@|C„?ŒB”Iœ'(ŠTTL„PIADRV:…VERSAdosPIAprinterdriverNNNNNNN ŠLLENƒ120K***************************************************************************K***************************************************************************K***************************************************************************K****************************************************************************&*ˆPIADRV:‚VERSAdosPIAprinterdriver.**ˆRevisionhistory:**ˆ11/11/85‚Initialrelease.*K***************************************************************************K***************************************************************************K***************************************************************************K***************************************************************************ŠPAGEŠOPTCRE,PCS,BRS***‰XREF…PRNT_INIT‰XREF…PRNT_COMMAND‰XREF…INTR_REC **‚Equatefilesincluded:* *ˆ9995.&.STR.EQ*ˆ9995.&.TCB.EQ*ˆ9995.&.CCB.EQ*ˆ9995.&.IOE.EQ*ˆ9995.&.NIO.EQ*ˆ9995.&.LV5.EQ*ˆ9995.&.UTILITY.MC*ˆ9995.&.PRNT.  EQ*ˆ9995.&.PRNTCCB.EQŠNOLISTŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠINCLUDE9995.&.UTILITY.MC ŠTTL…PRNT.EQŠLISTŠINCLUDE9995.&.PRNT.EQŠTTL…PRNTCCB.EQŠINCLUDE9995.&.PRNTCCB.EQŠTTL…PIADRV.SAŠPAGE/ŠOFFSET‚PCCBDDPContinuewithchannel-dependent*¦CCBvariablespace.  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* *%%%Å%%%*B*%%%„Device-dependent,channelrelated,variablesstarthere.‰%%%* *%%%Å%%%**%%%™(CCBSPACE)¡%%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* *%%%Å%%%*>*%%%„Endofdevicedependent,channelrelated,variables.%%%* *%%%Å%%%**%%%•ENDOFCCBSPACE %%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  3CCBSIZEBEQU†*–CCBSIZEBdefinesthesize(inbytes)$*¦ofacompleteCCBforthisdriver. %*¨CCBSIZEdefinesthesize(inpages)CL0080„EQU†CCBSIZEB+PAGESIZE-1‚ofaCCBforthedriver,andEXTCCBSZ=CCBSIZE‚EQU†L0080/PAGESIZE‡definesthesize(inpages)ofthe>EXTCCBSZEQU†CCBSIZE-1ŒextendedportionofaCCB.Theextended(*¦portionoftheCCBisusedexclusively)*¦fordevice-dependentvariablesthatare(*¦requiredbythedriver.‚Thereare$100'*¦bytesperpageofmemory,andtheCCB)*¦isdynamicallyallocatedasanintegral*¦numberofpages.‰PAGE** DEVICE EQUATES:*+DEV1ACƒEQU‡2“A-sidecontrolregisteroffset+DEV1BCƒEQU‡6“B-sidecontrolregisteroffset(DEV1ADƒEQU‡0“A-sidedataregisteroffset(DEV1BDƒEQU‡4“B-sidedataregisteroffset **‚Definitions:**ƒPIA„PRINTERLINE*ƒPIN‡NAME‰I/OƒACTIVE’USEB*ƒ---„-----------…---ƒ------‚-------------------------------------@*ƒCB2„INPUTPRIME…out„low„Clearprinterbufferandresetprinter *ƒCB1„FAULT‹in…low„Printerfault-*ƒCA2„DATASTROBE…out„low„Printerdatastrobe1*ƒCA1„ACKNOWLEDGE…in…low„Acknowledgefromprinter.*ƒPB2„BUSYŒin…highƒPrintercannotreceivedata2*ƒPB1„OUTOFPAPER„in…highƒPrinterisoutofpaper(*ƒPB0„SELECTŠin…highƒPrinterisselected* **‚DEV1AC(DEV1BC)Definition:*>*‚[7]…IRQA(B)1flag†GoeshighonactivetransitionofCA1(CB1)#*ClearedbyreadingDEV1AD(DEV1BD)+*‚[6]…IRQA(B)2flag†NotusedbythisdriverI*‚[5:3]ƒCA2(CB2)controlƒ(111)=CA2(CB2)setlow‚onWrt-b3=0toCRA(CRB)+*¥CA2(CB2)sethighonWrt-b3=1toCRA(CRB):*‚[2]…DDRaccess‰(0)ƒ=DataDirectionRegisterisselected(*(1)ƒ=OutputdataregisterisselectedD*‚[1]…CA1(CB1)controlƒ(0)ƒ=IRQA(B)1setbyhigh-to-lowonCA1(CB1)/*(1)ƒ=IRQA(B)1setbylow-to-highonCA1(CB1)7*‚[0]…CA1(CB1)controlƒ(0)ƒ=DisableIRQA(B)1interrupt!*(1)ƒ=Enable‚IRQA(B)1interrupt*?*‚Thecontrolregisters,DEV1ACandDEV1BC,areprogrammedfor:*N*‚-DataStrobe(CA2)andInputPrime(CB2)followthewritetobit3ofCRA(B)$*‚-Selecttheoutputdataregisters.M*‚-Setupforhigh-to-lowtransitionsofACKNOWLEDGE(CA1)andFAULT(CB1)toL*ƒgenerateaninterrupt.‚ThetransitionisatthePIApinnottheconnector.4*‚-InterruptsonACKNOWLEDGEandFAULTaredisabled.* DSDVIAƒEQU‡%00111100‹Seeabove.DSDVIBƒEQU‡%00111100‹Seeabove.‰PAGE ‰SECTION0O********************************************************************************1*ˆSERVICEVECTORTABLE,PARAMETERS,REVISIONINFO*@*ˆThefirst‚several‚locationsofevery‚I/OdrivermustcontainaB*ˆservicevectortabletocontainthe‚long-wordrelativeaddressesB*ˆofthethreedriversubroutinesthatCMRuses.‚TheCMRparameterC*ˆtableimmediatelyfollowstheservicevectortableandincludesaA*ˆfieldtelling‚CMR‚howmanyextrapages‚toallocatefortheCCB.E*ˆTherevisiontableimmediatelyfollowsthetheCMRparametertable.*O**************************************  *****************************************O******************************************************************************* ‰SECTION‚0 PIADRV: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!* ;‰DC.L…INTERUPT-PIADRV†Addressofinterruptserviceroutine.9‰DC.L…COMMANDS-PIADRV†Addressofcommandserviceroutine.4‰DC.L…INIT-PIADRVŠAddressofinitializationroutine.‰DC.L…0”Reserved. **‚OtherCMRparameters.*3‰DC.B…EXTCCBSZŽ#ofextrapagesintheCCB.‚TheCCB(*§maybeanysizefrom1to256pages(a&*§pageis256bytes):‚ifthisfieldis*§0,itwillbe1page,etc.‰DC.B…0,0,0Reserved.‰DC.L…0,0,0Reserved. **‚Revisioninfo:*/‰DC.B…'111185'DateoflastassemblyasMMDDYY.1‰DC.B…''’Spaceindicatesnopatchesto.LOfile.)‰DC.B…'4'’MajorVERSAdosrevisionnumber.‰PAGEO********************************************************************************:*ˆJumptableforusebythegenericprinterdriverPRNTLIB*O******************************************************************************* ‰BRA.L„DDP_OUTPUT‰BRA.L„GET_STAT‰BRA.L„DDP_RESET‰BRA.L„DDP_ENA_INTR‰PAGEO*******************************************************************************O*********************************************************************************ˆINITIALIZATIONROUTINE*B*ˆThis‚subroutineiscalledfromCMR‚whenCMRisinvokedbyataskB*ˆ(normallyIOI)to‚allocateachannel.‚ItspurposeistogivetheD*ˆdriverachancetosetupthingsforcommandserviceandinterrupt-*ˆservice.‚Thebasicfunctionsperformedare:*5*ˆ1.‚PutthestartaddressofthedriverintotheCCB*ŒvariableDRV_ADDR.?*ˆ2.‚Device-IndependentinitializationinthecalltoPRNT_INIT"*ŽtoinitializetheCCBvariables.?*ˆ3.‚Device-DependentinitializationinthecalltoDO_INITfor"*Ždevicedependentinitialization.*B*ˆThissubroutineisenteredthroughaJSRfromCMR,andwillexit7*ˆwithanRTS.‚Theprocessorisinthesupervisormode.*%*ˆEntry:„A6=physicaladdressofTCB*’A5=physicaladdressofCCB*5*ˆInterruptlevelis0.‚Registersmaybeusedfreely.*.*ˆRegistersusedinPRNT_INIT:…01234567*¦D*¦A‚*‰P**ˆExitsto:CMRviaRTS*O*******************************************************************************O******************************************************************************* INIT:*)*‚GetaddressofstartofdriverintoCCB*ŠLEA‡PIADRV(PC),A0ŠMOVE.L„A0,DRV_ADDR(A5)*>*‚Performthedevice-independentinitializationbycallingthe'*‚genericroutinePRNT_INITinPRNTLIB.*/‰JSR†PRNT_INITŒDothedevice-independentstuff.4‰IF‚‚THEN.SŽSomethingwentwrongwithPRNT_INIT.‹RTS™Thechannelisdown!!‰ENDI*8*‚Performanydevice-dependentinitializationinDO_INIT*/‰BSR.L„DO_INITŽDevicedependentinitialization.‰RTS‰PAGEO*******************************************************************************O*********************************************************************************ˆCOMMANDSERVICEROUTINE*C*ˆThissubroutineiscalledfromCMRwhenCMRreceivesacommandtoA*ˆinitiatean‚I/Otransaction‚withadevicethatiscontrolledby?*ˆthisdriver.‚Itsfunctionisto‚processthe‚givencommand‚andB*ˆqueuethecommandtothecontroller.‚Thesefunctionsarehandled(*ˆbythegenericprinterdriverPRNTLIB.*5*ˆEntry:„A2=physicaladdressofCMRparameterblock*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*5*ˆInterruptlevelis0.‚Registersmaybeusedfreely.*1*ˆRegistersusedbyPRNT_COMMAND:†01234567*ªD‚********ªA‚*****P**ˆExitsto:CMRviaRTS*O*******************************************************************************O******************************************************************************* COMMANDS:   *,*‚Performanydevice-dependentstuffhere...* =*‚Wehavereceivedacommand,soweknowthereissomeoneout**‚theretotalkto.‚LetPRNTLIBhandleit.*&‰JSR†PRNT_COMMAND‹Performthecommand.‰RTSReturntoCMR.‰TTL‡PIAINTERRUPTHANDLER‰PAGEO*******************************************************************************O*********************************************************************************ˆINTERRUPTSERVICEROUTINE**ˆEntry:„JSRfromISR(inCMR)*’A5=PhysicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚S********™A‚SS***S**(*ˆCalls:„DDP_RESET‚INTR_REC(inPRNTLIB)**ˆExit:…RTStoCMR*O*******************************************************************************O******************************************************************************* INTERUPT: .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress. 5ŠMOVE.BƒDEV1AC(A1),D0‡PickupA-sidestatusregister.#ŠAND.B„#$81,D0Maskinterruptbits.-ŠCMP.B„#$81,D0Acknowledgeinterruptpending?ŠBEQ.S„PRTI010Branchifyes.5ŠMOVE.BƒDEV1BC(A1),D0‡PickupB-sidestatusregister.#ŠAND.B„#$81,D0Maskinterruptbits.'ŠCMP.B„#$81,D0Faultinterruptpending?ŠBEQ.S„PRTI010Branchifyes. 1ŠAND.W„#$FFFE,SR‹Notforme,sosetconditionand ŠRTSšreturn.*K*‚Itwasforme,butifthechannelisoff-lineornotattached,justexit.*"PRTI010ƒBTSTW„#CCBFGOFF,CCBSTR(A5)"ŠBNE.S„PRTI020Branchifoff-line.ŠBTSTW„#CCBFGATH,CCBSTR(A5)1ŠBEQ.S„PRTI020Branchifchannelisnotattached.ŠTST.B„PRNTBUSY(A5)1ŠBNE.S„PRTI100BranchifwehaveI/Oinprogress. 2PRTI020ƒBSR.L„DDP_RESETDisabledeviceinterrupts.)ŠOR.W…#$0001,SRWehandledtheinterrupt.ŠRTSŠPAGE*:*‚Theinterruptisforme,andthereisI/Oinprogress...*INT_REGS‚REG…D1-D7/A2-A4/A6 PRTI100:;ŠMOVEM.LINT_REGS,-(SP)‡SavetheregistersnotsavebyCMR.+ŠBSR.LƒDDP_RESETŒDisabledeviceinterrupts. 9ŠADD.B„#1,INTR_CNT(A5)…Incrementpendinginterruptcount.$ŠJSR†INTR_RECŒLetPRNTLIBhandleit. *2* Printer interrupt handler exits from this point.* PRTINRTN:9ŠSUB.B„#1,INTR_CNT(A5)†Decrementpendinginterruptcount..ŠMOVEM.L‚(A7)+,INT_REGS‡Restoretheregisters.(ŠOR.W…#$0001,SRŒSetreturnconditionandŠRTS›returntoCMR.ŠTTL†PIADRV.SAŠPAGEO********************************************************************************!*’ROUTINESƒCALLEDƒBY**œPRNTLIB**O*******************************************************************************‰PAGEN*******************************************************************************0*ˆDDP_OUTPUTƒOUTPUTTHECHARACTERTOTHEPRINTER*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto.*ˆoutputthecharacterinD0.Btotheprinter.**6*ˆEntry:D0.B=charactertobeoutputtotheprinter.#*A5ƒ=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D‚P**™A„*‡P**ˆCalls:GET_STAT‚DDP_RESET*/*ˆExit:‚RTStocallerwithconditioncodesset:-*ˆCharacterwasoutputandacknowledged.=*,‚Characterwasoutputbutnotacknowledged(yet).2*,‚Printererrorconditionwasdetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** DDP_OUTPUT: 7ŠMOVEM.L‚D0-D1/A1,-(SP)†Savetheregisterswewilluse. 1ŠMOVE.LƒCCBCHB(A5),A1‡A1<--devicebaseaddress.'ŠBSR.L„GET_STATŒGetthecurrentstatus.ŠBEQ.S„PRNT_OKBranchifok.*9*‚Printererrorcondition(outofpaperornotselected):* =ERROR_RETBSR.L„DDP_RESET‹Reprogramdevicefornointerrupts.3ŠMOVE.Wƒ#1,D0Return,-->errordetected.6ŠMOVEM.L‚(SP)+,D0-D1/A1†Restoretheregistersweused.ŠRTSŠPAGE*J* Output the character; but before we output, see if we are to check BUSY.*  ,EQ410…EQU†CONFGBLK+IOSATW…User'sattributes. GPRNT_OKƒBTSTW„#IOABUSY,EQ410(A5)‚Seeiftheuserwantsustowaituntil6ŠIF‚‚THENtheprinterisnotBUSYbeforeprinting.ŒMOVE.BDEV1BD(A1),D14ŒAND.B‚#$07,D1MaskBUSY,OUT-OF-PAPERandSELECTED.0ŒCMP.B‚#$05,D1WaitaslongasweareBUSY,have&ŒBEQ.S‚PRNT_OKpaperandareSELECTED.ŒCMP.B‚#$01,D17ŒBNE.S‚ERROR_RET‹ErrorifOUT-OF-PAPERornotSELECTED.ŠENDI +ŠMOVE.BƒD0,DEV1AD(A1)‡Outputthedatabyte.9ŠMOVE.BƒD0,DEV1AD(A1)‡Allowdatatosettlebeforestrobe.ŠMOVE.BƒD0,DEV1AD(A1)‡*ŠMOVE.BƒD0,DEV1AD(A1)‡*ŠMOVE.BƒD0,DEV1AD(A1)‡* <ŠBCLR…#3,DEV1AC(A1)‡Strobepulsegoeslow(strobethedata).-ŠBCLR…#3,DEV1AC(A1)‡Stretchthestrobepulse.ŠBCLR…#3,DEV1AC(A1)‡*ŠBCLR…#3,DEV1AC(A1)‡*ŠBCLR…#3,DEV1AC(A1)‡* /ŠBSET…#3,DEV1AC(A1)‡Strobepulsebackhighnow. 6ŠMOVE.Wƒ#32,D1ŽTestfortheprinteracknowledgepulse.CWAIT_ACK‚BTST.Bƒ#7,DEV1AC(A1)‡Iftheacknowledgearrivesbeforethe6ŠBNE.S„OUT_OKŽlooptimesout(approx.100us)proceed.)ŠDBRA…D1,WAIT_ACK‰Otherwise,return. 0ŠMOVE.Wƒ#-1,D0ŽReturn,-->noACKyet.6ŠMOVEM.L‚(SP)+,D0-D1/A1†Restoretheregistersweused.ŠRTS =OUT_OK„TST.B„DEV1AD(A1)ŠCleartheACKNOWLEDGEinterruptflag.ŠMOVE.Bƒ#0,D0Setstatus.6ŠMOVEM.L‚(SP)+,D0-D1/A1†Restoretheregistersweused.ŠRTSŠPAGEN*******************************************************************************'*ˆGET_STAT„DETERMINETHEPRINTERSTATUS*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto9*ˆchecktheprinterstatusforselectedandout-of-paper.****ˆEntry:A5=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™A„*‡P* *ˆCalls:none*/*ˆExit:‚RTStocallerwithconditioncodesset:3*‚Printerisselectedandisnotout-of-paper.2*‚Printerisnotselectedorisout-of-paper.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** GET_STAT: 0ŠMOVE.LƒA1,-(SP)ŒSavetheregisterswewilluse. .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress.2ŠMOVE.BƒDEV1BD(A1),D1‡Pickupthestatusregister.&ŠAND.B„#$03,D1Maskuninterestedbits.-ŠCMP.B„#$01,D1SelectedandnotOut-of-Paper? /ŠMOVE.Lƒ(SP)+,A1ŒRestoretheregistersweused.&ŠRTSšReturntocallerwithstatusset.ŠPAGEN*******************************************************************************.*ˆDDP_RESETƒRESETTHEDEVICEFORNOINTERRUPTS*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto>*ˆsetupthedevicecontrolregistersandturnoffinterrupts.****ˆEntry:A5=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™A„*‡P* *ˆCalls:none**ˆExit:‚RTStocaller.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** DDP_RESET: ŠPUSH…SRŠINHIBIT–Disableinterrupts. 0ŠMOVE.LƒA1,-(SP)ŒSavetheregisterswewilluse. .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress. ?ŠMOVE.Bƒ#DSDVIA,DEV1AC(A1)‚ProgramtheA-side(interruptsoff).?ŠMOVE.Bƒ#DSDVIB,DEV1BC(A1)‚ProgramtheB-side(interruptsoff). +ŠTST.B„DEV1AD(A1)ŠClearACKƒinterruptflag.-ŠTST.B„DEV1BD(A1)ŠClearFAULTinterruptflag. /ŠMOVE.Lƒ(SP)+,A1ŒRestoretheregistersweused.ŠPOP†SR ŠRTSšReturn.ŠPAGEN*******************************************************************************5*ˆDDP_ENA_INTRƒENABLEFORINTERRUPTSFROMTHEPRINTER*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto%*ˆenablethehardwareforinterrup  ts.****ˆEntry:A5=physicaladdressoftheCCB.*;*Interruptlevelatthehardwareinterruptlevel(masked).*!*ˆRegisterusage:…01234567*™D*™A„*‡P* *ˆCalls:none**ˆExit:‚RTStocaller.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** DDP_ENA_INTR: 0ŠMOVE.LƒA1,-(SP)ŒSavetheregisterswewilluse. .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress.3ŠBSET…#0,DEV1BC(A1)‡EnabledeviceFAULTinterrupts.1ŠBSET…#0,DEV1AC(A1)‡EnabledeviceACKƒinterrupts. /ŠMOVE.Lƒ(SP)+,A1ŒRestoretheregistersweused. ŠRTSšReturn.ŠPAGEN********************************************************************************‰FINISHOFFTHEINITIALIZATION*2*‰Theseotherdevice-dependentthingsMUSTbedone>*‰beforewecanhandlecommands.‚Theyprobablycouldhavebeen?*‰doneinINITatthestartofthedriverbutarehandledhere.*.*‰1.‚ProgramthePIApinsforinputoroutput.A*‰2.‚ProgramthePIAforthedesiredmodeanddisableinterrupts.2*‰3.‚TurnofftheLEDifthisisaRTTLIOchannel.**‰Entry:A5=addressofCCB.* *‰Calls:none*N****************************************************************************** DO_INIT: ŠPUSH…SRŠINHIBIT–Disableinterrupts. .ŠMOVE.LƒCCBCHB(A5),A1‡Getdevicebaseaddress.>ŠMOVE.Bƒ#$00,DEV1AC(A1)…SelectA-sideDataDirectionRegister.>ŠMOVE.Bƒ#$00,DEV1BC(A1)…SelectB-sideDataDirectionRegister.=ŠMOVE.Bƒ#$FF,DEV1AD(A1)…SetA-sideasalloutput(dataport). *ŠCMP.B„#XTPRTL,CCBTYPE(A5)RTTLIOchannel?0ŠIF‚‚THENYes-setPB7asanoutputforLED;ŒMOVE.B#$80,DEV1BD(A1)…control,PB6-PB0arestatusinputs.ŠELSE:ŒMOVE.B#$00,DEV1BD(A1)…No-setPB7-PB0asstatusinputs.ŠENDI 8ŠBSR.S„DDP_RESET‹ProgramthePIAanddisableinterrupts. *ŠCMP.B„#XTPRTL,CCBTYPE(A5)RTTLIOchannel? ŠIF‚‚THEN5ŒMOVE.B#00,DEV1BD(A1)†Yes-turnofftheRTTLIOLED.ŠENDI ŠPOP†SRŠRTS ŠDS.W…30ŠENDNNN‰PAGE:PRNTLIB‚IDNT†45,0†VERSAdosprinterdrivergenericroutines6‰TTL‡PRNTLIB:‚VERSAdosprinterdrivergenericroutines ‰LLEN†120 ‰OPT‡CRE,PCS,BRSO*******************************************************************************O*******************************************************************************O********************************************************************************+*‰PRNTLIB:‚VERSAdos‚Printer‚Driver‚Routines*:*‰Purpose:‚Acollectionofprinterdriverroutinesusedto *“supportthefollowingdrivers: *œP050DRV *œP117DRV*œPIADRV**‰Revisionhistory:7*12/06/85‚InstallNEWKillermodificationwhichleaves,*šTheDriverID(Number)andReason(Number)2*šinCRASHSAValongwiththeCCBandDCBpointers.<*11/12/85‚ExtractedfromVERSAdos4.4releaseofP050DRV.SA**‰RMS68Kroutinesused: *TR0$.RQPA*TR0$.QEVENTI*TR0$.QEVENTT *TR0$.LOGPHY*TR0$.DRIVKILL *TR0$.GETTCB**‰Othernotes:0*ThiscodeisROMableandposition-independen  t.*O*******************************************************************************O*******************************************************************************O*******************************************************************************  * *‚INCLUDES***ˆ9995.&.IOE.EQ*ˆ9995.&.STR.EQ*ˆ9995.&.TCB.EQ*ˆ9995.&.NIO.EQ*ˆ9995.&.LV5.EQ*ˆ9995.&.CCB.EQ*ˆ9995.&.UTILITY.MC*ˆ9995.&.PRNT.EQ*ˆ9995.&.PRNTCCB.EQ*ˆ9995.&.KILL.MC*ˆ9995.&.KILLDRV.EQ*‰NOLIST‰INCLUDEƒ9995.&.IOE.EQ‰INCLUDEƒ9995.&.STR.EQ‰INCLUDEƒ9995.&.TCB.EQ‰INCLUDEƒ9995.&.NIO.EQ‰INCLUDEƒ9995.&.LV5.EQ‰INCLUDEƒ9995.&.CCB.EQ‰INCLUDEƒ9995.&.UTILITY.MC‰INCLUDEƒ9995.&.PRNT.EQ‰INCLUDEƒ9995.&.PRNTCCB.EQ‰INCLUDEƒ9995.&.KILL.MC‰INCLUDEƒ9995.&.KILLDRV.EQ‰LIST‰PAGEO********************************************************************************4*ƒEQUATESANDMACROSFORTHEGENERICPRINTERLIBRARY*¤J­NµB½KÅ2Í<Õ=Ý<å;í:õ9ý;7 :4=%>-35?=2E9MEUH]3e3m;uO*********************************************************************************@*ƒOFFSETTOMARKTHEENDOFTHESERVICEVECTORTABLEINADRIVER*SERVECT‚EQU‡$28*=*‚ADRIVERTHATWISHESTOUSEPRNTLIBMUSTHAVETHEFOLLOWING>*‚BRANCHTABLEIMMEDIATELYFOLLOWINGTHESERVICEVECTORTABLE:**†BRA.L‡DDP_OUTPUT*†BRA.L‡GET_STAT*†BRA.L‡DDP_RESET*†BRA.L‡DDP_ENA_INTR*‰OFFSET„SERVECTT_DDP_OUTPUT‡DS.L†1T_GET_STAT‰DS.L†1T_DDP_RESETˆDS.L†1T_DDP_ENA_INTR…DS.L†1** O********************************************************************************>*ƒMACROTOPERFORMTHEJUMPTOthedeviceDEPENDENTSUBROUTINE**ƒAssumption:‚None.**ƒCalledby:ƒT_JSR‚ROUTINE*2*‰where‚T_ROUTINEisanoffsetintheabovetable.*O******************************************************************************** T_JSR„MACRO ‰IFC'\1','' ŒFAIL‚400ŒMEXIT‰ENDC‰MOVE.LA4,-(SP)‰MOVE.LDRV_ADDR(A5),A4 ‰JSR„T_\1(A4)‰MOVE.L(SP)+,A4‰ENDM‰PAGEO********************************************************************************2*ƒDescriptionsoftheroutinesrequiredbyPRNTLIB*O*******************************************************************************  N*******************************************************************************0*ˆDDP_OUTPUTƒOUTPUTTHECHARACTERTOTHEPRINTER*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto.*ˆoutputthecharacterinD0.Btotheprinter.**6*ˆEntry:D0.B=charactertobeoutputtotheprinter.#*A5ƒ=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D‚P*™AŒP**ˆCalls:GET_STAT‚DDP_RESET*/*ˆExit:‚RTStocallerwithconditioncodesset:-*ˆCharacterwasoutputandacknowledged.=*,‚Characterwasoutputbutnotacknowledged(yet).2*,‚Printererrorconditionwasdetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N******************************************************************************ŠPAGEN*******************************************************************************'*ˆGET_STAT„DETERMINETHEPRINTERSTATUS*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto9*ˆchecktheprinterstatusforselectedandout-of-paper.****ˆEntry:A5=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™AŒP* *ˆCalls:none*/*ˆExit:‚RTStocallerwithconditioncodesset:3*‚Printerisselectedandisnotout-of-paper.2 *‚Printerisnotselectedorisout-of-paper.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N******************************************************************************ŠPAGEN*******************************************************************************.*ˆDDP_RESETƒRESETTHEDEVICEFORNOINTERRUPTS*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto>*ˆsetupthedevicecontrolregistersandturnoffinterrupts.****ˆEntry:A5=physicaladdressoftheCCB.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™AŒP* *ˆCalls:none**ˆExit:‚RTStocaller.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N******************************************************************************  N*******************************************************************************5*ˆDDP_ENA_INTRƒENABLEFORINTERRUPTSFROMTHEPRINTER*C*ˆThis‚isadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto%*ˆenablethehardwareforinterrupts.****ˆEntry:A5=physicaladdressoftheCCB.*;*Interruptlevelatthehardwareinterruptlevel(masked).*!*ˆRegisterusage:…01234567*™D*™AŒP* *ˆCalls:none**ˆExit:‚RTStocaller.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N******************************************************************************‰PAGEO********************************************************************************;*ƒDEVICE-DEPENDENTROUTINES‚THATARENOTCALLEDBYPRNTLIB,9*ƒBUTNEVERTHELESSNEEDTODOCERTAINTHINGSFORPRNTLIB.*O*********************************************************************************INIT:>*…ThisistheentrypointforanINITIALIZATIONcallfromCMR.*‰INITmustdothefollowing:*6*ŽPutthestartingaddressofthedriverintotheCCB:*LEA…MY_DRVR(PC),A0*MOVE.L‚A0,DRV_ADDR(A5)**‘....**“RTSO*******************************************************************************‰PAGE** *‚XREF's.**C*‚ThisXREFisfromthedriverlibraryDRVLIB.ROwhichislinkedin*‚atSYSgentime.*0‰XREF†LOGPHYŽConvertlogicaladdresstophysical6‰XREF†I_NRM_QEVENTˆQueueanormalI/Ocompletionevent*¦frominterrupthandler6‰XREF†N_NRM_QEVENTˆQueueanormalI/Ocompletionevent*¦fromcommandlevel.4‰XREF†N_HLT_QEVENTˆQueueahaltI/Ocompletionevent*¦fromcommandlevel./‰XREF†SET_TIMEŒRequestatimeractivationcall.**L*‚TheseXREF'sarefromthePRTTYPEmodule,tableofvalidprinterchannels.*0‰XREF†CH_TYPESŒChanneltypesforprinterdrivers0‰XREF†NUMTYPESŒNumberofsupportedchanneltypes5‰XREF†NUMBYTESŒNumberofbytesberentryinthetable *(*‚XDEF'Sforthedevice-dependentmodule*2‰XDEF†PRNT_INIT‹Device-independentinitialization.6‰XDEF†PRNT_COMMANDˆDevice-independentcommandhandler.)‰XDEF†INTR_RECŒInterrupthandlerroutine..‰XDEF†FLT_TIMER‹Printerfaulthandlerroutine.  ‰SECTION14PRNTLIB: **‚Identificationmnemonic*‰DC.B†'!PRNTLIB'**‚Revisioninfo:*/ŠDC.Bƒ'120685'‹DateoflastassemblyasMMDDYY.1ŠDC.Bƒ''Spaceindicatesnopatchesto.LOfile.)ŠDC.Bƒ'4'MajorVERSAdosrevisionnumber.*ŠPAGEO*********************************************************************************‰NOTESONCODINGSTANDARDS*O******************************************************************************* G*‚BecausethisisanI/Odriver,speedisoftheutmostimportance,andG*‚asaresulttradeoffsweremadedecreasingthestraightforwardnessofL*‚thecodeinfavoroflesstimespentprocessinginterrupts.‚Inparticular,F*‚theinterruptserviceportionofthisdriverisnotatallmodular--H*‚some'routines'havemultipleentryandexitpoints,andr eturnisnot*‚alwaystothecaller.*G*‚OnevisualaidusedwhichmaysaveyousomeworkistheuseoflabelsD*‚inexecutablecode.‚Considerthefollowingsampleprogramsegment:*.*‰LABEL1:˜labelaloneonline,followedby':'*‘MOVE.B......7*‰LABEL2:ADD.B‚......Šlabelnotalone,followedby':'-*‰LABEL3‚CMP.B‚......Šlabelnotalone,no':'*F*‚Eachwayofwritingthelabelhasitsownsignificance.‚LABEL1marksC*‚thebeginningofalogicalmodule,andnothingfallsintoLABEL1.G*‚LABEL2isalabelbranchedtofromoutsidethelogicalmodule.‚LABEL3F*‚isa'local'label,branchedtoonlyfromwithinthelogicalmodule.  >*‚Foreachsubroutine,registerusageisspecifiedasfollows:**‰Entry:A5=addressofCCB**‰Exit:‚A0=garbage(*A1=addressofoursideofthedevice*G*‚TheentryconditionsspecifyonlytheREQUIREMENTSoftheroutine.‚InI*‚otherwords,aregistermaybeknowntocontainaparticularvalue,butI*‚ifitisnotusedbyaroutine,itisnotlistedasanentrycondition.J*‚TheexitconditionslistonlythoseregisterswhichCHANGE.‚IntheaboveH*‚example,thefactthatA5isnotlistedasanexitconditionindicates"*‚thatitstillpointstotheCCB.*J*‚Ifamoduledoesnotrepresentasubroutine(thatis,willnotreturntoK*‚thecodeitwasenteredfrom),theexitconditionsfortheregisterswill*‚notbespecified.ŠPAGEJ****************************************************************************‰COMMANDSWITCHINGTABLE*:*‰Theseareusedbythecommandserviceroutinetojumpto.*‰theappropriateroutinetohandleacommand.*J************************************************************************** ŠDS…0 CMDTBL:$ŠDC.WƒIOSTATREQUESTSTATUScommand.2ŠDC.WƒIOCHDCCHANGEDEFAULTCONFIGURATIONcommand.ŠDC.WƒIOCNFGCONFIGUREcommand.ŠDC.WƒIOWRITWRITEcommand. =NUMCMDSƒEQU„(*-CMDTBL)/2‡Thenumberofcommandsinthetable. JMPTBL:ŠDC.WƒREQSTAT-*ŠDC.WƒDFCONFIG-*ŠDC.WƒCONFIG-*3ŠDC.WƒWRITE-*ŒBiasestothecorrespondingroutines. 7JMPOFF„EQU„JMPTBL-CMDTBL†Offsetbetweenthetwotables.'*£Havingfoundthecommandinthefirst&*£table,thisoffsetisusedtogetto(*£thecorrespondingvalueinthesecond.‰PAGEO*******************************************************************************O*******************************************************************************O*********************************************************************************ˆINITIALIZATIONROUTINE*B*ˆThis‚subroutineiscalledfromthedevice-dependentdriverafterA*ˆitreceivesaninitializationcallfromCMR.‚It'spurposeisto?*ˆsetthingsupforcommandserviceandinterruptservice.‚It's*ˆspecificfunctionsare:**Š1.Validatethechanneltype.4*Š2.Fillinthedrivercode,recognizedattributes,*andrecognizedparameters.*:*ˆEntryisthroughaJSRfromthedevice-dependentmodule.?*ˆEntryisatinterruptlevel0,andweareinsupervisormode.*%*ˆEntry:„A6=physicaladdressofTCB*’A5=physicaladdressofCCB*!*ˆRegisterusage:ˆ01234567*œD‚***œA‚*‰P*D*ˆExit:…RTStothedevice-dependentmodulewithconditioncodesset: *”and‚channelisdown./*”‹allwentwell,OKtoproceedwithdevice*£dependentI/O.*O*******************************************************************************O*******************************************************************************O******************************************************************************* ‰SECTIONƒ14‰DSˆ0 PRNT_INIT:*F*‚Checkthechanneltypefieldwearesupposedtobetomakesureit's*‚atypethisdriverhandles.*/ŠMOVE.BCCBTYPE(A5),D0…D0<--ourchanneltype.7ŠLEA„CH_TYPES,A0ˆA0<--addroftableofchanneltypes. ŠFOR.W…D1=#1‚TO‚#NUMTYPESƒDOŒCMP.Bƒ(A0)+,D0 ŒBEQ‡CH_FOUNDŒADD.L…#NUMBYTES-1,A0ŠENDF*%*„BADCHANNELTYPE!!!„SENDBACK*A‰MOV E.B#ISTAICE,CHANDOWN(A5)‚ReturnIndeterminateChannelError.)‰MOVE.B„#-1,D0‹Setconditioncodeto#‰RTS˜andreturntocallingroutine.‰PAGE**…GOODCHANNELTYPE!!!*CH_FOUND*D*…Ourdevicecodeandchanneltypematchesthatstoredinthetable.<*…LoadDRV_CODE,REC_ATTandREC_PARfromthetableentries.**—Channeltype‹(byte)*ŒA0‚---->‚Drivecode(byte)*—Recognizedattributes‚(word)*—Recognizedparameters‚(word) <‰MOVE.B„(A0)+,DRV_CODE(A5)‚StorethedevicecodeintheCCB.7‰MOVE.W„(A0)+,REC_ATT(A5)ƒSetuptheattributesandthe6‰MOVE.W„(A0)+,REC_PAR(A5)ƒparametersmasksintheCCB. (‰MOVE.B„#0,D0Returnstatus(good).‰RTS‰PAGEO*******************************************************************************O*******************************************************************************O*********************************************************************************ˆCOMMANDSERVICEROUTINE*B*ˆThissubroutineiscalled‚fromthedevice-dependent‚driverafterD*ˆitreceivesacommandtoinitiateanI/OtransactionwithadeviceB*ˆthatiscontrolledbythatdriver.‚Thepurpose‚ofthismoduleis@*ˆtoperformthe‚commontasks‚thatare‚necessaryfor‚allcommand@*ˆroutines,andto‚directcontrol‚tothe‚individualroutine‚thatB*ˆprocessesthegivencommand‚throughthecommandswitching‚table.*5*ˆEntry:„A2=physicaladdressofCMRparameterblock*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*"*ˆRegistersusage:„01234567 *™D‚**‡***™A‚*ƒPRRPP*$*ˆEXIT:…A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*9*ˆExitsto:Theroutinethatprocessesthegivencommand.*O*******************************************************************************O*******************************************************************************O******************************************************************************* PRNT_COMMAND: 6‰MOVE.LƒSP,SAVESP(A5)ŠSavethestackpointersowecan$*¦laterabortatanylevelofnested$*¦subroutinesandeasilyrestorethe%*¦stackenvironmentthatexistedwhen*¦thisroutinebeganexecution. :‰MOVE.LƒXIOCPK(A2),D6ŠGetthephysicaladdressoftheIOCB2‰MOVEQ.L‚#0,D5forthecommandintoA4.‚Subroutine7‰MOVE.WƒXIOPLN(A2),D5ˆLOGPHY1convertsthelogicalIOCB?‰MOVE.LƒCCBTASKA(A5),A0†address(inD6)intoaphysicaladdress)‰BSR.L„LOGPHY1Žforus.‚SubroutineLOGPHY11‰MOVE.LƒD6,A4returnsthephysicaladdressofthe *¦IOCBinD6. 9‰MOVE.LƒXIOUID(A2),A3ˆA3<--physicaladdressoftheDCB. 3‰MOVEQIƒISTACDN,D1Ifthechannelisdown,goqueue:‰TST.B„CHANDOWN(A5)‰aneventtotheattachedtasktoindi-8‰BNE.S„CMDEXIT2catethatthechannelisoutofservice.‰PAGE.‰MOVE.WƒIOSFCT(A4),D6ˆD6<--functionofIOCB. **‚CheckforHALTcommand.* ŠCMP.W‚#IOHALT,D6ŒHALTcommand?#ŠBEQ.L‚HALT’BranchifHALTcommand. ,ŠMOVE.LA3,DCBPNTR(A5)ˆSavetheDCBaddress.-ŠMOVE.LA4,IOCBPTR(A5)ˆSavetheIOCBaddress.ŠMOVE.LCCBTASKA(A5),D0-ŠMOVE.LD0,TCB_ADDR(A5)‡SavetheTCBaddress.ŠMOVE.WIOSOPT(A4),D06ŠMOVE.WD0,IOOPTS(A5)‰Savetheuser'scommandoptions. ** See if channel is busy.*"ŠTST.B„PRNTBUSY(A5)ˆChannelbusy? ŠIF‚‚THEN6ŒMOVE.B#XSTBSY,D0ŠBusy,setupchannelerrorcodeand ŒRTS˜return.ŠENDI -‰MOVEQ„#NUMCMDS-1,D0ˆSetuptheloopcounter.:‰MOVEQ„#JMPOFF,D1‹D1<--offsetbetweencmdandJMPtables/‰LEA†CMDTBL,A0ŒA0<--addressofcommandtable. 9CMD_SRCHCMP.W„(A0)+,D6Searchthetableforthecommand.‰DBEQ…D0,CMD_SRCHŠ* 3‰IF‚‚THENIfwefoundthecommandinthetable,8‹ADD.W‚-2(A0,D1),D1‰getthecorrespondingentryfromthe4‹JMP„-2(A0,D1)Œjumptableandjumptotheroutineto‰ENDIšhandlethecommand. 1‰MOVEQIƒISTAIF,D1ŒWedidn'tfindit,soexitwith(‰BRA.S„CMDEXIT2INVALIDFUNCTIONstatus.‰PAGEO*******************************************************************************O** ****************************************************************************** *ˆREQUESTSTATUSCOMMANDROUTINE*G*ˆThecommandserviceprocessorinvokestheREQSTATroutineinresponseE*ˆtoastatuscommand.‚Itspurpose‚istosetuptheusertask'spara-E*ˆmeterblocktoreflectthe‚drive'scurrentstatusandconfiguration<*ˆbasedontheconfigureblockinthechannelcontrolblock.*%*ˆEntry:„A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask**!*ˆRegisterusage:…01234567*™D‚**™A‚***PPP**ˆCalls:„STATCONF*7*ˆExit:…Fallsthroughtocommonexitroutine(CMDEXIT).*O*******************************************************************************O******************************************************************************* REQSTAT: 7ŠLEA†CONFGBLK(A5),A1‡SetupA1topointtothestartof%*¦theconfigurationblockintheCCB. 2ŠBSR.S„STATCONFŽSetIOSDST,IOSCTP,IOSDTP,IOSDRC%*¦intheusertask'sparameterblock. ?ŠMOVE.WƒREC_ATT(A5),IOSATM(A1)Setthesupportedattributesand<ŠMOVE.WƒREC_PAR(A5),IOSPRM(A1)parametersmasksintheusers(*¦parameterblock.‚Themaskscontainall(*¦ofthebitssignificanttothedriver. >ŠMOVE.Lƒ#(IOSPLN/2)-1,D0„CopythecurrentconfigurationvaluesAREQLOOPƒMOVE.Wƒ(A1)+,(A2)+‰fromtheconfigureblockintheCCBto8ŠDBRA…D0,REQLOOPŠtheusertask'sstatusparameterblock.ŠPAGEO*********************************************************************************ˆCOMMONEXITROUTINE*B*ˆTheCMDEXIT‚routineisa‚commonexitroutinethatisusedbytheC*ˆmanydifferentpathsthroughthecommandserviceroutine.‚ControlC*ˆcomestooneofthreeentrypointsbelowtoterminateprocessing.*%*ˆEntry:„A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB3*’A6=physicaladdressofTCBoftheattachedtask**D1.B=IOSSTAstatusvalue*!*ˆRegisterusage:…01234567*™D‚RP *™A‚*…PPP*1*ˆExit:…Returntodevice-dependentmoduleviaRTS*O*******************************************************************************  BCMDEXIT1MOVEQIƒISTAOK,D1ŒWe'vefinishedprocessingacommandwith'*¦noerrorsandwewanttoqueueanI/O(*¦completioneventtotheattachedtask. ECMDEXIT2LEA‡DO_EVENT(PC),A0…We'vefinishedprocessingacommandwith8‰MOVE.L„#T0GUARD,D0‰anerrorandwewanttoqueueanI/O2‰TRAP†#EXECcompletioneventtotheattachedtask.$*¦Thestatusvalueforthecompleted&*¦commandisinD1.Bwhenwegethere. "*¨WeuseCALL-GUARDEDtoqueuethe&*¦eventforcommandcompletionsothat&*¦itwillbeprotectedfromanyevents$*¦queuedfromtheinterrupthandler. BCMDEXIT3MOVE.LƒSAVESP(A5),SPŠRestorethestackpointer,andclear4‰MOVEQ„#0,D0D0toindicatethatthecommandservice(‰RTS›routinehasoperatedproperly.‚Then$*¦returncontroltotheroutinethat"*¦calledsubroutinePRNT_COMMANDS. #*¨Thisexitisvalidfromanylevel&*¦withinthedriverbecausewerestore(*¦theSPassaveduponentry.Thedriver*¦remainsre-entrant.‰PAGEO******************************************************************************** *ˆSTATUS/CONFIGURECOMMONCHORES*F*ˆThesubroutineSTATCONFperformsfunctionsthatarecommontostatus?*ˆcommands,configurecommands,anddefaultconfigurecommands.*6*ˆEntry:„A1=pointertoconfigureblockofCCBorDCB*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™DŒ***™A‚*PRPPP*&*ˆExit:…Returntothecallingroutine.<*’A2<--startofusertask'sconfig/statusparameterblock.*O******************************************************************************* STATCONF: ;ŠMOVE.L‚IOSDBP(A4),D6ŠGetthephysicaladdressofthefirst9ŠMOVE.L‚#IOSDLN,D5‹locationoftheusertask'sconfigure/?ŠMOVE.L‚TCB_ADDR(A5),A0†status parameterblockintoD6.‚LOGPHY17ŠBSR.LƒLOGPHY1Žconvertsthelogicaladdresoftheusers6ŠMOVE.L‚D6,A2parameterblockintoaphysicaladdress. 1ŠCLR.BƒIOSDST(A1)ŽReturn'on-line'devicestatus.7ŠMOVE.B‚CCBTYPE(A5),IOSCTP(A1)‚Returnthechanneltype.2ŠMOVE.B‚#XDSPRT,IOSDTP(A1)†DevicetypeisPRINTER.7ŠMOVE.B‚DRV_CODE(A5),IOSDRC(A1)Returnthedrivercode.ŠRTSŠPAGEO*******************************************************************************O*********************************************************************************ˆDEFAULTCONFIGURECOMMAND*H*ˆThecommandserviceprocessorinvokestheDFCONFIGroutineinresponseG*ˆtoadefaultconfigurecommand.‚Itspurposeistoestablishorchange>*ˆthedrive'sdefaultconfiguration,whichiskeptintheDCB.*ˆarea.*%*ˆEntry:„A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*!*ˆRegisterusage:…01234567 *™D‚*****™A‚***PPP**ˆCalls:„STATCONF*;*ˆExit:…Branchestocommonconfigurationchores(CONFGCOM).*O*******************************************************************************O******************************************************************************* DFCONFIG: 5ŠLEA†DCBDEV(A3),A1‰SetupA1topointtothestartof%*¦theconfigurationblockintheDCB. 2ŠBSR.S„STATCONFŽSetIOSDST,IOSCTP,IOSDTP,IOSDRC%*¦intheusertask'sparameterblock. 2ŠBRA.S„CONFGCOMŽBranchtothecommonconfiguration *¦routine.ŠPAGEO*******************************************************************************O*********************************************************************************ˆCONFIGURECOMMAND*F*ˆThecommandserviceprocessorinvokestheCONFIGroutineinresponseC*ˆtoa‚configurecommand.‚Itspurposeistoestablishor‚changethe:*ˆdrive'scurrentconfiguration,whichiskeptintheCCB.*%*ˆEntry:„A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*!*ˆRegisterusage:…01234567 *™D‚*****™A‚***PPP**ˆCalls:„STATCONF*B*ˆExit:…FallsthroughtoCONFGCOMforcommonconfigurationchores.*O*******************************************************************************O******************************************************************************* CONFIG: 7ŠLEA†CONFGBLK(A5),A1‡SetupA1topointtothestartof%*¦theconfigurationblockintheCCB. 2ŠBSR.S„STATCONFŽSetIOSDST,IOSCTP,IOSDTP,IOSDRC%*¦intheusertask'sparameterblock. =ŠMOVE.B#CECCDO,D3‰Ifhe'stryingtochangethewritetimeout?ŠBTSTW‚#IOSWTOB,IOSPRM(A2)value,returnaconfigurationerror.ŠBNE.L‚CONERROR DŠMOVE.LDCBDEV+IOSWTO(A3),IOSWTO(A1)Update(intheCCB)thetimeout+*£valuesfromtheDCBsotheycanbecopied-*£andfallintocommonconfigurationroutine.ŠPAGEO*********************************************************************************ˆCOMMONCONFIGURATIONCHORES*D*ˆThe‚CONFGCOM‚routineisusedbythe‚configure(CONFIG)anddefaultF*ˆconfigure(DFCONFIG)routines.‚Itspurposeistodomostofthework*ˆforbothofthem.*6*ˆEntry:„A1=pointertoconfigureblockofCCBorDCB1*’A2=pointertousertask'sconfigurationblock*’A3=physicaladdressofDCB*’A4=physicaladdressofIOCB*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*!*ˆRegisterusage:…01234567 *™D‚**** *™A„PPPPP* *ˆCalls:„none*3*ˆExit:…BranchestoCMDEXIT1ifnoerrorsdetected.0*’BranchestoCONERRORforconfigurationerrors.*O******************************************************************************* CONFGCOM: 7ŠMOVE.Wƒ#CECUAP,D3ŒSetupforanerrorexitincasethe&*¦useristryingtochangeunsupported*¦attribut esorparameters. 3ŠMOVE.WƒIOSATM(A2),D0‡D0<--user'sattributebits.3ŠMOVE.WƒIOSPRM(A2),D2‡D2<--user'sparameterbits. 6ŠMOVE.Wƒ#$FFFF,D1Iftheuser'sattributebitscontain;ŠSUB.W„REC_ATT(A5),D1†anybitsthatarenotallowedforthe4ŠAND.W„D0,D1IOSATMfield,abortwiththeerrorcode7ŠBNE.L„CONERRORŒinD3.Btobereturnedtotheusertask*¦intheIOSDSTfield. 6ŠMOVE.Wƒ#$FFFF,D1Iftheuser'sparameterbitscontain;ŠSUB.W„REC_PAR(A5),D1†anybitsthatarenotallowedforthe4ŠAND.W„D2,D1IOSPARfield,abortwiththeerrorcode7ŠBNE.L„CONERRORŒinD3.Btobereturnedtotheusertask*¦intheIOSDSTfield. E*‚Nextweneedtoseewhathisproposedconfigurationwilllooklike.D*‚Plugintohisdatablockthecurrentvaluesforthoseattributes&?*‚parametershedoesn'twanttochange.‚Theappropriatecurrent(*‚configurationisatA1andhe'satA2.*6ŠMOVE.WƒIOSATM(A2),D0‡Setuptheusersattributemask.;ŠAND.W„D0,IOSATW(A2)‡Zeroouttheattributesofhisthathe.ŠNOT.W„D0’doesn'twanttochange,zerooutthe<ŠAND.W„IOSATW(A1),D0‡attributesofminethathedoeswantto:ŠOR.W…D0,IOSATW(A2)‡change,andcombinetheminhisspace. 8ŠMOVE.WƒIOSPRM(A2),D0‡Getparametershewantstochange. 1ŠLSR.W‚#1,D0‘Ifhe'snotchangingtheLINEWIDTH,)ŠIF…THEN.S‹copythecurrentsetting.MOVE.WIOSREC(A1),IOSREC(A2)ŠENDI 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheLINES/PAGE,)ŠIF…THEN.Sˆcopythecurrentsetting.MOVE.LIOSRSZ(A1),IOSRSZ(A2)ŠENDI 3ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheWRITETIMEOUT0ŠIF…THEN.Sˆvalue,copythecurrentsetting.MOVE.LIOSWTO(A1),IOSWTO(A2)ŠENDI 3ŠLSR.W‚#2,D0ŽSkipovertheREADTIMEOUTbit.Ifthe'*£LOGICALRECORDLENGTHbitisnotset,*£copythecurrentsetting.ŠIF…THEN.SMOVE.WIOSLRL(A1),IOSLRL(A2)ŠENDI 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheEND-OF-LINE1ŠIF…THEN.SˆSTRING,copythecurrentsetting.MOVE.BIOSELC(A1),IOSELC(A2)ŠENDI*I*ƒNowthattheusersconfigurationblockcontainstheproposedattributesG* and parameters, they will be checked for validity before copying them* into the DCB or CCB.*8ŠMOVE.Bƒ#CECPNI,D3ŠIftheauto-linefeedattributeisset@ŠBTSTW„#IOALNFD,IOSATW(A2)andtheendoflinecharacterisnull+ŠIF‚‚THENreturnaconfigurationerror.ŒTST.B‚IOSELC(A2)ŒBEQ.S‚CONERRORŠENDI <ŠMOVE.Bƒ#CECPRLZ,D3‰Ifeitherthelogicalorphysicalrecord<ŠMOVE.WƒIOSREC(A2),D0‡lengthiszero,returnaconfigurationŠBEQ.S„CONERRORŒerror.ŠMOVE.WƒIOSLRL(A2),D2ŠBEQ.S„CONERROR 4ŠCMP.W„D2,D0Ifthelogicalrecordlengthisgreater5ŠBHS.S„OKCNFGŽthanthephysicalrecordlength,return*ŠMOVE.Bƒ#CECPLGP,D3‰aconfigurationerror.ŠBRA.S„CONERRORŠPAGE*F*…SettheconfigurationflagbyteinthedeviceDCBtoindicatethataK*‚CONFIGUREorCONFIGUREDEFAULTSrequestwasprocessed.FHSwillchecktheM*‚flagwhenitclosesthelastassignmenttothedevicetoseeifitneedstoH*‚tellIOStoissueaconfigurerequest.IOSwillthenissueaCONFIGUREJ*‚requestusingthedeviceDCBdefaultconfigurationparameters.ThiswillI*‚alwaysforcethecurrentconfigurationtothedefaultwheneverthelast*‚assignmentisclosed.**ˆExit:…BranchestoCMDEXIT3ifnoerrordetectedinprinting.,*’BranchestoCMDEXIT2iferrorisdetected.*O*******************************************************************************O******************************************************************************* WRITE:+ŠMOVE.LƒTCB_ADDR(A5),A0…A0<--TCBaddress. ŠBTSTW„#IOPTSKB,IOSOPT(A4)2ŠIF‚‚THENIfthebuffersresideinadifferent5ŒLEA„IOSTSK(A4),A0‡taskfromtheIOCB,gettheTCBofŒMOVE.L#T0GETTCB,D0ˆthattask. ŒTRAPƒ#EXEC#ŒBRA.S‚OKTCBBranchifgoodreturn,#ŒMOVE.B#XSTADB,D1Šelseexecerror.ŒBRA.L‚CMDEXIT2ŠENDI :OKTCB…MOVE.LƒA0,TCB_ADDR(A5)…SavephysicaladdressofTCB. :ŠADD.B„#1,TCBIOCNT(A0)…Incrementuser'spendingI/Ocount.*D*‚ValidatethebufferintheIOCBandconverttophysicaladdresses:*;ŠMOVE.LƒIOSSAD(A4),D6‡D6<--bufferphysicalstartaddress.+ŠMOVE.LƒIOSEAD(A4),D5‡D5<--bufferlength.ŠSUB.L„D6,D5* ŠADDQ…#1,D5*+ŠBSR.L„LOGPHY1Converttophysicaladdress. ;ŠMOVE.LƒD6,IOBUFPTR(A5)…SavephysicalstartaddressinCCB."ŠMOVE.LƒD6,A0A0<--bufferstart.0ŠADD.L„D5,D6Savephysicalendaddressplus1in ŠMOVE.LƒD6,IOBUFEND(A5)…theCCB.ŠPAGE%ŠST.B…PRNTBUSY(A5)ˆMarkchannelbusy.7ŠCLR.L„CHAR_CNT(A5)ˆInitializetheoutputbytecounter.#ŠT_JSR„DDP_RESET‹Setupthedevice. EQ410…EQU†CONFGBLK+IOSATW7ŠBTSTW„#IOASNFF,EQ410(A5)‚Iftheformfeedafterassign3ŠIF‚‚THENattributeis0sendaFFcharacterif9ŒTST.B‚DCBBCT(A3)ŠthisisthefirstoutputinthecurrentŒIF‚‚THENassignment.ŽST.BƒDCBBCT(A3)#ŽMOVE.B#FF,D0ŒFormFeedcharacter.&ŽBSR.L‚OUTPUTŒGooutputtheformfeed.ŒENDIŠENDI *J*‚Nowbegintooutputthecharacters(A0ispointingtothebufferstart):*-*‚CheckforIMAGEorFORMATTEDmodeprinting.*&ŠBTSTW„#IOPFORB,IOOPTS(A5)Imagemode?4ŠIF‚‚THENImagemodedoesnospecialprocessing.**‚PrintingIMAGEmode...* PRT_IMAGE:0ŒMOVE.B(A0)+,D0ŒGetnextdatabytefrombuffer.4ŒBSR.L‚OUTPUTŽSkipthespecialcharacterprocessing..ŒMOVE.LA0,IOBUFPTR(A5)…Updatebufferpointer..ŒADD.L‚#1,CHAR_CNT(A5)…Counteachbytesentto?ŒCMP.L‚IOBUFEND(A5),A0…theprinterwhetherprintableornot.If9ŒBNE.S‚PRT_IMAGE‹the endofthebufferisreached,dothe-ŒBRA.L‚PRTDONErequestcompletionprocessing.ŠENDIŠPAGE**‚PrintingFORMATTEDmode...*PRT_FORMATTED:0ŠMOVE.Bƒ(A0)+,D0ŒGetnextdatabytefrombuffer.0ŠCMP.B„#CR,D0ŽIfthecurrentbuffercharacteris0ŠIF‚‚THEN.SaCR,doend-of-lineprocessing..ŒMOVE.LƒA0,IOBUFPTR(A5)ƒUpdatebufferpointer. ŒBRA.S„PRTEOLŠENDI 2ŠBSR.L„OUTPUTŽOutputthecharactertotheprinter..ŠMOVE.LƒA0,IOBUFPTR(A5)…Updatebufferpointer. 5ŠCMP.B„#'',-1(A0)‹Ifthecurrentbuffercharacteris.ŠBLT.S„CHK_BUFFŒnon-printing,donotcheckfor**¦end-of-lineorbumpthecharactercount. *H*‚Wejustprintedaprintablecharacter(>=$20),thissectiondoesthis:*?*„IFnotyetprintedamultipleofthelogicallinelengthTHEN$*ˆproceedtotheendofbuffercheck*C*„ELSE‚(wehavejustprintedamultipleofthelogicallinelength)4*†IFlogicallinelength=physicallinelengthTHEN>*ˆoutputaLineFeedcharacter(ifuser'sLFattributeisoff)*>*†ELSE‚(logicallinelengthislessthanphysicallinelength)$*ˆIFuser'sLFattributeissetTHEN)*Šoutputtheuser'sEnd-of-LineCharacter*ˆELSE.*ŠoutputaLineFeed,CarriageReturnsequence*H*„Insimplewords,‚whenwegettotheendofthelogicalline,printtheI*„end-of-linesequence(EOLcharacterorLF,CR).IfweareattheendofI*„theprintersphysicalline,printaLF(ifnecessaryforthisprinter).*ŠPAGE.EQ610…EQU†CONFGBLK+IOSLRL…LOGICAL‚linelength./EQ620…EQU†CONFGBLK+IOSREC…PHYSICALlinelength.3EQ630…EQU†CONFGBLK+IOSELC…END-OF-LINECHARACTER%EQ640…EQU†CONFGBLK+IOSATW…Attributes. =ŠADD.L„#1,CHAR_CNT(A5)…Incrementtheprintedcharactercount.>ŠMOVE.LƒCHAR_CNT(A5),D2…D2<--numberofcharsprintedsofar.5ŠDIVU…EQ610(A5),D2ˆDividebythelogicallinelength.ŠSWAP…D2)ŠTST.W„D2’Ifwearenotattheendofthe6ŠBNE.S„CHK_BUFFŒlogicalline,gocheckforbufferend.*N*‚Wehavejustprintedamultipleofthelogicalline,doend-of-linestuff...*0ŠMOVE.WƒEQ610(A5),D3ˆD3<--logicallinelength.9ŠCMP.W„EQ620(A5),D3ˆComparelogicalwithphysicallength.&ŠIF‚‚THEN.SLogical<>Physical...0ŒMOVE.BEQ630(A5),D0ˆD0<-user'sEOLcharacter.8ŒBTSTW‚#IOALNFD,EQ640(A5)‚Checktheuser'sLFattribute.ŒIF‚‚THEN.S5ŽBSR.L‚OUTPUTŒLFattributeset,outputEOLcharacter.7ŽBRA.S‚P_TRNCATE‰Continueattruncatelinecheckpoint.ŒENDI 7ŒMOVE.Bƒ#LF,D0ŒLFattributeoff,outputLF,CRsequence.+ŒBSR.L„OUTPUTŒOutputaLineFeedcharacter.ŒMOVE.Bƒ#CR,D01ŒBSR.L„OUTPUTŒOutputaCarriageReturncharacter.7ŒBRA.S„P_TRNCATE‰Continueattruncatelinecheckpoint.ŠENDI*D*‚Printedalogicallineandthelogicalline=thephysicalline...*8ŠBTSTW„#IOALNFD,EQ640(A5)‚Checktheuser'sLFattribute. ŠIF‚‚THEN6ŒMOVE.B‚#LF,D0Printerdoesnotsupportautomaticline5ŒBSR.SƒOUTPUTfeed,sooutputaLFcharacterforhim.ŠENDI*'*‚Nowcheckthetrucateprintoption...*HP_TRNCATEBTSTW„#IOATPLL,EQ640(A5)‚Sincewehavereachedanend-of-line,2ŠBNE.S„PRTDONEterminatetherequestifspecified. @CHK_BUFF‚CMP.L„IOBUFEND(A5),A0…Iftheendofbufferhasnotbeen6ŠBLO†PRT_FORMATTED‡reached,outputthenextcharacter.9***‡BRA.S„PRTEOLŽBUFFEREMPTY...doendofbufferstuff.ŠPAGE*G*‚Wehavejustprintedtheuser'sbuffer(orfoundaCarriageReturnin2*‚thebuffer).‚Nowoutputtheend-of-linestuff...*3EQ650…EQU†CONFGBLK+IOSELC…END-OF-LINECHARACTER%EQ660…EQU†CONFGBLK+IOSATW…Attributes. PRTEOL:0ŠMOVE.BƒEQ650(A5),D0ˆD0<-user'sEOLcharacter.8ŠBTSTW„#IOALNFD,EQ660(A5)‚Checktheuser'sLFattribute.ŠIF‚‚THEN.S5ŒBSR.S‚OUTPUTŽLFattributeset,outputEOLcharacter.+ŒBRA.S‚PRTDONEDONE...gonotifytheuser.ŠENDI 7ŠMOVE.Bƒ#LF,D0ŽLFattributeoff,outputLF,CRsequence.+ŠBSR.S„OUTPUTŽOutputaLineFeedcharacter.ŠMOVE.Bƒ#CR,D01ŠBSR.S„OUTPUTŽOutputaCarriageReturncharacter.*I*‚Wehavecompletedprinting,nownotify theuser.IfwehavedetectedanI*‚errorwhileprinting,weenteratPRT_ERRORwithanerrorcodeinD1.W.*PRTDONE:)ŠMOVE.Wƒ#ISTAOK,D1ŠSetupOKstatuscode. PRT_ERROR:'ŠSF.B…PRNTBUSY(A5)ˆClearourbusyflag.,ŠMOVE.LƒTCB_ADDR(A5),A0…PickupTCBaddress.:ŠSUB.B„#1,TCBIOCNT(A0)…Decrementuser'sI/Opendingcount. 1ŠMOVE.BƒD1,IOSSTA(A4)‹Updateuser'sstatusfield.:ŠMOVE.LƒCHAR_CNT(A5),IOSLEN(A4)Update#ofbytesprinted. 0ŠTST.B„INTR_CNT(A5)ˆSeeifwetookaninterrupt. ŠIF‚‚THEN;ŒSF.BƒNONINTERRUPT(A5)„Yes-setupforaninterruptevent.2ŒBSR.L‚Q_EVENTCalltheroutinetosendtheevent. ŒIF‚‚THEN&ŽKILL.DRIVERPRNTLIB_ID,T0QEVNTI,A5,A3ŒENDI !ŠELSE‚(It'sacommandtypeevent) 1ŒST.BƒNONINTERRUPT(A5)„Setupforanormalevent.2ŒBSR.L‚Q_EVENTCalltheroutinetosendtheevent.)ŒSF.BƒNONINTERRUPT(A5)„Setfornexttime. ŒIF‚‚THEN&ŽKILL.DRIVERPRNTLIB_ID,T0QEVNTT,A5,A3ŒENDIŠENDI %ŠBRA.L„CMDEXIT3ŒReturntothecaller.ŠPAGEO*********************************************************************************ˆOUTPUTACHARACTERROUTINE*;*ˆTheOUTPUTroutineistosendacharactertotheprinter.*'*ˆEntry:„D0.B=charactertobeprinted3*’A0ƒ=pointingtothenextcharactertobeprinted*!*ˆRegisterusage:…01234567*™D‚P*™A‚P***ˆCalls:„DDP_OUTPUT‚DDP_ENA_INTR‚DDP_RESET*=*ˆExit:…RTSbacktothecaller,ifthecharacterwasprinted.8*’CMDEXIT3ifthecharacterwasprinted,buttheprinter$*’didnotacknowledgethecharacter.1*’PRT_ERRORifanerrorwasdetectedinprinting.*O******************************************************************************* OUTPUT:>ŠMOVE.Lƒ(SP),INTSWTCH(A5)ƒSavethereturnaddress(ifnoACK).*E*‚If‚we‚return‚from‚the‚DDP_OUTPUTroutinewithstatus,‚thentheG*‚character‚was‚printed,buttheprinterhasnotyetacknowledged.ƒWhenH*‚the‚acknowledge‚interruptcomesin,‚thedevice-dependentroutinecallsJ*‚theINTR_RECroutine.‚INTSWTCHisusedtobranchtothepointjustafterK*‚whoevercalledtheOUTPUTroutineinthefirstplace.ThisactionusuallyI*‚only‚occurs‚whenwehavejustoutputsomethingthattakestheprintera>*‚longtimetodo(likeaFormFeedoraLineFeedcharacter).*8ŠT_JSR„DDP_OUTPUTŠCallthedevice-dependoutputroutine. ŠIF‚‚THEN-ŒRTS˜Characterwasprinted,returntocaller.ŠENDI3ŠIF‚‚THENCharacterwasoutput,buttheprinter ŒINHIBIT”didnotacknowlegeyet..ŒMOVE.LA0,IOBUFPTR(A5)…Updatebufferpointer.7ŒT_JSR‚DDP_ENA_INTRˆEnableinterruptsfromtheprinter.2ŒBRA.L‚CMDEXIT3ŒAninterruptwillletuscontinue.ŠENDI 8ŠT_JSR„DDP_RESET‹Noneoftheabove,soitmusthavebeen9ŠMOVE.Wƒ#ISTANR,D1Šaprintererror.‚Resettheprinterand.ŠBRA.L„PRT_ERROR‹notifytheuseroftheerror.ŠPAGEO*******************************************************************************O*********************************************************************************ˆHALTI/OCOMMANDROUTINE*D*ˆThecommandserviceprocessorinvokestheHALTroutineinresponse@*ˆtoahaltcommand.‚ItspurposeistostoptheI/Oinprogress.*%*ˆEntry:„A3=physicaladdressofDCB1*’A4=physicaladdressofIOCB(ofHALTcommand)*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™D„*ƒ* *™A‚*…PPP**ˆCalls:„DDP_RESET‚N_HLT_QEVENT**ˆExit:…BranchestoCMDEXIT3.*O*******************************************************************************O******************************************************************************* HALT:%ŠTST.B„PRNTBUSY(A5)ˆAnyI/Opending?*ŠIF‚‚THENTherewasnothingtohalt...BŒMOVE.B#ISTAIF,IOSSTA(A4)‚Updateuser'sIOCBoftheHALTcommand.-ŒMOVE.W#ISTAIF,D1ŠSamecodeineventstatus.ŠELSE* *‚Therewassomethingtohalt...*ŒINHIBIT'ŒT_JSR‚DDP_RESET‹Initializethedevice.2ŒSF.BƒPRNTBUSY(A5)ˆClearourbusyflagintheCCB.8ŒSF.BƒFLT_ REQ(A5)‰Clearfaultrequestincaseitisset. =ŒMOVE.LTCB_ADDR(A5),A0…PickuptheTCBaddressofIOCBowner;ŒSUB.B‚#1,TCBIOCNT(A0)…anddecrementhispendingI/Ocount. ?ŒMOVE.LIOCBPTR(A5),A0†A0<--user'sIOCBfortheoriginalcmd.AŒMOVE.B#ISTATO,IOSSTA(A0)‚UpdatetheoriginalIOCBstatusfield.?ŒMOVE.LCHAR_CNT(A5),IOSLEN(A0)UpdateusersIOCBlengthfield.4ŒCLR.L‚CHAR_CNT(A5)ˆClearthecharactercountfield. AŒMOVE.B#ISTAOK,IOSSTA(A4)‚UpdatetheIOCBstatus(HALTcommand).-ŒMOVE.W#ISTATO,D1ŠSetupeventstatusfield.ŠENDI /ŠMOVE.Lƒ#0,A0A0<--0=DONOTCOPYTHEEVENT.!ŠMOVE.LƒA3,D3D3<--DCBaddress.1ŠBSR.L„N_HLT_QEVENTˆQueuetheevent(useDRVLIB). ŠIF‚‚THEN)ŠKILL.DRIVERPRNTLIB_ID,N_HLT_QVENT,A5,A3ŠENDI%ŠBRA.L„CMDEXIT3ŒReturntothecaller.ŠPAGEO********************************************************************************(*ˆLOGICAL-TO-PHYSICALADDRESSCONVERSION*F*ˆGivenaphysicalTCBaddressandthelogicaladdressandlengthofaE*ˆmemoryarea,subroutine‚LOGPHYcomputesthephysicaladdressoftheE*ˆmemoryarea.‚ItalsocheckstomakesurethatthegivenmemoryareaE*ˆreallybelongstothetask‚thatiscontrolledbythespecifiedTCB.*D*ˆThesubroutinewillnotreturnunlessthespecifiedmemoryresidesH*ˆentirelywithinthememorysegmentthatbelongstothespecifiedtask.*?*ˆEntry:„A0=physicaladdressofTCBoftaskcontainingbuffer;*’D6=logicaladdressofthefirstwordofthememoryarea)*’D5=lengthinbytesofthememoryarea*!*ˆRegisterusage:…01234567 *™D‚PP‡PR *™A‚PP‡P*B*ˆExit:…D6=physicaladdressofthefirstwordofthememoryarea *’Returntothecallingroutine.*O******************************************************************************* -LOGPHY1‚BSR†LOGPHY‘UsetheroutineinDRVLIB. ‰IF‚THEN.S5‹MOVEQIƒISTAADD,D1‹LOGPHYreturnsthisconditioncode)‹BRA†CMDEXIT2‹if(1)thespecifiedmemory'*¦areaiscompletelyoutsideanymemory'*¦segmentthatbelongstothespecified'*¦taskor(2)thespecifiedmemoryarea!*¦isinamemory-mappedI/Oarea.‰ENDI *‰RTSControlreachesthispointwhenwe've'*¦madeasuccessfuladdressconversion.‰PAGEJ****************************************************************************•BACKGROUND*œAND*”CALL__GUARDED**˜ROUTINES**•(DEVICEINDEPENDENT)*J************************************************************************** O*********************************************************************************‰SENDTHEEVENT(CALLGUARDED)*6*‰Somebodyincommandservicewantstoqueueanevent,=*‰butofcoursehecouldn'tsenditsincetheQ_EVENTroutine;*‰canonlybecalledfromthebackground.‚Soheaskedmeto)*‰doitforhim.‚I'msuchaniceroutine.*!*ˆEntry:„A3ƒ=‚AddressoftheDCB.*’A4ƒ=‚AddressoftheIOCB.*’A5ƒ=‚AddressoftheCCB.*’D1.B=‚Error/statuscode.*!*ˆRegisterusage:…01234567*™D„P *™AˆPPP**ˆCalls:„Q_EVENT***ˆExit:…RTSbacktocallerifallisokay.*’KILLERiferrorisdetected.*O******************************************************************************* DO_EVENT: /ŠST‡NONINTERRUPT(A5)„Setupforanormalevent.0ŠBSR†Q_EVENTCalltheroutinetosendtheevent.ŠSF‡NONINTERRUPT(A5) ŠIF‚‚THEN&ŠKILL.DRIVERPRNTLIB_ID,T0QEVNTT,A5,A3ŠENDI ŠRTSŠPAGEJ***************************************************************************5*‰QUEUEACOMPLETIONEVENTTOTHEATTACHEDTASK(IOS)*;*‰ThisroutinecallstheexectosendasmalleventtoIOS.;*‰ItusesI_NRM_QEVENTifwe'reprocessinganinterruptand:*‰N_NRM_QEVENTifwe'renot.‚TheseroutinesareinDRVLIB.*7*‰NOTE:thisroutinemayonlybecalledfromwithinthe*background!!!!!*!*ˆEntry:„A3ƒ=‚AddressoftheDCB.*’A4ƒ=‚AddressoftheIOCB.*’A5ƒ=‚AddressoftheCCB.*’D1.B=‚Error/statuscode.4*’NONINTERRUPT=00=Proces singaninterruptevent.0*’NONINTERRUPT=FF=Processinganormalevent.*!*ˆRegisterusage:…01234567*™D„P *™AˆPPP*#*ˆCalls:‚I_NRM_QEVENT,N_NRM_QEVENT*7*ˆExit:ƒRTSbacktocallerwiththeconditioncodeset:**=Theeventwassucessfullyqueued."*=UnsucessfulTRAP#0call.*O******************************************************************************* Q_EVENT: :‰MOVEM.LƒD3/A0,-(A7)‰Savetheregisterswewillblowaway. 9‰MOVE.BƒD1,IOSSTA(A4)ŠStorethestatuscodeintotheIOCB&*¦whereitcanbeexaminedbythetask$*¦thatoriginallyrequestedtheI/O. **‚SetupA0andD3forDRVLIB:*/‰MOVE.L„#0,A0A0<--0=DONOTCOPYTHEEVENT! ‰MOVE.L„A3,D3D3<--DCBaddress #‰IF.BƒNONINTERRUPT(A5)‚‚#0ƒTHEN$‹BSR.LƒI_NRM_QEVENTˆInterruptevent.‰ELSE!‹BSR.LƒN_NRM_QEVENTˆNormalevent.‰ENDI +‰MOVEM.L‚(A7)+,D3/A0ŠRestoretheregisters.‰RTS‰PAGEL*****************************************************************************/*ˆROUTINES„FOR„THE…INTERRUPT*'*‹HANDLER…FOR„THE…DEVICE**’DEPENDENT…MODULE*L****************************************************************************ŠPAGEO*******************************************************************************O*******************************************************************************O*********************************************************************************ˆINTERRUPTHANDLER*B*ˆThis‚subroutine‚iscalledfromthedevice-dependentdriverafterD*ˆitreceivesaninterruptfromthedevice.Itspurposeistoreturn@*ˆtothecodethatwasexecutingbeforeinterruptswereenabled.*ˆSpecificfunctionsare:*=*Š1.Savethereturnaddressoftheinterruptroutinecaller.4*Š2.GettheDCBandIOCBaddressesandtheIOBUFPTR5*variablesoutoftheCCBintodesignatedregisters.=*Š3.Checkforprintererrors,iferrorexitwitherrorcode.=*Š4.Returntotheroutinethatwasexecutingwheninterrupts,*hadtobeenabled(attheOUTPUTroutine).*%*ˆEntry:„A5=physicaladdressofCCB*!*ˆRegisterusage:ˆ01234567 *œD‚**** *œA‚**ƒ**P*.*ˆExit:…JMPtotheaddressstoredinINTSWTCH,:*’elsereturnanerrorcodeifthereisaprinterproblem.*O*******************************************************************************O*******************************************************************************O******************************************************************************* INTR_REC:4ŠMOVE.LƒSP,SAVESP(A5)‰Savethereturnaddressinthe)*¦interruptserviceroutine(DDPmodule). *ŠMOVE.LƒDCBPNTR(A5),A3†A3<--DCBaddress.+ŠMOVE.LƒIOCBPTR(A5),A4†A4<--IOCBaddress..ŠMOVE.LƒIOBUFPTR(A5),A0…Setupbufferpointer. 0ŠT_JSR„GET_STATŒSeeifthereisaprintererror. ŠIF‚‚THEN2ŒMOVE.W#ISTANR,D1ŠReturnprinternotreadyerror.ŒBRA.L‚PRT_ERRORŠENDI 6ŠMOVE.LƒINTSWTCH(A5),A1‡Branchtotheroutinethatwas-ŠJMP†(A1)executingwheninterruptshadtobe(*¦enabled.‚Thiswillbeatthecodejust**¦afterwhoevercalledtheOUTPUTroutine.ŠPAGEO*******************************************************************************O*******************************************************************************O******************************************************************************** *ˆFAULTTIMER*D*ˆThis‚subroutineiscalledfromthedevice-dependentdriverwhenitD*ˆneedstosetupatimercalltomonitortheFAULTline.‚ItisusedF*ˆonlybythosedriversthatcannotbeINTERRUPTEDforprinterFAULTS.*%*ˆEntry:„A5=physicaladdressofCCB*!*ˆRegisterusage:ˆ01234567*œDˆ**œAˆ*ƒP**ˆCalls:„SET_TIME(inDRVLIB)**ˆExit:…RTStocaller.*O*******************************************************************************O*******************************************************************************O******************************** *********************************************** FLT_TIMER:/ŠMOVEM.L‚D3/A3,-(SP)‰Saveanyregistersweuse. .ŠMOVE.Lƒ#FLT_DELAY,D3‡D3<--FAULTtimedelay.;ŠLEA†FLT_HANDLER(PC),A3‚A3<--ourroutinetohandletimer.4ŠBSR.L„SET_TIMEŒThisroutinesetsupthetimercall. ŠIF‚‚THEN.ŠKILL.DRIVERPRNTLIB_ID,SET_TIM,A5,DCBPNTR(A5)ŠENDI 3ŠMOVEM.L‚(SP)+,D3/A3‰Restoreanyregistersweused.ŠRTSŠPAGEO*********************************************************************************ˆFAULTHANDLER*F*ˆThissubroutinerunsasaresultofthetimeractivationthatissetD*ˆup‚intheroutineFLT_TIMER.‚ItisusedonlybythosedriversthatE*ˆcannotbeINTERRUPTEDforprinterFAULTS.‚WhenwegetherewecheckF*ˆtheflagFLT_REQ.Ifitisclear,thenanACKNOWLEDGEinterruptmustD*ˆhave‚comein,sowenolongerneedtherequest.‚IfFLT_REQisset,D*ˆthenwe‚did‚notreceiveanACKNOWLEDGE,soweassumethatthereisF*ˆsomethingwrongwiththeprinter.ThedriverwillclearFLT_REQeach$*ˆtimeitreceivesanACKinterrupt.*E*ˆOncethetimerissetup(inFLT_TIMER),wewilleventuallyrun,soE*ˆitislikelythatthisroutinewillrunevenaftertheentirewriteE*ˆrequesthasbeenhandled.‚SinceFLT_REQwillbeclear,wejustRTE.*%*ˆEntry:„D1=physicaladdressofCCB*!*ˆRegisterusage:ˆ01234567*œD„* *œA‚*…*****ˆCalls:„Q_EVENT**ˆExit:…RTEtocaller.*O******************************************************************************* TIM_REGS‚REG†D2-D7/A2-A6 FLT_HANDLER: ?ŠMOVEM.L‚TIM_REGS,-(SP)†ThetimerhassavedD0,D1,A0,andA1. %ŠMOVE.LƒD1,A5A5<--ourCCBaddress.:ŠTST.B„FLT_REQ(A5)‰Checkifwestillneedtherequest,the4ŠIF‚‚THENdriverclearsthisflageachtimethat=ŒMOVEM.L(SP)+,TIM_REGS…itreceivesanACKNOWLEDGEinterrupt.%ŒRTE˜Requestnotneeded,justreturn.ŠENDIŠPAGE*F*‚TheprinterhasnotACKNOWLEDGEDthelastcharacterthatwesent.‚WeK*‚gaveitplentyoftime(FLT_DELAY),sotheremustbesomethingwrongwithJ*‚theprinter.‚Wecan'tcheckthestatusoftheFAULTlinebecauseonmostF*‚printers,ifthecableisdisconnected,itdoesn'tlooklikeafaultI*‚condition.‚Theassumptionismadethatsincethetime-outhasoccurred,>*‚thereisaproblem,sowereturna'DEVICENOTREADY'error.*&ŠSF.B…FLT_REQ(A5)‰Clearfornexttime.#ŠT_JSR„DDP_RESET‹Resettheprinter.'ŠSF.B…PRNTBUSY(A5)ˆClearourbusyflag.,ŠMOVE.LƒTCB_ADDR(A5),A0…PickupTCBaddress.:ŠSUB.B„#1,TCBIOCNT(A0)…Decrementuser'sI/Opendingcount. *ŠMOVE.LƒDCBPNTR(A5),A3†A3<--DCBaddress.+ŠMOVE.LƒIOCBPTR(A5),A4†A4<--IOCBaddress.1ŠMOVE.Wƒ#ISTANR,D1ŠD1.W<--notreadyerrorcode.1ŠMOVE.BƒD1,IOSSTA(A4)‹Updateuser'sstatusfield.:ŠMOVE.LƒCHAR_CNT(A5),IOSLEN(A4)Update#ofbytesprinted. 0ŠTST.B„INTR_CNT(A5)ˆSeeifwetookaninterrupt. ŠIF‚‚THEN;ŒSF.BƒNONINTERRUPT(A5)„Yes-setupforaninterruptevent.2ŒBSR.L‚Q_EVENTCalltheroutinetosendtheevent. ŒIF‚‚THEN&ŽKILL.DRIVERPRNTLIB_ID,T0QEVNTI,A5,A3ŒENDI !ŠELSE‚(It'sacommandtypeevent) 1ŒST.BƒNONINTERRUPT(A5)„Setupforanormalevent.2ŒBSR.L‚Q_EVENTCalltheroutinetosendtheevent.)ŒSF.BƒNONINTERRUPT(A5)„Setfornexttime. ŒIF‚‚THEN&ŽKILL.DRIVERPRNTLIB_ID,T0QEVNTT,A5,A3ŒENDIŠENDI -ŠMOVEM.L(SP)+,TIM_REGS‡RestoretheregistersŠRTE ŠPAGE*********************** *‚PATCHSPACE***********************ŠDS.W…30ŠENDN NNNNN+RWINDRV‚IDNT†45,0†VERSAdosRWINdiskdriverNNNNNNNv}†ŽK–)ž0¦8®<¶:¾>Æ;ÎQÖ<Þ>æ;î8ö9þ9?:8C&<.367>0F6N6V8^2f='‰TTL‡RWINDRV:‚VERSAdosRWINdiskdriverN NNNNNNK***************************************************************************K***************************************************************************K***************************************************************************K****************************************************************************%*ˆRWINDRV:‚VERSAdosRWINdiskdriver.**ˆRevisionhistory:**ˆ10/31/85‚Initialrelease.<*ˆ12/11/85‚AddedCHK_PARAMroutinecalledbyDISKlib.R.E.M.*K***************************************************************************K***************************************************************************K***************************************************************************K***************************************************************************‰PAGE**ƒXREF'SfromDISKLIB*ŠXREF…DISK_INITŠXREF…DISK_COMMANDŠXREF…CHAN_DONE **‚Equatefilesincluded:* *‰INCLUDE‚9995.&.TCB.EQ*‰INCLUDE‚9995.&.CCB.EQ*‰INCLUDE‚9995.&.LV5.EQ*‰INCLUDE‚9995.&.IOE.EQ*‰INCLUDE‚9995.&.NIO.EQ*‰INCLUDE‚9995.&.DISKCCB.EQ*‰INCLUDE‚9995.&.DISKMEM.EQ*‰INCLUDE‚9995.&.DISK.EQ*‰INCLUDE‚9995.&.UTILITY.MC  ŠOPTCRE,PCS **‰MISCEQUATES*3DRIVESƒEQU‡4“Totalnumberofdrivesonourchannel. **ˆBWN‡2/13/84ƒPJD‚9/18/84*1GOODCODEEQU‡0“Opcodeforformatsectoras"good"1BADCODE‚EQU‡$80‘Opcodeforformatsectoras"bad"7ALTCODE‚EQU‡$40‘Opcodeforformatsectoras"alternate"*‰NOLIST‰INCLUDE‚9995.&.TCB.EQ‰INCLUDE‚9995.&.CCB.EQ‰INCLUDE‚9995.&.LV5.EQ‰INCLUDE‚9995.&.IOE.EQ‰INCLUDE‚9995.&.NIO.EQ‰INCLUDE‚9995.&.UTILITY.MC ‰TTL†DISK.EQ‰LIST‰INCLUDE‚9995.&.DISK.EQ‰TTL†DISKCCB.EQ‰INCLUDE‚9995.&.DISKCCB.EQ‰TTL†RWINDRV.SA‰PAGE/‰OFFSETƒDCCBDDPContinuewithchannel-dependent*¦CCBvariablespace.  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* *%%%Å%%%*B*%%%„Device-dependent,channelrelated,variablesstarthere.‰%%%* *%%%Å%%%**%%%™(CCBSPACE)¡%%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  E*ˆThefollowingsubsectionof‚thechannel-relatedpartofthedevice-H*‚dependentportion‚of‚the‚CCBisusedbytheRWINinterrupthandlerforH*‚buildinga‚commandpacketthatcanbesenttotheRWINcontroller.ƒTheM*‚variablesinthecommandpacketmustoccurintheexactorderthatisshownK*‚becausetheentirecommandpacketistreatedasanindivisibleblock.‚TheK*‚RWINc ontroller‚interpretstheindividualfieldsofthecommandpacketas#*‚shownintheillustrationsbelow. B*ˆTheWINCHESTERcontrollerinterpretsthecommandpacketasshown;*‚inthediagrambelow.‚ThevariablesinthecommandpacketH*‚mustoccurintheexactorderthatisshownbecausetheentirecommand,*‚packetistreatedasanindivisibleblock. 4*‡7‚6‚5‚4‚3‚2‚1‚0‹BytezeroofaRWINcommandpacketD*…--------------------------‡containstheopcodethattellstheRWIN4*‚0‚|‰Opcode‰|‡controllerwhatoperationtoperform.?*…|------------------------|‡Bits7-5ofbyteonecontainthe5*‚1‚|‚LUNƒ||‡controller-definedlogicalunitnumber,3*…|-----------|‡whichisequivalenttothechannel3*‚2‚|‰Logicalˆ|‡devicenumber.‚Bits4-0ofbyteone7*…|--‡Sector‡--|‡andallofbytestwoandthreeusually/*‚3‚|‰Number‰|‡containalogicalsectornumber.*…|------------------------|7*‚4‚|†SectorCount†|‰BytefourofaRWINcommandpacketB*…|------------------------|‡normallycontainsasectorcount,but<*‚5‚|†ControlCode†|‡bytefourisusedtocontaintheinter-B*…--------------------------‡leavefactorwhenaformatcommandis*¦beingspecified.*B*…|TD|SN|MF|SCC|DS|CIE|DMA|ˆFinally,bytefiveofaRWINcommand'*¦packetcontainsacontrolcode.‚Bit7&*¦definestrackdensity.Bit6defines)*¦format.Bit5definesrecordingmethod.(*¦Bits4-3definethesectorsize.Bit2**¦definesdiskettesides.Bit1canbeset$*¦toenablecommandinterrupt.Bit0*¦definesdatarequestmode.‰PAGE4*‡7‚6‚5‚4‚3‚2‚1‚0‹WhentheopcodefieldofacommandA*…--------------------------‡packetspecifiestheRWINcommandto<*‚0‚|1‚1‚0|…OpCodeƒ|‡configureadrive,someofthefieldsB*…|------------------------|‡ofthecommandpacketareinterpreted:*‚1‚|‚LUNƒ|0‚0‚0‚0‚0|‡alittledifferently(asdescribed$*…|------------------------|‡below).*‚2‚|‚MaxHD„|‚MaxCyl1|?*…|------------------------|‰Thebytesthatusedtocontainthe7*‚3‚|ˆMaxCyl0‡|‡logicalsectornumbernowcontainthe@*…|------------------------|‡headcountandcyclindercount.‚TheA*‚4‚|„StartPrecompCyc#|‡fieldthatusedtocontainthesectorB*…|------------------------|‡numbernowcontainsthestartprecomp@*‚5‚|‚ControlCodeƒ|CIE|‚|‡cyclenumber.‚TheonlymeaningfulbitE*…--------------------------‡ofthecontrolcodeisbit1whichstill&*¦isusedtoenableinterruptcommand. *‰DS.W…0–Thecommandpacketmustbeginona'*¦wordboundarybecausewedon'talways(*¦usebyte-modeaddressingtoaccessit. 2CMDOP„DS.B…1–TheCMDOPfieldofthecommandpacket)*¦containstheopcodethattellstheRWIN'*¦controllerwhatoperationtoperform. 2CMDLSNƒDS.B…3–TheCMDLSNfieldofacommandpacket:LSNMASK‚EQU†$001FFFFFŒoftencontainsalogicalunitnumber5LUNFIELDEQU†5”andalogicalsectornumbertospecify)*¦aparticularareaofaparticulardisk.&*¦TheLSNMASKvalueisabitmaskthat$*¦indicateswhichbitsoftheCMDLSN(*¦fieldcanbeusedforalogicalsector)*¦number,andtheLUNFIELDvalueisabit)*¦numbertoindicatethatbits5-7ofthe)*¦firstbyteoftheCMDLSNfieldareused"*¦fortheLUNfield.‚TheLUNfield)*¦containsthecontroller-definedlogical)*¦unitnumber,whichisequivalenttothe*¦channeldevicenumber. *2*ˆAddedtoimplementalternatesectorsŽBWN2/16/84*LSNMSKNOTŠEQU‡$FFFFFFFF-LSNMASK 4CMDSECTSDS.B…1–TheCMDSECTSfieldcontainsasector8CMDILVƒEQU†CMDSECTScountforareadorwriteoperation,&*¦anditcontainsaninterleavefactor&*¦foraformatoperation.‚TheCMDSECTS&*¦fieldalwayscontainsthevaluezero *¦foradefine-formatoperation.‰PAGE/MAXSECTSEQU†255”Thislabeldefinesthemaximum(*¦possiblevaluethatcanbeusedinthe'*¦CMDSECTSfield.‚IfanI/Otransaction)*¦involvesmorethanMAXSECTSsectors,we(*¦mustbreakupthetransactionintotwo*¦ormoresmallertransactions. "CMDCTRL‚DS.B…1”Controlcodefield. -CTD†EQU‡7•TheCMDCTRLfieldofaRWINcommand)CS N†EQU‡6“packetcontainsacontrolcode.0CMF†EQU‡5“Forallcommandswiththeexceptionof0CSS†EQU‡4“configureadrive,theWINCHESTERuses,CDS†EQU‡2“allbitofthecontrolcodefield. CIE†EQU‡1 CDM†EQU‡0 0CMDENDƒEQU†*–ThelabelCMDENDisattachedtothe9CMDLENƒEQU†CMDEND-CMDOP‰bytethatimmediatelyfollowsthe&*¦commandpacketinmemory,andCMDLEN(*¦specifiesthelength(inbytes)ofthe'*¦commandpacket.‚Wesometimesstartat'*¦locationCMDENDandaccessthefields&*¦inthecommandpacketbyusingauto-*¦decrementaddressing. 7IOQUEUE‚DS.L…DRIVES‘TheIOQUEUEisusedtoindicatethe(*¦I/Oactivities(ifany)thatarelined'*¦upwaitingtobedoneunderinterrupt(*¦controlbytheRWINinterrupthandler.'*¦Sincewecanneverhavemorethanone'*¦commandpendingforanysingledrive,(*¦theIOQUEUEhasexactlyenoughentries%*¦toaccommodateoneI/Oactivityfor'*¦eachdrivethataRWINcontrollercan*¦possiblycontrol. $*¨AnentryintheIOQUEUEisalong-)*¦wordpointerthatcontainsthephysical(*¦addressofadrive'svariableblockin**¦thedrive-associatedareaofglobalmem,(*¦andthevaluesinthedrive'svariable&*¦blockdescribetheI/Oactivitythat*¦mustbedonewiththatdrive.‰PAGE'*¨TheRWINdriverputsentriesintothe'*¦IOQUEUEintheorderinwhichtheI/O)*¦requestsarereceived,sonodriveona$*¦RWINchannelhaspriorityoverany'*¦otherdriveonthesamechannel.‚When$*¦theRWINdriverreceivesanewI/O%*¦request,thedriversimplyputsthe&*¦entryforthatrequestintothenext *¦availableslotoftheIOQUEUE. '*¨WhentheRWINdrivercompletesanI/O&*¦activityunderinterruptcontrol,it(*¦movesallremainingIOQUEUEentriesup%*¦byonepositionintheIOQUEUE.‚The(*¦physicalmovementofqueueentriesmay%*¦soundlikeapoorapproachatfirst&*¦glance,butitturnsouttobequite%*¦good.‚Theuseofwrappingfrontand$*¦rearqueuepointerswithposition-(*¦independentcodeisrathercumbersome,$*¦andthephysicalmovementofqueue%*¦entriesisabettertechniquefora"*¦shortqueuesuchastheIOQUEUE. 1IOQCNTƒDS.W…1–Thisvariablecontainsthecountof#*¦thenumberofbytesintheactive)*¦entriesintheIOQUEUE,soIOQCNT=4*N)*¦whereNisthenumberofactiveentries(*¦intheIOQUEUE.‚ThevalueofIOQCNTis$*¦alwaysintherangefrom0through&*¦through4*DRIVES,sowecouldeasily&*¦useasinglebyteforthisvariable.(*¦However,weuseafullwordforcoding%*¦convenience.‚NoticethatIOQCNTcan%*¦beusedasanoffsetpointertothe&*¦nextavailableentryintheIOQUEUE. '*¨IOQCNTmustbeinitializedtozeroat*¦system-initializationtime. 1BLKCNTƒDS.B…1–BLKCNTisusedinthedatatransfer(*¦routinesandisequaltothenumberof'*¦128byteblockslefttobetransfered&*¦forthecurrentsector.Thisisonly *¦usedforread&writecommands 1RETRY„DS.B…1–UsedbyWinchesterinterrupthandler%*¦tocountthenumberofretrieswhen*¦executingerrorcorrectionin*¦completinganI/Oactivity.‰PAGE0RETRYCNTEQU†6–ValueusedtoinitializeRETRYin*¦errorhandling. 1SENSBYT0DS.B…1–Theseareerrorcorrectionstatus3SENSBYT1DS.B…1”bytesusedbytheinterrupthandler2SENSBYT2DS.B…1”whenexecutingerrorcorrectionin,SENSBYT3DS.B…1”completingandI/Oactivity.SENSBYT4DS.B…1SENSBYT5DS.B…1SENSBYT6DS.B…1SENSBYT7DS.B…1SENSBYT8DS.B…1SENSBYT9DS.B…1  M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%* *%%%Å%%%*>*%%%„Endofdevicedependent,channelrelated,variables.%%%* *%%%Å%%%**%%%•ENDOFCCBSPACE %%%* *%%%Å%%%*M*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*  3CCBSIZEBEQU†*–CCBSIZEBdefinesthesize(inbytes)(*¦ofacompleteCCBfortheRWINdriver. %*¨CCBSIZEdefinesthesize(inpages)?L0080„EQU†CCBSIZEB+PAGESIZE-1‚ofaCCBfortheRWINdriver,andBCCBSIZE‚ EQU†L0080/PAGESIZE‡EXTCCBSZdefinesthesize(inpages)of*ƒ15‚14‚13‚12ƒ11‚10ƒ9ƒ8„intheparametersmaskarenotusedbyI*‚+---+---+---+---++---+---+---+---+‚theRWINdriver,butallofthebits8*‚|‹|ƒ||ƒ|ƒ|ƒ|ƒ|‚thataredefinedforanydiskdriveare;*‚+---+---+---+---++---+---+---+---+‚showninthediagrams.*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|7*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=IOSSOFisnotusedbytheWIN.*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|1*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=IOSPSMissignificant. *„|ƒ|ƒ|ƒ|„|ƒ|;*„|ƒ|ƒ|ƒ|„|ƒ------------1=IOSSHDisnotusedbytheWIN. *„|ƒ|ƒ|ƒ|„|6*„|ƒ|ƒ|ƒ|„----------------1=IOSTRKDissignificant. *„|ƒ|ƒ|ƒ|9*„|ƒ|ƒ|ƒ---------------------1=IOSPCOMissignificant.*„|ƒ|ƒ|C*„|ƒ|ƒ-------------------------1=IOSSPTDisnotusedbytheWIN.*„|ƒ|D*„|ƒ-----------------------------1=IOSSRBisnotusedbytheWIN.*„|H*„---------------------------------1=IOSRWCCBisnotusedbytheWIN.   *„7ƒ6ƒ5ƒ4„3ƒ2ƒ1ƒ0$*‚+---+---+---+---++---+---+---+---+*‚|ƒ|ƒ|ƒ|ƒ||ƒ|ƒ|ƒ|ƒ|$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|/*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=IOSRECissignificant.*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|1*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=IOSRSZissignificant. *„|ƒ|ƒ|ƒ|„|ƒ|;*„|ƒ|ƒ|ƒ|„|ƒ------------1=IOSWTOisnotusedbytheWIN. *„|ƒ|ƒ|ƒ|„|=*„|ƒ|ƒ|ƒ|„----------------1=IOSRTOisnotusedbytheWIN. *„|ƒ|ƒ|ƒ|8*„|ƒ|ƒ|ƒ---------------------1=IOSSPTissignificant.*„|ƒ|ƒ|:*„|ƒ|ƒ-------------------------1=IOSHDSissignificant.*„|ƒ|<*„|ƒ-----------------------------1=IOSTRKissignificant.*„|>*„---------------------------------1=IOSILVissignificant. PAGE*+*ˆATTRIBUTESMASKFORTHEWINCHESTERDRIVER* '*¨Theindividualbitsoftheattributes&*¦wordareinterpretedasshowninthe*¦accompanyingdiagrams. !*¨Noticethatthetophalfofthe<*ƒ15‚14‚13‚12ƒ11‚10ƒ9ƒ8„attributeswordiscompletelyunusedI*‚+---+---+---+---++---+---+---+-- -+‚foraRWIN‚disk,butthetophalfof+*‚| |‚theattributeswordisstillpresent.$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|:*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----‚1=Post-read/pre-writeprecompreq'd*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|(notused)=*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------‚1=8"floppydisk;0=5-1/4"disk.*„|ƒ|ƒ|ƒ|„|ƒ|‘(notused)-*„---------------------------------‚Notused.  *„7ƒ6ƒ5ƒ4„3ƒ2ƒ1ƒ0$*‚+---+---+---+---++---+---+---+---+*‚|‹|ƒ||ƒ|ƒ|ƒ|ƒ|$*‚+---+---+---+---++---+---+---+---+*„^ƒ^ƒ^ƒ^„^ƒ^ƒ^ƒ^*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ|<*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|ƒ----1=Doubledata-density(MFM)onmedia.*„|ƒ|ƒ|ƒ|„|ƒ|ƒ|9*„|ƒ|ƒ|ƒ|„|ƒ|ƒ--------1=Doubletrack-densityonmedia. *„|ƒ|ƒ|ƒ|„|ƒ|6*„|ƒ|ƒ|ƒ|„|ƒ------------1=Double-sidedfloppydisk. *„|ƒ|ƒ|ƒ|„|?*„|ƒ|ƒ|ƒ|„----------------1=IBMformat;0=Motorolaformat. *„|ƒ|ƒ|ƒ|>*„|ƒ|ƒ|ƒ---------------------1=Rigiddisk;0=floppydisk.*„|ƒ|ƒ|G*„|ƒ|ƒ-------------------------1=Doubledata-density(MFM)ondrive.*„|ƒ|¡(notused)D*„|ƒ-----------------------------1=Doubletrack-densityondrive.*„|¥(notused)K*„---------------------------------1=Seekreq'dw/headswitchondrive. *ª(notused)‰PAGE0‰OFFSETƒ-2•ThisOFFSETblockdefinesthememory-&*¦mappedI/OspaceforaRWINchannel.&*¦TheRWINdrivercommunicatesthrough*¦thismemory-mappedI/Ospace. #*¨TheCCBCHBpointernormallywould'*¦pointtothebeginningofthememory-)*¦mappedI/Oarea(byte0),butsinceI/O'*¦accessesaretotheoddbytesonlyit**¦wouldpointtobyte1.FortheRWIN,the"*¦CCBCHBpointstothebyte3(the)*¦RWINstatus)whichisalwaysaccessible!*¦whereasbyte1(sense)isnot.*¨Weuseanoffsetof-2inthe!*¦OFFSETstatementtocompensate. *¨WeuseDS.B1*2todefinethe#*¦OFFSETSusedtheaccesstheRWIN. ************** *ƒBYTE1ƒ***************4COMMAND‚DS.B†1*2“WRITEregisterforsendingthecom-*¦mandbytestotheRWIN. 5SENSE„EQU‡COMMANDREADregisterforgettingthesense*¦informationfromtheRWIN.'*¨COMMANDorSENSEmayonlybeaccessed*¦whentheRWINisnotbusy. ************** *ƒBYTE3ƒ***************4INTCTRL‚DS.B†1*2‡WRITEregistertoenableordisable ** DATA REQUEST INTERRUPTS*ENBLDINTEQU‡$01‡01EnablesDSBLDINTEQU‡$00‡00Disables  PAGE 6FLAGS„EQU‡INTCTRLREADregistertoexamineRWINstatus*¦Bitsaredescribedbelow:*BITCB„EQU‡7•1=RWINisbusy*¦0=RWINnotbusy*,BITCI„EQU‡6•1=Commandcompletioninterrupt&*¦clearedwithawritetoCOMMANDora*¦readofSENSE.*.BITFAULTEQU‡5•1=Afaultoccuredinthelast**¦commandtoRWIN.SENSEbytesidentifyth(*¦error.‚ClearedwithawritetoCOMMAND*¦orareadofSENSE.*-BITDI„EQU‡4•1=Datarequestinterruptequals*¦BITDRQ*ENBLDINT*1BITDRQƒEQU‡3•1=Readdataorroomforwritedata*¦isavailableinFIFObuffer.*0BITCIEƒEQU‡2•1=Commandcompletioninterruptis&*¦enabled.‚Always=1forthisdriver.*%BITDMAƒEQU‡1•1=DRQindicates1byte'*¦0=DRQindicates1block(128bytes)*¦Always=0forthisdriver.*BITDIEƒEQU‡0“CopyofINTCTRL* ************** *ƒBYTE5ƒ***************5RWINRSTƒDS.B†1*2‘WRITEONLYregistertoresettheWDC  ************** *ƒBYTE7ƒ***************‰DS.B†1*2‘NOTUSED ***************************ƒBYTES9,11,13,15‚***************************4DATA0„DS.B†1*2‘[READdatafrombufferorWRITEdata1DATA1„DS.B†1*2‘[tobuffer.These4addressesare3DATA2„DS.B†1*2‘[decodedtothebuffertoallowthe.DATA3„DS.B†1*2‘[useoftheMOVEPinstruction.‰PAGEO********************************************************************************1*ˆSERVICEVECTORTABLE,PARAMETERS,REVISIONINFO*@*ˆThefirst‚several‚locationsofevery‚I/OdrivermustcontainaB*ˆservicevectortabletocontainthe‚long-wordrelativeaddressesB*ˆofthethreedriversubroutinesthatCMRuses.‚TheCMRparameterC*ˆta bleimmediatelyfollowstheservicevectortableandincludesaA*ˆfieldtelling‚CMR‚howmanyextrapages‚toallocatefortheCCB.E*ˆTherevisiontableimmediatelyfollowsthetheCMRparametertable.*O*******************************************************************************O******************************************************************************* ‰SECTION‚0 RWINDRV: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!* <‰DC.L…INTERUPT-RWINDRV…Addressofinterruptserviceroutine.:‰DC.L…COMMANDS-RWINDRV…Addressofcommandserviceroutine.5‰DC.L…INIT-RWINDRV‰Addressofinitializationroutine.‰DC.L…0”Reserved. **‚OtherCMRparameters.*3‰DC.B…EXTCCBSZ#ofextrapagesintheCCB.‚TheCCB(*§maybeanysizefrom1to256pages(a&*§pageis256bytes):‚ifthisfieldis*§0,itwillbe1page,etc.‰DC.B…0,0,0Reserved.‰DC.L…0,0,0Reserved. **‚Revisioninfo:*/‰DC.B…'121185'DateoflastassemblyasMMDDYY.1‰DC.B…''’Spaceindicatesnopatchesto.LOfile.)‰DC.B…'4'’MajorVERSAdosrevisionnumber.‰PAGEO********************************************************************************7*ˆJumptableforusebythegenericdiskdriverDISKLIB*O******************************************************************************* ‰BRA.L„SET_CNFG‰BRA.L„SET_CODE‰BRA.L„CHK_FLOPPY‰BRA.L„CHK_LSN‰BRA.L„BLD_PACKET‰BRA.L„DISK_START‰BRA.L„CHK_PARAM‰PAGEO*******************************************************************************O*********************************************************************************ˆINITIALIZATIONROUTINE*B*ˆThis‚subroutineiscalledfromCMR‚whenCMRisinvokedbyataskB*ˆ(normallyIOI)to‚allocateachannel.‚ItspurposeistogivetheD*ˆdriverachancetosetupthingsforcommandserviceandinterrupt-*ˆservice.‚Thebasicfunctionsperformedare:*5*ˆ1.‚PutthestartaddressofthedriverintotheCCB*ŒvariableDRV_ADDR.2*ˆ2.‚Putthetotalnumberofdrivesonourchannel!*ŒintotheCCBvariableMAX_DRVS.8*ˆ3.‚Putthesizeinbytesofthedrive'svariableblock!*ŒintotheCCBvariableDRV_SIZE.?*ˆ4.‚Device-IndependentinitializationinthecalltoDISK_INIT"*ŽtoinitializetheCCBvariables.?*ˆ5.‚Device-DependentinitializationinthecalltoDO_INITfor"*Ždevicedependentinitialization.*B*ˆThissubroutineisenteredthroughaJSRfromCMR,andwillexit7*ˆwithanRTS.‚Theprocessorisinthesupervisormode.*%*ˆEntry:„A6=physicaladdressofTCB*’A5=physicaladdressofCCB*5*ˆInterruptlevelis0.‚Registersmaybeusedfreely.*.*ˆRegistersusedinDISK_INIT:…01234567*¦D‚**¦A‚*‰P**ˆExitsto:CMRviaRTS*O*******************************************************************************O*******************************************************************************ŠPAGEINIT: *)*‚GetaddressofstartofdriverintoCCB*ŠLEA‡RWINDRV(PC),A0ŠMOVE.L„A0,DRV_ADDR(A5)*9*‚GetthenumberofdrivessupportedbytheRWINchannel.*ŠMOVE.W„#DRIVES,MAX_DRVS(A5)*5*‚Getthesizeinbytesofthedrive'svariableblock*ŠMOVE.W„#DRVBLKSZ,DRV_SIZE(A5)*>*‚Performthedevice-independentinitializationbycallingthe'*‚genericroutineDISK_INITinDISKLIB.*/‰JSR†DISK_INITŒDothedevice-independentstuff.4‰IF‚‚THEN.SŽSomethingwentwrongwithDISK_INIT.‹RTS™Thechannelisdown!!‰ENDI*8*‚Performanydevice-dependentinitializationinDO_INIT*/‰BSR.L„DO_INITŽDevicedependentinitialization.‰RTS‰PAGEO*******************************************************************************O*********************************************************************************ˆCOMMANDSERVICEROUTINE*C*ˆThissubroutineiscalledfromCMRwhenCMRreceivesacommandtoA*ˆinitiatean‚I/Otransaction‚withadevicethatiscontrolledby?*ˆth isdriver.‚Itsfunctionisto‚processthe‚givencommand‚andB*ˆqueuethecommandtothecontroller.‚Thesefunctionsarehandled%*ˆbythegenericdiskdriverDISKLIB.*5*ˆEntry:„A2=physicaladdressofCMRparameterblock*’A5=physicaladdressofCCB/*’A6=physicaladdressofTCBofattachedtask*5*ˆInterruptlevelis0.‚Registersmaybeusedfreely.*1*ˆRegistersusedbyDISK_COMMAND:†01234567*ªD‚********ªA‚*****P**ˆExitsto:CMRviaRTS*O*******************************************************************************O******************************************************************************* COMMANDS: *,*‚Performanydevice-dependentstuffhere...* =*‚Wehavereceivedacommand,soweknowthereissomeoneout**‚theretotalkto.‚LetDISKLIBhandleit.*&‰JSR†DISK_COMMAND‹Performthecommand.‰RTSReturntoCMR.‰PAGEO*******************************************************************************O*********************************************************************************ˆRWININTERRUPTHANDLER*E*ˆControlcancometotheRWINinterrupt‚handlerwhenCMRreceivesanF*ˆinterruptontheinterruptlevelthatisusedbytheRWINcontrollerB*ˆIfthe‚interruptisaRWINinterrupt,theRWIN‚interrupthandlerF*ˆsetstheCbitoftheSR,andlowerstheinterruptmasklevelbyone*ˆleveluponreturn.*=*ˆEntry:„A1=PhysicaladdressoftheRWINinterrupthandler.#*’A5=PhysicaladdressoftheCCB.1*’SR=MaskedattheleveloftheRWINinterrupt.*O*******************************************************************************O*******************************************************************************‰PAGEO*********************************************************************************ˆINTERRUPTPOLLINGROUTINE*B*ˆControlcancometothe‚RWINinterrupthandlerwhenCMRreceivesC*ˆaninterruptontheinterruptlevelthatisusedbytheRWINdiskC*ˆcontroller.IftheinterruptisaRWINinterrupt,theRWINdriverA*ˆhandlesit,‚andreturnstoCMRwiththeCbitsetoftheSR.‚IfA*ˆtheinterruptisnotaRWINinterrupt,‚returntoCMRwiththeC*ˆbitcleared.*#*ˆEntry:„JSRfrominterrupthandler*’A5=physicaladdressofCCB*<*ˆTheinterruptlevelisattheleveloftheRWINinterrupt.8*ˆD0,A0,A1,A5havebeensavedbyCMR.‚Thedrivermust *ˆsaveanyotherregistersused.*!*ˆRegisterusage:…01234567*™D‚**™A‚*‰P**ˆExit:…RTSbacktoCMR*O*******************************************************************************O******************************************************************************* **ˆIstheinterruptforme?* REQINTƒEQU†(1<*ˆThisroutineisexecutedduetoaRWINinterruptorhasbeen?*ˆcalledfromthecommandhandlertoinitiateanI/Ooperation.>*ˆWe'llturnoff‚theinterrupts,savesomeregisters,andjump2*ˆtothepreviouslysetco-routineswitchaddress.*7*ˆTheinterruptlevelismaskedatourchannel'slevel.*=*ˆEntry:„A0=physicaladdressofRWINMemory-MappedI/Oarea*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567(*™D‚*####=Savedtousethroughout.*™A‚P*###P*=*ˆExit:…Jumptoco-routinesegmentaddressedbyINTSWTCH(A5).*O************************************************************ ******************* RWININT‚EQU‡*6‰MOVE.B#DSBLDINT,INTCTRL(A0)‚Disabledatainterrupts.*‰BTST.B#BITCB,FLAGS(A0)‡IstheRWINbusy?2‰IF…THEN.SŒTheRWINisnotbusy,socleartheCŠMOVE.BSENSE(A0),SENSBYT0(A5)commandcompletioninterruptandDRQ‰ENDIšbyreadingSENSEbyte0. @EQ430„REG†A4/A3/A2/D3/D2/D1†A5,A1,A0,andD0havealreadybeen;‰MOVEM.L‚EQ430,-(SP)ŠsavedbyCMR.‚Herewesavetherestof$*§theregistersthatweneedtouse. =‰MOVE.L„CCBCHB(A5),A0‡A0<---memory-mappedI/OspaceofRWIN4‰MOVE.LƒIOQUEUE(A5),A1‡A1<--Drive'svariableblock =‰MOVE.LƒINTSWTCH(A5),A3ˆBranchtotheco-routinesegmentthat"‰JMP†(A3)‘shouldbeexecutednext.‰PAGEO*********************************************************************************ˆWINCHESTEROPCODETABLE*F*ˆTheWinchesteropcodetablecontainstheRWIN-definedvaluesforthe:*ˆI/OoperationsthatarecurrentlysupportedbytheRWIN.*O******************************************************************************* 0*’---------------------------RWINOpcodevalue.*’|*’|”------IOFUNCTindexvalue.*’|”|*’|”|*’V”V‰DC.B…$0A’-1=Writedisk.OPTBL„DC.B…$04“0=Formatdisk.‰DC.B…$C0’+1=Configuredrive‰DC.B…$08’+2=Readdisk.0FTRACKƒDC.B…$06”Theopcodeforaformat-trackor7ALTSECƒDC.B…$07’format-alternatecommandisnotindexed/‰DS.W†0“bytheIOFUNCTvalue.TheIOFUNCTvalue&*¦forallformatcommandsisthesame.'*¦Weuniquelyidentifytheformat-track&*¦commandsbythefactthatitsIOOPTS!*¦valueisdifferent.‡BWN2/13/84‰PAGEO*********************************************************************************ˆPROCESSNEXTQUEUEENTRY*E*ˆControlcomestothisco-routinesegmenttoprocessthefrontentryA*ˆoftheIOQUEUE.‚WeareguaranteedthattheIOQUEUEisnon-empty%*ˆwhencontrolcomestothisroutine.*=*ˆEntry:„A0=physicaladdressofRWINMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚** *™A‚PPƒ*ƒP**ˆExit:…BSRtoSENDCMD*O******************************************************************************* *F*ˆBuildthe6-bytecommandpacketinthedriveblockofglobalmemory.*>PROCQUE‚LEA†CMDEND(A5),A3ˆA3<--bytethatimmediatelyfollows(*¦thelastbyteofcmdpacketinmemory.%*¦Autodecrementaddressingisusedto(*¦completethecommandpacketinmemory. >‰MOVE.BƒCTRLCODE(A1),-(A3)ƒCopythecontrol-codeintoCMDCTRL. *;* WE'LL ASSUME A READ OR WRITE COMMAND, SINCE MOST WILL BE.*7‰MOVE.LƒHALFSCTS(A1),D0†Areanyhalfsectorsspecified?)‰BNE.S„L0470YES.READHALFSECTORSFIRST >‰MOVE.LƒIOSCTCNT(A1),D0†Getthetotal#ofsectorstotransfer‰MOVE.Lƒ#MAXSECTS,D13‰CMP.L„D1,D0Is#required<=MAXperRWINcommand?*‰BLS.S„L0470Yes.Thisrequires1command.0‰MOVE.LƒD1,D0NO.TransferMax.inthiscommand.9L0470„MOVE.BƒD0,-(A3)Move#ofsectorstocommandpacket %*¨Ifwe'reprocessingacommand(such#*§asaformatcommand)thatdoesn't)*§involveanactualI/Otransfer,wehave*§IOSCTCNT=0.‰PAGE=‰MOVE.LƒIOSECTOR(A1),-(A3)…WeusetheIOSECTORvaluefromthe?‰AND.W„#LSNMASK>>16,(A3)+ƒdiskdrive'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.‚TheLUNfieldoccupies *§thetopfewbitsofLSNfield. **‚Housekeeping...*<‰SUB.L„D0,IOSCTCNT(A1)ˆReducethecountofremainingsectors'*¦bythenumberofsectorsthatwillbe(*¦processedasaresultofthiscommand. :‰ADD.L„D0,IOSECTOR(A1)ˆIncreasethestartingsectornumber'*¦bythenumberofsectorsthatwillbe(*¦processedasaresultofthiscommand.&*¦ThiscausesIOSECTORtopointtothe)*¦sectorthatshouldbespecifiedforthe$*¦next(ifany)command packetafter *¦thisone. ;‰MOVE.BƒIOFUNCT(A1),D0‰GettheIOFUNCTcodeintoD0.Wsowe+‰EXT.W„D0“canuseittoindexintotheRWIN6‰CMP.B„#FMTFUNC,D0Šopcodetable.Foraformatcommand,3‰IFTHEN.Swemustdosomespecialprocessing.**‚ForFormatCommandsONLY:*‚THEN.SŽIfnot,seeifit'saformat *¦alternatesectortypecommand.*"ŽIF‚IOOPTS(A1)#IOPBADTHEN.S 9“MOVEQI„ALTSEC-OPTBL,D0‚Ifalternatesectortypecommand,$*¬thensetuptogetALTSECcommand. “BRA.S…L0490 ŽENDI ‰ENDI =‰MOVEQWƒFTRACK-OPTBL,D0†AdjustD0.Wtoindextheformat-track!*¦entryoftheRWINopcodetable.‰ENDI‰PAGE*&*ˆContinueprocessingforallcommands*;EQ483„EQU†CONFGBLK+IOSSPTˆForallcommands,change6thbyte(*¦tosingle-density,128bytes/sectorif(*¦weareontrack0(floppydisksonly).*/‰CLR.L„D1“Comparethe#ofsectorspertrackto=‰MOVE.BƒEQ483(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‡**?*ˆBecauseoftheaddedcode,wegetadisplacementerroronthe&*ˆcommentedoutstatement.™BWN‚2/13/84**‰LEA‡OPTBL(PC),A4‰A4<--RWINopcodetable@‰MOVE.B„0(A4,D0.W),-(A3)…FilltheCMDOPfieldofthecmdpacket.>***†MOVE.BƒOPTBL(PC,D0.W),-(A3)ƒFinally,filltheCMDOPfield. 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' 8SENDAGN‚BSR†SENDCMDSendthecommandpackettotheRWIN.$*¦controller,andsubroutineSENDCMD'*¦assumesthatA0pointstothememory-*¦mappedI/OareafortheRWIN.* *¨Controlfallsthrutothedata*¦handlingpartofthedriver.‰PAGEO*********************************************************************************ˆDATAHANDLER*B*ˆWeassumethatthecommandisadatatransfertype(i.e.reador?*ˆwrite)‚andsetuptotransferasector.ƒThisiswastediftheB*ˆcommandisaconfigureorformatbutsincemostcomandsareR/W,*ˆwewon'tworryaboutit.*O******************************************************************************* NEXTSECTEQU†*EQ491„EQU†CONFGBLK+IOSPSM6‰MOVE.WƒEQ491(A1),D1‰D1<--thenumberofbytes/sector2‰TST.L„HALFSCTS(A1)‰Anyhalfsectorsthiscommand? ‰IFTHEN.SNo.)ŠLSR.W„#1,D1Yes.Dividesectorsizeby2‰ENDI <‰LSR.W„#LCDSCTBT,D1‰D1.B=#blocks/sectorforthiscommand.%‰MOVE.BƒD1,BLKCNT(A5)ˆSavethecount. 8NEXTSEC1BSR†INTRTNTheRWINcontrollerneedstimetodo$*¦itsjobbeforewecantransferany(*¦data,soreturncontroltothesystem.'*¦WhentheRWINcontrollerhasfinished$*¦itscurrenttask,we'llreceivean&*¦interruptthatwillcausecontrolto(*¦comebackhere.‚Theco-routinelinkage)*¦convenientlyallowsustocalltherest&*¦ofthesystemasifitweresimplya)*¦subroutinetobeexecutedwhilewehave*¦nothingbettertodo.‰PAGEO********************************************************************************%*ˆWegethereafteraRWINinterrupt.$*ˆWeareexpectingadatainterrupt.*O******************************************************************************* <‰MOVE.LƒIOBUFPTR(A1),A3ˆPointA3tothenextbyteoftheI/O&*¦buffer.‚WenowhavebothA3andD1.W%*¦setupproperlyforareadorwrit e'*¦transaction.‚Ifwe'reperformingsome&*¦otherkindoftransaction(suchasa(*¦formatcommand),we'vesimplywasteda(*¦littletimebysettingupA3andD1.W. =‰MOVE.BƒIOFUNCT(A1),D2‡SetupD2.BwiththeI/Ofunctionflag..‰CMP.B„#READFUNC,D2‰Testforthereadcommand.'‰BEQ.S„RD_WRIfread,goreadthedata..‰CMP.B„#WRTFUNC,D2ŠTestforthewritecommand.)‰BEQ.S„RD_WRIfwrite,gowritethedata.3‰CMP.B„#CNFGFUNC,D2‰Testfortheconfigurecommand.+‰BEQ†RDSTAT1ŽIfconfigure,gocheckstatus. /‰IF.B†IOFUNCT(A1)‚‚#FMTFUNCƒTHEN.S„Format?**ˆForFormatCommandsONLY* )Ž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ŠSend256bytestocontroller**¦tomarksectors0throughsectorno.-1(*¦as‚"good",andthesectorsfromsector&*¦no.through31as"bad",designating(*¦correspondingsectorsonthealternate*¦trackas"alternates".*?*ˆWewanttodisablethedatainterruptbecausewearealldoneC*ˆsendingdata.TheCMDSECTSfield,whichisthesameastheCMDILVA*ˆ(interleavefactor)field,mustbesetto0,asitistestedin *ˆINTRTN.*“SF.B†CMDSECTS(A5)(“BSR‡INTRTNŽWaitforcontrollertodoit‰PAGEO********************************************************************************%*ˆWegethereafteraRWINinterrupt.>*ˆWeareexpectingacommandcompletioninterruptfor'FORMAT'*O******************************************************************************* 4“BTST.B„#BITCB,FLAGS(A0)„IsRWINbusy?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 O********************************************************************************%*ˆWegethereafteraRWINinterrupt.B*ˆWeareexpectingadatainterruptsowecansendalternatedata.*O******************************************************************************* 2“MOVE.B„#ALTCODE,D5‡D5.B<---Opcodeforalternate*)“MOVE.B„#32,D2ŽD2.B<---firstsectorno.*°tobemarked"bad".,“BSR‡SEND_BYTES‡Send256bytestocontroller*°tomarkallsectorsofthe *°alternatetrackas"alternate"*?*ˆWewanttodisablethedatainterruptbecausewearealldoneC*ˆsendingdata.TheCMDSECTSfield,whichisthesameastheCMDILVA*ˆ(interleavefactor)field,mustbesetto0,asitistestedin *ˆINTRTN.*“SF.B†CMDSECTS(A5) “BRA‡READSTATŽENDI‰ENDI *‰BRA‡RDSTAT1—Ifcontrolreachesthispoint*°wehaveacommandcompletion*°andcancheckstatus.‰PAGE RD_WR„EQU‡*8‰MOVE.BƒFLAGS(A0),D0‹Ifwe'reperformingadatatransfer *¦thecontrollershouldbeBUSY.*‰BPL†CHECKERRNOTBUSY.Gotocheckerror.‰BTST…#BITDRQ,D0IsDRQon.3‰BEQ†CTRLERRŽWedon'tknowwhythere'saninterrupt* *ˆBWN‡3/5/84*A*ˆDoublecheckthatwewillnotreadorwritepasttheendoftheB*ˆbufferonournextread/write.StartingaddressisinA3,endingF*ˆaddressisinIOBUFEND,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,youaregoin gtomess*ˆupthedisk.* ‰ENDI *‰TST.B„D2•Checkforreadorwritecommand.'‰BLT.S„WRTDATAŽBRANCHIFWRITECOMMAND.*¨FALLTHRUONREAD ‰PAGEO********************************************************************************D*ˆREADDATAROUTINEenteredafteraRWINinterrupt(DRQ)foraread.*=*ˆEntry:„A0=physicaladdressofRWINMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory)*’A3=pointertonextbyteofI/Obuffer*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚*…**™A‚P…**9*ˆExit:…Branchestoread/writecommonroutine(RWCOMMON).*O******************************************************************************* READDATAEQU†*.EQ546„EQU†4*8”Eachiterationoftheinnerloop%*¦belowtransfers4*8=32databytes @‰MOVEQWƒLCDSCTSZ/EQ546-1,D3„InitializeD3.Wtocontroltheinner$*¦loop.‚We'llexecutetheinnerloop%*¦enoughtimestotransfer128bytes. DL0550„MOVEP.L‚DATA0(A0),D0†----ƒEachcompleteiterationofthisloop9‰MOVE.LƒD0,(A3)+Š|ƒtransfers4*8=32databytesfromthe'*§|ƒRWINcontrollertotheinputbuffer=‰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†|…TheRWINcontrolleractuallyhasjust7‰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.‰PAGEO********************************************************************************C*ˆREADJUNK‚ROUTINEenteredafteraRWINinterrupt(DRQ)foraread.*E*ˆWejustrealizedthatweareabouttowritepasttheuser'sbuffer.2*ˆWewilljustreadthebytesintothebitbucket.*=*ˆEntry:„A0=physicaladdressofRWINMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory)*’A3=pointertonextbyteofI/Obuffer*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚*…**™A‚P…**9*ˆExit:…Branchestoread/writecommonroutine(RWCOMMON).*O******************************************************************************* READJUNKEQU†* @‰MOVEQWƒLCDSCTSZ/EQ546-1,D3„InitializeD3.Wtocontroltheinner$*¦loop.‚We'llexecutetheinnerloop%*¦enoughtimestotransfer128bytes. FRD_LOOP‚MOVEP.L‚DATA0(A0),D0†----ƒEachcompleteiterationofthisloop&*§|ƒtransfers4*8=32databytesfrom%*§|ƒRWINcontrollertotheBITBUCKET=‰MOVEP.L‚DATA0(A0),D0†|ƒandweperformjustenoughiterations$*§|ƒofthisinnerlooptotransfera&*§|ƒtotalofLCDSCTSZbytesduringone4‰MOVEP.L‚DATA0(A0),D0†|ƒiterationoftheouterloop.*§|#*§|ƒWeuseaMOVEP.Linstructionto<‰MOVEP.L‚DATA0(A0),D0†|ƒtransferfourconsecutivedatabytes'*§|ƒwiththemaximumpossiblespeedand&*§|ƒreplicatethecodeinthisloopto<‰MOVEP.L‚DATA0(A0),D0†|ƒreducetheeffectsofloopoverhead.'*§|ƒWecouldreplicatethecodeinthis'*§|ƒloopmoretimesforevenmorespeed=‰MOVEP.L‚DATA0(A0),D0†|ƒbutdiminishingreturnsbegintomake&*§|ƒmorereplicationslessattractive.*§|=‰MOVEP.L‚DAT A0(A0),D0†|…TheRWINcontrolleractuallyhasjust'*§|ƒonedataregisterbutthatregister'*§|ƒappearsat4differentlocationsin>‰MOVEP.L‚DATA0(A0),D0†|ƒthememorymap.Therefore,theMOVEP.L%*§|ƒinstructionactuallyaccessesthe'*§|ƒsamedataregister4timeswiththe-‰DBRA…D3,RD_LOOPˆ----‚maximumpossiblespeed.  ‰RTS‰PAGEO********************************************************************************K*…WRITEDATAROUTINEenteredwhenwehaveaRWINinterupt(DRQ)forawrite*=*ˆEntry:„A0=physicaladdressofRWINMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory)*’A3=pointertonextbyteinI/Obuffer*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567*™D‚*…**™A‚P…**=*ˆExit:…Fallthroughtoread/writecommonroutine(RWCOMMON).*O******************************************************************************* WRTDATA‚EQU†* .EQ561„EQU†4*8”Eachiterationoftheinnerloop&*¦belowtransfers4*8=32databytes. @‰MOVEQWƒLCDSCTSZ/EQ561-1,D3„InitializeD3.Wtocontroltheinner$*¦loop.‚We'llexecutetheinnerloop%*¦enoughtimestotransfer128bytes. ?L0570„MOVE.Lƒ(A3)+,D0Š----‚Eachcompleteiterationofthisloop>‰MOVEP.L‚D0,DATA0(A0)†|ƒtransfers4*8=32databytesfromthe'*§|ƒoutputbuffertotheRWINcontrolle8‰MOVE.Lƒ(A3)+,D0Š|ƒandweperformjustenoughiterations>‰MOVEP.L‚D0,DATA0(A0)†|ƒofthisinnerlooptotransferatotal *§|ƒofLCDSCTSZbytesduringone/‰MOVE.Lƒ(A3)+,D0Š|ƒiterationoftheouterloop.‰MOVEP.L‚D0,DATA0(A0)†|#*§|…WeuseaMOVEP.Linstructionto7‰MOVE.Lƒ(A3)+,D0Š|ƒtransferfourconsecutivedatabytes?‰MOVEP.L‚D0,DATA0(A0)†|ƒwiththemaximumpossiblespeed,andwe&*§|ƒreplicatethecodeinthisloopto7‰MOVE.Lƒ(A3)+,D0Š|ƒreducetheeffectsofloopoverhead.;‰MOVEP.L‚D0,DATA0(A0)†|ƒWecouldreplicatethecodeinthis'*§|ƒloopmoretimesforevenmorespeed8‰MOVE.Lƒ(A3)+,D0Š|ƒbutdiminishingreturnsbegintomake=‰MOVEP.L‚D0,DATA0(A0)†|ƒfurtherreplicationslessattractive.*§|8‰MOVE.Lƒ(A3)+,D0Š|…TheRWINcontrolleractuallyhasjust<‰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.*©ControlfallsintoRW_COMMON‰PAGEO*********************************************************************************ˆREAD/WRITECOMMONROUTINE*?*ˆEnteredafterreadingorwritingablockofdata(128bytes).*=*ˆEntry:„A0=physicaladdressofRWINMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory-*’A3=pointertonextbyteintheI/Obuffer*’A5=physicaladdressofCCB*@*ˆExit:…BranchestoNEXTSEC1tocompleteprocessingthissector.5*’BranchestoNEXTSECTtocompleteprocessingcurrent7*’FallthroughtoRWINDONEroutinetofinishprocessing%*’thecurrententryoftheI/Oqueue.*O******************************************************************************* FRWCOMMONMOVE.LƒA3,IOBUFPTR(A1)†UpdatetheI/Obufferpointertopoint%*¦tothenextbyteoftheI/Obuffer. 8‰SUB.B…#1,BLKCNT(A5)‡Adjustblockcountforthissector.0‰BNE†NEXTSEC1Wehaven'tfinishedasectorsogo)*¦tocontinuethetransferiftheRWINis*¦requestingdatatransfer.*5*‚IncrementtheLSNanddecrementtheCMDSECTSfield:*7‰ADD.L„#1,CMDOP(A5)‹IncrementtheLSN.Thismaybeused%*¦toretryifsectorisfoundtohave*¦anECC/CRCerror.:‰SUB.B„#1,CMDSECTS(A5)ˆDecrementthecountofsectorsthat4‰BHI†NEXTSECTremaintobeprocessedforthecurrent%*¦WDCcommandsequence.‚Ifwehaven't**¦finished,loopbacktoprocessnextone. =‰BTST.Bƒ#BITCB,FLAGS(A0)‡We'vefinishedprocessingallofthe(*¦sector(s)forthecurrentRWINcommand *¦sequence. 5‰BNE.S„READSTATTheRWINmaystillbeBUSYbecauseof'*¦a dataECCerrorinlastsectorread. '*¨TheRWINisdone.(normalcase).ReadE‰MOVE.BƒSENSE(A0),SENSBYT0(A5)SENSEBYTE0toclearcommandcomplet-1‰BRA.S„RDSTAT1ioninterruptandgocheckstatus. 7READSTATBSR.S„INTRTN‘Returncontroltothesystem,and)*¦waitforastatus-readyRWINinterrupt. PAGEO********************************************************************************%*ˆWegethereafteraRWINinterrupt.2*ˆWeareexpectingacommandcompletioninterrupt.*O******************************************************************************* 7‰BTST.Bƒ#BITCB,FLAGS(A0)…IsRWINBUSY?Itshouldn'tbe.4‰BNE†CTRLERRŽYES.MustbeaDRQinterruptthatwe're*¦notexpecting.ARDSTAT1‚TST.B„SENSBYT0(A5)‰Werethereanyerrorsinthiscommand?'‰BNE.L„CHECKERRYES.Gotocheckerror. =XFERDONECLR.L„HALFSCTS(A1)‹Thisclearsthehalfsectorcount"*¦sinceallhalfsectorshavebeen%*¦transferedanyadditionaltransfers&*¦forthisI/Opacketwillbesectors.8‰TST.L„IOSCTCNT(A1)‹TheRWINcontrollerhassuccessfully1‰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(*¦endofthedisk,wereturntheISTAEOV'*¦statuscode.‚Otherwise,wereturnthe)*¦ISTAOKstatuscodetoindicatethatthe!*¦entireoperationwentsmoothly. %*¨ControlnowfallsintotheRWINDONE"*¦routinetofinishprocessingthe!*¦currententryoftheI/Oqueue.‰PAGEO*********************************************************************************ˆFINISHPROCESSINGQUEUEENTRY*F*ˆControlcomesherewhenthedriverisdonewiththecurrentcommand.D*ˆWecallCHAN_DONEin‚DISKLIBtoqueuetheI/Ocompletioneventfor@*ˆus,and‚we‚removethecurrent‚entryfrom‚thequeue.‚IftheI/OD*ˆqueuehasanotherentry,‚we'llloopbackandstartprocessingthat*ˆentry.*=*ˆEntry:„D1.B=VERSAdoserrorcodeiferror,otherwisezero.9*’D2=Logicalsectornumberiferror,otherwisegarbage.9*’A1=pointertodrive'svariableblockinglobalmemory*’A5=PhysicaladdressofCCB*?*ˆTheseentryconditionsarerequiredbytheCHAN_DONEroutine.*6*ˆCalls:„CHAN_DONEinthegenericdiskdriverDISKLIB.*=*ˆExit:…Branchestoprocessnextqueueentryifthereisone.0*’Fallsthroughtoidleloopifthereisn'tone.*O******************************************************************************* RWINDONEEQU†* 2‰JSR†CHAN_DONEŒCallthegenericdiskdrivertoset"*¦fieldsintheIOCBandqueuethe*¦eventforus. 6EQ640„REG†A1/A3/A4HereweremovethefrontentryfromA‰MOVEM.L‚IOQUEUE+4(A5),EQ640‚theI/Oqueue,andwesimultaneouslyA‰MOVEM.L‚EQ640,IOQUEUE(A5)„setA1topointtothedriveblockfor(*¦thediskdrivethatisassociatedwith$*¦thenext(ifany)entryoftheI/O*¦queue. 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%*¦ispotentiallyactivewhentheRWIN'*¦controlleriscaughtupandshouldbe*¦idle.‰PAGEO************************************************************** *******************ˆIDLELOOPROUTINE*B*ˆThisroutineisenteredwhentheI/Oqueuehasbeenemptied.TheB*ˆcontrolleriscompletelycaughtupwithallofitsrequests,and9*ˆisnowidle.‚We'llsimplereturncontroltothesystem.*=*ˆEntry:„A0=physicaladdressofRWINMemory-MappedI/Oarea*’A5=physicaladdressofCCB*3*ˆExit:…BSRtoINTRTN.‚Itshouldneverreturnhere.*O******************************************************************************* :IDLELOOPBSR.S„INTRTN‘TheI/Oqueueisempty,sowesimply%*¦returncontroltothesystem.‚We've)*¦caughtupwithalloftherequeststhat'*¦havebeensetupforprocessingunder*¦interruptcontrol. 4‰ST.B…CHANDOWN(A5)‹Ifcontrolevercomestothisco-%*¦routinesegment,wehaveaproblem.#*¦Apparently,we'vereceivedaRWIN%*¦interruptwhenwehaven'tgiventhe%*¦controlleranythingtodo.‚Infact,%*¦notonlyhavewenotgiventheRWIN'*¦controlleranythingtodo,wehaven't*¦evenenableditsinterrupt. #*¨It'shardtotellwhatmighthave$*¦causedthisproblem,butsomething$*¦seriousiswrong.‚WemarktheRWIN&*¦channeldown,andwe'llreportitas%*¦beingdownthenexttimethesystem*¦triestoaccessit. 2‰BRA.S„IDLELOOPReturntotheidleloop.‚We'llget$*¦outofthisloopwhenevertheRWIN&*¦driverreceivesanothercommandthat(*¦requiressomeactionthatmustbedone*¦underinterruptcontrol. PAGEO*********************************************************************************ˆRETURNFROMINTERRUPT*C*ˆThisroutineiscalledwheneverwewanttoreturncontroltoCMR;B*ˆtowaitforthenextinterruptorwhenwe'vefinishedprocessingA*ˆallcommands.‚Thisroutineisalwayscalledasasubroutine,so?*ˆthestackcontainstheaddressoftheco-routinesegmentthatD*ˆshouldbeexecutedinresponsetothenextinterrupt.ThisroutineA*ˆstoresthataddressinINTSWTCH,andenablesdatainterruptsif!*ˆthereisdatalefttotransfer.*=*ˆEntry:„A0=physicaladdressofRWINMemory-MappedI/Oarea*’A5=physicaladdressofCCB*O******************************************************************************* DINTRTNƒMOVE.Lƒ(SP)+,INTSWTCH(A5)ƒSavetheco-routineswitchaddress. AEQ440„REG†D1/D2/D3/A2/A3/A4„Restoretheregistersthatweresaved;‰MOVEM.L‚(SP)+,EQ440Šatthestartoftheinterrupthandler. 4‰TST.B„CMDSECTS(A5)‹Ifallthesectorshavenotbeen2‰IFTHEN.Stransfered,wewanttoenabledata7ŠMOVE.B#ENBLDINT,INTCTRL(A0)interruptsfromtheRWIN.‰ENDI &*¦NOTE*‚TheCMDSECTSfieldisnon-zero$*¦forCONFIGUREandFORMATcommands,'*¦butdatainterruptsarenotgenerated)*¦sowedon'tcarethattheyareenabled. G*ƒ******************************…Wedon'tenabledatainterrupts,since)*¦thelastcommandtotheRWINcontroller'*¦mayhavebeenareadorwriteandthe&*¦RWINloadsandunloadstheFIFOcon-<*†++++++‚NOTICE‚++++++ŠtinueouslywhileIDLEING.Thisallows%*¦adrivertotransmitorreceiveall)*¦thedataforacommandwithoutchecking&*¦forerroruntilit'sdone.Ofcourse(*¦noreadorwritestothediskactually)*¦occuraftertheerror.Thisdriverdoes?*ƒ******************************…NOTmakeuseofthisfunction. 4CARRY„EQU†1<<0“Finally,settheSR.Cbit,andreturn5‰OR.B…#CARRY,CCR‹controltoCMR.‚SettingtheSR.Cbit&*¦indicatesthatwehaveprocessedthe *¦interrupt.‰RTS‰SPC2N*******************************************************************************"*ˆENDOFINTERRUPTSERVICEROUTINE*N******************************************************************************‰PAGEO********************************************************************************-*ˆSUBROUTINESCALLEDBYTHEINTERRUPTHANDLER*O******************************************************************************* O************************************************************************** ******=*ˆSET_UP_ALT„(addedforalternatesectorcommandBWN2/13/84)*;*ˆSetupacommandpacketfortheformatalternatecommand.:*ˆTakethecommandpacketyouhavenow,andsubstitutethe=*ˆalternatesectornumberforthesectornumberintherenow.*@*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory*’A5=addressofCCB*!*ˆRegisterusage:…01234567*™D„**™A„P‡P**ˆP=parameterregister!*ˆ*=savedandrestoredregister**ˆExit:…Sameasentry*O******************************************************************************* SET_UP_ALT!‰MOVE.L„D1,-(SP)ŒSaveregisterD1<‰MOVE.L„CMDOP(A5),D1ˆSavebytes0-3ofcommandpacketinD1.8‰AND.L…#LSNMSKNOT,D1‡Maskoutlower21bitsofD1.‚These%*§bitscontaintheoldsectornumber.%*§ThestuffwewanttosaveisinD1.*3‰MOVE.L„IOALTSEC(A1),CMDOP(A5)ˆPutalternatesector*§numberintocommandpacket.;‰AND.L…#LSNMASK,CMDOP(A5)ƒMaskoutupper11bitsofcommand'*§packet.‚ThesecontainOpcodeandLUN.*:‰OR.L†D1,CMDOP(A5)ˆCombinetheoldOpcodeandLUNwiththe *§new(alternate)sectornumber. $‰MOVE.L„(SP)+,D1ŒRestoreregisterD1‰RTS‰PAGEO********************************************************************************D*ˆSEND_BYTES--Send256bytesofformatdescriptortothecontroller**@*ˆForeachofthe32sectors(0-$1F)onthetrack,send5bytes:*+*ˆByte0ƒ$00ifsectoristobemarkedgood)*‘$40ifsectoristobemarkedalternate#*‘$80ifsectoristobemarkedbad*8*ˆByte1„Logicalsectornumberforthistrack(00-$1F)*3*ˆByte2„Cylindernumber(MSB)ofalternatesector.*3*ˆByte3„Cylindernumber(LSB)ofalternatesector.*:*ˆByte4„Bits7,6,5:‚Headnumber(0-7)ofalternatesector5*’Bits4,3,2,1,0:Sectornumber(0-$1F)ofalternate*£sector**ˆThensendfillbytesto256.**ˆEntry:(*’A0ƒ=addressofmemory-mappedI/Oarea4*’D0.B=Cylindernumberofalternatesectorforbad$*™sector(garbageifnobadsectors)7*’D1.B=Headnumberofalternatesectorforbadsector*™(garbageifnobadsectors)3*’D2.B=Sectornumberoffirstbadsectorontrack*’D5.B=Opcode(00or40)**!*ˆRegisterusage:…0ƒ1234567*™D‚PƒPP**P**™A‚PƒP*’P=parameterregister*’R=returnregister*’*=saved/restoredregister***ˆExit:*’Sameasentry**O*******************************************************************************‰PAGE SEND_BYTES:SEND_REGSREG†D0-D6'‰MOVEM.LƒSEND_REGS,-(SP)…Saveregisters/‰MOVE.W„#256,D6D6<---numberofbytestosend $‰CLR.B…D3’D3will‚holdsectornumber3‰WHILE.BƒD3ƒƒ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*… nMwC<‡>A—4Ÿ7§E¯<·B¿;ÇJÏ<×Eß=ç<ï=*ˆ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‰PAGEO************ *********************************************************************ˆCHECKERRORROUTINE*+*ˆSomeerrorhasbeendetectedbytheRWIN.**ˆForaREADcommand:>*IftheerrorisanECCerror(correctableoruncorrectable),+*’1.‚Comparecurrenterrorwithlasterror.<*’2.‚Ifretrycountisnotexhausted,retryfrombadsector.;*’3.‚Ifretrycountisexhausted,erroriscorrectable,and7*–thelasttwoerrorswereidentical,we'llcorrectthe4*–errorinmemoryandissuetherestofthecommand.*’4.‚Elsereporttheerror.*+*ˆForallothercommands,reporttheerror.*=*ˆEntry:„A0=physicaladdressofRWINMemory-MappedI/Oarea9*’A1=pointertodrive'svariableblockinglobalmemory<*’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. 9‰LEA†SENSBYT0(A5),A4†POINTERTOSENSEBYTE0.NOTICETHAT$*§THE10SENSEBYTESAREACCESSEDIN *§ORDER(ei.0..9)BYSEQUENTIAL!*§READSOFTHESAMEMEMORYMAPPED"*§BYTEINTHERWIN.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 BUFFEREQ554„EQU†CONFGBLK+IOSPSM:‰MOVE.LƒIOBUFPTR(A1),A3†POINTERTONEXTLOCATIONINBUFFER7‰SUB.W„EQ554(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‰PAGE*H*‚WeonlygettoCHECKERRifwereadorwrotethedataanduppedtheLSNJ*‚andCMDSECTSinthecommandpacketforpreparationforgoingtoSENDNEW.*(*‚However,atthispointwewilleither:**ˆ(1)branchtoSTATERRifnomoreretries7*ˆ(2)branchtoSTATERRiferrorisnotcode$12or$13*ˆ(3)doaretry*E*‚IneachofthesecaseswewanttohavethecurrentLSNandCMDSECTSE*‚inthecommandpacket,sowehavetoadd1toCMDSECTSandsubtract*‚1fromtheLSN.* *L0555„TST.B„RETRY(A5)ŒISRETRYCOUNT=0?&‰IF‚‚THEN.SŽ&REPORTERRORIFZERO‹ADDQ.Bƒ#1,CMDSECTS(A5)‹SUBQ.Lƒ#1,CMDOP(A5)‹BRA.S„STATERR‰ENDI ‰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 PACKET3* IS POINTING TO THE CURRENT SECTOR. (BWN 10/25/84) ‰CLR.L„D1%‰MOVE.WƒEQ554(A1),D1‰GETBYTES/SECTOR*‰TST.L„HALFSCTS(A1)‰ISTHISAHALFSECTOR?‰BEQ.S„L0556NO.*‰LSR.W„#1,D1YES.BYTE/SECTORDIVIDEDBY2GL0556„SUB.L„D1,IOBUFPTR(A1)‚RESETBUFFERPOINTERTOSTARTOFBADSECTOR7‰ADDQ.Bƒ#1,CMDSECTS(A5)‚ADD1TON UMBEROFSECTORSLEFT*®FORCURRENTCOMMAND)‰SUB.L„#1,CMDOP(A5)ŽSETLSNBACK1SECTOR0‰LEA†CMDOP(A5),A3ŽPOINTA3TOTHECOMMANDPACKET+‰BRA†SENDAGN“GOTOSENDTHECOMMANDTOREAD*«FROMERRORSECTOR.‰PAGEO*********************************************************************************ˆREPORTERRORROUTINE*B*ˆWegetherewhenanerrorhasbeendetectedbytheRWIN1andthe*ˆretries,ifany,havefailed.*@*ˆEntry:„A1=pointertodrive'svariableblockinglobalmemory*’A5=physicaladdressofCCB*!*ˆRegisterusage:…01234567 *™D„R*R*™A„P‡P*"*ˆExit:‡D1.B=VERSAdoserrorcode/*”D2.L=Logicalsectornumberoferrorsector.*=*ˆTheseregistersarearequirementfortheRWINDONEroutine.**ˆExitsto:RWINDONE*O******************************************************************************* STATERR‚CLR.L„D29‰MOVE.BƒSENSBYT0(A5),D2†GettheerrordescriptiontoD2.W(‰CMP.B„#1,IOFUNCT(A1)‡Configurecommand?*‰BNE.S„RSTERR1ŽNo...reporterrorasusual.5‰CMP.B„#$0C,D2ŽYes..wastheerroranillegalcommand?1‰BNE†XFERDONENo...returnasifnoerroroccured.)RSTERRƒEQU†$80’Checkforself-testerror.RSTERR1‚CMP.B„#RSTERR,D2 ‰BNE.S„L0950/‰MOVE.Bƒ#ISTAUNR,D1ŠUnrecoverabledeviceerror. ‰BRA†RWINDONE * HERE FOR OTHER CODES?L0950„CMP.B„#ERRCEND,D2ŠRestofcodes>lastentryintableare *¦undefined. ‰BLS.S„L0955‰MOVE.Bƒ#ISTAICE,D1 ‰BRA†RWINDONE IL0955„MOVE.BƒERRCODE(PC,D2.W),D1‚UsetheRWINerror-codeasanindexinto(*¦theRWINerror-codetable,andgetthe)*¦VERSAdoserrorcodefromthetableinto*¦D1.B. 9‰MOVE.L„CMDOP(A5),D2ˆGetthesectornumberwiththeerror3‰AND.L…#LSNMASK,D2‰fromthecommandpacketintoD2. +‰BRA†RWINDONEDonewiththeerrorhandling. PAGEO********************************************************************************8*ˆTABLETOTRANSLATERWINERRORCODESTOVERSADOSERRORS*O******************************************************************************* *¨----‚RWINErrorCode.*¨|$*¨V…RWINDefinitionandExplanation. ?ERRCODE‚DC.B…ISTADMA‡$00„Noerror.BUTthedriverwasexpecting&*¦totransferdatatoorfromtheRWIN%*¦whentheRWINthroughtitwasdone.'*¦Wereportacontrollererrorwhenever$*¦wegetthiserrorcodebecausethe*¦situationisserious. 3‰DC.B…ISTAUNR‡$01„Noindexsignal.‚VERSAdosdoesn't'*¦reallyhaveanerrorcodetodescribe%*¦thissituation,sowesimplyreport$*¦thatthediskunrecoverableerror. 2‰DC.B…ISTARES‡$02„Notrack000.‚Diskrestoreerror '‰DC.B…ISTASAˆ$03„Invalidsectornumber. 7‰DC.B…ISTANRˆ$04„Drivenotready.‚Wereportanerrorto'*¦indicatethatthedriveisnotready. #‰DC.B…ISTASEK‡$05„Noseekcomplete. &‰DC.B…ISTADME‡$06„IDheadernotfound. 7‰DC.B…ISTADME‡$07„Datamarknotfound.ReportasIDnot$*¦found.Thisisnota"DELETEDDATA*¦MARKDETECT" 6‰DC.B…ISTABDS‡$08„Nestedalternatesectors.Thiserror%*¦isdetectedwhenasectorismarked%*¦defectiveandthealternateisalso*¦markeddefective. '‰DC.B…ISTAICE‡$09„Undefinederrorcode.'‰DC.B…ISTAICE‡$0A„Undefinederrorcode.'‰DC.B…ISTAICE‡$0B„Undefinederrorcode. &‰DC.B…ISTAIFˆ$0C„Invalidcommandcode. '‰DC.B…ISTAICE‡$0D„Undefinederrorcode.'‰DC.B…ISTAICE‡$0E„Undefinederrorcode.'‰DC.B…ISTAICE‡$0F„Undefinederrorcode.'‰DC.B…ISTAICE‡$10„Undefinederrorcode.'‰DC.B…ISTAICE‡$11„Undefinederrorcode. 3‰DC.B…ISTACRC‡$12„UncorrectabledataECC/CRCerror. 7‰DC.B…ISTACRC‡$13„Correctabledataerror.Theretrydid"*¦produceconsistentresultssoan"*¦uncorrectableerrorisreported. (‰DC.B…ISTAWPˆ$14„Writeprotecteddevice. 5‰DC.B…ISTAUNR‡$15„Writefault.Thisisreportedasan*¦unrecoverabledeviceerror. '‰DC.B…ISTAICE‡$16„Undefinederrorcode.'‰DC.B…ISTAICE‡$17„Undefinederrorcode.'‰DC.B…ISTAICE‡$18„Undefinederrorcode.'‰DC.B…ISTAICE‡$19„Undefinederrorcode.'‰DC.B…ISTAICE‡$1A„Undefinederrorcode.'‰DC.B…IS TAICE‡$1B„Undefinederrorcode.'‰DC.B…ISTAICE‡$1C„Undefinederrorcode.'‰DC.B…ISTAICE‡$1D„Undefinederrorcode.'‰DC.B…ISTAICE‡$1E„Undefinederrorcode.'‰DC.B…ISTAICE‡$1F„Undefinederrorcode.'‰DC.B…ISTAICE‡$20„Undefinederrorcode.'‰DC.B…ISTAICE‡$21„Undefinederrorcode.'‰DC.B…ISTAICE‡$22„Undefinederrorcode.'‰DC.B…ISTAICE‡$23„Undefinederrorcode.'‰DC.B…ISTAICE‡$24„Undefinederrorcode.'‰DC.B…ISTAICE‡$25„Undefinederrorcode.'‰DC.B…ISTAICE‡$26„Undefinederrorcode.'‰DC.B…ISTAICE‡$27„Undefinederrorcode.'‰DC.B…ISTAICE‡$28„Undefinederrorcode.'‰DC.B…ISTAICE‡$29„Undefinederrorcode.'‰DC.B…ISTAICE‡$2A„Undefinederrorcode.'‰DC.B…ISTAICE‡$2B„Undefinederrorcode.'‰DC.B…ISTAICE‡$2C„Undefinederrorcode.'‰DC.B…ISTAICE‡$2D„Undefinederrorcode.'‰DC.B…ISTAICE‡$2E„Undefinederrorcode.'‰DC.B…ISTAICE‡$2F„Undefinederrorcode.'‰DC.B…ISTAICE‡$30„Undefinederrorcode.'‰DC.B…ISTAICE‡$31„Undefinederrorcode.'‰DC.B…ISTAICE‡$32„Undefinederrorcode.'‰DC.B…ISTAICE‡$33„Undefinederrorcode.'‰DC.B…ISTAICE‡$34„Undefinederrorcode.'‰DC.B…ISTAICE‡$35„Undefinederrorcode.'‰DC.B…ISTAICE‡$36„Undefinederrorcode.'‰DC.B…ISTAICE‡$37„Undefinederrorcode.'‰DC.B…ISTAICE‡$38„Undefinederrorcode.'‰DC.B…ISTAICE‡$39„Undefinederrorcode.'‰DC.B…ISTAICE‡$3A„Undefinederrorcode.'‰DC.B…ISTAICE‡$3B„Undefinederrorcode.'‰DC.B…ISTAICE‡$3C„Undefinederrorcode.'‰DC.B…ISTAICE‡$3D„Undefinederrorcode.'‰DC.B…ISTAICE‡$3E„Undefinederrorcode.'‰DC.B…ISTAICE‡$3F„Undefinederrorcode.'‰DC.B…ISTAICE‡$40„Undefinederrorcode. 6‰DC.B…ISTAUNR‡$41„Floppycontrollerchipfault.Report *¦anUnrecoverableDeviceError. 6‰DC.B…ISTACNF‡$42„Illegalfloppyformat.Configuration*¦ParameterError. 3‰DC.B…ISTACFG‡$43„Media/driveincompatible.Config.*¦ParameterError. 3‰DC.B…ISTAUNR‡$44„Unexpectedfloppydiskcontroller *¦interrupt. ERRCEND‚EQU†*-ERRCODE K* ERROR CODES >$44 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.‚TheRWINwantstobereadorwrittenbutthedriverisnot%*Žexpectingtotransfermoredata,orE*Š2.‚TheRWINgeneratedaninteruptbuttheconditionhaschanged,orD*Š3.‚TheRWINwent'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…CHANDOWN(A5)‹DowntheRWINchannelbysettingthe"*¦variablethatindicatesthatthe#*¦controllerisdown.‚Ifthesystem(*¦triestoaccesstheRWINchannelagain#*¦withoutresettingitfirst,we'll%*¦reportanerrorindicatingthatthe$*¦channelisdown.‚Thesystemreally"*¦shouldn'ttrytoaccesstheRWIN'*¦channelagainwithoutfirstresetting$*¦thecontroller.‚Evenresettingthe)*¦controllermaynotcorrecttheproblem,'*¦butwe'llletthesystemtryasoften*¦asitwishes. 5‰MOVEQIƒISTACNT,D1SetupD1.Bforreportingastatus5‰BRA†RWINDONEcodethatindicatesacontrollererror,%*¦andgoterminateprocessingforthe!*¦currententryoftheI/Oqueue.‰PAGEO*********************************************************************************ˆSENDCOMMANDROUTINE*H*ˆThepurposeofthisroutineistosendthecommandpackettotheRWIN.*8*ˆEntry:„A0=addr essof1stbyteofthecommandpacket.6*’A3=physicaladdressofRWINMemory-MappedI/Oarea*!*ˆRegisterusage:…01234567*™D‚***™A‚P…**"*ˆExit:…Returntocallingroutine.*O******************************************************************************* SENDCMD‚EQU‡*&‰MOVEQW„CMDLEN-1,D1‰Numberofbytes-1"EQ521„EQU‡(1<‚Drive/controllersupportstheconfigurerequest.?*‚Drive/controllerdoesnotsupporttheconfigurerequest.4*•D1.B=VERSAdoserrorcodefortheerrordetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** SET_CNFG: /‰MOVEM.L‚D2/D4,-(A7)ŠSaveanyregistersweuse. $‰MOVEQ.L‚#0,D2Clearsaveregisters.‰MOVEQ.L‚#0,D4* >CD010„EQU†CONFGBLK+IOSTRKD…No.ofcylindersondrive(floppy).;CD015„EQU†CONFGBLK+IOSTRK†No.ofcylindersonmedia(hard). $‰BTSTW„#IOARDISC,CONFGBLK+IOSATW(A1)‰IF‚‚THEN.SŽIffloppy,7‹MOVE.W‚CD010(A1),D4ˆUsetheno.ofcylindersondrive.‰ELSE.S˜Ifhard,7‹MOVE.W‚CD015(A1),D4ˆUsetheno.ofcylindersonmedia.‰ENDI %‰SUBQ…#1,D4Maxcyl=no.ofcyl-1.‰PAGE9CD020„EQU†CONFGBLK+IOSHDS†Readtheno.ofheadsondrive.‰MOVE.BƒCD020(A1),D2‰*)‰SUBQ…#1,D2Maxheads=no.ofheads-1.$‰LSL.W„#8,D2Positioninbits13-15.‰LSL.W„#5,D2*!‰OR.W…D2,D4Addtosaveregister. :CD030„EQU†CONFGBLK+IOSPCOM…Readtheprecompensationvalue.‰MOVE.WƒCD030(A1),D2‰*0‰CMP.W„#$FF,D2ŽLimittoonebyte,sincetheRWIN-‰IF‚‚THEN.SŽhasonlyonebytetoholdthe1‹MOVE.W#$FF,D2Žpre-compensationcylindernumber!‰ENDI %‰MOVE.LƒD2,IOSCTCNT(A1)†Saveitaway.‰MOVE.LƒD4,IOSECTOR(A1) 3‰CMP.B„D0,D0Setsincewesupportthecommand.4‰MOVEM.L‚(A7)+,D2/D4ŠRestoreregistersthatweused.‰RTS‰PAGEN******************************************************************************* *ˆSET_CODE*F*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledatE*ˆthebeginningofthedriver.‚ThefunctionofthisroutineistosetD*ˆanymedia‚and/or‚driverelatedcodesinthedrive'svariableblockC*ˆ(device-dependentportion)‚requiredby‚theparticular‚controller.>*ˆItiscalledbyconfigure,read,write,andformatcommands.**A*ˆEntry:„A1=pointertoDrive'sVariableBlockinglobalmemory.#*’A5=physicaladdressoftheCCB.* *’Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567 *™D‚**…**™A„P‡P* *ˆCalls:none**ˆExit:‚RTStocaller.*F*ˆTheinterruptleveluponexitmustbethesameasitwasupon entry.*N****************************************************************************** SET_CODE: 2‰MOVEM.L‚D0/D1/D4,-(A7)‡Saveanyregistersweuse. -‰MOVEQ„#0,D4UseD4toholdthecontrolcode.6EQ652„EQU†CONFGBLK+IOSATW†ReadoptionfieldinIOSATW.‰MOVE.WƒEQ652(A1),D0‰Getit. ‰BTST…#IOATDEN,D0ŠTrackdensity?'‰BEQ.S„STAG10Leaveaszeroforsingle.&‰BSET…#CTD,D4ŽSetthatbitfordouble. $STAG10ƒBTST…#IOAFRMT,D0ŠFormattype?)‰BNE.S„STAG20LeaveaszeroforIBM-type.-‰BSET…#CSN,D4ŽSetthatbitforMotorolatype. *STAG20ƒBTST…#IOADDEN,D0ŠRecordingdensity?,‰BEQ.S„STAG30Leaveaszeroforsingle(FM).,‰BSET…#CMF,D4ŽSetthatbitfordouble(MFM). STAG30ƒBTST…#IOADSIDE,D0‰Sides?'‰BEQ.S„STAG35Leaveaszeroforsingle.&‰BSET…#CDS,D4ŽSetthatbitfordouble.‰PAGESTAG35ƒEQU†*”Labelforbranch.4STAG40ƒEQU†CONFGBLK+IOSPSM†Readcurrentrecordsize.‰MOVE.WƒSTAG40(A1),D0ˆGetit.$‰MOVEQ„#0,D1Clearworkingregister.3STAG45ƒSUB.W„#128,D0ŽSubtractoutmin.recordsize.-‰BEQ.S„STAG50SizefoundwhenD0equalszero.‰ADD.B„#1,D1Incrementcounter.‰BRA†STAG45Andtryagain.-STAG50ƒLSL.B„#3,D1Positionsectorsizecode.‰OR.B…D1,D4Setthosebits. &‰BCLR…#CDM,D4ŽClearno-DMAbitalways.+‰BSET…#CIE,D4ŽSetcommandinterruptenable. 0‰MOVE.BƒD4,CTRLCODE(A1)†Setupthecontrolcode. 7‰MOVEM.L‚(A7)+,D0/D1/D4‡Restoreregistersthatweused.‰RTS‰PAGEN********************************************************************************ˆCHK_FLOPPYROUTINE*C*ˆThisisa‚devicedependent‚routinewhose‚offsetmust‚beinstalledD*ˆatthebeginningofthedriver.The‚functionof‚thisroutine‚istoF*ˆcheckthatthebytespersector,‚sectorspertrack,anddata-densityG*ˆdensityvaluesareconsistentwitheachother.Thisroutineiscalled?*ˆafterthe‚user's‚configuration‚block‚has‚been‚filled‚with‚theG*ˆproposedconfiguration.Therefore,A0pointstotheendoftheuser's*ˆconfigurationblock.*0*ˆEntry:A0=endofuser'sconfigurationblock.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567 *™D†***ƒ***™A‚Pƒ** *ˆCalls:none*/*ˆExit:‚RTStocallerwithconditioncodesset:-*noerrorsinthisconfigurationcheck.*anerrorwasfound.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N*******************************************************************************/*‚TablesusedtocheckthefloppyconfigurationJ*‚TheRWINandSASIcontrollersagreeontheirvaluesfor128bytesectorsN*‚and256bytesector.Howeverthereisadifferenceonthe1024bytesectors,E*‚andadifferenceinwhatissupportedbythedifferentcontrollers.J*‚Fornow,withonly128or256bytessectors,thereisnodifference,and*‚wecanusethesametables.**$*ƒBYTESPERSECTOR--SINGLEDENSITY*-BPS_S„DC.W†128Š128bytes,singledatadensity,‰DC.W†0Œwedonotsupport256singledensity,‰DC.W†0Œwedonotsupport512singledensity-‰DC.W†0Œwedonotsupport1024singledensity*$*ƒBYTESPERSECTOR--DOUBLEDENSITY*5BPS_D„DC.W†0ŒRWINdoesnotsupport128doubledensity(‰DC.W†256Š256bytes,doubledatadensity,‰DC.W†0Œwedonotsupport512doubledensity-‰DC.W†0Œwedonotsupport1024doubledensity‰PAGEƒTHEN.SŒIfdoubledensity,movepntrto*ŽADDQ.Lƒ#BPS_DENS,A2„doubledensitytable.‰ENDI***6‰MOVE.W„IOSPSM-IOSDRSV(A0),D6‰D6<---bytespersector 0‰MOVE.W#C_TBL_SZ-1,D7Searchformatchinbytes)BPS_LOOPCMP.Wƒ(A2)+,D6’persectortable.‰DBEQ„D7,BPS_LOOP.‰BNE.SƒRET“Ifnomatch,returnwithCCR=*'*‚Weareherebecausewefoundamatch.* BPS_FOUND4‰LEA‡SPT5_S(PC),A2‡A2<---‚pntrtosectorpertrack,#*¦5",singledensitytable.(SPT5_S)1‰BTSTW…#IOADDEN,D4‰Ifdoubledensity,pointA2to-‰IFƒƒTHEN.SŒsectorspertrack,5",double,ŽADDQ.Lƒ#SPT_DDEN,A2„densitytable.(SPT5_D)‰ENDI.‰BTSTW…#IOASIZE,D4‰If8"diskette,pointA2to0‰IFƒƒTHEN.SŒthesectorspertrack,8"table,4ŽADDQ.Lƒ#SPT_SIZE,A2„eithersingleordoubledensity*‰ENDIšasfixedupabove.(SPT8_DorSPT8_S)*D*ƒNowthatA2ispointingtothepropertableforsectorspertrack,G*ƒsetupD4topointtothebyteoffsetofourentryfromthebeginning=*ƒofthepropertable,andlet'scheckthesectorspertrack.*‰MOVE.W„#C_TBL_SZ-1,D3 ‰SUB.W…D7,D37‰MOVE.B„IOSSPT-IOSDRSV(A0),D2‰D2<---sectorspertrack‰CMP.B…0(A2,D3.W),D2ARET†MOVEM.Lƒ(A7)+,D2/D3/D4/D6/D7/A2ƒReturnwithCCR=ifmatch‰RTS›foundandotherwise.‰PAGEN******************************************************************************* *ˆCHK_LSN*C*ˆThisisadevicedependentroutinewhoseoffsetmust‚be‚installedD*ˆatthebeginningofthe‚driver.ThefunctionofthisroutineistoC*ˆcheckthat‚therequestedstartinglogical‚sectornumber(inD2.L)E*ˆislessthanorsameasthelargestlogicalsectornumbersupported$*ˆbytheparticulardiskcontroller.**-*ˆEntry:D2=startinglogicalsectornumber.* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D†P*™A* *ˆCalls:none*/*ˆExit:‚RTStocallerwithconditioncodesset:3*=startinglogicalsectornumberisinvalid.1*=startinglogicalsectornumberisvalid.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** CHK_LSN: :‰CMP.L„#LSNMASK+1,D2ŠSincethefirstlogicalsectoronthe)*¦diskislogicalsectorzero,thenumber(*¦ofthelastlogicalsectoronthedisk&*¦isD2-1.‚Ifthisnumberistoolarge)*¦tofitundertheLSNmask,somethingis'*¦wrong.‚Wecan'thavealogicalsector(*¦numberthatislargerthanthelargest(*¦sectornumberthattheRWINcontroller *¦supports.‰RTS‰PAGEN******************************************************************************* *ˆBLD_PACKET*C*ˆThisisadevice-dependentroutinewhose‚offsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoC*ˆbuildany orall‚partsofthecommandpacketthatcanbebuiltat=*ˆinterrupt‚level0‚which‚willbe‚used‚bythe‚particular‚disk,*ˆcontrollertoprocessthecurrentcommand.*A*ˆEntry:„A1=pointertoDrive'sVariableBlockinglobalmemory.#*’A5=physicaladdressoftheCCB.* *’Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™D*™A„P‡P* *ˆCalls:„none*/*ˆExit:‚RTStocallerwithconditioncodesset:3*‚Noerrorswerefoundinbuildingthepacket.4*‚Anerrorwasdetectedinbuildingthepacket.4*•D1.B=VERSAdoserrorcodefortheerrordetected.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N****************************************************************************** *F*‚ThisfunctionisnotrequiredbytheRWINdriver.‚Thecommandpacket8*‚isbuiltwiththeinterruptsmaskedintheco-routine.* BLD_PACKET: ‰CMP.B…D0,D0‰RTS‰PAGEN******************************************************************************* *ˆDISK_START*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledE*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto:*.*Š1.‚Setupthedevice-dependentfieldsinthe*Ždrive'svariableblock.-*Š2.‚Setupforcommandqueueingifrequired./*Š3.‚Ifthedriveisnotbusy,tellthecommand*Žtothecontroller.**D*ˆEntry:A1=addressofthedrivesvariableblockinglobalmemory.#*A5=physicaladdressoftheCCB.*=*Interruptlevelonentryisatourhardwarelevel(masked).*!*ˆRegisterusage:…01234567*™D‚* *™A‚*P‡P**ˆCalls:RWININT**ˆExit:‚RTStocaller.*N******************************************************************************  DISK_START: ‰PUSH…SR/‰MOVEM.L‚D0/A0,-(A7)ŠSaveanyregistersweuse. 6‰LEA†IOQCNT(A5),A0ŠPutthepointertothedrive'sarea1‰MOVE.Wƒ(A0),D0Žofmemoryintothenextavailable;EQ670„EQU†IOQUEUE-IOQCNT‡queueentry,andadvancethequeue=‰MOVE.LƒA1,EQ670(A0,D0.W)„pointer.‚Wedon'tneedtocheckfor2‰ADD.W„#4,(A0)Žqueueoverflowbecausewecannever&*¦accumulatemorethanonequeueentry'*¦foreachdrive.‚Wealsodon'tneedto(*¦checkforqueuewrap-aroundbecausewe'*¦physicallymovequeueentriesinstead&*¦ofusingwrap-aroundqueuepointers. -‰TST.W„D0•Ifthequeuewasn'temptybeforewe1‰BNE.S„L0410madethelatestentry,theinterrupt$*¦handlerisalreadyactiveandwill)*¦eventuallycompletetheI/Otransaction'*¦thatwe'vejustspecified.‚Otherwise,#*¦weneedtoactivatetheinterrupt *¦handler.‰PAGE8‰LEA†PROCQUE(PC),A0‰Setuptheco-routineswitchpointer@‰MOVE.LƒA0,INTSWTCH(A5)†tostartprocessingnewI/Oqueueentry.:‰MOVE.LƒCCBCHB(A5),A0ˆA0<--RWINmemory-mappedI/Ospace. ,‰BSR†RWININTŽTellcommandtothecontroller.*C*ƒNowwehavestartedofftheI/OandarereadytoreturntoCMRto(*ƒbeawakenedwhenaninterruptarrives.* 9L0410„MOVEM.L‚(A7)+,D0/A0ŠRestoreregistersthatweused.‰POP‡SR‰RTS‰SPC‡2‰PAGEN********************************************************************************ˆCHK_PARAMROUTINE*C*ˆThisisa‚devicedependent‚routinewhose‚offsetmust‚beinstalledD*ˆatthebeginningofthedriver.The‚functionof‚thisroutine‚istoB*ˆvalidate‚any‚device‚dependent‚parameters.‚Thisroutineiscalled?*ˆafterthe‚user's‚configuration‚block‚has‚been‚filled‚with‚theG*ˆproposedconfiguration.Therefore,A0pointstotheendoftheuser's*ˆconfigurationblock.*/*ˆEntry:A0=endofuser'sconfigurationblock* *Interruptlevelonentryis0.*!*ˆRegisterusage:…01234567*™DˆR*™A‚P* *ˆCalls:none*$*ˆExit:‚RTSbacktocallingroutine.>*CONDITIONCODES:noerrorsinthisconfigurationcheck.* anerrorwasfound./*D3.B=Returnederrorcodeiferrorisfound.*F*ˆTheinterruptleveluponexitmustbethesameasitwasuponentry.*N******************************** ********************************************** CHK_PARAM: ‰CMP.B…D0,D0Setconditioncodes ‰RTS›Return.N******************************************************************************* *‰ENDROUTINESCALLEDBYDISKLIB*N******************************************************************************ŠPAGEN********************************************************************************‰FINISHOFFTHEINITIALIZATION*2*‰Theseotherdevice-dependentthingsMUSTbedone>*‰beforewecanhandlecommands.‚Theyprobablycouldhavebeen?*‰doneinINITatthestartofthedriverbutarehandledhere.**‰1.‚Readstatusofself-test.*‰2.‚TestofFIFO.**‰Entry:A5=addressofCCB.**‰Registersmaybeusedfreely.* *‰Calls:none*N****************************************************************************** DO_INIT: *(*‚ReadstatusofselftestandtestFIFO*8‰MOVE.LƒCCBCHB(A5),A0ˆA0<=channel'smemorymappedI/O.;‰BTST…#BITCB,FLAGS(A0)…Testthereadregisterfornotbusy.5‰BEQ.S„FIPASSDon'tresetortestbufferifnotbusy.,‰MOVE.Bƒ#0,RWINRST(A0)‡Resetthecontroller.CWINI10ƒBTST…#BITCB,FLAGS(A0)…Pollthereadregisterfornotbusy...,‰BNE†WINI10...toindicateendofself-test.1‰BTST…#BITFAULT,FLAGS(A0)‚Testthepass/failbit.!‰BEQ.S„WINI20Continueifpassed..‰SNE.B„CHANDOWN(A5)‰Setthechanneldownflag.‰RTS›ReturntoCMR. !WINI20ƒMOVE.W„#4095,D1Œ4Kbuffer.AFIWRITE‚MOVE.B„D1,DATA0(A0)ˆMovedatabytebybytetothebuffer.‰DBRA†D1,FIWRITEŠ*‰MOVE.W„#4095,D1ŒRestart.BFIREADƒCMP.B…DATA0(A0),D1ˆComparedatabytebybyteinthebuffer.&‰BNE.S…FIERRORBranchuponerroronly.‰DBRA†D1,FIREAD‹*‰BRA.S…FIPASSŽDoneifpassed.5FIERROR‚SNE.B…CHANDOWN(A5)ˆSetthechanneldownflag.FIPASSƒRTS›ReturntoCMR *********************** *‚PATCHSPACE***********************ŠDS.Wƒ30ŠENDNNNNNNN?SCCDRV„IDNTƒ45,0…VERSAdosZ8530terminaldriverwithtype-ahead;ŠTTL„SCCDRV:‚VERSAdosZ8530terminaldriverwithtype-ahead ŠLLENƒ120J**************************************************************************J**************************************  ************************************J**************************************************************************J***************************************************************************9*‰SCCDRV:‚VERSAdosZ8530terminaldriverwithtype-ahead.*8*‰Purpose:‚VERSAdosdevicedrivertohandleasynchronous0*“terminals(ofanytype)overtheZ8530chipon *“theMVME117orMVME133boards.**‰Revisionhistory:*>*02/26/86‚ModifiedtoworkwiththeVME117'sandtheVME133's2*šthatbringRTS,pin4attheRS232connector(to3*šterminal),toCTSatthechip.‚Nolongersupports*štheoldmethod.*2*01/29/86‚ChangedtoworkwiththeVME133byBAW.*7*12/10/85‚InstallNEWKillermodificationwhichleaves,*šTheDriverID(Number)andReason(Number)2*šinCRASHSAValongwiththeCCBandDCBpointers.*'*03/15/85‚InitialreleasebyMikeDuh.*J**************************************************************************J**************************************************************************NN÷IY#D F(E0@88@6H:P<X:`=hAp@xJ€:ˆ 9˜@ ;¨°<¸ À:È@Ð@Ø&J**************************************************************************J**************************************************************************‰PAGE**‚XREF'sfromTERMLIB* ‰XREF†LOG_ERR‰XREF†MARK_DOWN ‰XREF†RESET‰XREF†TERM_BREAK‰XREF†TERM_COMMAND‰XREF†TERM_GOT_CHAR‰XREF†TERM_INIT‰XREF†TERM_TBE***†XREF†TERM_UNRDYŠNotused. **‚Equatefilesincluded:* *‰STR.EQ*‰TCB.EQ*‰CCB.EQ*‰IOE.EQ*‰NIO.EQ*‰LV5.EQ1*‰BAB.EQBackgroundActivationBlockdescription.:*‰TERMCCB.EQ‰OffsetsandequatesforCCBDDPforterminals.$*‰TERMINAL.EQˆEquatesforterminals.*‰UTILITY.MC‰Macros. *‰KILL.MC *‰KILLDRV.EQ*ŠPAGE**‚MACRO'Sused:* *N*‚OUT_SCC-OutputabytefromadataregistertoaregisterontheZ8530SCC.C*ŒItisrequiredtowritethedesiredSCCregisteraddresstoWrite<*ŒRegister0ontheZ8530first,thenwritethedatatoWR0.5*ŒFormat:‚[