<?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: HCS12 Full Chip Simulation, STD writing 'uu' to memory instead of registers A:B value. Why? in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175636#M5678</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this context uu is undefined. I like this feture of CW simulatior very much.&lt;/P&gt;&lt;P&gt;STD 2,SP+ is not useful for real life applications. Almost every real life application uses interrupts. With interrupts enabled, what is below address pointed by SP is undefined since interrupt entry/exit will overwrite locations below SP.&lt;/P&gt;&lt;P&gt;Yes, you could use all&amp;nbsp;3 index&amp;nbsp;registers (X,Y and SP) to do some smart application intialization, while interrupts are not yet enabled, but this is exception where CW simulator makes bad job for you.&lt;/P&gt;&lt;P&gt;In your case, since size of array A1 and A2 is known and one array immediately follows another, you could use single index register to access both arrays like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; LDAB 1,X+&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ADDB A2-A1,X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; INX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you insist using SP and simulator,&amp;nbsp;you could iterate through array in reverse direction, from higher addresses towards lower addresses "pushing data to stack".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Oct 2011 04:08:33 GMT</pubDate>
    <dc:creator>kef</dc:creator>
    <dc:date>2011-10-21T04:08:33Z</dc:date>
    <item>
      <title>HCS12 Full Chip Simulation, STD writing 'uu' to memory instead of registers A:B value. Why?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175635#M5677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm writing a lab assignment for my class but cant figure out why this writes 'uu' instead of the register values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Registers have A = 00, B = 41 when stepping through.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'courier new,courier';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000; font-family: 'courier new,courier';"&gt;save:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000; font-family: 'courier new,courier';"&gt;&amp;nbsp;&amp;nbsp; STD 2,SP+ ; Store the value in the Result array, then increment&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I know uu means not initalized, but what does that mean??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Jairus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2011 00:39:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175635#M5677</guid>
      <dc:creator>frmdstryr</dc:creator>
      <dc:date>2011-10-21T00:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: HCS12 Full Chip Simulation, STD writing 'uu' to memory instead of registers A:B value. Why?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175636#M5678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this context uu is undefined. I like this feture of CW simulatior very much.&lt;/P&gt;&lt;P&gt;STD 2,SP+ is not useful for real life applications. Almost every real life application uses interrupts. With interrupts enabled, what is below address pointed by SP is undefined since interrupt entry/exit will overwrite locations below SP.&lt;/P&gt;&lt;P&gt;Yes, you could use all&amp;nbsp;3 index&amp;nbsp;registers (X,Y and SP) to do some smart application intialization, while interrupts are not yet enabled, but this is exception where CW simulator makes bad job for you.&lt;/P&gt;&lt;P&gt;In your case, since size of array A1 and A2 is known and one array immediately follows another, you could use single index register to access both arrays like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; LDAB 1,X+&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ADDB A2-A1,X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; INX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you insist using SP and simulator,&amp;nbsp;you could iterate through array in reverse direction, from higher addresses towards lower addresses "pushing data to stack".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2011 04:08:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175636#M5678</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2011-10-21T04:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: HCS12 Full Chip Simulation, STD writing 'uu' to memory instead of registers A:B value. Why?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175637#M5679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to iterate through two equal length arrays and add the corresponding elements and save the sums in another array (see the attached main.asm). This means I need 3 registers (or 2 registers and a word in memory) to keep track of where I'm currently at in each array.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the method you stated above for iterating through the two arrays, but I need a way to keep track of the resulting array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The assigment was a lab that we did prior to learning how to use the stack, so i'm not supposed to really be pushing an address into the stack.&amp;nbsp; In this situation, the stack would be the correct thing to use?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 06:12:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175637#M5679</guid>
      <dc:creator>frmdstryr</dc:creator>
      <dc:date>2011-10-24T06:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: HCS12 Full Chip Simulation, STD writing 'uu' to memory instead of registers A:B value. Why?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175638#M5680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI&gt;I'm trying to iterate through two equal length arrays and add the corresponding elements and save the sums in another array (see the attached main.asm). This means I need 3 registers (or 2 registers and a word in memory) to keep track of where I'm&amp;nbsp;currently at in each array.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Like I said, simulator treats locations below SP as undefined. This is very useful to detect problems in real life applications. On access to such uu variable, simulator can stop execution and tell you where your application reads undefined or uninitialized data. You have no such luxury debugging on real hardware.&amp;nbsp;Yes, you may use your code as is on real hardware. It should&amp;nbsp;work, provided interrupts are disabled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your app it's enough to have only 2 index registers. Like I said, since input arrays are of the same size, you need only 1 index regsiter to access elements of both arrays [i] and [i+sizeof(first array)]. Even if arrays are not close to each other, or A2 is allocated below A1, it should work.&lt;/P&gt;&lt;P&gt;You also couldd stop using additional memory for Count. Instead of determining array size, which is compile time constant in your case, you could check if index register reached end of array or not. See attached&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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>Mon, 24 Oct 2011 13:57:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175638#M5680</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2011-10-24T13:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: HCS12 Full Chip Simulation, STD writing 'uu' to memory instead of registers A:B value. Why?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175639#M5681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, I understand what you were saying now.&amp;nbsp; That's so much more efficient than what my teacher had shown our class!&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>Tue, 25 Oct 2011 01:34:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS12-Full-Chip-Simulation-STD-writing-uu-to-memory-instead-of/m-p/175639#M5681</guid>
      <dc:creator>frmdstryr</dc:creator>
      <dc:date>2011-10-25T01:34:14Z</dc:date>
    </item>
  </channel>
</rss>

