November 21, 2001
Can anyone give me a short example on int_setvector function?   I have no idea on how to split the interrupt address into segment and offset.   Thanks


November 22, 2001
> Imran Haider a écrit :
>
> Can anyone give me a short example on int_setvector function?   I have no idea on how to split the interrupt address into segment and offset.   Thanks

//declarations

static int _cdecl int_handler(INT_DATA* idata);

//trap vector:

if (int_intercept(no_int,int_handler,int_stack_size)!=0) goto err;


//untrap vector (if trap was ok):

int_restore(no_int);

//interrupt handler:

static int _cdecl int_handler(INT_DATA* idata) {
//at entry, if hardware interrupt, cpu flag if is 0 (interrupt locked), PIC 8929 interrupt mask is off
            .
            .
    do what you have to do (!! if hardware asynchronous interrupt there is some particular knowledge to have !!)
            .
            .
     return 0;            //return 0 if you want to call original interrupt

        or

    return 1            //return 1 if you don't want to call original interrupt
                           //!! if hardware interrupt, you have to send a End Of Interrupt to Interrupt Controller PIC 8259
}