Page 1 of 1

accessing local static variables from asm

Posted: Sun Dec 16, 2018 10:42 am
by nippur72
How do I refer a local static variable from ASM? E.g. in the following code, how to access "z" ?

Code: Select all

void foo() {
   static unsigned char z;
   ld a, (_z)      ; **** doesn't work

Posted: Sun Dec 16, 2018 3:12 pm
by dom
For sccz80 they're mangled: _st_[FUNCNAME]_[VARIABLENAME] so in this case: _st_foo_z

zsdcc has different mangling rules.