PASM MOV to Array Question
Pascal22
Posts: 2
hi,
how to make something like this in PASM : (write a value in an array)
MOV TmpVal, Adr_2_Array
ADD TmpVal, Offset
MOV TmpVal, Value
Adr_2_Array contain the base adresse of an array localised in the cog memory
Offset contain a position in the array
the last line do not work : the value is moved in the TmpVal register and not in the (adresse_of_array+offset) register
sorry for my poor english...:shakehead:
how to make something like this in PASM : (write a value in an array)
MOV TmpVal, Adr_2_Array
ADD TmpVal, Offset
MOV TmpVal, Value
Adr_2_Array contain the base adresse of an array localised in the cog memory
Offset contain a position in the array
the last line do not work : the value is moved in the TmpVal register and not in the (adresse_of_array+offset) register
sorry for my poor english...:shakehead:
Comments
Note that you need a one instruction delay between the last change to the
instruction and when it's executed. The 2nd SHR serves as the delay and it
repositions the offset back to where it was originally. You could use any other
single instruction (like a NOP) for the same purpose.
The "0-0" is just a placeholder to show you which fields of which instructions are
calculated at run time. You could use just "0" if you want, but "0-0" can be more
meaningful.
I unterstand that must have 4 instructions between the movd and the modified instustion (4 cycles of decoding by instruction)... that's right ?
Another question :
the cog's memory is long aligned, so the offset's step is 1 vs hub's memory who the offset's step is 4 (for a long value) ?
Yep you got it.