home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!cs.utexas.edu!bcm!cephalo.neusc.bcm.tmc.edu!tso
- From: tso@cephalo.neusc.bcm.tmc.edu (Dan Ts'o)
- Newsgroups: comp.os.msdos.programmer
- Subject: Divide by zero handling in MSC...
- Message-ID: <14585@gazette.bcm.tmc.edu>
- Date: 6 Sep 1992 23:48:23 GMT
- Sender: usenet@bcm.tmc.edu
- Distribution: comp
- Organization: Baylor College of Medicine, Houston,Tx
- Lines: 24
- Nntp-Posting-Host: cephalo.neusc.bcm.tmc.edu
-
-
- I have been working on an interactive language (YAIL ?) and using
- MSC 5.0, 6.0 as well as the Intel Code builder for C compilers. I want the
- language to properly handle divide-by-zero traps. I have used _dos_getvect
- and _dos_setvect to catch the traps and dispatch to routines, but I can't
- seem to arrange to clear the error. I know I could have the catch routine
- longjmp to a safe place, but I would rather have it set an error flag and
- clear the condition. The observed behavior is that it loops because the
- condition is never cleared and the divide is always restarted. I have tried
- setting the divisor to a non-zero number in the catch routine, but I must be
- doing something wrong. I thought that I could just set the AX register to
- one, but perhaps it is being saved prior to entering the catch routine.
- Other suggestions ? Please email. It would be nice to have a
- solution that could work both under MSC and the Intel compiler. Even better
- if it was all in C, without assembly code. Thanks.
-
-
- Cheers,
- Dan Ts'o 212-327-7671
- Dept. Neurobiology dan@rna.rockefeller.edu
- Rockefeller Univ. ...s5!rna!dan
- 1230 York Ave. tso@rockvax.bitnet
- NY, NY 10021
-
-