Jump to content
Sign in to follow this  
jartim

How to access function parameter in assembly?

Recommended Posts

Hi, 

Does anyone have any insight into how to access a function parameter from in-line assembler?

I am doing the following -

void type24Var::add(const unsigned long src)
{
    asm
    {
        movf _src, W
    }
}

But this will not compile and I get the message -

failure
type24Var.cpp(68:2): error: error in built-in assembly
make[2]: [build/default/production/type24Var.o] Error 1 (ignored)

It's driving me crazy, nothing I do seems to clear the error!

 

Share this post


Link to post
Share on other sites

You access function argument correctly. Must be something else that causes the problem. Have you included system.h? If W is undefined you'll get same error (to check replace W with 0)

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum 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  

×