<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Assembly problem  with indirect X instructions in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218441#M8656</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you are looking at lots of test code trying to figure out what I am getting these errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and a union to union assignment is just fine - - - -&amp;nbsp; As A = B&lt;/P&gt;&lt;P&gt;note the actual code is simply a block transfer.&amp;nbsp;&amp;nbsp; If assigning an int or something to a union it needs to know&lt;/P&gt;&lt;P&gt;what it is it is being assigned to - - - -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Jul 2011 03:58:31 GMT</pubDate>
    <dc:creator>Jim_P</dc:creator>
    <dc:date>2011-07-01T03:58:31Z</dc:date>
    <item>
      <title>Assembly problem  with indirect X instructions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218438#M8653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;I am having to do a bit of Assembly coding - - for some 64 bit math - - simple add and subtract.&lt;/P&gt;&lt;P&gt;as I have started coding this I checked what I was doing and getting a series of error messages.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;windows 7 64 bit CW10.1 HS08JM project&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is inside of a function&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;union DLong Add64( union DLong A, union DLong B )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static union DLong a, b, C;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static byte D,E,F;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; byte I;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I = 7;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = A;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b = B;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; asm&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; LDA D;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ADD E;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; STA F;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; LDX #7&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; LDA&amp;nbsp; D,x;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ADD E, x;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; STA F, X;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ............. more to be added&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ( C );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;error message occurs on the lines that I am trying to index using the X register.&lt;/P&gt;&lt;P&gt;i.e. LDA opcode16,X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the error message on the indexed opcodes of&lt;/P&gt;&lt;P&gt;C18123 End of Line expected&lt;/P&gt;&lt;P&gt;for each of the index X assembly codes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used inline assembly before without problems - - first time using indexed addressing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks Jim P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2011 02:31:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218438#M8653</guid>
      <dc:creator>Jim_P</dc:creator>
      <dc:date>2011-06-30T02:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Assembly problem  with indirect X instructions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218439#M8654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello JP,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While it may not be the cause of your error messages, your inline code does not appear to make sense unless the variables D, E, and F are declared as arrays of at least eight elements.&amp;nbsp; You cannot assume a particular order in which the&amp;nbsp;static variables are linked to memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that there may also be a problem with the assignments a = A; and b = B; since these are unions, and you do not specify a particular element of the union.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2011 10:19:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218439#M8654</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2011-06-30T10:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Assembly problem  with indirect X instructions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218440#M8655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Jim,&amp;nbsp;I think you need to&amp;nbsp;use address operator @ here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LDA&amp;nbsp; @D,x;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADD @E, x;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STA @F, X;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2011 11:53:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218440#M8655</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2011-06-30T11:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Assembly problem  with indirect X instructions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218441#M8656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you are looking at lots of test code trying to figure out what I am getting these errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and a union to union assignment is just fine - - - -&amp;nbsp; As A = B&lt;/P&gt;&lt;P&gt;note the actual code is simply a block transfer.&amp;nbsp;&amp;nbsp; If assigning an int or something to a union it needs to know&lt;/P&gt;&lt;P&gt;what it is it is being assigned to - - - -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2011 03:58:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218441#M8656</guid>
      <dc:creator>Jim_P</dc:creator>
      <dc:date>2011-07-01T03:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Assembly problem  with indirect X instructions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218442#M8657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks that makes sense - - - - nothing else seemed to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I figured out a work around - - - I assigned the variables to a fixed address and then hard coded that address&lt;/P&gt;&lt;P&gt;worked but now what I would call ideal or right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the use of the @ seems to be the key, I did try the &amp;amp; and that did not work.&lt;/P&gt;&lt;P&gt;think that part of my problem is that the variable is on the stack - - when passed. So no fixed address.&lt;/P&gt;&lt;P&gt;even making the variables static did not seem to help as that should have created a fixed address for the variables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2011 04:01:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218442#M8657</guid>
      <dc:creator>Jim_P</dc:creator>
      <dc:date>2011-07-01T04:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Assembly problem  with indirect X instructions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218443#M8658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello JP,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the attached code probably does not do what you require, it does demonstrate a method of setting up a stack frame for arithmetic operations, and makes use of inline assembly code.&amp;nbsp; Maybe you will be able to extract some ideas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2011 16:35:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218443#M8658</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2011-07-01T16:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Assembly problem  with indirect X instructions</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218444#M8659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - I will keep the code for reference and use if the need arrives&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2011 08:14:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Assembly-problem-with-indirect-X-instructions/m-p/218444#M8659</guid>
      <dc:creator>Jim_P</dc:creator>
      <dc:date>2011-07-06T08:14:19Z</dc:date>
    </item>
  </channel>
</rss>

