home *** CD-ROM | disk | FTP | other *** search
- ;-----------------------------------------------------------------------------;
- ; ;
- ; INT61.ASM -- Forwarder program for the INTHOOK example application ;
- ; ;
- ; Written by Walter Oney ;
- ; ;
- ;-----------------------------------------------------------------------------;
-
- name int61
- .286p
- int61 segment byte public 'code'
- assume cs:int61, ds:int61
- org 100h ; required for .COM file usage
- begin: jmp doit ; jump around fixed data area
-
- vect60 dw 0, 0 ; for inspection by signaller
-
- doit: mov ax, 2561h ; hook INT 61h so INT60 can find us
- lea dx, callback ; from another virtual machine
- int 21h ; ..
-
- lea dx, endprog+15 ; point past all code in this module
- shr dx, 4 ; compute # paragraphs to keep
- mov ax, 3100h ; terminate and stay resident
- int 21h ; (does not return)
-
- ; CALLBACK is reached circuitously when INT60 does a 2F/1685 to schedule
- ; it to run in the system virtual machine.
-
- callback:
- push es ; save working registers
- push ds ; ..
- pusha ; ..
- mov ax, cs ; set DS == CS
- mov ds, ax ; ..
-
- mov ax, 3560h ; get current INT 60 vector address
- int 21h ; ..
- mov vect60, bx ; save for debugging inspection
- mov vect60+2, es ; ..
-
- mov ax, es ; is there a handler?
- or ax, bx ; ..
- jz done60 ; if not, don't signal it!
-
- int 60h ; issue INT 60 to wakeup WinApp
-
- done60: popa ; restore registers
- pop ds
- pop es ; ..
- iret ; return from callback to Windows
-
- endprog: ; for 21/31 paragraph computation
-
- int61 ends
- end begin