<?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: mc9sdp512 ucontroller R/W CF card question</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219177#M9191</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had that thought while we talk back and forth. However I have no idea how you figure out reg x is pushed to sp+9. I check the chip spec and it says x will be pushed to sp-4 and sp-5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I got from spec:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 5-5. Stacking Order on Entry to Interrupts&lt;BR /&gt;Memory Location CPU Registers&lt;BR /&gt;SP PCL&lt;BR /&gt;SP–1 PCH&lt;BR /&gt;SP–2 IYL&lt;BR /&gt;SP–3 IYH&lt;BR /&gt;SP–4 IXL&lt;BR /&gt;SP–5 IXH&lt;BR /&gt;SP–6 ACCA&lt;BR /&gt;SP–7 ACCB&lt;BR /&gt;SP–8 CCR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you tell me how you get the mem location of SP+9 as where reg x is pushed? Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Aug 2010 02:54:07 GMT</pubDate>
    <dc:creator>Ebird</dc:creator>
    <dc:date>2010-08-20T02:54:07Z</dc:date>
    <item>
      <title>mc9sdp512 ucontroller R/W CF card question</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219169#M9183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am a newbie of mc9sdp512 ucontroller. I am digging a CF file issue for my company and I had a hard time to understand some legacy asm code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following is the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_gfOpen::&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;pshx&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;tfr&amp;nbsp;&amp;nbsp; &amp;nbsp;d,x&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;file name pointer is in accd&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;lda&amp;nbsp;&amp;nbsp; &amp;nbsp;5,sp&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;get drive num and operation type&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldb&amp;nbsp;&amp;nbsp; &amp;nbsp;#14&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; swi&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clra&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;pulx&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I don't understand is that after load 14 to accumulator b and call software interrupt. The file on CF card is open "magically". How it is opened I don't know. Here in the vector table, swi is defined as this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;word swiHndl&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;$fff6 SWI&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is swiHndl:&lt;/P&gt;&lt;P&gt;swiHndl:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tsx&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xgdx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;accd = sp of current stack&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jmp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jOS_call&amp;nbsp;&amp;nbsp; &amp;nbsp;;do OS_call&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And jOS_call:&lt;/P&gt;&lt;P&gt;jOS_call::&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;jmp&amp;nbsp;&amp;nbsp; &amp;nbsp;0&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;operating system call&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone can hlep me figure how the file on the CF card is opened?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 22:51:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219169#M9183</guid>
      <dc:creator>Ebird</dc:creator>
      <dc:date>2010-08-19T22:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: mc9sdp512 ucontroller R/W CF card question</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219170#M9184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hm, jmp 0? Either it is a jump to what&amp;nbsp;contents of PORTAB register points to, or maybe some resorces remapping is done using INITRM,&amp;nbsp;INITEE, INITRG registers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 23:18:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219170#M9184</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-08-19T23:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: mc9sdp512 ucontroller R/W CF card question</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219171#M9185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kef,&lt;/P&gt;&lt;P&gt;Thanks for the reply. The snippet in my question is a combination of asm code I grabbed from different place to make them make sense. However I just don't understand what makes them meanningful. I found one more cacro def in one of header file like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.macro fileOpen&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldab&amp;nbsp; #_FLASH_OPEN&amp;nbsp;&amp;nbsp; &amp;nbsp;;file open function call&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;swi&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;result code/filenumber in accb, x:y = file size&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.endmacro&lt;BR /&gt;&lt;BR /&gt;swi is the same as what I posted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still does not make sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 23:24:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219171#M9185</guid>
      <dc:creator>Ebird</dc:creator>
      <dc:date>2010-08-19T23:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: mc9sdp512 ucontroller R/W CF card question</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219172#M9186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think OS routine is expected at address 0. It seems OS function number is passed to OS routine&amp;nbsp;in register B. This makes sense.&lt;/P&gt;&lt;P&gt;Do you wonder how pointer to file name is passed to OS routine? Yes, I also don't see how it is done. Pointer to file name seems to be passed to _gfOpen in reg D,&amp;nbsp;then it is transferred to reg X and finally SWI call is made. But swiHndl overwrites reg X with SP, so I don't know how _gfOpen is passing file name to OS routine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Aug 2010 00:13:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219172#M9186</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-08-20T00:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: mc9sdp512 ucontroller R/W CF card question</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219173#M9187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The file name is in reg x. At the beginning of gfOpen, pshx save it in memory and then tfr d, x will copy it to d. Eventually, when the file is opened, the size of the opened file is in y. What I don't understand is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ldb&amp;nbsp;&amp;nbsp; &amp;nbsp;#_FLASH_OPEN ( _FLASH_OPEN = 14)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;why put a int 14 to b before swi? and how software int can do file operation like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And about address 0, is it address of register PORTA? I got this line from the Freescale spec 9SDP256BDGV2:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0&lt;BR /&gt;$0000 PORTA&lt;BR /&gt;Read:&lt;BR /&gt;Bit 7 6 5 4 3 2 1 Bit 0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Aug 2010 00:53:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219173#M9187</guid>
      <dc:creator>Ebird</dc:creator>
      <dc:date>2010-08-20T00:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: mc9sdp512 ucontroller R/W CF card question</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219174#M9188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class="lia"&gt;&lt;UL&gt;&lt;LI&gt;The file name is in reg x. At the beginning of gfOpen, pshx save it in memory and then tfr d, x will copy it to d. Eventually, when the file is opened, the size of the opened file is in y. What I don't understand is this:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oh yes, swi handler can access file name pointer pushed previously to the&amp;nbsp;stack.&amp;nbsp; It is transferred from d to x, but later x is destroyed doing tsx.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ldb&amp;nbsp;&amp;nbsp; &amp;nbsp;#_FLASH_OPEN ( _FLASH_OPEN = 14)&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;why put a int 14 to b before swi? and how software int can do file operation like this?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why not? SWI doesn't change any CPU register. What you load to any CPU register before SWI, everything will be passed to SWI handler.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;And about address 0, is it address of register PORTA? I got this line from the Freescale spec 9SDP256BDGV2:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Yes, but&amp;nbsp;S12D allows register,&amp;nbsp;EEPROM and RAM remapping. So your legacy code could move registers block away from 0 and map here RAM or EEPROM with some code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Aug 2010 01:26:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219174#M9188</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-08-20T01:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: mc9sdp512 ucontroller R/W CF card question</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219175#M9189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Based on your reply, I understand this is what happened:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;swi actually does the magic to open file, and the integer #_FLASH_OPEN is passed to swi to ask it to open file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The bits in reg x: I have no clue how the file name can survive after tsx&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Aug 2010 01:45:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219175#M9189</guid>
      <dc:creator>Ebird</dc:creator>
      <dc:date>2010-08-20T01:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: mc9sdp512 ucontroller R/W CF card question</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219176#M9190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;File name pointer in X doesn't survive, but it is pushed to the stack before SWI. So inside SWI handler (and in routine at 0) file name pointer is available on the stack at SP+9.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Aug 2010 02:24:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219176#M9190</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-08-20T02:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: mc9sdp512 ucontroller R/W CF card question</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219177#M9191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had that thought while we talk back and forth. However I have no idea how you figure out reg x is pushed to sp+9. I check the chip spec and it says x will be pushed to sp-4 and sp-5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I got from spec:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 5-5. Stacking Order on Entry to Interrupts&lt;BR /&gt;Memory Location CPU Registers&lt;BR /&gt;SP PCL&lt;BR /&gt;SP–1 PCH&lt;BR /&gt;SP–2 IYL&lt;BR /&gt;SP–3 IYH&lt;BR /&gt;SP–4 IXL&lt;BR /&gt;SP–5 IXH&lt;BR /&gt;SP–6 ACCA&lt;BR /&gt;SP–7 ACCB&lt;BR /&gt;SP–8 CCR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you tell me how you get the mem location of SP+9 as where reg x is pushed? Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Aug 2010 02:54:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219177#M9191</guid>
      <dc:creator>Ebird</dc:creator>
      <dc:date>2010-08-20T02:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: mc9sdp512 ucontroller R/W CF card question</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219178#M9192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh, my mistake.&amp;nbsp;Comment in gfOpen states that file name pointer is in D, and I thought it was in X and pushed to the stack. And contents of X, that was pshx'ed in gfOpen is available in the SWI handler at SP+9.&amp;nbsp; Your list of stacked registers&amp;nbsp;confirms that. 2bytes X + 2 bytes Y + A + B + CCR + 2 bytes PC = 9 bytes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Aug 2010 03:09:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/mc9sdp512-ucontroller-R-W-CF-card-question/m-p/219178#M9192</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-08-20T03:09:00Z</dc:date>
    </item>
  </channel>
</rss>

