Jump to content

Inline Assembly - Addlw With C Variable Names


Recommended Posts

With BoostC inline assembly, using the name of a variable with the movlw instruction loads its address, e.g.

 

unsigned char array[4];

 

asm

{

movlw _array

movwf _fsr

}

 

I would expect the same behavior for addlw, so that it would be possible to efficiently index into the array, e.g.

 

asm

{

movlw 0x02

addlw _array

movwf _fsr

}

 

However this gives an "error in built-in assembly" on the addlw line.

 

(I know that in this simple case, one could swap the movlw and addlw instructions and get the same effect while avoiding the problem, but there are situations where this is not the case, e.g. when you already have the array index in the W register from a previous calculation).

 

Is there some syntax trick to get around this error, or is it a bug / missing feature?

 

Regards,

Ken

Link to post
Share on other sites

kenh,

I assume it should be fairly trivial to implement this. Obviously it should apply for all instructions with literal arguments.

In principle its a simple change, but its under consideration with other related issues.

 

Regards

Dave

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...
×
×
  • Create New...