May 18, 2024, 05:10:57 AM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Learning sources

Started by steveo, March 13, 2008, 02:22:11 PM

Previous topic - Next topic

steveo

Jon,
I've been taking the time to go through the wealth of material found in the "help" section of the Stamp editor. Much of it seems to start just a a tad higher than my knowledge level, but covers the material just a hair short of what I need to really grasp it.

Don't get me wrong, it's helping me a lot but it tends to lead to more questions, like "what's the functional difference between on-gosub and branch?"

Can you recommend some further reading sources for me?

JonnyMac

Parallax has a ton of material on the BS2 (which we use in the Prop-2).  I would recommend StampWorks, but then... I wrote it!  Ego aside, it will teach you professional coding techniques as they apply to the BS2.

Sadly, there's not much info on the BS1; still there's is something:
  -- Nuts & Volts "Stamp Applications"
  -- BS1 App Notes

Note: The authors of these sources don't alwys conform to "The Elements of PBASIC Style" (in the help file).  I suggest that you should, even if they don't.

Since we all learn through observation I suggest you read through these sources.  Even if the project seems very far from what you'd ever do, read the material, anyway.  Programming is programming, and a microcontroller doesn't care if it's running a thermostat or a pop-up monster in a haunted house.

To your question: BRANCH is a [specialized] form of GOTO that gets it's target from a list.  What target from the list?  Well, BRANCH requires an index for that.  It's a great piece of work and I've always loved BRANCH.  It is especially useful in state-driven programs (the state causes the program to branch appropriately).

ON-GOTO and BRANCH are identical; they function alike.  I asked for ON-GOTO and ON-GOSUB at Parallax to conform to other versions of BASIC.  Now... ON-GOSUB is a different beast.  Whenever you have a GOSUB the program is going to jump to another section and expects to find a RETURN somewhere.  When it hits that RETURN the program jumps back to the line after GOSUB.  Using subroutines is a clean way to re-use code and have it called from any point within the program, as once the subroutine is finished it automatically makes its way back to the point that called it.

I hope this helps.
Jon McPhalen
EFX-TEK Hollywood Office