Write from assembly to spin
Princ
Posts: 12
Hi,
I would like to ask you how can i write from assembly to VAR blok (spin)
I made a field for example
long color[253]
i want to write from assembly to spin
I know that i can send address for cognew like cognew(@writetospin,@colors[253])
or i can write to it with wrlong from assembly
but if i want to write for example to position 143 i don´t know any easy trick how to do it beacause i know that assembly doesn´t have anything like arrrays
thanks a lot
I would like to ask you how can i write from assembly to VAR blok (spin)
I made a field for example
long color[253]
i want to write from assembly to spin
I know that i can send address for cognew like cognew(@writetospin,@colors[253])
or i can write to it with wrlong from assembly
but if i want to write for example to position 143 i don´t know any easy trick how to do it beacause i know that assembly doesn´t have anything like arrrays
thanks a lot
Comments
cognew(@writetospin,@colors)
...inside of the Assembly program the address that you specify in "@colors" is moved to the par variable.
It is important to know that the par variable is always LONG aligned, but accessed by each individual byte within the PASM.
Depending on how you defined "@colors" .... i.e. BYTE, WORD, LONG, will depend on how you will want to access the proper array element within PASM.
Note: to write to an element in an array, simply use the wrbyte, wrword, and wrlong in place of the rdbyte,rdword, and rdlong below.
For example if "@colors" were defined as a BYTE:
For example if "@colors" were defined as a WORD: (notice the difference in what we add to t1)
For example if "@colors" were defined as a LONG: (notice the difference in what we add to t1)