home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-25 | 1.8 KB | 89 lines | [TEXT/MPS ] |
- ; (c) 1996 Dieter Spaar
- ; Internet: spaar@mirider.augusta.de
-
-
- INCLUDE 'traps.a'
- INCLUDE 'SysEqu.a'
- INCLUDE 'SysErr.a'
-
-
- ; Install patch for SCSIDispatch
-
- ; The patch simply checks for SCSI commands that may eject the media
- ; and ignores them.
- ; Does not work for SCSI manager 4.3 cause it uses trap SCSIAtomic !
-
- SCSIDispatchPatch PROC EXPORT
-
- BRA.S start
- next DC.L 0 ; old trap address goes here
-
- start MOVE #$A815,D0 ; SCSiDispatch
- _GetToolTrapAddress ; (D0/trapNum:Word):A0\ProcPtr
- LEA next,A1
- MOVE.L A0,(A1)
-
- LEA patch,A0
- MOVE #$A815,D0 ; SCSiDispatch
- _SetToolTrapAddress ; (A0/trapAddr:ProcPtr; D0/trapNum:Word)
- RTS
-
- ; here is the start of the patch
-
- patch MOVE 4(A7),D1 ; routine selector
- CMPI #3,D1
- BEQ.S scsiCmd
-
- go_on LEA next,A0 ; execute the old trap
- MOVEA.L (A0),A0
- JMP (A0)
-
- ;**********************************
-
- scsiCmd
- CMPI #6,6(A7) ; length of SCSI command
- BNE.S go_on
- MOVEA.L 8(A7),A0 ; address of SCSI command buffer
- CMPI.B #$1E,(A0) ; PREVENT ALLOW MEDIA REMOVAL command ?
- BEQ.S prevent
- CMPI.B #$1B,(A0) ; START STOP UNIT command ?
- BNE.S go_on
- CMPI.B #2,4(A0) ; STOP UNIT, request EJECT of medium, for APPLE CDROM driver
- BNE.S go_on
- BRA.S leave
- prevent
- CMPI.B #0,4(A0) ; allow removal ?
- BNE.S go_on
- leave
- MOVE #0,D0 ; return no error but don't execute SCSI command
- RTS
-
- ENDP
-
-
-
- ; return the size of the shutdown routine
-
- GetSize PROC EXPORT
-
- LEA GetSize - SCSIDispatchPatch,A0
- MOVE.L A0,4(A7)
- RTS
-
- ENDP
-
-
- ; return start address of the shutdown routine
-
- GetAddr PROC EXPORT
-
- LEA SCSIDispatchPatch,A0
- MOVE.L A0,4(A7)
- RTS
-
- ENDP
-
-
- END
-
-