home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_07_02 / v7n2060a.txt < prev    next >
Text File  |  1988-12-20  |  2KB  |  59 lines

  1. PAGE
  2. PAGE 64, 132
  3. TITLE Start up code for Turbo-C based Device Driver -- R.D.Allen, 9/4/87
  4. ; Copyright 1987, 1988 PARS Service Partnership
  5.  
  6. ;Declare Segments & Groups. Define Device Driver Header
  7. DGROUP    GROUP    _TEXT, _DATA, _CVTSEG, _SCNSEG, _BSS, _TAIL
  8.  
  9. ASSUME    CS:_TEXT, DS:NOTHING
  10. _TEXT    SEGMENT BYTE PUBLIC 'CODE'    ; All code goes in this segment
  11.  
  12.     PUBLIC    _header
  13.     PUBLIC    DGROUP@
  14.     PUBLIC    _abort
  15.     PUBLIC    _setDGROUP
  16.  
  17.     EXTRN    _strategy:NEAR
  18.     EXTRN    _dosio:NEAR
  19.  
  20. ; ************************
  21. ; DEVICE HEADER: Must be first thing in the binary file. Always!
  22. ; ************************
  23.  
  24. _header    DW    -1                        ; Chain Pointer -1, only device in driver
  25.         DW    -1
  26.         DW    1100100000000000b        ; IOCTL word, simple character device
  27.         DW    DGROUP:_strategy
  28.         DW    DGROUP:_dosio
  29.         DB    "COMX    "                ; Name of driver is COMX
  30.  
  31. DGROUP@            dw ?                ; Turbo-C library requires this set to DS
  32.  
  33. _setDGROUP:
  34.         MOV        CS:DGROUP@, DS        ; TINY model library wants this 
  35.                                     ; Called during (df_) INIT. Falls into ret
  36.  
  37. _abort:    RET                            ; Hope this is never called!
  38.  
  39. _TEXT    ENDS
  40. _DATA    SEGMENT BYTE PUBLIC 'DATA'    ; Main data segment for driver
  41. _DATA    ENDS
  42.                                     ; Additional segments desired by the
  43.                                     ; compilier.
  44. _CVTSEG SEGMENT WORD PUBLIC 'DATA'
  45.     PUBLIC    __RealCvtVector
  46. __RealCvtVector    dw ?
  47. _CVTSEG ENDS
  48.  
  49. _SCNSEG SEGMENT WORD PUBLIC 'DATA'
  50. _SCNSEG ENDS
  51.  
  52. _BSS    SEGMENT WORD PUBLIC 'BSS'
  53. _BSS    ENDS
  54.  
  55. _TAIL    SEGMENT WORD PUBLIC 'TAIL'    ; Data area for initialization code
  56. _TAIL    ENDS                        ; All can be thrown away
  57.  
  58.         END
  59.