Interrupt Services Win3.1 & Win95 
Author Message
 Interrupt Services Win3.1 & Win95

Capturing interrupts.

Under DOS and Win3.1 using the DOS functions Get Interrupt (Int 21/35)
and Set Interrupt (Int 21/25) allow access to interrupts such as the
serial IRQ 3 (Int 0Ch) for the mouse on com1.

This system works in both Win3.1 and DOS as under DOS there is only
one IVT, and under windows, window applications (except Dos Boxes) use
the one IVT which points to protected mode service routines. Thus
under windows you can chain your own protected mode routine to
service these interrupts in a similar fashon as in the days of DOS.

Now with Win95 this nice and simple method doesn't work. It appears as
if the interrupts arent passed onto your applications IVT. So how do
you trap interrupts and pass them to your own service routines?

To see what I mean here is a snippet of code to capture an interrupt,
which does work in Win3.1 but NOT Win95. Could someone show
corrections so it will function under Win95.

...
;Prepare For Interrupt Handler
        push    es
        push    ds
        mov     ax,000Ah        ;create alias Data descr. for Code Seg
        push    cs
        pop     bx              ;Selector to be aliased
        int     31h             ;returns ax
        push    ax
        pop     es
        push    es
        mov     es:DSselector,ax     ;Save Alias maybe  handy later
        mov     ax,Word Ptr whndl   ;The  "Window" Handle to
        mov     es:Hwndcs,ax         ;           get messages later
        mov     ax,3500h+Int_Val    ;Get Old Interrupt Vector
        int     21h             ;--> ES:BX
        push    es
        pop     ax
        pop     es
        mov     es:OffsetInt,bx
        mov     es:SelectorINT,ax
        mov     dx,OFFSET runtime       ;Get New Vector
        push    cs                      ;service in same seg.  
        pop     ds
        mov     ax,2500h+Int_Val        ;Set Interrupt Vector
        int     21h
        pop     ds          ;Point Back into NORMAL Data space
        pop     es
...

;The Interrupt routine
Runtime:
        call    Post_Check
        db      0EAh       ;JMP to FAR pointer to original service.
OffsetInt               DW      0
SelectorInt     DW      0

Init_Grabber Endp

Having the posting routine separate lets you check things by being
callable directly

Post_Check      Proc    Near
Public  Post_Check
        pusha                   ;Save ALL regs
        push    ds
        push    es
        push    ss
        mov     ax,cs:Hwndcs
        mov     bx,00h
        push    ax
        push    Word Ptr WM_USER
        push    bx              ;Pass Parameter
        push    0
        push    0
        call    Postmessage     ;Win API, Put message on que
        pop     ss
        pop     es
        pop     ds
        popa
        ret
Post_Check      Endp



Thu, 02 Dec 1999 03:00:00 GMT  
 Interrupt Services Win3.1 & Win95

In 95 you may wish to use a VXD.
95 has control of all recources.

Quote:

>Capturing interrupts.

>Under DOS and Win3.1 using the DOS functions Get

Interrupt (Int 21/35)
Quote:
>and Set Interrupt (Int 21/25) allow access to interrupts such
as the
>serial IRQ 3 (Int 0Ch) for the mouse on com1.

>This system works in both Win3.1 and DOS as under DOS
there is only
>one IVT, and under windows, window applications (except
Dos Boxes) use
>the one IVT which points to protected mode service
routines. Thus
>under windows you can chain your own protected mode
routine to
>service these interrupts in a similar fashon as in the days of
DOS.

>Now with Win95 this nice and simple method doesn't work. It
appears as
>if the interrupts arent passed onto your applications IVT. So
how do
>you trap interrupts and pass them to your own service
routines?

>To see what I mean here is a snippet of code to capture an
interrupt,
>which does work in Win3.1 but NOT Win95. Could someone
show
>corrections so it will function under Win95.

>....
>;Prepare For Interrupt Handler
>    push    es
>    push    ds
>    mov     ax,000Ah        ;create alias Data descr. for
Code Seg
>    push    cs
>    pop     bx              ;Selector to be aliased
>    int     31h             ;returns ax
>    push    ax
>    pop     es
>    push    es
>    mov     es:DSselector,ax     ;Save Alias maybe  
handy later
>    mov     ax,Word Ptr whndl   ;The  "Window" Handle
to
>    mov     es:Hwndcs,ax         ;           get messages later
>    mov     ax,3500h+Int_Val    ;Get Old Interrupt Vector
>    int     21h             ;--> ES:BX
>    push    es
>    pop     ax
>    pop     es
>    mov     es:OffsetInt,bx
>    mov     es:SelectorINT,ax
>    mov     dx,OFFSET runtime       ;Get New Vector
>    push    cs                      ;service in same
seg.    
>    pop     ds
>    mov     ax,2500h+Int_Val        ;Set Interrupt Vector
>    int     21h
>    pop     ds          ;Point Back into NORMAL Data
space
>    pop     es
>....

>;The Interrupt routine
>Runtime:
>    call    Post_Check
>    db      0EAh       ;JMP to FAR pointer to original
service.
>OffsetInt           DW      0
>SelectorInt DW      0

>Init_Grabber Endp

>Having the posting routine separate lets you check things
by being
>callable directly

>Post_Check      Proc    Near
>Public  Post_Check
>    pusha                   ;Save ALL regs
>    push    ds
>    push    es
>    push    ss
>    mov     ax,cs:Hwndcs
>    mov     bx,00h
>    push    ax
>    push    Word Ptr WM_USER
>    push    bx              ;Pass Parameter
>    push    0
>    push    0
>    call    Postmessage     ;Win API, Put message on
que
>    pop     ss
>    pop     es
>    pop     ds
>    popa
>    ret
>Post_Check      Endp



Sun, 05 Dec 1999 03:00:00 GMT  
 Interrupt Services Win3.1 & Win95



Quote:
>> ...[Snip]....

>I've had very little experiance with Win95. Any hints as to how you
>would go about creating a VDX?

I've heard of a book by Thielen and Woodruff, "Writing Windows Virtual
Device Drivers" and it USED to include a program on disk supplied by
Microsoft called VxD-Lite. Where could you aquire a copy of this book
WITH this. I've heard that Microsoft have withheld it from current
versions of the book.


Sun, 12 Dec 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CW2000-PUT() under Win95 10 times slower than under Win3.11

2. Compilers for DOS/Win3/Win95

3. Uploading to Simtel.Net's MS-DOS, Win3.x and Win95 collections

4. Uploading to Simtel.Net's MS-DOS, Win3.x and Win95 collections

5. Uploading to Simtel.Net's MS-DOS, Win3.x and Win95 collections

6. Uploading to Simtel.Net's MS-DOS, Win3.x and Win95 collections

7. Uploading to Simtel.Net's MS-DOS, Win3.x and Win95 collections

8. Need a Compiler for WIN3.x or WIN95

9. Absoft F77 for Win3.1/Win95/WinNT

10. FORTRAN 77 freeware: 32-bit in Win3.1x or Win95

11. Itcl2.1 on Win3.1,Win95,WinNT

12. Need a tcl interpreter for Win3.1/Win95!!!

 

 
Powered by phpBB® Forum Software