Skip to content

How to address structure offset intentions correctly #321

Answered by RPGHacker
hellow554 asked this question in Q&A
Discussion options

You must be logged in to vote

An offsetof() does sound like a reasonable addition to Asar (though I'm not sure how easy it is to add - don't remember how exactly struct labels are stored in Asar).

For the time being, I'd propose a workaround similar to this:

PlayerData = $8000
struct Player_t
  .x: skip 1
  .y: skip 1
endstruct

LDX.W #PlayerData ; base address of an struct array
LDA.W Player_t.y, X ; use the second byte of that struct

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@hellow554
Comment options

@hellow554
Comment options

@RPGHacker
Comment options

Answer selected by hellow554
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants