home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / c / tcdev.arc / TCDEV.ASM < prev    next >
Assembly Source File  |  1987-07-14  |  2KB  |  105 lines

  1. ;History:1,1
  2. ;07-14-87 00:18:30 add a user-settable device attribute word
  3. ;07-13-87 23:30:27 use dgroup:offset, NOT offset
  4. ;07-13-87 23:28:57 change the definition of _BSS.
  5. ;07-13-87 23:26:10 move mystack to _BSS
  6. ;07-10-87 23:22:52 make a programmable-settable device name.
  7.  
  8.     INCLUDE c:\turboc\include\RULES.ASI
  9.  
  10. Header@
  11.  
  12. ExtProc@    device_driver, __CDECL__
  13.  
  14. DSeg@
  15.  
  16. ptrsav    dw    ?,?            ; request packet address
  17.  
  18. savess    dw    ?            ; old stack save
  19. savesp    dw    ?
  20.  
  21. DSegEnd@
  22.  
  23. _BSS    SEGMENT WORD PUBLIC 'BSS'
  24.     dw    256 dup (?)
  25. mystack    label    byte
  26. _BSS    ends
  27.  
  28. _BSSEND SEGMENT
  29. PubSym@        enddata, <LABEL BYTE>, __Cdecl__
  30. _BSSEND ENDS
  31.  
  32. CSeg@
  33.  
  34. device_header    struc
  35.         dw    -1,-1
  36. device_attr    dw    ?
  37. device_strategy    dw    ?
  38. device_intr    dw    ?
  39. device_name    db    '        '
  40. device_header    ends
  41.  
  42.     public    _dev_name
  43. _dev_name    equ    $.device_name
  44.     public    _dev_attr
  45. _dev_attr    equ    $.device_attr
  46.     device_header<,, strat, intr>
  47.     db    0            ;leave room for a trailing null.
  48.  
  49. strat proc    far
  50.     mov    cs:ptrsav,bx
  51.     mov    cs:ptrsav+2,es        ; save es:bx as dword
  52.     ret
  53. strat endp
  54.  
  55. intr    proc    far
  56.  
  57. ;    save everything
  58.  
  59.     push    ax
  60.  
  61.     mov    cs:savess,ss
  62.     mov    cs:savesp,sp
  63.  
  64.     mov    ax,cs
  65.     mov    ss,ax
  66.     mov    sp,offset dgroup:mystack
  67.  
  68.     push    bx
  69.     push    cx
  70.     push    dx
  71.     push    si
  72.     push    di
  73.     push    bp
  74.     push    ds
  75.     push    es
  76.  
  77.     mov    ax,cs
  78.     mov    ds,ax
  79.  
  80.     push    ds:ptrsav+2
  81.     push    ds:ptrsav
  82.     call    device_driver@
  83.     add    sp,4
  84.  
  85.     pop    es
  86.     pop    ds
  87.     pop    bp
  88.     pop    di
  89.     pop    si
  90.     pop    dx
  91.     pop    cx
  92.     pop    bx
  93.  
  94.     mov    ss,cs:savess
  95.     mov    sp,cs:savesp
  96.  
  97.     pop    ax
  98.     ret
  99.  
  100. intr    endp
  101.  
  102. CSegEnd@
  103.  
  104.     end                ; end of program
  105.