IMD 1.17: 11/11/2014 10:55:00 82VKXSVRDOS B* VERSADOS/RMS68K SRC/OBJ 4.4 (NOT BOOTABLE) SN=49367 7 OF 30  SR07q82VKXSVRDOS 0420¥n-h:p<xD€>ˆ;9˜G E¨<°A¸FÀ  C*‚TheRockwell68560ProtocolCommunicationsController(MPCC)isaK* single channel communications device capable of full duplex, asynchronousI* or synchronous protocol. The register offsets for this device are shownE* below followed by the bit and field definitions used to program the&* R68560 for operation on the MVME050.*BMPC_DEV1‚EQU$FF1001ˆBaseaddressoftheserialport1onMVME050.BMPC_DEV2‚EQU$FF1041ˆBaseaddressoftheserialport2onMVME050.$*œAllregistershaveoddaddressess.O*------------------------------------------------------------------------------&MPC_RSRƒEQU‚0ReceiverStatusRegister'MPC_RCRƒEQU‚2ReceiverControlRegister$MPC_RDRƒEQU‚4ReceiverDataRegister8MPC_RIVN‚EQU‚8ReceiverInterruptVectorNumberRegister2MPC_RIER‚EQU‚10ŒReceiverInterruptEnableRegisterO*------------------------------------------------------------------------------*MPC_TSRƒEQU‚16ŒTransmitterStatusRegister+MPC_TCRƒEQU‚18ŒTransmitterControlRegister(MPC_TDRƒEQU‚20ŒTranmistterDataRegister*ƒfortheMPCCdriver.‚CMRautomaticallyallocatesonepageofA*ƒmemory($100bytes)fortheCCB,andourvariableEXTCCBSZwillB*ƒresideintheCMRparametertableatthebeginningofthedriver8*ƒtotellCMRhowmanyextrapagesofmemoryareneeded.**CCBSIZEBEQU‡*PAGESIZEEQU‡$100L1‡SET‡CCBSIZEB+PAGESIZE-1CCBSIZE‚EQU‡L1/PAGESIZEEXTCCBSZEQU‡CCBSIZE-1ŠPAGEJ***************************************************************************+*‰SERVICEVECTORTABLE,REVISIONINFO,ETC.*@*‰ThistableisexaminedbyCMRwhenthechannelisallocatedtoC*‰determinewheretogoforinterrupts,commands,&initialization.<*‰Itmustalwaysbeattheverytopofthedrivercode.‚Also>*‰includedisaparametertellingthenumberofextrapagesof >*‰memorytoincludeintheCCB,andinformationdescribingthe*‰revisionofthedriver.*L**************************************************************************** ŠSECTION‚0ŠOPT„BRS MPCCDRV: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!*=ŠDC.LƒINTERRUPT-MPCCDRV‚Addressofinterruptserviceroutine.9ŠDC.LƒCOMMAND-MPCCDRV„Addressofcommandserviceroutine.5ŠDC.LƒINIT-MPCCDRV‡Addressofinitializationroutine.ŠDC.Lƒ0’Reserved. **‚OtherCMRparameters.*7ŠDC.BƒEXTCCBSZ‹#ofextrapagesintheCCB.‚TheCCBmay)*§beanysizefrom1to256pages(apage'*§is256bytes):‚ifthisfieldis0,it*§willbe1page,etc.ŠDC.Bƒ0,0,0ŽReserved.ŠDC.Lƒ0,0,0ŽReserved. **‚Revisioninfo:*/ŠDC.Bƒ'102384'‹DateoflastassemblyasMMDDYY.1ŠDC.Bƒ''Spaceindicatesnopatchesto.LOfile.)ŠDC.Bƒ'4'MajorVERSAdosrevisionnumber.*‰PAGEO********************************************************************************;*ˆJumptableforusebythegenericterminaldriverTERMLIB*O******************************************************************************* ‰BRA.L…PUT_CHAR ‰BRA.L…CK_TBE‰BRA.L…DDP_RESET ‰BRA.L…SETUP‰BRA.L…CLOCK_RESET‰BRA.L…GET_STAT‰BRA.L…DDP_STOP‰BRA.L…DDP_UNSTOP‰BRA.L…DDP_BEG_BREAK‰BRA.L…DDP_END_BREAK‰PAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INITIALIZATIONROUTINE*>*‰ThisroutineiscalledbyCMRwhenthechannelisallocated.9*‰Itspurposeistosetupthingsforcommandserviceand7*‰interruptservice.‚Themajorfunctionsperformedare:*9*Š1.Determineifthesecondserialportispresent(some8*Žversionsofboardmayhavejustoneport)andmarkthe*Žchanneldownifitsabsent.?*Š2.Device-IndependentinitializationinthecalltoTERM_INIT"*toinitializetheCCBvariables.9*Š3.Device-Dependentinitializationinacallguardedto#*DO_INITtoinitializethedevice.*@*‰WegotherethroughaJSRfromCMR,andwillexitwithanRTS.>*‰AllregistershavebeensavedbyCMRandmaybeusedfreely.?*‰Entryisatinterruptlevel0,andweareinsupervisormode.**‰Entry:‚A5=addressofCCB.*:*‰Calls:‚TERM_INITinthegenericterminaldriverTERMLIB./*‘MARK_DOWNinTERMLIBifPort2doesn'texist.*#*‰Exit:ƒCMR(viaRTS)ifallisOK.'*‘KILLERifexecwon'tallocatememory,.*’orcan'tgetbackgroundroutineentrypoint.*J**************************************************************************J**************************************************************************J**************************************************************************ŠDS…0 ŠPAGEINIT:***‚Checkforthepresenceofserialport2.*2ŠMOVE.LCCBCHB(A5),A0†Gettheaddressofourport.BŠCMP.B‚#$FF,MPC_PSR1(A0)‚Thisvalue/locationguaranteedifabsent.:ŠBEQ.S‚NO_PORT2‹BranchoutofINITbecauseportnotthere.*>*‚Performthedevice-independentinitializationbycallingthe'*‚genericroutineTERM_INITinTERMLIB.*.‰JSR‡TERM_INIT‹Dothedevice-independentstuff2‰IFƒƒTHEN…SomethingwentwrongwithTERM_INIT.4‰IFƒƒTHEN„Theexeccallfailedandwecannotget!*œthescheduler'sentrypoint!!!ŽTR0$.KILLER‚,‰ELSERTSThechannelisdown!!‰ENDI‰ENDI*;*‚Performtheminimumdevice-deoendentinitializationusing@*‚callguardedtotheEXECforaroutineresidentinbackground.*5‰LEA‡DO_INIT(PC),A0†Device-dependentroutineaddress.-‰MOVE.L„#T0GUARD,D0‰CallguardedtotheEXEC.‰TRAP†#0‰RTS 1NO_PORT2JSR‡MARK_DOWN‹Setthechanneldownflag.‰RTS‰PAGEJ**************************************************************************J************************************************************************** J****************************************************************************‰COMMANDSERVICEROUTINE*>*‰Wegetenteredherewhentheattachedtask(IOS)invokesCMR?*‰viaaTRAP1withanINITIATEI/Oparameterblocktoprocess.>*‰CMRhasalreadycheckedtheCMRparameterblocktoensureit<*‰resideswithintheaddressspaceoftheattachedtask.‚IOSA*‰hasalreadyvalidatedtheIOCB,exceptforthebufferaddresses *‰therein.*@*‰WegotherethroughaJSRfromCMR,andwillexitwithanRTS.>*‰AllregistershavebeensavedbyCMRandmaybeusedfreely.?*‰Entryisatinterruptlevel0,andweareinsupervisormode.*5*‰Entry:A2=physicaladdressofCMRparameterblock*A5=physicaladdressofCCB*9*‰Calls:TERM_COMMANDingenericterminaldriverTERMLIB.*3*‰Exit:‚D0=resultsofparameterblockvalidation:3*•always0inourcase,indicatingitwasOK,since2*•IOSwillnotsendusanyrequestexceptHALTI/O/*•ifwearealreadybusy,andCMRmakesallthe*•otherchecks.**J**************************************************************************J**************************************************************************J************************************************************************** COMMAND: *,*‚Performanydevice-dependentstuffhere...* *=*‚Wehavereceivedacommand,soweknowthereissomeoneoutI*‚theretotalkto.‚Iftheguywhoreportsbreaksisasleep,wakehimup.* %ŠJSR…TERM_COMMAND†PerformthecommandŠRTS—returntoCMR.ŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INTERRUPTHANDLINGROUTINE*<*‰ThisroutinecompletesI/Orequestsstartedbythecommand:*‰serviceroutine.‚Itisenteredattheinterruptpriority;*‰levelofinterruptsonthischannel,andisessentiallya9*‰subroutinetothefirstlevelinterrupthandlerinCMR.*:*‰Entry:D0,A0,A1havebeensavedbyCMRandareavailable*A5=addressofCCB*9*‰ExitisalwaysviaRTS,whichtakesusbacktoCMR.‚The3*carrybitisexaminedbyCMRtodeterminewhether7*thedriverhandledtheinterruptorwhetheritshould4*passtheinterruptontothenextguyinthechain*onthatvector:*='Ihandledit'**‰Stack:*(A7)+8... *(A7)+4longwordreturnaddress6*(A7)ƒlongwordsavedcontentsofD1(mustberestored*—beforeexittoCMR)*J**************************************************************************J**************************************************************************J************************************************************************** INTERRUPT: $* Clear the interrupt at the BIM #1: 5ŠMOVE.BCCBTYPE(A5),D0‰GetourchanneltypefromCCB.(ŠCMP.B#XTMPC1,D0ŽAreweserialport#1? ŠIFTHEN’Ifwe'reno.1....<‹MOVE.B#BIM_SET,BIM_CTL0…Setcontrolregister0oftheBIM.ŠELSEšIfwe'reno.2....<‹MOVE.B#BIM_SET,BIM_CTL1…Setcontrolregister1oftheBIM.ŠENDI 3ŠMOVE.LCCBCHB(A5),A1†A1<--addressofourdevice. "ŠPUSH.LD1‘Getsomeworkingspace.7ŠMOVE.BMPC_RSR(A1),D1…Copyofreceivestatusregister.ŠMOVE.BMPC_RIER(A1),D0*ŠAND.B‚D0,D1ŽHavewereceivedacharacter?+ŠBEQ.S‚INT10ŽNocharacterreceivedifzero.5ŠAND.B‚#$1E,D1ŒGetridofallbitsexcepterrorbits.*ŠBNE.S‚INTERRBranchtoprocesstheerror.1ŠBRA.S‚RCANoerror,branchtoprocesscharacter. PAGE @INT10…MOVE.BMPC_TSR(A1),D1…Copyoftransmitterstatusregister.ŠMOVE.BMPC_TIER(A1),D0*ŠAND.B‚D0,D1ŽIsourtransmitbufferempty?1ŠBNE.S‚TBEBranchtoprocessemptybufferifyes. 7ŠMOVE.BMPC_SISR(A1),D1„Copyofserialstatusregister.ŠMOVE.BMPC_SIER(A1),D0 ŠAND.B‚D0,D17ŠBNE.S‚ESCIfthenprocessexternalstatuschange.+ŠPOP.L‚D1‘Ifwegethere,mustnotbemine. NOT_FOR_ME ŠMOVEQ‚#0,D0 ŠADDQƒ#1,D0ŠRTSŠPAGE J***************************************************************************)*‰TRANSMITBUFFEREMPTYINTERRUPTHANDLER*?*‰TheR68560'stransmitbufferjustbecameempty,soifwehave+*‰morecharacterstosendwecandoitnow.*$*‰Entry:A1=addressofourdevice.*A5=addressofCCB.-*D1.B=copyoftransmitterstatusregister.*9*‰Calls:TERM_TBEinthegenericterminaldriverTERMLIB.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*O******************************************************************************* TBE:<ŠMOVE.B#0<*‰Calls:TREM_PUT_CHARinthegenericterminaldriverTERMLIB.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** RCA:4ŠMOVE.BMPC_RDR(A1),D0‡GetthecharfromtheR68560.*ŠMOVE.B#$FF,MPC_RSR(A1)…Clearthestatus.5ŠJSR„TERM_GOT_CHARˆDothedevice-independentstuff...)ŠBRA.S‚INT_EXITExitfromthisinterrupt.ŠPAGEJ***************************************************************************!*‰DETECTEDEXTERNALSTATUSCHANGE*?*‰TheR68560detectedachangeinstatusontheDCDinputline.8*‰Weneedtoactivatethesendeventbackgroundroutine.*$*‰Entry:A1=addressofourdevice.*A5=addressofCCB(*D1.B=copyofserialstatusregister.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** ESC:=‰BSET#DCDX,MPC_SISR(A1)ˆClearandtesttheDCDstatusbit...3‰IFƒTHENIfitsset,thenseeifwehandleit.>ŠBTSTW‚#IOADCD,CONFIG+IOSATW(A5)‚Iftheattributeswordinthe4ŠIF…THENŠconfigurationsayswe'rereportingDCD3‹BKGRNDBREAKHandleaDCDtransitionwithaBREAK.ŠENDI‰ENDI ‰BRA.SINT_EXIT‰PAGEJ***************************************************************************#*‰FOUNDERRORONRECEIVEDCHARACTER*<*‰TheR68560detectedanerrorintheprocessofreceivinga<*‰character.‚Weneedtorecordthisinformationsothatwhen<*‰thecorrespondingdataisrequestedfromthereceivequeue*‰wecanreportanerror.*$*‰Entry:A1=addressofourdevice.*A5=addressofCCB2*D1.B=copyofreceiverstatusregister,showing*—errorbitsonly!*8*‰Calls:LOG_ERRinthegenericterminaldriverTERMLIB.4*TERM_BREAKinthegenericterminaldriverTERMLIB.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** INTERR:.ŠMOVE.BMPC_RDR(A1),D0ˆReadthedataregister.*ŠMOVE.B#$FF,MPC_RSR(A1)†Clearthestatus. 'ŠBTST‚#BRK,D1Havewereceivedabreak?1ŠIF„THENŽIfthereceivedbreakbitisset...!‹BRA.S‚PROCBRKŽProcessthebreak!ŠENDI /ŠBTSTƒ#OE,D1Perhapsthiswasanoverrunerror.0ŠIF…THENIftheoverrunerrorbitisset.../‹PUT_BYTEOVERRUN,D0‰Getthepropererrorcode.‹JSR„LOG_ERRŽLogtheerror.+‹BRA„INT_EXITAndexitfromthisinterrupt.ŠENDI &ŠBTST„#PE,D1Howaboutaparityerror?/ŠIF†THENŒIftheparityerrorbitisset...0‹PUT_BYTEPAR_FRAM,D0ˆGetthepropererrorcode.‹JSR„LOG_ERRŽLogtheerror. *‹BRA„INT_EXITAndexitfromtheinterrupt.ŠENDI )ŠBTST„#FE,D1Lastcallforframingerror.0ŠIF†THENŒIftheframingerrorbitisset...0‹PUT_BYTEPAR_FRAM,D0ˆGetthepropererrorcode.‹JSR„LOG_ERRŽLogtheerror.*‹BRA„INT_EXITAndexitfromtheinterrupt.ŠENDI *ŠBRA„INT_EXITŽJustincasewegethere....ŠPAGE DPROCBRKƒMOVE.B#1<=transmitbuffernotempty*=transmitbufferempty*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*M***************************************************************************** CK_TBE:>ŠBTST.B#TD,MPC_TSR(A1)ˆTesttransmitbufferemptybitinTSR.*ŠRTS›Mustreturnwithconditioncodesset.ŠPAGEH************************************************************************* *ˆDEVICEDEPENDENTRESETROUTINE*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoB*ˆperformaminimumresetofthedevice.FortheR68560thismeans6*ˆclearinganyerrorstatusandenablingthereceiver.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.**ˆEntry:A5=addressofCCB**Interruptlevelonentryis0**ˆExit:‚RTStocaller*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*E*********************************************************************  DDP_RESET: 3ŠMOVEM.LA1,-(A7)ŽSaveusedregistersonthestack..ŠMOVE.LCCBCHB(A5),A1ŠA1<--addrofourport.9ŠMOVE.B#$FF,MPC_RSR(A1)‡Clearanyreceivererrorstatus.<ŠMOVE.B#$FF,MPC_TSR(A1)‡Clearanytransmittererrorstatus.2ŠMOVE.B#1<*ˆontheMVME050board.‚Thistableallowsustoconvertfroma@*ˆVERSAdosbaudratecodetothebaudratedivider(LSHandMSH)C*ˆandclockcontrolcodeweneedtowritetotheon-boardregisters*ˆoftheR68560.*,*ˆThetablecontains4parametersperentry:7*Œ1stentryistheleastsiginificanthalf(LSH)ofthe.*’baudratedividertobewrittentoMPC_BRD1.5*Œ2ndentryisthemostsignificanthalf(MSH)ofthe.*’baudratedividertobewrittemtoMPC_BRD2.5*Œ3rdentryistheclockcontrolregistervaluetobe*’writtentoMPC_CCR4*Œ4thentryisundefinedatthistime-settozero.*8*ˆNotalloftheVERSAdosbaudratecodesaresupported.;*ˆThegenericterminaldriverTERMLIBdoesacheckonvalid@*ˆbaudratesforaspecificchannelsoweshouldneverbepassed9*ˆanunsupportedbaudratecode.‚Justincase,wesetthe#*ˆunsupportedentriesto9600baud.*O******************************************************************************* BAUD_ASYNC‰DC.B‚0,$1D,$68,$2B‡50‰DC.B‚0,$0D,$68,$2B‡75‰DC.B‚0,$1D,$2F,$59‡110‰DC.B‚0,$0D,$39,$DF‡134.5‰DC.B‚0,$1D,$22,$B9‡150‰DC.B‚0,$0D,$1A,$0B‡3009‰DC.B‚0,$1D,$00,$8B‡600„****notsupported-default9600‰DC.B‚0,$1D,$04,$57‡1200‰DC.B‚0,$0D,$04,$57‡1800:‰DC.B‚0,$1D,$00,$8B‡2000ƒ****notsupported-default9600‰DC.B‚0,$0D,$03,$41‡2400‰DC.B‚0,$0D,$02,$2C‡3600‰DC.B‚0,$1D,$01,$16‡4800‰DC.B‚0,$0D,$01,$16‡7200‰DC.B‚0,$1D,$00,$8B‡9600‰DC.B‚0,$0D,$00,$68‡19200‰DC.B‚0,$0D,$00,$34‡38400PASSTBL‚DS.W‚0 PAGE*+*ˆSetProtocolSelectRegister2‚(MPC_PSR2)/*Œstartwithbytemode[7]andasyncmode[2:0]*ŠPUT_BYTEBYTE+ASYNC,D0  * Word length control [4:3]:ŠBTSTW#IOABITS,IOSATW(A0)…Addinbitspercharacterinfo. ŠIF„THEN ‹OR.B#BIT7,D07bits/character.ŠELSE ‹OR.B#BIT8,D08bits/character.ŠENDI * Stop Bit Length [6:5]:ŠBTSTW#IOASTPB,IOSATW(A0)…Addinthenumberofstopbits. ŠIF„THEN‹OR.B#SB1,D0‘1stopbit.ŠELSE‹OR.B#SB2,D0‘2stopbits.ŠENDI ,ŠMOVE.BD0,MPC_PSR2(A1)‡Tellittothechip. *&*ˆSetErrorControlRegister(MPC_ECR)%*Œstartwithnoparity,noCRCchecks*ŠMOVEQ.L#0,D0 * Parity Mode [7:6]3ŠBTSTW#IOAUSEP,IOSATW(A0)…Ifwe'reusingparity... ŠIF„THEN(‹OR.B#PARENAB,D0Setenableparitybit.0‹BTSTW#IOAPRTY,IOSATW(A0)„Ifitsevenparity... ‹IF„THEN&ŒOR.B#PAREVEN,D0ŒSetevenparitybit.‹ENDIŠENDI +ŠMOVE.BD0,MPC_ECR(A1)ŠTellittothechip. PAGE**ˆSetupforinterrupts.* #* Set the interrupt vector numbers.6ŠMOVE.BCCBVECT(A5),D0‰GetthevectornumberfromCCB.7ŠMOVE.BD0,MPC_RIVN(A1)ˆSetvectornumberforreceiver.:ŠMOVE.BD0,MPC_TIVN(A1)ˆSetvectornumberfortransmitter.5ŠMOVE.BD0,MPC_SIVN(A1)ˆSetvectornumberforserial.&*§CMRforcesustousesameforall3. * Program the BIM #15ŠMOVE.BCCBTYPE(A5),D0‰GetourchanneltypefromCCB.(ŠCMP.B#XTMPC1,D0ŽAreweserialport#1? ŠIFTHEN’Ifwe'reno.1....<‹MOVE.B#BIM_SET,BIM_CTL0…Setcontrolregister0oftheBIM.ŠELSEšIfwe'reno.2....<‹MOVE.B#BIM_SET,BIM_CTL1…Setcontrolregister1oftheBIM.ŠENDI**ˆCleartheFIFO*/ŠMOVEQ‚#7,D0’ThereareeightbytesintheFIFO..CLRFIFOƒMOVE.BMPC_RDR(A1),D1‰Readthemout....ŠDBRAƒD0,CLRFIFODecrement...untildone...then9ŠMOVE.B#$FF,MPC_RSR(A1)‡Resetanyreceivererrorstatus.**ˆNowsetourdeviceasready.*/ŠMOVE.B‚#READY,MPC_SICR(A1)„AssertDTRandRTS./ŠMOVE.B‚#0<THEN*6ŠMOVE.B#UNREADY,MPC_SICR(A1)makeourport'unready'.ŠENDI 2* Enable those interrupts we'd like to know about.6ŠMOVE.B#INTR,MPC_RIER(A1)…Enablereceiverinterrupts.4ŠMOVE.B#INTS,MPC_SIER(A1)…Enableserialinterrupts. **ˆRestoreregistersandreturn.*ŠMOVEM.Lƒ(A7)+,D0/D1/A0/A1ŠRTSŠPAGEO*********************************************************************************ˆRESETTHECLOCK*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto3*ˆchangetheclockspeedbacktoitsdefaultvalue.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.**ˆEntry:A5=addressofCCB*A1=addressofourport**Interruptlevelonentryis0**ˆExit:‚RTStocaller*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*O******************************************************************************* CLOCK_RESET:*A*ƒThisfunctionalityisnotsupportedbytheR68560ontheVME050*ŠRTSŠPAGEJ****************************************************************************ˆGETDEVICESTATUSBYTE*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoA*ˆpreparestheDEVICESTATUSbytewhichcontainstheconditionof6*ˆtheCTSline(whichindicatesdeviceready/unready).*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*8*ˆNote:‚Thisroutinedoesnotsetthebreakindicatorin*thedevicestatusbyte.**ˆEntry:A5=addressofCCB**Interruptlevelonentryis0*!*ˆExit:‚D0.B=DeviceStatusbyte*RTStocaller*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.* J************************************************************************** GET_STAT:,ŠMOVEM.LD1/A1,-(A7)‹Saveworkingregisters.'ŠCLR.LƒD0”Devicestatustobereturned..ŠMOVE.L‚CCBCHB(A5),A1‰A1<--addrofourport.<ŠMOVE.B‚MPC_SISR(A1),D1‡D1<--statusofVME050inputlines.#ŠBTST„#CTSL,D1ŽTesttheCTSline.../ŠIF†THENIfCTSislow,deviceisunready.0‹BSET#XDSNRB,D0ŽSetunreadybitinstatusbyte.ŠENDI/ŠMOVEM.L(A7)+,D1/A1‹Restoreworkingregisters.ŠRTSŠPAGEM*******************************************************************************ˆSTOPTHETRANSMITTINGDEVICE*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoA*ˆchangeahardwareoutputlinetomakeourdevicelook'unready''*ˆsothetransmittingdevicewillstop.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*+*ˆEntry:A1=addressofoursideofdevice*A5=addressofCCB*5*InterruptlevelonentryisINHIBITEDatourlevel.**ˆExit:‚RTStocaller*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*K*************************************************************************** DDP_STOP::ŠMOVE.B‚#UNREADY,MPC_SICR(A1)RaisetheRTSandDTRlines.ŠRTSŠPAGEK****************************************************************************$*ˆDEVICEDEPENDENTUNSTOPTHEDEVICE*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.ThefunctionofthisroutineistoC*ˆunstopthetransmittingdevicebychangingahardwareoutputline"*ˆtomakeourdevicelook'ready'.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*+*ˆEntry:A1=addressofoursideofdevice*A5=addressofCCB*5*InterruptlevelonentryisINHIBITEDatourlevel.**ˆExit:‚RTStocaller*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*J************************************************************************** DDP_UNSTOP:8ŠMOVE.B‚#READY,MPC_SICR(A1)ƒLowertheRTSandDTRlines.ŠRTSŠPAGEK****************************************************************************&*ˆDEVICEDEPENDENTBEGINBREAKROUTINE*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto@*ˆgiveacommandtostartsendingbreakconditiontoourdevice.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*+*ˆEntry:A1=addressofoursideofdevice*A5=addressofCCB*5*InterruptlevelonentryisINHIBITEDatourlevel.**ˆExit:‚RTStocaller*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*E*********************************************************************  DDP_BEG_BREAK:7ŠBSET.B#TI,MPC_TCR(A1)‡Giveantransmitbreakcommand.ŠRTSŠPAGEK****************************************************************************$*ˆDEVICEDEPENDENTENDBREAKROUTINE*C*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledD*ˆatthebeginningofthedriver.Thefunctionofthisroutineisto?*ˆgiveacommandtostopsendingbreakconditiontoourdevice.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*+*ˆEntry:A1=addressofoursideofdevice*A5=addressofCCB*5*InterruptlevelonentryisINHIBITEDatourlevel.**ˆExit:‚RTStocaller*0*ˆThisroutinemustpreserveallregistersused.0*ˆTheinterruptleveluponexitmustbethesame*ˆasitwasuponentry.*L**************************************************************************** DDP_END_BREAK:9ŠBCLR.B#TI,MPC_TCR(A1)‡Clearthetransmitbreakcommand.ŠRTS SPC 10 O******************************************************************************** *‰ENDROUTINESCALLEDBYTERMLIB*O*******************************************************************************ŠPAGEO*********************************************************************************“BACKGROUND**šAND**‘CALL__GUARDED**–ROUTINES**•(DEVICE-DEPENDENT)*O*******************************************************************************ŠPAGEO*********************************************************************************‰FINISHOFFTHEINITIALIZATION*A*‰TheinitializationroutinehasgonearoundresettingeverythingD*‰itcan,buttheroutinesRESETandDDP_RESETshouldonlybecalled>*‰fromwithinthebackground.‚Soheinvokedthisroutinetodo *‰itforhim.*?*‰Inaddition,theseotherdevice-dependentthingsMUSTbedone>*‰beforewecanhandlecommands.‚Theyprobablycouldhavebeen?*‰doneinINITatthestartofthedriverbutarehandledhere.*5*‰1.‚PutthestartaddressofthedriverintotheCCB*variableDRV_ADDR.>*‰2.‚Setupthedevice-dependentBABsusingthemacroSET_BAB.;*‰3.‚PuttheaddressoftheA-sideofadualchanneldevice6*intotheCCBvariableADRSIDEA.‚Ifnotdualchannel,**puttheaddressofPort1intoADRSIDEA.**‰Entry:A5=addressofCCB.*6*‰Calls:RESETinthegenericterminaldriverTERMLIB.*DDP_RESETinthisdriver.6*MARK_DOWNinthegenericterminaldriveriffailure.*O******************************************************************************* DO_INIT:**‚Inhibitinterrupts*‰PUSH†SR‰INHIBIT*)*‚GetaddressofstartofdriverintoCCB*ŠLEA‡MPCCDRV(PC),A4ŠMOVE.L„A4,DRV_ADDR(A5)*>*‚SetuptheaddressofA-sidewiththeaddressofourdevice.*@ŠMOVE.LCCBCHB(A5),ADRSIDEA(A5)‚MovedeviceaddressintoA-side. ŠJSR„RESETŽReseteverything.ŠBSR.L‚DDP_RESETŠPOP„SR ŠRTS 7FAIL†JSR„MARK_DOWNŠMarkthechanneldownusingTERMLIB.ŠPOP„SRŠRTSŠPAGE*********************** *‚PATCHSPACE***********************ŠDS.Wƒ30ŠEND  ééééééé =/*=/*†MPSCDRV.AF=/*6=/* Chain file to assemble NEC 7201 subordinate driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to MPSCDRV.LS=/*=/IFC \1ƒ=ARGMPSCDRV.LS=/ENDIF=/*$=ASM MPSCDRV.SA,MPSCDRV.RO,\1;RZ=150=/*{ Included files are:=/*ƒ9995.&.MVME400.EQ=/*ƒ9995.&.NEC7201.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.BAB.EQ=/*ƒ9995.&.TERMINAL.EQ=/*ƒ9995.&.UTILITY.MC=/*ƒ9995.&.TERMCCB.EQ=/*}=/*=ENDéééééÈ>MPSCDRVƒIDNTƒ4,1‡VERSADOS7201TERMINALDRIVERWITHTYPE-AHEAD;ŠTTL„MPSCDRV:‚VERSADOS7201TERMINALDRIVERWITHTYPE-AHEAD ŠLLENƒ120J**************************************************************************J**************************************************************************J**************************************************************************J***************************************************************************9*‰MPSCDRV:‚VERSAdos7201terminaldriverwithtype-ahead.*8*‰Purpose:‚VERSAdosdevicedrivertohandleasynchronous3*terminals(ofanytype)overtheNEC7201chipon*thefollowingboards:*’VM02‚VM03‚MVME400**‰Revisionhistory:*1*10/23/84‚AllBSR'stoTERMLIBnowJSR'sincase.*šTERMLIBislocatedmorethan32Kbytesaway.+*‘10/9/84‚AddedbaudratesupportforVM03.<*‘9/17/84‚RemovedreferencestoMENUandTR_MODEinMPSCDRV,*šputintoTERMLIB3*‘8/30/84‚FixedSPRconcerningSETUP.‚Commentedout(*šthecodethatteststhemodembit.‚Now**šiftheoffhookbitisset,theDTRline&*šissetlow,‚whetherornotthemodem *šbitisset.1*‘8/29/84‚MPSCDRVhasjumptableatbeginningfor*šusebyTERMLIB.0*‘6/6/84‚SplitMPSCDRVintoMPSCDRVandTERMLIB.*šMPSCDRVcontainsonlydevicedependentcode.)*‘8/9/83‚Fixedbuginoverrundetection.5*‘7/13/83‚Fixbugs:‚7bitchar'sintransparentmode;*¥XOFF/XOFFlockupproblem.8*‘5/25/83‚ImplementationofDCDnotification,auto-baud-**šrate-detect,andtransparentmodelogic.7*10/19/82‚Majorrepairssothatinterruptswillnotbe3*˜disabledsolongastoscrewupSDLC.‚Revision1.**‘9/16/82‚InitialreleasebySteveFranck.*J**************************************************************************J**************************** **********************************************J**************************************************************************J************************************************************************** PAGE**‚XREF'sfromTERMLIB* ‰XREF†LOG_ERRÑ1ÚSâ8êEòAú50 ;3B"F*92L:9BHJDRFZJb@jHrFzM‚;ŠD’LšH¢ ‰XREF†RESET‰XREF†TERM_INIT‰XREF†TERM_COMMAND‰XREF†TERM_TBE‰XREF†TERM_BREAK‰XREF†TERM_GOT_CHAR‰XREF†TERM_UNRDY‰XREF†MARK_DOWN *C*‚EquatesforthevariableBOARDdefinedinTERMCCB.EQ.ThisdriverA*‚calculatesBOARDfromthevariableCCBTYPEdefinedinCCB.EQasF*‚CCBTYPEdividedby2.ThisdriverusesBOARDtomakeboard-dependent3*‚decisions,i.e.softwareselectingthebaudrate.* VM02†EQU„$30MVME400ƒEQU„$32 VM03†EQU„$3AGVM03_BRCREQU„$F80071…AddressofthebaudratecontrolregisteronVM03 *?*‚Masksdelineatingallrecognized(REC)andunrecognized(UNR)(*‚attributes(ATT)andparameters(PAR).*C*REC_ATTƒEQU„%1011111111111111‚1bitsrepresentdefinedattributes.D*UNR_ATTƒEQU„$FFFF-REC_ATT†The1'scomplementofthatareundefined. C*REC_PARƒEQU„%0111111111111111‚1bitsrepresentdefinedparameters.D*UNR_PARƒEQU„$FFFF-REC_PAR†The1'scomplementofthatareundefined.***‚Equatefilesincluded:* *‰MVME400.EQ *‰NEC7201.EQ*‰STR*‰TCB*‰CCB*ˆ9995..BAB.EQ*‰IOE*‰NIO*‰LV5#*‰TERMINAL.EQˆEquatesforterminals *‰UTILITY.MC:*‰TERMCCB.EQ‰OffsetsandequatesforCCBDDPforterminals.*ŠPAGEŠINCLUDE9995.&.MVME400.EQŠINCLUDE9995.&.NEC7201.EQŠNOLIST ŠTTL…STR.EQŠINCLUDE9995.&.STR.EQŠNOLISTŠINCLUDE9995.&.TCB.EQŠNOLISTŠINCLUDE9995.&.CCB.EQŠNOLISTŠINCLUDE9995.&.IOE.EQ‰NOLISTŠINCLUDE9995.&.NIO.EQŠNOLISTŠINCLUDE9995.&.LV5.EQ‰NOLIST‰INCLUDEƒ9995.&.BAB.EQŠLISTŠINCLUDE9995.&.TERMINAL.EQŠINCLUDE9995.&.UTILITY.MCŠINCLUDE9995.&.TERMCCB.EQŠLIST‰OFFSET„TERMDDP */*‚DevicedependentBackgroundactivationblocks**ƒfortheMPSCdriver.‚CMRautomaticallyallocatesonepageofA*ƒmemory($100bytes)fortheCCB,andourvariableEXTCCBSZwillB*ƒresideintheCMRparametertableatthebegin ningofthedriver8*ƒtotellCMRhowmanyextrapagesofmemoryareneeded.**CCBSIZEBEQU‡*PAGESIZEEQU‡$100L1‡SET‡CCBSIZEB+PAGESIZE-1CCBSIZE‚EQU‡L1/PAGESIZEEXTCCBSZEQU‡CCBSIZE-1;ŠTTL„MPSCDRV:‚VERSADOS7201TERMINALDRIVERWITHTYPE-AHEADŠPAGEJ***************************************************************************+*‰SERVICEVECTORTABLE,REVISIONINFO,ETC.*@*‰ThistableisexaminedbyCMRwhenthechannelisallocatedtoC*‰determinewheretogoforinterrupts,commands,&initialization.<*‰Itmustalwaysbeattheverytopofthedrivercode.‚Also>*‰includedisaparametertellingthenumberofextrapagesof>*‰memorytoincludeintheCCB,andinformationdescribingthe*‰revisionofthedriver.*L**************************************************************************** ŠSECTION‚0ŠOPT„BRS MPSCDRV: *D*‚Servicevectortable.‚NoticethatthesevaluesarerelativetotheC*‚beginningofthedriversothemechanismisposition-independent!*=ŠDC.LƒINTERRUPT-MPSCDRV‚Addressofinterruptserviceroutine.9ŠDC.LƒCOMMAND-MPSCDRV„Addressofcommandserviceroutine.5ŠDC.LƒINIT-MPSCDRV‡Addressofinitializationroutine.ŠDC.Lƒ0’Reserved. **‚OtherCMRparameters.*7ŠDC.BƒEXTCCBSZ‹#ofextrapagesintheCCB.‚TheCCBmay)*§beanysizefrom1to256pages(apage'*§is256bytes):‚ifthisfieldis0,it*§willbe1page,etc.ŠDC.Bƒ0,0,0ŽReserved.ŠDC.Lƒ0,0,0ŽReserved. **‚Revisioninfo:*/ŠDC.Bƒ'102384'‹DateoflastassemblyasMMDDYY.1ŠDC.Bƒ''Spaceindicatesnopatchesto.LOfile.)ŠDC.Bƒ'4'MajorVERSAdosrevisionnumber.*‰PAGE*+*‚JumptableforusebythegenericTERMLIB*‰BRA.L…PUT_CHAR ‰BRA.L…CK_TBE‰BRA.L…DDP_RESET ‰BRA.L…SETUP‰BRA.L…CLOCK_RESET‰BRA.L…GET_STAT‰BRA.L…DDP_STOP‰BRA.L…DDP_UNSTOP‰BRA.L…DDP_BEG_BREAK‰BRA.L…DDP_END_BREAK **‰PAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INITIALIZATIONROUTINE*>*‰ThisroutineiscalledbyCMRwhenthechannelisallocated.9*‰Itspurposeistosetupthingsforcommandserviceand7*‰interruptservice.‚Themajorfunctionsperformedare:"*Validatethechanneltypefield.+*Getmemoryfortransmit&receivequeues..*Initializeflags,pointers,etc.intheCCB.*Initializethe7201.4*IftheboardisanMVME400,testthe7201andPIA!*“andinitializethePIAaswell.*@*‰WegotherethroughaJSRfromCMR,andwillexitwithanRTS.>*‰AllregistershavebeensavedbyCMRandmaybeusedfreely.?*‰Entryisatinterruptlevel0,andweareinsupervisormode.**‰Entry:A5=addressofCCB.*'*‰Exitsto:‚CMR(viaRTS)ifallisOK.'*”KILLERifexecwon'tallocatememory.*J**************************************************************************J**************************************************************************J************************************************************************** ŠDS…0 INIT: )********************************************D***‚THISISTEMPORARYJUNKFORDEBUGGING.‚InorderthatVERSAbugnotF***‚messwithportBofthe7201,wehavetosethis'alternateserialH***‚port2address'topointtoaninnocuouslocation.‚Setthealternate2***‚addressto$F70014sohe'llblowaway$F70018.***:***‡MOVE.L#$F70014,$65A†Tosimplifydebugging!!!!!!!!!!!!***7***‚Hereissomereservedspacesoyoucanpatchitin:ŠNOPŠNOPŠNOPŠNOP****.‰JSR‡TERM_INIT‹Dothedevice-independentstuff*%%%%%%%%%%%%%%ƒbwn‚8/13/842‰IFƒƒTHEN…SomethingwentwrongwithTERM_INIT.4‰IFƒƒTHEN„Theexeccallfailedandwecannotget!*œthescheduler'sentrypoint!!!ŽTR0$.KILLER‚,‰ELSERTSThechannelisdown!!‰ENDI‰ENDI*?*‚Callguardedforthedevicedependentinitializationrouti ne.**‰LEA‡DO_INIT(PC),A0‰MOVE.L„#T0GUARD,D0‰TRAP†#0 ‰RTS)*****************************************ŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰COMMANDSERVICEROUTINE*>*‰Wegetenteredherewhentheattachedtask(IOS)invokesCMR?*‰viaaTRAP1withanINITIATEI/Oparameterblocktoprocess.>*‰CMRhasalreadycheckedtheCMRparameterblocktoensureit<*‰resideswithintheaddressspaceoftheattachedtask.‚IOSA*‰hasalreadyvalidatedtheIOCB,exceptforthebufferaddresses *‰therein.*@*‰WegotherethroughaJSRfromCMR,andwillexitwithanRTS.>*‰AllregistershavebeensavedbyCMRandmaybeusedfreely.?*‰Entryisatinterruptlevel0,andweareinsupervisormode.*5*‰Entry:A2=physicaladdressofCMRparameterblock*A5=physicaladdressofCCB*3*‰Exit:‚D0=resultsofparameterblockvalidation:3*•always0inourcase,indicatingitwasOK,since2*•IOSwillnotsendusanyrequestexceptHALTI/O/*•ifwearealreadybusy,andCMRmakesallthe*•otherchecks.*A*‰Note:‚TERMLIBdoesnotrecognizeCMRcommandsforHALT&RESET.B*‰HALTcanstillbeaccomplishedthroughuseoftheHALTI/OIOCB.*J**************************************************************************J**************************************************************************J************************************************************************** COMMAND:   *E*‚IfthisisanMVME400board,readthePIA'sA-sideperipheraldata0*‚registerandsaveitintheCCBforlateruse.*:ŠIF.BBOARD(A5)#MVME400THENƒIfthisisanMVME400,?ŠMOVE.LADRSIDEA(A5),A0ˆA0<--addrof7201A-sidecontrolreg.DŠMOVE.BPIAPER_A(A0),PIA_ASAV(A5)‚GetafreshcopyoftheperipheralŠENDIšdataregister. *C*‚Nowthatwehavereceivedacommand,weknowthereissomeoneoutI*‚theretotalkto.‚Iftheguywhoreportsbreaksisasleep,wakehimup.*F**ˆMOVE.B#S_REPORT,ES_ST(A5)Reportincomingbreakstoattachedtask. ‹JSR…TERM_COMMAND ŠRTS—returntoCMR.  J**************************************************************************K***************************************************************************ŠPAGEJ**************************************************************************J**************************************************************************J****************************************************************************‰INTERRUPTHANDLINGROUTINE*<*‰ThisroutinecompletesI/Orequestsstartedbythecommand:*‰serviceroutine.‚Itisenteredattheinterruptpriority;*‰levelofinterruptsonthischannel,andisessentiallya9*‰subroutinetothefirstlevelinterrupthandlerinCMR.=*‰Remember,however,thatthisisasubordinatedriver--hence=*‰theinterruptwasfieldedfirstbythesupervisorusedwith(*‰whatevertypeofboardwe'rehandling.*:*‰Entry:D0,A0,A1havebeensavedbyCMRandareavailable3*D1hasbeensavedbythesupervisordriverandis7*available,butmustberestoreduponexit(POP.LD1).*A5=addressofCCB5*ifthisisanMVME400,D1containsthecontentsof,*thePIA'sA-sideperipheraldataregister.*9*‰ExitisalwaysviaRTS,whichtakesusbacktoCMR.‚The3*carrybitisexaminedbyCMRtodeterminewhether7*thedriverhandledtheinterruptorwhetheritshould4*passtheinterruptontothenextguyinthechain*onthatvector:*='Ihandledit'**‰Stack:*(A7)+8... *(A7)+4longwordreturnaddress6*(A7)ƒlongwordsavedcontentsofD1(mustberestored*—beforeexittoCMR)*J**************************************************************************J**************************************************** ********************** INTERRUPT: *E*‚Note:‚thisdriverrequiresasupervisordriversinceithandlestheF*‚7201.‚ThesupervisordriveroriginallywrittenforusewiththisoneF*‚isMPSCSUP,whichbranchestotheappropriatelongwordinthistableI*‚dependingoninterrupttype.‚Also,thesupervisorwillnotpasscontrolA*‚tothisdriverunlessthereisinfactaninterruptonmyport.**‚VM02andVM03entrypoints:'ŠBRA.S‚TBEMytransmitbufferisempty.ŠNOP,ŠBRA.L‚ES‘External/statuschangeonmyport.%ŠBRA.S‚RCACharacterreceivedforme.ŠNOP,ŠBRA.L‚SRCSpecialreceiveconditionforme.*‚MVME400entrypoints:*ŠBRA.S‚TBE400Mytransmitbufferisempty.ŠNOP/ŠBRA.L‚ES400ŽExternal/statuschangeonmyport.(ŠBRA.S‚RCA400Characterreceivedforme.ŠNOP/ŠBRA.L‚SRC400Specialreceiveconditionforme.0ŠBRA.L‚RI400ŽMyRI‚linewenthigh(lowatchip).(ŠBRA.L‚DSR400MyDSRlinedidsomething.4ŠBRA.L‚DSR400MyDSRandRIlinesbothdidsomething"*©(onlyworryabouttheDSRline).ŠPAGEJ***************************************************************************)*‰TRANSMITBUFFEREMPTYINTERRUPTHANDLER*=*‰The7201'stransmitbufferjustbecameempty,soifwehave+*‰morecharacterstosendwecandoitnow.*'*‰Entry:A0=addressofAsideof7201*A5=addressofCCB5*ifthisisanMVME400,D1containsthecontentsof,*thePIA'sA-sideperipheraldataregister.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** TBE400:BŠMOVE.BD1,PIA_ASAV(A5)„SavethePIA'sA-sideperipheralregister. :TBE:†MOVE.LCCBCHB(A5),A1†A1<--addrofoursideof7201. ;ŠMOVE.B#NCW0RTI,CREG(A1)‚ResetTBEinterruptsonourside.DŠMOVE.B#NCW0EOI,CREG(A0)‚Cleartheinterrupt(EOItosideAreg0). *%%%%%%%%%%ƒBWN‚9/17/84*F*‚Callthedevice-independentroutinethatdealswithtransparentmode)*‚orinvokestheXMITbackgroundroutine.* ‰JSR‡TERM_TBE‰BRA.L…INT_EXITŠPAGEJ***************************************************************************(*‰RECEIVEDCHARACTERAVAILABLEINTERRUPT*=*‰The7201hasjustreceivedacharacter,anditisavailable=*‰forreading.‚Wewilldothatnow,andtheresultwillgoin$*‰thereceivequeueifthere'sroom.*'*‰Entry:A0=addressofAsideof7201*A5=addressofCCB5*ifthisisanMVME400,D1containsthecontentsof,*thePIA'sA-sideperipheraldataregister.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** RCA400:DŠMOVE.BD1,PIA_ASAVA(A5)ƒSavetheimageofthePIA'speripheralreg. :RCA:†MOVE.LCCBCHB(A5),A1†A1<--addrofoursideof7201. 8ŠMOVE.BDREG(A1),D0ˆGetthecharfromthe7201andreset>ŠMOVE.B#NCW0EOI,CREG(A0)‚theinterrupt(EOItosideAreg0). *%%%%%%%%%%%%‚BWN9/17/84*A*‚Weonlygetintoautobaudratedetectmodeifwehavereceived:*‚aDCDtransitioninterruptwhileweareconfiguredtodoD*‚autobaudratedetection.‚Ifwearealsointransparentmode,this *‚characterwillbethrownaway.G*‚WehavemodifiedtheBREAKroutineinTERMLIBsothatitdoesnothing *‚ifweareintransparentmode.*<ŠTST.B‚AUTO_BAUD(A5)†Ifwe'reinautobaudratedetectmode, ŠBNE„DETECT_BAUDˆgohandlethat. *C*‚CallthedeviceindependentroutinetocheckfortransparentmodeG*‚anddothestufffortransparentmodeorifnotintranparentmodetoG*‚checkforanyspecialcharacterssuchasXON,XOFF,BREAKEQUIVALENT,G*‚orDISCARDOUTPUT.Otherwise,putthecharacterinthereceivequeue.* ‰JSR‡TERM_GOT_CHAR‰BRA.L…INT_EXIT ŠPAGEO*********************************************************************************‰AUTOBAUDRATEDETECTION*?*‰Wecomehe  rewhencharactersarereceivedwhilewe'reinautoB*‰baudratedetectmode.‚Thisroutinelooksattheincomingchar's@*‰toseeifitcanestablishtheclockrate(x16orx64)touse.*B*‰The#ofmillisecondstowaitforthereceivertobeflushedwasA*‰determinedasfollows.‚Theslowestpairofbaudrates(ofthose@*‰whichcanbegeneratedusingourbaudrategenerator)thatcanB*‰workwiththisx16/x64clockratetrickis75baudand300baud.C*‰Thebufferwillneedtobeflushedifwearesamplingat300baud=*‰butthedataiscominginat75baud.‚ThelargestamountofA*‰garbagewehavetoworryaboutisastartbit,8databits,andA*‰aparitybit--thestopbitswillnotcauseaproblem.‚Therefore8*‰weneedtowaitfor10bit-timesat75baud,whichis:**•1second…1000msecs3*‰10bits‚*‚--------‚*‚----------„=„about133msecs*•75bits†1second*>*‰Actuallywedon'tneedtowaitquitethatlongsincewehave?*‰alreadyreceivedawholecharatthefasterbaudrate,butit!*‰makesforanicesafetymargin.**‰Entry:*‹D0.B=thecharreceived.$*‹A1ƒ=addrofoursideofthe7201.*‹A5ƒ=addrofourCCB.*O******************************************************************************* DETECT_BAUD: *B*‚Ifwe'recurrentlyflushingthereceiver,justignorethischar.*&ŠTST.B‚FLUSHING(A5)‡Ifwe'reflushing,(ŠBNE.L‚INT_EXIT‹exitfromtheinterrupt. *<*‚We'renotflushing;isthischartheCRwe'relookingfor?*7ŠAND.B‚CHAR_MSK(A5),D0„Stripoffparityif7bits/char. +ŠIF.BD0#CRTHEN…IfthecharisaCR, -ŠSF…AUTO_BAUD(A5)†Takeusoutofdetectmode,*%%%%%%%%%%%%%%%%% BWN 7/9/84 ŽBKGRND„BREAK‰BRA.L…INT_EXITE**ˆBSETW‚#W_BREAK,WORK(A5)‚andinvokethebackgroundbreakroutineto"**ˆBRA.L‚BKG_EXEC‹notifysomebody.*%%%%%%%%%%%%%%%%%%%%%%%%%%%% ŠENDI–*  *C*‚Thatwasn'tahit;getreadytotryagainattheotherbaudrate.*<ŠNOT.B‚CLOCK_64(A5)‡Switchtotheotherclockdivisorvalue.%ŠIF…THENŠIfwe'renowdoingx16,ŠBSR„CLOCK16Œsetusupforx16;!ŠELSE–Else(we'renowdoingx64),ŠBSR„CLOCK64Œsetusupforx64.ŠENDI–* *I*‚Nowwaittomakesurethereisn'tsomegarbagelefthangingaroundfrom!*‚theerroneouscharwereceived.*<ŠST…FLUSHING(A5)‡Settheflagsowe'llknowtoignorechar's*§thatcomein. 3ŠENABLE”Wecandotherestwithinterruptsenabled. <ŠLEA„FLUSHED(PC),A0…A0<--addrtogotowhentimerexpires.BŠMOVE.L#10*1000/75,A1…A1<--#ofmillisec'stowaitforreceiver*§tobecompletelyflushed.7ŠMOVE.L#1,D1ŽD1<--interruptlevelfortimerroutine.7ŠMOVE.LA5,D2ŽD2<--timerID;we'llneedtheCCBaddr.'ŠTR0$.RQPA,Askexectosetthetimer.,ŠBRA„WAIT_FLUSH‰.‚Alliswell,sojustwait.8ŠSF…FLUSHING(A5)‡.‚Timerwasnotset,socleartheflag.2WAIT_FLUSHBRA.LINT_EXIT‹Exitfromtheinterrupt.ŠPAGEO********************************************************************************2*‰ROUTINESTOSETTHECLOCKDIVISORTOx16ANDx64*:*‰EntrypointCLOCK16setstheclockdivisortox16,while4*‰EntrypointCLOCK64setstheclockdivisortox64.**‰Entry:$*‹A1ƒ=addrofoursideofthe7201.*‹A5ƒ=addrofourCCB.**‰Exit:*O******************************************************************************* **‚Setclockdivisortox16.*CLOCK16:CLOCK_RESETˆEQU‡* !ŠPUSH.LD0‘SaveregistersandSR. ŠPUSHƒSR‘*ŠINHIBIT“Inhibitinterrupts.3ŠSF…CLOCK_64(A5)‡Markthatwe'reusingax16clock.:ŠPUT_BYTENCW4C16,D0‡Loadtheregistervalueforx16clockŠBRA„SET_CLOCKŠandgosetit.  **‚Setclockdivisortox64.*CLOCK64: !ŠPUSH.LD0‘SaveregistersandSR. ŠPUSHƒSR‘*ŠINHIBIT“Inhibitinterrupts.3ŠST…CLOCK_64(A5)‡Markthatwe'reusingax64clock.;ŠPUT_BYTENCW4C64,D0‡Loadtheregistervalueforx64clock.  *4*‚SettheclockdivisoraccordingtothebitsinD0.  *LSET_CLOCKAND.B‚#$FF-NCW4CLK,R4_7201(A5)‚Settheclockdivisorfieldto0's.1ŠOR.BƒD0,R4_7201(A5)…Orinthechosenclockrate.AŠMOVE.B#NCW0RG4,CREG(A1)‚Nowgivethepreparedregisterimageto&ŠMOVE.BR4_7201(A5),CREG(A1)‚the7201. **‚Exit.*!ŠPOP„SR‘RestoreSRandregisters, ŠPOP.L‚D0‘*ŠRTS—andreturn.ŠPAGEO********************************************************************************C*‰TIMERINTERRUPTROUTINEFORFLUSHINGRECEIVERONBAUDRATEDETECT*B*‰RoutineDETECT_BAUDsetsaflagtoindicatethatincomingchar's@*‰shouldbediscardedandsetsatimer.‚Whenthetimergoesoff,G*‰wecomeheretocleartheflag(becausetheflushingperiodisover).**‰Entry:9*‹D0,A0,A1havebeensavedbytheexecandareavailable.7*‹D1ƒ=addrofCCB(becausewemadethatthetimerID).**‰Exit:*O******************************************************************************* FLUSHED: ŠPUSH.LA5‘SaveA5./ŠMOVE.LD1,A5ŽPuttheaddressofourCCBinA5.<ŠSF…FLUSHING(A5)‡Turnofftheflagthatsayswe'reflushing.ŠPOP.L‚A5‘RestoreA5. %ŠRTE—Returnfromthetimerinterrupt.ŠPAGEJ***************************************************************************"*‰EXTERNAL/STATUSCHANGEINTERRUPT*:*‰Thisinterruptfromthe7201canbecausedseveralways:;*‰abreaksignalstarts;abreaksignalends;eitherCTSor7*‰DCDchanged.‚Theonlyconditionwecareaboutinthis8*‰driveriswhenabreaksignalstarts,inwhichcasewe>*‰havetogetanappropriateeventtotheattachedtask(IOS).*'*‰Entry:A0=addressofAsideof7201*A5=addressofCCB5*ifthisisanMVME400,D1containsthecontentsof,*thePIA'sA-sideperipheraldataregister.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** ES400:DŠMOVE.BD1,PIA_ASAVA(A5)ƒSavetheimageofthePIA'speripheralreg. 9ES:‡MOVE.LCCBCHB(A5),A1†A1<--addrofoursideof7201. 9ŠMOVE.BEXT_STATUS(A5),D0‚D0<--theoldexternalstatus.3ŠMOVE.BSREG(A1),D1ˆD1<--thenewexternalstatus.;ŠMOVE.BD1,EXT_STATUS(A5)‚SaveitintheCCBfornexttime.1ŠEOR.B‚D1,D0ŽD0<--thosethingswhichchangedin"*§externalstatussincelasttime. EŠMOVE.B#NCW0REX,CREG(A1)‚ResettheESconditiontolatchnewvalues.9ŠMOVE.B#NCW0EOI,CREG(A0)‚Issueend-of-interruptcommand. *%%%%%%%%%%‚BWN9/17/84**‚CheckforaDCDtransition.*-‰PUT_BYTE‚NCR0DCD,D1ŠIfthebitjustchanged, ‰AND.B…D0,D1.‰IF‚‚THENcalltheDCDbackgroundhandler. BKGRNDƒDCD‰ENDI **‚Checkforabreak.*7‰AND.B…#NCR0BRK,D0‰IftheBREAKDETECTbitjustchanged,‰AND.B…EXT_STATUS(A5),D0ƒanditisnowhigh, ‰IFƒƒTHEN3ŽJSR†TERM_BREAK†callthedevice-independentroutine*¦totakecareofabreak.‰ENDI ‰BRA.L…INT_EXITŠPAGEJ***************************************************************************%*‰SPECIALRECEIVECONDITIONINTERRUPT*:*‰The7201detectedanerrorintheprocessofreceivinga<*‰character.‚Weneedtorecordthisinformationsothatwhen<*‰thecorrespondingdataisrequestedfromthereceivequeue*‰wecanreportanerror.*'*‰Entry:A0=addressofAsideof7201*A5=addressofCCB5*ifthisisanMVME400,D1containsthecontentsof,*thePIA'sA-sideperipheraldataregister.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*J************************************************************************** SRC400:DŠMOVE.BD1,PIA_ASAVA(A5)ƒSavetheimageofthePIA'speripheralreg. :SRC:†MOVE.LCCBCHB(A5),A1†A1<--addrofoursideof7201. <ŠMOVE.B#NCW0RG1,CREG(A1)‚GetSRCconditionfrom7201statusŠMOVE.BSREG(A1),D0ˆregister1. BŠMOVE.B#NCW0ERR,CREG(A1)‚Cleartheerrorandresettheinterrupt.ŠMOVE.B#NCW0EOI,CREG(A0)‚* ?ŠPUT_BYTENCR1CRC+NCR1PER,D1‚If  it'saframingorparityerror,ŠAND.B‚D0,D1Ž*ŠIF…THENŠ* 1ŠPUT_BYTEPAR_FRAM,D0†Logaparity/framingerror; ŠJSR„LOG_ERR ŠBRA†INT_EXIT "ŠELSE–else(notparityorframing) .ŠPUT_BYTENCR1RCU,D1‡Ifit'sanoverrunerror,ŠAND.B‚D0,D1Ž*ŠIF…THENŠ**ŠPUT_BYTEOVERRUN,D0‡Loganoverrunerror. ŠJSR„LOG_ERR ŠBRA„INT_EXITŠENDI–* ŠENDI  ŠBRA„INT_EXIT‹Exit.ŠPAGEO*********************************************************************************‰DSRINTERRUPT*?*‰TheRS232lineDataSetReadyhasmadethetransitionwewere=*‰waitingfor(lowtohighorhightolow),sowe'llprobably<*‰wanttosendanevent.‚ThisisdetectedthroughthePIAon*‰theMVME400board.*'*‰Entry:A0=addressofAsideof7201*A5=addressofCCB5*ifthisisanMVME400,D1containsthecontentsof,*thePIA'sA-sideperipheraldataregister.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*O******************************************************************************* DSR400:DŠMOVE.BD1,PIA_ASAVA(A5)ƒSavetheimageofthePIA'speripheralreg. *%%%%%%%%%%% BWN 7/9/84 ‰BKGRND„DSR ‰BRA‡INT_EXIT:**ˆBSETW‚#W_DSR,WORK(A5)„MarkworkfortheDSRroutineand&**ˆBRA„BKG_EXEC‹invokethebackground.*%%%%%%%%%%%%%%%%%%%%%%%ŠPAGEO*********************************************************************************‰RIINTERRUPT*>*‰TheRS232lineRingIndicatorhasgonehigh,indicatingthat9*‰themodemweareconnectedtoisringing.‚Thatmeanswe<*‰wanttowaitforDSRtogohigh(whichmeansthephonehas<*‰beenansweredbythemodem).‚Thisconditionisdetectedby *‰thePIAontheMVME400board.*'*‰Entry:A0=addressofAsideof7201*A5=addressofCCB5*ifthisisanMVME400,D1containsthecontentsof,*thePIA'sA-sideperipheraldataregister.*<*‰Sincethisisnotasubroutine,registersatexitarejust-*‰theentryrequirementsofthenextroutine.*O******************************************************************************* RI400:DŠMOVE.BD1,PIA_ASAVA(A5)ƒSavetheimageofthePIA'speripheralreg. @ŠBTST.B#0,CCBTYPE(A5)…Ifwe'rehandlingtheAsideofthe7201,ŠIF…THENŠ*3ŠADD.B‚D1,D1Žshiftbit6ofPIA'sA-sideperipheral#*§datareg.togetstatusofportA*§DSRlineinbit7;BŠBCLR#DSR_FALLING,PIACTL_A(A0)‚settheA-sidecontrolregisterto-ŠELSE–waitforDSRtogohigh,else(we'reB)BŠBCLR#DSR_FALLING,PIACTL_B(A0)‚settheB-sidecontrolregistertoŠENDI–waitforDSRtogohigh. ?ŠMOVE.B#S_WT4RDY,DSR_ST(A5)ƒSetupDSRprocesstowaitforDSR$*§togohigh(modemansweredphone). *;*‚It'spossiblethatDSRhasalreadygonehigh;ifso,just2*‚invoketheDSRtransitionhandlerinbackground.*2ŠTST.B‚D1‘Ifbit7ofD1(DSRstatusforourport)(ŠBMI„INT_EXIT‹is1(DSRlow),justexit. *%%%%%%%%%%% BWN 7/9/84 ‰BKGRND„DSR ‰BRA‡INT_EXITD**ˆBSETW‚#W_DSR,WORK(A5)‚DSRishi:‚markworkfortheDSRtransition2**ˆBRA„BKG_EXEC‹handlerandinvokethebackground.*%%%%%%%%%%%%%%%%%%%%%%ŠNOPŠPAGE*E*‚Nowexitasfromaninterrupt.‚WemayinfacthavebeencalledfromF*‚commandserviceorinitialization,buttheyhadtosetituptolook*‚likeaninterrupt,too.*INT_EXIT:POP.L‚D1‘RestoreD1,7ŠMOVEQ‚#1,D0ŽsetcarrybittotellCMR'wehandledit,' ŠSUBQƒ#2,D0Ž*ŠRTS—andreturn.ŠPAGE*%%%%%%%%%%%%%%%%%BWN‚7/13/84‰PAGEK*****************************************************************************!*ROUTINES„CALLED„BY**–TERMLIB**F**********************************************************************‰PAGEL******************************************************************************ˆTRANSMITTHECHARACTER*?*ˆThisisthedevicedependentroutinethatactuallywritesthe*ˆcharactertothedevice.*F*ˆTheoffsettothisroutinemustbeinstalledatthebeginningofthe *ˆdriver.*-*ˆ  Entry:„A1=addressofoursideofthechip*’A5=addressofCCB*’D0.B=charactertotransmit*ˆInterruptlevelonentry:0**C*ˆExit:…Allregistersarepreserved,includingthestatusregister.<*’Itisimportanttokeeptheinterruptlevelthesameasit*’wasuponentry.**J************************************************************************** PUT_CHAR:‰MOVE.B„D0,DREG(A1)‰RTS*J**************************************************************************‰PAGEM******************************************************************************$*ˆCHECKTHEDEVICE'STRANSMITBUFFER*F*ˆThisisadevicedependentroutinewhoseoffsetmustbeinstalledat*ˆthebeginningofthedriver.<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.*-*ˆEntry:A1=addressofoursideofthechip*A5=addressofCCB*ˆInterruptlevelonentry:0**ˆExit:‚Conditioncodes:"*=transmitbuffernotempty*=transmitbufferempty**M*****************************************************************************CK_TBE:‰BTST.B„#2,SREG(A1)‰RTSJ**************************************************************************‰PAGEH************************************************************************* *ˆDEVICEDEPENDENTRESETROUTINE*9*ˆThisisthedevice-dependentpartoftheresetroutine.F*ˆTheoffsettothisroutinemustbeinstalledatthebeginningofthe *ˆdriver.****ˆEntry:A5=addrofCCB*ˆInterruptlevelonentry:0*$*ˆExit:Allregistersarepreserved.*<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.*E********************************************************************* DDP_RESET: 6ŠMOVEM.LA1/D0,-(A7)‡saveusedregistersonthestack.*B*‚IfthisisanMVME400board,wemustinitializethePIAcontrol@*‚registerforoursidetowaitforDSRtogolow(unready)and,2*‚ifweareconfiguredforamodem,RItogohigh.*:ŠIF.BBOARD(A5)#MVME400THEN‚IfthisisanMVME400, CŠMOVE.B#S_WT4UNR,DSR_ST(A5)ƒChangeDSRstatetoawaitDSRunready.4ŠMOVE.B#1<THENŠ*8ŠBSET#RI_ENABLE,D0ˆEnableinterruptsforRItogohigh.ŠENDI–* *M*‚D0nowhastheproperinitializationvalue.‚Putitinourcontrolregister.*AŠMOVE.LADRSIDEA(A5),A1„A1<--addrof7201A-sidectrlregister.4ŠBTST.B#0,CCBTYPE(A5)…Ifwe'rehandlingtheAside,ŠIF…THENŠ*;ŠMOVE.BD0,PIACTL_A(A1)„initializethePIA'sA-sidecontrolŠELSE–register,else:ŠMOVE.BD0,PIACTL_B(A1)„initializetheB-sidecontrolreg.ŠENDI–* ŠENDI–*  0ŠMOVEM.L(A7)+,A1/D0‡Restoresavedregistersand ŠRTS—exit.ŠPAGEJ***************************************************************************@*‰SUBROUTINETOSETUPTHEDEVICEACCORDINGTOTHECONFIGURATION*;*‰Usestheworkingconfiguration(intheCCB)tosetupthe;*‰device,andsomeconfiguration-relatedfieldsintheCCB.*F*ˆTheoffsettothisroutinemustbeinstalledatthebeginningofthe *ˆdriver.**‰Entry:A5=addressofCCB*ˆInterruptlevelonentry:0**‰Exit:<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.*J************************************************************************** SETUP: <ŠMOVEM.LD0-D2/A0-A3,-(A7)Savesomeregistersonthestack. ŠPUSHƒSR **‚Firstsetupaddresses.*4ŠLEA„CONFIG(A5),A0†A0<--addrofCCBconfiguration.3ŠMOVE.LCCBCHB(A5),A1†A1<--addrofour7201port.3ŠMOVE.LADRSIDEA(A5),A2„A2<--addrof7201Aport.)ŠLEA„2(A2),A3‹A3<--addrof7201Bport. *2*‚[4]„x16orx64clockrateaccordingtotheflag,(*‰stopbits&parityfromconfiguration.*0ŠPUT_BYTENCW4C1  6,D0‡Startwithx16clockinD0.;ŠTST.B‚CLOCK_64(A5)‡Iftheflagissetsayingwe'reusingaŠIF…THENŠx64clock,)ŠPUT_BYTENCW4C64,D0‡putx64clockinD0.ŠENDI–* :ŠBTSTW‚#IOASTPB,IOSATW(A0)Addinthenumberofstopbits. ŠIF…THENŠOR.Bƒ#NCW4SB1,D0ˆ(1stopbit)ŠELSEŠOR.Bƒ#NCW4SB2,D0ˆ(2stopbits)ŠENDI >ŠBTSTW‚#IOAUSEP,IOSATW(A0)Ifwe'reusingparity,enableit... ŠIF…THENŠOR.Bƒ#NCW4PEE,D0:ŠBTSTW‚#IOAPRTY,IOSATW(A0)andifwe'reusingevenparity,ŠIF…THENŠsetitup.ŠOR.Bƒ#NCW4PEO,D0ŠENDIŠENDI ŠINHIBITBŠMOVE.B#NCW0RG4,CREG(A1)‚Pointtocontrolregister4onourport.ŠMOVE.BD0,CREG(A1)ˆ[4]<--D09ŠMOVE.BD0,R4_7201(A5)…SavetheimageintheCCBaswell. ŠMOVEƒ(A7),SR ***‚[3]„autoenablesmode,receiverenabled,*‰bits/charfromconfiguration.*DŠPUT_BYTENCW3AUE+NCW3RXE,D0Startwithautoenablesmode&receiver*§enabledinD0. 1ŠBTSTW‚#IOABITS,IOSATW(A0)Addinbits/charinfo. ŠIF…THENŠOR.Bƒ#NCW3BT7,D0ˆ(7bits/char)ŠELSEŠOR.Bƒ#NCW3BT8,D0ˆ(8bits/char)ŠENDI ŠINHIBITBŠMOVE.B#NCW0RG3,CREG(A1)‚Pointtocontrolregister3onourport.ŠMOVE.BD0,CREG(A1)ˆ[3]<--D0 ŠMOVEƒ(A7),SR *0*‚[5]„RTS&DTRlineshigh,transmitterenabled,*‰bits/charfromconfiguration.*>ŠPUT_BYTENCW5DTR+NCW5RTS+NCW5TXE,D0StartwithRTS&DTRhigh$*§andthetransmitterenabledinD0. *%%%%%%%%%%ƒBWN‚8/30/84A**ˆBTSTW‚#IOAMODM,IOSATW(A0)„Ifthisisamodemwe'retalkingto,**ˆIF…THENŽ*8ŠBTSTW‚#IOAOFFH,IOSATW(A0)„andtheguywantsitoffhook,ŠIF…THENŽ*,ŠAND.B‚#$FF-NCW5DTR,D0ˆsettheDTRlinelow.ŠENDIš* **ˆENDIš* 1ŠBTSTW‚#IOABITS,IOSATW(A0)Addinbits/charinfo. ŠIF…THENŠOR.Bƒ#NCW5TX7,D0ˆ(7bits/char)ŠELSEŠOR.Bƒ#NCW5TX8,D0ˆ(8bits/char)ŠENDI ŠINHIBITBŠMOVE.B#NCW0RG5,CREG(A1)‚Pointtocontrolregister5onourport.ŠMOVE.BD0,CREG(A1)ˆ[5]<--D0@ŠMOVE.BD0,R5_7201(A5)…AlsosavethisoneintheCCB(we'llhave&*§todinkwithiteverytimewechange*§DTRorRTS). *G*‚[1]„conditionaffectsvector,interruptonallchar's&parityerror,E*‰transmitterinterruptsenabled,external/statusinterruptsenabled.*BŠMOVE.B#NCW0RG1,CREG(A1)‚Pointtocontrolregister1onourport.1ŠMOVE.B#NCW1STV+NCW1IRP+NCW1TXI+NCW1EXI,CREG(A1)*§[1]<--allthatjunk.ŠPOP„SR *I*‚IfthisisanMVME400board,setupthebaudratecontrolsonthePIA.*@ŠIF.BBOARD(A5)#MVME400THENƒIfthisisanMVME400board, 6ŠMOVE.BIOSBRT(A0),D0†D0<--theconfiguredbaudrate.;ŠPUT_BYTE$F0,D1‹D1<--masktoclearlow4bitsofabyte./ŠBTSTƒ#0,CCBTYPE(A5)…IfthisisanA-sideport,ŠIF…THENŠ*8ŠLSL.B‚#4,D0Žgetthevalueinthehigh4bitsandchange3ŠPUT_BYTE$0F,D1‹themasktoclearthehigh4bits.ŠENDI–*?ŠAND.B‚D1,PIAPER_B(A2)„Replacethecurrent4-bitvaluewiththe%ŠOR.BƒD0,PIAPER_B(A2)„baudratecode. ŠENDI *A*‚IfthisisaVM03board,setupthebaudratecontrolregister.*8ŠIF.BBOARD(A5)#VM03THENƒIfthisisaVM03board, 6ŠMOVE.BIOSBRT(A0),D0†D0<--theconfiguredbaudrate.;ŠPUT_BYTE$F0,D1‹D1<--masktoclearlow4bitsofabyte./ŠBTSTƒ#0,CCBTYPE(A5)…IfthisisanB-sideport,ŠIF…THENŠ*8ŠLSL.B‚#4,D0Žgetthevalueinthehigh4bitsandchange3ŠPUT_BYTE$0F,D1‹themasktoclearthehigh4bits.ŠENDI–*<ŠMOVE.BVM03_BRCR,D2‡Readthecurrentbaudratecontrolreg.5ŠAND.B‚D1,D2ŽReplacethecurrent4-bitvaluewiththeŠOR.BƒD0,D2Žbaudratecode.;ŠMOVE.BD2,VM03_BRCR‡Writeitbacktothecontrolregister. ŠENDI * **‚Restoreregistersandreturn.*8ŠMOVEM.L(A7)+,D0-D2/A0-A3Restoreregistersfromstack.ŠRTSŠPAGEJ****************************************************************************‰GETDEVICESTATUSBYTE*8*‰PreparestheDEVICESTATUSbytewhichcontains,ifthe:*‰boardiscapableofsensingit,theconditionoftheDSR8*‰line(whichindicatesdeviceready/unready).‚Notethat:*‰withtheMVME400this  infocannotbereaddirectlyfrom<*‰thedeviceduringaninterrupttour,butithasbeensaved*‰intheCCBunderPIA_ASAV.*8*‰Note:‚thisroutinedoesnotsetthebreakindicatorin*thedevicestatusbyte.F*ˆTheoffsettothisroutinemustbeinstalledatthebeginningofthe *ˆdriver.**<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.**‰Entry:A5=addressofCCB*ˆInterruptlevelonentry:0**&*‰Exit:‚D0.B=thedevicestatusbyte.*D1‚issavedandrestored.*J************************************************************************** GET_STAT: ŠCLR.B‚D0‰MOVE.L‚D1,-(SP) **‚AddinthestatusofDCD.*5ŠPUT_BYTENCR0DCD,D1‡IfDCDishighattheconnector,ŠAND.B‚EXT_STATUS(A5),D1‚*ŠIF…THENŠ*6ŠBSETƒ#XDSDCD,D0‰settheDCDbitinthedevicestatus.ŠENDI–* *6*‚Addinwhetherornotwe'redetectingthebaudrate.*@ŠTST.B‚AUTO_BAUD(A5)†Ifwe'recurrentlyinAUTOBAUDRATEDETECTŠIF…THENŠmode,2ŠBSETƒ#XDSABR,D0‰setthebitinthedevicestatus.ŠENDI–* *I*‚IsthisanMVME400board?‚Ifso,getDSRstatusfromthePIA.‚Wecan'tK*‚reallygooutandreadthePIAatthispoint(wemightaccidentallyclearG*‚apendinginterrupt),sowelookinsteadatthelastversionofitwe*‚savedintheCCB.*9ŠIF.BBOARD(A5)#MVME400THEN‚IfthisisanMVME400, BŠMOVE.BPIA_ASAV(A5),D1„D1<--savedcopyofA-sideper.datareg.2ŠBTSTƒ#0,CCBTYPE(A5)…Ifwe'rehandlingtheAside,ŠIF…THENŠ*1ŠADD.B‚D1,D1Žshiftbit6intothebit7position.ŠENDI–* 0ŠTST.B‚D1‘Ifbit7isset(indicatingDSRislow/ŠIF…THENŠandhencethedeviceisunready),:ŠBSETƒ#XDSNRB,D0‰settheunreadybitinthedevicestatus.ŠENDI–* ŠENDI–* ‰MOVE.L‚(A7)+,D1 ŠRTS—Return.ŠPAGEM******************************************************************************5*ˆDEVICEDEPENDENTSTUFFFORLOWERINGAHARDWARELINE*ˆTOSTOPTHETRANSMITTER.*<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.*F*ˆTheoffsettothisroutinemustbeinstalledatthebeginningofthe *ˆdriver.***ˆEntry:$*’A1=addressofoursideofdevice*’A5=addressofCCB3*ˆInterruptlevelonentry:INHIBITEDatourlevel.*K*************************************************************************** DDP_STOP:CŠAND.B‚#$FF-NCW5DTR,R5_7201(A5)‚Changeourimageof7201register5*§toshowDTRlow,%*£andputitin7201register5while2ŠMOVE.B#NCW0RG5,CREG(A1)‚interruptsaredisabled.ŠMOVE.BR5_7201(A5),CREG(A1)‚*‰RTS9*********************************************************‰PAGEK****************************************************************************$*ˆDEVICEDEPENDENTUNSTOPTHEDEVICE*=*ˆWhenwearenotusingXOFF/XON,weunstopthedeviceinour*ˆowndevicedependentway.*;*ˆWearerunninginbackgroundwhenthisroutineiscalled.*?*ˆTheoffsettothisroutinemustbeinstalledatthebeginning*ˆofthedriver.*<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.*/*ˆEntry:„A1=addressofoursideofthedevice*’A5=addressoftheCCB5*ˆIneterruptleveluponentry:INHIBITEDatourlevel*J************************************************************************** DDP_UNSTOP:*AŠOR.Bƒ#NCW5DTR,R5_7201(A5)SettheDTRlinehigh(usingtheimageCŠMOVE.B#NCW0RG5,CREG(A1)‚ofcontrolregister5storedintheCCB).ŠMOVE.BR5_7201(A5),CREG(A1)* ‰RTS‰PAGEK****************************************************************************&*ˆDEVICEDEPENDENTBEGINBREAKROUTINE*F*ˆTheoffsettothisroutinemustbeinstalledatthebeginningofthe *ˆdriver.*<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.**ˆEntry:„A5=addrofCCB!*’A1=addrofoursideofdevice4*ˆInterruptleveluponentry:INHIBITEDatourlevel**ˆExit:* *ˆUsesD0*E**************************************  *******************************  DDP_BEG_BREAK:‰SAVE†D0>ˆMOVEQ‚#NCW5BRK,D0ˆCreateanimageofthe7201'scontrolreg5>ˆOR.BƒR5_7201(A5),D0…withtheTRANSMITBREAKbitsetandwriteDˆMOVE.B#NCW0RG5,CREG(A1)‚thatouttocontrolregister5ofourside ˆMOVE.BD0,CREG(A1)ˆofthe7201. ‰RESTOREƒD0‰RTS  ‰PAGEK****************************************************************************$*ˆDEVICEDEPENDENTENDBREAKROUTINE*F*ˆTheoffsettothisroutinemustbeinstalledatthebeginningofthe *ˆdriver.*<*ˆItisimportanttokeeptheinterruptlevelthesameasit*ˆwasuponentry.**ˆEntry:„A5=addrofCCB!*’A1=addrofoursideofdevice5*ˆInterruptleveluponentry:INHIBITEDatourlevel.**ˆExit:*L**************************************************************************** DDP_END_BREAK:‰MOVE.B„#NCW0RG5,CREG(A1)‰MOVE.B„R5_7201(A5),CREG(A1)‰RTS ‰PAGEI***************************************************************************“BACKGROUND**šAND**‘CALL__GUARDED**–ROUTINES**•(DEVICE-DEPENDENT)*E*********************************************************************ŠPAGEO*********************************************************************************‰FINISHOFFTHEINITIALIZATION*A*‰TheinitializationroutinehasgonearoundresettingeverythingD*‰itcan,buttheroutinesRESETandDDP_RESETshouldonlybecalled>*‰fromwithinthebackground.‚Soheinvokedthisroutinetodo *‰itforhim.*?*‰Inaddition,theseotherdevice-dependentthingsMUSTbedone>*‰beforewecanhandlecommands.‚Theyprobablycouldhavebeen?*‰doneinINITatthestartofthedriverbutarehandledhere.*5*‰1.‚PutthestartaddressofthedriverintotheCCB*variableDRV_ADDR.>*‰2.‚Setupthedevice-dependentBABsusingthemacroSET_BAB.;*‰3.‚PuttheaddressoftheA-sideofadualchanneldevice6*intotheCCBvariableADRSIDEA.‚Ifnotdualchannel,**puttheaddressofPort1intoADRSIDEA.**‰Entry:*A5=addressofCCB.*O******************************************************************************* DO_INIT:**‚Inhibitinterrupts*‰PUSH†SR‰INHIBIT*)*‚GetaddressofstartofdriverintoCCB*‰LEA‡MPSCDRV(PC),A4‰MOVE.L„A4,DRV_ADDR(A5)*$*‚SetupthedevicedependentBAB's.*‰SET_BABƒDCD0,DCD‰SET_BABƒDSR0,DSR *6*‚SetuptheaddressoftheAsideoftheSerialport.*?ŠMOVE.LCCBCHB(A5),ADRSIDEA(A5)‚Moveaddressofoursideofthe;ŠBTST.B#0,CCBTYPE(A5)…7201toCCBasaddressofAside.‚If3ŠIF…THENŠthechanneltypesayswe'rereallyB,=ŠSUB.L‚#2,ADRSIDEA(A5)„subtract2fromtheaddresstomakeitŠENDI–theAside. *%%%%%%%%%%%% BWN 6/25/84* DEVICE DEPENDENT STUFF*H*‚Determinetheboardtype.‚Ifit'sanMVME400(whichhasaPIAonit),!*‚testitandinitializethePIA.*:ŠIF.BBOARD(A5)‚#MVME400THEN‚IfthisisanMVME400, AŠMOVE.LADRSIDEA(A5),A0„A0<--addrof7201portActrlregister.7ŠLEA„2(A0),A1‹A1<--addrof7201portBctrlregister.-ŠSEL_PERA‘SeeifthefailLEDison.‚Ifnot,<ŠBTSTƒ#LED_STAT,PIAPER_A(A0)‚someoneelsehasalreadysetup$ŠIF…THENŠthe7201.‚Ifitison, :ŠBSETƒ#LED_CTRL,PIAPER_A(A0)‚Setthefaillightbitinthe*§PeripheralDataRegister. 1ŠSEL_DDRA‘SetupthePIA'sA-sideDataDirection>ŠMOVE.B#DDR_A,PIADDR_A(A0)‚Register.‚Ifitdoesnotreadback+ŠCMP.B‚#DDR_A,PIADDR_A(A0)‚correctly,fail. ŠBNE„FAIL* -ŠSEL_DDRB‘SetuptheDataDirectionRegister*ŠMOVE.B#DDR_B,PIADDR_B(A0)‚ontheBside. DŠMOVE.B#NCW0RG1,CREG(A1)‚MakesuretheCONDITIONAFFECTSVECTORbit6ŠMOVE.B#0,CREG(A1)ˆisoffinregister1Bofthe7201.@ŠMOVE.B#NCW0RG2,CREG(A1)‚Writethetestvalueouttothe7201'sAŠMOVE.B#TEST_VAL,CREG(A1)vectorregister(2B)andreaditback.5ŠMOVE.B#NCW0RG2,CREG(A1)‚Ifit'snotthesame,fail.ŠCMP  .B‚#TEST_VAL,CREG(A1)* ŠBNE„FAIL* 3ŠSEL_PERA‘LeavethePIApointingtothePeripheral$ŠSEL_PERB‘DataRegisters(always!).3ŠBCLRƒ#LED_CTRL,PIAPER_A(A0)ƒTurnoffthefailLED! ŠENDI ŠENDI 0*‚Nowactuallydotheminimumsetuponthe7201.*6ŠMOVE.LCCBCHB(A5),A1†A1<--addrofoursideof7201.6ŠMOVE.LADRSIDEA(A5),A2„A2<--addrofAsideof7201.,ŠLEA„2(A2),A3‹A3<--addrofBsideof7201. 1ŠMOVE.B#NCW0RCN,CREG(A1)‚Resetour7201channel.  **ˆINHIBIT0**ˆCLR.B‚ES_ST(A5)ŠSetESprocessstatetoIDLE. *A*‚[2A]ƒpriorityrelationshipRxA>RxB>TxA>TxB>ExTA>ExTB.*@ŠMOVE.B#NCW0RG2,CREG(A2)‚Pointtocontrolregister2onportA.9ŠMOVE.B#NCW2PRI,CREG(A2)‚[2A]<--priorityrelationship. **‚[2B]ƒinterruptvectoris0.*@ŠMOVE.B#NCW0RG2,CREG(A3)‚Pointtocontrolregister2onportB.ŠMOVE.B#0,CREG(A3)ˆ[2B]<--0 * *‚[1B]ƒconditionaffectsvector.*@ŠMOVE.B#NCW0RG1,CREG(A3)‚Pointtocontrolregister1onportB.<ŠMOVE.B#NCW1STV,CREG(A3)‚[1B]<--conditionaffectsvector. *%%%%%%%%%%%%%%%%%%%%%%%%*K*‚WehavetosetupafewthingsintheCCBbeforeinvokingthebackground.*@ŠMOVE.BSREG(A1),EXT_STATUS(A5)‚Getthecurrentexternalstatus.7ŠSF…CLOCK_64(A5)‡We'restartingoutwiththex16clock. ŠJSR„RESETŽReseteverything.ŠBSR.L‚DDP_RESET6*‰BSR.L‚SETUPŽSetupthe7201accordingtotheconfig.**‚Enableinterruptsnow.* **‡ENABLE‰POP‡SR **ˆBRA.L‚CHECK_WORK‰Andexit.‰RTS*%%%%%%%%%%%% BWN 9/17/84FAIL…JSR‡MARK_DOWN**‡MOVE.B„#M_DOWN,MENU(A5)**‡MOVE.B„#ISTAUNR,DOWN_ERR(A5)*%%%%%%%%%%%%%% BWN 7/9/84**‡BRA‡CHECK_WORK **‡ENABLE‰POP‡SR‰RTS*%%%%%%%%%%%%%%%%%%%%%%%%*%%%%%%%%%%%%%%ŠPAGEO*********************************************************************************‰DSRTRANSITIONHANDLER*?*‰ThispartofthebackgroundrunswhenthePIAsensesachange@*‰ontheDSRline.‚Thiseithermeansthatit(terminalormodem)?*‰isjustgoingreadyorjustgoingunready.‚Ifit'sjustgoing;*‰ready,thenamodemjustansweredthephone.‚Ifit'sjustC*‰goingunready,somebodyhungupordidsomethingtotheterminal./*‰It'sverylikelywe'llwanttosendanevent.*B*‰ThisroutineiscalledusingBACKGROUNDsoweenteratinterrupt6*‰level0,andwemustmustexitatinterruptlevel0.6*‰WemustalsorestoreregisterA7ifwemesswithit.@*‰Otherthanthat,wearefreetoreturnwhateverwelikeinthe *‰registers.** *‰DSR0(background)entrypoint:-*A1=addressofbackgroundactivationblock**‰DSRentrypoint:*‰Entry:#*A1=addressofoursideof7201.%*A4=addressofstartofourdriver*A5=addressofCCB.**‰Exit:*A0=garbage.*O******************************************************************************* *%%%%%%%%%%%%%%%%%bwn‚7/9/84DSR0:**ƒSetupA5andA1.<*ƒWhentheexeccallsthisroutine,A1=addressoftheBAB.* (‰LEA‡-DSR_BAB(A1),A5„A5<---CCBaddress9‰MOVE.L„CCBCHB(A5),A1‡A1<---addressofoursideof72011‰MOVE.L„DRV_ADDR(A5),A4…A4<---addressofdriver*"*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%DSR: **ˆPUSH.LA1‘SaveA1. D*‚IfwewerewaitingforDSRtogohigh(becauseofaRIinterrupt),E*‚thenthephonehasbeenansweredandwecangenerateabreakevent.D*‚Beforewedo,though,setthingsuptointerruptwhenDSRgoeslow.*‚soweknowwhenthedeviceisgoingunready.*CŠIF.BDSR_ST(A5)#S_WT4RDYTHENƒIfwe'rewaitingforDSRhigh, *%%%%%%%%%%%ƒBWN‚9/12/84ŠMOVE.L‚ADRSIDEA(A5),A0 *%%%%%%%%%%%@ŠBTST.B#0,CCBTYPE(A5)…Ifwe'rehandlingtheAsideofthe7201,ŠIF…THENŠ*CŠBSET#DSR_FALLING,PIACTL_A(A0)‚settheA-sidecontrolreg.towait'ŠELSE–forDSRtogolow,else(we'reB)CŠBSET#DSR_FALLING,PIACTL_B(A0)‚settheB-sidecontrolreg.towaitŠENDI–forDSRtogolow. CŠMOVE.B#S_WT4UNR,DSR_ST(A5)ƒChangestatebacktowaitforDSRlow,*%%%%%%%%%%%%%%%%%bwn‚7/9/84?**ˆBSETW‚#W_BREAK,WORK(A  5)‚andflagworkforthebreakhandler. ŽBKGRND„BREAK*%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ŠELSE *A*‚WewerewaitingforDSRtogolow,sothisinterruptmeansthat?*‚theterminalisunready.‚IfweweredoingI/O,sendanevent.* ŠJSR„TERM_UNRDY ŠIF‚‚THENŽTR0$.KILLER,ŠENDI ŠENDI   **ˆPOP.L‚A1‘RestoreA1.*%%%%%%%%%%%%%%%%%bwn‚7/9/844**ˆBRA„CHECK_WORK‰Returntothebackgroundexecutor.‰RTS!*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%ŠPAGEO*********************************************************************************‰HANDLEADCDTRANSITION*?*‰TherewasatransitionontheDCDline.‚Wemayneedtonotify;*‰theuser,andwemayneedtostartautobaudratedetect.*B*‰ThisroutineiscalledusingBACKGROUNDsoweenteratinterrupt6*‰level0,andwemustmustexitatinterruptlevel0.6*‰WemustalsorestoreregisterA7ifwemesswithit.@*‰Otherthanthat,wearefreetoreturnwhateverwelikeinthe *‰registers.* *‰DCD0(background)entrypoint:-*A1=adrressofbackgroundactivationblock**‰DO_DCDentrypoint:*‰Entry:#*A1=addressofoursideof7201.%*A4=addressofstartofourdriver*A5=addressofCCB.*O********************************************************************************%%%%%%%%%%%%%%%%%bwn‚7/9/84DCD0:**ƒSetupA5andA1.<*ƒWhentheexeccallsthisroutine,A1=addressoftheBAB.*(‰LEA‡-DCD_BAB(A1),A5„A5<---CCBaddress9‰MOVE.L„CCBCHB(A5),A1‡A1<---addressofoursideof72011‰MOVE.L„DRV_ADDR(A5),A4…A4<---addressofdriver*"*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DO_DCD: */*‚Reportthetransitionifwe'reconfiguredto.*>ŠBTSTW‚#IOADCD,CONFIG+IOSATW(A5)‚Iftheattributeswordinthe4ŠIF…THENŠconfigurationsayswe'rereportingDCD*§transitions,*%%%%%%%%%%%%%‚BWN7/16/84 BKGRND„BREAK;**ˆBSETW‚#W_BREAK,WORK(A5)‚markworkforthebreakroutine.*%%%%%%%%%%%%%%%%%%%ŠENDI–* */*‚Startupautobaudratedetectifweneedto.*?ŠPUT_BYTENCR0DCD,D0‡IfDCDiscurrentlyhighattheconnector,ŠAND.B‚EXT_STATUS(A5),D0‚*ŠIF…THENŠ* @ŠBTSTW‚#IOAAUTO,CONFIG+IOSATW(A5)‚Ifwe'reconfiguredtodoauto"ŠIF…THENŠbaudratedetection, .ŠJSR„RESETŽResetthingstoaninnocuousstate.ŠBSR.L‚DDP_RESET5ŠBSR.L‚CLOCK16ŒSettheclockdivisortox16tostart.;ŠST…AUTO_BAUD(A5)†Markthatwe'reinautobauddetectmode. ŠENDI ŠENDI ‰RTS ‰PAGE*********************** *‚PATCHSPACE***********************ŠDS.Wƒ30ŠEND  ééééé  éé=/*=/*†MPSCSPR.AF=/*K=/* Chain file to assemble NEC 7201 supervisor driver for the MVME400 board=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to MPSCSPR.LS=/*=/IFC \1ƒ=ARGMPSCSPR.LS=/ENDIF=/*$=ASM MPSCSPR.SA,MPSCSPR.RO,\1;RZ=106=/*{ Included files are:=/*ƒ9995.&.NEC7201.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.CCB.EQ=/*}=/*=ENDééééééª*‰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 SE T 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ƒ'52383'‹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.* ŠTR0$.KILLERŠ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:*‚*…VM02interrupts *Œ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.AF=/*B=/* Chain file to assemble NEC 7201 supervisor driver for the VM02=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to MPSCSUP.LS=/*=/IFC \1ƒ=ARGMPSCSUP.LS=/ENDIF=/*$=ASM MPSCSUP.SA,MPSCSUP.RO,\1;RZ=106=/*{ Included files are:=/*ƒ9995.&.NEC7201.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.CCB.EQ=/*}=/*=ENDéé ééééô9MPSCSUPƒIDNTƒ4,0‡NEC7201SUPERVISORDRIVERFORVM02BOARD6ŠTTL„MPSCSUP:‚NEC7201SUPERVISORDRIVERFORVM02BOARD ŠLLENƒ120J**************************************************************************J**************************************************************************J**************************************************************************J***************************************************************************<*‰MPSCSUP:‚SupervisorchanneldriverforNEC7201driverson*theVM02board.*=*‰Purpose:‚VERSAdosdevicedrivertotakeinterruptsfromthe1*NEC7201chiponaVM02andpasscontroltothe"*appropriatesubordinatechannel.**‰Revisionhistory:**9/16/82‚InitialreleasebySteveFranck.*;*‰Interface:‚Thisdriverdoesnotservicecommands.‚Whenan4*interruptoccurs,thisdrivercheckswhetheritis3*fromthe7201forwhichitisresponsible.‚Ifso,1*itdetermineswhichsideofthe7201causedthe1*interruptandpassescontroltotheappropriate8*subordinatehandler,usingtheCCBSUBlinkintheCCB.**‰RMS68Kroutinesused: *TR0$.KILLER**‰Othernotes:4*Thissupervisorrequiresthatsubordinatechannels6*forbothofthe7201portsbeallocatedandthatthe(*channelforportAbeallocatedfirst.*ThiscodeisROMable.'*AssembleusingchainfileMPSCSUP.AF.*J**************************************************************************J**************************************************************************J**************************************************************************J**************************************************************************  **‚Equatefilesincluded:* *‰NEC7201*‰9995.&.STR.EQ*‰CCB*ŠNOLISTŠINCLUDE9995.&.NEC7201.EQŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.CCB.EQŠLIST‰PAGEO*********************************************************************************ˆMACROS*O******************************************************************************* ý<9B;(*.*‚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*‡AtafixedlocationintheCCBwewill havesomefieldswhichwillD*‚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ƒ'091682'‹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.* ŠTR0$.KILLERŠ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.* ŠENDééé=/*=/*†P050DRV.AF=/*>=/* Chain file to assemble printer driver for the VME050 board=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to P050DRV.LS=/*=/IFC \1ƒ=ARGP050DRV.LS=/ENDIF=/*%=ASM P050DRV.SA,P050DRV.RO,\1;MRZ=146=/*{ Included files are:=/*ƒ9995.&.TRACE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*}=/*=END éééééé&ŠPAGEKP050DRVƒIDNTƒ4,0VERSAdosLocalPrinterI/OHandlerProcessV4.0-09/13/82?ŠTTL„VERSADOS…LOCALPRINTERI/OHANDLERPROCESSV4.0-09/13/82 ŠLLENƒ120*‰INCLUDEfilesare:**‰9995.&.TRACE.EQ*‰9995.&.STR.EQ*‰9995.&.TCB.EQ*‰9995.&.CCB.EQ*‰9995.&.IOE.EQ*‰9995.&.NIO.EQ*‰9995.&.LV5.EQŠNOLISTŠINCLUDE9995.&.TRACE.EQŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠLISTJ****************************************************************************1* PRT -- REV. 1.00 02NOV81 (TL09) JIM SMITH - IOH9*ˆREV.1.0101FEB82(TL09)JIMSMITH-VECTORCHAIN(IOH)5*ˆREV.1.0223FEB82(TL09)JIMSMITH-IOCBUSE(IOH)5*ˆREV.2.0015APR82(TL09)JIMSMITH-PRINTERDRIVER5*ˆREV.2.0101JUN82(TL09)MARCBRIEL-PRINTERDRIVER5*ˆREV.2.1015JUL82(TL09)MARCBRIEL-PRINTERDRIVER-*ˆREV‚2.2018JAN84ˆMARCBRIEL-PRINTERDRIVER@*ˆREV.2.3017JUL84ˆKENTGOTT-AdaptedforVME050parallelport;*ˆREV‚2.3117DEC84ˆMIKEDUH‚-RemovedENABLatPRTINRTNfor *­SPR1178(EpsonRX80printer).*«-FixedHALTroutine.=*ˆREV‚2.3219DEC84ˆMIKEDUH‚-Increasedtimeoutto10seconds*­forusewithslowprinters.ééé /&8)@GH@PCXI`?h>pBx7€0ˆ9>˜= Q¨1°=¸<À?È ÐFØ7àDè 4*ˆREV‚2.3318FEB85ˆMIKEDUH-‚ChangedPrinterSTROBE*­instructionstouseaMOVE*­insteadofBCLRandBSET.‚The *­STROBEregisteriswriteonly.7*ˆREV‚2.348MAR85‰DICKV.…Haltroutineregisterchanges*'*ƒPURPOSE:‚CHANNEL(DEVICE)I/OHANDLER*****PRINTERDRIVER*****/*ƒENTRY:‚JSRFROMCMRHANDLER(COMMANDSERVICE) *‹JSRFROMCMRINTERRUPTHANDLER*-*ƒEXIT:-ALWAYSEXITSWITHARTSINSTRUCTION***ƒCODEISRE-ENTRANT**H*-----------------------------------------------------------------------*PRTORG:ŠPAGE*(****************************************(* EQUATES FOR SPECIAL ASCII CHARACTERS *(*****************************************NUL‡EQU„$00NullBEL‡EQU„$07BellBSˆEQU„$08BackspaceLFˆEQU„$0ALinefeedFFˆEQU„$0CFormfeedCRˆEQU„$0DCarriagereturnSPACE…EQU„$20Blank ******************** DEVICE EQUATES ********************(DEV1AD„EQU„0’A-sidedataregisteroffsetéééé+DEV1AC„EQU„2’A-sidecontrolregisteroffset(DEV1BD„EQU„4’B-sidedataregisteroffset+DEV1BC„EQU„6’B-sidecontrolregisteroffset*-STRBSY„EQU„%00000100ŠDevicebusyŠVME050fault4STROUT„EQU„%00000010ŠDeviceoutofpaper‚VME050busy/STRSEL„EQU„%00000001ŠDeviceselected†VME050sel*6DSDVIA„EQU„$3CDisabledA-sideinterrupts‚*1/17/84MLB)DSDVIB„EQU„$3CDisabledB-sideinterrupts*4BIM_CTL3‚EQU„$FF10C7ŒAddressofBIM#1controlreg33BIM_VEC3‚EQU„$FF10CFŒAddressofBIM#1vectorreg3&IRE‡EQU„4’Interruptrequestenablebit *************************** MISCELLANEOUS EQUATES ***************************IOEVCD„EQU„1’I/OeventcodeDVALATM„EQU„1<ŠMOVE.LXIOCPK(A2),D6†Setupaddressofcommandpacket(IOCB).6ŠMOVE.WXIOPLN(A2),D5†Setuplengthofcommandpacket.+ŠMOVE.LCCBTASKA(A5),A1„SetupTCBpointer.&ŠBSR„IOHADRCK‹Callconversionroutine.ŠBRA.S‚PRTU010ŒGoodreturn.)ŠMOVE.B#ISTAIP,D1‰SetupIOSerrorcode.ŠBRA„NRMEXITŒExit.=PRTU010ƒMOVE.LD6,A3ŽSavephysicaladdressofcommandpacket.**‚CheckforHALTcommand.*(ŠCMP.W‚#IOHALT,IOSFCT(A3)HALTcommand?!ŠBEQ„HALTBranchifHALTcommand.** See if channel is busy.*)ŠBTSTW‚#CCBFGBSY,CCBFG(A5)Channelbusy?ŠBEQ.S‚PRTU020ŒBranchifno.6ŠMOVE.B#XSTBSY,D0‰Busy,setupchannelerrorcodeandŠBRA„IOHUSRTN‹Return.ŠPAGE*K****************************************************************************(*‚Findthecommandinthecommandtable.*** PRTU020:8ŠMOVE.WIOSOPT(A3),CCBCOPT(A5)SaveIOCBoptionsinCCB.6ŠMOVE.LXIOUID(A2),CCBCID(A5)SaveDCBpointerinCCB.(ŠMOVE.LA3,CCBCCB(A5)†SaveIOCBpointer.*ŠMOVE.LXIOUID(A2),A4†PickupDCBpointer.9ŠMOVE.LCCBTASKA(A5),CCBTASKB(A5)SetupbuffertaskTCB. -ŠMOVEQ‚#NUMCMDS-1,D0†Setuptheloopcounter./ŠLEA„CMDTBL,A0ŠA0<--addressofcommandtable./ŠMOVE.WIOSFCT(A3),D6†Setupusercommandcode. 8CMDSRCHƒCMP.W‚(A0)+,D6‹Searchthetableforthecommand.ŠDBEQƒD0,CMDSRCH‰* 3ŠBNE.S‚CMDERRIfwefoundthecommandinthetable,8ŠADD.L‚#JMPOFF-2,A0‡getthecorrespondingentryfromthe5ŠMOVE.W(A0),D0Œjumptableandjumptotheroutineto"ŠJMP„(A0,D0.W)Šhandlethecommand. ?CMDERR„MOVE.B#ISTAIF,D1‰Wedidn'tfindit,soexitwitherror. ŠBRA„NRMEXITŠPAGEL******************************************************************************‰WRITE**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB%*‰A6=addressofattachedtask'sTCB***L*****************************************************************************WRITE:5ŠBSR„IOSCOMNŒDothestuffcommontoallI/Ocommands. -ŠBSETW‚#CCBFGBSY,CCBFG(A5)Markchannelbusy.6ŠCLR.L‚CCBRLEN(A5)ˆInitializetheoutputbytecounter.1ŠMOVE.LCCBCHB(A5),A1†Setupdevicebaseaddress. ŠBSR„DEVINIT1‹Setupthedevice.ŠSPC„2=ŠMOVE.LCCBTASKB(A5),A0„PickuptheTCBaddressofIOCBowner;ŠADD.B‚#1,TCBIOCNT(A0)„andincrementhispendingI/Ocount.ŠSPC„2,ŠMOVE.LCCBPTR(A5),A0†Setupbufferpointer.ŠSPC„2@ŠBTSTW‚#IOASNFF,CCBCFIG+IOSATW(A5)Iftheformfeedafterassign4ŠBNE.S‚WRIT010Œattributeis0sendaFFcharacterif)*£thisisthefirstoutputinthecurrent *£assignment.ŠSPC„20ŠTST.B‚DCBBCT(A4)‰Doweneedtodoaformfeed?ŠBNE.S‚WRIT010ŒBranchifno."ŠST…DCBBCT(A4)‰Setformfeedflag.(ŠMOVE.B#FF,D0Yes,setupFFcharacter.!ŠBSR„PRTOUT1ŒGooutputtodevice.ŠBRA.S‚WRIT020ŒReturn. 'WRIT010ƒBSR„PRTOUTStartbufferoutput. !WRIT020ƒUNMASKEnableinterrupts.ŠBRA„CMDEXITŒGOFINISHUPŠPAGE M*******************************************************************************‰REQUESTSTATUS*$*‰Entry:A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M******************************************************************************REQSTAT: *E*‚Gettheaddressofhisdatablockandmoveourconfigurationthere.*2ŠBSR„CNFGADRŒGetthephysicaladdressoftheusers*£configurationblock.ŠSPC„24ŠBSR.S‚STATYPSetupthedevicestatus,channeltype,&*£devicetype,anddrivercodesinthe*£user'sconfigureblock.ŠSPC„2>ŠMOVE.W#VALATM,IOSATM(A0)ReturnthesupportedattributesandBŠMOVE.W#VALPRM,IOSPRM(A0)parametersmasksintheusersconfigure*£block.ŠSPC„2BŠMOVE.L#(IOSPLN/2)-1,D0ƒD0<--loopcontroltomoveentireblock.'REQLOOPƒMOVE.W(A0)+,(A1)+ˆMoveaword.5ŠDBRAƒD0,REQLOOP‰Keepmovinguntilwholeblockmoved. 'ŠMOVE.B#ISTAOK,D1‰ExitwithOKstatus.ŠBRA„NRMEXITŒ*ŠSPC„2*A*„Thissubroutinestoresthecurrentdevicestatus(alwaysready),E*‚channeltype,devicetype,anddrivercodeintotheusersconfigureL*‚block.NotethatthesevaluesarereturnedonlyonRETRIEVEDEVICESTATUS/K*‚CONFIGURATION,CONFIGUREDEVICE,andCHANGEDEFAULTCONFIGURATIONrequests/*‚onlywhennoconfigurtionerrorwasdetected.*5STATYP„CLR.B‚IOSDST(A0)‰Returnon-linedevicestatus.AŠMOVE.BCCBTYPE(A5),IOSCTP(A0)Returnthechanneltypedefinedin *¨theCCB.2ŠMOVE.B#XDSPRT,IOSDTP(A0)DevicetypeisPRINTER.>ŠMOVE.B#IODLPRT,IOSDRC(A0)ThisisalocalCentronicsprinter&*¨driverforuseontheEXORmacsDEBUG#*¨PIAportoranMVME410PIAonthe*¨I/OChannel.ŠRTSŠPAGEM****************************************************************************** *‰CONFIGURE*@*‰ThiscommandchangestheCCBconfiguration,theonefromwhich<*‰thedriversetsupthedeviceandunderwhichitperforms.*,*‰Entry:A2=addressofCMRparameterblock*A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M****************************************************************************** CONFIGUR: *B*‚Getthephysicaladdressoftheuser'sconfigurationdatablock.*2ŠBSR„CNFGADRŒGetthephysicaladdressoftheusers*£configurationdatablock.ŠSPC„21ŠMOVE.LXIOUID(A2),A4†A4<--baseaddressofDCB. =ŠMOVE.B#CECCDO,D2‰Ifhe'stryingtochangethewritetimeout?ŠBTSTW‚#IOSWTOB,IOSPRM(A1)value,returnaconfigurationerror. ŠBNE„CNFGERRŠSPC„2DŠMOVE.LDCBDEV+IOSWTO(A4),IOSWTO(A0)Update(intheCCB)thetimeout/ŠBRA.S‚CMNCNFGŒvaluesfromtheDCB,sotheycan,*£becopied,anddothecommonconfiguration *£processing.ŠPAGEM*******************************************************************************‰CHANGEDEFAULTCONFIGURATION*6*‰ThiscommandchangestheDCBconfiguration,towhich4*‰IOSwillrestoreus(viaaCONFIGUREcommand)when/*‰FHSclosesthelastallocationofthedevice.*$*‰Entry:A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M***************************************************************************** CHNGDEF: *H*‚Firstgetthephysicaladdressoftheuser'sconfigurationdatablock.*8ŠBSR„CNFGADR2‹Gettheaddressoftheusersconfiguration,*£datablock.ThisentrypointpreservesA0.ŠSPC„27ŠMOVE.LXIOUID(A2),A0†LoadtheaddressoftheDCBinA46ŠMOVE.LA0,A4ŽandtheaddressoftheDCBconfigurationŠADD.L‚#DCBDEV,A0‰blockinA0. ŠPAGEM*******************************************************************************‰COMMONCONFIGURATIONROUTINE*7*‰Thisroutinedoestheworkcommontothetwocommands-*‰CONFIGUREandCHANGEDEFAULTCONFIGURATION.*7*‰Entry:A0=AddressofCCBorDCBconfigurationblock,*A1=Addressofuser'sconfigurationblock*M***************************************************************************** CMNCNFG:*L*ƒFirst,boththeattributesandparametersmasksarecheckedtoseeifbits L* corresponding to unsupported attributes or parameters are set. If any such2* bits are set, a configuration error is returned.*7ŠMOVE.W#CECUAP,D2‰Setupforanerrorexitincasethe&*£useristryingtochangeunsupported*£attributesorparameters.ŠSPC„29ŠMOVE.W#NVALATM,D0ˆZerothebitsoftheusersattributes<ŠAND.W‚IOSATM(A1),D0†maskthatcorrespondtosupportedpara-5ŠBNE.S‚CNFGERRŒmeters.Ifanyremainingbitsareset,*£returnanerror.ŠSPC„29ŠMOVE.W#NVALPRM,D0ˆZerothebitsoftheusersattributes<ŠAND.W‚IOSPRM(A1),D0†maskthatcorrespondtosupportedpara-5ŠBNE.S‚CNFGERRŒmeters.Ifanyremainingbitsareset,*£returnanerror.ŠSPC„2E*‚Nextweneedtoseewhathisproposedconfigurationwilllooklike.D*‚Plugintohisdatablockthecurrentvaluesforthoseattributes&?*‚parametershedoesn'twanttochange.‚Theappropriatecurrent(*‚configurationisatA0andhe'satA1.*ŠOPT„BRS6ŠMOVE.WIOSATM(A1),D0†Setuptheusersattributemask.;ŠAND.W‚D0,IOSATW(A1)†Zeroouttheattributesofhisthathe.ŠNOT.W‚D0‘doesn'twanttochange,zerooutthe<ŠAND.W‚IOSATW(A0),D0†attributesofminethathedoeswantto:ŠOR.WƒD0,IOSATW(A1)†change,andcombinetheminhisspace. @ŠMOVE.WIOSPRM(A1),D0†Getmaskofparametershewantstochange. 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheLINEWIDTH,'ŠIF…THEN™copythecurrentsetting.MOVE.WIOSREC(A0),IOSREC(A1)ŠENDI 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheLINES/PAGE,'ŠIF…THEN™copythecurrentsetting.MOVE.LIOSRSZ(A0),IOSRSZ(A1)ŠENDI 3ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheWRITETIMEOUT.ŠIF…THEN•value,copythecurrentsetting.MOVE.LIOSWTO(A0),IOSWTO(A1)ŠENDI 3ŠLSR.W‚#2,D0ŽSkipovertheREADTIMEOUTbit.Ifthe'*£LOGICALRECORDLENGTHbitisnotset,*£copythecurrentsetting.ŠIF…THENŠMOVE.WIOSLRL(A0),IOSLRL(A1)ŠENDI 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheEND-OF-LINE/ŠIF…THEN”STRING,copythecurrentsetting.MOVE.BIOSELC(A0),IOSELC(A1)ŠENDIŠOPT„BRL*I*ƒNowthattheusersconfigurationblockcontainstheproposedattributesG* and parameters, they will be checked for validity before copying them* into the DCB or CCB.*8ŠMOVE.B#CECPNI,D2‰Iftheauto-linefeedattributeisset@ŠBTSTW‚#IOALNFD,IOSATW(A1)andtheendoflinecharacterisnull,ŠBEQ.S‚CMNC001Œreturnaconfigurationerror.ŠTST.B‚IOSELC(A1)ŠBEQ.S‚CNFGERRŠSPC„2CCMNC001ƒMOVE.B#CECPRLZ,D2ˆIfeitherthelogicalorphysicalrecord<ŠMOVE.WIOSREC(A1),D0†lengthiszero,returnaconfigurationŠBEQ.S‚CNFGERRŒerror.ŠMOVE.WIOSLRL(A1),D3ŠBEQ.S‚CNFGERRŠSPC„24ŠCMP.W‚D3,D0ŽIfthelogicalrecordlengthisgreater5ŠBHS.S‚OKCNFGthanthephysicalrecordlength,return*ŠMOVE.B#CECPLGP,D2ˆaconfigurationerror.ŠSPC„2ACNFGERRƒMOVE.B#ISTACFG,D1ˆReturnaconfigurationerrorstatusin>ŠMOVE.BD2,IOSCEC(A1)†theusersIOSparameterblockandreturn8ŠBRA.S‚CNFGEXIT‹thespecificconfigurationerrorcodein *£theusersconfigurationblock.ŠSPC„2F*…SettheconfigurationflagbyteinthedeviceDCBtoindicatethataK*‚CONFIGUREorCONFIGUREDEFAULTSrequestwasprocessed.FHSwillchecktheM*‚flagwhenitclosesthelastassignmenttothedevicetoseeifitneedstoH*‚tellIOStoissueaconfigurerequest.IOSwillthenissueaCONFIGUREJ*‚requestusingthedeviceDCBdefaultconfigurationparameters.ThiswillI*‚alwaysforcethecurrentconfigurationtothedefaultwheneverthelast*‚assignmentisclosed.*I*…SubroutineSTATYPiscalledtostorethecurrentdevicestatus,channelH*‚type,devicetype,anddrivercodeintotheusersconfigurationblock.*ŠMOVE.BCCBRLEN(A5),IOSLEN(A3)UpdateusersIOCBlengthfield.ŠCLR.L‚CCBRLEN(A5)ŠSPC„2=ŠMOVE.LCCBTASKB(A5),A0„PickuptheTCBaddressofIOCBowner;ŠSUB.B‚#1,TCBIOCNT(A0)„anddecrementhispendingI/Ocount.ŠSPC„2*!*‚Preparetheeventandqueueit.*8ŠMOVE.B#ISTATO,IOSSTA(A3)UpdatetheIOCBstatusfield.,ŠMOVE.W#ISTATO,D3‰Setupeventstatusfield-ŠMOVE.B#XPSHLT,D1‰Setupeventstatusvalue.!ŠMOVE.L#6,D0ŽSetupinfolength.&ŠMOVE.LCCBCID(A5),D2†SetupeventID..ŠLEA„CCBPKT(A5),A4†Setupeventbuildpointer.ŠBSR„QEVNTŽQueueevent.ŠBRA„CMDEXITŒRETURN ŠPAGEL******************************************************************************C*‰ROUTINECOMMONTOALLI/OCOMMANDS(READ,WRITE,OUTPUTW/INPUT)**‚Entry:A3=addressofIOCB*‰A5=addressofCCB**L*****************************************************************************IOSCOMN:?ŠBTSTW‚#IOPTSKB,IOSOPT(A3)Ifthebuffersresideinadifferent"ŠBEQ.S‚IOSC005ŒtaskfromtheIOCB, 9ŠLEA„IOSTSK(A3),A0†Pointtothetaskname&sessionofthe7ŠTR0$.GETTCB,bufferowner&callexectogetaddress."ŠBRA.S‚OKTCBŽIfit'sgood,branch.ŠNOP—Ifit'sbad,6ŠMOVE.B#XSTADB,D1‰setstatusinIOCBtoaddresserrorŠTST.L‚(A7)+ŽadjuststackŠBRA.S‚NRMEXITŒandexittoCMR. :OKTCB…MOVE.LA0,CCBTASKB(A5)„SavephysicaladdressofTCB. *<*‚ValidatetheinfointheIOCBabouttheprimarybufferand *‚converttophysicaladdresses.*BIOSC005ƒMOVE.LIOSSAD(A3),D6†D6<--bufferphysicalstartaddress.+ŠMOVE.LIOSEAD(A3),D5†D5<--bufferlength.ŠSUB.L‚D6,D5Ž* ŠADDQƒ#1,D5Ž*ŠSPC„25ŠMOVE.LD5,-(A7)‹Savethebufferlengthonthestack.ŠSPC„2>ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner."ŠBSR.S‚IOHADRCK‹Checktheaddress.$ŠBRA.S‚IOSC010ŒIfit'sgood,branch.9ŠADDQ.L#8,A7ŽIfit'sabadbaseaddress,removesavedD5&*£andadjustthestackreturnaddress.ŠSPC„24ŠMOVE.B#ISTAADD,D1ˆSetIOCBstatustoADDRESSERROR6ŠBRA.S‚NRMEXITŒandexitwithappropriateerrorstatus. @IOSC010ƒMOVE.LD6,CCBPTR(A5)†SavephysicalstartaddressinCCB. 2ŠADD.L‚(A7)+,D6‹Savethephysicalendaddressplus&ŠMOVE.LD6,CCBEAP1(A5)…oneintheCCB.ŠRTSŠPAGEK****************************************************************************=*‰VALIDATECONFIGURATIONBUFFERADDRESS&CONVERTTOPHYSICAL*$*‰Entry:D5=bufferlengthinbytes-*D6=bufferlogicalstartaddr(toconvert)*A3=addressofIOCB*A5=addressofCCB***‰Exit:‚D6ƒ=bufferphysicalstartaddress*D5ƒ=bufferlength*K****************************************************************************CCNFGADRƒLEA.L‚CCBCFIG(A5),A0…ThisentrypointloadstheCCBconfig.*£datablockintoA0.ŠSPC„2.CNFGADR2‚MOVE.LA0,-(A7)‹SaveA0onthestack.?ŠMOVE.LIOSDBP(A3),D6†D6<--logicaladdrofuser'sdatablock./ŠMOVE.L#IOSPLN,D5‰D5<--lengthofdatablock.ŠSPC„2>ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner."ŠBSR.S‚IOHADRCK‹Checktheaddress.%ŠBRA.S‚CNFGADR3‹Ifit'sgood,branch.ŠSPC„27ŠADD.L‚#8,A7ŽIftheaddressorlengthisbad,cleanthe<ŠMOVE.B#ISTAADD,D1ˆstack,setIOCBstatustoADDRESSERROR,6ŠBRA.S‚NRMEXITŒandexitwithappropriateerrorstatus.ŠSPC„2=CNFGADR3‚MOVE.LD6,A1ŽStorethephysicaladdressoftheusers9ŠMOVE.L(A7)+,A0‹datablockinA1,restoreA0andreturn.ŠRTSŠPAGEO******************************************************************************** *ˆNORMALEXIT*,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB*‰D1=IOSerrorcode*I**************************************************************************NRMEXIT:*ŠLEA„CCBPKT(A5),A4†Setupqueueworkarea.!ŠMOVE.L#6,D0ŽSetuppacketsize.#ŠMOVE.LXIOUID(A2),D2†SetupPBid.#ŠAND.W‚#$FF,D1ŒMaskforwordvalue."ŠMOVE.WD1,D3ŽSetupstatusvalue./ŠMOVE.BD1,IOSSTA(A3)†UpdateIOCBstatusfield.%ŠMOVE.B#XPSNRM,D1‰Setupeventtype.ŠBSR„QEVNTŽGoqueueevent.CMDEXITƒCLR.L‚D0*8* User request side of IOH always exits from this point.*IOHUSRTN‚EQU„*ŠRTS—RETURNTOMAINLINEŠPAGEK****************************************************************************B*ƒSubroutinetocheckaddressboundariestoseeifentirelywithin* calling tasks address space.*&*‚Entry:D5-‚numberofbytestocheck*‰D6-‚68000address(logical)*‰A1-‚TCBaddress***** EXEC ROUTINE#* REGISTERS USED: D0-D1,D3,D6/A0-A1**7*EXIT:„D6-PHYSICALADDRESSOFBUFFERBASE(IFLEGAL)*ŠRETURNTOPC„FORGOODADDRESS*”PC+2‚FORBADLENGTH*”PC+4‚FORBADADDRESS*F*********************************************************************** IOHADRCK:%ŠBTSTƒ#0,D6ŽMustbeonworkboundary.)ŠBNE.S‚IOHADR6ŒBranchifbadbufferbase.ŠTST.L‚D5‘Lengthcan'tbezero.2ŠBEQ.S‚IOHADR8ŒDon'tgotologphywithzerocount. IOHADR2ƒEQU„*1ŠMOVE.LTCBTST(A1),A0†Addressoftaskseg.table. ŠTR0$.LOGPHY.ŠBRA.S‚IOHADR8ŒBranchforgoodaddressreturn.3IOHADR6ƒADD.L‚#2,(A7)ŒAdjustPCforinvalidreturn.IOHADR8ƒRTS—Return.ŠPAGEI***************************************************************************ˆGETTCBROUTINE*)*’ENTRY:A0=POINTERTOTASKANDSESSION***’EXECROUTINE*’REGISTERSUSED:D0-D1/A0-A1***’EXIT:A0=TCBADRESS**˜RETURNTOPC„FORGOODTASKSPECIFICATION!*¢PC+2‚FORBADTASKSPECIFICATION**J***************************************************************************GETTCB: ŠTR0$.GETTCB&ŠBRA.S‚GETT10Goodtaskspecification.ŠNOP—Badtaskspecification.&ŠADD.L‚#2,(A7)ŒBadtaskspecification.GETT10„RTS—Return.ŠPAGEL******************************************************************************‚PRTOUT*%*ˆThisistheprinteroutputroutine.***ˆENTRY:‚A0=addressofbuffer*A1=addressofdevicebase*A3=addressofIOCB*A4=addressofDCB*A5=addressofCCB*.* PRTOUT1 ENTRY: D0.B = character to be output*—otherregistersasabove* M******************************************************************************CPRTIMG„ADD.L‚#1,CCBRLEN(A5)…Forimagemode,counteachbytesentto>ŠCMP.L‚CCBEAP1(A5),A0…theprinterwhetherprintableornot.If6ŠBEQ.S‚PRT070theendofthebufferisreached,dothe *£requestcompletionprocessing.ŠSPC„2PRTOUT:0ŠMOVE.B(A0)+,D0‹Getnextdatabytefrombuffer.,ŠMOVE.LA0,CCBPTR(A5)†Updatebufferpointer.ŠSPC„2;ŠBTSTW‚#IOPFORB,CCBCOPT(A5)Forimagemodeoutput,skipthe,ŠBNE.S‚PRTOUT1Œspecialcharacterprocessing.ŠSPC„20ŠCMP.B‚#CR,D0Ifthecurrentbuffercharacteris,ŠBEQ.S‚PRT030aCR,proceedwithend-of-line *£processing.ŠSPC„2+PRTOUT1ƒBSR.L‚DEVOUTSŒOutputthedatabyte.ŠSPC„2EPRT010„BTSTW‚#IOPFORB,CCBCOPT(A5)Iftheoutputisbringperformedin1ŠBNE.S‚PRTIMGimagemode,transfercontroltothe%*£topoftheoutputlooptocheckfor*£endofbuffer.ŠSPC„25ŠCMP.B‚#'',-1(A0)ˆIfthecurrentbuffercharacteris,ŠBLT.S‚PRT017non-printing,donotcheckfor(*£end-of-lineorincrementthecharacter*£countŠSPC„25ŠADD.L‚#1,CCBRLEN(A5)…Incrementtheprintedcharacter*£count.ŠSPC„29ŠMOVE.LCCBRLEN(A5),D2…DividetheprintedcharactercountAŠDIVUƒCCBCFIG+IOSLRL(A5),D2bythelogicallinelength.Storethe+ŠSWAPƒD2‘remainderinthelowerhalfofD2.ŠSPC„2*ŠTST.W‚D2‘Ifanexactlogicalandphysical4ŠBNE.S‚PRT017end-of-linehasbeenreached,outputaN* The following line was added to the VME050 printer driver to fix the problemL*oftheoriginaldriver.‚ItdidacomparisonofthephysicallinelengthtoH*registerD3.‚Thisregisterwasneversetup.‚Ithinktheintentwasto>* compare the physical line length to the logical line length.:ŠMOVE.WCCBCFIG+IOSLRL(A5),D3Loadthelogicallinelength*@ŠCMP.W‚CCBCFIG+IOSREC(A5),D3linefeedfornon-auto-LFdevice.If3ŠBEQ.S‚PRT013onlythelogicallinelengthhasbeen3ŠBSR.S‚PRTEOLreached,outputalogicalend-of-line2ŠBRA.S‚PRT015sequence.Ifneitherlengthhasbeen&*£reachedproceedtotheend-of-buffer*£check.ŠSPC„2GPRT013„BTSTW‚#IOALNFD,CCBCFIG+IOSATW(A5)Ifthedevicedoesnotsupport0ŠBNE.S‚PRT015autolinefeed,outputalinefeed5ŠMOVE.B#LF,D0ifthebytecountisanexactmultiple"ŠBSR.S‚DEVOUTSŒofthelinelength.ŠSPC„2FPRT015„BTSTW‚#IOATPLL,CCBCFIG+IOSATW(A5)Sinceanend-of-linehasbeen/ŠBNE.S‚PRT070reached,terminatetherequestif!*£thetruncateprintattributeis*£set.ŠSPC„2=PRT017„CMP.L‚CCBEAP1(A5),A0…Iftheendofbufferhasnotbeen/ŠBLT„PRTOUTreached,outputthenextcharacter.ŠSPC„2:PRT030„BSR.S‚PRTEOLOutputalogicalend-of-linesequence.ŠPAGEPRT070:*2*‚Finishedtransfer,nowqueueeventtorequestor.*+ŠBCLRW‚#CCBFGBSY,CCBFG(A5)Clearbusyflag.,ŠMOVE.LCCBTASKB(A5),A0„PickupTCBaddress.3ŠSUB.B‚#1,TCBIOCNT(A0)„DecrementI/Opendingcount. -ŠMOVE.W#ISTAOK,D3‰SetupokIOSstatuscode.#ŠAND.B‚#$01,D0ŒOnlyworryaboutsel!ŠCMP.B‚#$01,D0ŒCheckforselected ŠBEQ.S‚PRT0801ŠMOVE.W#ISTANR,D3‰Fault,setupIOSstatuscode.-PRT080„MOVE.L#6,D0ŽSetupeventinfolength.*ŠMOVE.B#XPSNRM,D1‰Setupeventtypecode.)ŠMOVE.LCCBCID(A5),D2†SetupDCBaddress./ŠMOVE.BD3,IOSSTA(A3)†UpdateIOCBstatusfield.8ŠMOVE.LCCBRLEN(A5),IOSLEN(A3)UpdateIOCBlengthfield. *ŠLEA„CCBPKT(A5),A4†Setupeventdataarea./ŠBSR„QEVNTŽQueuecompletioneventtorequestor. !ŠIF.BƒCCBPTRTE(A5)ƒ#0THEN.SRTSELSE.S BRA„PRTINRTEŠENDIŠPAGE*E*‹ThissubroutineoutputseitheraLF-CRsequenceoranEOLcharacter6*‰basedonthesettingoftheauto-linefeedattribute.*#PRTEOL„MOVE.BCCBCFIG+IOSELC(A5),D0?ŠBTSTW‚#IOALNFD,CCBCFIG+IOSATW(A5)Ifnotanexactend-of-line,4ŠBNE.S‚DEVOUTSŒoutputtheEOLcharacteriftheauto-(*§linefeedattributeisset.Elseoutput*§aLFandCR.ŠSPC„2/ŠMOVE.B#LF,D0CallDEVOUTtooutputalinefeed.ŠBSR.S‚DEVOUTcharacter.Ifanerrorstatusis1ŠTST.B‚D3‘returnedinD3,transfercontroltotheŠBNE.S‚DEVOUTEŒerrorexit.ŠSPC„2 6ŠMOVE.B#CR,D0SetupcarriagereturncharacterinD0.ŠSPC„2*E*‹ThisroutineiscalledasasubroutinefromPRTOUTtooutputsingleF*‰charactersfromD0withautomaticrequestterminationifanerrorisD*‰detectedintheDEVOUTsubroutine.Executionalsofallsthroughto*‰herefromPRTEOL.*8DEVOUTSƒBSR.S‚DEVOUTCallDEVOUTtooutputthecharacter5ŠTST.B‚D3‘inD0.IfthestatusreturnedinD3isnon-'ŠBEQ.S‚DEVOUTOK‹zero,doanerrorexit.ŠSPC„2:DEVOUTEƒTST.L‚(A7)+ŽIfanerroroccurstransfercontrolto-ŠPEA.L‚PRT070therequestcompletionroutine.ŠSPC„2+DEVOUTOK‚RTS—Returntothecallingroutine.ŠPAGEO*********************************************************************************‚DEVOUT(*****MODIFIED1/27/83BYM.BRIEL*******<*†1.Checkforadevicefault(not-selectedoroutofpaper).=*ˆIfafaultispresent,terminatetherequestwithanerror.*F*†2.IfanPrinterAcknowledgeisexpected,waitfortheACKpulsefor@*‰approx.100us.Ifthepulsedoesnotarrivein100us,enable0*‰theAcknowledgeinterruptandexitthedriver.*4*†3.OutputthenextcharacterandpulseDataStrobe**ˆENTRY:„D0‚=databyte*’A1‚=devicebaseaddress*‘(SP)=returnaddress*4(SP)=PRTOUTreturnaddress*DEVICE=Interruptsdisabled*,*ˆEXIT:…D0‚=Devicestatusregistercontents*NORMAL=(SP)return*FAULT=(SP)+2return5*‘BUSY=4(SP)PRTOUTreturnaddress(deviceenabled)*K****************************************************************************DEVOUT:.ŠCLR.B‚D3‘ClearD3inpreparationforanormal *£return.ŠSPC„2 ŠCLR.L‚D1.ŠMOVE.BDEV1BD(A1),D1†Pickupstatusregister. ŠMOVE.LD1,D2ŽMakeanothercopy.&ŠAND.B‚#$01,D1ŒMaskuninterestedbits.'ŠCMP.B‚#$01,D1ŒIstheprinterselected?ŠBNE.S‚DEV010Faultexitifno.ŠSPC„2:ŠTST.B‚CCBACKP(A5)ˆIfaprinteracknowledgeisnotpending,ŠBEQ.S‚DEV020proceedwithcharacteroutput.ŠSPC„2:ŠMOVE.W#32,D1RepeatedlytestfortheprinteracknowledgeDEVACKŠBTST.B#7,DEV1BD(A1);ŠDBNEƒD1,DEVACKŠthelooptimesout(approx.100us)proceed**£withcharacteroutput.Otherwise,enable**£theAcknowledgepulseinterruptandexit *£thedriver.ŠSPC„2 ŠBNE.S‚DEV020 * Enable ACK Interrupt and Exit. :ŠMOVE.BD0,CCBSAVB(A5)…Thedeviceisbusy,savedatabyte..ŠMOVE.L(A7)+,CCBIRTN(A5)‚Savereturnaddress.-ŠSUB.L‚#2,CCBIRTN(A5)…Adjustserviceaddress.ŠSPC„2AŠMOVE.L(A7)+,CCBISTK(A5)‚SavesubroutinereturnaddressintoCCBŠSPC„2 *;*ƒSetupTIMEOUTcallincaseofafault(NoACKinterrupt)*CŠMOVEM.LD0-D2/A0-A1,-(A7)SaveregistersusedbyTIMEOUT(EXRQPA)./ŠMOVE.L#34,D0ServicerequestcodeforEXRQPA.ŠCLR.L‚D1‘HSKP-ŠMOVE.BCCBPPRIO(A5),D1„Saveinterruptlevel.ŠMOVE.LA5,D2ŽAddressofCCB.ŠLEA„PTIMOUT(PC),A0…Addressofwakeuproutine.9ŠMOVE.L#10000,A1Š***12/19/84‚Setfor10000millisecondsŠTRAPƒ#0ŠNOP—Assumethecallwastaken,ŠMOVEM.L(A7)+,D0-D2/A0-A1Restoreregisters3ŠST.BƒCCBTIMED(A5)‡SetTIMEOUTrequestneededflag. ŠINHIB‚DisableŒinterrupts.1ŠBSETƒ#IRE,BIM_CTL3†EnabledeviceACKinterrupts. ŠRTS—Return. * Fault Exit +DEV010„MOVE.LD2,D0ŽSetupstatusregister.1ŠBSR„DEVINIT1‹Reprogramdevicefornointerrupts.ŠSPC„2’1/17/84MLB*:ŠCLR.B‚CCBACKP(A5)ˆClearpendingprinteracknowledgeflag.ŠTST.B‚DEV1AC(A1)ŠSPC„2’1/17/84MLB*+ŠST…D3‘SetD3non-zerotoindicateanerror$ŠBRA.S‚DEVOEXandpreparetoreturn.ŠPAGE*(*Outputthenextcharacter1/17/84MLB**DEV020ŠTST.B‚DEV1AC(A1)ŠSPC„2’1/17/84MLB*'ŠMOVE.BD0,DEV1AD(A1)†Outputdatabyte.** data strobe:** CHANGED 02/18/85.K*UseMOVEinstructionsfortheSTROBEinsteadofBCLRandBSET.‚TheSTROBEJ*registerisWRITEonly.‚ReadingthisregisterwillcleartheACKNOWLEDGE9*flag.‚BCLRandBSETareREAD-MODIFY-WRITEinstructions.*3ŠMOVE.B#0,DEV1AC(A1)†***02/18/85changedtoMOVE. +ŠMOVE.B#8,DEV1AC(A1)†Strobethedatabyte.ŠSPC„2’1/17/84MLB*8ŠST…CCBACKP(A5)ˆSettheprinteracknowledgependingflagŠSPC„2’1/17/84MLB*0ŠMOVE.BDEV1BD(A1),D0†Getstatusregisteragain.ŠSPC„20DEVOEX„ENABL‚EnableinterruptsandreturntotheŠRTS—callingroutine.ŠPAGEJ**************************************************************************éééééé*!* INTERRUPT SIDE FOR PRT HANDLING*?*ƒPURPOSE:‚HANDLEACKNOWLEDGEMENTSANDMESSAGECOMPLETIONSFROM2*THEIOH.‚OPERATESATHARDWAREINTERRUPTPRIORITY=*LEVELASASUBROUTINETOTHEFIRSTLEVELINTERRUPTHANDLER.*+*ƒENTRY:‚JSR‚FROMINTERRUPTHANDLERROUTINE*‹A0-WORKREGISTER *‹A1=SELF*‹A5=ADDRESSOFCCB*‹D0=WORKREGISTER*/*ƒEXIT:‚RTS-BACKTOINTERRUPTHANDLERROUTINE**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A*****P****ƒEXECROUTINESCALLED:‚QEVENTI**ƒCODEISRE-ENTRANT*F*---------------------------------------------------------------------*4* If channel is off-line or not attached, just exit.*PRTISR:.ŠMOVE.LCCBCHB(A5),A1†Getdevicebaseaddress.2ŠBTST.B#IRE,BIM_CTL3†Aretheinterruptsenabled?ŠBEQ.S‚PRTI005ŒIfnotthenexit*ŠMOVE.BDEV1BD(A1),D0†Readthestatusbits#ŠAND.B‚#$80,D0ŒOnlyworryaboutACKŠBNE.S‚PRTI0109PRTI005ƒAND.W‚#$FFFE,SRŠNointerruptsosetconditionand ŠRTS—return. 5PRTI010ƒCLR.B‚CCBTIMED(A5)‡ClearTIMEOUTneededflag.&ŠBTSTW‚#CCBFGOFF,CCBSTR(A5)Off-line?ŠBNE.S‚PRTI020ŒBranchifyes.5ŠBTSTW‚#CCBFGATH,CCBSTR(A5)Isthechannelattached?ŠBEQ.S‚PRTI020ŒBranchifno.(ŠBTSTW‚#CCBFGBSY,CCBFG(A5)I/Opending?ŠBNE.S‚PRTI100ŒBranchifyes. 8PRTI020ƒMOVE.LCCBCHB(A5),A1†Setupdevicebaseaddress.(ŠBSR„DEVINIT1‹Disabledeviceinterrupts. ŠENABL!ŠOR.Wƒ#$0001,SRŠSetconditionand ŠRTS—return.ŠPAGEN******************************************************************************** INTERRUPT LEVEL PROCESSING*0*ˆIthasbeendeterminedthatI/Oisinprogress*ˆandtheinterruptisours.**N*******************************************************************************PRTI100:=ŠMOVEM.LD1-D7/A2-A4/A6,-(A7)Savetherestoftheregisters.1ŠBSR„DEVINIT1‹Reprogramdevicefornointerrupts.ŠSPC„2’1/17/84MLB*>ŠCLR.B‚CCBACKP(A5)ˆCleartheprinteracknowledgependingflag.ŠTST.B‚DEV1AC(A1)ŠSPC„2’1/17/84MLB*-ŠMOVE.LCCBPTR(A5),A0†Restorebufferpointer. 1ŠMOVE.BCCBSAVB(A5),D0…Restorecurrentdatabyte.5ŠMOVE.LCCBIRTN(A5),A2…Getinterruptserviceaddress.'ŠMOVE.LCCBCCB(A5),A3†GetIOCBaddress.&ŠMOVE.LCCBCID(A5),A4†GetDCBaddress.8ŠADD.B‚#1,CCBICNT(A5)…Incrementpendinginterruptcount.:ŠPEA„PRTINRTN(PC)‡Stacktheinterruptroutineexitaddress>ŠMOVE.LCCBISTK(A5),-(A7)‚Restoresubroutinereturnaddresson*£stack.!ŠJMP„(A2)Jumptooutputroutine. *.* PRT interrupt handler exits from this point.* PRTINRTN:7ŠSUB.B‚#1,CCBICNT(A5)…Decrementpendinginterruptcount0ŠMOVEM.L(A7)+,D1-D7/A2-A4/A6Restoreregisters./***‡ENABL•LetCMRenableinterruptslater,this%***¡fixisforEPSONRX80(SPR1178).(ŠOR.Wƒ#$0001,SRŠSetreturnconditionand!ŠRTS—returntointerrupthandler. 2PRTINRTE‚CLR.B‚CCBPTRTE(A5)‡ClearRTEneededflag..ŠCLR.B‚CCBTIMED(A5)‡ClearTIMEOUTneededflag.ŠENABL0ŠMOVEM.L(A7)+,D2-D7/A2-A6RestoretheregistersŠRTEŠPAGEJ*************************************************************************** * PTIMOUT*E*ƒPURPOSE:‚Thisistheentrypointforawakeupcall.‚Itissetupin?*theDEVOUTroutinewhenanACKNOWLEDGEhasnotbeenreceived.;*ThisroutinewillbeenteredevenifanACKNOWLEDGEcomes<*duringtheTIMEOUT.‚TheflagCCBTIMEDischeckedtoseeif8*aTIMEOUTisstillneeded.‚Thisflagisclearedinthe *ACKNOWLEDGEinterruptroutine.**ƒENTRY:‚FromtheEXEC.*‹D1-AddressoftheCCB*?*ƒEXIT:ƒRTE-MustsaveD2-D7/A2-A6andrestorebeforetheRTE.*J**************************************************************************PTIMOUT:-ŠMOVEM.LD2-D7/A2-A6,-(A7)Savetheregisters&ŠMOVE.LD1,A5ŽPickuptheCCBaddress.'ŠMOVE.LCCBCCB(A5),A3†GetIOCBaddress.&ŠMOVE.LCCBCID(A5),A4†GetDCBaddress.2ŠST.BƒCCBPTRTE(A5)‡FlagtoprocessanRTEonexit.1ŠTST.B‚CCBTIMED(A5)‡DowestillneedtheTIMEOUT?/ŠBEQ.S‚PRTINRTE‹No-musthavereceivedanACK. (ŠBSR„DEVINIT1‹Disabledeviceinterrupts.-ŠCLR.B‚D0‘MakethestatuslooklikeitisnotŠBRA„PRT070selected.ŠPAGEJ**************************************************************************** QEVNT**„Placemessageonuser'sASQ.**ˆA4=addressofeventarea*ˆA5=addressofCCB'*ˆD0=eventlength(minusheaderinfo)*ˆD1=eventtype*ˆD2=4byteid(DCB)*ˆD3=statusvalue(2bytes)*ˆD4=devicestatus(2bytes)*ˆD5=devicenumber(1byte)*J***************************************************************************QEVNT:ŠMOVE.LD0,D6ŽSavelength.5ŠMOVE.L#2,D7ŽOffsetforstaging(noservicevector)./ŠMOVE.B#IOEVCD,1(A4)†Code(noservicevector).)ŠMOVE.LCCBSVVC(A5),2(A4)‚Servicevector.+ŠBEQ.S‚QEVNT10ŒBranchifnoservicevector./ŠADD.L‚#4,D0ŽCorrectlengthforservicevector.7ŠADD.L‚#4,D7ŽCorrectoffsetstagingforservicevector.2ŠADD.L‚#$00800000,(A4)„Correctforservicevector. 1QEVNT10ƒMOVE.BD1,0(A4,D7)ˆCompletioneventtype.*ŠMOVE.BCCBKEY(A5),1(A4,D7)User'sidkey.-ŠADD.L‚#4,D0ŽCompletelengthofreturnevent.6ŠCMP.B‚CCBASQL(A5),D0…User'smaximumASQentrylength.#ŠBLS.S‚QEVNT20ŒBranchiflengthok.0ŠMOVE.BCCBASQL(A5),D0…User'slengthissmaller. &QEVNT20ƒMOVE.BD0,(A4)ŒCorrectlength. /QEVNT40ƒMOVE.LD2,2(A4,D7)ˆSetupstatusvalue.$ŠMOVE.WD3,6(A4,D7)ˆSetupid(DCB).ŠCMP.B‚#6,D6Ž6byteinfo?ŠBEQ.S‚QEVNT50ŒBranchifyes.)ŠMOVE.WD4,8(A4,D7)ˆSetupdevicestatus.ŠCMP.B‚#8,D6Ž8byteinfo?ŠBEQ.S‚QEVNT50ŒBranchifyes.*ŠMOVE.BD5,10(A4,D7)‡Setupdevicenumber.&ŠCLR.B‚11(A4,D7)ŠClearreservedfield.*I* Now let's put the completion into registers and send event to the task.* QEVNT50ƒEQU„*ŠMOVEM.L(A4),D2-D7ŠBSR.S‚IOHQEVNTŠRTSŠPAGEK*****************************************************************************9* ROUTINE TO QUEUE EVENT (ALREADY STAGED IN REGISTERS) TO*ƒ-DRIVINGTASK. *ƒ-EVENTBEGINSINREGISTERD2.***ˆEXECROUTINE/*ˆREGISTERSUSED:D0-D1/A0,A3-A6‚WORKREGISTERS*˜D2-D7‹STAGINGREGISTERS** K**************************************************************************** IOHQEVNT:$ŠMOVEM.LA3-A5,-(A7)‡Ssveregisters.-ŠMOVE.LCCBRQSTA(A5),A0„Caller'sTCBaddress.ŠSPC„26ŠMOVE.L#T0QEVNTI,D0‡Ifthisroutinewascalledduring6ŠTST.B‚CCBICNT(A5)ˆinterruptprocessing,usetheQEVNT3ŠBNE.S‚IOHQ4Žinterruptroutine,elseusethenormal#ŠMOVE.L#T0QEVNTT,D0‡QEVNTroutine. IOHQ4…TRAPƒ#0#ŠBRA.S‚IOHQ5ŽBranchifqueueingok.'ŠMOVEM.L(A7)+,A3-A5‡Restoreregisters.9ŠMOVE.L(A7),CCBQVER1(A5)‚Savecallersaddressfordebug.ŠBRA.S‚IOHQRTN ,IOHQ5…MOVEM.L(A7)+,A3-A5‡Restoreregisters..ŠCLR.L‚CCBQVER1(A5)‡Clearqueueerroraddress. IOHQRTNƒRTS—RETURNŠENDééééé=/*=/*†P115DRV.AF=/*B=/* Chain file to assemble the printer driver for the VME115 board=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to P115DRV.LS=/*=/IFC \1ƒ=ARGP115DRV.LS=/ENDIF=/*%=ASM P115DRV.SA,P115DRV.RO,\1;MRZ=146=/*{ Included files are:=/*ƒ9995.&.TRACE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9999.M68230.M68230.EQ=/*}=/*=ENDéééééé ðŠPAGEJP115DRVƒIDNTƒ4,4VERSAdosVME115LocalPrinterI/OProcessV4.4-08/28/84AŠTTL„VERSADOSVME115LOCALPRINTERHANDLERPROCESSV4.4-08/28/84 ŠLLENƒ120ŠNOLISTŠINCLUDE9995.&.TRACE.EQŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠLIST ŠNOFORMATJ****************************************************************************1* PRT -- REV. 1.00 02NOV81 (TL09) JIM SMITH - IOH9*ˆREV.1.0101FEB82(TL09)JIMSMITH-VECTORCHAIN(IOH)5*ˆREV.1.0223FEB82(TL09)JIMSMITH-IOCBUSE(IOH)5*ˆREV.2.0015APR82(TL09)JIMSMITH-PRINTERDRIVER5*ˆREV.2.0101JUN82(TL09)MARCBRIEL-PRINTERDRIVER5*ˆREV.2.1015JUL82(TL09)MARCBRIEL-PRINTERDRIVER-*ˆREV‚2.2018JAN84ˆMARCBRIEL-PRINTERDRIVER0*ˆREV‚3.0028AUG84ˆMIKEDUH‚-ADAPTEDFORVME115;*ˆREV‚3.0117DEC84ˆMIKEDUH‚-RemovedENABLatPRTINRTNfor *­SPR1178(EpsonRX80printer).*«-FixedHALTroutine.=*ˆREV‚3.0219DEC84ˆMIKEDUH‚-Increasedtimeoutto10seconds*­forusewithslowprinters.ééé ù+ DE@"H*C2?:>B9J*R=Z=b>jNr2z;‚9Š6’Aš0¢<ª+8*ˆREV‚3.038MAR85‰DICKV.ƒ-HALTROUTINEREGISTERCHANGE*&*ƒPURPOSE:‚VME115LOCALPRINTERDRIVER*/*ƒENTRY:‚JSRFROMCMRHANDLER(COMMANDSERVICE) *‹JSRFROMCMRINTERRUPTHANDLER*-*ƒEXIT:-ALWAYSEXITSWITHARTSINSTRUCTION***ƒCODEISRE-ENTRANT**H*-----------------------------------------------------------------------**‚INCLUDEDFILES:**„INCLUDE9995.&.TRACE.EQ*„INCLUDE9995.&.STR.EQ*„INCLUDE9995.&.TCB.EQ*„INCLUDE9995.&.CCB.EQ*„INCLUDE9995.&.IOE.EQ*„INCLUDE9995.&.NIO.EQ*„INCLUDE9995.&.LV5.EQ*„INCLUDE9999.M68230.M68230.EQ*PRTORG:‰INCLUDE9999.M68230.M68230.EQ‰PAGE(****************************************(* EQUATES FOR SPECIAL ASCII CHARACTERS *(*****************************************NUL†EQU‡$00‘NullBEL†EQU‡$07‘BellBS‡EQU‡$08‘BackspaceLF‡EQU‡$0A‘LinefeedFF‡EQU‡$0C‘FormfeedCR‡EQU‡$0D‘CarriagereturnSPACE„EQU‡$20‘Blank*************************** MISCELLANEOUS EQUATES *éé éé**************************IOEVCD„EQU„1’I/OeventcodeDVALATM„EQU„1<ŠMOVE.LXIOCPK(A2),D6†Setupaddressofcommandpacket(IOCB).6ŠMOVE.WXIOPLN(A2),D5†Setuplengthofcommandpacket.+ŠMOVE.LCCBTASKA(A5),A1„SetupTCBpointer.&ŠBSR„IOHADRCK‹Callconversionroutine.ŠBRA.S‚PRTU010ŒGoodreturn.)ŠMOVE.B#ISTAIP,D1‰SetupIOSerrorcode.ŠBRA„NRMEXITŒExit.=PRTU010ƒMOVE.LD6,A3ŽSavephysicaladdressofcommandpacket.**‚CheckforHALTcommand.*(ŠCMP.Wƒ#IOHALT,IOSFCT(A3)…HALTcommand?!ŠBEQ…HALT“BranchifHALTcommand.** See if channel is busy.*)ŠBTSTW‚#CCBFGBSY,CCBFG(A5)‚Channelbusy?ŠBEQ.S‚PRTU020ŽBranchifno.6ŠMOVE.B#XSTBSY,D0‹Busy, setupchannelerrorcodeandŠBRA„IOHUSRTNReturn.ŠPAGE*K****************************************************************************(*‚Findthecommandinthecommandtable.*** PRTU020:8ŠMOVE.WIOSOPT(A3),CCBCOPT(A5)SaveIOCBoptionsinCCB.6ŠMOVE.LXIOUID(A2),CCBCID(A5)‚SaveDCBpointerinCCB.(ŠMOVE.LA3,CCBCCB(A5)†SaveIOCBpointer.*ŠMOVE.LXIOUID(A2),A4†PickupDCBpointer.9ŠMOVE.LCCBTASKA(A5),CCBTASKB(A5)‚SetupbuffertaskTCB. -ŠMOVEQ‚#NUMCMDS-1,D0†Setuptheloopcounter./ŠLEA„CMDTBL,A0ŠA0<--addressofcommandtable./ŠMOVE.WIOSFCT(A3),D6†Setupusercommandcode. 8CMDSRCHƒCMP.W‚(A0)+,D6‹Searchthetableforthecommand.ŠDBEQƒD0,CMDSRCH‰* 3ŠBNE.S‚CMDERRIfwefoundthecommandinthetable,8ŠADD.L‚#JMPOFF-2,A0‡getthecorrespondingentryfromthe5ŠMOVE.W(A0),D0Œjumptableandjumptotheroutineto"ŠJMP„(A0,D0.W)Šhandlethecommand. ?CMDERR„MOVE.B#ISTAIF,D1‰Wedidn'tfindit,soexitwitherror. ŠBRA„NRMEXITŠPAGEL******************************************************************************‰WRITE**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB%*‰A6=addressofattachedtask'sTCB***L*****************************************************************************WRITE:5‰BSR‡IOSCOMNDothestuffcommontoallI/Ocommands. -‰BSETW…#CCBFGBSY,CCBFG(A5)Markchannelbusy.6‰CLR.L…CCBRLEN(A5)‰Initializetheoutputbytecounter.1‰MOVE.L„CCBCHB(A5),A1‡Setupdevicebaseaddress. ‰BSR‡DEVINIT1ŒSetupthedevice.‰SPC‡2=‰MOVE.L„CCBTASKB(A5),A0‡PickuptheTCBaddressofIOCBowner;‰ADD.B…#1,TCBIOCNT(A0)…andincrementhispendingI/Ocount.‰SPC‡2,‰MOVE.L„CCBPTR(A5),A0‡Setupbufferpointer.‰SPC‡2@‰BTSTW…#IOASNFF,CCBCFIG+IOSATW(A5)Iftheformfeedafterassign4‰BNE.S…WRIT010attributeis0sendaFFcharacterif)*¦thisisthefirstoutputinthecurrent *¦assignment.‰SPC‡20‰TST.B…DCBBCT(A4)ŠDoweneedtodoaformfeed?‰BNE.S…WRIT010Branchifno."‰STˆDCBBCT(A4)ŠSetformfeedflag.(‰MOVE.B„#FF,D0ŽYes,setupFFcharacter.!‰BSR‡PRTOUT1Gooutputtodevice.‰BRA.S…WRIT020Return. 'WRIT010‚BSR‡PRTOUTŽStartbufferoutput. !WRIT020‚UNMASK˜Enableinterrupts.‰BRA‡CMDEXITGOFINISHUP‰PAGEM*******************************************************************************‰REQUESTSTATUS*$*‰Entry:A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M******************************************************************************REQSTAT: *E*‚Gettheaddressofhisdatablockandmoveourconfigurationthere.*2ŠBSR„CNFGADRŒGetthephysicaladdressoftheusers*£configurationblock.ŠSPC„24ŠBSR.S‚STATYPSetupthedevicestatus,channeltype,&*£devicetype,anddrivercodesinthe*£user'sconfigureblock.ŠSPC„2>ŠMOVE.W#VALATM,IOSATM(A0)„ReturnthesupportedattributesandBŠMOVE.W#VALPRM,IOSPRM(A0)‚parametersmasksintheusersconfigure*¤block.ŠSPC„2BŠMOVE.L#(IOSPLN/2)-1,D0ƒD0<--loopcontroltomoveentireblock.'REQLOOPƒMOVE.W(A0)+,(A1)+ˆMoveaword.5ŠDBRAƒD0,REQLOOP‰Keepmovinguntilwholeblockmoved. 'ŠMOVE.B#ISTAOK,D1‰ExitwithOKstatus.ŠBRA„NRMEXITŒ*ŠSPC„2*A*„Thissubroutinestoresthecurrentdevicestatus(alwaysready),E*‚channeltype,devicetype,anddrivercodeintotheusersconfigureL*‚block.NotethatthesevaluesarereturnedonlyonRETRIEVEDEVICESTATUS/K*‚CONFIGURATION,CONFIGUREDEVICE,andCHANGEDEFAULTCONFIGURATIONrequests/*‚onlywhennoconfigurtionerrorwasdetected.*5STATYP„CLR.B‚IOSDST(A0)ŽReturnon-linedevicestatus.AŠMOVE.BCCBTYPE(A5),IOSCTP(A0)‚Returnthechanneltypedefinedin *¨theCCB.2ŠMOVE.B#XDSPRT,IOSDTP(A0)†DevicetypeisPRINTER.?ŠMOVE.B#IODLPRT,IOSDRC(A0)…ThisisalocalCentronicsprinter.ŠRTSŠPAGEM****************************************************************************** *‰CONFIGURE*@*‰Thisc ommandchangestheCCBconfiguration,theonefromwhich<*‰thedriversetsupthedeviceandunderwhichitperforms.*,*‰Entry:A2=addressofCMRparameterblock*A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M****************************************************************************** CONFIGUR: *B*‚Getthephysicaladdressoftheuser'sconfigurationdatablock.*2ŠBSR„CNFGADRŒGetthephysicaladdressoftheusers*£configurationdatablock.ŠSPC„21ŠMOVE.LXIOUID(A2),A4†A4<--baseaddressofDCB. =ŠMOVE.B#CECCDO,D2ŠIfhe'stryingtochangethewritetimeout?ŠBTSTW‚#IOSWTOB,IOSPRM(A1)value,returnaconfigurationerror. ŠBNE„CNFGERRŠSPC„2DŠMOVE.LDCBDEV+IOSWTO(A4),IOSWTO(A0)Update(intheCCB)thetimeout/ŠBRA.S‚CMNCNFGŒvaluesfromtheDCB,sotheycan,*£becopied,anddothecommonconfiguration *£processing.ŠPAGEM*******************************************************************************‰CHANGEDEFAULTCONFIGURATION*6*‰ThiscommandchangestheDCBconfiguration,towhich4*‰IOSwillrestoreus(viaaCONFIGUREcommand)when/*‰FHSclosesthelastallocationofthedevice.*$*‰Entry:A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M***************************************************************************** CHNGDEF: *H*‚Firstgetthephysicaladdressoftheuser'sconfigurationdatablock.*8ŠBSR„CNFGADR2‹Gettheaddressoftheusersconfiguration,*£datablock.ThisentrypointpreservesA0.ŠSPC„27ŠMOVE.LXIOUID(A2),A0ˆLoadtheaddressoftheDCBinA46ŠMOVE.LA0,A4ŽandtheaddressoftheDCBconfigurationŠADD.L‚#DCBDEV,A0‰blockinA0. ŠPAGEM*******************************************************************************‰COMMONCONFIGURATIONROUTINE*7*‰Thisroutinedoestheworkcommontothetwocommands-*‰CONFIGUREandCHANGEDEFAULTCONFIGURATION.*7*‰Entry:A0=AddressofCCBorDCBconfigurationblock,*A1=Addressofuser'sconfigurationblock*M***************************************************************************** CMNCNFG:*L*ƒFirst,boththeattributesandparametersmasksarecheckedtoseeifbitsL* corresponding to unsupported attributes or parameters are set. If any such2* bits are set, a configuration error is returned.*7ŠMOVE.W#CECUAP,D2‹Setupforanerrorexitincasethe&*£useristryingtochangeunsupported*£attributesorparameters.ŠSPC„29ŠMOVE.W#NVALATM,D0ŠZerothebitsoftheusersattributes<ŠAND.W‚IOSATM(A1),D0†maskthatcorrespondtosupportedpara-5ŠBNE.S‚CNFGERRŒmeters.Ifanyremainingbitsareset,*£returnanerror.ŠSPC„29ŠMOVE.W#NVALPRM,D0ŠZerothebitsoftheusersattributes<ŠAND.W‚IOSPRM(A1),D0†maskthatcorrespondtosupportedpara-5ŠBNE.S‚CNFGERRŒmeters.Ifanyremainingbitsareset,*£returnanerror.ŠSPC„2E*‚Nextweneedtoseewhathisproposedconfigurationwilllooklike.D*‚Plugintohisdatablockthecurrentvaluesforthoseattributes&?*‚parametershedoesn'twanttochange.‚Theappropriatecurrent(*‚configurationisatA0andhe'satA1.*ŠOPT„BRS6ŠMOVE.WIOSATM(A1),D0†Setuptheusersattributemask.;ŠAND.W‚D0,IOSATW(A1)†Zeroouttheattributesofhisthathe.ŠNOT.W‚D0‘doesn'twanttochange,zerooutthe<ŠAND.W‚IOSATW(A0),D0†attributesofminethathedoeswantto:ŠOR.WƒD0,IOSATW(A1)†change,andcombinetheminhisspace. @ŠMOVE.WIOSPRM(A1),D0†Getmaskofparametershewantstochange. 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheLINEWIDTH,'ŠIFTHENcopythecurrentsetting.ŠMOVE.WIOSREC(A0),IOSREC(A1)ŠENDI 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheLINES/PAGE,'ŠIFTHENcopythecurrentsetting.ŠMOVE.LIOSRSZ(A0),IOSRSZ(A1)ŠENDI 3ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheWRITETIMEOUT.ŠIFTHENŽvalue,copythecurrentsetting.ŠMOVE.LIOSWTO(A0),IOSWTO(A1)ŠENDI 3ŠLSR.W‚#2,D0ŽSkipovertheREADTIMEOUTbit.Ifthe'*£LOGICALRECORDLEN GTHbitisnotset,*£copythecurrentsetting. ŠIFTHENMOVE.W‚IOSLRL(A0),IOSLRL(A1)ŠENDI 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheEND-OF-LINE/ŠIFTHENŽSTRING,copythecurrentsetting.ŒMOVE.BIOSELC(A0),IOSELC(A1)ŠENDIŠOPT„BRL*I*ƒNowthattheusersconfigurationblockcontainstheproposedattributesG* and parameters, they will be checked for validity before copying them* into the DCB or CCB.*8ŠMOVE.B#CECPNI,D2ŒIftheauto-linefeedattributeisset@ŠBTSTW‚#IOALNFD,IOSATW(A1)andtheendoflinecharacterisnull,ŠBEQ.S‚CMNC001returnaconfigurationerror.ŠTST.B‚IOSELC(A1)ŠBEQ.S‚CNFGERRŠSPC„2CCMNC001ƒMOVE.B#CECPRLZ,D2ŠIfeitherthelogicalorphysicalrecord<ŠMOVE.WIOSREC(A1),D0†lengthiszero,returnaconfigurationŠBEQ.S‚CNFGERRŒerror.ŠMOVE.WIOSLRL(A1),D3ŠBEQ.S‚CNFGERRŠSPC„24ŠCMP.W‚D3,D0Ifthelogicalrecordlengthisgreater5ŠBHS.S‚OKCNFGthanthephysicalrecordlength,return*ŠMOVE.B#CECPLGP,D2ˆaconfigurationerror.ŠSPC„2ACNFGERRƒMOVE.B#ISTACFG,D1‰Returnaconfigurationerrorstatusin>ŠMOVE.BD2,IOSCEC(A1)†theusersIOSparameterblockandreturn8ŠBRA.S‚CNFGEXIT‹thespecificconfigurationerrorcodein *£theusersconfigurationblock.ŠSPC„2F*…SettheconfigurationflagbyteinthedeviceDCBtoindicatethataK*‚CONFIGUREorCONFIGUREDEFAULTSrequestwasprocessed.FHSwillchecktheM*‚flagwhenitclosesthelastassignmenttothedevicetoseeifitneedstoH*‚tellIOStoissueaconfigurerequest.IOSwillthenissueaCONFIGUREJ*‚requestusingthedeviceDCBdefaultconfigurationparameters.ThiswillI*‚alwaysforcethecurrentconfigurationtothedefaultwheneverthelast*‚assignmentisclosed.*I*…SubroutineSTATYPiscalledtostorethecurrentdevicestatus,channelH*‚type,devicetype,anddrivercodeintotheusersconfigurationblock.*ŠMOVE.BCCBRLEN(A5),IOSLEN(A3)UpdateusersIOCBlengthfield.ŠCLR.L‚CCBRLEN(A5)ŠSPC„2=ŠMOVE.LCCBTASKB(A5),A0‡PickuptheTCBaddressofIOCBowner;ŠSUB.B‚#1,TCBIOCNT(A0)‡anddecrementhispendingI/Ocount.ŠSPC„2*!*‚Preparetheeventandqueueit.*8ŠMOVE.B‚#ISTATO,IOSSTA(A3)ƒUpdatetheIOCBstatusfield.,ŠMOVE.W‚#ISTATO,D3‹Setupeventstatusfield-ŠMOVE.B‚#XPSHLT,D1‹Setupeventstatusvalue.!ŠMOVE.L‚#6,D0Setupinfolength.&ŠMOVE.L‚CCBCID(A5),D2ˆSetupeventID..ŠLEA…CCBPKT(A5),A4ˆSetupeventbuildpointer.ŠBSR…QEVNTQueueevent.ŠBRA…CMDEXITŽRETURN ŠPAGEL******************************************************************************C*‰ROUTINECOMMONTOALLI/OCOMMANDS(READ,WRITE,OUTPUTW/INPUT)**‚Entry:A3=addressofIOCB*‰A5=addressofCCB**L*****************************************************************************IOSCOMN:?ŠBTSTW‚#IOPTSKB,IOSOPT(A3)Ifthebuffersresideinadifferent"ŠBEQ.S‚IOSC005ŒtaskfromtheIOCB, 9ŠLEA„IOSTSK(A3),A0†Pointtothetaskname&sessionofthe7ŠTR0$.GETTCB‚,Œbufferowner&callexectogetaddress."ŠBRA.S‚OKTCBŽIfit'sgood,branch.ŠNOP—Ifit'sbad,6ŠMOVE.B#XSTADB,D1‰setstatusinIOCBtoaddresserrorŠTST.L‚(A7)+ŽadjuststackŠBRA.S‚NRMEXITŒandexittoCMR. :OKTCB…MOVE.LA0,CCBTASKB(A5)„SavephysicaladdressofTCB. *<*‚ValidatetheinfointheIOCBabouttheprimarybufferand *‚converttophysicaladdresses.*BIOSC005ƒMOVE.LIOSSAD(A3),D6†D6<--bufferphysicalstartaddress.+ŠMOVE.LIOSEAD(A3),D5†D5<--bufferlength.ŠSUB.L‚D6,D5Ž* ŠADDQƒ#1,D5Ž*ŠSPC„25ŠMOVE.LD5,-(A7)‹Savethebufferlengthonthestack.ŠSPC„2>ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner."ŠBSR.S‚IOHADRCK‹Checktheaddress.$ŠBRA.S‚IOSC010ŒIfit'sgood,branch.9ŠADDQ.L#8,A7ŽIfit'sabadbaseaddress,removesavedD5&*£andadjustthestackreturnaddress.ŠSPC„25ŠMOVE.B#ISTAADD,D1ˆSetIOCBstatustoADDRESSERROR.6ŠBRA.S‚NRMEXITŒandexitwithappropriateerrorstatus. @IOSC010ƒMOVE.LD6,CCBPTR(A5)†SavephysicalstartaddressinCCB.2ŠADD.L‚(A7)+,D6‹Savethephysicalendaddressplus&ŠMOVE.LD6,CCBEAP1(A5)…oneintheCCB.ŠRTSŠPAGEK****************************************************************************=*‰VALIDATECONFIGURATIONBUFFERADDRESS&CONVERTTOPHYSICAL*$*‰Entry:D5=bufferlengthinbytes-*D6=bufferlogicalstartaddr(toconvert)*A3=addressofIOCB*A5=addressofCCB***‰Exit:‚D6ƒ=bufferphysicalstartaddress*D5ƒ=bufferlength*K****************************************************************************CCNFGADRƒLEA.L‚CCBCFIG(A5),A0…ThisentrypointloadstheCCBconfig.*£datablockintoA0.ŠSPC„2.CNFGADR2‚MOVE.LA0,-(A7)‹SaveA0onthestack.?ŠMOVE.LIOSDBP(A3),D6†D6<--logicaladdrofuser'sdatablock./ŠMOVE.L#IOSPLN,D5‰D5<--lengthofdatablock.ŠSPC„2>ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner."ŠBSR.S‚IOHADRCK‹Checktheaddress.%ŠBRA.S‚CNFGADR3‹Ifit'sgood,branch.ŠSPC„27ŠADD.L‚#8,A7ŽIftheaddressorlengthisbad,cleanthe<ŠMOVE.B#ISTAADD,D1ˆstack,setIOCBstatustoADDRESSERROR,6ŠBRA.S‚NRMEXITŒandexitwithappropriateerrorstatus.ŠSPC„2=CNFGADR3‚MOVE.LD6,A1ŽStorethephysicaladdressoftheusers9ŠMOVE.L(A7)+,A0‹datablockinA1,restoreA0andreturn.ŠRTSŠPAGEO******************************************************************************** *ˆNORMALEXIT*,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB*‰D1=IOSerrorcode*I**************************************************************************NRMEXIT:*‰LEA‡CCBPKT(A5),A4‡Setupqueueworkarea.!‰MOVE.L„#6,D0Se tuppacketsize.#‰MOVE.L„XIOUID(A2),D2‡SetupPBid.#‰AND.W…#$FF,D1Maskforwordvalue."‰MOVE.W„D1,D3Setupstatusvalue./‰MOVE.B„D1,IOSSTA(A3)‡UpdateIOCBstatusfield.%‰MOVE.B„#XPSNRM,D1ŠSetupeventtype.‰BSR‡QEVNTGoqueueevent.CMDEXIT‚CLR.L…D0*8* User request side of IOH always exits from this point.*IOHUSRTN‚EQU„*ŠRTS—RETURNTOMAINLINEŠPAGEK****************************************************************************B*ƒSubroutinetocheckaddressboundariestoseeifentirelywithin* calling tasks address space.*&*‚Entry:D5-‚numberofbytestocheck*‰D6-‚68000address(logical)*‰A1-‚TCBaddress***** EXEC ROUTINE#* REGISTERS USED: D0-D1,D3,D6/A0-A1**7*EXIT:„D6-PHYSICALADDRESSOFBUFFERBASE(IFLEGAL)*ŠRETURNTOPC„FORGOODADDRESS*”PC+2‚FORBADLENGTH*”PC+4‚FORBADADDRESS*F*********************************************************************** IOHADRCK:%ŠBTSTƒ#0,D6‘Mustbeonworkboundary.)ŠBNE.S‚IOHADR6Branchifbadbufferbase.ŠTST.L‚D5”Lengthcan'tbezero.2ŠBEQ.S‚IOHADR8Don'tgotologphywithzerocount. IOHADR2ƒEQU„*1ŠMOVE.LTCBTST(A1),A0‰Addressoftaskseg.table. ŠTR0$.LOGPHY.ŠBRA.S‚IOHADR8Branchforgoodaddressreturn.3IOHADR6ƒADD.L‚#2,(A7)AdjustPCforinvalidreturn.IOHADR8ƒRTSšReturn.ŠPAGEI***************************************************************************ˆGETTCBROUTINE*)*’ENTRY:A0=POINTERTOTASKANDSESSION***’EXECROUTINE*’REGISTERSUSED:D0-D1/A0-A1***’EXIT:A0=TCBADRESS**˜RETURNTOPC„FORGOODTASKSPECIFICATION!*¢PC+2‚FORBADTASKSPECIFICATION**J***************************************************************************GETTCB: ŠTR0$.GETTCB&ŠBRA.S„GETT10ŽGoodtaskspecification.ŠNOPšBadtaskspecification.&ŠADD.L„#2,(A7)Badtaskspecification.GETT10„RTSšReturn.ŠPAGEL******************************************************************************‚PRTOUT*%*ˆThisistheprinteroutputroutine.***ˆENTRY:‚A0=addressofbuffer*A1=addressofdevicebase*A3=addressofIOCB*A4=addressofDCB*A5=addressofCCB*.* PRTOUT1 ENTRY: D0.B = character to be output*—otherregistersasabove*M******************************************************************************CPRTIMG„ADD.L‚#1,CCBRLEN(A5)†Forimagemode,counteachbytesentto>ŠCMP.L‚CCBEAP1(A5),A0„theprinterwhetherprintableornot.If6ŠBEQ.S‚PRT070Œtheendofthebufferisreached,dothe *¢requestcompletionprocessing.ŠSPC„2PRTOUT:0ŠMOVE.B‚(A0)+,D0ŽGetnextdatabytefrombuffer.,ŠMOVE.L‚A0,CCBPTR(A5)‰Updatebufferpointer.ŠSPC…2;ŠBTSTWƒ#IOPFORB,CCBCOPT(A5)„Forimagemodeoutput,skipthe,ŠBNE.SƒPRTOUT1specialcharacterprocessing.ŠSPC…20ŠCMP.B‚#CR,D0“Ifthecurrentbuffercharacteris,ŠBEQ.S‚PRT030‘aCR,proceedwithend-of-line *§processing.ŠSPC…2+PRTOUT1ƒBSR.LƒDEVOUTSOutputthedatabyte.ŠSPC„2?ŠBTSTWƒ#IOPFORB,CCBCOPT(A5)„Iftheoutputisbringperformedin1ŠBNE.SƒPRTIMGimagemode,transfercontroltothe%*§topoftheoutputlooptocheckfor*§endofbuffer.ŠSPC…25ŠCMP.Bƒ#'',-1(A0)Ifthecurrentbuffercharacteris,ŠBLT.SƒPRT017non-printing,donotcheckfor(*¦end-of-lineorincrementthecharacter*¦countŠPAGE<ŠADD.L‚#1,CCBRLEN(A5)ŠIncrementtheprintedcharactercount.9ŠMOVE.LCCBRLEN(A5),D2ŠDividetheprintedcharactercountAŠDIVUƒCCBCFIG+IOSLRL(A5),D2‚bythelogicallinelength.Storethe+ŠSWAP„D2”remainderinthelowerhalfofD2.ŠSPC…1*ŠTST.W‚D2—Ifanexactlogicalandphysical4ŠBNE.S‚PRT017‘end-of-linehasbeenreached,outputa*N* THE FOLLOWING LINE WAS ADDED TO THE VME115 PRINTER DRIVER TO FIX THE PROBLEML*OFTHEORIGINALDRIVER.‚ITDIDACOMPARISONOFTHEPHYSICALLINELENGTHTOH*REGISTERD3.‚THISREGISTERWASNEVERSETUP.‚ITHINKTHEINTENTWASTO>* COMPARE THE PHYSICAL LINE LENGTH TO THE LOGICAL LINE LENGTH.BŠMOVE.WCCBCFIG+IOSLRL(A5),D3‚(FIRSTLOADTH ELOGICALLINELENGTH)*@ŠCMP.W‚CCBCFIG+IOSREC(A5),D3‚linefeedfornon-auto-LFdevice.If3ŠBEQ.S‚PRT013‘onlythelogicallinelengthhasbeen3ŠBSR.S‚PRTEOL‘reached,outputalogicalend-of-line2ŠBRA.S‚PRT015‘sequence.Ifneitherlengthhasbeen&*§reachedproceedtotheend-of-buffer*§check.ŠSPC„2GPRT013„BTSTWƒ#IOALNFD,CCBCFIG+IOSATW(A5)Ifthedevicedoesnotsupport0ŠBNE.SƒPRT015autolinefeed,outputalinefeed5ŠMOVE.B#LF,D0‘ifthebytecountisanexactmultiple"ŠBSR.SƒDEVOUTSofthelinelength.ŠSPC…2FPRT015„BTSTW‚#IOATPLL,CCBCFIG+IOSATW(A5)Sinceanend-of-linehasbeen/ŠBNE.SƒPRT070“reached,terminatetherequestif!*ªthetruncateprintattributeis*ªset.ŠSPC„2=PRT017„CMP.LƒCCBEAP1(A5),A0ŠIftheendofbufferhasnotbeen/ŠBLT…PRTOUTreached,outputthenextcharacter.ŠSPC…2:PRT030„BSR.SƒPRTEOL‘Outputalogicalend-of-linesequence.ŠPAGEPRT070:*2*‚Finishedtransfer,nowqueueeventtorequestor.*+ŠBCLRW‚#CCBFGBSY,CCBFG(A5)ƒClearbusyflag.,ŠMOVE.LCCBTASKB(A5),A0‡PickupTCBaddress.3ŠSUB.B‚#1,TCBIOCNT(A0)‡DecrementI/Opendingcount. -ŠMOVE.W#ISTAOK,D3ŒSetupokIOSstatuscode.6ŠAND.B‚#%00000110,D0‰KeepSELECTEDandPAPEROUTbits.7ŠCMP.B‚#%00000100,D0‰SeeifSELECTEDandPAPERnotout."ŠBEQ.S‚PRT080Branchifnofaults.1ŠMOVE.W#ISTANR,D3ŒFault,setupIOSstatuscode.-PRT080„MOVE.L#6,D0‘Setupeventinfolength.*ŠMOVE.B#XPSNRM,D1ŒSetupeventtypecode.)ŠMOVE.LCCBCID(A5),D2‰SetupDCBaddress./ŠMOVE.BD3,IOSSTA(A3)‰UpdateIOCBstatusfield.8ŠMOVE.LCCBRLEN(A5),IOSLEN(A3)‚UpdateIOCBlengthfield. *ŠLEA„CCBPKT(A5),A4‰Setupeventdataarea./ŠBSR„QEVNT‘Queuecompletioneventtorequestor. !ŠIF.BƒCCBPTRTE(A5)#0THEN.SŒRTSŠELSE.S ŒBRA‚PRTINRTEŠENDIŠPAGE*E*‹ThissubroutineoutputseitheraLF-CRsequenceoranEOLcharacter6*‰basedonthesettingoftheauto-linefeedattribute.*#PRTEOL„MOVE.BCCBCFIG+IOSELC(A5),D0?ŠBTSTWƒ#IOALNFD,CCBCFIG+IOSATW(A5)Ifnotanexactend-of-line,4ŠBNE.SƒDEVOUTSoutputtheEOLcharacteriftheauto-(*§linefeedattributeisset.Elseoutput*§aLFandCR.ŠSPC…2/ŠMOVE.B‚#LF,D0’CallDEVOUTtooutputalinefeed.ŠBSR.SƒDEVOUTcharacter.Ifanerrorstatusis1ŠTST.BƒD3”returnedinD3,transfercontroltotheŠBNE.SƒDEVOUTEerrorexit.ŠSPC„26ŠMOVE.B‚#CR,D0SetupcarriagereturncharacterinD0.ŠSPC„2*E*‹ThisroutineiscalledasasubroutinefromPRTOUTtooutputsingleF*‰charactersfromD0withautomaticrequestterminationifanerrorisD*‰detectedintheDEVOUTsubroutine.Executionalsofallsthroughto*‰herefromPRTEOL.*8DEVOUTSƒBSR.S‚DEVOUTCallDEVOUTtooutputthecharacter5ŠTST.B‚D3‘inD0.IfthestatusreturnedinD3isnon-'ŠBEQ.S‚DEVOUTOK‹zero,doanerrorexit.ŠSPC„2:DEVOUTEƒTST.L‚(A7)+Ifanerroroccurstransfercontrolto-ŠPEA.L‚PRT070therequestcompletionroutine.ŠSPC„2+DEVOUTOK‚RTS™Returntothecallingroutine.ŠPAGEO*********************************************************************************‚DEVOUT(*****MODIFIED1/27/83BYM.BRIEL*******<*†1.Checkforadevicefault(not-selectedoroutofpaper).=*ˆIfafaultispresent,terminatetherequestwithanerror.*F*†2.IfanPrinterAcknowledgeisexpected,waitfortheACKpulsefor@*‰approx.100us.Ifthepulsedoesnotarrivein100us,enable0*‰theAcknowledgeinterruptandexitthedriver.*4*†3.OutputthenextcharacterandpulseDataStrobe**ˆENTRY:„D0‚=databyte*’A1‚=devicebaseaddress*‘(SP)=returnaddress*4(SP)=PRTOUTreturnaddress*DEVICE=Interruptsdisabled*,*ˆEXIT:…D0‚=Devicestatusregistercontents*NORMAL=(SP)return*FAULT=(SP)+2return5*‘BUSY=4(SP)PRTOUTreturnaddress(deviceenabled)*K****************************************************************************DEVOUT:.‰CLR.BƒD3“ClearD3inpreparationforanormal *£return.‰SPC…2 ‰CLR.LƒD1,‰MOVE.B‚PBDR(A1),D1‹Pickupstat usregister. ‰MOVE.L‚D1,D2‘Makeanothercopy.,‰AND.Bƒ#%00000110,D1‰Maskuninterestedbits.3‰CMP.Bƒ#%00000100,D1‰SelectedandnotOut-of-Paper?‰BNE.SƒDEV010Faultexitifno.‰SPC…2:ŠTST.B‚CCBACKP(A5)ŠIfaprinteracknowledgeisnotpending,ŠBEQ.S‚DEV020proceedwithcharacteroutput.ŠSPC„2:ŠMOVE.W#32,D1RepeatedlytestfortheprinteracknowledgeADEVACK„BTST.B#1,PSR(A1)‰pulse.Iftheacknowledgearrivesbefore;ŠDBNEƒD1,DEVACKŠthelooptimesout(approx.100us)proceed**£withcharacteroutput.Otherwise,enable**£theAcknowledgepulseinterruptandexit *£thedriver.ŠSPC„2 ŠBNE.S‚DEV020*(* Enable ACKNOWLEDGE Interrupt and Exit.:‰MOVE.B‚D0,CCBSAVB(A5)ˆThedeviceisbusy,savedatabyte..‰MOVE.L‚(A7)+,CCBIRTN(A5)…Savereturnaddress.-‰SUB.Lƒ#2,CCBIRTN(A5)ˆAdjustserviceaddress.A‰MOVE.L‚(A7)+,CCBISTK(A5)…SavesubroutinereturnaddressintoCCB*<*‚SETUPTIMEOUTCALLINCASEOFAFAULT(NOACKINTERRUPT):C‰MOVEM.LD0-D2/A0-A1,-(A7)…SaveregistersusedbyTIMEOUT(EXRQPA).3‰MOVE.L‚#T0RQPA,D0ŒServicerequestcodeforEXRQPA. ‰CLR.LƒD1-‰MOVE.B‚CCBPPRIO(A5),D1‡Saveinterruptlevel.#‰MOVE.L‚A5,D2‘SaveourCCBaddress..‰LEA…PTIMOUT(PC),A0ˆAddressofwakeuproutine.6‰MOVE.L‚#10000,A1***12/19/84‚Setfor10000millisec.‰TRAP„#0‰NOP›Assumethecallwastaken.-‰MOVEM.L(A7)+,D0-D2/A0-A1…Restoreregisters.1‰ST†CCBTIMED(A5)ŠSetTIMEOUTREGUESTNEEDEDflag.*(*‚NOWENABLETHEEXPECTEDACKINTERRUPT:‰INHIB™Disableinterrupts./‰BSET„#2,PACR(A1)‹EnabledeviceACKinterrupts. ‰RTS›Return.* * Fault Exit+DEV010ƒMOVE.L‚D2,D0‘Setupstatusregister.1‰BSR…DEVINIT1ŽReprogramdevicefornointerrupts.:ŠCLR.B‚CCBACKP(A5)‰Clearpendingprinteracknowledgeflag.@ŠMOVE.B#%00000010,PSR(A1)‚ClearAcknowledgeinterruptIRQflag.+‰ST†D3”SetD3non-zerotoindicateanerror$‰BRA.SƒDEVOEXandpreparetoreturn.*(*Outputthenextcharacter1/17/84MLB*FDEV020ƒMOVE.B‚#%00000010,PSR(A1)„ClearAcknowledgeinterruptIRQflag.%‰MOVE.B‚D0,PADR(A1)‹Outputdatabyte.‰BCLR„#0,PCDR(A1)'‰BSET„#0,PCDR(A1)‹Strobethedatabyte.8‰ST†CCBACKP(A5)‹Settheprinteracknowledgependingflag.‰MOVE.B‚PBDR(A1),D0‹Getstatusregisteragain.‰SPC…20DEVOEXƒENABL™Enableinterruptsandreturntothe‰RTS™callingroutine.‰PAGEJ***************************************************************************!* INTERRUPT SIDE FOR PRT HANDLING*?*ƒPURPOSE:‚HANDLEACKNOWLEDGEMENTSANDMESSAGECOMPLETIONSFROM2*THEIOH.‚OPERATESATHARDWAREINTERRUPTPRIORITY=*LEVELASASUBROUTINETOTHEFIRSTLEVELINTERRUPTHANDLER.*+*ƒENTRY:‚JSR‚FROMINTERRUPTHANDLERROUTINE*‹A0-WORKREGISTER *‹A1=SELF*‹A5=ADDRESSOFCCB*‹D0=WORKREGISTER*/*ƒEXIT:‚RTS-BACKTOINTERRUPTHANDLERROUTINE**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A*****P****ƒEXECROUTINESCALLED:‚QEVENTI**ƒCODEISRE-ENTRANT*F*---------------------------------------------------------------------*4* If channel is off-line or not attached, just exit.*PRTISR:.ŠMOVE.LCCBCHB(A5),A1‰Getdevicebaseaddress.+ŠMOVE.BPSR(A1),D0ŒPickupstatusregister.)ŠAND.B‚#%00000010,D0‰Maskinterruptbits.4ŠCMP.B‚#%00000010,D0‰ACKNOWLEDGEInterruptpending?ŠBEQ.S‚PRTI010Branchifyes. 2ŠAND.W‚#$FFFE,SRNointerruptsosetconditionand ŠRTSšreturn.*C*‚SINCEANACKWASRECEIVEDTHEREISNONEEDFORATIMEOUTREQUEST:5PRTI010ƒCLR.B‚CCBTIMED(A5)ŠClearTIMEOUTneededflag.&ŠBTSTW‚#CCBFGOFF,CCBSTR(A5)‚Off-line?ŠBNE.S‚PRTI020Branchifyes.5ŠBTSTW‚#CCBFGATH,CCBSTR(A5)‚Isthechannelattached?ŠBEQ.S‚PRTI020Branchifno.(ŠBTSTW‚#CCBFGBSY,CCBFG(A5)ƒI/Opending?ŠBNE.S‚PRTI100Branchifyes. 8PRTI020ƒMOVE.LCCBCHB(A5),A1‰Setupdevicebaseaddress.(ŠBSR„DEVINIT1ŽDisabledeviceinterrupts.ŠENABL!ŠOR.Wƒ#$0001,SRSetconditionand ŠRTSšreturn.ŠPAGEN******************************************************************************** INTERRUPT LEVEL PROCESSING*0*ˆIthasbeende terminedthatI/Oisinprogress*ˆandtheinterruptisours.**N*******************************************************************************PRTI100:=ŠMOVEM.LD1-D7/A2-A4/A6,-(A7)Savetherestoftheregisters.1ŠBSR…DEVINIT1Reprogramdevicefornointerrupts.=ŠCLR.B‚CCBACKP(A5)‰CleartheprinteracknowledgependingflagBŠMOVE.B#%00000010,PSR(A1)‚ClearDEVICEAcknowledgeinterruptIRQ.ŠSPC„1–1/17/84MLB*-ŠMOVE.L‚CCBPTR(A5),A0ˆRestorebufferpointer.1ŠMOVE.B‚CCBSAVB(A5),D0‡Restorecurrentdatabyte.5ŠMOVE.L‚CCBIRTN(A5),A2‡Getinterruptserviceaddress.'ŠMOVE.L‚CCBCCB(A5),A3ˆGetIOCBaddress.&ŠMOVE.L‚CCBCID(A5),A4ˆGetDCBaddress.8ŠADD.Bƒ#1,CCBICNT(A5)‡Incrementpendinginterruptcount.:ŠPEA…PRTINRTN(PC)‰StacktheinterruptroutineexitaddressAŠMOVE.L‚CCBISTK(A5),-(A7)„Restoresubroutinereturnonthestack.!ŠJMP…(A2)‘Jumptooutputroutine.*.* PRT interrupt handler exits from this point. PRTINRTN:7ŠSUB.Bƒ#1,CCBICNT(A5)‡Decrementpendinginterruptcount0ŠMOVEM.L(A7)+,D1-D7/A2-A4/A6Restoreregisters./***‡ENABL˜LetCMRenableinterruptslater,this%***¤fixisforEPSONRX80(SPR1178).(ŠOR.W„#$0001,SRŒSetreturnconditionand!ŠRTSšreturntointerrupthandler.ŠPAGEJ*************************************************************************** * PTIMOUT*E*ƒPURPOSE:‚Thisistheentrypointforawakeupcall.‚Itissetupin?*theDEVOUTroutinewhenanACKNOWLEDGEhasnotbeenreceived.;*ThisroutinewillbeenteredevenifanACKNOWLEDGEcomes<*duringtheTIMEOUT.‚TheflagCCBTIMEDischeckedtoseeif8*aTIMEOUTisstillneeded.‚Thisflagisclearedinthe *ACKNOWLEDGEinterruptroutine.**ƒENTRY:„FromtheEXEC.*D1-AddressoftheCCB*?*ƒEXIT:…RTE-mustsaveD2-D7/A2-A6andrestorebeforetheRTE.*J**************************************************************************PTIMOUT:*ŠMOVEM.LD2-D7/A2-A6,-(A7)„Saveregisters.&ŠMOVE.L‚D1,A5PickuptheCCBaddress..ŠMOVE.L‚CCBCHB(A5),A1ˆGetdevicebaseaddress.'ŠMOVE.L‚CCBCCB(A5),A3ˆGetIOCBaddress.&ŠMOVE.L‚CCBCID(A5),A4ˆGetDCBaddress./ŠST†CCBPTRTE(A5)‰FlagtoprocessaRTEonexit.1ŠTST.BƒCCBTIMED(A5)‰DowestillneedtheTIMEOUT?/ŠBEQ.SƒPRTINRTENo-musthavereceivedanACK.*J* A TIMEOUT has occurred and NO acknowledge was received from the printer.H*THISSHOULDBEAFAULTCONDITION.‚IfthecablewasdisconnectedATTHEK* VME115 board an actual fault would be missed if the FAULT line were to beH*checkedhere.‚Thisisbecausethereisnopull-downresistoronboard.J* The assumption is made here that since a TIMEOUT has occurred there must;* be a problem, so queue the 'DEVICE NOT READY' error back.*ŠBSR…DEVINIT1Resetthedevice.-ŠCLR.BƒD0“Makethestatuslooklikeitisnot,ŠBRA…PRT070selected.Thenqueueeventback.ŠSPC2*!* TIMEOUT exits here with an RTE:2PRTINRTE‚CLR.BƒCCBPTRTE(A5)‰ClearRTEneededflag..ŠCLR.BƒCCBTIMED(A5)‰ClearTIMEOUTneededflag.ŠENABL1ŠMOVEM.L(A7)+,D2-D7/A2-A6„Restoretheregisters.ŠRTEŠPAGEJ**************************************************************************** QEVNT**„Placemessageonuser'sASQ.**ˆA4=addressofeventarea*ˆA5=addressofCCB'*ˆD0=eventlength(minusheaderinfo)*ˆD1=eventtype*ˆD2=4byteid(DCB)*ˆD3=statusvalue(2bytes)*ˆD4=devicestatus(2bytes)*ˆD5=devicenumber(1byte)*J***************************************************************************QEVNT:ŠMOVE.LD0,D6ŽSavelength.5ŠMOVE.L#2,D7ŽOffsetforstaging(noservicevector)./ŠMOVE.B#IOEVCD,1(A4)†Code(noservicevector).)ŠMOVE.LCCBSVVC(A5),2(A4)‚Servicevector.+ŠBEQ.S‚QEVNT10ŒBranchifnoservicevector./ŠADD.L‚#4,D0ŽCorrectlengthforservicevector.7ŠADD.L‚#4,D7ŽCorrectoffsetstagingforservicevector.2ŠADD.L‚#$00800000,(A4)„Correctforservicevector. 1QEVNT10ƒMOVE.BD1,0(A4,D7)ˆCompletioneventtype.*ŠMOVE.BCCBKEY(A5),1(A4,D7)User'sidkey.-ŠADD.L‚#4,D0ŽCompleteleng thofreturnevent.6ŠCMP.B‚CCBASQL(A5),D0…User'smaximumASQentrylength.#ŠBLS.S‚QEVNT20ŒBranchiflengthok.0ŠMOVE.BCCBASQL(A5),D0…User'slengthissmaller. &QEVNT20ƒMOVE.BD0,(A4)ŒCorrectlength. /QEVNT40ƒMOVE.LD2,2(A4,D7)ˆSetupstatusvalue.$ŠMOVE.WD3,6(A4,D7)ˆSetupid(DCB).ŠCMP.B‚#6,D6Ž6byteinfo?ŠBEQ.S‚QEVNT50ŒBranchifyes.)ŠMOVE.WD4,8(A4,D7)ˆSetupdevicestatus.ŠCMP.B‚#8,D6Ž8byteinfo?ŠBEQ.S‚QEVNT50ŒBranchifyes.*ŠMOVE.BD5,10(A4,D7)‡Setupdevicenumber.&ŠCLR.B‚11(A4,D7)ŠClearreservedfield.*I* Now let's put the completion into registers and send event to the task.* QEVNT50ƒEQU„*ŠMOVEM.L(A4),D2-D7ŠBSR.S‚IOHQEVNTŠRTSŠPAGEK*****************************************************************************9* ROUTINE TO QUEUE EVENT (ALREADY STAGED IN REGISTERS) TO*ƒ-DRIVINGTASK. *ƒ-EVENTBEGINSINREGISTERD2.***ˆEXECROUTINE/*ˆREGISTERSUSED:D0-D1/A0,A3-A6‚WORKREGISTERS*˜D2-D7‹STAGINGREGISTERS**K**************************************************************************** IOHQEVNT:$ŠMOVEM.LA3-A5,-(A7)‡Ssveregisters.-ŠMOVE.LCCBRQSTA(A5),A0„Caller'sTCBaddress.ŠSPC„26ŠMOVE.L#T0QEVNTI,D0‰Ifthisroutinewascalledduring6ŠTST.B‚CCBICNT(A5)ˆinterruptprocessing,usetheQEVNT3ŠBNE.S‚IOHQ4Žinterruptroutine,elseusethenormal#ŠMOVE.L#T0QEVNTT,D0‡QEVNTroutine. IOHQ4…TRAPƒ#0#ŠBRA.S‚IOHQ5ŽBranchifqueueingok.'ŠMOVEM.L(A7)+,A3-A5‡Restoreregisters.9ŠMOVE.L(A7),CCBQVER1(A5)‚Savecallersaddressfordebug.ŠBRA.S‚IOHQRTN ,IOHQ5…MOVEM.L(A7)+,A3-A5‡Restoreregisters..ŠCLR.L‚CCBQVER1(A5)‡Clearqueueerroraddress. IOHQRTNƒRTS—RETURNŠENDééé=/* =/*†PIADRV.AF=/*8=/* Chain file to assemble the printer driver for a PIA.=/*:=/* If no output argument is specified for the listing the(=/* chain file will default to PIADRV.LS=/*=/IFC \1ƒ=ARGPIADRV.LS=/ENDIF=/*#=ASM PIADRV.SA,PIADRV.RO,\1;MRZ=146=/*{ Included files are:=/*ƒ9995.&.TRACE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*}=/*=ENDéééé é鲊PAGEJPIADRV„IDNTƒ4,0VERSAdosLocalPrinterI/OHandlerProcessV4.0-09/13/82?ŠTTL„VERSADOSLOCALPRINTERI/OHANDLERPROCESSV4.0-09/13/82 ŠLLENƒ120ŠNOLISTŠINCLUDE9995.&.TRACE.EQŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠLIST ŠNOFORMATJ****************************************************************************1* PRT -- REV. 1.00 02NOV81 (TL09) JIM SMITH - IOH9*ˆREV.1.0101FEB82(TL09)JIMSMITH-VECTORCHAIN(IOH)5*ˆREV.1.0223FEB82(TL09)JIMSMITH-IOCBUSE(IOH)5*ˆREV.2.0015APR82(TL09)JIMSMITH-PRINTERDRIVER5*ˆREV.2.0101JUN82(TL09)MARCBRIEL-PRINTERDRIVER5*ˆREV.2.1015JUL82(TL09)MARCBRIEL-PRINTERDRIVER-*ˆREV‚2.2018JAN84ˆMARCBRIEL-PRINTERDRIVER;*ˆREV‚2.2117DEC84ˆMIKEDUH‚-RemovedENABLatPRTINRTNfor *­SPR1178(EpsonRX80printer).*«-FixedHALTroutine.8*ˆREV‚2.228MAR85‰DICKV.ƒ-Haltroutineregisterchangeéééé »Ä-ÌEÔEÜ@äFì@ô@üC7 37>$<,R46<9D=LBT>\>d!*'*ƒPURPOSE:‚CHANNEL(DEVICE)I/OHANDLER*****PRINTERDRIVER*****/*ƒENTRY:‚JSRFROMCMRHANDLER(COMMANDSERVICE) *‹JSRFROMCMRINTERRUPTHANDLER*-*ƒEXIT:-ALWAYSEXITSWITHARTSINSTRUCTION***ƒCODEISRE-ENTRANT**H*-----------------------------------------------------------------------*PRTORG:ŠPAGE*(****************************************(* EQUATES FOR SPECIAL ASCII CHARACTERS *(*****************************************NUL†EQU‡$00‘NullBEL†EQU‡$07‘BellBS‡EQU‡$08‘BackspaceLF‡EQU‡$0A‘LinefeedFF‡EQU‡$0C‘FormfeedCR‡EQU‡$0D‘CarriagereturnSPACE„EQU‡$20‘Blank ******************** DEVICE EQUATES ********************+DEV1ACƒEQU‡2“A-sidecontrolregisteroffset+DEV1BCƒEQU‡6“B-sidecontrolregisteroffset(DEV1ADƒEQU‡0“A-sidedataregisteroffset(DEV1BDƒEQU‡4“B-sidedataregisteroffset* STRBSYƒEQU‡%00000100‹Devicebusy(STROUTƒEQU‡%00000010‹Deviceoutofpaper$STRSELƒEQU‡%00000001‹Deviceselected*6DSDVIAƒEQU‡$3C‘Dis abledA-sideinterrupts‚*1/17/84MLBééé)DSDVIBƒEQU‡$3C‘DisabledB-sideinterrupts *************************** MISCELLANEOUS EQUATES ***************************IOEVCD„EQU„1’I/OeventcodeDVALATM„EQU„1<*ƒCA2DATASTBDATASTROBE„OUTPUT…LOW„PULSETOCLOCKDATAFROM*³PIATOPRINTERLOGIC<*ƒCA1ACKNLGƒACKNOWLEDGE„INPUT†LOW„PULSEINDICATINGINPUTOF*³CHARACTERINTOPRINTER*³MEMORYORENDOFFUNTION1*ƒPB2BUSY…BUSY‹INPUT†HIGHƒPRINTERCANNOTRECEIVE*³DATA.<*ƒPB1OUT-PPƒOUTOFPAPERƒINPUT†HIGHƒPRINTERISOUTOFPAPER/*ƒPB0SEL†SELECT‰INPUT†HIGHƒPRINTERISSELECTED*K****************************************************************************DEVINIT:1‰MOVE.L„CCBCHB(A5),A1‡Setupdevicebaseaddress.5‰MOVE.B„#00,DEV1AC(A1)†SelecttheDDRfortheA-side.5‰MOVE.B„#00,DEV1BC(A1)†SelecttheDDRfortheB-side.;‰MOVE.B„#$FF,DEV1AD(A1)…SetA-sidedatadirection(output). +‰CMP.B…#XTPRTL,CCBTYPE(A5)RTTLIOchannel?‰BNE.S…DEVINIT0ŒBranchifno.3‰MOVE.B„#$80,DEV1BD(A1)…PB7outputforLEDcontrol.‰BRA.S„DEVINITAŠSPC„2¼*FDEVINIT0MOVE.B„#00,DEV1BD(A1)†SetB-sidedatadirection(statusinputŠSPC„2HDEVINITAMOVE.B„#$04,DEV1AC(A1)…SelectA-sidedataregister1/17/84MLB*9‰TST.B…DEV1AD(A1)ŠReaddatareg.toclearACKinterrupt‚*ŠSPC„2¼*HDEVINIT1MOVE.B„#$04,DEV1BC(A1)…ClearinterruptonB-side.1/17/84MLB*8‰TST.B…DEV1BD(A1)ŠReaddataregistertoclearinterrupt.*‰MOVE.B„#DSDVIA,DEV1AC(A1)‚ProgramA-side.*‰MOVE.B„#DSDVIB,DEV1BC(A1)‚ProgramB-side.‰SPC‡2*‰CMP.B…#XTPRTL,CCBTYPE(A5)RTTLIOchannel?‰BNE.S…DEVINIT2ŒBranchifnot.?‰MOVE.B„#00,DEV1BD(A1)†TurnoffRTTLIOLED(won'thurtothers).‰SPC‡29DEVINIT2BCLR†#0,DEV1AC(A1)‡DisableinterruptsonA-side.1‰BCLR†#0,DEV1BC(A1)‡DisableinterruptsonB-side. ‰RTS›Return.‰PAGEJ***************************************************************************%*ˆTHISISTHECOMMANDSERVICEROUTINE*6*‹PARAMETERADDRESSANDBOUNDARYCHECKSHAVEBEENMADE**ƒENTRY:‚JSRFROMCMRHANDLER**‹A2-PHYSICALADDRESSOFPARAMETERBLOCK*‹A5-PHYSICALADDRESSOFCCB,*‹A6-PHYSICALADDRESSOFATTACHEDTASKTCB*5*ƒEXIT:‚RTS-PARAMETERBLOCKVALIDATIONSTATUSIND0**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A**P**PP*$*”A3=CAMMANDPACKET(IOCB)POINTER *”A6=REQUESTORTCBADDRESS**ƒEXECROUTINESCALLED:‚QEVENTT**ƒCODEISRE-ENTRANT*J***************************************************************************PRTUSER:*)* Convert logical PB address to physical.* ŠCLR.L‚D5>ŠMOVE.LXIOCPK(A2),D6†Setupaddressofcommandpacket(IOCB).6ŠMOVE.WXIOPLN(A2),D5†Setuplengthofcommandpacket.+ŠMOVE.LCCBTASKA(A5),A1„SetupTCBpointer.&ŠBSR„IOHADRCK‹Callconversionroutine.ŠBRA.S‚PRTU010ŒGoodreturn.)ŠMOVE.B#ISTAIP,D1‰SetupIOSerrorcode.ŠBRA„NRMEXITŒExit.=PRTU010ƒMOVE.LD6,A3ŽSavephysicaladdressofcommandpacket.**‚CheckforHALTcommand.*(ŠCMP.Wƒ#IOHALT,IOSFCT(A3)…HALTcommand?!ŠBEQ…HALT“BranchifHALTcommand.** See if channel is busy.*)ŠBTSTW‚#CCBFGBSY,CCBFG(A5)‚Channelbusy?ŠBEQ.S‚PRTU020ŽBranchifno.6ŠMOVE.B#XSTBSY,D0‹Busy,setupchannelerrorcodeandŠBRA„IOHUSRTNReturn.ŠPAGE*K****************************************************************************(*‚Findthecommandinthecommandtable.*** PRTU020:8ŠMOVE.WIOSOPT(A3),CCBCOPT(A5)SaveIOCBoptionsinCCB.6ŠMOVE.LXIOUID(A2),CCBCID(A5)‚SaveDCBpointerinCCB.(ŠMOVE.LA3,CCBCCB(A5)†SaveIOCBpointer.*ŠMOVE.LXIOUID(A2),A4†PickupDCBpointer.9ŠMOVE.LCCBTASKA(A5),CCBTASKB(A5)‚SetupbuffertaskTCB. -ŠMOVEQ‚#NUMCMDS-1,D0†Setuptheloopcounter./ŠLEA„CMDTBL,A0ŠA0<--addressofcommandtable./ŠMOVE.WIOSFCT(A3),D6†Setupusercommandcode. 8CMDSRCHƒCMP.W‚(A0)+,D6‹Searchthetableforthecommand.ŠDBEQƒD0,CMDSRCH‰* 3ŠBNE.S‚CMDERRIfwefoundthecommandinthetable,8ŠADD.L‚#JMPOFF-2,A0‡getthecorrespondingentryfromthe5ŠMOVE.W(A0),D0Œjumptableandjumptotheroutineto"ŠJMP„(A0,D0.W)Šhandlethecommand. ?CMDERR„MOVE.B#ISTAIF,D1‰Wedidn'tfindit,soexitwitherror. ŠBRA„NRMEXITŠPAGEL******************************************************************************‰WRITE**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB%*‰A6=addressofattachedtask'sTCB***L*****************************************************************************WRITE:5‰BSR‡IOSCOMNDothestuffcommontoallI/Ocommands. -‰BSETW…#CCBFGBSY,CCBFG(A5)Markchannelbusy.6‰CLR.L…CCBRLEN(A5)‰Initializetheoutputbytecounter.1‰MOVE.L„CCBCHB(A5),A1‡Setupdevicebaseaddress. ‰BSR‡DEVINIT1ŒSetupthedevice.‰SPC‡2=‰MOVE.L„CCBTASKB(A5),A0‡PickuptheTCBaddressofIOCBowner;‰ADD.B…#1,TCBIOCNT(A0)…andincrementhispendingI/Ocount.‰SPC‡2,‰MOVE.L„CCBPTR(A5),A0‡Setupbufferpointer.‰SPC‡2@‰BTSTW…#IOASNFF,CCBCFIG+IOSATW(A5)Iftheformfeedafterassign4‰BNE.S…WRIT010attributeis0sendaFFcharacterif)*¦thisisthefirstoutputinthecurrent *¦assignment.‰SPC‡20‰TST.B…DCBBCT(A4)ŠDoweneedtodoaformfeed?‰BNE.S…WRIT010Branchifno."‰STˆDCBBCT(A4)ŠSetformfeedflag.(‰MOVE.B„#FF,D0ŽYes,setupFFcharacter.!‰BSR‡PRTOUT1Gooutputtodevice.‰BRA.S…WRIT020Return. 'WRIT010‚BSR‡PRTOUTŽStartbufferoutput. !WRIT020‚UNMASK˜Enableinterrupts.‰BRA‡CMDEXITGOFINISHUP‰PAGEM*******************************************************************************‰REQUESTSTATUS*$*‰Entry:A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M******************************************************************************REQSTAT: *E*‚Gettheaddressofhisdatablockandmoveourconfigurationthere.*2ŠBSR„CNFGADRŒGetthephysicaladdressoftheusers*£configurationblock.ŠSPC„24ŠBSR.S‚STATYPSetupthedevicestatus,channeltype,&*£devicetype,anddrivercodesinthe*£user'sconfigureblock.ŠSPC„2>ŠMOVE.W#VALATM,IOSATM(A0)„ReturnthesupportedattributesandBŠMOVE.W#VALPRM,IOSPRM(A0)‚parametersmasksintheusersconfigure*¤block.ŠSPC„2BŠMOVE.L#(IOSPLN/2)-1,D0ƒD0<--loopcontroltomoveentireblock.'REQLOOPƒMOVE.W(A0)+,(A1)+ˆMove  aword.5ŠDBRAƒD0,REQLOOP‰Keepmovinguntilwholeblockmoved. 'ŠMOVE.B#ISTAOK,D1‰ExitwithOKstatus.ŠBRA„NRMEXITŒ*ŠSPC„2*A*„Thissubroutinestoresthecurrentdevicestatus(alwaysready),E*‚channeltype,devicetype,anddrivercodeintotheusersconfigureL*‚block.NotethatthesevaluesarereturnedonlyonRETRIEVEDEVICESTATUS/K*‚CONFIGURATION,CONFIGUREDEVICE,andCHANGEDEFAULTCONFIGURATIONrequests/*‚onlywhennoconfigurtionerrorwasdetected.*5STATYP„CLR.B‚IOSDST(A0)ŽReturnon-linedevicestatus.AŠMOVE.BCCBTYPE(A5),IOSCTP(A0)‚Returnthechanneltypedefinedin *¨theCCB.2ŠMOVE.B#XDSPRT,IOSDTP(A0)†DevicetypeisPRINTER.>ŠMOVE.B#IODLPRT,IOSDRC(A0)…ThisisalocalCentronicsprinter&*¨driverforuseontheEXORmacsDEBUG#*¨PIAportoranMVME410PIAonthe*¨I/OChannel.ŠRTSŠPAGEM****************************************************************************** *‰CONFIGURE*@*‰ThiscommandchangestheCCBconfiguration,theonefromwhich<*‰thedriversetsupthedeviceandunderwhichitperforms.*,*‰Entry:A2=addressofCMRparameterblock*A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M****************************************************************************** CONFIGUR: *B*‚Getthephysicaladdressoftheuser'sconfigurationdatablock.*2ŠBSR„CNFGADRŒGetthephysicaladdressoftheusers*£configurationdatablock.ŠSPC„21ŠMOVE.LXIOUID(A2),A4†A4<--baseaddressofDCB. =ŠMOVE.B#CECCDO,D2ŠIfhe'stryingtochangethewritetimeout?ŠBTSTW‚#IOSWTOB,IOSPRM(A1)value,returnaconfigurationerror. ŠBNE„CNFGERRŠSPC„2DŠMOVE.LDCBDEV+IOSWTO(A4),IOSWTO(A0)Update(intheCCB)thetimeout/ŠBRA.S‚CMNCNFGŒvaluesfromtheDCB,sotheycan,*£becopied,anddothecommonconfiguration *£processing.ŠPAGEM*******************************************************************************‰CHANGEDEFAULTCONFIGURATION*6*‰ThiscommandchangestheDCBconfiguration,towhich4*‰IOSwillrestoreus(viaaCONFIGUREcommand)when/*‰FHSclosesthelastallocationofthedevice.*$*‰Entry:A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M***************************************************************************** CHNGDEF: *H*‚Firstgetthephysicaladdressoftheuser'sconfigurationdatablock.*8ŠBSR„CNFGADR2‹Gettheaddressoftheusersconfiguration,*£datablock.ThisentrypointpreservesA0.ŠSPC„27ŠMOVE.LXIOUID(A2),A0ˆLoadtheaddressoftheDCBinA46ŠMOVE.LA0,A4ŽandtheaddressoftheDCBconfigurationŠADD.L‚#DCBDEV,A0‰blockinA0. ŠPAGEM*******************************************************************************‰COMMONCONFIGURATIONROUTINE*7*‰Thisroutinedoestheworkcommontothetwocommands-*‰CONFIGUREandCHANGEDEFAULTCONFIGURATION.*7*‰Entry:A0=AddressofCCBorDCBconfigurationblock,*A1=Addressofuser'sconfigurationblock*M***************************************************************************** CMNCNFG:*L*ƒFirst,boththeattributesandparametersmasksarecheckedtoseeifbitsL* corresponding to unsupported attributes or parameters are set. If any such2* bits are set, a configuration error is returned.*7ŠMOVE.W#CECUAP,D2‹Setupforanerrorexitincasethe&*£useristryingtochangeunsupported*£attributesorparameters.ŠSPC„29ŠMOVE.W#NVALATM,D0ŠZerothebitsoftheusersattributes<ŠAND.W‚IOSATM(A1),D0†maskthatcorrespondtosupportedpara-5ŠBNE.S‚CNFGERRŒmeters.Ifanyremainingbitsareset,*£returnanerror.ŠSPC„29ŠMOVE.W#NVALPRM,D0ŠZerothebitsoftheusersattributes<ŠAND.W‚IOSPRM(A1),D0†maskthatcorrespondtosupportedpara-5ŠBNE.S‚CNFGERRŒmeters.Ifanyremainingbitsareset,*£returnanerror.ŠSPC„2E*‚Nextweneedtoseewhathisproposedconfigurationwilllooklike.D*‚Plugintohisdatablockthecurrentvaluesforthoseattributes&?*‚parametershedoesn'  twanttochange.‚Theappropriatecurrent(*‚configurationisatA0andhe'satA1.*ŠOPT„BRS6ŠMOVE.WIOSATM(A1),D0†Setuptheusersattributemask.;ŠAND.W‚D0,IOSATW(A1)†Zeroouttheattributesofhisthathe.ŠNOT.W‚D0‘doesn'twanttochange,zerooutthe<ŠAND.W‚IOSATW(A0),D0†attributesofminethathedoeswantto:ŠOR.WƒD0,IOSATW(A1)†change,andcombinetheminhisspace. @ŠMOVE.WIOSPRM(A1),D0†Getmaskofparametershewantstochange. 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheLINEWIDTH,'ŠIFTHENcopythecurrentsetting.ŠMOVE.WIOSREC(A0),IOSREC(A1)ŠENDI 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheLINES/PAGE,'ŠIFTHENcopythecurrentsetting.ŠMOVE.LIOSRSZ(A0),IOSRSZ(A1)ŠENDI 3ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheWRITETIMEOUT.ŠIFTHENŽvalue,copythecurrentsetting.ŠMOVE.LIOSWTO(A0),IOSWTO(A1)ŠENDI 3ŠLSR.W‚#2,D0ŽSkipovertheREADTIMEOUTbit.Ifthe'*£LOGICALRECORDLENGTHbitisnotset,*£copythecurrentsetting. ŠIFTHENMOVE.W‚IOSLRL(A0),IOSLRL(A1)ŠENDI 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheEND-OF-LINE/ŠIFTHENŽSTRING,copythecurrentsetting.ŒMOVE.BIOSELC(A0),IOSELC(A1)ŠENDIŠOPT„BRL*I*ƒNowthattheusersconfigurationblockcontainstheproposedattributesG* and parameters, they will be checked for validity before copying them* into the DCB or CCB.*8ŠMOVE.B#CECPNI,D2ŒIftheauto-linefeedattributeisset@ŠBTSTW‚#IOALNFD,IOSATW(A1)andtheendoflinecharacterisnull,ŠBEQ.S‚CMNC001returnaconfigurationerror.ŠTST.B‚IOSELC(A1)ŠBEQ.S‚CNFGERRŠSPC„2CCMNC001ƒMOVE.B#CECPRLZ,D2ŠIfeitherthelogicalorphysicalrecord<ŠMOVE.WIOSREC(A1),D0†lengthiszero,returnaconfigurationŠBEQ.S‚CNFGERRŒerror.ŠMOVE.WIOSLRL(A1),D3ŠBEQ.S‚CNFGERRŠSPC„24ŠCMP.W‚D3,D0Ifthelogicalrecordlengthisgreater5ŠBHS.S‚OKCNFGthanthephysicalrecordlength,return*ŠMOVE.B#CECPLGP,D2ˆaconfigurationerror.ŠSPC„2ACNFGERRƒMOVE.B#ISTACFG,D1‰Returnaconfigurationerrorstatusin>ŠMOVE.BD2,IOSCEC(A1)†theusersIOSparameterblockandreturn8ŠBRA.S‚CNFGEXIT‹thespecificconfigurationerrorcodein *£theusersconfigurationblock.ŠSPC„2F*…SettheconfigurationflagbyteinthedeviceDCBtoindicatethataK*‚CONFIGUREorCONFIGUREDEFAULTSrequestwasprocessed.FHSwillchecktheM*‚flagwhenitclosesthelastassignmenttothedevicetoseeifitneedstoH*‚tellIOStoissueaconfigurerequest.IOSwillthenissueaCONFIGUREJ*‚requestusingthedeviceDCBdefaultconfigurationparameters.ThiswillI*‚alwaysforcethecurrentconfigurationtothedefaultwheneverthelast*‚assignmentisclosed.*I*…SubroutineSTATYPiscalledtostorethecurrentdevicestatus,channelH*‚type,devicetype,anddrivercodeintotheusersconfigurationblock.*ŠMOVE.BCCBRLEN(A5),IOSLEN(A3)UpdateusersIOCBlengthfield.ŠCLR.L‚CCBRLEN(A5)ŠSPC„2=ŠMOVE.LCCBTASKB(A5),A0‡PickuptheTCBaddressofIOCBowner;ŠSUB.B‚#1,TCBIOCNT(A0)‡anddecrementhispendingI/Ocount.ŠSPC„2*!*‚Preparetheeventandqueueit.*8ŠMOVE.B‚#ISTATO,IOSSTA(A3)ƒUpdatetheIOCBstatusfield.,ŠMOVE.W‚#ISTATO,D3‹Setupeventstatusfield-ŠMOVE.B‚#XPSHLT,D1‹Setupeventstatusvalue.!ŠMOVE.L‚#6,D0Setupinfolength.&ŠMOVE.L‚CCBCID(A5),D2ˆSetupeventID..ŠLEA…CCBPKT(A5),A4ˆSetupeventbuildpointer.ŠBSR…QEVNTQueueevent.ŠBRA…CMDEXITŽRETURN ŠPAGEL******************************************************************************C*‰ROUTINECOMMONTOALLI/OCOMMANDS(READ,WRITE,OUTPUTW/INPUT)**‚Entry:A3=addressofIOCB*‰A5=addressofCCB**L*****************************************************************************IOSCOMN:?ŠBTSTW‚#IOPTSKB,IOSOPT(A3)Ifthebuffersresideinadifferent"ŠBEQ.S‚IOSC005ŒtaskfromtheIOCB, 9ŠLEA„IOSTSK(A3),A0†Pointtothetaskname&sessionofthe7ŠTR0$.GETTCB‚,Œbufferowner&callexectogetaddress."ŠBRA.S‚OKTCBŽIfit'sgood,branch.ŠNOP—Ifit'sbad,6ŠMOVE.B#XSTADB,D1‰setstatusinIOCBtoaddresserrorŠTST.L‚(A7)+ŽadjuststackŠBRA.S‚NRMEXITŒandexittoCMR. :OKTCB…MOVE.LA0,CCBTASKB(A5)„SavephysicaladdressofTCB. *<*‚ValidatetheinfointheIOCBabouttheprimarybufferand *‚converttophysicaladdresses.*BIOSC005ƒMOVE.LIOSSAD(A3),D6†D6<--bufferphysicalstartaddress.+ŠMOVE.LIOSEAD(A3),D5†D5<--bufferlength.ŠSUB.L‚D6,D5Ž* ŠADDQƒ#1,D5Ž*ŠSPC„25ŠMOVE.LD5,-(A7)‹Savethebufferlengthonthestack.ŠSPC„2>ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner."ŠBSR.S‚IOHADRCK‹Checktheaddress.$ŠBRA.S‚IOSC010ŒIfit'sgood,branch.9ŠADDQ.L#8,A7ŽIfit'sabadbaseaddress,removesavedD5&*£andadjustthestackreturnaddress.ŠSPC„24ŠMOVE.B#ISTAADD,D1ˆSetIOCBstatustoADDRESSERROR6ŠBRA.S‚NRMEXITŒandexitwithappropriateerrorstatus. @IOSC010ƒMOVE.LD6,CCBPTR(A5)†SavephysicalstartaddressinCCB.2ŠADD.L‚(A7)+,D6‹Savethephysicalendaddressplus&ŠMOVE.LD6,CCBEAP1(A5)…oneintheCCB.ŠRTSŠPAGEK****************************************************************************=*‰VALIDATECONFIGURATIONBUFFERADDRESS&CONVERTTOPHYSICAL*$*‰Entry:D5=bufferlengthinbytes-*D6=bufferlogicalstartaddr(toconvert)*A3=addressofIOCB*A5=addressofCCB***‰Exit:‚D6ƒ=bufferphysicalstartaddress*D5ƒ=bufferlength*K****************************************************************************CCNFGADRƒLEA.L‚CCBCFIG(A5),A0…ThisentrypointloadstheCCBconfig.*£datablockintoA0.ŠSPC„2.CNFGADR2‚MOVE.LA0,-(A7)‹SaveA0onthestack.?ŠMOVE.LIOSDBP(A3),D6†D6<--logicaladdrofuser'sdatablock./ŠMOVE.L#IOSPLN,D5‰D5<--lengthofdatablock.ŠSPC„2>ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner."ŠBSR.S‚IOHAD! RCK‹Checktheaddress.%ŠBRA.S‚CNFGADR3‹Ifit'sgood,branch.ŠSPC„27ŠADD.L‚#8,A7ŽIftheaddressorlengthisbad,cleanthe<ŠMOVE.B#ISTAADD,D1ˆstack,setIOCBstatustoADDRESSERROR,6ŠBRA.S‚NRMEXITŒandexitwithappropriateerrorstatus.ŠSPC„2=CNFGADR3‚MOVE.LD6,A1ŽStorethephysicaladdressoftheusers9ŠMOVE.L(A7)+,A0‹datablockinA1,restoreA0andreturn.ŠRTSŠPAGEO******************************************************************************** *ˆNORMALEXIT*,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB*‰D1=IOSerrorcode*I**************************************************************************NRMEXIT:*‰LEA‡CCBPKT(A5),A4‡Setupqueueworkarea.!‰MOVE.L„#6,D0Setuppacketsize.#‰MOVE.L„XIOUID(A2),D2‡SetupPBid.#‰AND.W…#$FF,D1Maskforwordvalue."‰MOVE.W„D1,D3Setupstatusvalue./‰MOVE.B„D1,IOSSTA(A3)‡UpdateIOCBstatusfield.%‰MOVE.B„#XPSNRM,D1ŠSetupeventtype.‰BSR‡QEVNTGoqueueevent.CMDEXIT‚CLR.L…D0*8* User request side of IOH always exits from this point.*IOHUSRTN‚EQU„*ŠRTS—RETURNTOMAINLINEŠPAGEK****************************************************************************B*ƒSubroutinetocheckaddressboundariestoseeifentirelywithin* calling tasks address space.*&*‚Entry:D5-‚numberofbytestocheck*‰D6-‚68000address(logical)*‰A1-‚TCBaddress***** EXEC ROUTINE#* REGISTERS USED: D0-D1,D3,D6/A0-A1**7*EXIT:„D6-PHYSICALADDRESSOFBUFFERBASE(IFLEGAL)*ŠRETURNTOPC„FORGOODADDRESS*”PC+2‚FORBADLENGTH*”PC+4‚FORBADADDRESS*F*********************************************************************** IOHADRCK:%ŠBTSTƒ#0,D6‘Mustbeonworkboundary.)ŠBNE.S‚IOHADR6Branchifbadbufferbase.ŠTST.L‚D5”Lengthcan'tbezero.2ŠBEQ.S‚IOHADR8Don'tgotologphywithzerocount. IOHADR2ƒEQU„*1ŠMOVE.LTCBTST(A1),A0‰Addressoftaskseg.table. ŠTR0$.LOGPHY.ŠBRA.S‚IOHADR8Branchforgoodaddressreturn.3IOHADR6ƒADD.L‚#2,(A7)AdjustPCforinvalidreturn.IOHADR8ƒRTSšReturn.ŠPAGEI***************************************************************************ˆGETTCBROUTINE*)*’ENTRY:A0=POINTERTOTASKANDSESSION***’EXECROUTINE*’REGISTERSUSED:D0-D1/A0-A1***’EXIT:A0=TCBADRESS**˜RETURNTOPC„FORGOODTASKSPECIFICATION!*¢PC+2‚FORBADTASKSPECIFICATION**J***************************************************************************GETTCB: ŠTR0$.GETTCB&ŠBRA.S„GETT10ŽGoodtaskspecification.ŠNOPšBadtaskspecification.&ŠADD.L„#2,(A7)Badtaskspecification.GETT10„RTSšReturn.ŠPAGEL******************************************************************************‚PRTOUT*%*ˆThisistheprinteroutputroutine.***ˆENTRY:‚A0=addressofbuffer*A1=addressofdevicebase*A3=addressofIOCB*A4=addressofDCB*A5=addressofCCB*.* PRTOUT1 ENTRY: D0.B = character to be output*—otherregistersasabove*M******************************************************************************CPRTIMG„ADD.L‚#1,CCBRLEN(A5)†Forimagemode,counteachbytesentto>ŠCMP.L‚CCBEAP1(A5),A0„theprinterwhetherprintableornot.If6ŠBEQ.S‚PRT070Œtheendofthebufferisreached,dothe *¢requestcompletionprocessing.ŠSPC„2PRTOUT:0ŠMOVE.B‚(A0)+,D0ŽGetnextdatabytefrombuffer.,ŠMOVE.L‚A0,CCBPTR(A5)‰Updatebufferpointer.ŠSPC…2;ŠBTSTWƒ#IOPFORB,CCBCOPT(A5)„Forimagemodeoutput,skipthe,ŠBNE.SƒPRTOUT1specialcharacterprocessing.ŠSPC…20ŠCMP.B‚#CR,D0“Ifthecurrentbuffercharacteris,ŠBEQ.S‚PRT030‘aCR,proceedwithend-of-line *§processing.ŠSPC…2+PRTOUT1ƒBSR.LƒDEVOUTSOutputthedatabyte.ŠSPC„2EPRT010„BTSTWƒ#IOPFORB,CCBCOPT(A5)„Iftheoutputisbringperformedin1ŠBNE.SƒPRTIMGimagemode,transfercontroltothe%*§topoftheoutputlooptocheckfor*§endofbuffer.ŠSPC…25ŠCMP.Bƒ#'',-1(A0)Ifthecurren" tbuffercharacteris,ŠBLT.SƒPRT017non-printing,donotcheckfor(*¦end-of-lineorincrementthecharacter*¦countŠSPC…25ŠADD.L‚#1,CCBRLEN(A5)‹Incrementtheprintedcharacter*§count.ŠSPC…29ŠMOVE.LCCBRLEN(A5),D2‹DividetheprintedcharactercountAŠDIVUƒCCBCFIG+IOSLRL(A5),D2‚bythelogicallinelength.Storethe+ŠSWAP„D2”remainderinthelowerhalfofD2.ŠSPC…2*ŠTST.W‚D2—Ifanexactlogicalandphysical4ŠBNE.S‚PRT017‘end-of-linehasbeenreached,outputa@ŠCMP.W‚CCBCFIG+IOSREC(A5),D3‚linefeedfornon-auto-LFdevice.If3ŠBEQ.S‚PRT013‘onlythelogicallinelengthhasbeen3ŠBSR.S‚PRTEOL‘reached,outputalogicalend-of-line2ŠBRA.S‚PRT015‘sequence.Ifneitherlengthhasbeen&*§reachedproceedtotheend-of-buffer*§check.ŠSPC„2GPRT013„BTSTWƒ#IOALNFD,CCBCFIG+IOSATW(A5)Ifthedevicedoesnotsupport0ŠBNE.SƒPRT015autolinefeed,outputalinefeed5ŠMOVE.B#LF,D0‘ifthebytecountisanexactmultiple"ŠBSR.SƒDEVOUTSofthelinelength.ŠSPC…2FPRT015„BTSTW‚#IOATPLL,CCBCFIG+IOSATW(A5)Sinceanend-of-linehasbeen/ŠBNE.SƒPRT070“reached,terminatetherequestif!*ªthetruncateprintattributeis*ªset.ŠSPC„2=PRT017„CMP.LƒCCBEAP1(A5),A0ŠIftheendofbufferhasnotbeen/ŠBLT…PRTOUTreached,outputthenextcharacter.ŠSPC…2:PRT030„BSR.SƒPRTEOL‘Outputalogicalend-of-linesequence.ŠPAGEPRT070:*2*‚Finishedtransfer,nowqueueeventtorequestor.*+ŠBCLRW‚#CCBFGBSY,CCBFG(A5)ƒClearbusyflag.,ŠMOVE.LCCBTASKB(A5),A0‡PickupTCBaddress.3ŠSUB.B‚#1,TCBIOCNT(A0)‡DecrementI/Opendingcount. -ŠMOVE.W#ISTAOK,D3ŒSetupokIOSstatuscode..ŠAND.B‚#3,D0‘Maskfaultbitsofdevicestatus.ŠCMP.B‚#1,D0‘Anyfaults?"ŠBEQ.S‚PRT080Branchifnofaults.1ŠMOVE.W#ISTANR,D3ŒFault,setupIOSstatuscode.-PRT080„MOVE.L#6,D0‘Setupeventinfolength.*ŠMOVE.B#XPSNRM,D1ŒSetupeventtypecode.)ŠMOVE.LCCBCID(A5),D2‰SetupDCBaddress./ŠMOVE.BD3,IOSSTA(A3)‰UpdateIOCBstatusfield.8ŠMOVE.LCCBRLEN(A5),IOSLEN(A3)‚UpdateIOCBlengthfield. *ŠLEA„CCBPKT(A5),A4‰Setupeventdataarea./ŠBSR„QEVNT‘Queuecompletioneventtorequestor. ŠRTSŠPAGE*E*‹ThissubroutineoutputseitheraLF-CRsequenceoranEOLcharacter6*‰basedonthesettingoftheauto-linefeedattribute.*#PRTEOL„MOVE.BCCBCFIG+IOSELC(A5),D0?ŠBTSTWƒ#IOALNFD,CCBCFIG+IOSATW(A5)Ifnotanexactend-of-line,4ŠBNE.SƒDEVOUTSoutputtheEOLcharacteriftheauto-(*§linefeedattributeisset.Elseoutput*§aLFandCR.ŠSPC…2/ŠMOVE.B‚#LF,D0’CallDEVOUTtooutputalinefeed.ŠBSR.SƒDEVOUTcharacter.Ifanerrorstatusis1ŠTST.BƒD3”returnedinD3,transfercontroltotheŠBNE.SƒDEVOUTEerrorexit.ŠSPC„26ŠMOVE.B‚#CR,D0SetupcarriagereturncharacterinD0.ŠSPC„2*E*‹ThisroutineiscalledasasubroutinefromPRTOUTtooutputsingleF*‰charactersfromD0withautomaticrequestterminationifanerrorisD*‰detectedintheDEVOUTsubroutine.Executionalsofallsthroughto*‰herefromPRTEOL.*8DEVOUTSƒBSR.S‚DEVOUTCallDEVOUTtooutputthecharacter5ŠTST.B‚D3‘inD0.IfthestatusreturnedinD3isnon-'ŠBEQ.S‚DEVOUTOK‹zero,doanerrorexit.ŠSPC„2:DEVOUTEƒTST.L‚(A7)+Ifanerroroccurstransfercontrolto-ŠPEA.L‚PRT070therequestcompletionroutine.ŠSPC„2+DEVOUTOK‚RTS™Returntothecallingroutine.ŠPAGEO*********************************************************************************‚DEVOUT(*****MODIFIED1/27/83BYM.BRIEL*******<*†1.Checkforadevicefault(not-selectedoroutofpaper).=*ˆIfafaultispresent,terminatetherequestwithanerror.*F*†2.IfanPrinterAcknowledgeisexpected,waitfortheACKpulsefor@*‰approx.100us.Ifthepulsedoesnotarrivein100us,enable0*‰theAcknowledgeinterruptandexitthedriver.*4*†3.OutputthenextcharacterandpulseDataStrobe**ˆENTRY:„D0‚=databyte*’A1‚=devicebaseaddress*‘(SP)=returnaddress*4(SP)=PRTOUTreturnaddress*DEVICE=Interruptsdisabled*,*ˆEXIT:…D0‚=Dev" icestatusregistercontents*NORMAL=(SP)return*FAULT=(SP)+2return5*‘BUSY=4(SP)PRTOUTreturnaddress(deviceenabled)*K****************************************************************************DEVOUT:.‰CLR.BƒD3“ClearD3inpreparationforanormal *£return.‰SPC…2 ‰CLR.LƒD1.‰MOVE.B‚DEV1BD(A1),D1‰Pickupstatusregister. ‰MOVE.L‚D1,D2‘Makeanothercopy.&‰AND.Bƒ#$03,D1Maskuninterestedbits.-‰CMP.Bƒ#$01,D1SelectedandnotOut-of-Paper?‰BNE.SƒDEV010Faultexitifno.‰SPC…2:ŠTST.B‚CCBACKP(A5)ŠIfaprinteracknowledgeisnotpending,ŠBEQ.S‚DEV020proceedwithcharacteroutput.ŠSPC„2:ŠMOVE.W#32,D1RepeatedlytestfortheprinteracknowledgeDDEVACK„BTST.B#7,DEV1AC(A1)†pulse.Iftheacknowledgearrivesbefore;ŠDBNEƒD1,DEVACKŠthelooptimesout(approx.100us)proceed**£withcharacteroutput.Otherwise,enable**£theAcknowledgepulseinterruptandexit *£thedriver.ŠSPC„2 ŠBNE.S‚DEV020 * Enable Interrupts and Exit. :‰MOVE.B‚D0,CCBSAVB(A5)ˆThedeviceisbusy,savedatabyte..‰MOVE.L‚(A7)+,CCBIRTN(A5)…Savereturnaddress.-‰SUB.Lƒ#2,CCBIRTN(A5)ˆAdjustserviceaddress.‰SPC…2A‰MOVE.L‚(A7)+,CCBISTK(A5)…SavesubroutinereturnaddressintoCCB‰SPC…2‰INHIB™Disableinterrupts.3‰BSET„#0,DEV1BC(A1)‰Enabledevicefaultinterrupts.1‰BSET„#0,DEV1AC(A1)‰EnabledeviceACKinterrupts. ‰RTS›Return. * Fault Exit +DEV010ƒMOVE.L‚D2,D0‘Setupstatusregister.1‰BSR…DEVINIT1ŽReprogramdevicefornointerrupts.ŠSPC„2°1/17/84MLB*:ŠCLR.B‚CCBACKP(A5)ˆClearpendingprinteracknowledgeflag.=ŠTST.B‚DEV1AD(A1)‰ClearAcknowledgeinterruptIRQflaginPIAŠSPC„2°1/17/84MLB*+‰ST†D3”SetD3non-zerotoindicateanerror$‰BRA.SƒDEVOEXandpreparetoreturn. (*Outputthenextcharacter1/17/84MLB* @DEV020ƒTST.BƒDEV1AD(A1)ŒClearPIAAcknowledgeinterruptIRQflagŠSPC„2˜1/17/84MLB*'‰MOVE.B‚D0,DEV1AD(A1)‰Outputdatabyte. 1* data strobe (this technique for RTTLIO support) ‰BCLR„#3,DEV1AC(A1))‰BSET„#3,DEV1AC(A1)‰Strobethedatabyte.‰SPC…2—1/17/84MLB*8‰ST†CCBACKP(A5)‹Settheprinteracknowledgependingflag‰SPC…2—1/17/84MLB*0‰MOVE.B‚DEV1BD(A1),D0‰Getstatusregisteragain.‰SPC…20DEVOEXƒENABL™Enableinterruptsandreturntothe‰RTS™callingroutine.‰PAGEJ***************************************************************************!* INTERRUPT SIDE FOR PRT HANDLING*?*ƒPURPOSE:‚HANDLEACKNOWLEDGEMENTSANDMESSAGECOMPLETIONSFROM2*THEIOH.‚OPERATESATHARDWAREINTERRUPTPRIORITY=*LEVELASASUBROUTINETOTHEFIRSTLEVELINTERRUPTHANDLER.*+*ƒENTRY:‚JSR‚FROMINTERRUPTHANDLERROUTINE*‹A0-WORKREGISTER *‹A1=SELF*‹A5=ADDRESSOFCCB*‹D0=WORKREGISTER*/*ƒEXIT:‚RTS-BACKTOINTERRUPTHANDLERROUTINE**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A*****P****ƒEXECROUTINESCALLED:‚QEVENTI**ƒCODEISRE-ENTRANT*F*---------------------------------------------------------------------*4* If channel is off-line or not attached, just exit.*PRTISR:.ŠMOVE.LCCBCHB(A5),A1‰Getdevicebaseaddress. 5ŠMOVE.BDEV1AC(A1),D0‰PickupA-sidestatusregister.#ŠAND.B‚#$81,D0Maskinterruptbits."ŠCMP.B‚#$81,D0Interruptpending?ŠBEQ.S‚PRTI010Branchifyes.5ŠMOVE.BDEV1BC(A1),D0‰PickupB-sidestatusregister.#ŠAND.B‚#$81,D0Maskinterruptbits."ŠCMP.B‚#$81,D0Interruptpending?ŠBEQ.S‚PRTI010Branchifyes. 2ŠAND.W‚#$FFFE,SRNointerruptsosetconditionand ŠRTSšreturn. -PRTI010ƒBTSTW‚#CCBFGOFF,CCBSTR(A5)‚Off-line?ŠBNE.S‚PRTI020Branchifyes.5ŠBTSTW‚#CCBFGATH,CCBSTR(A5)‚Isthechannelattached?ŠBEQ.S‚PRTI020Branchifno.(ŠBTSTW‚#CCBFGBSY,CCBFG(A5)ƒI/Opending?ŠBNE.S‚PRTI100Branchifyes. 8PRTI020ƒMOVE.LCCBCHB(A5),A1‰Setupdevicebaseaddress.(ŠBSR„DEVINIT1ŽDisabledeviceinterrupts. ŠENABL!ŠOR.Wƒ#$0001,SRSetconditionand ŠRTSšreturn.ŠPAGEN******************************************************************************** INTE# RRUPT LEVEL PROCESSING*0*ˆIthasbeendeterminedthatI/Oisinprogress*ˆandtheinterruptisours.**N*******************************************************************************PRTI100:=ŠMOVEM.LD1-D7/A2-A4/A6,-(A7)Savetherestoftheregisters.1ŠBSR…DEVINIT1Reprogramdevicefornointerrupts.ŠSPC„2–1/17/84MLB*>ŠCLR.B‚CCBACKP(A5)ˆCleartheprinteracknowledgependingflag.;ŠTST.B‚DEV1AD(A1)‰ClearPIAAcknowledgeinterruptIRQflag.ŠSPC„2–1/17/84MLB*-ŠMOVE.L‚CCBPTR(A5),A0ˆRestorebufferpointer.1ŠMOVE.B‚CCBSAVB(A5),D0‡Restorecurrentdatabyte.5ŠMOVE.L‚CCBIRTN(A5),A2‡Getinterruptserviceaddress.'ŠMOVE.L‚CCBCCB(A5),A3ˆGetIOCBaddress.&ŠMOVE.L‚CCBCID(A5),A4ˆGetDCBaddress.8ŠADD.Bƒ#1,CCBICNT(A5)‡Incrementpendinginterruptcount.:ŠPEA…PRTINRTN(PC)‰Stacktheinterruptroutineexitaddress>ŠMOVE.L‚CCBISTK(A5),-(A7)„Restoresubroutinereturnaddresson*¦stack.!ŠJMP…(A2)‘Jumptooutputroutine. *.* PRT interrupt handler exits from this point.* PRTINRTN:7ŠSUB.Bƒ#1,CCBICNT(A5)‡Decrementpendinginterruptcount0ŠMOVEM.L(A7)+,D1-D7/A2-A4/A6Restoreregisters./***‡ENABL˜LetCMRenableinterruptslater,this%***¤fixisforEPSONRX80(SPR1178).(ŠOR.Wƒ#$0001,SRSetreturnconditionand!ŠRTSšreturntointerrupthandler.ŠPAGEJ**************************************************************************** QEVNT**„Placemessageonuser'sASQ.**ˆA4=addressofeventarea*ˆA5=addressofCCB'*ˆD0=eventlength(minusheaderinfo)*ˆD1=eventtype*ˆD2=4byteid(DCB)*ˆD3=statusvalue(2bytes)*ˆD4=devicestatus(2bytes)*ˆD5=devicenumber(1byte)*J***************************************************************************QEVNT:ŠMOVE.LD0,D6ŽSavelength.5ŠMOVE.L#2,D7ŽOffsetforstaging(noservicevector)./ŠMOVE.B#IOEVCD,1(A4)†Code(noservicevector).)ŠMOVE.LCCBSVVC(A5),2(A4)‚Servicevector.+ŠBEQ.S‚QEVNT10ŒBranchifnoservicevector./ŠADD.L‚#4,D0ŽCorrectlengthforservicevector.7ŠADD.L‚#4,D7ŽCorrectoffsetstagingforservicevector.2ŠADD.L‚#$00800000,(A4)„Correctforservicevector. 1QEVNT10ƒMOVE.BD1,0(A4,D7)ˆCompletioneventtype.*ŠMOVE.BCCBKEY(A5),1(A4,D7)User'sidkey.-ŠADD.L‚#4,D0ŽCompletelengthofreturnevent.6ŠCMP.B‚CCBASQL(A5),D0…User'smaximumASQentrylength.#ŠBLS.S‚QEVNT20ŒBranchiflengthok.0ŠMOVE.BCCBASQL(A5),D0…User'slengthissmaller. &QEVNT20ƒMOVE.BD0,(A4)ŒCorrectlength. /QEVNT40ƒMOVE.LD2,2(A4,D7)ˆSetupstatusvalue.$ŠMOVE.WD3,6(A4,D7)ˆSetupid(DCB).ŠCMP.B‚#6,D6Ž6byteinfo?ŠBEQ.S‚QEVNT50ŒBranchifyes.)ŠMOVE.WD4,8(A4,D7)ˆSetupdevicestatus.ŠCMP.B‚#8,D6Ž8byteinfo?ŠBEQ.S‚QEVNT50ŒBranchifyes.*ŠMOVE.BD5,10(A4,D7)‡Setupdevicenumber.&ŠCLR.B‚11(A4,D7)ŠClearreservedfield.*I* Now let's put the completion into registers and send event to the task.* QEVNT50ƒEQU„*ŠMOVEM.L(A4),D2-D7ŠBSR.S‚IOHQEVNTŠRTSŠPAGEK*****************************************************************************9* ROUTINE TO QUEUE EVENT (ALREADY STAGED IN REGISTERS) TO*ƒ-DRIVINGTASK. *ƒ-EVENTBEGINSINREGISTERD2.***ˆEXECROUTINE/*ˆREGISTERSUSED:D0-D1/A0,A3-A6‚WORKREGISTERS*˜D2-D7‹STAGINGREGISTERS**K**************************************************************************** IOHQEVNT:$ŠMOVEM.LA3-A5,-(A7)‡Ssveregisters.-ŠMOVE.LCCBRQSTA(A5),A0„Caller'sTCBaddress.ŠSPC„26ŠMOVE.L#T0QEVNTI,D0‰Ifthisroutinewascalledduring6ŠTST.B‚CCBICNT(A5)ˆinterruptprocessing,usetheQEVNT3ŠBNE.S‚IOHQ4Žinterruptroutine,elseusethenormal#ŠMOVE.L#T0QEVNTT,D0‡QEVNTroutine. IOHQ4…TRAPƒ#0#ŠBRA.S‚IOHQ5ŽBranchifqueueingok.'ŠMOVEM.L(A7)+,A3-A5‡Restoreregisters.9ŠMOVE.L(A7),CCBQVER1(A5)‚Savecallersaddressfordebug.ŠBRA.S‚IOHQRTN ,IOHQ5…MOVEM.L(A7)+,A3-A5‡Restoreregisters..ŠCLR.L‚CCBQVER1(A5)‡Clearqueueerroraddress. IOHQRTNƒRTS—RETURNŠEND# éééé=/*=/*†PV01DRV.AF=/*@=/* Chain file to assemble the printer driver for the VM01 board=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to PV01DRV.LS=/*=/IFC \1ƒ=ARGPV01DRV.LS=/ENDIF=/*%=ASM PV01DRV.SA,PV01DRV.RO,\1;MRZ=146=/*{ Included files are:=/*ƒ9995.&.TRACE.EQ=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ=/*ƒ9995.&.LV5.EQ=/*}=/*=ENDéééééélŠPAGEKPV01DRVƒIDNTƒ4,4VERSAdosLocalPrinterI/OHandlerProcessV4.4-09/04/848ŠTTL„VERSADOSVM01LOCALPRINTERPROCESSV4.4-09/04/84 ŠLLENƒ120ŠNOLISTŠINCLUDE9995.&.TRACE.EQŠINCLUDE9995.&.STR.EQŠINCLUDE9995.&.TCB.EQŠINCLUDE9995.&.CCB.EQŠINCLUDE9995.&.IOE.EQŠINCLUDE9995.&.NIO.EQŠINCLUDE9995.&.LV5.EQŠLIST ŠNOFORMATJ****************************************************************************1* PRT -- REV. 1.00 02NOV81 (TL09) JIM SMITH - IOH9*ˆREV.1.0101FEB82(TL09)JIMSMITH-VECTORCHAIN(IOH)5*ˆREV.1.0223FEB82(TL09)JIMSMITH-IOCBUSE(IOH)5*ˆREV.2.0015APR82(TL09)JIMSMITH-PRINTERDRIVER5*ˆREV.2.0101JUN82(TL09)MARCBRIEL-PRINTERDRIVER5*ˆREV.2.1015JUL82(TL09)MARCBRIEL-PRINTER$ DRIVER-*ˆREV‚2.2018JAN84ˆMARCBRIEL-PRINTERDRIVER.*ˆREV‚3.0004SEP84ˆMIKEDUH‚-ADAPTEDFORVM01;*ˆREV‚3.0117DEC84ˆMIKEDUH‚-RemovedENABLatPRTINRTNfor *­SPR1178(EpsonRX80printer).*«-FixedHALTroutine.8*ˆREV‚3.028MAR85‰DICKV.ƒ-HALTROUTINEREGISTERCHANGEééé u~.†CŽC–@žJ¦>®>¶C¾7Æ0Î7Ö?Þ<æSî2ö;þ93C:@*$*ƒPURPOSE:‚VM01LOCALPRINTERDRIVER*/*ƒENTRY:‚JSRFROMCMRHANDLER(COMMANDSERVICE) *‹JSRFROMCMRINTERRUPTHANDLER*-*ƒEXIT:-ALWAYSEXITSWITHARTSINSTRUCTION***ƒCODEISRE-ENTRANT**H*-----------------------------------------------------------------------**‚INCLUDEDFILES:**‰INCLUDE9995.&.TRACE.EQ*‰INCLUDE9995.&.STR.EQ*‰INCLUDE9995.&.TCB.EQ*‰INCLUDE9995.&.CCB.EQ*‰INCLUDE9995.&.IOE.EQ*‰INCLUDE9995.&.NIO.EQ*‰INCLUDE9995.&.LV5.EQ*PRTORG:ŠPAGE(****************************************(* EQUATES FOR SPECIAL ASCII CHARACTERS *(*****************************************NUL†EQU‡$00‘NullBEL†EQU‡$07‘BellBS‡EQU‡$08‘BackspaceLF‡EQU‡$0A‘LinefeedFF‡EQU‡$0C‘FormfeedCR‡EQU‡$0D‘CarriagereturnSPACE„EQU‡$20‘Blank ******************* DEVICE EQUATES ********************DEV1ADƒEQU‡1“Printerdatabuss./DEV1BDƒEQU‡0“Printerstatus(paperout,select)0DEV1ACƒEQU‡5“READ‚bit7=ACKNOWLEDGEinterrupt.#*¦WRITEbit3=DATASTROBEoutput.éééH* note: ACKNOWLEDGE interrupt flag (bit 7) is cleared by reading DEV1AD.*DEV1BCƒEQU‡4“READ‚bit7=FAULTinterrupt.#*¦WRITEbit3=INPUTPRIMEoutput.B* note: FAULT interrupt flag (bit 7) is cleared by reading DEV1BD. ************************** MISCELLANEOUS EQUATES ***************************IOEVCD„EQU„1’I/OeventcodeDVALATM„EQU„1<ŠMOVE.LXIOCPK(A2),D6†Setupaddressofcommandpacket(IOCB).6ŠMOVE.WXIOPLN(A2),D5†Setuplengthofcommandpacket.+ŠMOVE.LCCBTASKA(A5),A1„SetupTCBpointer.&ŠBSR„IOHADRCK‹Callconversionroutine.ŠBRA.S‚PRTU010ŒGoodreturn.)ŠMOVE.B#ISTAIP,D1‰SetupIOSerrorcode.ŠBRA„NRMEXITŒExit.=PRTU010ƒMOVE.LD6,A3ŽSavephysicaladdressofcommandpacket.**‚CheckforHALTcommand.*(ŠCMP.Wƒ#IOHALT,IOSFCT(A3)…HALTcommand?!ŠBEQ…HALT“BranchifHALTcommand.** See if channel is busy.*)ŠBTSTW‚#CCBFGBSY,CCBFG(A5)‚Channelbusy?ŠBEQ.S‚PRTU020ŽBranchifno.6ŠMOVE.B#XSTBSY,D0‹Busy,setupchannelerrorcodeandŠBRA„IOHUSRTNReturn.ŠPAGE*K****************************************************************************(*‚Findthecommandinthecommandtable.*** PRTU020:8ŠMOVE.WIOSOPT(A3),CCBCOPT(A5)SaveIOCBoptionsinCCB.6ŠMOVE.LXIOUID(A2),CCBCID(A5)‚SaveDCBpointerinCCB.(ŠMOVE.LA3,CCBCCB(A5)†SaveIOCBpointer.*ŠMOVE.LXIOUID(A2),A4†PickupDCBpointer.9ŠMOVE.LCCBTASKA(A5),CCBTASKB(A5)‚SetupbuffertaskTCB. -ŠMOVEQ‚#NUMCMDS-1,D0†Setuptheloopcounter./ŠLEA„CMDTBL,A0ŠA0<--addressofcommandtable./ŠMOVE.WIOSFCT(A3),D6†Setupusercommandcode. 8CMDSRCHƒCMP.W‚(A0)+,D6‹Searchthetableforthecommand.ŠDBEQƒD0,CMDSRCH‰* 3ŠB% NE.S‚CMDERRIfwefoundthecommandinthetable,8ŠADD.L‚#JMPOFF-2,A0‡getthecorrespondingentryfromthe5ŠMOVE.W(A0),D0Œjumptableandjumptotheroutineto"ŠJMP„(A0,D0.W)Šhandlethecommand. ?CMDERR„MOVE.B#ISTAIF,D1‰Wedidn'tfindit,soexitwitherror. ŠBRA„NRMEXITŠPAGEL******************************************************************************‰WRITE**,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB%*‰A6=addressofattachedtask'sTCB***L*****************************************************************************WRITE:5‰BSR‡IOSCOMNDothestuffcommontoallI/Ocommands. -‰BSETW…#CCBFGBSY,CCBFG(A5)Markchannelbusy.6‰CLR.L…CCBRLEN(A5)‰Initializetheoutputbytecounter.1‰MOVE.L„CCBCHB(A5),A1‡Setupdevicebaseaddress. ‰BSR‡DEVINIT1ŒSetupthedevice.‰SPC‡2=‰MOVE.L„CCBTASKB(A5),A0‡PickuptheTCBaddressofIOCBowner;‰ADD.B…#1,TCBIOCNT(A0)…andincrementhispendingI/Ocount.‰SPC‡2,‰MOVE.L„CCBPTR(A5),A0‡Setupbufferpointer.‰SPC‡2@‰BTSTW…#IOASNFF,CCBCFIG+IOSATW(A5)Iftheformfeedafterassign4‰BNE.S…WRIT010attributeis0sendaFFcharacterif)*¦thisisthefirstoutputinthecurrent *¦assignment.‰SPC‡20‰TST.B…DCBBCT(A4)ŠDoweneedtodoaformfeed?‰BNE.S…WRIT010Branchifno."‰STˆDCBBCT(A4)ŠSetformfeedflag.(‰MOVE.B„#FF,D0ŽYes,setupFFcharacter.!‰BSR‡PRTOUT1Gooutputtodevice.‰BRA.S…WRIT020Return. 'WRIT010‚BSR‡PRTOUTŽStartbufferoutput. !WRIT020‚UNMASK˜Enableinterrupts.‰BRA‡CMDEXITGOFINISHUP‰PAGEM*******************************************************************************‰REQUESTSTATUS*$*‰Entry:A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M******************************************************************************REQSTAT: *E*‚Gettheaddressofhisdatablockandmoveourconfigurationthere.*2ŠBSR„CNFGADRŒGetthephysicaladdressoftheusers*£configurationblock.ŠSPC„24ŠBSR.S‚STATYPSetupthedevicestatus,channeltype,&*£devicetype,anddrivercodesinthe*£user'sconfigureblock.ŠSPC„2>ŠMOVE.W#VALATM,IOSATM(A0)„ReturnthesupportedattributesandBŠMOVE.W#VALPRM,IOSPRM(A0)‚parametersmasksintheusersconfigure*¤block.ŠSPC„2BŠMOVE.L#(IOSPLN/2)-1,D0ƒD0<--loopcontroltomoveentireblock.'REQLOOPƒMOVE.W(A0)+,(A1)+ˆMoveaword.5ŠDBRAƒD0,REQLOOP‰Keepmovinguntilwholeblockmoved. 'ŠMOVE.B#ISTAOK,D1‰ExitwithOKstatus.ŠBRA„NRMEXITŒ*ŠSPC„2*A*„Thissubroutinestoresthecurrentdevicestatus(alwaysready),E*‚channeltype,devicetype,anddrivercodeintotheusersconfigureL*‚block.NotethatthesevaluesarereturnedonlyonRETRIEVEDEVICESTATUS/K*‚CONFIGURATION,CONFIGUREDEVICE,andCHANGEDEFAULTCONFIGURATIONrequests/*‚onlywhennoconfigurtionerrorwasdetected.*5STATYP„CLR.B‚IOSDST(A0)ŽReturnon-linedevicestatus.AŠMOVE.BCCBTYPE(A5),IOSCTP(A0)‚Returnthechanneltypedefinedin *¨theCCB.2ŠMOVE.B#XDSPRT,IOSDTP(A0)†DevicetypeisPRINTER.?ŠMOVE.B#IODLPRT,IOSDRC(A0)…ThisisalocalCentronicsprinter.ŠRTSŠPAGEM****************************************************************************** *‰CONFIGURE*@*‰ThiscommandchangestheCCBconfiguration,theonefromwhich<*‰thedriversetsupthedeviceandunderwhichitperforms.*,*‰Entry:A2=addressofCMRparameterblock*A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M****************************************************************************** CONFIGUR: *B*‚Getthephysicaladdressoftheuser'sconfigurationdatablock.*2ŠBSR„CNFGADRŒGetthephysicaladdressoftheusers*£configurationdatablock.ŠSPC„21ŠMOVE.LXIOUID(A2),A4†A4<--baseaddressofDCB. =ŠMOVE.B#CECCDO,D2ŠIfhe'stryingtochangethewritetimeout?ŠBTSTW‚#IOSWTOB,IOSPRM(A1)value,returnaconfigurationerror. ŠBNE& „CNFGERRŠSPC„2DŠMOVE.LDCBDEV+IOSWTO(A4),IOSWTO(A0)Update(intheCCB)thetimeout/ŠBRA.S‚CMNCNFGŒvaluesfromtheDCB,sotheycan,*£becopied,anddothecommonconfiguration *£processing.ŠPAGEM*******************************************************************************‰CHANGEDEFAULTCONFIGURATION*6*‰ThiscommandchangestheDCBconfiguration,towhich4*‰IOSwillrestoreus(viaaCONFIGUREcommand)when/*‰FHSclosesthelastallocationofthedevice.*$*‰Entry:A3=addressofuser'sIOCB*A5=addressofmyCCB**‰ExitstoNRMEXIT*M***************************************************************************** CHNGDEF: *H*‚Firstgetthephysicaladdressoftheuser'sconfigurationdatablock.*8ŠBSR„CNFGADR2‹Gettheaddressoftheusersconfiguration,*£datablock.ThisentrypointpreservesA0.ŠSPC„27ŠMOVE.LXIOUID(A2),A0ˆLoadtheaddressoftheDCBinA46ŠMOVE.LA0,A4ŽandtheaddressoftheDCBconfigurationŠADD.L‚#DCBDEV,A0‰blockinA0. ŠPAGEM*******************************************************************************‰COMMONCONFIGURATIONROUTINE*7*‰Thisroutinedoestheworkcommontothetwocommands-*‰CONFIGUREandCHANGEDEFAULTCONFIGURATION.*7*‰Entry:A0=AddressofCCBorDCBconfigurationblock,*A1=Addressofuser'sconfigurationblock*M***************************************************************************** CMNCNFG:*L*ƒFirst,boththeattributesandparametersmasksarecheckedtoseeifbitsL* corresponding to unsupported attributes or parameters are set. If any such2* bits are set, a configuration error is returned.*7ŠMOVE.W#CECUAP,D2‹Setupforanerrorexitincasethe&*£useristryingtochangeunsupported*£attributesorparameters.ŠSPC„29ŠMOVE.W#NVALATM,D0ŠZerothebitsoftheusersattributes<ŠAND.W‚IOSATM(A1),D0†maskthatcorrespondtosupportedpara-5ŠBNE.S‚CNFGERRŒmeters.Ifanyremainingbitsareset,*£returnanerror.ŠSPC„29ŠMOVE.W#NVALPRM,D0ŠZerothebitsoftheusersattributes<ŠAND.W‚IOSPRM(A1),D0†maskthatcorrespondtosupportedpara-5ŠBNE.S‚CNFGERRŒmeters.Ifanyremainingbitsareset,*£returnanerror.ŠSPC„2E*‚Nextweneedtoseewhathisproposedconfigurationwilllooklike.D*‚Plugintohisdatablockthecurrentvaluesforthoseattributes&?*‚parametershedoesn'twanttochange.‚Theappropriatecurrent(*‚configurationisatA0andhe'satA1.*ŠOPT„BRS6ŠMOVE.WIOSATM(A1),D0†Setuptheusersattributemask.;ŠAND.W‚D0,IOSATW(A1)†Zeroouttheattributesofhisthathe.ŠNOT.W‚D0‘doesn'twanttochange,zerooutthe<ŠAND.W‚IOSATW(A0),D0†attributesofminethathedoeswantto:ŠOR.WƒD0,IOSATW(A1)†change,andcombinetheminhisspace. @ŠMOVE.WIOSPRM(A1),D0†Getmaskofparametershewantstochange. 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheLINEWIDTH,'ŠIFTHENcopythecurrentsetting.ŠMOVE.WIOSREC(A0),IOSREC(A1)ŠENDI 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheLINES/PAGE,'ŠIFTHENcopythecurrentsetting.ŠMOVE.LIOSRSZ(A0),IOSRSZ(A1)ŠENDI 3ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheWRITETIMEOUT.ŠIFTHENŽvalue,copythecurrentsetting.ŠMOVE.LIOSWTO(A0),IOSWTO(A1)ŠENDI 3ŠLSR.W‚#2,D0ŽSkipovertheREADTIMEOUTbit.Ifthe'*£LOGICALRECORDLENGTHbitisnotset,*£copythecurrentsetting. ŠIFTHENMOVE.W‚IOSLRL(A0),IOSLRL(A1)ŠENDI 1ŠLSR.W‚#1,D0ŽIfhe'snotchangingtheEND-OF-LINE/ŠIFTHENŽSTRING,copythecurrentsetting.ŒMOVE.BIOSELC(A0),IOSELC(A1)ŠENDIŠOPT„BRL*I*ƒNowthattheusersconfigurationblockcontainstheproposedattributesG* and parameters, they will be checked for validity before copying them* into the DCB or CCB.*8ŠMOVE.B#CECPNI,D2ŒIftheauto-linefeedattributeisset@ŠBTSTW‚#IOALNFD,IOSATW(A1)andtheendoflinecharacterisnull,ŠBEQ.S‚CMNC001returnaconfigurationerror.ŠTST.B‚IOSELC(A1)ŠBEQ.S‚CNFGERRŠSPC„2CCMNC001ƒMOVE.B& #CECPRLZ,D2ŠIfeitherthelogicalorphysicalrecord<ŠMOVE.WIOSREC(A1),D0†lengthiszero,returnaconfigurationŠBEQ.S‚CNFGERRŒerror.ŠMOVE.WIOSLRL(A1),D3ŠBEQ.S‚CNFGERRŠSPC„24ŠCMP.W‚D3,D0Ifthelogicalrecordlengthisgreater5ŠBHS.S‚OKCNFGthanthephysicalrecordlength,return*ŠMOVE.B#CECPLGP,D2ˆaconfigurationerror.ŠSPC„2ACNFGERRƒMOVE.B#ISTACFG,D1‰Returnaconfigurationerrorstatusin>ŠMOVE.BD2,IOSCEC(A1)†theusersIOSparameterblockandreturn8ŠBRA.S‚CNFGEXIT‹thespecificconfigurationerrorcodein *£theusersconfigurationblock.ŠSPC„2F*…SettheconfigurationflagbyteinthedeviceDCBtoindicatethataK*‚CONFIGUREorCONFIGUREDEFAULTSrequestwasprocessed.FHSwillchecktheM*‚flagwhenitclosesthelastassignmenttothedevicetoseeifitneedstoH*‚tellIOStoissueaconfigurerequest.IOSwillthenissueaCONFIGUREJ*‚requestusingthedeviceDCBdefaultconfigurationparameters.ThiswillI*‚alwaysforcethecurrentconfigurationtothedefaultwheneverthelast*‚assignmentisclosed.*I*…SubroutineSTATYPiscalledtostorethecurrentdevicestatus,channelH*‚type,devicetype,anddrivercodeintotheusersconfigurationblock.*ŠMOVE.BCCBRLEN(A5),IOSLEN(A3)UpdateusersIOCBlengthfield.ŠCLR.L‚CCBRLEN(A5)ŠSPC„2=ŠMOVE.LCCBTASKB(A5),A0‡PickuptheTCBaddressofIOCBowner;ŠSUB.B‚#1,TCBIOCNT(A0)‡anddecrementhispendingI/Ocount.ŠSPC„2*!*‚Preparetheeventandqueueit.*8ŠMOVE.B‚#ISTATO,IOSSTA(A3)ƒUpdatetheIOCBstatusfield.,ŠMOVE.W‚#ISTATO,D3‹Setupeventstatusfield-ŠMOVE.B‚#XPSHLT,D1‹Setupeventstatusvalue.!ŠMOVE.L‚#6,D0Setupinfolength.&ŠMOVE.L‚CCBCID(A5),D2ˆSetupeventID..ŠLEA…CCBPKT(A5),A4ˆSetupeventbuildpointer.ŠBSR…QEVNTQueueevent.ŠB' RA…CMDEXITŽRETURN ŠPAGEL******************************************************************************C*‰ROUTINECOMMONTOALLI/OCOMMANDS(READ,WRITE,OUTPUTW/INPUT)**‚Entry:A3=addressofIOCB*‰A5=addressofCCB**L*****************************************************************************IOSCOMN:?ŠBTSTW‚#IOPTSKB,IOSOPT(A3)Ifthebuffersresideinadifferent"ŠBEQ.S‚IOSC005ŒtaskfromtheIOCB, 9ŠLEA„IOSTSK(A3),A0†Pointtothetaskname&sessionofthe7ŠTR0$.GETTCB‚,Œbufferowner&callexectogetaddress."ŠBRA.S‚OKTCBŽIfit'sgood,branch.ŠNOP—Ifit'sbad,6ŠMOVE.B#XSTADB,D1‰setstatusinIOCBtoaddresserrorŠTST.L‚(A7)+ŽadjuststackŠBRA.S‚NRMEXITŒandexittoCMR. :OKTCB…MOVE.LA0,CCBTASKB(A5)„SavephysicaladdressofTCB. *<*‚ValidatetheinfointheIOCBabouttheprimarybufferand *‚converttophysicaladdresses.*BIOSC005ƒMOVE.LIOSSAD(A3),D6†D6<--bufferphysicalstartaddress.+ŠMOVE.LIOSEAD(A3),D5†D5<--bufferlength.ŠSUB.L‚D6,D5Ž* ŠADDQƒ#1,D5Ž*ŠSPC„25ŠMOVE.LD5,-(A7)‹Savethebufferlengthonthestack.ŠSPC„2>ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner."ŠBSR.S‚IOHADRCK‹Checktheaddress.$ŠBRA.S‚IOSC010ŒIfit'sgood,branch.9ŠADDQ.L#8,A7ŽIfit'sabadbaseaddress,removesavedD5&*£andadjustthestackreturnaddress.ŠSPC„24ŠMOVE.B#ISTAADD,D1ˆSetIOCBstatustoADDRESSERROR6ŠBRA.S‚NRMEXITŒandexitwithappropriateerrorstatus. @IOSC010ƒMOVE.LD6,CCBPTR(A5)†SavephysicalstartaddressinCCB.2ŠADD.L‚(A7)+,D6‹Savethephysicalendaddressplus&ŠMOVE.LD6,CCBEAP1(A5)…oneintheCCB.ŠRTSŠPAGEK****************************************************************************=*‰VALIDATECONFIGURATIONBUFFERADDRESS&CONVERTTOPHYSICAL*$*‰Entry:D5=bufferlengthinbytes-*D6=bufferlogicalstartaddr(toconvert)*A3=addressofIOCB*A5=addressofCCB***‰Exit:‚D6ƒ=bufferphysicalstartaddress*D5ƒ=bufferlength*K****************************************************************************CCNFGADRƒLEA.L‚CCBCFIG(A5),A0…ThisentrypointloadstheCCBconfig.*£datablockintoA0.ŠSPC„2.CNFGADR2‚MOVE.LA0,-(A7)‹SaveA0onthestack.?ŠMOVE.LIOSDBP(A3),D6†D6<--logicaladdrofuser'sdatablock./ŠMOVE.L#IOSPLN,D5‰D5<--lengthofdatablock.ŠSPC„2>ŠMOVE.LCCBTASKB(A5),A1„A1<--addressofTCBofbufferowner."ŠBSR.S‚IOHADRCK‹Checktheaddress.%ŠBRA.S‚CNFGADR3‹Ifit'sgood,branch.ŠSPC„27ŠADD.L‚#8,A7ŽIftheaddressorlengthisbad,cleanthe<ŠMOVE.B#ISTAADD,D1ˆstack,setIOCBstatustoADDRESSERROR,6ŠBRA.S‚NRMEXITŒandexitwithappropriateerrorstatus.ŠSPC„2=CNFGADR3‚MOVE.LD6,A1ŽStorethephysicaladdressoftheusers9ŠMOVE.L(A7)+,A0‹datablockinA1,restoreA0andreturn.ŠRTSŠPAGEO******************************************************************************** *ˆNORMALEXIT*,*‚Entry:A2=addressofCMRparameterblock*‰A3=addressofIOCB*‰A4=addressofDCB*‰A5=addressofCCB*‰A6=addressofusersTCB*‰D1=IOSerrorcode*I**************************************************************************NRMEXIT:*‰LEA‡CCBPKT(A5),A4‡Setupqueueworkarea.!‰MOVE.L„#6,D0Setuppacketsize.#‰MOVE.L„XIOUID(A2),D2‡SetupPBid.#‰AND.W…#$FF,D1Maskforwordvalue."‰MOVE.W„D1,D3Setupstatusvalue./‰MOVE.B„D1,IOSSTA(A3)‡UpdateIOCBstatusfield.%‰MOVE.B„#XPSNRM,D1ŠSetupeventtype.‰BSR‡QEVNTGoqueueevent.CMDEXIT‚CLR.L…D0*8* User request side of IOH always exits from this point.*IOHUSRTN‚EQU„*ŠRTS—RETURNTOMAINLINEŠPAGEK****************************************************************************B*ƒSubroutinetocheckaddressboundariestoseeifentirelywithin* calling tasks address space.*&*‚Entry:D5-‚numberofbytestocheck*‰D6-‚68000address(logical)*‰A1-‚TCBaddress***** EXEC ROUTINE#* REGISTERS USED: D0-D1,D3,D6/A0-A1**7*EXIT:„D6-PHYSICA' LADDRESSOFBUFFERBASE(IFLEGAL)*ŠRETURNTOPC„FORGOODADDRESS*”PC+2‚FORBADLENGTH*”PC+4‚FORBADADDRESS*F*********************************************************************** IOHADRCK:%ŠBTSTƒ#0,D6‘Mustbeonworkboundary.)ŠBNE.S‚IOHADR6Branchifbadbufferbase.ŠTST.L‚D5”Lengthcan'tbezero.2ŠBEQ.S‚IOHADR8Don'tgotologphywithzerocount. IOHADR2ƒEQU„*1ŠMOVE.LTCBTST(A1),A0‰Addressoftaskseg.table. ŠTR0$.LOGPHY.ŠBRA.S‚IOHADR8Branchforgoodaddressreturn.3IOHADR6ƒADD.L‚#2,(A7)AdjustPCforinvalidreturn.IOHADR8ƒRTSšReturn.ŠPAGEI***************************************************************************ˆGETTCBROUTINE*)*’ENTRY:A0=POINTERTOTASKANDSESSION***’EXECROUTINE*’REGISTERSUSED:D0-D1/A0-A1***’EXIT:A0=TCBADRESS**˜RETURNTOPC„FORGOODTASKSPECIFICATION!*¢PC+2‚FORBADTASKSPECIFICATION**J***************************************************************************GETTCB: ŠTR0$.GETTCB&ŠBRA.S„GETT10ŽGoodtaskspecification.ŠNOPšBadtaskspecification.&ŠADD.L„#2,(A7)Badtaskspecification.GETT10„RTSšReturn.ŠPAGEL******************************************************************************‚PRTOUT*%*ˆThisistheprinteroutputroutine.***ˆENTRY:‚A0=addressofbuffer*A1=addressofdevicebase*A3=addressofIOCB*A4=addressofDCB*A5=addressofCCB*.* PRTOUT1 ENTRY: D0.B = character to be output*—otherregistersasabove*M******************************************************************************CPRTIMG„ADD.L‚#1,CCBRLEN(A5)†Forimagemode,counteachbytesentto>ŠCMP.L‚CCBEAP1(A5),A0„theprinterwhetherprintableornot.If6ŠBEQ.S‚PRT070Œtheendofthebufferisreached,dothe *¢requestcompletionprocessing.ŠSPC„2PRTOUT:0ŠMOVE.B‚(A0)+,D0ŽGetnextdatabytefrombuffer.,ŠMOVE.L‚A0,CCBPTR(A5)‰Updatebufferpointer.ŠSPC…2;ŠBTSTWƒ#IOPFORB,CCBCOPT(A5)„Forimagemodeoutput,skipthe,ŠBNE.SƒPRTOUT1specialcharacterprocessing.ŠSPC…20ŠCMP.B‚#CR,D0“Ifthecurrentbuffercharacteris,ŠBEQ.S‚PRT030‘aCR,proceedwithend-of-line *§processing.ŠSPC…2+PRTOUT1ƒBSR.LƒDEVOUTSOutputthedatabyte.ŠSPC„2EPRT010„BTSTWƒ#IOPFORB,CCBCOPT(A5)„Iftheoutputisbringperformedin1ŠBNE.SƒPRTIMGimagemode,transfercontroltothe%*§topoftheoutputlooptocheckfor*§endofbuffer.ŠSPC…25ŠCMP.Bƒ#'',-1(A0)Ifthecurrentbuffercharacteris,ŠBLT.SƒPRT017non-printing,donotcheckfor(*¦end-of-lineorincrementthecharacter*¦countŠSPC…25ŠADD.L‚#1,CCBRLEN(A5)‹Incrementtheprintedcharacter*§count.ŠSPC…29ŠMOVE.LCCBRLEN(A5),D2‹DividetheprintedcharactercountAŠDIVUƒCCBCFIG+IOSLRL(A5),D2‚bythelogicallinelength.Storethe+ŠSWAP„D2”remainderinthelowerhalfofD2.ŠSPC…2*ŠTST.W‚D2—Ifanexactlogicalandphysical4ŠBNE.S‚PRT017‘end-of-linehasbeenreached,outputa*G*‚THEFOLLOWINGWASADDEDTOTHEVM01PRINTERDRIVERTOFIXTHEPROBLEML*‚OFTHEORIGINALDRIVER.‚ITDIDACOMPARISONOFTHEPHYSICALLINELENGTHTOH*‚REGISTERD3.‚THISREGISTERWASNEVERSETUP.‚ITHINKTHEINTENTWASTO>*‚COMPARETHEPHYSICALLINELENGTHTOTHELOGICALLINELENGTH.BŠMOVE.WCCBCFIG+IOSLRL(A5),D3‚(FIRSTLOADTHELOGICALLINELENGTH)*@ŠCMP.W‚CCBCFIG+IOSREC(A5),D3‚linefeedfornon-auto-LFdevice.If3ŠBEQ.S‚PRT013‘onlythelogicallinelengthhasbeen3ŠBSR.S‚PRTEOL‘reached,outputalogicalend-of-line2ŠBRA.S‚PRT015‘sequence.Ifneitherlengthhasbeen&*§reachedproceedtotheend-of-buffer*§check.ŠSPC„2GPRT013„BTSTWƒ#IOALNFD,CCBCFIG+IOSATW(A5)Ifthedevicedoesnotsupport0ŠBNE.SƒPRT015autolinefeed,outputalinefeed5ŠMOVE.B#LF,D0‘ifthebytecountisanexactmultiple"ŠBSR.SƒDEVOUTSofthelinelength.ŠSPC…2FPRT015„BTSTW‚#IOATPLL,CCBCFIG+IOSATW(A5)Sinceanend-of-linehasbeen/ŠBNE.SƒPRT070“reached,terminatetherequestif!*ªthetruncateprintattributeis*ªset.ŠSPC„2=PRT017„CMP.LƒCCBEAP1(A5),A0ŠIftheendofbufferhasn( otbeen/ŠBLT…PRTOUTreached,outputthenextcharacter.ŠSPC…2:PRT030„BSR.SƒPRTEOL‘Outputalogicalend-of-linesequence.ŠPAGEPRT070:*2*‚Finishedtransfer,nowqueueeventtorequestor.*+ŠBCLRW‚#CCBFGBSY,CCBFG(A5)ƒClearbusyflag.,ŠMOVE.LCCBTASKB(A5),A0‡PickupTCBaddress.3ŠSUB.B‚#1,TCBIOCNT(A0)‡DecrementI/Opendingcount. -ŠMOVE.W#ISTAOK,D3ŒSetupokIOSstatuscode..ŠAND.B‚#3,D0‘Maskfaultbitsofdevicestatus.ŠCMP.B‚#1,D0‘Anyfaults?"ŠBEQ.S‚PRT080Branchifnofaults.1ŠMOVE.W#ISTANR,D3ŒFault,setupIOSstatuscode.-PRT080„MOVE.L#6,D0‘Setupeventinfolength.*ŠMOVE.B#XPSNRM,D1ŒSetupeventtypecode.)ŠMOVE.LCCBCID(A5),D2‰SetupDCBaddress./ŠMOVE.BD3,IOSSTA(A3)‰UpdateIOCBstatusfield.8ŠMOVE.LCCBRLEN(A5),IOSLEN(A3)‚UpdateIOCBlengthfield. *ŠLEA„CCBPKT(A5),A4‰Setupeventdataarea./ŠBSR„QEVNT‘Queuecompletioneventtorequestor. ŠRTSŠPAGE*E*‹ThissubroutineoutputseitheraLF-CRsequenceoranEOLcharacter6*‰basedonthesettingoftheauto-linefeedattribute.*#PRTEOL„MOVE.BCCBCFIG+IOSELC(A5),D0?ŠBTSTWƒ#IOALNFD,CCBCFIG+IOSATW(A5)Ifnotanexactend-of-line,4ŠBNE.SƒDEVOUTSoutputtheEOLcharacteriftheauto-(*§linefeedattributeisset.Elseoutput*§aLFandCR.ŠSPC…2/ŠMOVE.B‚#LF,D0’CallDEVOUTtooutputalinefeed.ŠBSR.SƒDEVOUTcharacter.Ifanerrorstatusis1ŠTST.BƒD3”returnedinD3,transfercontroltotheŠBNE.SƒDEVOUTEerrorexit.ŠSPC„26ŠMOVE.B‚#CR,D0SetupcarriagereturncharacterinD0.ŠSPC„2*E*‹ThisroutineiscalledasasubroutinefromPRTOUTtooutputsingleF*‰charactersfromD0withautomaticrequestterminationifanerrorisD*‰detectedintheDEVOUTsubroutine.Executionalsofallsthroughto*‰herefromPRTEOL.*8DEVOUTSƒBSR.S‚DEVOUTCallDEVOUTtooutputthecharacter5ŠTST.B‚D3‘inD0.IfthestatusreturnedinD3isnon-'ŠBEQ.S‚DEVOUTOK‹zero,doanerrorexit.ŠSPC„2:DEVOUTEƒTST.L‚(A7)+Ifanerroroccurstransfercontrolto-ŠPEA.L‚PRT070therequestcompletionroutine.ŠSPC„2+DEVOUTOK‚RTS™Returntothecallingroutine.ŠPAGEO*********************************************************************************‚DEVOUT(*****MODIFIED1/27/83BYM.BRIEL*******<*†1.Checkforadevicefault(not-selectedoroutofpaper).=*ˆIfafaultispresent,terminatetherequestwithanerror.*F*†2.IfanPrinterAcknowledgeisexpected,waitfortheACKpulsefor@*‰approx.100us.Ifthepulsedoesnotarrivein100us,enable0*‰theAcknowledgeinterruptandexitthedriver.*4*†3.OutputthenextcharacterandpulseDataStrobe**ˆENTRY:„D0‚=databyte*’A1‚=devicebaseaddress*‘(SP)=returnaddress*4(SP)=PRTOUTreturnaddress*DEVICE=Interruptsdisabled*,*ˆEXIT:…D0‚=Devicestatusregistercontents*NORMAL=(SP)return*FAULT=(SP)+2return5*‘BUSY=4(SP)PRTOUTreturnaddress(deviceenabled)*K****************************************************************************DEVOUT:'‰CLR.BƒD3“ClearD3foranormalreturn.* ‰CLR.LƒD1.‰MOVE.B‚DEV1BD(A1),D1‰Pickupstatusregister. ‰MOVE.L‚D1,D2‘Makeanothercopy.&‰AND.Bƒ#$03,D1Maskuninterestedbits.-‰CMP.Bƒ#$01,D1SelectedandnotOut-of-Paper?‰BNE.SƒDEV010Faultexitifno.*:ŠTST.B‚CCBACKP(A5)ŠIfaprinteracknowledgeisnotpending,ŠBEQ.S‚DEV020proceedwithcharacteroutput.*:ŠMOVE.W#32,D1‹Repeatedlytestfortheprinteracknowledge:DEVACK„SUBQƒ#1,D1Œpulse.Iftheacknowledgearrivesbefore9ŠBEQ.S‚DEV005‹thelooptimesout(approx.100us)proceed=ŠTST.B‚CCBACKP(A5)†withcharacteroutput.Otherwise,exitthe4ŠBNE.S‚DEVACK‹driver.‚AFAULToranACKNOWLEDGEWILL*¡ALWAYSCLEARCCBACK.*N*‚Sinceinterruptscannotbemasked,wemustchecktoseeifaninterruptcameL*‚in.‚Thisinterruptwillcleartheinterruptflagbit(bit7)andwillalsoK*‚clearCCBACKP.‚BecauseCCBACKPwastestedaboveandfoundtobeclear,an6*‚interrupt(eitherFAULTorACKNOWLEDGE)didcomein.,ŠBRA.S‚DEVOU( TGoseewhichinterruptitwas.* DEV005„INHIB6ŠTST.B‚CCBACKP(A5)ˆCheckonemoretimetomakesure...(ŠBNE.S‚DEV008IfSTILLset,gobailout.ŠENABL4ŠBRA.S‚DEVOUTElse,gocheckwhichinterruptitwas.ŠSPC„2*L* No interrupts - so set up the return address and exit, waiting for a FAULT)* or an ACKNOWLEDGE interrupt to come in.*@DEV008ƒMOVE.B‚D0,CCBSAVB(A5)ˆThedeviceisbusy,savedatabyte..‰MOVE.L‚(A7)+,CCBIRTN(A5)…Savereturnaddress.-‰SUB.Lƒ#2,CCBIRTN(A5)ˆAdjustserviceaddress.*A‰MOVE.L‚(A7)+,CCBISTK(A5)…SavesubroutinereturnaddressintoCCB*L* Set a flag to tell the interrupt routine that the next interrupt should beB*processed.‚Remember,wewillgetaninterruptoneachcharacter.1‰ST.B„CCBINREQ(A5)ŠSet'INTERRUPTREQUIRED'flag. ‰RTS›Return.* * Fault Exit+DEV010ƒMOVE.L‚D2,D0Setupstatusregister.*‰BSR…DEVINIT1ŠClearanypendinginterrupt.:‰CLR.B‚CCBACKP(A5)ˆClearpendingprinteracknowledgeflag.7‰TST.B‚DEV1AD(A1)‰ClearAcknowledgeinterruptIRQflag.+‰ST†D3SetD3non-zerotoindicateanerror$‰BRA.SƒDEVOEXŒandpreparetoreturn.*(*Outputthenextcharacter1/17/84MLB*=DEV020ƒTST.BƒDEV1AD(A1)ŒClearAcknowledgeinterruptIRQflag.'‰MOVE.B‚D0,DEV1AD(A1)‰Outputdatabyte.‰INHIB* * data strobe‰MOVE.B‚#%00000000,DEV1AC(A1)3‰MOVE.B‚#%00001000,DEV1AC(A1)ƒStrobethedatabyte.8‰ST†CCBACKP(A5)‹Settheprinteracknowledgependingflag0‰MOVE.B‚DEV1BD(A1),D0‰Getstatusregisteragain.0DEVOEXƒENABL™Enableinterruptsandreturntothe‰RTS™callingroutine.‰PAGEJ***************************************************************************!* INTERRUPT SIDE FOR PRT HANDLING*?*ƒPURPOSE:‚HANDLEACKNOWLEDGEMENTSANDMESSAGECOMPLETIONSFROM2*THEIOH.‚OPERATESATHARDWAREINTERRUPTPRIORITY=*LEVELASASUBROUTINETOTHEFIRSTLEVELINTERRUPTHANDLER.*+*ƒENTRY:‚JSR‚FROMINTERRUPTHANDLERROUTINE*‹A0-WORKREGISTER *‹A1=SELF*‹A5=ADDRESSOFCCB*‹D0=WORKREGISTER*/*ƒEXIT:‚RTS-BACKTOINTERRUPTHANDLERROUTINE**ƒREGISTERSUSED:ƒ01234567 *”D******** *”A*****P****ƒEXECROUTINESCALLED:‚QEVENTI**ƒCODEISRE-ENTRANT*F*---------------------------------------------------------------------*4* If channel is off-line or not attached, just exit.*PRTISR:.ŠMOVE.LCCBCHB(A5),A1‰Getdevicebaseaddress.5ŠMOVE.BDEV1AC(A1),D0‰PickupA-sidestatusregister.#ŠAND.B‚#$80,D0Maskinterruptbits..ŠCMP.B‚#$80,D0ACKNOWLEDGEinterruptpending?ŠBEQ.S‚PRTI010Branchifyes.5ŠMOVE.BDEV1BC(A1),D0‰PickupB-sidestatusregister.#ŠAND.B‚#$80,D0Maskinterruptbits.(ŠCMP.B‚#$80,D0FAULTinterruptpending?ŠBEQ.S‚PRTI010Branchifyes. 2ŠAND.W‚#$FFFE,SRNointerruptsosetconditionand ŠRTSšreturn. -PRTI010ƒBTSTW‚#CCBFGOFF,CCBSTR(A5)‚Off-line?ŠBNE.S‚PRTI020Branchifyes.5ŠBTSTW‚#CCBFGATH,CCBSTR(A5)‚Isthechannelattached?ŠBEQ.S‚PRTI020Branchifno.(ŠBTSTW‚#CCBFGBSY,CCBFG(A5)ƒI/Opending?ŠBNE.S‚PRTI100Branchifyes. 8PRTI020ƒMOVE.LCCBCHB(A5),A1‰Setupdevicebaseaddress.(ŠBSR„DEVINIT1ŽClearanyFAULTinterrupt.2ŠTST.B‚DEV1AD(A1)ŒClearanyACKNOWLEDGEinterrupt.6ŠCLR.B‚CCBACKP(A5)‹CleartheACKNOWLEDGEpendingflag.ŠENABL!ŠOR.Wƒ#$0001,SRSetconditionand ŠRTSšreturn.ŠPAGEN******************************************************************************** INTERRUPT LEVEL PROCESSING*0*ˆIthasbeendeterminedthatI/Oisinprogress*ˆandtheinterruptisours.**N*******************************************************************************PRTI100:(ŠBSR…DEVINIT1‰ClearanyFAULTinterrupt.2ŠTST.BƒDEV1AD(A1)‡ClearanyACKNOWLEDGEinterrupt.>ŠCLR.BƒCCBACKP(A5)†CleartheprinterACKNOWLEDGEpendingflag.;ŠTST.BƒCCBINREQ(A5)…Seeifthisinterruptisreallyneeded.-ŠBEQ.SƒPRTI200ŠBranchifnointerruptneeded..ŠCLR.BƒCCBINREQ(A5)…Else,clearfornexttime.*=ŠMOVEM.LD1-D7/A2-A4/A6,-(A7)Savetherestoftheregisters.ŠSPC„2–1/17/84MLB*-ŠMOVE.L‚CC) BPTR(A5),A0ˆRestorebufferpointer.1ŠMOVE.B‚CCBSAVB(A5),D0‡Restorecurrentdatabyte.5ŠMOVE.L‚CCBIRTN(A5),A2‡Getinterruptserviceaddress.'ŠMOVE.L‚CCBCCB(A5),A3ˆGetIOCBaddress.&ŠMOVE.L‚CCBCID(A5),A4ˆGetDCBaddress.8ŠADD.Bƒ#1,CCBICNT(A5)‡Incrementpendinginterruptcount.:ŠPEA…PRTINRTN(PC)‰Stacktheinterruptroutineexitaddress>ŠMOVE.L‚CCBISTK(A5),-(A7)„Restoresubroutinereturnaddresson*¦stack.!ŠJMP…(A2)‘Jumptooutputroutine. *.* PRT interrupt handler exits from this point.* PRTINRTN:7ŠSUB.Bƒ#1,CCBICNT(A5)‡Decrementpendinginterruptcount0ŠMOVEM.L(A7)+,D1-D7/A2-A4/A6Restoreregisters.PRTI200:/***‡ENABL˜LetCMRenableinterruptslater,this%***¤fixisforEPSONRX80(SPR1178).(ŠOR.Wƒ#$0001,SRSetreturnconditionand!ŠRTSšreturntointerrupthandler.ŠPAGEJ**************************************************************************** QEVNT**„Placemessageonuser'sASQ.**ˆA4=addressofeventarea*ˆA5=addressofCCB'*ˆD0=eventlength(minusheaderinfo)*ˆD1=eventtype*ˆD2=4byteid(DCB)*ˆD3=statusvalue(2bytes)*ˆD4=devicestatus(2bytes)*ˆD5=devicenumber(1byte)*J***************************************************************************QEVNT:ŠMOVE.LD0,D6ŽSavelength.5ŠMOVE.L#2,D7ŽOffsetforstaging(noservicevector)./ŠMOVE.B#IOEVCD,1(A4)†Code(noservicevector).)ŠMOVE.LCCBSVVC(A5),2(A4)‚Servicevector.+ŠBEQ.S‚QEVNT10ŒBranchifnoservicevector./ŠADD.L‚#4,D0ŽCorrectlengthforservicevector.7ŠADD.L‚#4,D7ŽCorrectoffsetstagingforservicevector.2ŠADD.L‚#$00800000,(A4)„Correctforservicevector. 1QEVNT10ƒMOVE.BD1,0(A4,D7)ˆCompletioneventtype.*ŠMOVE.BCCBKEY(A5),1(A4,D7)User'sidkey.-ŠADD.L‚#4,D0ŽCompletelengthofreturnevent.6ŠCMP.B‚CCBASQL(A5),D0…User'smaximumASQentrylength.#ŠBLS.S‚QEVNT20ŒBranchiflengthok.0ŠMOVE.BCCBASQL(A5),D0…User'slengthissmaller. &QEVNT20ƒMOVE.BD0,(A4)ŒCorrectlength. /QEVNT40ƒMOVE.LD2,2(A4,D7)ˆSetupstatusvalue.$ŠMOVE.WD3,6(A4,D7)ˆSetupid(DCB).ŠCMP.B‚#6,D6Ž6byteinfo?ŠBEQ.S‚QEVNT50ŒBranchifyes.)ŠMOVE.WD4,8(A4,D7)ˆSetupdevicestatus.ŠCMP.B‚#8,D6Ž8byteinfo?ŠBEQ.S‚QEVNT50ŒBranchifyes.*ŠMOVE.BD5,10(A4,D7)‡Setupdevicenumber.&ŠCLR.B‚11(A4,D7)ŠClearreservedfield.*I* Now let's put the completion into registers and send event to the task.* QEVNT50ƒEQU„*ŠMOVEM.L(A4),D2-D7ŠBSR.S‚IOHQEVNTŠRTSŠPAGEK*****************************************************************************9* ROUTINE TO QUEUE EVENT (ALREADY STAGED IN REGISTERS) TO*ƒ-DRIVINGTASK. *ƒ-EVENTBEGINSINREGISTERD2.***ˆEXECROUTINE/*ˆREGISTERSUSED:D0-D1/A0,A3-A6‚WORKREGISTERS*˜D2-D7‹STAGINGREGISTERS**K**************************************************************************** IOHQEVNT:$ŠMOVEM.LA3-A5,-(A7)‡Ssveregisters.-ŠMOVE.LCCBRQSTA(A5),A0„Caller'sTCBaddress.ŠSPC„26ŠMOVE.L#T0QEVNTI,D0‰Ifthisroutinewascalledduring6ŠTST.B‚CCBICNT(A5)ˆinterruptprocessing,usetheQEVNT3ŠBNE.S‚IOHQ4Žinterruptroutine,elseusethenormal#ŠMOVE.L#T0QEVNTT,D0‡QEVNTroutine. IOHQ4…TRAPƒ#0#ŠBRA.S‚IOHQ5ŽBranchifqueueingok.'ŠMOVEM.L(A7)+,A3-A5‡Restoreregisters.9ŠMOVE.L(A7),CCBQVER1(A5)‚Savecallersaddressfordebug.ŠBRA.S‚IOHQRTN ,IOHQ5…MOVEM.L(A7)+,A3-A5‡Restoreregisters..ŠCLR.L‚CCBQVER1(A5)‡Clearqueueerroraddress. IOHQRTNƒRTS—RETURNŠEND=/*=/*†RWINDRV.AF=/*:=/* Chain file to assemble the RWIN disk controller driver=/*:=/* If no output argument is specified for the listing the)=/* chain file will default to RWINDRV.LS=/*=/IFC \1ƒ=ARGRWINDRV.LS=/ENDIF=/*&=ASM RWINDRV.SA,RWINDRV.RO,\1;-WRZ=186=/*{ Included files are:=/*ƒ9995.&.STR.EQ=/*ƒ9995.&.TCB.EQ=/*ƒ9995.&.CCB.EQ=/*ƒ9995.&.LV5.EQ=/*ƒ9995.&.IOE.EQ=/*ƒ9995.&.NIO.EQ =/*ƒCOMCMD.AI=/*ƒRWININT.AI=/*}=/*=END) éééééé&‰TTL‡RWINDRV.SA >*ˆJAHƒ2/25/85ƒInCOMCMD:‚Useno.ofcylindersonmediaforthe'*˜configurecommandonharddisksonly.9*ˆJAHƒ2/18/85ƒInCOMCMD:‚Limitthepre-compensationvalue.*˜to$FF-themostthatwillfitinonebyte.ééééééé/8:@:HDP9X8`=h,p+x:€7ˆ6:˜A :¨6°.¸9À;È8Ð8Ø4à8è:ð6ø<Q* *ˆBWNƒ2/13/84‡PJD9/18/84 *ˆRV10/17/84retryoptioncheck<*ˆBWN‚10/25/84:‚Fixedsothatcorrectsectornumberreturned*˜whenanerrorisfound.3*˜RWCOMMON:‚DonotincrementLSNunlessallsectors.*˜havebeenprocessedforthecurrentcommand.+*˜CHECKERR:DonotdecrementLSNforretry.4*˜STATERR:‚DonotdecrementLSNforreportingerror.*;*ˆBWNƒ11/7/84ƒInCOMCMD:‚Makeachecktoseethatbytesper-*˜sector,sectorspertrack,anddatadensity4*˜haveconsistentvaluesforafloppydiskof51/4".*˜and8"sizes.‚Ifnot,returnerrorcode$47.*D*ˆBWNƒ12/21/84‚Yetanotherfixfortheelusivecorrectsectornumber *˜return:0*˜Seemsthatthelast"fix"causedustoputbad3*˜stuffintotheuser'sbufferwhenreadingsectors-*˜intrack0ofadoubledensityfloppydisk.5*˜ThisoccuredwhentherewasaCRCerrorintrack0.&*˜Thesetupforretrywasnotcorrect.4*˜Hopefullythiswillfixtheproblemofthecorrect'*˜sectornumbersgettingreturnedfora.*˜CRCerrorandtrack/sectorIDerroraswell.*˜(1)inRWCOMMON:**œputbackinthecodethatadded1toLSN'*œandsubtracted1fromCMDSECTSinthe*œcommandpacket.*˜(2)nearthelabelRD_WR::+*œIfanerroroccurshere,branchdirectto,*œSTATERRinsteadofCHECKERR.‚Atthispoint *œwehavethecurrentLSNinthe*œcommandpacket.*˜(3)inCHECKERR:**œIfthedataiscorrectible,andCMDSECTS1*œispositive(whichIdon'tthinkcouldhappen‚-'*œneedsmoreanalysis)thentheLSNand$*œCMDSECTSwillbesetupcorrectly.&*œIfthedataisnotcorrectible,then3*œwhetherweretryorreporttheerror,weneedthe0*œcurrentLSNandCMDSECTSinthecommandpacket.*œsomovethesubtract1fromLSNandadd1to**œCMDSECTScommandsuptothelabelL0555.*** ŠOPTCRE,PCS **‰MISCEQUATES*"DRIVESƒEQU‡4“#ofdrivesperboardEXEC…EQU‡0“RMS68Ktrap# %DTYPE„EQU‡1”Conditionalassemblyflag*¦0=assembleforSASIdriver$*¦1=assembleforWinchesterdriver*K*****************************************************************************ˆBWN‡2/13/84ƒPJD‚9/18/84*1GOODCODEEQU‡0“Opcodeforformatsectoras"good"1BADCODE‚EQU‡$80‘Opcodeforformatsectoras"bad"7ALTCODE‚EQU‡$40‘Opcodeforformatsectoras"alternate"*O*******************************************************************************   **ˆMACROSUSEDBYTHISDRIVER*4LONGWORDMACRO„.–Thismacroskipszeroormorebytes'*¦inmemory(ifnecessary)toalignthe)*¦assembler'slocationcountertoalong-&*¦wordboundary.‚Wedefinealong-word)*¦boundarytobealocationwhoseaddress*¦isevenlydivisibleby4.‰DS.W…00‰IFNE…*/4*4-*Ifthelocationcounterisn'tona-‰DS.W…1”long-wordboundary,advanceitbyone/‰ENDC….”wordtoputitonalong-wordboundary.‰ENDM 3MOVEIAƒMACRO„.–Thismacroisusefulwhenwewantto%*¦putanimmediatevalueintoan *¦register."*¦[