home *** CD-ROM | disk | FTP | other *** search
-
-
- I have, on occasion, wondered how you would attach a Clipper function
- to the system clock for periodic evaluation ( Usually when I had an urgent
- need to do so). With the aid of a few books ( namely Undoccumented DOS and
- the DOS Programmer's Reference) and a friend of mine for help with the
- Assembly routines an attempt was made, the results of which is in your hands.
- I should point out that this routine was written by me in attempt to get
- aquainted with C interrupts and that there are other routines out there that
- may work for you with less hassel -- namely NetLib's N_SETTIME().
-
- Initially the ticker routine actually called the udf from within the
- int 8 handler. While this seemed to work on the surface, it was not a
- reliable solution. Although ticker prevents dos recursion by checking the
- dos safe flag, Clipper is itself NON RE-ENTRANT. This being the case there
- was no telling when my int 8 routine would hang the system because Clipper
- was in the middle of a non re-entrant routine ( such as __PLANKTON).
- Unfortunately Clipper doesn't to my knowledge have a ClipperSafe flag. The
- workaround to this was to find a way to get CLIPPER TO CALL THE UDF on a
- periodic basis for me. I accomplished this by setting up a hotkey to the udf
- and then, instead of calling the routine myself, stuffing the keyboard buffer
- the the hotkey's scan code from within the int 8 routine. The downshot of
- this approach is that it only works while the Clipper wait-state is active.
- The upshot is that it doesn't cause you system to barf. If your routine does
- not hit a wait-state periodicly -- you might consider using an inkey()
- replacement that is hotkey (wait-state) aware inside your code.
-
-
- ONTICK USAGE:
- -------------
- IT is EXTREMELY important that you remember to shutdown the ontick()
- routine BEFORE you terminate your application. If you don't you are
- guaranteed to force yourself into a re-boot situation. You might want
- to put an ontick() call in your error handler so that if you encounter
- any fatal runtime errors in your application you won't have to continualy
- re-boot your system.
-
- DO NOT OVERLAY onTickC.obj, onTickA.obj
-
-
- FILES YOU SHOULD HAVE:
- ----------------------
- You should have three programs -- ontick.prg, ontickc.c, and onticka.asm.
- and the object modules ontickc.obj and onticka.obj.
-
- ontick.prg:
- This is the clipper5 module which provides your interface to the
- system timer. It includes a simple test routine which you can exclude
- from compilation by removing the #define _TEST from the source.
-
- ontickC.C:
- C routines which modify the int 8 timer vector and handle the periodic
- servicing of your specified clipper function by way of the keyboard
- buffer.
-
- ontickA.Asm:
- Assembler replacements for the Microsoft _dos_setvector() and
- _dos_getvector() routines ( so we don't need LLIBCA to link) and a
- routine to get the address of the dos safe flag. The new routines are
- called _setvector(), _getvector(), and _getindosAddress().
-
-
- I want to thank all those people who helped me with this in one way or
- another- Namely Ted Means and John MacDonald.
-
- Please let me know what you think.
-
- Brenton Farmer
- CIS: 71621,627
-
-
-
-