[A83] Re: program pointers [83]


[Prev][Next][Index][Thread]

[A83] Re: program pointers [83]




[Joe Pemberton wrote]
> [Henk Poley wrote]
> >I need to know the end of the program (that's running). If I'm right I
> >can find this by reading the first pointer to a file from the VAT:
> >
> >	ld	hl,(PROGPTR - 2)	;HL = end_of_program
> >
> >Am I right? Or can there be other variables (like reals, GDBs, pictures,
> >etc.) directly after the executing program? If so, how should I
> >get a pointer to the end of my program?
> >
> >And NO, it can't be done via a simple "end_of_program:" at the end of
> >my assembly file. Because I'm using a different assembler (one with a
> >linker)and files get linked after the main routine).
> >
> >	Henk Poley
> 
>
> if you're gonna do it the hard way, couldn't you just do a
> bcall(_chkfindsym) with your programs name in op1 and get a pointer to
> the data?  The first two bytes of your program are it's size. so all you
> would have to do is take that and add $9d95 to get it's offset when it is
> running.
> btw why aren't you using TASM? 

Uhm, I'm going to make a malloc() routine (Ti-83) for the z88dk
(a C compiler). That compiler uses Z80ASM as assembler:

1. Because it can make relocatable files, which (can) get linked via the
(built-in) linker. C without a linker can be done (see ti8xcc) but isn't
quite 'standard'. And I can't force the people who make it to use another
assembler (without a linker)...  ;)

2. Z80ASM is open source, in contrary to TASM, which is closed source and
has only been released for DOS (for a 80286 or higher, I think).

The z88dk runs under:
-- *nix (unix, Linux, solaris, etc),
-- DOS (MS DOS, Dr. DOS, OpenDOS, FreeDOS, etc),
-- Windows (all versions, as long you can run a DOS program within it) and
-- Amiga.
On all types of processors, as long a you can find a C compiler for that,
and you are running one of the operating systems I mentioned above. (on
that
system...)

Why would you do a slow call to _chkfindsym if you have a pointer (to the
end of your program) at a fixed point in memory?
(At least, I hope it's there...)

Another thing: I should store the name of my program inside my program, in
order to be able to use _chkfindsym... (would need a compiler-hack)

But can anyone tell me if I'm right?

	Henk Poley




Follow-Ups: