<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[ChipMusic.org - Assembly/Differences in .NSF Files]]></title>
		<link>https://chipmusic.org/forums/topic/23812/assemblydifferences-in-nsf-files/</link>
		<description><![CDATA[The most recent posts in Assembly/Differences in .NSF Files.]]></description>
		<lastBuildDate>Thu, 08 Nov 2018 05:25:50 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Assembly/Differences in .NSF Files]]></title>
			<link>https://chipmusic.org/forums/post/260419/#p260419</link>
			<description><![CDATA[<b><i>kvee says:</i></b><div class="quotebox"><cite>venoSci wrote:</cite><blockquote><p>looks like i will need to do some bank switching since bytes $75-$77 are non-zero values</p></blockquote></div><p>You might need to use this then: <a href="https://wiki.nesdev.com/w/index.php/INES_Mapper_031" target="_blank">https://wiki.nesdev.com/w/index.php/INES_Mapper_031</a><br /></p><div class="quotebox"><cite>venoSci wrote:</cite><blockquote><p>I appreciate all the help, and I will use this information in order to (hopefully) get something working in the near future.</p><p>Thanks!</p></blockquote></div><p>No problem! :]<br />Let me know how everytinhg turns out!</p>]]></description>
			<pubDate>Thu, 08 Nov 2018 05:25:50 +0000</pubDate>
			<guid>https://chipmusic.org/forums/post/260419/#p260419</guid>
		</item>
		<item>
			<title><![CDATA[Re: Assembly/Differences in .NSF Files]]></title>
			<link>https://chipmusic.org/forums/post/260417/#p260417</link>
			<description><![CDATA[<b><i>venoSci says:</i></b><div class="quotebox"><cite>kvee wrote:</cite><blockquote><p>Don&#039;t worry about $70-$77, just check it&#039;s all zeroes (that means no bankswitching). If it&#039;s not all zeroes however, you&#039;re not gonna be able to use the simple playback method from the nerdtracker example.</p></blockquote></div><p>Thank you for all the info! It looks like i will need to do some bank switching since bytes $75-$77 are non-zero values (thanks deflemask). I appreciate all the help, and I will use this information in order to (hopefully) get something working in the near future.</p><p>Thanks!</p>]]></description>
			<pubDate>Thu, 08 Nov 2018 02:01:38 +0000</pubDate>
			<guid>https://chipmusic.org/forums/post/260417/#p260417</guid>
		</item>
		<item>
			<title><![CDATA[Re: Assembly/Differences in .NSF Files]]></title>
			<link>https://chipmusic.org/forums/post/260416/#p260416</link>
			<description><![CDATA[<b><i>kvee says:</i></b><div class="quotebox"><cite>venoSci wrote:</cite><blockquote><p>how do I determine that the load address is not $8000? Do I simply look for where the bulk of the hex data (song data) is? In my case, the largest chunk of the data IS located at address $8080 (with $8000 being the beginning of the file)</p></blockquote></div><p>Oh, don&#039;t confuse the offsets inside the file (where the song data always starts at byte $80) with the memory layout of the NES. It&#039;s possible Deflemask actually does this (have load=$8080), but I don&#039;t use it so I&#039;m not sure.<br />Your data would be located at $8080 if and only if bytes 8 and 9 of the .NSF header are $80. <br />Also, don&#039;t include the first 128 bytes from the .NSF, that&#039;s the header. It&#039;s metadata and it doesn&#039;t belong in the final .NES file.</p><p><em>(Ok, side note here: if the load address is indeed $8080, you could load the entire .nsf file at $8000 and the song data would in fact then be at $8080, because it would be shifted by the size of the header data, so some programs might even do that on purpose, but it&#039;s ugly and somewhat confusing! Just read the addresses from the header and then throw the header away. I know, it might take a bit of wrapping your head around all this)</em></p><p>Here&#039;s a quick and dirty diagram:<br /><a class="postimg" href="https://i.imgur.com/o4tT3xe.png" title="https://i.imgur.com/o4tT3xe.png" id="forum_image_74775291"><img src="https://i.imgur.com/o4tT3xe.png" /></a><br />(I&#039;ve made a test .nsf that is shown there, but the principle is always the same)</p><p>Don&#039;t worry about $70-$77, just check it&#039;s all zeroes (that means no bankswitching). If it&#039;s not all zeroes however, you&#039;re not gonna be able to use the simple playback method from the nerdtracker example.</p><p>Oh, and you can also ask in the <a href="http://forums.nesdev.com/" target="_blank">nesdev forums</a>, or in the <a href="http://discord.gg/5x6vdSK" target="_blank">famitracker.org discord</a> (while this discord server is mainly for famitracker users, there are definitely people who know NES programming and might be willing to help, in the <strong>#development</strong> channel!).</p>]]></description>
			<pubDate>Thu, 08 Nov 2018 01:02:08 +0000</pubDate>
			<guid>https://chipmusic.org/forums/post/260416/#p260416</guid>
		</item>
		<item>
			<title><![CDATA[Re: Assembly/Differences in .NSF Files]]></title>
			<link>https://chipmusic.org/forums/post/260415/#p260415</link>
			<description><![CDATA[<b><i>venoSci says:</i></b><div class="quotebox"><cite>kvee wrote:</cite><blockquote><p>NSF files can (and do!) have different load/init/play addresses. Take a look here: <a href="https://wiki.nesdev.com/w/index.php/NSF" target="_blank">https://wiki.nesdev.com/w/index.php/NSF</a>.<br />Download a hex editor if you don&#039;t have one, it&#039;s invaluable for quickly looking inside .NSFs (I use XVI32 personally). Definitely check you&#039;re not playing a bankswitched NSF, that&#039;s way more complicated that this example you&#039;ve posted can handle (to the point of requiring custom hardware).</p><p>For non-bankswitched NSFs, this should work. If the load address is not $8000, change the </p><div class="codebox"><pre><code>.org $8000</code></pre></div><p> before </p><div class="codebox"><pre><code>.incbin</code></pre></div><p>Also modify the <strong>init</strong> and <strong>play</strong> constants and you should be set!<br />(I dunno why the code defines the load address and then just hardcodes it, oh well)</p><p>Good luck! :]<br />EDIT: Don&#039;t forget to strip the header from the .NSF before including it!</p></blockquote></div><p>Hey, thank you for the information, but i still have a few questions (I am very new to this). First, how do I determine that the load address is not $8000? Do I simply look for where the bulk of the hex data (song data) is? In my case, the largest chunk of the data IS located at address $8080 (with $8000 being the beginning of the file). In a similar fashion, i am unsure how to modify the init and play registers accordingly. </p><p>I tried to manually copy the data stored at $070-$077 into the registers denoted by the table on the NESDEV wiki but other than turning my emulator screen white (?), there was no change in audio playback. </p><p>Any more pointers would be very helpful, thank you.</p>]]></description>
			<pubDate>Wed, 07 Nov 2018 23:30:22 +0000</pubDate>
			<guid>https://chipmusic.org/forums/post/260415/#p260415</guid>
		</item>
		<item>
			<title><![CDATA[Re: Assembly/Differences in .NSF Files]]></title>
			<link>https://chipmusic.org/forums/post/260411/#p260411</link>
			<description><![CDATA[<b><i>nitro2k01 says:</i></b><p>NES is not the platform I program for, but I can still speculate a little.</p><p>When you&#039;re saying no audio playback, do you mean completely silent, or no PCM samples?</p><p>For NMIs to be triggered, you need to set bit 7 in PPU1 (register $2000). The example code does this for you. However the reference document <a href="http://problemkaputt.de/everynes.htm#ppureset" target="_blank">Everynes</a> suggests that writes to this register during the first frame after reset are ignored. Maybe you need to wait 1-2 frames, or wait for VBlank, after the call to init, but before the write to $2000.</p><p>RAM contains random data at power-on. Maybe Deflemask expects RAM to be cleared before calling init, but Nerdtracker&#039;s init initializes all the RAM it&#039;s using so that&#039;s why it works. </p><p>Might be obvious, but check whether Deflemask&#039;s manual has an example player routine.</p><p>Try running your silent ROM in a debugger like no$nes and see if you can figure it out by single-stepping the ROM to figure out what it does.</p><p>Check whether the file that&#039;s exported is NSF or NSFe or NSF2 and check with documentation whether that might matter. (I leave that work to you. <img src="https://chipmusic.org/forums/img/smilies/wink.png" width="15" height="15" alt="wink" /> )</p><p>Useful links:<br /><a href="http://problemkaputt.de/nes.htm" target="_blank">http://problemkaputt.de/nes.htm</a><br /><a href="https://wiki.nesdev.com/w/index.php/NSF" target="_blank">https://wiki.nesdev.com/w/index.php/NSF</a></p>]]></description>
			<pubDate>Wed, 07 Nov 2018 02:13:42 +0000</pubDate>
			<guid>https://chipmusic.org/forums/post/260411/#p260411</guid>
		</item>
		<item>
			<title><![CDATA[Re: Assembly/Differences in .NSF Files]]></title>
			<link>https://chipmusic.org/forums/post/260410/#p260410</link>
			<description><![CDATA[<b><i>kvee says:</i></b><p>Oh, and to answer your question, each tracker has its own driver code. The <a href="http://famitracker.com/downloads.php" target="_blank">FamiTracker NSF driver</a> is even open source, so you can take a peek if you&#039;re curious. Games typically include drivers at the source level, NSF was meant more as a format to rip game music to originally.</p>]]></description>
			<pubDate>Wed, 07 Nov 2018 02:10:35 +0000</pubDate>
			<guid>https://chipmusic.org/forums/post/260410/#p260410</guid>
		</item>
		<item>
			<title><![CDATA[Re: Assembly/Differences in .NSF Files]]></title>
			<link>https://chipmusic.org/forums/post/260409/#p260409</link>
			<description><![CDATA[<b><i>kvee says:</i></b><p>NSF files can (and do!) have different load/init/play addresses. Take a look here: <a href="https://wiki.nesdev.com/w/index.php/NSF" target="_blank">https://wiki.nesdev.com/w/index.php/NSF</a>.<br />Download a hex editor if you don&#039;t have one, it&#039;s invaluable for quickly looking inside .NSFs (I use XVI32 personally). Definitely check you&#039;re not playing a bankswitched NSF, that&#039;s way more complicated that this example you&#039;ve posted can handle (to the point of requiring custom hardware).</p><p>For non-bankswitched NSFs, this should work. If the load address is not $8000, change the </p><div class="codebox"><pre><code>.org $8000</code></pre></div><p> before </p><div class="codebox"><pre><code>.incbin</code></pre></div><p>Also modify the <strong>init</strong> and <strong>play</strong> constants and you should be set!<br />(I dunno why the code defines the load address and then just hardcodes it, oh well)</p><p>Good luck! :]<br />EDIT: Don&#039;t forget to strip the header from the .NSF before including it!</p>]]></description>
			<pubDate>Wed, 07 Nov 2018 02:01:59 +0000</pubDate>
			<guid>https://chipmusic.org/forums/post/260409/#p260409</guid>
		</item>
		<item>
			<title><![CDATA[Assembly/Differences in .NSF Files]]></title>
			<link>https://chipmusic.org/forums/post/260408/#p260408</link>
			<description><![CDATA[<b><i>venoSci says:</i></b><p>Hey Everyone!</p><p>For my Senior Independent Project in college, I have decided to try my hand at writing code for the NES in 6502 Assembly. Having graphic rendering more or less handled, i am now moving on to audio playback. I found some code for nerdtracker .nsf playback here: </p><p><a href="https://wiki.nesdev.com/w/index.php/Nerdtracker_player_in_NESASM" target="_blank">https://wiki.nesdev.com/w/index.php/Ner &#133; _in_NESASM</a></p><p>I assumed it would work with all .nsf files.&nbsp; However, after exporting my .nsf from deflemask and running the code, I was able to create a NES rom but without any audio playback. Is there a difference in .nsf files generated by different pieces of software? Am I missing something? Any help on this issue would be very helpful. </p><p>Thanks!</p>]]></description>
			<pubDate>Wed, 07 Nov 2018 01:37:35 +0000</pubDate>
			<guid>https://chipmusic.org/forums/post/260408/#p260408</guid>
		</item>
	</channel>
</rss>
