First time using pointers, needs review
Mag748
Posts: 266
Hello,
I just discovered using pointers in assembly for arrays. I modified an existing file that worked, to use arrays with pointers, and now it no longer works. I've been pouring over it all day to try and find any mistakes, but I though I would put it up here in case anyone out there has a second to look over what I'm doing and who might be able to catch any obvious mistakes.
Any thoughts would be greatly appreciated.
Thanks,
Marcus
MSGEQ7 Driver 4.5.13c.spin
I just discovered using pointers in assembly for arrays. I modified an existing file that worked, to use arrays with pointers, and now it no longer works. I've been pouring over it all day to try and find any mistakes, but I though I would put it up here in case anyone out there has a second to look over what I'm doing and who might be able to catch any obvious mistakes.
Any thoughts would be greatly appreciated.
Thanks,
Marcus
MSGEQ7 Driver 4.5.13c.spin
Comments
Always have line of code before the 0-0 line comes up, here I use mov mycounter,#8 as to avoid a nop
If the array is on the destination side.
A relative to the current DAT block
Thank you both for the routine suggestions. I added that to my spin file and it helped my understand the process, and I will do this from now on.
kuroneko,
Great catch on the @ vs. # mistake I made. that helped. And regarding the +2 on the shl command, I was thinking I needed to shift all my offsets and array indices left by 2 since a long is 4 bytes in Spin, BUT I didn't realize that all commands are acting on LONGs in ASM, so I got rid of all those extra left shifts by 2 and everything works like a charm!
Thanks for all your help