I did a variety of experiments and this is what I found.

The compiler puts automatic variables in registers if possible.

c is probably 4(ix).
I think in your example, d is assigned to the a register.

You might try this and see how it goes.

Douglas


char foo(unsigned char c)
{
        char e;
        e = c;
        e += 5;
        return e;
}

generates this...


;sample.c:1: char foo(unsigned char c)
;       ---------------------------------
; Function foo
; ---------------------------------
_foo_start::
_foo:
        push    ix
        ld      ix,#0
        add     ix,sp
;sample.c:4: e = c;
;sample.c:5: e += 5;
        ld      a, 4 (ix)
        add     a,#0x05
        ld      l,a
;sample.c:6: return e;
        pop     ix
        ret
_foo_end::
        .area _CODE
        .area _CABS













On Jun 25, 2011, at 12:49 PM, Egan Ford wrote:

> I have a function:
> 
> void foo(unsigned char c)
> {
>    char d;
> __asm
>    ld a,(_c)
> ...
> 
> How do I get the address for c and d?  _c works if global, but not local.
> 
> Thanks.
> 
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a 
> definitive record of customers, application performance, security 
> threats, fraudulent activity and more. Splunk takes this data and makes 
> sense of it. Business sense. IT sense. Common sense.. 
> http://p.sf.net/sfu/splunk-d2d-c1
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to