TP procedures preserve registers ?

In article <31727AE8.4...@cip.mathematik.uni-stuttgart.de>,

Quote
Christian Froeschlin <froes...@cip.mathematik.uni-stuttgart.de> writes:

|> Hi,
|>
|> I am calling a Turbo Pascal procedure from an assembler routine and
|> was wondering about which registers can I expect to be preserved, if
|> any ? Is it different for procedures with the interrupt directive ?

When you call a built-in TP procedure, only CS, DS, SS, SP, and BP are
preserved.  I'm not sure about ES because I often modify it and forgot how
TP manages it inside its routines.  The general purpose regs (AX, BX, CX, DX as
well as SI and DI) are not guaranteed to be preserved.

Inside an interrupt routine, all the regs are preserved.

|> Also I have noted the following : in an interrupt routine, I used
|> the @ operator to get a pointer to a record, which works fine.
|> Using the addr function, the system crashed. What is the difference ?

I haven't been using addr for quite a while.  My guess is that you may have a
different DS than your own when you called it.  If you include the interrupt
directive, TP sets up DS for you.  If not, you have to set it up yourself to make
sure that you're really pointing to your own data segment.

YO!
Erwin

--
Erwin D. Paguio
http://rh.iist.unu.edu/~ep/ydeeps.htm
Pascal and ASM Enthusiast