accessing local static variables from asm

Other misc things
Post Reply
nippur72
Member
Posts: 29
Joined: Sat Sep 29, 2018 4:47 pm

accessing local static variables from asm

Post 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;
   __asm 
   ld a, (_z)      ; **** doesn't work
   __endasm;
}
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

For sccz80 they're mangled: _st_[FUNCNAME]_[VARIABLENAME] so in this case: _st_foo_z

zsdcc has different mangling rules.
Post Reply