Jump to content

Wrong Opcode Generated

Recommended Posts

Bug description:

The wrong opcode is being generated. (no errors are being reported)


#include "<system.h>"

typedef unsigned char uint8;

//define an inline function so multiple asm can be used within macros:
inline void ADDLW(uint8& value)
asm addlw _value; //generates a movlw instead of addlw

void main(void)
uint8 var @0x300 + 12; //kludge: create var with desired value as its address so it can be passed by reference to inline function

ADDLW(var); //should generate "addlw 12", but generates "movlw 12" instead


Expected behavior:

The example code above should generate "addlw 12", not "movlw 12".


Is the problem 100% reproduceable:






Compiler version:



Target device:PIC16F1827, '1823, '688, etc.



Windows XP



Link to post
Share on other sites
  • 2 weeks later...

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.

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.

  • Create New...