home *** CD-ROM | disk | FTP | other *** search
- Page 55,132
- .186
- Title WDPatch V1.2 Copyright 1986, 1987 Scott Samet
- Driver_Text Segment
- Assume CS:Driver_Text,DS:Nothing,ES:Nothing
- Driver Proc FAR
- ; Standard MS-DOS Driver Header, used by all drivers
- DD -1 ; Pointer to Next Driver
- DW 08000h ; Attribute Bits: Block Device
- DW Strategy ; Offset of Strategy Routine
- DW Interrupt ; Offset of Interrupt Routine
- DB '$WDPATCH' ; Eight bytes name
-
- ; Definition of the Standard MS-DOS Request Header
- RH Struc
- RHLen DB ? ; Length of this RH
- RHUnit DB ? ; Unit number for this request
- RHCmd DB ? ; Command Code
- RHStat DW ? ; Bit 15 = Error, Bits 0-7 = Code
- DB 8 dup (?) ; Reserved Area
-
- RH0Unit DB ? ; Number of Units
- RH0Brk DD ? ; Break Addr (End of Driver + 1)
- RH0BPB DD ? ; BPB Array Ptr
-
- ;RHMed DB ? ; Media Descriptor Byte
- ;RHAddr DD ? ; Data Transfer Address
- ;RHCnt DW ? ; Byte/Sector Count
- ;RHSec DW ? ; Starting Sector
- RH Ends
-
- RH0BrkO Equ Word Ptr RH0Brk
- RH0BrkS Equ Word Ptr RH0Brk+2
- RH0BPBO Equ Word Ptr RH0BPB
- RH0BPBS Equ Word Ptr RH0BPB+2
-
- ; Save area used to communicate between Strategy and Interrupt Routine
- RHOfs DW ? ; offset of RH address
- RHSeg DW ? ; segment of RH address
- RHPtr Equ DWord Ptr RHOfs ; Same location, as DWord Ptr
-
- ; Strategy Routine:
- ; Called to set up an I/O Operation. ES:BX points to a Request Header.
- ; ES:BX is saved for use by the interrupt routine.
- Strategy:
- Mov RHSeg,ES
- Mov RHOfs,BX
- Ret
-
- ; Interrupt Routine:
- ; Called to start the I/O Operation preset by the strategy call.
- ; The saved ES:BX Pointer is used to find the Request Header.
-
- Interrupt:
- PushA
-
- LDS BX,RHPtr ; Restore pointer to Request Header
- Mov AL,[BX.RhCmd] ; Get Command Code from Request Header
- Or AL,AL ; Is this an install request?
- JE Install ; -Yes- go handle it
- Mov AX,8103h ; -No- Get Error, Done & Unknown Cmd Status
- Mov [BX.RHStat],AX ; Set flags in Request Header Status
- Exit: PopA
- Ret ; Done
-
-
- Int41: DB 16 Dup (0)
- Int46: DB 16 Dup (0)
-
- Install:
- Mov BX,41h*4
- Mov DX,Offset Int41
- Call Reloc
- Mov BX,46h*4
- Mov DX,Offset Int46
- Call Reloc
-
- LDS BX,RHPtr ; Restore pointer to Request Header
- Mov [BX.RHStat],0100h ; Error Status
-
- Mov DX,Offset Install ; Set DX = Break offset
- Mov [BX.RH0BrkO],DX ; CS:AX = Break Address (end of
- Mov [BX.RH0BrkS],CS ; memory + 1)
-
- Push CS
- Pop DS
- Mov DX,Offset CRite
- Mov AH,9
- Int 21h
- JMP Exit
-
- ; DS /src
-
- Reloc Proc Near
- Xor AX,AX
- Mov DS,AX
- LDS SI,[BX] ; DS:SI -> old param
- Push CS
- Pop ES
- Mov DI,DX ; ES:DI -> new param
- CLD
- Mov CX,16
- REP MOVSB ; Move it
- Xor AX,AX
- Mov DS,AX
- Mov [BX],DX
- Push CS
- Pop [BX+2]
- Ret
- Reloc EndP
-
-
- CRite DB 0Dh,0Ah,'WDPatch V1.0 Copyright 1989 Scott Samet',0Dh,0Ah,'$'
- Driver EndP
- Driver_Text EndS
- End
-