EW> that other processes may influence your program by putting values
EW> there. ;-)
GD> I don't understand why all screen output would be removed due to
GD> optimization. Can you explain, please?
The problem is related to compiler optimization. Take the following code,
for example:
#include
int main (void)
{
int _far *Screen_Pointer = (int _far *)MK_FP(0xB800, 0);
int Tmp;
for (Tmp = 0; Tmp < 2000; Tmp++) // 2000=Screen size (80x25)
*Screen_Pointer++ = ' ';
return 0;
}
This should clear the screen, right? On some compilers, with optimization
turned ON, it will do absolutely nothing. The compiler sees that you're
not doing anything with the data you've written, so it doesn't write it.
If, howver, you put "volatile" in there (changing the declaration to
int _far volation *Screen_Pointer, it will work.
Hope that helps!
DISCLAIMER: This code was writetn completely from scratch, is untested,
and will *definately* fail to work on systems with a
monochrome monitor!
Sincerely,
Anthony Tibbs
... Windows Ice Cream = Hoggin' DOS
___ Blue Wave/DOS v2.30 [NR]
--- Maximus 3.01
---------------
* Origin: World of Power BBS * Private * Ottawa, ON (1:163/215.38)
|