Question about the use of 0 in prop assembly
Chris Kraft
Posts: 20
I am reading through the code in TV.spin and there are a couple of lines that I am not sure what they do. They all seem to use 0 as a location to copy things into.
Specifically (I don't have the line numbers handy):
(there should not be a space between the : and par but the forums code keeps interpreting it as emoticons even inside the code block)
If I understand rdlong correctly it is taking main memory and, in this case, copying it into 0.
Further on I see the following two samples:
Does anyone know what this does? Why use 0 as a destination?
The only thing I can think of is that maybe 0 ends up representing the bottom of cog memory but that doesn't explain the use of mov 0,0 then.
If anyone has an explanation for what this is doing I would appreciate the help.
Thanks
--Chris
Post Edited (Chris Kraft) : 11/27/2006 2:28:49 PM GMT
Specifically (I don't have the line numbers handy):
: par rdlong 0,t1
(there should not be a space between the : and par but the forums code keeps interpreting it as emoticons even inside the code block)
If I understand rdlong correctly it is taking main memory and, in this case, copying it into 0.
Further on I see the following two samples:
:wr mov 0,t21
:ltab mov 0,01
Does anyone know what this does? Why use 0 as a destination?
The only thing I can think of is that maybe 0 ends up representing the bottom of cog memory but that doesn't explain the use of mov 0,0 then.
If anyone has an explanation for what this is doing I would appreciate the help.
Thanks
--Chris
Post Edited (Chris Kraft) : 11/27/2006 2:28:49 PM GMT
Comments
So if I understand correctly:
: par rdlong 0,t1
establishes : par as being those commands, then a movd modify's the destination address, for example:
movd : par, #_enable
This causes the line to modify into the following:
: par rdlong #_enable,t1
Although its not really #_enable but the address that _enable is pointing too.
--Chris
You've got it. Zero is being used here as a "don't-care" value. Some other assemblers provide an explicit symbol for distinguishing "I want this to be zero" from "I don't care what this is," often * or _, and that might be something for Parallax to consider.
-Phil