I have been trying to write c code to overwrite the interrupt vectors on the DS80c400 ( to do the same as the following asm code) EXTRN CODE (com_isr) MOV DPTR, #000023H MOV A, #02H; MOVX @DPTR, A; INC DPTR; MOV A, #BYTE2 com_isr; MOVX @DPTR, A; INC DPTR; MOV A, #HIGH com_isr; MOVX @DPTR, A; INC DPTR; MOV A, #LOW com_isr; MOVX @DPTR, A; i would like to do the same in 'c' but when I get a pointer to the com_isr fuction it is in the "generic pointer" format which is not much use. So any suggestion on how to do this in C?
Thanks that seems to do the trick void _isrInstall (unsigned char vector, void *pointer) { long unkludgedPointer; unkludgedPointer= (((long)pointer) & 0x7fffff) - 0x010000; FVAR (char,vector) = 0x02; FVAR (char,vector+1) = (unkludgedPointer >> 16) & 0xff; FVAR (char,vector+2) = (unkludgedPointer >> 8) & 0xff; FVAR (char,vector+3) = unkludgedPointer & 0xff; return; }