6$ X;SAVE#D5:B>PARK.M65X;ASM,,#d5:b>PARK.OBJX;06/02/92 By: Robert Puff(P2EI<:FINIT STARTPQ>Z PRAMPAGEd!@ :nX;xDEVMSKGRAMPAGEьPIAPORTBіX;Zero-page equatesX; SCSIID6ZWTEMP12 ZPTMP11 ZPTMP24 ZPTMP35SECH5120X; PRTTMPX;X; PIA Equates: PORTAq PORTBp" DDRAs, DDRBr6 PPCR|@X;J PTEMP(TX;^ RETRYSh BYTESr CURSY| CTRLS DRIVE HDRLOC DATLOC MAXSECSECSTRK DECRETFIRSTINCX;X;Select controllerX; A=scsi # <0=7>SEL_CTRLPZPTMP1 QPPCRL>PPPCR;;kill any handshakeQ>  PDDRB&*PORTB;;are we busy?0 KS_C1:$>;;do a RESETD &PORTBN S_C50XHS_C5;;pause a littlebQ>;;maybe this willlPPORTB;;wake ctrlr upv>? S_C444;;waste cycles44444444440  HS_C41  HS_C4**PORTB;;let's look again4KS_C1;;yep, all ok>%>;;else busH:;;'overrun'..RS_C1 SETOUT;;set data out\ $ZPTMP1f QBITTAB9p PPORTAzQ>;;lower /SEL PPORTB$>%>S_C2*PORTBJS_C3;;is it busy?2HS_C2;;nope, loop3 HS_C2BUSERRQ>PPORTB;;oh well, QPPCRL> PPPCR S_C8$>  &DDRB$0. &PORTB8 SETINP;;give upB%>L:V S_C3Q>` PPORTBj?t>~S_C6QPORTB;;wait forM>;;REQ and C/DFS_C7;;to assert0 HS_C61 HS_C6 FS_C8S_C7%>;;y=0, success!:X;"BITTAB ===== =@=X;SETINP5;;set direction Q>;;of data bus FSETINP1 SETOUT5(Q>2SETINP1PDDRA<7F:PX;ZSND_CMD&ZWTEMP1;;send cmdd'ZWTEMP1;;framen PBYTESx SETOUTX; LDA PPCRX; AND #$F0 ;enableX; ORA #9 ;handshakeX; STA PPCR WAITREQ%> SN_C1$>SN_C2QPORTB ISN_C21 *PORTB KSN_C4JSN_C2;;branchSN_C21M>HSN_C22;;oops, data modeQ@ZWTEMP17 PPORTA" FIXSCSI,36 )BYTES@HSN_C1;;always loopJSN_C22%>T:^SN_C4!BUSERRhX;rX;| RWDATA &ZWTEMP1'ZWTEMP1 FIXALFC LZWTEMP1 HRWD1 :;;no dataRWD1 WAITREQ QPORTBV?ERW_DD2;;writes SETINPDRW_DA1;;branch to readsX;RW_DD2%>;;put data codeRW_CC2QPORTB& IRW_CC30 *PORTB: KRW_CC4DJRW_CC2;;branchN RW_CC3M>;;command or data?XFRW_DD3;;out of databQ@ZWTEMP17l PPORTAv3 HRW_CC2#ZWTEMP1HRW_CC2;;branchX; RW_DD3C%>:X;RW_CC4!BUSERRX;RW_DA1%>RW_DA2$> RW_DA3QPORTB;;get data code IRW_DA4  *PORTB KRW_CC4 2* FRW_CC44 HRW_DA3>RW_DA4M>H FRW_DA5R QPORTA\P@ZWTEMP17f3pHRW_DA3;;in place of DA2z#ZWTEMP1HRW_DA3;;branchX;RW_DA5 FIXALFC%>:X;GETSTAT SETINP QPPCRL> PPPCR WAITREQQPORTA;;status byte PZPTMP2 FIXSCSI WAITREQ$ "X; LDA PORTA ;toss 2nd stat. FIXSCSI8  BUSERR;;release busB QZPTMP2L M>V FGE_ST1` %>j :t GE_ST1%>~ : X; FIXSCSIQPPCR M> PPPCR FIX1*PORTB IFIX1 L> PPPCR : X; WAITREQQ> > %>;;5 min timeout WA_R1*PORTB;;wait for REQ KWA_R2;;not busy GWA_R3( :;;got it!2 WA_R3!WA_R1;;LOOP FOREVER< O>F HWA_R1P 2Z HWA_R1d 3n HWA_R1x WA_R27 7 !BUSERR X; FIXALF Q> PPPCR Q> PPPCR;;FIX ACK PROBLEM : X; DOIT7 PPRTTMP 7 PPRTTMP %> Q@PRTTMP7" PBYTES, 36 Q@PRTTMP7@ PRETRYSJ 3T Q@PRTTMP7^ PHDRLOCh 3r Q@PRTTMP7| PHDRLOC 3 Q@PRTTMP7 PDATLOC 3 Q@PRTTMP7 PDATLOC C , OPRTTMP ? QPRTTMP O> 5 C 5 DATPAGE& QHDRLOC0 PPRTTMP: QHDRLOCD PPRTTMPN DOI3%>X Q@PRTTMP7b M>l P@PRTTMP7v $DRIVE Q9 M> L@PRTTMP7 P@PRTTMP7;;set LUN # Q9 M> SEL_CTRL GDOI1 $HDRLOC %HDRLOC QBYTES SND_CMD GDOI2 WAITREQ $DATLOC %DATLOC RWDATA* GDOI24 GETSTAT> IDOI1H DOI2"RETRYS;;retry 2xR IDOI3\ DOI1:f X;p DATPAGE5z Q> HDATPAGE1 PRPAGE5 Q> HDATPAGE1 JUNKPAGE5 Q> DATPAGE1PRAMPAGE 7 : X; MAKE_CLINE &CURSY Q> %> CSS1PPTEMP81$ ICSS1.38 'PTEMPBAL,VO>A` PPTEMPj DATPAGEtA~T?T?T? PDRIVE>Q95M>L>0 PPTEMP7V?;W? ;W?V?(V?2 PPTEMP<Q> ,F PPTEMPPQ9ZV?dV?nV?xV?%> ;;heads A2DIGITQ9PQ9PL HCSS01 $CURSY,;;not valid: CSS01$>& A3DIGIT$>CSS8QNUMBUF8"PPTEMP9,263@)>J DCSS8T$>PTEMP^%>PTEMPh PRINTr $CURSY| ;;;good:X;NUMBUF A A=X;A2DIGITR>  DA2D1S>  A2D15Q>U? PPTEMP87L>0PPTEMP8:X;&!COMLO =@====d= =0!COMHI =B=='====:!COMH2 =======DX;NA3DIGITQ> 0X$>b%>lA3D1PNUMBUF8v1 IA3D13 A3D2Q9 RCOMH28 HA3D3Q9 RCOMHI8 HA3D3Q9 RCOMLO8A3D3DA3D4Q9 SCOMLO8P9 Q9 SCOMHI8 P9*Q94 SCOMH28>P9H,R QNUMBUF8\O>f PNUMBUF8pDA3D2;;branchz A3D43)> DA3D2%>A3D5QNUMBUF8R> 0 HA3D63)> DA3D5 A3D6:X;A3DIGPRT A3DIGITC,O>NUMBUF>$Q>NUMBUF.O>8?BQ>LPNUMBUFVX;`PRINT&PRTTMPj'PRTTMPt PR1%>~ Q@PRTTMP7FPR2 EOUTCH #PRTTMPHPR1#PRTTMPHPR1PR2: EOUTCH?QG5QF5$> C:X;(KGETCH$>2Q> <PB9F VPQ>ZPB9d Q>KCOLnPD9xQ>KCOLPE9Q>PJ9 VQ>PB9Q>PH9PI9 V5Q> PB9 V7:"KCOL AK:A=,X;6INITMSG }=}@/ Aˠؠ󠠨éA=J+ A Hard Disk Parking Utility 1.5A=T2 AA==^* A Configured Drives:A==h1 A գ A==r3NOCTLM ==ANo Hard Disks Configured!A==|-SELHDM =APress any key to exit.A==X; STARTQ> PPORTB$>INITMSG%>INITMSG;;title PRINTQ> PCTRLS>STRL1 MAKE_CLINE6UCTRLS;;display drives8 ESTRL2STRL3$CURSY&20(>: DSTRL1DQCTRLS;;make sure thereNHSTRL4;;is at least 1X$>NOCTLMb%>NOCTLMl PRINTvSTRL4$>SELHDM%>SELHDM;;press a key PRINTQ>P KGETCH X;THAT'S ALL! NOW LEAVE PORTX;CORRECTLY...Q>=P$Q>P. (> EQUITDOS Q> * PDDRB4X;>QUITDOSQ>H EOUTCHR !EOUTCH\X;fSTRL2 DOITp  =RCAPCMD=DATAz ISTRL2AQ> PFIRSTINC !ERRDCP1STRL2AQDATA $DATA %DATA STRL5P&'PREACMD&REACMD'REACMD $DRIVEQ9;;is it 512?M> FSTRL5A$T.U8U;;multiply # by 2BSTRL5A A3DIGITL%>VSTRL5BQNUMBUF8`R> 0jHSTRL5C;;kill leadingtQ> ;;0's in sec #~ PNUMBUF83)> DSTRL5BSTRL5C$>NUMBUF%>NUMBUF PRINT SETLAST DOIT =REACMD=DATA ISTRL6$>NOPARK%>NOPARK PRINT STRL7!STRL3STRL6$>PARK%>PARK( PRINT2Q><PFQPM>ZHSTRL7;;DO WE SHUT DOWN?d $DRIVEnQ9xM> HSTRL7 DOIT =TURNOFF=DATA !STRL3X;TURNOFF =====REACMD =====)RCAPCMD %=========NOPARK A A==PARK A ParkedA==X;ERRDCP1$DRIVEQ9M> FSAS1Q>;;secs/trk" ,, SAS1Q> 6 PSECSTRK@Q9J PDATATQ9^PDATA;;set uphQ9;;define limitsrV?;;parm block|V?V?V? PDATAQ9 PDATAQ9 PDATAQ9 PDATAQ9 PDATAQ> PDATA;;ecc length DOIT =DEFLIMC=DATA!SAS3;;ignore status&X;0DEFLIMC  =====:X;DSAS3Q>;;set to -1N PMAXSECXPMAXSECbPMAXSECl;v#QDATA;;TAKE 7 cylinders awayS>;;for bad sectors PDATA QDATAS> PDATASAS6$DATA;;# of heads SAS6A, QMAXSEC OSECSTRK PMAXSEC DSAS6B#MAXSEC HSAS6B#MAXSEC  SAS6B0 HSAS6A QDATA;;cylinders* HSAS6C4"DATA;;high byte>SAS6C"DATAH QDATAR LDATA\HSAS6;;figure # of secsfQ>p PDECRETzNOB5QMAXSECPREACMDQMAXSECPREACMDQMAXSECPREACMD SETLAST DOIT =REACMD=DATA GNOB1 QFIRSTINC INOUP1QMAXSEC;;go up till we,;;hit an error OSECSTRK PMAXSEC DNOB5$#MAXSEC. HNOB58#MAXSECBHNOB5;;branchLNOUP1QMAXSECV$MAXSEC`%MAXSECj !STRL5t NOB1)>~ HNOB2NOB3$>ERRM2%>ERRM2 PRINT !STRL3 NOB2Q> PFIRSTINC"DECRET;;ONLY GO DOWNFNOB3;;256 TRACKS QMAXSEC; SSECSTRK PMAXSECQMAXSEC S>PMAXSECQMAXSEC(S>2PMAXSEC< !NOB5F"ERRM2 AA==PX;ZSETLAST$DRIVEdQ9nM>;;do step ratex FSETL1Q9M>SETL1PREACMD:X;IDATAEIX; INIT