problem grabbing Values in array over 14 elements in asm
Rick_H
Posts: 116
I am having a problem grabbing Values in array over 13 elements in asm.
this is my code, any thing over the 13th element is = to 0 in asm but shows up in terminal debug as the correct value.
am I missing something?
this is my code, any thing over the 13th element is = to 0 in asm but shows up in terminal debug as the correct value.
VAR long stack[100] pri inittest stack[2] := 20 '8 stack[3] := 30 '12 stack[4] := 40 '16 stack[5] := 50 '20 stack[6] := 60 '24 stack[7] := 80 '28 stack[8] := 2300 '32 stack[9] := 240 '36 stack[10] := 80 '40 stack[11] := 160 '44 stack[12] := 100 '48 stack[13] := 50 '52 stack[14] := 25 '56 Dat Init1 add Temp1, par add Temp1, #28 rdlong T1span1, Temp1 add temp1, #4 rdlong T2Span1, temp1 add temp1, #4 rdlong span1, temp1 add temp1, #4 rdlong bias1, temp1 Init1_ret ret Init2 mov Temp1, par add Temp1, #44 rdlong T1span2, Temp1 add temp1, #4 rdlong T2Span2, temp1 add temp1, #4 rdlong span2, temp1 add temp1, #4 rdlong bias2, temp1 Init2_ret ret T1span1 long 10 '28 - 7 T2span1 long 10 '32 - 8 span1 long 242 '36 - 9 Bias1 long 90 '40 - 10 T1span2 long 100 '44 - 11 T2span2 long 100 '48 - 12 span2 long 242 '52 - 13 Bias2 long 90 '56 - 14 temp1 long 0if I change Init2 to use the same values as init1 I get the same output, if I then change span2 and bias2 to 44 and 48 I get 160 from each, but then when I try 52 or 56 I get 0 in both. their is no code that accesses the stack except this and the debuger.
am I missing something?
Comments
I have tried using init1 to grab it and still get 0 so its not the asm code over writing it somewhere.
I have tried elements 13 to 30 and get 0 no matter what init I use.
The values are actually their, in spin I can write them to the terminal and its all correct.
any debugging suggestions or is their some limitation to rdlong I don't understand?
As both Init1 and Init2 have a RET I wonder how it's used. If you really call Init1 or Init2 from SPIN with cognew( @Init1, @stack) and/or cognew( @Init2, @stack ) you in fact have a problem.
Init1 will work, Init2 won't, because it does not find the PASM variables where you expect em.
But that's guesswork and one can't guess what others can do wrong in programming ... you have to see it! ;o)
they are just initialization sub routines, not loaded in separate cogs.
Honestly the time to init the data is not critical but I will need subs that are as fast as possible for user changes real time if I do it that way.