<?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: In-line assembly in Codewarrior for 8 bit v6.2 in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175907#M5701</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VarC is declared in direct page area. In map file, its location is 0x87.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But still error comes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is #pragma push and #pragma pop necessary in definition?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what they do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rakesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Apr 2009 04:52:29 GMT</pubDate>
    <dc:creator>RakeshParekh</dc:creator>
    <dc:date>2009-04-28T04:52:29Z</dc:date>
    <item>
      <title>In-line assembly in Codewarrior for 8 bit v6.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175905#M5699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am developing code using MC9S08QD2 and codewarrior v6.2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For certain critical operations, I want my generated code to be optimized in size and execution speed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are there ready to use intrinsic functions defined in codewarrior to use assembly instructions like ROR - rotate right through carry, SEC - set carry, CLC - clear carry etc?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I do not find these intrinsic function, I tried to put down macro definition for these purpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However it does not compile.&lt;/P&gt;&lt;P&gt;For ex.&lt;BR /&gt;unsigned char VarC;&lt;BR /&gt;#defined RotateRight(x) {__asm ROR x;}&lt;/P&gt;&lt;P&gt;void main (void)&lt;BR /&gt;{&lt;BR /&gt;:&lt;BR /&gt;:&lt;BR /&gt;RotateRight(VarC);&lt;BR /&gt;:&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;I get compiler error messages C18700 and C18701.&lt;/P&gt;&lt;P&gt;How to resolve it?&lt;/P&gt;&lt;P&gt;Same error messages go away if I first transfer operand to accumulator and work on accumulator.&lt;/P&gt;&lt;P&gt;Why so?&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Kindly advice asap.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Thanks and regards,&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Rakesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2009 11:55:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175905#M5699</guid>
      <dc:creator>RakeshParekh</dc:creator>
      <dc:date>2009-04-26T11:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: In-line assembly in Codewarrior for 8 bit v6.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175906#M5700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The ROR instruction does only support DIR (meaning 8 bit addresses) and not EXT (meaning 16 bit addresses). Therefore either allocate VarC in a __DIRECT_SEG area (and tell the compiler), load, rotate in a register, rotate the register and store it back to VarC or load the address of VarC into H:X and use "ROR ,X".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm guessing that placing the variable into a __DIRECT_SEG segment is the best way to go as this is an optimization task.&lt;/P&gt;&lt;P&gt;E.g.&lt;/P&gt;&lt;PRE&gt;
#pragma push#pragma DATA_SEG __SHORT_SEG MY_NEAR_DATA_SEG  // must be mapped in the prmunsigned char VarC;#pragma pop&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&amp;nbsp;&lt;BR /&gt;&lt;P&gt;Check the ROR access details in the HCS08 reference manual and &lt;A href="http://www.freescale.com/files/microcontrollers/doc/app_note/AN2093.pdf%20" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank"&gt;AN2093.pdf&lt;/A&gt; also contains samples using the direct page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:24:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175906#M5700</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2020-10-29T09:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: In-line assembly in Codewarrior for 8 bit v6.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175907#M5701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VarC is declared in direct page area. In map file, its location is 0x87.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But still error comes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is #pragma push and #pragma pop necessary in definition?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what they do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rakesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2009 04:52:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175907#M5701</guid>
      <dc:creator>RakeshParekh</dc:creator>
      <dc:date>2009-04-28T04:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: In-line assembly in Codewarrior for 8 bit v6.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175908#M5702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pls. ignore Solved Tag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It was by mistake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is not solved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rakesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2009 04:53:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175908#M5702</guid>
      <dc:creator>RakeshParekh</dc:creator>
      <dc:date>2009-04-28T04:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: In-line assembly in Codewarrior for 8 bit v6.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175909#M5703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; VarC is declared in direct page area. In map file, its location is 0x87.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is is declared in a section with a __SHORT_SEG qualifier? The compiler does not read map files &lt;IMG alt="Smiley Wink" class="emoticon emoticon-smileywink" id="smileywink" src="https://community.nxp.com/i/smilies/16x16_smiley-wink.png" title="Smiley Wink" /&gt;.&lt;/P&gt;&lt;P&gt;It's the other way round, if the variable is placed in a&amp;nbsp; __SHORT_SEG section and that section is placed in the prm file into the first 256 bytes, then the map file will show an address &amp;lt; 256.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here a simplistic snippet which works for me:&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;PRE&gt;
#pragma DATA_SEG __SHORT_SEG MY_ZEROPAGEunsigned char VarC;#define RotateRight(x) {__asm ROR x;}void main (void){  RotateRight(VarC);}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also note the manuals in the help and help\pdf folders.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:24:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/In-line-assembly-in-Codewarrior-for-8-bit-v6-2/m-p/175909#M5703</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2020-10-29T09:24:39Z</dc:date>
    </item>
  </channel>
</rss>

