home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / msdos / programm / 9108 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  1.6 KB

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