mirror of
https://github.com/cc65/cc65.git
synced 2024-12-24 11:31:31 +00:00
Document using inline asm with SoA, structs with array members
This commit is contained in:
parent
9299e550a5
commit
c2f3421dee
@ -1448,10 +1448,16 @@ Or, to access a struct member of a static variable:
|
||||
unsigned char x;
|
||||
unsigned char y;
|
||||
unsigned char color;
|
||||
unsigned char aux[32];
|
||||
} pixel_t;
|
||||
static pixel_t pixel;
|
||||
__asm__ ("ldy #%b", offsetof(pixel_t, color));
|
||||
__asm__ ("lda %v,y", pixel);
|
||||
|
||||
/* or to access an array member */
|
||||
static unsigned char i;
|
||||
__asm__ ("ldy %v", i);
|
||||
__asm__ ("lda %v+%b,y", pixel, offsetof(pixel_t, aux));
|
||||
</verb></tscreen>
|
||||
<p>
|
||||
The next example shows how to use global variables to exchange data between C
|
||||
|
Loading…
Reference in New Issue
Block a user