<<<--- % Author M.Ruckert LOC #100 Main IS @ --->>> ELEMENTS IS 64 Number of elements in circular buffer SIZE IS ELEMENTS*8 Size of buffer in BYTE MASK IS SIZE-1 Mask to facilitate computations modulo \.{SIZE} LOC (@+SIZE-1)&~MASK Align location to a multiple of \.{SIZE} X OCTA ... $X_0,\ldots,X_{54}$ LOC X+SIZE Reserve SIZE byte Xn GREG X+54*8 $\.{Xn} \is \hbox{Address of current~} X_n = X_{54}$ result IS $0 base IS $1 offset IS $2 mask IS $3 tmp IS $4 SET mask,MASK ANDN base,Xn,mask Extract \.{base} and \.{offset} from \.{Xn} AND offset,Xn,mask \.{offset} of $X_{n}$ ADD offset,offset,8 \ul{\sl A2.~Advance.}\qquad $n\is n+1$ AND offset,offset,mask ADDU Xn,base,offset $\.{Xn} \is \hbox{Address of~} X_{n+1}$ SUB offset,offset,24*8 \.{offset} of $X_{n-24}$ AND offset,offset,mask LDOU result,base,offset $\.{result} \is X_{n-24}$ SUB offset,offset,(55-24)*8 \.{offset} of $X_{n-55}$ AND offset,offset,mask LDOU tmp,base,offset $\.{tmp} \is X_{n-55}$ ADDU result,result,tmp \ul{\sl A1.~Add.} STOU result,Xn,0 $X_n \is X_{n-24}+X_{n-55} \bmod m$