From 80b1683fa2ddb0b321cbf8699b386d0934fc5799 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Sun, 19 May 2024 19:14:01 +0200 Subject: [PATCH] Document member offset in inline assembler --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d4914bc..a98b786 100644 --- a/README.md +++ b/README.md @@ -775,7 +775,28 @@ A function return value can be provided in the zero page addresses ACCU (+0..+3) } } -Labels are defined with a colon after the name. Pure assembler functions can be defined outside of the scope of a function and accessed using their name inside of other assembler function. One can e.g. set up an interrupt +Struct member offsets can be generated with the Type::Member syntax: + + struct P + { + unsigned char np; + unsigned char ns; + + void test() + { + auto that = this; + + __asm { + lda #1 + ldy #P::ns + sta (that),y + } + } + }; + + +Labels are defined with a colon after the name. Pure assembler functions can be defined outside of the scope of a function and accessed using their name inside of other assembler function. One can e.g. set up an interrupt. + ### Interrupt routines