Modifying Dat in program.
Clock Loop
Posts: 2,069
Can a dat entry, like such.
Be modified in a running program?
Say I wanted to modify the first byte in FourBytes.
From value $00 to value $FF. How would I do this?
I tried looking at the prop manual, and didn't see anything there. I tried a forum search...
DAT FourBytes byte $00, $FF, $00, $0F
Be modified in a running program?
Say I wanted to modify the first byte in FourBytes.
From value $00 to value $FF. How would I do this?
I tried looking at the prop manual, and didn't see anything there. I tried a forum search...
Comments
byte[noparse][[/noparse]@FourBytes]:=$FF
You can also just do (since you just want the first byte):
FourBytes:=$FF
If you want to get at·the nth byte (n=0..3), you can do:
FourBytes[noparse][[/noparse]n]:=$FF
or,
byte[noparse][[/noparse]@FourBytes][noparse][[/noparse]n]:=$FF
or,
byte[noparse][[/noparse]@FourBytes+n]:=$FF
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Meh. Nothing here, move along.
If you create many instances of an object in your program they will all have their own private VAR space in memory but they will all share the same DAT space.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
If I ran 2 copys of the same object(different names), their DAT statements would be accessable to eachother, but their variables stay local to that object?
Thats why one doesn't need to be careful with variable names, but im assuming with DAT you must be careful with names because if two objects have a Dat with the same name problems happen?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Meh. Nothing here, move along.
No all symbol names (DAT/VAR/PUB/PRI) are local to the object. There are no collisions between names across different objects.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"VOOM"?!? Mate, this bird wouldn't "voom" if you put four million volts through it! 'E's bleedin' demised!
Lets say I launched an object to read a value and told it to store that value at the address of INFO.
Now the modinfo.spin code.
This part
infopointer[noparse][[/noparse]0]:= moreinfo
is not working.
Or something.
Because when i run the program, it still prints
use
infopointer is just a local variable that receives the value @info. Changing a local variable by assigning to it has no effect outside the method to which it's local.
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 6/6/2009 10:45:15 PM GMT
well what if I wanted to pass the n'th byte?
Well this doesn't work, ...
I just read the prop manual on
BYTE
That answered my questions.
Thank you all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
** P O O F **
Post Edited (BPM) : 6/6/2009 11:17:48 PM GMT