[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recode to Play MP3?



On 22 mayo, 18:49, biel...@terra.es wrote:
>
> A way to be sure that the code is accelerated would be to relocate a
> copy of it into main RAM, and use it instead for the transfers.
>

Also, if the code is relocated to RAM, it could also be tweaked a bit
(self-modifying code) in order to gain even some more cycles by
removing the indirections :

loop2   lda  ATADataLow,x (4 cycles)
   sta  IOBuffer,y (4 cycles)
   iny  (2 cycles)
   lda  ATADataHigh,x  (4 cycles)
   sta  IOBuffer,y  (4 cycles)
   iny  (2 cycles)
   bne  rLoop  (branch taken, 3 cycles)

One interation gets 2 bytes and takes 23 cycles, or 11.5 cycles per
byte, or 86.95 KB/s/MHz.

Unrolling it just a little bit :

loop2   lda  ATADataLow,x (4 cycles)
   sta  IOBuffer,y (4 cycles)
   iny  (2 cycles)
   lda  ATADataHigh,x  (4 cycles)
   sta  IOBuffer,y  (4 cycles)
   iny  (2 cycles)
   lda  ATADataLow,x (4 cycles)
   sta  IOBuffer,y (4 cycles)
   iny  (2 cycles)
   lda  ATADataHigh,x  (4 cycles)
   sta  IOBuffer,y  (4 cycles)
   iny  (2 cycles)
   bne  rLoop  (branch taken, 3 cycles)

Would give you 43/4 = 10.75 cycles/byte -->> 93.02 KB/s/MHz.

Unrolling it completely would give you 10 cycles/byte or 100KB/s/MHz.

All of the above without an accelerator.

2 of the (about) 11 cycles per byte must be slow, non-accelerated 1000
nS memory cycles. A 4x accelerator could very likely manage to execute
the remaining 9 cycles in 3 1000ns cycles. That would translate to a
rate of 5 cycles/byte or 200KB/s. Or more than a floppy a second !
And although I'm not 100% sure I don't think that reading so fast
would be a problem for the flash card.

--Jorge.