Category : C Source Code
Archive   : C-ALL.ZIP
Filename : TI641.ASC

 
Output of file : TI641.ASC contained in archive : C-ALL.ZIP







PRODUCT : Borland C++ NUMBER : 641
VERSION : 2.0
OS : PC DOS
DATE : September 11, 1991 PAGE : 1/2

TITLE : Using Interrupt Functions in C++ Programs




/************************************************************************
example of installing an interrupt function in a C++ program
************************************************************************/
#pragma option -w -w-par
#include
#include

typedef void interrupt (*cast_isr) (...);

void install(void interrupt (*faddr)(...), int inum);
void interrupt mybeep(unsigned, unsigned, unsigned, unsigned,
unsigned, unsigned, unsigned, unsigned,
unsigned);
void testbeep(unsigned char bcount, int inum);

//-----------------
int main(void)
{
install( (cast_isr)mybeep, 10);
testbeep(3,10);
cputs("beep");
return 0;
}


//-----------------
void install(void interrupt (*faddr)(...), int inum)
{
setvect(inum, faddr);
}

//-----------------
void interrupt mybeep(unsigned bp, unsigned di, unsigned si,
unsigned ds, unsigned es, unsigned dx,
unsigned cx, unsigned bx, unsigned ax)
{
int i, j;
char originalbits, bits;
int bcount = 2000;

bits = originalbits = inportb(0x61);
















PRODUCT : Borland C++ NUMBER : 641
VERSION : 2.0
OS : PC DOS
DATE : September 11, 1991 PAGE : 2/2

TITLE : Using Interrupt Functions in C++ Programs




for (i = 0; i <= bcount; i++)
{ outportb(0x61, bits & 0xfc);
for (j = 0; j <= 300; j++);
outportb(0x61, bits | 2);
for (j=0; j<=300; j++);
}
outportb(0x61, originalbits);
}

//-----------------
void testbeep(unsigned char bcount, int inum)
{
_AH = bcount;
geninterrupt(inum);
}




































  3 Responses to “Category : C Source Code
Archive   : C-ALL.ZIP
Filename : TI641.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. 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/