Is there away to point to an Array
Hi all
Is there away to point to an Array and get it's dimension(upper bound), so I can pass them to a sub/function.
I'm doing it like this now, but it takes a lot of space.
SXlee
Is there away to point to an Array and get it's dimension(upper bound), so I can pass them to a sub/function.
Array_1 VAR Byte(16) Array_2 VAR Byte(14) Array_3 VAR Byte(11) Array_4 VAR Byte(16)Like so
Sub MySub2 FOR idx = 0 TO 3 DealWith_Array ThisArray, UBound Next i EndSub Sub DealWith_Array FOR idx = 0 TO UBound TheArray(i)=i ......... ......... ......... ......... ......... Next i EndSub
I'm doing it like this now, but it takes a lot of space.
Sub MySub1 DealWithArray_1 DealWithArray_2 DealWithArray_3 DealWithArray_4 EndSub Sub DealWithArray_1 FOR idx = 0 TO 15 Array_1(i)=i ......... ......... ......... ......... ......... Next i EndSub Sub DealWithArray_2 FOR idx = 0 TO 13 Array_2(i)=i ......... ......... ......... ......... ......... Next i EndSub Sub DealWithArray_3 FOR idx = 0 TO 10 Array_3(i)=i ......... ......... ......... ......... ......... Next i EndSub Sub DealWithArray_4 FOR idx = 0 TO 15 Array_4(i)=i ......... ......... ......... ......... ......... Next i EndSub
SXlee

Comments
arrLen1 CON 14 arrLen2 CON 10 arrLen3 CON 9 arrLen4 CON 4 arr1 VAR Byte(arrLen1) arr2 VAR Byte(arrLen2) arr3 VAR Byte(arrLen3) arr4 VAR Byte(arrLen4) arrLens: DATA arrLen1 DATA arrLen2 DATA arrLen3 DATA arrLen4 '.... FOR i = 0 TO 3 ' 4 arrays READ arrLens + i, uBound FOR j = 0 TO uBound LOOKUP i, [ @arr1, @arr2, @arr3, @arr4 ], W ASM ADD W, j MOV FSR, W ' now do something to ind, e.g. INC IND BANK __DEFAULT ENDASM NEXT NEXTThe Ubound parameter was not my first concern, pointing to an Array was my first.
But if you can do it with Ubound you can do it with an array.
Thank you!
SXlee