[fpc-pascal]Modifying cpu registers while in turbo pascal interrupt routine ?
Nikolai Zhubr
s001 at hotbox.ru
Fri Mar 19 00:07:36 CET 2004
Hi,
Thursday, 18 March, 2004, 18:26:04, Harald Houppermans wrote:
[...]
>> 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.
TP7 only uses 16-bit regs, for longints too, hence no need to
save/restore higher words.
>> and it doesn't provide a stack (so your programm will crash even it it
> doesn't
>> use longint).
Of course interrupt handler will have some stack, though it is
usually rather small (like all things in 16-bit world ;)
Built-in stack checking won't work properly though indeed.
> Euhm... why will it crash ?
> Let me gues... if I call other routines from inside the interrupt routine ?
No. If you re-enter non-reenterable code like DOS services,
say try to open some file without special care.
This is getting too much off-topic I guess...
--
Best regards,
Nikolai Zhubr
> 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
>>
> _______________________________________________
> 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