gnupic: gpasm - how to get address of variable ?


Previous by date: 8 Sep 2012 17:03:09 -0000 Re: gpasm - how to get address of variable ?, Gál Zsolt
Next by date: 8 Sep 2012 17:03:09 -0000 Re: gpasm - how to get address of variable ?, Joe Pfeiffer
Previous in thread: 8 Sep 2012 17:03:09 -0000 Re: gpasm - how to get address of variable ?, Gál Zsolt
Next in thread: 8 Sep 2012 17:03:09 -0000 Re: gpasm - how to get address of variable ?, Joe Pfeiffer

Subject: Re: gpasm - how to get address of variable ?
From: Tamas Rudnai ####@####.####
Date: 8 Sep 2012 17:03:09 -0000
Message-Id: <CAJLb5+TtXAR0_CtdCtcCwqo3QGbEyw2KH9L-WpMQ1ruz+dX7bg@mail.gmail.com>

CBLOCK-s are *not* variables but (C)onstant (BLOCK)s ...

So you define constants that happen to be easily used as memory addresses
-- but you can use this for other things than this if you wish.

If you want to have real variable definitions and memory management, you
need to use relocative mode and linker scripts as opposed to absolute mode.

Tamas


On 7 September 2012 23:57, Borut Ražem ####@####.#### wrote:

> I was totally wrong: the cblock "variables" actually hold the address. I
> was wrongly thinking about cblocks as C structures...
>
> Obviously I have no idea how the assembler works :-[
>
> My apologies,
> Borut
>
>
> On 07. 09. 2012 10:15, Borut Ražem wrote:
>
>> Hi Vaclav,
>>
>> I don't think you can get the address of CBLOCK variable.
>> The alternative is to use EQUs instead of CBLOCK:
>>
>> var1            EQU        0x20
>> var_array    EQU        0x21
>>
>>                     movlw    var_array
>>                     movwf    FSR
>>
>> Borut
>>
>> On 07. 09. 2012 09:52, Vaclav Peroutka wrote:
>>
>>> Hello,
>>>
>>> I want to use FSR/INDF in assembler. I have defined
>>>
>>>      CBLOCK    0x20
>>>          var1:    1
>>>          var_array:    1
>>>      ENDC
>>>
>>> In the code, I want to use
>>>     movlw address_of_var_array
>>>     movwf FSR
>>>
>>> and then to write to var_array through INDF.
>>>
>>> How can I do that ? I did not find any expression in gputils manual.
>>>
>>> Thank you in advance,
>>> Vaclav
>>>
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>
>


-- 
int main() { char *a,*s,*q; printf(s="int main() { char *a,*s,*q;
printf(s=%s%s%s, q=%s%s%s%s,s,q,q,a=%s%s%s%s,q,q,q,a,a,q); }",
q="\"",s,q,q,a="\\",q,q,q,a,a,q); }

Previous by date: 8 Sep 2012 17:03:09 -0000 Re: gpasm - how to get address of variable ?, Gál Zsolt
Next by date: 8 Sep 2012 17:03:09 -0000 Re: gpasm - how to get address of variable ?, Joe Pfeiffer
Previous in thread: 8 Sep 2012 17:03:09 -0000 Re: gpasm - how to get address of variable ?, Gál Zsolt
Next in thread: 8 Sep 2012 17:03:09 -0000 Re: gpasm - how to get address of variable ?, Joe Pfeiffer


Powered by ezmlm-browse 0.20.