Re: [cc65] ca65 - addressing .STRUCT

From: <silverdr1wfmh.org.pl>
Date: 2013-03-02 20:26:57
On 2013-03-02, at 19:49, Ullrich von Bassewitz wrote:

>> I have a table stored in a .STRUCT, where I want to access the first byte of
>> this table but don't want to reference the first member because the order of
>> the members is likely to change.
>> 
>> Can a .STRUCT base address somehow be used (I get undefined symbol error
>> when trying) without referencing members?
> 
> A struct is a type and doesn't have an address. You can place a struct
> somewhere in memory and access the memory location instead:
> 
>    .struct Coordinate
>        X   .word
>        Y   .word
>    .endstruct
> 
> Pos:    .tag    Coordinate
>        ...
>        lda     Pos
>        ldx     Pos+1

I see. Just this doesn't yield the sugar (to make code more readable) I was aiming at. Something like:

	ldx &Pos::X
	ldy &Pos::Y

but adds on complexity instead.

-- 
SD!----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Mar 2 20:27:08 2013

This archive was generated by hypermail 2.1.8 : 2013-03-02 20:27:12 CET