Driving me crazy: wrlong, wrbyte
Hello, please rescue me!
I do not understand this:
..
wrlong bp,bp ' is working
wrbyte bp,bp ' is not working
...
If I omit the wrlong, the wrbyte works.
Is there a restriction using wrX ? Does the IDE something (optimizing?) with the code??
Christof
I do not understand this:
..
wrlong bp,bp ' is working
wrbyte bp,bp ' is not working
...
If I omit the wrlong, the wrbyte works.
Is there a restriction using wrX ? Does the IDE something (optimizing?) with the code??
Christof
Comments
The second wrbyte in that code writes the same thing in the same address, so it does not modify anything. Remember that propeller is little endian, ie. $22 looks in memory as a long like 22 00 00 00. So you're overwriting the LEAST significant byte with the wrbyte (At least assuming that the address is divisible by 4).
Post Edited (Jasper_M) : 3/17/2007 5:27:09 PM GMT
I don't know what you're trying to do with this code sequence. It doesn't make sense.
Mike
that was not the problem. I was already crazy posting this.
The real problem was, that I used
Dat
P long '/* Primary Register */
S long '/* Second Register */
...
instead of
Dat
P long 1 '/* Primary Register */
S long 1 '/* Second Register */
..
the assembler did not use different locations. You seem to have to use init values.
This lead the code to write somewhere into memory....
Thank you Jasper, I realized, that I had to have a different problem...
Christof
I was just looking at your code and looking at those empty "long"s and thinking "oh, you can do that..."... And good luck with retargeting the small C!
You're right about the "longs" without data... they end up not emitting any data (by design)... but simply specifying a data value may not be the best solution either (it's okay, but may be wasteful, is all).
Another way is to do:
The "1" means "1 long of space".· The difference is that the res (reserve) directive increments the cog address of the next item, but doesn't emit any data (whereas P long <nothing> also doesn't emit data, but doesn't increment the assembler's cog address either).
A note of caution about res... since it doesn't emit data, make sure you have all your res's as the LAST code in your assembly... or you'll end up with P and S pointing to a location used by a "long" definition, or an instruction, that you specified after it.
SUMMARY:
· defining longs, with data, increases the size of your object
· defining res's does not increase the size of your object, but still gives you a symbolic register to work with once the code is loaded into the cog.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Jeff Martin
· Sr. Software Engineer
· Parallax, Inc.