Here? ($ operator)
CardboardGuru
Posts: 443
I've just updated to prop-tool 1.05.8 and I noticed in the release notes for 1.05.6
"Updated compiler to support $ as a "here" operator"
I'd be interested to know what that means, and how is it used?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Help to build the Propeller wiki - propeller.wikispaces.com
Prop Room Robotics - my web store for Roomba spare parts in the UK
"Updated compiler to support $ as a "here" operator"
I'd be interested to know what that means, and how is it used?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Help to build the Propeller wiki - propeller.wikispaces.com
Prop Room Robotics - my web store for Roomba spare parts in the UK
Comments
If you should ask me in private, this is a questionable gift....
Go on; tell us all, in public
I'm interested in hearing your views and I'm sure others are. I see it as a useful addition but you have a lot more Propeller Assembler experience than I have.
I'll admit it can be prone to error when code is added or removed between its use and intended destination and reaching over macro commands can cause problems but that's no different to its use in any other Assembler, and, finally, people are not forced to use it.
(a) I think it is not strictly needed... Something like
X++
in C... I should expect any decent compiler to generate efficient code out of
X += 1
$ - indeed present in any (macro!) assembler has it's main duty inside macros, as it would need tricky modifications otherwise when expanding macros...
Another useful application in other machines is aligning code or data
Used with discretion there is no more danger in it than in the next best JMP-instruction.
However, now - having this NEW feature - people will start looking through their code where this can be applied for better or for worse; imagine: tight loop could be re-written DJNZ X, #$-1 - Yes, I know you all: DeSilva.. and the rest...
I'm highly likely to pick that up and go with it. Other uses will really depend on how it adds clarity, of if it makes something more possible, sans a kludge.
Sorry to go somewhat OT, but it's kind of relevant. What's the easiest way to make damn sure an instruction exists at a specific COG address? eg: $ = $100
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Is this a new features they snuck into Propeller Tool? What, if any, are the other new features? I haven't had a chance to install the new one yet. Does it replace the old one automatically?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
I don't think that "$" is implemented as a variable. It's a predefined label whose value happens to change from place to place, so "$ = $100" would not be allowed. You'd use "ORG $100" for that purpose. "$" is useful in macro definitions as others have noted (which we don't have) and it's useful in creating tables with relative addresses. As noted, it's useful in 2-3 instruction loops. It's a dangerous construct in most other contexts. The fact that something useful can be abused is not a reason by itself to prohibit its introduction. There are certainly contexts where "$" can be clearly and cleanly used to implement something where the other alternative (local labels) is awkward and potentially confusing and error prone.
pad: long 0[noparse][[/noparse]$100 - $]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax Forums - If you're ready to learn, we're ready to help.
Post Edited (CJ) : 10/28/2007 5:46:10 PM GMT
I'm somewhat outta the loop on org. I thought there were problems with it's direct use, as in ORG $100. Can't seem to find the thread. Was a while back though.
If ORG = address is ok, that totally answers the question. I might have just been limited from bad, or old info!
Ken, the Parallax practice, seen so far, is to just install the newer version alongside the older one. That way you can move projects over, see what, if anything, has to be changed, than carry on with the newer tool as it makes sense.
When you run any given version, it looks to see if it is associated with the relevant files, asks if you want to deal with that, then goes and does it's thing. All in all, pretty painless.
I'm not gonna go edit any older code either. Will probably just use it, where it makes sense, in newer code. After thinking about it, I'll probably limit using it in the self-modify way, only for very small and tight situations.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Post Edited (potatohead) : 10/28/2007 5:53:30 PM GMT
Using $+n is potentially dangerous, but that comes with the territory ( is there anything to stop people using label+n ? I'm in the wrong OS so cannot check ). Misuse is usually in writing code where it's not clear where $+n area boundaries are leading to accidental editing.
One argument against code using $+n is that it will not work for those who have not upgraded to a compiler version which supports it. Generally not a problem but there are people around the world who do have problems downloading 10MB files.
That doesn't mean that ORG is useless, though. For example, you might want to designate an area of cog RAM that's shared by multiple snippets of code (i.e. overlays). In such a case, each snippet would begin with an ORG bearing the cog address of the overlay area.
-Phil
had always been possible; there is not much improvement in
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
To your question: I think it will not enforce the installation of a driver when there is already one present.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?