Jump to content
Sign in to follow this  
Mac

CCSv4 assembly inside C, help?

Recommended Posts

Greetings Gentlemen,

 

I'm trying to access a C array from inline assembly. The array resides at 0200..0207h but when I attempt to copy the array address into the R9 register, it ends up with a 0201h value. What am I doin' wrong, please?

 

TIA, Mike

 

    unsigned char bam[] = { 1,2,3,4,        // special bam array
                           5,6,7,8 };      //

     while(1)                              //
     { 
       __asm(" push    R9           ");    // preserve R9     (3 cycles)
       __asm(" mov.w   &bam, R9     ");    // R9 = &bam[0]    (3 cycles)
       __asm(" mov.b   @R9+, &P1OUT ");    // P1OUT = @R9     (5 cycles)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

Sign in to follow this  

×
×
  • Create New...