<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[ChipMusic.org - NES APU Fades]]></title>
	<link rel="self" href="https://chipmusic.org:80/forums/feed/atom/topic/23849/"/>
	<updated>2018-12-03T23:15:55Z</updated>
	<generator>PunBB</generator>
	<id>https://chipmusic.org/forums/topic/23849/nes-apu-fades/</id>
		<entry>
			<title type="html"><![CDATA[Re: NES APU Fades]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/260844/#p260844"/>
			<content type="html"><![CDATA[<p>You&#039;re exactly right though, that&#039;s what he needs to do :]<br />Look at this <a href="https://wiki.nesdev.com/w/index.php/NMI" target="_blank">link</a> and also <a href="https://wiki.nesdev.com/w/index.php/PPU_registers#PPUCTRL" target="_blank">this one</a>, you can just </p><div class="codebox"><pre><code>jsr wait_nmi</code></pre></div><p> before each lda / sta pair you do to get up and running, though it&#039;s a bit ugly. But hey, it&#039;s a start!<br />Each VBL wait is approx. 1/60 s.</p>]]></content>
			<author>
				<name><![CDATA[kvee]]></name>
				<uri>https://chipmusic.org/kvee</uri>
			</author>
			<updated>2018-12-03T23:15:55Z</updated>
			<id>https://chipmusic.org/forums/post/260844/#p260844</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES APU Fades]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/260576/#p260576"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>Orgia Mode wrote:</cite><blockquote><p>Ugh, interrupts are such a headache for me, but if anyone can help it is nitro. I will be keeping an eye on the progress of this.</p></blockquote></div><p>It&#039;s not me in this case. I haven&#039;t coded for the NES at all, so I can only give general advice. GB is my console. I&#039;d recommend asking for help in the <a href="https://forums.nesdev.com/" target="_blank">NESdev forums</a> or wait for one of the NES gurus to come around.</p>]]></content>
			<author>
				<name><![CDATA[nitro2k01]]></name>
				<uri>https://chipmusic.org/nitro2k01</uri>
			</author>
			<updated>2018-12-03T05:35:32Z</updated>
			<id>https://chipmusic.org/forums/post/260576/#p260576</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES APU Fades]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/260575/#p260575"/>
			<content type="html"><![CDATA[<p>Ugh, interrupts are such a headache for me, but if anyone can help it is nitro. I will be keeping an eye on the progress of this.</p>]]></content>
			<author>
				<name><![CDATA[Orgia Mode]]></name>
				<uri>https://chipmusic.org/Orgia+Mode</uri>
			</author>
			<updated>2018-12-03T05:01:28Z</updated>
			<id>https://chipmusic.org/forums/post/260575/#p260575</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES APU Fades]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/260574/#p260574"/>
			<content type="html"><![CDATA[<p>All the writes happen within microseconds of each other, and only the last (or should I say current) write is in effect. You would need to write a sequencer which writes a new value (for example) every frame in the NMI interrupt handler. So you would need to store a variable somewhere, and maybe a list of volume values in ROM that you would be reading one by one and writing to $4000.</p>]]></content>
			<author>
				<name><![CDATA[nitro2k01]]></name>
				<uri>https://chipmusic.org/nitro2k01</uri>
			</author>
			<updated>2018-12-03T04:19:22Z</updated>
			<id>https://chipmusic.org/forums/post/260574/#p260574</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[NES APU Fades]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/260571/#p260571"/>
			<content type="html"><![CDATA[<p>Hello Everyone! I&#039;m back with another NES sound related question.<br />Having scrapped getting sound from the NES via a .nsf file, I have been trying to hard-code some little ditties into the chip in assembly.<br />My current process is this: I am making separate sub-routines for each note/note length and then calling them in an order, to form a sort of song.<br />Right now, my code for the note D, with a fade out looks like this:</p><p>D3:<br />&nbsp; &nbsp; ;pitch D3<br />&nbsp; &nbsp; lda #%11111001<br />&nbsp; &nbsp; sta $4002<br />&nbsp; &nbsp; lda #%10000010<br />&nbsp; &nbsp; sta $4003</p><p>&nbsp; &nbsp; ;volume &amp; pulse width<br />&nbsp; &nbsp; ;fade out<br />&nbsp; &nbsp; ;F-D-B-9-7-5-3-2-1-0<br />&nbsp; &nbsp; lda #%00111111<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; lda #%00111101<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; lda #%00111011<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; lda #%00111001<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; lda #%00110111<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; lda #%00110101<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; lda #%00110011<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; lda #%00110010<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; lda #%00110001<br />&nbsp; &nbsp; sta $4000</p><p>&nbsp; &nbsp; RTS</p><p>and to an extent, this works! the NES generating a D3 pitch. HOWEVER: the fade is not working as expected. What I expect to happen is for the note to hold at maximum volume for a moment, before going down in volume. what happens in actuality, is that the APU only seems to be reading (from what i can hear) the last write to $4000, meaning that i have a steady tone at volume 1, rather than a tone that decreases in volume. If anyone can help me troubleshoot this, that would be very helpful.</p><p>Note: I understand that the length can be changed via the highest 5 bits written to $4003, but I still would like to experiment with this method and get it to work.</p>]]></content>
			<author>
				<name><![CDATA[venoSci]]></name>
				<uri>https://chipmusic.org/venoSci</uri>
			</author>
			<updated>2018-12-03T03:23:34Z</updated>
			<id>https://chipmusic.org/forums/post/260571/#p260571</id>
		</entry>
</feed>
