home *** CD-ROM | disk | FTP | other *** search
/ Computer Select (Limited Edition) / Computer Select.iso / dobbs / v17n02 / inhook.exe / INT60.ASM next >
Encoding:
Assembly Source File  |  1991-05-07  |  2.4 KB  |  64 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;                                          ;
  3. ;    INT60.ASM -- Signaller program for INTHOOK example application          ;
  4. ;                                          ;
  5. ;    Written by Walter Oney                              ;
  6. ;                                          ;
  7. ;-----------------------------------------------------------------------------;
  8.  
  9.      name  int60
  10. int60     segment byte public 'code'
  11.      assume cs:int60, ds:int60
  12.      org   100h          ; required for .COM file usage
  13.  
  14. ;    See if the forwarder program is present by checking the interrupt
  15. ;    vector for 61h.
  16.  
  17. begin:     mov   ax, 3561h      ; get int 61 vector address
  18.      int   21h          ;   ..
  19.      mov   ax, es          ; be sure there is one
  20.      or    ax, bx          ;   ..
  21.      jz    cantcall       ; if not, complain and quit
  22.  
  23. ;    Use 2F/1685 to switch to the system virtual machine and call the
  24. ;    forwarder program. Note that no-one actually does an INT 61h -- we
  25. ;    simply use the vector as a convenient (and facile) place to park
  26. ;    the address of the callback
  27.  
  28.      mov   ax, 1685h      ; fcn 1685: switch VM's and callback
  29.      mov   di, bx          ; ES:DI = callback address (int 61 hdlr)
  30.      mov   bx, 1          ; BX = VM to switch to (system VM)
  31.      mov   cx, 3          ; CX = .... .... .... ..11 -- wait until
  32.                   ;    interrupts enabled and critical
  33.                   ;    section unowned
  34.      xor   dx, dx          ; DX:SI = priority boost (zero)
  35.      xor   si, si          ;   ..
  36.      int   2Fh          ; switch to system VM & do INT 60
  37.  
  38. ;    If the forwarder found an INT 60 handler, it saved the address beginning
  39. ;    after a 3-byte JMP located at 100h. Check this in order to complain if
  40. ;    the responder WinApp isn't loaded. Note that this test will sometimes
  41. ;    fail because we're running asynchronously with the system VM.
  42.  
  43.      mov   ax, word ptr es:[103h]; see if forwarder found an INT 60 handler
  44.      or    ax, word ptr es:[105h];     ..
  45.      jz    no60          ; if not, complain about it
  46.  
  47. goback:  mov   ax, 4C00h      ; terminate with errorlevel 0
  48.      int   21h          ; (does not return)
  49.  
  50. cantmsg  db    'The forwarder program is not installed', 13, 10, '$'
  51. nomsg     db    'The responder WinApp is not running', 13, 10, '$'
  52.  
  53. no60:     lea   dx, nomsg      ; responder not present
  54.      jmp   short complain      ;   ..
  55.  
  56. cantcall:lea   dx, cantmsg      ; forwarder not present
  57.  
  58. complain:mov   ah, 9          ; fcn 9: print msg in DS:DX on screen
  59.      int   21h          ;   ..
  60.      jmp   goback          ; exit
  61.  
  62. int60     ends
  63.      end   begin
  64.