home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / s / s001 / 1.ddi / TS / ASM / INT13SPY.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-03-15  |  1.4 KB  |  81 lines

  1. DOSSEG
  2. .MODEL large, C
  3. .CODE
  4. ;
  5. old13         dd       0
  6. flag13         dd       0
  7. ;
  8. spy13  proc far
  9. ;
  10.        push    ds
  11.        push    si
  12.        lds     si, cs:flag13          ;set flag if FILIO
  13.        inc     word ptr [si]
  14.        pop     si
  15.        pop     ds
  16.  
  17.        pushf                  ;simulate int 0x13
  18.        call    [old13]
  19.  
  20.        push    ds
  21.        push    si
  22.        lds     si, cs:flag13          ;we are now leaving DOS
  23.        dec     word ptr [si]
  24.        pop     si
  25.        pop     ds
  26.  
  27.        iret
  28.  
  29. spy13  endp
  30. ;
  31. ;
  32. public    init13
  33. init13    proc far uses ds, ioflag:ptr word, intrpt:word
  34.     lds    bx, ioflag
  35.     mov    WORD PTR cs:flag13,   bx
  36.     mov    WORD PTR cs:flag13+2, ds
  37.  
  38.     mov     ax, intrpt
  39.     shl     ax, 1
  40.     shl     ax, 1
  41.     mov     bx,ax
  42.     xor     ax,ax
  43.     mov     ds,ax
  44.     mov     ax, [bx]
  45.     mov    WORD PTR cs:old13, ax          ; save org interrupt 21
  46.     mov     ax, [bx + 2]
  47.     mov    WORD PTR cs:old13 + 2, ax
  48.     cli
  49.     mov    ax, offset spy13
  50.     mov     [bx], ax
  51.     mov    ax, seg spy13
  52.     mov     [bx + 2], ax
  53.     sti
  54.  
  55.     ret
  56.  
  57. init13 endp
  58. ;
  59. ;
  60. public    term13
  61. term13    proc far uses ds, intrpt:word
  62.  
  63.     mov     ax, intrpt
  64.     shl     ax, 1
  65.     shl     ax, 1
  66.     mov     bx,ax
  67.     xor     ax,ax
  68.     mov     ds,ax
  69.     mov    ax, WORD PTR cs:old13         ; restore org interrupt 13
  70.     cmp    ax, 0
  71.     je    not13
  72.     mov     [bx], ax
  73.     mov    ax, WORD PTR cs:old13 + 2
  74.     mov    [bx + 2], ax
  75. not13:    ret
  76.  
  77. term13    endp
  78.  
  79.  
  80. END
  81.