sota@fluke.UUCP (Bruce White) (10/09/85)
<> Does anyone know why memory resident programs such as Sidekick won't come up when the following program, compiled with Microsoft C (3.0), is being run? main () { char string[80]; while (1) { puts("Enter a <CR> terminated line\n"); gets(string); } } Sidekick is loaded, the above program is executed, and then Ctrl-ALT is pressed to invoke Sidekick. The computer emits 5 slow beeps, and then continues. A similar version of the program, (using fgets(string,80,stdin)), compiled with C86 did the same thing. Any ideas? -- Bruce T. White John Fluke Mfg. Co., Inc. {uw-beaver,decvax!microsof,ucbvax!lbl-csam,allegra,ssc-vax}!fluke!sota
broehl@watdcsu.UUCP (Bernie Roehl) (10/11/85)
In article <962@vax2.fluke.UUCP> sota@fluke.UUCP (Bruce White) writes: >... >Sidekick is loaded, the above program is executed, and then Ctrl-ALT is pressed >to invoke Sidekick. The computer emits 5 slow beeps, and then continues. A >similar version of the program, (using fgets(string,80,stdin)), compiled with >C86 did the same thing. > >Any ideas? > Sidekick beeps like that if you try to invoke it while a DOS function call is being executed. The reason is simple; DOS (at least up to 3.1) is not designed to be re-entrant. If Sidekick were to try and read its notepad, help file, appointment calendar, etc, it would wind up calling DOS and possibly using the same routine that was already running as result of the DOS call. This would cause massive screwups in the stack and any global data areas. In most C libraries for the PC, stdin and stdout (as used by gets and puts) go through DOS (as they should) to get characters; your program is clearly i/o bound, and spends most of its life sitting in gets(). Sidekick therefore complains.
peter@graffiti.UUCP (Peter da Silva) (10/13/85)
> Does anyone know why memory resident programs such as Sidekick won't come up > when the following program, compiled with Microsoft C (3.0), is being run? > > ... > > Sidekick is loaded, the above program is executed, and then Ctrl-ALT is pressed > to invoke Sidekick. The computer emits 5 slow beeps, and then continues. A > similar version of the program, (using fgets(string,80,stdin)), compiled with > C86 did the same thing. Sidekick won't run when MS-DOS is currently executing, to avoid re-entrancy problems. The BIOS is re-entrant, but MS-DOS isn't. gets and fgets both must use MS-DOS call #whatever-it-is to read a line of text, instead of doing it character-at-a-time in the BIOS as other programs do. You can get the same result by invoking Sidekick at certain times in COMMAND.COM. Workaround #1: After hitting CTRL-ALT, hit return. This will kick the program out of MS-DOS and let Sidekick get in. This will, of course, send a blank line to the program so I hope it can deal with that. Workaround #2: Write your own gets() function, using getch(), and do all the erase and kill processing yourself Workaround #3: Get CED.COM, which among other things replaces this particular MS-DOS call with its own version. It seems to be sufficiently re-entrant to avoid worrying SideKick (or maybe SK just doesn't recognise it as part of DOS).
slerner@sesame.UUCP (Simcha-Yitzchak Lerner) (10/13/85)
> > <> > > Does anyone know why memory resident programs such as Sidekick won't come up > when the following program, compiled with Microsoft C (3.0), is being run? > > main () { > char string[80]; > while (1) { > puts("Enter a <CR> terminated line\n"); > gets(string); > } > } > > Sidekick is loaded, the above program is executed, and then Ctrl-ALT is pressed > to invoke Sidekick. The computer emits 5 slow beeps, and then continues. A > similar version of the program, (using fgets(string,80,stdin)), compiled with > C86 did the same thing. > > Any ideas? > -- > Bruce T. White > John Fluke Mfg. Co., Inc. > {uw-beaver,decvax!microsof,ucbvax!lbl-csam,allegra,ssc-vax}!fluke!sota I would *guess* that what is going on has to do with the fact that many memory resident programs will not activate themselves when a DOS call is active. (They will retry several times, beep (sometimes) and give up). I suspect that a DOS call to get a char (and wait for it if not available) is being used by the above routine, and Sidekick sees that a DOS call is active, and not wanting to crash the system (DOS is not reentrant), beeps and gives up. If you can code useing functions that get a char. only if available, you should have a chance to get Sidekick to load. -- Opinions expressed are public domain, and do not belong to Lotus Development Corp. ---------------------------------------------------------------- Simcha-Yitzchak Lerner {genrad|ihnp4|ima}!wjh12!talcott!sesame!slerner {cbosgd|harvard}!talcott!sesame!slerner talcott!sesame!slerner@harvard.ARPA
slerner@sesame.UUCP (Simcha-Yitzchak Lerner) (10/16/85)
>.... > Sidekick won't run when MS-DOS is currently executing, to avoid re-entrancy > problems. The BIOS is re-entrant, but MS-DOS isn't. Sorry, but many BIOS calls are NOT reentrant. Try executing a char fetch in the middle of another char fetch. Do it with the right timing and you can cause merry fun with the buffer pointers. >.... > Workaround #3: Get CED.COM, which among other things replaces this particular > MS-DOS call with its own version. It seems to be sufficiently re-entrant to > avoid worrying SideKick (or maybe SK just doesn't recognise it as part of DOS). I suspect that some methods of detecting DOS being active will indicate when a replacement to dos is running. Luck of the draw here. -- Opinions expressed are public domain, and do not belong to Lotus Development Corp. ---------------------------------------------------------------- Simcha-Yitzchak Lerner {genrad|ihnp4|ima}!wjh12!talcott!sesame!slerner {cbosgd|harvard}!talcott!sesame!slerner talcott!sesame!slerner@harvard.ARPA
edg@micropro.UUCP (Ed Greenberg) (10/18/85)
In article <298@graffiti.UUCP> peter@graffiti.UUCP (Peter da Silva) writes: >Sidekick won't run when MS-DOS is currently executing, to avoid re-entrancy >problems. The BIOS is re-entrant, but MS-DOS isn't. gets and fgets both must >use MS-DOS call #whatever-it-is to read a line of text, instead of doing it >character-at-a-time in the BIOS as other programs do. You can get the same >result by invoking Sidekick at certain times in COMMAND.COM. >... >Workaround #2: Write your own gets() function, using getch(), and do all the >erase and kill processing yourself Or try this... Sit in a loop until a character becomes available, THEN call fgets (or whatever) to get the string. When a Sidekick hit happens, you're not in DOS. If you are filling out the command line, and you try to bring up SK, you will still get the five beeps, but that's much more appropriate than getting them at the beginning of the line. -e -- Ed Greenberg; MicroPro International Corp. (disclaimer) UUCP: {hplabs,dual,glacier,lll-crg}!well!micropro!edg AT&T: 415-499-4096