<?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>S12 / MagniV MicrocontrollersのトピックRe: using array declared in &amp;quot;C&amp;quot; code in assembly for S12X</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/using-array-declared-in-quot-C-quot-code-in-assembly-for-S12X/m-p/164804#M5330</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Vicky,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It is certainly possible to grab the stack pointer content and store this in an Array via C.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I do something similar with the macro below:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;ASM_STORE_STACK_PTR(pu8_stack);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Where the macro is defined as:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#define ASM_STORE_STACK_PTR(p_stack)&amp;nbsp;&amp;nbsp; {__asm STS p_stack;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;you will need to check the S12 assembler manual, but there will be other assembler commands to grab the other registers.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Good luck!&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Jun 2008 16:49:04 GMT</pubDate>
    <dc:creator>EmbeddedCoder</dc:creator>
    <dc:date>2008-06-18T16:49:04Z</dc:date>
    <item>
      <title>using array declared in "C" code in assembly for S12X</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/using-array-declared-in-quot-C-quot-code-in-assembly-for-S12X/m-p/164803#M5329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Comic Sans MS'; font-size: 1;"&gt;Hi,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Comic Sans MS'; font-size: 1;"&gt;I have a requirement which is quite different which i never used earlier.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Comic Sans MS'; font-size: 1;"&gt;1. Declared a array&amp;nbsp;in a file, test1.c&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Comic Sans MS'; font-size: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned int Store[10]; //Assume unsigned int takes 2 bytes of data&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Comic Sans MS'; font-size: 1;"&gt;2. Now, I need to update store array with content of PC, SP, X, Y and other registers. //Assume, Store[] variable and copy logic would be in same file. I hope it should not be issue either&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Comic Sans MS'; font-size: 1;"&gt;Question:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Comic Sans MS'; font-size: 1;"&gt;1. Is it possible to perform step2 above?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Comic Sans MS'; font-size: 1;"&gt;2. If its possible, can I have a short example for same.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Comic Sans MS'; font-size: 1;"&gt;Regards&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Comic Sans MS'; font-size: 1;"&gt;Vicky&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2008 23:38:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/using-array-declared-in-quot-C-quot-code-in-assembly-for-S12X/m-p/164803#M5329</guid>
      <dc:creator>Vicky</dc:creator>
      <dc:date>2008-06-16T23:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: using array declared in "C" code in assembly for S12X</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/using-array-declared-in-quot-C-quot-code-in-assembly-for-S12X/m-p/164804#M5330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Vicky,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It is certainly possible to grab the stack pointer content and store this in an Array via C.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I do something similar with the macro below:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;ASM_STORE_STACK_PTR(pu8_stack);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Where the macro is defined as:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#define ASM_STORE_STACK_PTR(p_stack)&amp;nbsp;&amp;nbsp; {__asm STS p_stack;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;you will need to check the S12 assembler manual, but there will be other assembler commands to grab the other registers.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Good luck!&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 16:49:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/using-array-declared-in-quot-C-quot-code-in-assembly-for-S12X/m-p/164804#M5330</guid>
      <dc:creator>EmbeddedCoder</dc:creator>
      <dc:date>2008-06-18T16:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: using array declared in "C" code in assembly for S12X</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/using-array-declared-in-quot-C-quot-code-in-assembly-for-S12X/m-p/164805#M5331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I looked this up for you:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;STAA will store the&amp;nbsp;Acc A&amp;nbsp;Reg&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;STAB will store the Acc B Reg&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;STX will store the Index X Reg&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;STY will store the Index&amp;nbsp;Y Reg&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;so you can create other macros to store these values for you, as shown below:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#define ASM_STORE_ACC_A(p_acc_a)&amp;nbsp;&amp;nbsp; {__asm STAA p_acc_a;}&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;#define ASM_STORE_ACC_B(p_acc_b)&amp;nbsp;&amp;nbsp; {__asm STAB p_acc_b;}&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;#define ASM_STORE_IX_X(p_x)&amp;nbsp;&amp;nbsp; {__asm STX p_x;}&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;#define ASM_STORE_IX_Y(p_y)&amp;nbsp;&amp;nbsp; {__asm STY p_y;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm not sure what storing the program counter will do for you as it will be the address of the place where you store the values?&lt;/DIV&gt;&lt;DIV&gt;Do you mean you want to store the program counter contained on the stack (i.e. the calling function)?&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 17:00:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/using-array-declared-in-quot-C-quot-code-in-assembly-for-S12X/m-p/164805#M5331</guid>
      <dc:creator>EmbeddedCoder</dc:creator>
      <dc:date>2008-06-18T17:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: using array declared in "C" code in assembly for S12X</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/using-array-declared-in-quot-C-quot-code-in-assembly-for-S12X/m-p/164806#M5332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Id suggest you store it in a struct...&lt;/DIV&gt;&lt;DIV&gt;see here:&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;message.id=10109" target="test_blank"&gt;http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;message.id=10109&lt;/A&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 16:48:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/using-array-declared-in-quot-C-quot-code-in-assembly-for-S12X/m-p/164806#M5332</guid>
      <dc:creator>Xbot</dc:creator>
      <dc:date>2008-06-24T16:48:01Z</dc:date>
    </item>
  </channel>
</rss>

