help porting 16 bit to 32 bit (partly assembly) application 
Author Message
 help porting 16 bit to 32 bit (partly assembly) application

Help!
I am trying to get the following code to work in 32 bit mode using
Microsoft Visual C++ (4.1)
compiler.  It compiles and runs fine using the 16 bit compiler (2.1 I
think), but in the 32 bit
complier, I get the following error at the two lines that are noted:
error C2443: operand size conflict

I think that:
change_int_intr() sets up an interrupt handler (new_intr_proc) routine
and that:
restore_int_intr() puts the original (windows?) interrupt handler
back(?...please correct me if I am wrong this!)

Assuming that this is correct, I am sure that someone has already done
this for the 32 bit environment...could someone point me to some code
that does this?

Short of this miracle (someone already having the code), could someone
explain (in the preferred order :) ) one of the following:
1) how do I write a function that replaces an interrupt handler with my
own?
2) why does this code not work and what can I do to fix it?

I just started with XLVision and as of yet do not have my own e-mail
address.  If you could

here is the offending code:

thanks for your help!
-jor
Jordan Thompson
XLVision
(407)589-7331

WORD FAR change_int_intr( VOID )
{
    WORD    rt;

    rt = 0;
    _disable();                        //Disable interrupt.
    _asm{
        push    DS
error-> mov     AX, DS
        mov     ES, AX
        mov     DI, OFFSET reg_st      ;;ES:DI points to register
structure.
        mov     AX, CS
        mov     DS, AX
        mov     SI, OFFSET new_intr_proc;;DS:SI points to new int.
procedure.
error-> mov     AX, 303h
        int     31h                    ;;Allocate real mode Seg:Off (in
CX:DX).
        jc      error
        pop     DS
        mov     DLLgv_new_intr_seg, CX ;;Set the Seg:Off to 2 global
variables.
        mov     DLLgv_new_intr_off, DX

        mov     BL, DLLgv_hooked_intr  ;;Set BL to the 0Dh.
        mov     AX, 200h               ;;Get the int. vector (in CX:DX).
        int     31h
        jc      error

        mov     DLLgv_old_intr_seg, CX ;;Save old vector (in CX:DX).
        mov     DLLgv_old_intr_off, DX

        mov     BL, DLLgv_hooked_intr  ;;Set BL to the 0Dh.
        mov     CX, DLLgv_new_intr_seg
        mov     DX, DLLgv_new_intr_off
        mov     AX, 201h               ;;Set new vector to the int.
        int     31h
        jc      error
        jmp     ok
    error:
        mov     rt, 1
    ok:
        }
    _enable();                         //Enable interrupt.

    return( rt );

Quote:
}

                //return 0: sucessful
                //       1: restore error
WORD FAR restore_int_intr( VOID )
{
    WORD    rt;

    rt = 0;
    _disable();                        //Disable interrupt.
    _asm{
        mov     CX, DLLgv_old_intr_seg  ;;Set the old int.# vector to
CX:DX.
        mov     DX, DLLgv_old_intr_off
        mov     BL, DLLgv_hooked_intr   ;;Set 0Dh to BL to be restored.
        mov     AX, 201h                ;;Restore the interrupt.
        int     31h
        jc      error

        mov     CX, DLLgv_new_intr_seg  ;;Set real mode Seg:Off to
CX:DX.
        mov     DX, DLLgv_new_intr_off
        mov     AX, 304h                ;;Release the real mode Seg:Off.
        int     31h
        jmp     ok
    error:
        mov     rt, 1
    ok:
        }
    _enable();                         //Enable interrupt.
    return( rt );

Quote:
}



Sat, 03 Oct 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Q: How to port a 16-bit application to 32-bit

2. HELP: porting 16 bit mfc program to 32 bit (mfc v5)

3. 16-bit application 32-bit help

4. 16-bit application 32-bit help

5. reading old data, 16 bit application vs 32 bit application

6. porting 16-bit int to 32-bit int with asm code

7. Porting 16-bit to 32-bit code and the use of the LOWORD and HIWORD macros

8. Porting from 16-bit to 32-bit

9. Porting 16 bit code to 32 bit : Resource file with RCDATA

10. porting __segment from 16-bit DLL to 32-bit

11. Porting 16-bit to 32-bit

12. Porting 16-bit app to 32-bit

 

 
Powered by phpBB® Forum Software