gerotica
2007-03-24 03:56:19 UTC
I saw a lot of info about the problems of trapping int21h, but I
really don´t understand what happens. I need to watch some serial
operations from another program, wich uses fopen() function as
interface for the comm port. Here´s my code:
void interrupt (*old21)();
void interrupt int21(void)
{
char far* str;
if (_AH == 0x3d)
{
str = MK_FP(_DS, _DX);
if (_fstricmp(str, "com1:") == 0)
reboot(); //Debugging purpouses
}
old21();
}
void main(void)
{
union REGS regs;
long far* vect;
old21 = getvect(0x21);
vect = MK_FP(0, 0x21 * 4); //using direct address cause setvect
could cause conflict??
*vect = int21 // Not sure about this
reboot = MK_FP(0xffff, 0x0000);
regs.x.ax = 0x3100;
regs.x.dx = 0x1000;
intdos(®s, ®s);
}
Im not sure if this pointers operations are correct but Im interested
about what happens inside the int21 function.
Tks in advance
really don´t understand what happens. I need to watch some serial
operations from another program, wich uses fopen() function as
interface for the comm port. Here´s my code:
void interrupt (*old21)();
void interrupt int21(void)
{
char far* str;
if (_AH == 0x3d)
{
str = MK_FP(_DS, _DX);
if (_fstricmp(str, "com1:") == 0)
reboot(); //Debugging purpouses
}
old21();
}
void main(void)
{
union REGS regs;
long far* vect;
old21 = getvect(0x21);
vect = MK_FP(0, 0x21 * 4); //using direct address cause setvect
could cause conflict??
*vect = int21 // Not sure about this
reboot = MK_FP(0xffff, 0x0000);
regs.x.ax = 0x3100;
regs.x.dx = 0x1000;
intdos(®s, ®s);
}
Im not sure if this pointers operations are correct but Im interested
about what happens inside the int21 function.
Tks in advance