Technical Notes Database TN1215D.txt The $G+ directive, 286 code generation, and Real M Category :Pascal Platform :All Product :Turbo Pascal 1.0 Description: Question: If I use the $G+ 286 code generation directive, how can I be sure that Windows is running in Real mode? Answer: The 286 code generation option allows the compiler to substitute more efficient 286 instructions in place of normal 8088 instructions for things like loops, jumps and memory operations. If you compile your program with $G+, then you should call GetWinFlags early in the startup of your application - such as in your Application.Init. Check for the wf_PtMode flag set. If it's not set, then you're not running in protected mode, and you should display a message box and exit your program. Setting the Application's status variable to a non-zero value should also work, although that would cause more code to be executed, implying greater risk of hitting a 286 instruction. All the precompiled units in TPW will run in real mode and are not affected by the $G+ directive. The $G+ directive only affects code that you compile yourself. Reference: 7/16/98 4:35:42 PM
Last Modified: 01-SEP-99