If I use the command:
ARRAYWRITE TestArray,[SKIP N,$81,$CF,$4D....]
Where N = $A,
Will it start filling TestArray with $81 at location $A, and leave locations 0-9 untouched?
Printable View
If I use the command:
ARRAYWRITE TestArray,[SKIP N,$81,$CF,$4D....]
Where N = $A,
Will it start filling TestArray with $81 at location $A, and leave locations 0-9 untouched?
ARRAYREAD has a SKIP modifier.
ARRAYWRITE does not.
Maybe you could ...Which writes the first N bytes back to themselves.Code:ARRAYWRITE TestArray,[STR TestArray\N,$81,$CF,$4D...]
<br>
So, in the above example,
ArrayRead [SKIP N,$81,$CF,4D...]
Would give me an array with $81 in location $A, and locations 0-9 untouched?
NO, that would give compile errors.
ARRAYREAD gets data from an array. So you can't have constants as parameters.
ARRAYWRITE puts data in an array.
Consider the following program ...The output would look like this, and the data can be moved by changing the value of N. ...Code:TestArray VAR BYTE[26]
N VAR BYTE
N = 9
ARRAYWRITE TestArray,["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
HSEROUT ["Before-",STR TestArray\26,13,10]
ARRAYWRITE TestArray,[STR TestArray\N,"12345678"]
HSEROUT ["After -",STR TestArray\26,13,10]
If the data is always going to be placed at the same location, you can do it this way...Code:Before-ABCDEFGHIJKLMNOPQRSTUVWXYZ
After -ABCDEFGHI12345678RSTUVWXYZ
Resulting in the same thing ...Code:TestArray VAR BYTE[26]
StartPos VAR TestArray[9]
ARRAYWRITE TestArray,["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
HSEROUT ["Before-",STR TestArray\26,13,10]
ARRAYWRITE StartPos,["12345678"]
HSEROUT ["After -",STR TestArray\26,13,10]
<hr>ADDED:Code:Before-ABCDEFGHIJKLMNOPQRSTUVWXYZ
After -ABCDEFGHI12345678RSTUVWXYZ
You can also do the fixed position data like this ...Unfortunately, you can not do it like this, which would be very handy...Code:TestArray VAR BYTE[26]
ARRAYWRITE TestArray,["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
HSEROUT ["Before-",STR TestArray\26,13,10]
ARRAYWRITE TestArray(9),["12345678"]
HSEROUT ["After -",STR TestArray\26,13,10]
hth,Code:TestArray VAR BYTE[26]
N VAR BYTE
N = 9
ARRAYWRITE TestArray,["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
HSEROUT ["Before-",STR TestArray\26,13,10]
ARRAYWRITE TestArray(N),["12345678"]
HSEROUT ["After -",STR TestArray\26,13,10]
As our friend Darrel Taylor write
http://www.picbasic.co.uk/forum/atta...1&d=1263158154
Here is example :
If you have array = "ABCDE"
And you do next :
You will have next :Code:A var byte[5]
B0 var byte : B0 = 10
ARRAYWRITE A, [DEC B0]
array = "10CDE"
Best regards to all and special to Darrel
Thanks to both of you!