home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / c / scsidrvr.arc / driasm.s < prev    next >
Text File  |  1988-07-10  |  2KB  |  113 lines

  1. name driasm
  2.  
  3.  
  4. STACKSIZ equ 512
  5.  
  6. _TEXT    segment    public 'CODE'
  7.  
  8. ;This forces everything into the same segment
  9. DGROUP    GROUP    _TEXT, _DATA, _EMUSEG, _CVTSEG, _SCNSEG, _BSS, _BSSEND
  10.  
  11. ASSUME    CS:_TEXT, DS:DGROUP, SS:DGROUP
  12.  
  13. ;This must be first
  14. include dheader.s
  15.  
  16. ; This is the pointer to the request header
  17. ; Together they are a far pointer
  18. public _request_off
  19. _request_off     dw ?        ;must be in code segment
  20. _request_seg    dw ?
  21.  
  22. ;This is to keep turbo C happy
  23. public DGROUP@
  24. DGROUP@ dd ?        ;must be in code segment
  25.  
  26. ;These are local storage for the callers sp and ss
  27. oldss    dw    ?
  28. oldsp    dw ?
  29.  
  30. ; This is the local stack
  31. db STACKSIZ dup (?)
  32. localstk_top label word
  33.  
  34.  
  35. ; This is the "strategy" entry point
  36. _strat    proc    far
  37.     mov    word ptr cs:_request_off,bx
  38.     mov    word ptr cs:_request_seg,es
  39.     mov cs:DGROUP@, cs        ;Turbo C uses this for interrupt functions
  40.     ret    
  41. _strat    endp
  42.  
  43.  
  44. ; This is the "interrupt" entry point
  45. _intr    proc    far
  46.     cli
  47.     push ds
  48.     push es
  49.     push ax
  50.     push bx
  51.     push cx
  52.     push dx
  53.     push si
  54.     push di
  55.     push bp
  56.     pushf
  57.  
  58.     mov cs:oldss, ss
  59.     mov cs:oldsp, sp
  60.  
  61.     mov ax, cs ;make local data addressable
  62.     mov ds, ax
  63.     mov ss, ax
  64.     mov es, ax
  65.     mov ax, offset localstk_top
  66.     mov sp, ax
  67.     mov bp, ax
  68.     sti
  69.  
  70.     mov    ax, cs:_request_seg
  71.     push ax
  72.     mov    ax, cs:_request_off
  73.     push ax
  74.     call _dointr    ;call dointr() with far pointer to header
  75.     pop ax
  76.     pop ax
  77.  
  78.     cli
  79.     mov ax, cs:oldss
  80.     mov ss, ax
  81.     mov ax, cs:oldsp
  82.     mov sp, ax
  83.     popf
  84.     pop bp
  85.     pop di
  86.     pop si
  87.     pop dx
  88.     pop cx
  89.     pop bx
  90.     pop ax
  91.     pop es
  92.     pop ds
  93.     sti
  94.     ret
  95. _intr    endp
  96.  
  97.  
  98.     public    _intr
  99.     public    _strat
  100.  
  101.  
  102.  
  103.     extrn _dointr:near
  104.  
  105. _TEXT    ends
  106.  
  107. _BSSEND segment byte public 'BSSEND'
  108. public _edata
  109. _edata label byte
  110. _BSSEND ends
  111.  
  112.     end
  113.