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

Harald Houppermans houppermans at home.nl
Thu Mar 18 16:26:04 CET 2004


----- Original Message ----- 
From: "Klaus Hartnegg" <klaus at fischer.brain.uni-freiburg.de>
To: <fpc-pascal at lists.freepascal.org>
Sent: Thursday, March 18, 2004 9:02 AM
Subject: Re: [fpc-pascal]Modifying cpu registers while in turbo pascal
interrupt routine ?


> > Turbo pascal 7 has the 'interrupt' directive which can be placed behind
a
> > procedure name to turn it into a interrupt handler.
>
> forget it, it's a bug
> it doesn't save all registers (so your program will crash if it uses
longint)

Yes I read this somewhere else... It doesn't store the high word of the 32
bit registers like eax, ebx, etc.

So as long as I don't use longint's it should be ok.

> and it doesn't provide a stack (so your programm will crash even it it
doesn't
> use longint).

Euhm... why will it crash ?

Let me gues... if I call other routines from inside the interrupt routine ?

That seems logical... since call routines requires a stack to be present...
the push stuff on it etc and pop it back.

Euhm it's a little bit weird that it hasn't a stack... are you absolutely
sure about that ?

( Proving it would be best :D )

Anyway is that right ? calling other procedures/functions will make it crash
?

So as long as no other procedures and functions are called it should work...
or is there still another way to make it crash because it doesnt have a
stack ?

>
> > The problem is that these parameters are probably passed 'by value'. So
> > these are only copies.
>
> try trapint.pas from this page:
> http://www.brain.uni-freiburg.de/~klaus/pascal/sources/
>
> hope this helps,
> Klaus
> -- 
> Klaus Hartnegg, Brain Research Group, University Freiburg,
> Hansa-strasse 9a, D-79104 Freiburg, Germany, hartnegg at uni-freiburg.de
> Please avoid sending me Word attachments (use txt, rtf, or pdf).
> See http://www.fsf.org/philosophy/no-word-attachments.html
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>





More information about the fpc-pascal mailing list