/* * irqvector.h -- MS-DOS interrupt vector subroutines * * Copyright (C) 1997 by Sony Computer Entertainment * All rights Reserved */ #include #include #include #include #include #include "irqvect.h" /*------- interrupt vector set/restore routines ------*/ struct intvects *ivects = NULL; void restore_ivectors(void) { struct intvects *v = ivects; for( v = ivects; v != NULL; v = v->next ) { _dos_setvect( v->vectnum, v->savevect ); } } void set_ivector(unsigned short num, intvector vector) { struct intvects *newvects = NULL; newvects = malloc(sizeof(struct intvects)); if( newvects == NULL ) { _cputs("Can not malloc interrupt vector save area\n\r"); restore_ivectors(); exit(1); } newvects->vectnum = num; newvects->savevect = _dos_getvect(num); _dos_setvect(num, vector); newvects->next = ivects; ivects = newvects; } void printvect() { void __far *vect; vect = (void __far *)_dos_getvect(0x1b); printf("\nint 1bh == %04x:%04x\n", _FP_SEG(vect), _FP_OFF(vect)); vect = (void __far *)_dos_getvect(0x23); printf("int 23h == %04x:%04x\n", _FP_SEG(vect), _FP_OFF(vect)); vect = (void __far *)_dos_getvect(0x24); printf("int 24h == %04x:%04x\n", _FP_SEG(vect), _FP_OFF(vect)); }