Jump to content
Sign in to follow this  
MarkL

Struct Member Access With Inline Assembler

Recommended Posts

It would be very useful to be able to address individual struct members with the inline assember.

This is especially useful in combination with macro's (e.g. MAKESHORT)

 

Here is a (fictive) example of how it could work:

struct point {

short x;

short y;

}

struct point pnt;

 

.

.

MAKESHORT(pnt.y, lobyte, hibyte);

.

.

 

There are several workarounds to the above but they all compromise the optimization or maintainability.

Share this post


Link to post
Share on other sites

Can you not just use a pointer to pnt.y and then use the pointer variable with MAKESHORT()?

Share this post


Link to post
Share on other sites
It would be very useful to be able to address individual struct members with the inline assember...

 

You can do it with current compiler. Just use offset when reference struct variable. For example to set pt.y to 0xA5 use code like:

 

asm movlw 0xA5
asm movwf _pt+2

 

Regards,

Pavel

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...