Jump to content
Sign in to follow this  
Asmotaku

Dereferencing

Recommended Posts

Well, some ANSI-C newbies could ask "what is dereferencing".

It concern the use of "&" preceding a var's symbol.

 

Then, using indirect addressing with FSR, it's common sense to think of :

 

:D

char myvariable[10];

char idx;

for(idx=0; idx<10; idx++)

{

  fsr = &myvariable  + idx;

  indf = something;

}

/* instead of  */

???

for(idx=0; idx<10; idx++)

{

  asm

  {

      bank     _myvariable ; risky while using .lib modules ;

      movf     _idx,W

      addlw    _myvariable

      movwf   FSR

      ;** assert STATUS's IRP bit **;

      movf     _something,W

      movwf   INDF;

}

 

As far as I'm concerned, I greatly prefer the first syntax and its 3 lines code !  :cool:

 

So, Mr Pavel Sir, how about dereferencing ?

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...