Board index » delphi » HELP: FP Calculations clobbered by a pgm's local interrupt handler on PENTIUM, 486

HELP: FP Calculations clobbered by a pgm's local interrupt handler on PENTIUM, 486

I have a DOS PROTECTED mode program written in BORLAND PASCAL 7.0 running
under WINDOWS 3.1. The program does some floating point computations.  
These computations are periodically getting clobbered.

When it loads it re-directs the real-time clock interrupt to a local
interrupt handler which reads/writes data to an external data bus.  This
operation runs in "background".

The main loop of the program (running in "foreground") reads several A/D
channels, scales the values into engineering units, does some
computations using SIN, COS and ARCTAN2 and displays the values on
the screen for the user.

It appears that the computations are being clobbered by the interrupt
handler.  While a computation is in progress the main loop is interrupted
by the real-time clock interrupt handler.  When control is passed back to
the main loop the floating point computation is clobbered and corrupted.
 Arbitrary values are displayed.  All my attempts to prevent this have
failed.

Does anyone have any ideas how to prevent the FP from being interrupted?

Can the state of the FP be saved/restored using inline assembler
in PASCAL?

Do I have to move all the FP calculations to the interrupt handler?

Please send any reponses to: mcuccare#iplmaster.orl.lmco.com

Mark Cuccarese

_________________________________________________________________________

            Mark Cuccarese - mcucc...@iplmail.orl.lmco.com
_________________________________________________________________________

 

Re:HELP: FP Calculations clobbered by a pgm's local interrupt handler on PENTIUM, 486


In article <5f5p5u$...@zeus.orl.mmc.com>
           mcucc...@iplmaster.orl.mmc.com "Mark Cuccarese" writes:

Quote

> I have a DOS PROTECTED mode program written in BORLAND PASCAL 7.0 running
> under WINDOWS 3.1. The program does some floating point computations.  
> These computations are periodically getting clobbered.

This can only be as a result of a programming error.

Quote
> When it loads it re-directs the real-time clock interrupt to a local
> interrupt handler which reads/writes data to an external data bus.  This
> operation runs in "background".

Almost certainly the interrupt handler is doing something that involves
floating point numbers, and inheriting the stack mid calculation.

Quote
> It appears that the computations are being clobbered by the interrupt
> handler.  While a computation is in progress the main loop is interrupted
> by the real-time clock interrupt handler.  When control is passed back to
> the main loop the floating point computation is clobbered and corrupted.
>  Arbitrary values are displayed.  All my attempts to prevent this have
> failed.

You don't say whether it's emulator ot x87 hardware

Quote
> Does anyone have any ideas how to prevent the FP from being interrupted?

> Can the state of the FP be saved/restored using inline assembler
> in PASCAL?

Don't know for your dialect, but saving and restoring x87 status and
registers will fix the problem if you *must* use FP in the interrupt routine.

Quote
> Do I have to move all the FP calculations to the interrupt handler?

Put them all in one process and it will work too.
Or use a decent multi-tasking OS.

Quote
> Please send any reponses to: mcuccare#iplmaster.orl.lmco.com

                                      ^^^ unlikely to work!    

Regards,
--
Martin Brown  <mar...@nezumi.demon.co.uk>     __                CIS: 71651,470
Scientific Software Consultancy             /^,,)__/

Other Threads