PASM noob question
Bobb Fwed
Posts: 1,119
I have some PASM programs with a few #:loop's in it, and I was wondering how the program know which :loop to go to? Is it the closest one? I've found it seems to work fine going to a close :loop below the JMP or above. I'm sure there is a simple answer.
Comments
Basically the compilier assigns the jmp to the closest :loop.
Becareful with this. I would strongly reconmend you do not use the : and strech your brain a bit to give your loops good labels.
Assembly is not good for debuging, if a problem comes up it takes a great deal of errort to fix it.
If you want to use the : use it only once or twice far apart in the program.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
I think local labels are very useful for some things.· There are always jumps that go somewhere close and the actual label used really doesn't make any difference in understanding the program.· Those are the places where local labels are very useful.· If I have a short subroutine, maybe 10-20 instructions, that includes a loop or some jumps associated with a test, local labels work great.· In the rest of the program, who cares what label I use within the short subroutine.· Larger subroutines or more complex code is a different story.· Again, local labels are great over a short span, maybe 10-30 instructions.
Post Edited (Mike Green) : 2/4/2009 8:10:39 PM GMT
Cheers!
Paul Rowntree
One way to use it is to always use the same kind of label for the same kind of program flow or data construct. Then use the unique labels to identify other areas in the program that are going to be specific to that program.
If you want to do that, one pleasant side effect is being able to cut 'n paste code without having to worry about a label conflict. Another is when you do see a conflict, and it's local, then you've got a flow issue.
Either it's useful, or it isn't. Depends on your style really.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
Safety Tip: Life is as good as YOU think it is!
Now that I am confident on how local labels work, they are very useful and doesn't force me to come up with labels that wouldn't be very portable to other programs.
Local labels are not really much different than local variables. Do you uniquely name all of those as well? [noparse];)[/noparse]
Jason
I Have always loved that line ! ..
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Necessity is the mother of invention'
Those who can, do.Those who can’t, teach.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
This is almost Zen-like! Does anyone remember a short story by Arthur C Clarke, "The Nine Billion Names of God"?
Cheers!
Paul Rowntree