Posted By: mk (mk) on 'CZprogram'
Title:     Re: BOOT
Date:      Wed Nov 12 20:17:35 1997


 Tak na DEVICE=c:filename.exe som niekde nasiel zdrojacik:

;-----------------------------------------------------------------------;
;    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)
 HC_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


;---

Search the boards