Lesson 5:

Creating Labels and how to use them

Labels are like memory addresses for the calculator to reference a place in the program or game that can be called up later from within that program. You cannot access labels in one program from another.

Defining a Label (Lbl)

A Label is defined by one or two characters, either alphabetic or numeric. The Lbl command can be used in cunjunction with the Goto and Menu( commands. The syntax for Lbl is: Lbl A1

To access a Lbl, you can use Goto or Menu(. Goto will tell the program that you need to go to the corresponding Lbl. These two commands are probably the simplest of commands to deal with, and probably one of the slowest. This will be explained later on.

The Menu( command allows a programmer to make a menu similar to what the calculator uses. The format of Menu(Menu("Title","Option 1",1,"Option 2",2,"Option 3",3,"Option 4",4,"Option 5",5,"Option 6",6,"Option 7",7

Here is a little bit of a break down on the above syntax. "Title" is what is displayed across the top of the screen. It can be 16 characters long, and any spaces you put in will display a black square in its place. Option 1",1 is what will be displayed in the menu, folled by the Lbl that you are wanting to go to. There are only 7 available menu options, most of the time, that is all one needs. If it isn't, then for the last option, have "More" as an option, and go to a different menu. There are no known ways to bypass the 7 option limit, other than writing your own routines to make a menu.

The biggest problem with using Goto and Memu( commands is that these commands cause the processor to start at the top of the program, and work its way down until it runs across the correct Lbl. If you have a program that is less than 1,000 bytes, than this is not a problem, you will not see much of a lag. If you have a program much larger, say 16kb, and you are looking for a Lbl at the end of the program, your user will have to wait a long time for the processor to get there. There are alternatives to using the Goto/Lbl system, though, it will be discussed in a future lesson.

Command definitions for this lesson:

Goto: This command tells the processor to start at the top of a program and begins searching for a Lbl.

Lbl: This is an address of sorts, allowing for certain commands to go to this location from within the program.

Menu(: This command allows a user to select from a list of 7 options and goes to a certain part of the program.

<<Previous - Contents - Next>>