56800E modulo addressing

Discussion created by miroslavmartisek on Jun 20, 2013
Latest reply on Jul 2, 2013 by xiangjun.rong

Hello guys,


have somebody got experiences with 56800E core modulo addressing? Namely, I

cannot read correct value of last sample in circular buffer (its length is

7 samples). If I want to obtain other samples, it works very well.


Simple code is here:




Frac16 test;

Frac16 TestBuffer[7] = {4587, 4578, 1258, 6688, 1024, 1122, 874};


asm Frac16 ModuloTest(Frac16 *buffer)


  adda #1,SP 

  move.w N,X:(SP) // save N



  adda #0,R2,R0 // R0 = R2

  moveu.w #6,M01 // modulo addressing 


  move.w #6,N

  adda N,R0


  move.w X:(R0),A


  move.w A,Y0 // result to Y0



  move.w X:(SP)-,X0

  move.w X0,N





And calling:

test = ModuloTest(TestBuffer);




If I want to call this function, it returns value of 32 instead 874. Also,

I tried to modify this code million times, but without success. At the

moment I don´t know how improve it.

Could somebody give me an advice to solve it?


Thanks a lot!


Miroslav from Bohemia (Czech Republic)