Mail Archives: djgpp/2000/01/13/22:27:18
From: | "Andrew Jones" <xluminous AT hotmail DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
References: | <387C95C6 DOT B2FA8951 AT bluewin DOT de>
|
Subject: | Re: Still problems with protected_mode_int
|
Lines: | 47
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.00.2314.1300
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300
|
Message-ID: | <Yylf4.28107$tT2.250319@quark.idirect.com>
|
Date: | Thu, 13 Jan 2000 14:46:16 GMT
|
NNTP-Posting-Host: | 216.154.11.224
|
X-Complaints-To: | abuse AT idirect DOT com
|
X-Trace: | quark.idirect.com 947774776 216.154.11.224 (Thu, 13 Jan 2000 09:46:16 EST)
|
NNTP-Posting-Date: | Thu, 13 Jan 2000 09:46:16 EST
|
Organization: | Internet Direct - http://www.mydirect.com
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
[snip]
> volatile int tics = 0;
>
> void timer_handler()
> {
> printf("Tics passed: %d\n",++tics);
> }
>
[snip]
Your problem is right there. Assuming DJGPP uses the DOS print to screen
function. Others have said it, I will try to explain it.
DOS maintains several internal data structures and other things. Due to the
nature of DOS, you cannot call a DOS function while another DOS function is
executing. Since your ISR is using (at the low level) a DOS function to
print to the screen, when the timer increments and the ISR is called again
it leaves the DOS function which you are still in, jumps to the ISR, and
jumps back to the beginning of the DOS print to screen function. This is a
big no-no. A better solution (probably not the best) is:
main()
{
int quit = 0, old_tic = 0;
...
while(!quit)
{
... (get keyboard, check if ESCAPE or something, set quit flag)
if(tics != old_tic)
{
printf("Tics passed: %d\n", ++tics);
old_tic = tics;
}
}
}
Or something as such. This is how I update the pattern data (more or less)
displayed on screen for an FM player I've got.
You could also use direct screen writes in your ISR, but I do not know how
to accomplish this under DJGPP (I use Watcom).
AndrewJ
- Raw text -