Category : C Source Code
Archive   : ADVGRAPH.ZIP
Filename : INSTISR.C
/* INSTISR.C installs the serial interrupt service
** routine. Refer to "serial interface at a glance"
** for register offsets used.
*/
#include
#include
#include
struct ISRVEC
{
unsigned vecl;
unsigned vech;
unsigned type;
};
extern struct ISRVEC isrvec;
instisr(service, request, port)
unsigned (*service)();
unsigned request;
unsigned long port;
{
unsigned far *base = (unsigned far *)port;
int i = 2;
outp((*base)+1, 1); /* select interrupts */
/* maskable hardware interrupts must be unmasked */
/* in the 8259 interrupt mask register */
outp(0x21, inp(0x21) & ~0x10); /* unmask COM1 interrupt */
/* set the interrupt vector using DOS */
setvect(request, service);
/* enable interrupts selected */
outp((*base)+4, inp((*base)+4) | 8);
/* clear pending interrupts */
inp(*base);
inp(*base);
inp(*base);
return(0);
}
setvect(vector, service)
int vector;
unsigned (*service)();
{
union REGS regs;
struct SREGS sregs;
regs.h.al = vector;
regs.h.ah = 0x35;
int86x(0x21, ®s, ®s, &sregs);
isrvec.vech = sregs.es; /* segment */
isrvec.vecl = regs.x.bx; /* offset */
isrvec.type = vector;
sregs.ds = FP_SEG(service); /* segment */
regs.x.dx = FP_OFF(service); /* offset */
regs.h.al = vector;
regs.h.ah = 0x25;
int86x(0x21, ®s, ®s, &sregs);
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/