Assembly code questioon.
mynet43
Posts: 644
I spent some time debugging assembly code.
I ran into a bug I hadn't seen before, that took me way too long to find.
If I use the following code:
It assembles fine, but doesn't store 'cnt' in _addr.
If I change it like this:
It now works fine.
Has anyone run across this before?
On p. 397 of the manual, it says that read-only registers can only be used in the 'source' field, which this is.
Am I missing something?
Thanks for the help.
Jim
I ran into a bug I hadn't seen before, that took me way too long to find.
If I use the following code:
wrlong cnt,_addr
It assembles fine, but doesn't store 'cnt' in _addr.
If I change it like this:
mov t2,cnt wrlong t2,_addr
It now works fine.
Has anyone run across this before?
On p. 397 of the manual, it says that read-only registers can only be used in the 'source' field, which this is.
Am I missing something?
Thanks for the help.
Jim
Comments
Too bad the assembler doesn't catch it...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
do you say that with
mov cnt, # some value
wrlong cnt, addr
you really find 'some value' in HUB RAM? And this works with other special registers as well. Nice to know if that works because it can safe some longs in PASM.
So, what about
mov cnt, cnt
wrlong cnt, addr
then you don't have to waste an additional register.
I'm surprised the assembler has no knowledge of the props special registers. It seems like it would be helpful if it did.
Since it executed without an error, does anyone know which data was actually written to the output address?
It seems like it would make more sense to provide another way to get at the "registers under the registers".
All-in-all, I learned a lot from this little post.
Thanks everyone,
Jim