[comp.sys.atari.st] variables in executable

bjoern@drdhh.hanse.de (Bjoern Kriews) (11/19/90)

Hi Andrew !

(I wasn't able to get mail to you)

Just as Claus said: 
Get your basepage pointer (_base in Laser / _BasPag in TC), determine the
offset from your text segment to your data segment (preinitialized 
variables), add the size of a tos program header (28 bytes) and the 
offset of the variable you want to save (rel. to data seg) and you
get the offset into the executable file.

You should declare such variables always global and preinitialized,
otherwise they are allocated on the stack or in bss.
Take a symbolic debugger and look at your compiler output to find
the locations.

Be aware of compilers that initialize at runtime (old Megamax did, don't
now about Laser, Turbo doesn't).

Hope that helps,
	Bjoern

P.S: 
If you have further problems -> contact me but please keep short,
I have to pay for INCOMING mail.

---
bjoern@drdhh.hanse.de = Bjoern Kriews / Stormsweg 6 / 2000 Hamburg 76 / FRG
In other words, compilers are free to warn about anything they like
 (`foo.c, line 354: warning: code written at 4 AM').	[Chris Torek]