Skip navigation
2636 Views 6 Replies Latest reply: Apr 1, 2009 2:35 PM by fleshone RSS
fleshone Just Startin' 5 posts since
Jan 9, 2009
Currently Being Moderated

Mar 13, 2009 10:36 PM

Help with writing to external memory for a delay effect?

HI all,

 

I took LukeD's old Delay code, which was posted in the old forum, and modified it based on the suggestions in the same thread.  The delay code is shown in the reply to this post.  The delay function is at the bottom of the text file (thanks LukeD).

 

The delay time, however, is very short (on the order of tens of miliseconds).  I want to extend the delay time by using the external memory, but I am failing.   I tried to use suggestions given in the old forum, but am still failing.

 

// ???
Can anyone help with modifying the code to extend the delay time (like to seconds instead of miliseconds)?  If someone has done this in C, that would be equally as helpful (even more helpful).

// ???

 

My end goal is a function of the type: y(n) = x(n-Delay1) + x(n-Delay2)

where Delay1, Delay2 are controlled by knob1, knob2 with the range 0 to 1sec.

 

Thanks in advance.

 

 

///////////////////////////////

 

I have this example from the old forum, but my Assembly is too weak to get it to work.  It may help someone else:

(if anyone knows the author, please note who it was.  I don't have their name)

 

////////////////////////////////

Posted: Jan 19, 2009 8:24 AM

 

Hi,
I’ve just finished my first prototype. This one needed to access to the external memory. I performed this without using the DMA module. This code doesn’t appear in the documentation. So I thought it can be interesting if I give it to you.

 

This is how to perform a simple write in the 8bits external memory:

 

move #>$ABCDEF,a1 ;Move the data in the a1 register
move #>$200000,r0 ;Move the destination address to r0
move a1,y:(r0)+ ;Copy the lowest 8bits to the external data and increment r0
lsr #8,a1 ;logical shift right of 8bits
move a1,y:(r0)+
lsr #8,a1
move a1,y:(r0)

 

Of Course, to copy the 24bits information, you need three 8bits cells in your external memory.

 

To read the external memory,the code is similar:
move #>$200000,r0 ;Move the source address to r0
move y:(r0)+,b1 ;Copy the lowest 8bits and increment r0
move b1,x0 ;move the results in r0
move y:(r0)+,b1 ;Copy the other 8bits and increment r0
lsl #8,b1 ; logical shift left of 8bits
or x0,b1 ;add the information to x0(logical or)
move b1,x0 ;the result of the or was on b1
move y:(r0),b1
lsl #16,b1
or x0,b1
move b1,x0

//////////////////////////////

    • LukeD Just Startin' 7 posts since
      Aug 14, 2008

      Hey, so I just updated the Flanger effect & uploaded the latest source code (sorry, comments are a bit bare in parts.  I meant to fix that, but never got around to it).  There's still a few bugs that appear when you use multiple voices, but the important part is that I use the external memory for the delay, so you can look at that to see how I do it.  (I'm using the DMA module by the way)

      Source: http://sites.google.com/site/lukedsfiles/tcddk/flanger.zip

        • LukeD Just Startin' 7 posts since
          Aug 14, 2008

          Unfortunately, because of the way I wrap around the buffer (I use m0 and m1 to do wrap around addressing), the maximum buffer size (and therefore, the maximum delay) is pretty small, something like 30000 samples.  By the way, the delay limit must be at most the buffer size.

           

          If you read through the Family Manual, I think I remember seeing that there is some way to do wrapping in the DMA that allows larger sizes, but I never read how to do it.  Sorry =/

          I'd help you out more, but I have a lot of real life stuff at the moment.  (Also, I already own a really nice delay pedal and don't have much reason to write one)

           

          If I get some free time, I'll probably look into this.  I'll let you know what I find, but it could be a few weeks before I get to it.

           

          Alternatively, you could try setting m0 and m1 to 0, use direct addressing mode, and just see what happens.  That will try to use the entire y space for your buffer so make sure you have nothing else stored in y space at all.  I have no idea if that'd work or not though to be honest.

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 5 points
  • Helpful Answers - 3 points