risto@tuura.UUCP (Risto Lankinen) (01/09/91)
Hi! There's a function GetWinFlags(), which tells the 'size' of the system's CPU to the calling program. I have made a program that calls this function in order to politely tell the user to go out and buy bigger computer, were the program run in an 8086/88 . What happens instead, is that the 8086/88 hangs up the moment that my program is run. The reason for this is known, and is that the arguments to the function MessageBox() (following the failed test after the GWF() ) are pushed using the 286 opcode 'PUSH <literal>' . The question is, how can I use the -G2 switch, but still be able to mark a portion of the program such, that it would be compiled to 8086/88 ? I would make the change right after those two calls. The 80286 code is so much more compact I wouldn't wish to sacrifice using it, but I also know that in a multi-tasking system, the user's irritation against one task is directly proportional to the cube of the number of simultaneously running other tasks, which it offends or kills. I guess I'd be happy with some sort of #pragma, but haven't found any that would solve this problem so far (I'm using MS-C 6.0). Terveisin: Risto Lankinen -- Risto Lankinen / product specialist *************************************** Nokia Data Systems, Technology Dept * 2 2 * THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME! Now working on 2 +1 * replies: risto@yj.data.nokia.fi ***************************************
rspangle@jarthur.Claremont.EDU (Froot Loop) (01/10/91)
In article <915@tuura.UUCP> risto@tuura.UUCP (Risto Lankinen) writes: >The question is, how can I use the -G2 switch, but still be able to mark >a portion of the program such, that it would be compiled to 8086/88 ? I can think of a few possibilities. 1) Have the FIRST thing your 80286-compiled program does call a routine in a separate module, which is compiled for 8086/88. That routine does all the checking for 8086/88, and returns false if an 8086/88 is present. The main routine exits in that case. You are probably ok doing this, as long as you don't pass any parameters to that routine. (since those would be pushed onto the stack) 2) Compile your main routine for 8086/88. But strip out all the code but the check for 8086, and put this code in functions that are in a module compiled for 80286. Admittedly, these are pretty kludgy. I'm not sure if there's a way to compile for two different chips in one module. -- -------------------------------------------------------------------------- | Randy Spangler | Get your mind out of the gutter | | rspangle@jarthur.claremont.edu | you're blocking my periscope | --------------------------------------------------------------------------
johnc@plxsun.uucp (John Ciccarelli) (01/10/91)
In article <915@tuura.UUCP> risto@tuura.UUCP (Risto Lankinen) writes: > >The question is, how can I use the -G2 switch, but still be able to mark >a portion of the program such, that it would be compiled to 8086/88 ? > >Terveisin: Risto Lankinen Simple. Just put the 8086-specific code in separate module(s), compiled with 286 code generation turned off. You must be sure that no 286 code will execute before you issue the message box and terminate the app, of course. John Ciccarelli Plexus Software, 5200 Great America Pkwy, Suite 200, Santa Clara CA 95054 email: ...sun!plx!johnc, voice: 408-982-4842, fax: 408-727-4864
gregj@microsoft.UUCP (Greg JONES) (01/11/91)
In article <10289@jarthur.Claremont.EDU>, rspangle@jarthur.Claremont.EDU (Froot Loop) writes: > In article <915@tuura.UUCP> risto@tuura.UUCP (Risto Lankinen) writes: > >The question is, how can I use the -G2 switch, but still be able to mark > >a portion of the program such, that it would be compiled to 8086/88 ? > > 2) Compile your main routine for 8086/88. But strip out all the > code but the check for 8086, and put this code in functions > that are in a module compiled for 80286. > > Admittedly, these are pretty kludgy. I'm not sure if there's a way to > compile for two different chips in one module. This isn't particularly kludgy. Just execute only 8086-compiled modules until you know you're running on a 286 (GetWinFlags will tell you what CPU you're running on). Putting the main routine (with the check) in a module compiled for 8086, and the meat of the program in other modules compiled with -G2, will work just fine. You don't need to strip out all the code but the check in order for it to work (most apps don't do tremendous amounts of work in their main routines anyway). uunet!microsoft!gregj Greg Jones, MS network development [I just happen to work here. Sheer coincidence.]
jerry@polygen.uucp (Jerry Sheckel) (01/15/91)
In article <915@tuura.UUCP> risto@tuura.UUCP (Risto Lankinen) writes: > >The question is, how can I use the -G2 switch, but still be able to mark >a portion of the program such, that it would be compiled to 8086/88? > Why not just put the code which may run in real mode [the start-up code and the call to GetWinFlags()] into a separate file, and compile only that file without the -G2 flag? -- +-------------------+----------------------+---------------------------------+ | JERRY J. SHEKHEL | POLYGEN CORPORATION | When I was young, I had to walk | | Drummers do it... | Waltham, MA USA | to school and back every day -- | | ... In rhythm! | (617) 890-2175 | 20 miles, uphill both ways. | +-------------------+----------------------+---------------------------------+ | ...! [ princeton mit-eddie bu sunne ] !polygen!jerry | | jerry@polygen.com | +----------------------------------------------------------------------------+