[fpc-pascal]Modifying cpu registers while in turbo pascal interrupt routine ?

Harald Houppermans houppermans at home.nl
Sat Mar 20 03:21:16 CET 2004


----- Original Message ----- 
From: "Nikolai Zhubr" <s001 at hotbox.ru>
To: <fpc-pascal at lists.freepascal.org>
Sent: Friday, March 19, 2004 10:59 PM
Subject: Re: [fpc-pascal]Modifying cpu registers while in turbo pascal
interrupt routine ?


> Hi,
> Friday, 19 March, 2004, 14:10:02, Klaus Hartnegg wrote:
> [...]
> > No, programs compiled with Turbo-Pascal 7 with the $G+ option will
> > use 32 bit registers for longint arithmetic if the program runs on a
> > 386 cpu or higher. They test the cpu-type on startup and store the
> Ok, I've found you are right essentially.
> To be precise though, $G+ have no effect on this, as
> TP7 compiler itself still generates pure 16-bit code.
> Math libraries are most probably hand-made and use
> 32-bit code for intermediate calculations, depending
> on test8086 variable value.
> So, when going to use "interrupt" directive one should
> do "test8086 := 1" before any interrupt ever happen.
> Nice to learn this.

Euhm this is a bit weird.

I read at some sites, set test 8086 to zero, some other sites say set 8086
to one.

The documention of TP says: zero is for 8086, one is for 80286, and two is
for 80386.

A 286 is in fact a 32 bit cpu... limited to 32 mb ram.

So it would be logical to assume setting it to one would still use 32 bit
instructions ? which is no good
since they can get interrupted... causing results to be corrupted.

Is that right or not ?

So setting it to zero is safest... but what effect does setting it to one
have ?!





More information about the fpc-pascal mailing list