From c2f3421deeede90f53ea18dcb399c3d645c5edf9 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Tue, 14 May 2019 18:15:27 +0300 Subject: [PATCH] Document using inline asm with SoA, structs with array members --- doc/cc65.sgml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/cc65.sgml b/doc/cc65.sgml index 11b112f6f..24634ea3f 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -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));

The next example shows how to use global variables to exchange data between C