heintze@grane.enet.dec.com (Siegfried Heintze) (09/06/90)
Hurray, hurray - I have, after many late nights and much tribulation, found the problem: ZORTECH's sleep function (V2.1 or later, V2.0x seems fine) causes hangs or calls to exit(0) when INT 0x33 FUNC 2 or INT 0x10 FUNC 9 is called from the routine whose address is passed INT 0x33 FUNC 0x0c. I want to thank everyone for their efforts to make helpful suggestions. I had been using the standard sleep routine provided with most C compilers to give me a chance to generate a few mouse interrupts to see if my routines were working. My programs would always hang or call exit for no apparent reason. Programs that worked in ZORTECH V2.06 no longer worked in V2.14 and I could not figure out why. (To make things worse, there was another bug with ZORTECH's flash graphics routines (V2.14 - v2.06 seems fine) where they would not recognize my STB (brand) VGA adapter board). When I single stepped thru my routines with ZORTECH's debugger they would just hang when I got to the MSDOS INT 0x33 FUNC 2 (hide the mouse) consequently I thought this is where the problem was. The fact that I can perform INT 0x10 FUNC 9 and VGA reads and writes leads me to believe that it is possible to do many useful things from INT 0x33 FUNC 0x0c as long as you are careful to synchronize access to VGA memory, calls to malloc, and DISK I/O. I do this by incrementing a counter and ignoring the mouse interrupt if one of these critical path operations are in progress (as indicated by a non-zero value for the counter). I plan to implement a more elegant solution of saving mouse interrupts in a queue later. This current method serves my present need. Sieg P. S. When I insert the following code at the beginning of my test program, it works! #include <dos.h> #ifdef __ZTC__ // I believe this is already defined for MSC short peekw(offset, seg) { int x; peek(seg, offset, &x, 2); return x; }; #endif // From page 292 of Joe Campbell's book, // The C Programmer's Guide to Serial Communication: #define TIMER_LO 0x46C void delay(unsigned tsecs) { unsigned tickref; for(; tsecs > 0; --tsecs) { tickref = peekw(TIMER_LO, 0); while(tickref == peekw(TIMER_LO, 0)); } } #define sleep(t) delay((t)*20)
bright@Data-IO.COM (Walter Bright) (09/08/90)
In article <15188@shlump.nac.dec.com> heintze@grane.enet.dec.com (Siegfried Heintze) writes:
< Hurray, hurray - I have, after many late nights and much tribulation,
< found the problem: ZORTECH's sleep function (V2.1 or later, V2.0x seems
< fine) causes hangs or calls to exit(0) when INT 0x33 FUNC 2 or INT 0x10 FUNC
< 9 is called from the routine whose address is passed INT 0x33 FUNC 0x0c.
Zortech's sleep function is implemented as a simple loop that calls the
DOS get time of day function in a tight loop until the specified time
has elapsed. Unfortunately, DOS and the BIOS are not reentrant, so
calling DOS or the BIOS while in sleep could cause a crash.