From JJK@lbvrtda.logica.com Tue Aug  1 03:01 EDT 1995
Received: from ulkyvx.louisville.edu by starbase.spd.louisville.edu with ESMTP
	(1.37.109.11/16.2) id AA002670483; Tue, 1 Aug 1995 03:01:23 -0400
Resent-Date: Tue, 1 Aug 1995 03:01:23 -0400
Resent-From: JJK@lbvrtda.logica.com
Return-Path: <JJK@lbvrtda.logica.com>
Received: from ULKYVX.LOUISVILLE.EDU by ULKYVX.LOUISVILLE.EDU (PMDF V4.2-11
 #6403) id <01HTJKR1OAVK94DX69@ULKYVX.LOUISVILLE.EDU>; Tue,
 1 Aug 1995 02:57:48 EST
Received: from carmen.logica.co.uk by ULKYVX.LOUISVILLE.EDU (PMDF V4.2-11
 #6403) id <01HTJKQUPSQO94DX68@ULKYVX.LOUISVILLE.EDU>; Tue,
 1 Aug 1995 02:57:40 EST
Received: from smtpmail.logica.com (mssmtp.logica.com [158.234.8.102]) by
 carmen.logica.co.uk (8.7.Beta.10/8.7.Beta.10) with SMTP id IAA25462 for
 <GCLIND01@ULKYVX.LOUISVILLE.EDU>; Tue, 1 Aug 1995 08:01:05 +0100 (BST)
Received: by smtpmail.logica.com with Microsoft Mail id
 <301DDF38@smtpmail.logica.com>; Tue, 01 Aug 95 08:00:56 bst
Date: Tue, 01 Aug 1995 08:52:00 -0300 (bst)
From: Keyser Jan Just <JJK@lbvrtda.logica.com>
Subject: EXE device driver
Resent-To: gclind01@starbase.spd.louisville.edu
To: GCLIND01 <GCLIND01@ULKYVX.LOUISVILLE.EDU>
Resent-Message-Id: <01HTJKR1QPOI94DX69@ULKYVX.LOUISVILLE.EDU>
Message-Id: <301DDF38@smtpmail.logica.com>
X-Vms-To: IN%"GCLIND01@ULKYVX.LOUISVILLE.EDU"  "GCLIND01"
X-Mailer: Microsoft Mail V3.0
Content-Type: MULTIPART/MIXED; BOUNDARY="Boundary (ID /1OM+ers6Y8bRuZUp11j4w)"
Status: RO


--Boundary (ID /1OM+ers6Y8bRuZUp11j4w)
Content-type: TEXT/PLAIN; CHARSET=US-ASCII


A bit late, but here's the source code. Enjoy... Jan Just

;-----------------------------------------------------------------------;
;    Request Header (Common portion)                   ;
;-----------------------------------------------------------------------;

RH   equ  DS:[BX]        ;addressability to Request Header structure

RHC  struc
               db   ?    ; length of Request Header (including data)
               db   ?    ; unit code (subunit)
     RHC_Cmd        db   ?    ; command code
     RHC_Sta        dw   ?    ; status
               dq   ?    ; reserved for DOS
     RH0_NumUnits   db   ?    ; number of units
                         ; set to 1 if installation succeeds,
                         ; set to 0 to cause installation failure
     RH0_EndOfs     dw   ?    ; offset  of ending address
     RH0_EndSeg     dw   ?    ; segment of ending address
               dw   ?    ; unused
               dw   ?    ; unused
               db   ?    ; unused

RHC  ends                ;end of common portion

Code      segment para public
          assume    CS:Code,DS:Code
          org  0
                              
StartCode equ  $
                    
; DEVICE HEADER - must be at offset zero within device driver

     dd   -1             ; becomes pointer to next device header
     dw   0A000h              ; attribute (IBM format block device)
     dw   offset Strategy     ; pointer to device "strategy" routine
     dw   offset Interrupt    ; pointer to device "interrupt handler"
     db   "DEVXXXXX"

; End of DEVICE HEADER

int21_seg dw   0
int21_ofs dw   0
first_umb dw   0

RH_Ptr         label     dword
RH_PtrOfs dw   ?
RH_PtrSeg dw   ?

Strategy  proc far

          mov  cs:RH_PtrOfs,bx
          mov  cs:RH_PtrSeg,es
          ret

Strategy  endp

;-----------------------------------------------------------------------;
;    Device "interrupt" entry point                                  ;
;-----------------------------------------------------------------------;

Interrupt proc far

          push ax
          push bx
          push ds

          lds  bx,RH_Ptr
          mov  al,RH.RHC_Cmd
          or   al,al
          jnz  Int_Cmd_Exit
          call Dev_Init
Int_Cmd_Exit:
          mov  ax,offset EndCode
          mov  RH.RH0_EndOfs,ax
          mov  RH.RH0_EndSeg,cs
          mov  ax,1
          mov  RH.RHC_Sta,ax

          pop  ds
          pop  bx
          pop  ax
          ret
          
Interrupt endp

Dev_Init  proc near

          push ax
          push bx
          push cx
          push dx
          push si
          push di
          push ds
          push es
          
          mov  ax,5200h
          int  021h
          mov  bx,008Ch
          mov  ax,es:[bx]
          mov  cs:first_umb,ax

          mov  ax,3521h
          int  021h
          mov  cs:int21_ofs,bx
          mov  cs:int21_seg,es

          pop  es
          pop  ds
          pop  di
          pop  si
          pop  dx
          pop  cx
          pop  bx
          pop  ax
          ret

Dev_Init  endp

EndCode        equ  $

Start:
          mov  ax,cs
          mov  ds,ax
          mov  ax,00900h
          lea  dx,Msg_1
          int  021h
          mov  ax,04C00h
          int  021h
          
Msg_1          db   "Please install me as a device driver!", 13, 10, "$"

Code      ends

          end  Start

--Boundary (ID /1OM+ers6Y8bRuZUp11j4w)--

