From: Erik Berglund Newsgroups: comp.os.msdos.djgpp Subject: GPF with system() and clock int. Lines: 99 Message-ID: Date: Fri, 21 Jul 2000 16:15:33 GMT NNTP-Posting-Host: 194.237.158.30 X-Complaints-To: abuse AT telia DOT com X-Trace: newsb.telia.net 964196133 194.237.158.30 (Fri, 21 Jul 2000 18:15:33 CEST) NNTP-Posting-Date: Fri, 21 Jul 2000 18:15:33 CEST Organization: Telia Internet To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi, today I tried the program tu20.c, included below. It is part of my own IDE tool, much like Borland's Turbo Pascal. The problem is that the program almost works, but sometimes I get a GPF (see below). I have not the slightest idea why this is happening. Am I missing something in the coding? When the clock tick frequency is set to 16x, the error shows up more frequently (after 4-5 runs). Without the clock interrupt everything works fine, but I would like to use the clock interrupt for updating a counter on the screen, as something similar to "Line Number" in Turbo Pascal. Without the "system()" call everything runs OK, so it seems that it is the combination of "system()" and clock interrupts that doesn't work. As a work around solution, I have tried a 16-bit Turbo Pascal TSR program which updates the screen in background, and it seems to work. gcc version is 2.7.2.1, DJGPP is 2.01, OS is plain DOS 6.22, CSWDPMI version is r4, CPU is Pentium Pro 200 MHz, 128 Mb RAM. Thank you for any ideas, -- Erik Berglund erik2 DOT berglund AT telia DOT com -- Start of tu20.c -- #include #include #include #include #include #include #define textseg 0xb800 #define numch 7 int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY; static int int08flag; /* * int08 - Clock interrupt service routine. * If int08flag=1, update counter on screen. */ void int08() { static int cnt,i,j; static char st[numch]; if (!int08flag) cnt = 0; /* Idle */ else { /* Counting */ cnt = cnt + 1; i = cnt*56; for (j=0; j 0)) st[numch-j-1] = ' '; i = i / 10; } for (j=0; j