home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 024 / psi110g.zip / PKVEC.ASM < prev    next >
Assembly Source File  |  1993-09-16  |  3KB  |  111 lines

  1. ; Packet driver interrupt hooks
  2.  
  3. ;%    .MODEL  MEMMOD,C
  4. include asmglobal.h        
  5.     %MACS
  6.     extrn   pkint:proc
  7.  
  8.     .DATA
  9.     extrn   Stktop
  10.  
  11.     .CODE
  12. sssave  dw      ?
  13. spsave  dw      ?
  14. axsave  dw      ?
  15. dbase   dw      @Data
  16.  
  17. if      @Cpu AND 8
  18. disave  dw      ?
  19. endif
  20.  
  21. ; pkvec0 - Packet driver receive call handler #0
  22.     public  pkvec0
  23.     label   pkvec0  far
  24.     pushf                   ; save his interrupt state
  25.     cli                     ; no distractions
  26.     mov     cs:sssave,ss    ; stash user stack context
  27.     mov     cs:spsave,sp
  28.     mov     cs:axsave,ax    ; save our AX register
  29.  
  30.     mov     ss,cs:dbase     ; set up interrupt stack
  31.     lea     sp,Stktop
  32.     if      @Cpu AND 8
  33.         PUSHALL
  34.     endif
  35.     push    ds              ; save for caller
  36.  
  37.     mov     ax,ss
  38.     mov     ds,ax
  39.     mov     ax,0    ; device #0
  40.     push    ax
  41.     mov     ax,cs:axsave    ; Restore AX
  42.     pushf           ; make it look like an INTERRUPT
  43.     call    pkint
  44.     jmp     pkret
  45.  
  46. ; pkvec1 - Packet driver receive call handler #1
  47.     public  pkvec1
  48.     label   pkvec1  far
  49.     pushf                   ; save his interrupt state
  50.     cli                     ; no distractions
  51.     mov     cs:sssave,ss    ; stash user stack context
  52.     mov     cs:spsave,sp
  53.     mov     cs:axsave,ax    ; save our AX register
  54.  
  55.     mov     ss,cs:dbase     ; set up interrupt stack
  56.     lea     sp,Stktop
  57.     if @Cpu AND 8
  58.         PUSHALL
  59.     endif
  60.     push    ds              ; save for caller
  61.  
  62.     mov     ax,ss
  63.     mov     ds,ax
  64.     mov     ax,1    ; device #1
  65.     push    ax
  66.     mov     ax,cs:axsave    ; Restore AX
  67.     pushf           ; make it look like an INTERRUPT
  68.     call    pkint
  69.     jmp     pkret
  70.  
  71. ; pkvec2 - Packet driver receive call handler #2
  72.     public  pkvec2
  73.     label   pkvec2  far
  74.     pushf                   ; save his interrupt state
  75.     cli                     ; no distractions
  76.     mov     cs:sssave,ss    ; stash user stack context
  77.     mov     cs:spsave,sp
  78.     mov     cs:axsave,ax    ; save our AX register
  79.  
  80.     mov     ss,cs:dbase     ; set up interrupt stack
  81.     lea     sp,Stktop
  82.     if @Cpu AND 8
  83.         PUSHALL
  84.     endif
  85.     push    ds              ; save for caller
  86.  
  87.     mov     ax,ss
  88.     mov     ds,ax
  89.     mov     ax,2    ; device #2
  90.     push    ax
  91.     mov     ax,cs:axsave    ; Restore AX
  92.     pushf           ; make it look like an INTERRUPT
  93.     call    pkint
  94.     jmp     pkret
  95.  
  96. ; common return for all packet drivers
  97.     label   pkret   near
  98.     pop     ax      ; pop dev # arg
  99.     pop     ds      ; restore for caller
  100.     if      @Cpu AND 8
  101.         mov cs:disave,di
  102.         POPALL
  103.         mov di,cs:disave
  104.     endif
  105.     mov     ss,cs:sssave
  106.     mov     sp,cs:spsave    ; restore original stack context
  107.     popf
  108.     retf
  109.  
  110.     end
  111.