Fun with pointers
RedNifre
Posts: 84
Hello!
I have several arrays and one pointer to the currently active array. Lets say I want to change the fourth LONG of the currently active array. How to do that?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Hydra in a LEGO NES:
http://forums.parallax.com/showthread.php?p=654788
I have several arrays and one pointer to the currently active array. Lets say I want to change the fourth LONG of the currently active array. How to do that?
[noparse][[/noparse]...] arrayPointer := @array3 ??arrayPointer??.LONG[noparse][[/noparse] 4 ] := 99 DAT array1 long blablabla array2 long blablabla array3 long blablabla array4 long blablabla
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Hydra in a LEGO NES:
http://forums.parallax.com/showthread.php?p=654788
Comments
That's an array of longs, but I need to modify bytes. @render_tab is an array of bytes, organized into longs. index is the address pointer. It's some code I'm working on right now.
In your case, since you are working with longs, you can just take the number of the long you want to modify, multiply it by 4, then do:
long [noparse][[/noparse]@your_array] [noparse][[/noparse]index] := value of long
, where index = number_of_long * 4
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Help to build the Propeller wiki - propeller.wikispaces.com
Play Defender - Propeller version of the classic game
Prop Room Robotics - my web store for Roomba spare parts in the UK
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Hydra in a LEGO NES:
http://forums.parallax.com/showthread.php?p=654788
Andre'