<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[ChipMusic.org - Sequencing Music (NES ASM)]]></title>
	<link rel="self" href="https://chipmusic.org:80/forums/feed/atom/topic/23850/"/>
	<updated>2018-12-03T11:32:54Z</updated>
	<generator>PunBB</generator>
	<id>https://chipmusic.org/forums/topic/23850/sequencing-music-nes-asm/</id>
		<entry>
			<title type="html"><![CDATA[Re: Sequencing Music (NES ASM)]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/260579/#p260579"/>
			<content type="html"><![CDATA[<p>Update: Solution found, please ignore.</p>]]></content>
			<author>
				<name><![CDATA[venoSci]]></name>
				<uri>https://chipmusic.org/venoSci</uri>
			</author>
			<updated>2018-12-03T11:32:54Z</updated>
			<id>https://chipmusic.org/forums/post/260579/#p260579</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Sequencing Music (NES ASM)]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/260577/#p260577"/>
			<content type="html"><![CDATA[<p>Hey All, me again!</p><p>So, in my last post I was trying to achieve a fade effect manually, but i found that simply changing bits 5 and 6 on the value written to $4000 would do that just fine for my needs AND I can modify the length using the highest 5 bits written to register $4003. Awesome.<br />Now my issue seems to be an inability to trigger a sequence of more than one note.<br />I know that once the counter reaches 0 on the note length, the flag for the note length at register $4015 will set to 0. <br />My code looks like this:</p><p>&nbsp; &nbsp; .inesprg 1<br />&nbsp; &nbsp; .ineschr 0<br />&nbsp; &nbsp; .inesmap 1<br />&nbsp; &nbsp; .inesmir 0</p><p>&nbsp; &nbsp; .bank 1<br />&nbsp; &nbsp; .org $FFFA<br />&nbsp; &nbsp; .dw 0 ;vbank<br />&nbsp; &nbsp; .dw Main<br />&nbsp; &nbsp; .dw 0</p><p>&nbsp; &nbsp; .bank 0<br />&nbsp; &nbsp; .org $C000<br />&nbsp; &nbsp; </p><p>Main:<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; ;period/frequ and also set length<br />One:<br />&nbsp; &nbsp; JSR D3</p><p>&nbsp; &nbsp; ldx $4015<br />&nbsp; &nbsp; cpx #%00000000<br />&nbsp; &nbsp; beq Two</p><br /><p>Infiniteloop<br />&nbsp; &nbsp; jmp Infiniteloop</p><p>Two:<br />&nbsp; &nbsp; JSR D4</p><p>&nbsp; &nbsp; jmp Infiniteloop</p><br /><p>D3:<br />&nbsp; &nbsp; ;D3, eighth note<br />&nbsp; &nbsp; lda #%00000001<br />&nbsp; &nbsp; sta $4015<br />&nbsp; &nbsp; lda #%10011111<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; lda #%11111001<br />&nbsp; &nbsp; sta $4002<br />&nbsp; &nbsp; lda #%01001010<br />&nbsp; &nbsp; sta $4003<br />&nbsp; &nbsp; </p><br /><p>&nbsp; &nbsp; RTS</p><br /><p>D4:<br />&nbsp; &nbsp; lda #%00000001<br />&nbsp; &nbsp; sta $4015<br />&nbsp; &nbsp; lda #%10011111<br />&nbsp; &nbsp; sta $4000<br />&nbsp; &nbsp; lda #%01111100<br />&nbsp; &nbsp; sta $4002<br />&nbsp; &nbsp; lda #%01001001<br />&nbsp; &nbsp; sta $4003</p><br /><br /><p>&nbsp; &nbsp; RTS</p><p>In my head, the code should.<br />1. From main, jump to my subroutine D3, where I<br />&nbsp; &nbsp; a. enable PU1 by writing 1 to the first bit of register $4015<br />&nbsp; &nbsp; b. write the duty cycle/volume/period/length data to registers $4000, $4002, and $4003<br />&nbsp; &nbsp; c. return to main<br />2. Load the value stored at $4015 to the x register<br />3. test the value against a correct zero-d out $4015, meaning that the timer on PU1 had counted to zero<br />4. Jump to D4, where i would do the same process as in step one.</p><p>On paper, i feel like my code checks out, but clearly i am missing something here, so if anyone could help me (again) that would be extremely cool.<br />Thanks!</p>]]></content>
			<author>
				<name><![CDATA[venoSci]]></name>
				<uri>https://chipmusic.org/venoSci</uri>
			</author>
			<updated>2018-12-03T08:53:47Z</updated>
			<id>https://chipmusic.org/forums/post/260577/#p260577</id>
		</entry>
</feed>
