Re: [cc65] externzp decls

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2000-01-29 23:15:12


> I added an "externzp" extension to do this.  This is probably not the
> best way to do it --- there should be something more general.  Say
> "extern __zeropage__ v;" or even "__zeropage__ v;" to _request_ that
> a new variable be put into some zeropage segment.

There is already a #pragma to do exactly this. This is the reason why there
is a SC_ZEROPAGE flag and all the code to create correct .importzp
instructions for the assembler.

The #pragma solution is somewhat cleaner since it does not pollute the
namespace and is ignored by other compilers so it is more portable. However,
even the #pragma solution is a hack in my eyes, and as a consequence, it is
not documented in section 7 of cc65.txt, which describes the #pragmas. Maybe
this decision was wrong, since it forced you to spend time and labour in
search for another solution. I hope this is not too disappointing.

I'm still thinking about a better solution that solves all the placement
problems at once. The compiler should be able to place variables in the
zeropage segment (this is the reason why the assembler creates a zeropage
segment by default), and import/export zeropage variables. A complete
solution will probably use modifiers similiar to those that you proposed.
Until such a solution exists, please use

	#pragma zpsym ("foo");

to make a zero page symbol from a previously declared symbol.

Regards


	Uz


--
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:35 CET