🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #42870

Re: Need help writting Turbo C TSR

#42870
From: Bruce Corbett
Date: Thu, 22 Feb 1990 15:25
42 lines
1076 bytes
I'm *TRYING* to learn how to write a TSR in Turbo C.
A short program follows:



#include <stdio.h>
#include <dos.h>

void interrupt (*oldfunc)();
void interrupt myfunc();
int flag = 0;

main()
{

	oldfunc = getvect(0x1C);
	setvect(0x1C, myfunc);
	keep(0, 10000 / 16);
}

void interrupt myfunc()
{
	extern  int flag;

	(oldfunc)();
	if(flag == 0)
	{
		flag = 1;
		putchar('X');
		flag = 0;
	}
}

As it stands this code prints a $, then a prompt, then about 5 $'s on the
same line, then it hangs and I have to boot.  If the putchar() is removed
it will go resident and I see no ill effects.

Please send help/suggestions to me at:  att!nwgpb!n9bh or att!cbnewsc!n9bh

Thanks in advance,
Bruce Corbett
Technical Details
Message-ID: <13837@cbnewsc.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!att!cbnewsc!n9bh

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!att!cbnewsc!n9bh
From: n9bh@cbnewsc.ATT.COM (Bruce Corbett)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Need help writting Turbo C TSR
Message-ID: <13837@cbnewsc.ATT.COM>
Date: 22 Feb 90 15:25:30 GMT
Organization: AT&T Bell Laboratories
Lines: 42