The Homescreen and Its Commands

The TI-83/+/SE homescreen is composed of eight rows (1 to 8 from top to bottom) by sixteen columns (1 to 16 from left to right); it is like a grid. The homescreen uses the large, easy to see, 5 by 7 font. Because each character takes up the same 5 by 7 space, regardless of what its actual size is, the text cannot be moved around to get pixel perfect precision.

The homescreen does not have access to any of the drawing commands that are available on the graphscreen (such as the points, pixels, lines, or circles). This leaves you with just using the text to imitate graphics, which unfortunately does not look very good. Using the homescreen is faster than using the graphscreen, though.

Clearing the Homescreen

There are numerous times in a program that you need a clear screen, so that you can display whatever text you want without it being interrupted. One place, in particular, is at the beginning of a program, since the previous program call(s) and any other text is typically still displayed on the screen. The simple ClrHome command is the command you use to clear the homescreen.

Format
:ClrHome

You also want to make sure to clear the homescreen when exiting programs (at the end of a program). This ensures that the next program that the user runs will not have to deal with whatever text your program left behind. It also helps the user, because they will not have to manually clear the homescreen by pressing the CLEAR key; you have already done it for them.

To use the ClrHome command, you should first be in the Program editor for your program. In the Program editor, press PRGM, then arrow over to the I/O menu. Then, scroll down to ClrHome and press ENTER (or press the 8 key). Now the ClrHome command has been put into your program.

Displaying Text on the Homescreen

Displaying text is a fundamental part of programs because the user will not know what is going on if a program does not display anything on the screen. Most things that you do in a program are displayed on the screen. This includes giving the user instructions, math calculations, or anything else. There are two commands that are used for displaying text: Disp and Output.

You can display text (the text needs to be within quotes), numbers, variables, or expressions. The current value of the variable will be used, while the expression will be evaluated before it is displayed. There are certain advantages and disadvantages to each command, and there are also certain situations where each command should be used. For most cases, though, Disp should be used.

Displaying with Disp

The first, and easiest, way to display text is using the Disp command. Text is displayed on the left side of the screen, while numbers, variables and expressions are displayed on the right side. Text can be moved over to the right by padding it with spaces, but there is no equivalent for numbers, variables, and expressions. You can also use the Disp command by itself, which simply displays the homescreen.

When you use an empty string with no text (i.e. two quotes side by side -- ""), a blank line is displayed. Similarly, when displaying a matrix or a list, and the matrix or list is too large to display in its entirety, an ellipsis (…) is displayed at the boundaries of the screen. The matrix or list, unfortunately, cannot be scrolled so the rest of it can be seen.

Format
:Disp [argument]

If you have a string of numbers that you are displaying, you do not need to put quotes around the numbers. This causes the numbers to be displayed on the right side of the screen, and they cease being a string. You may want to keep the numbers in a string, though, if they have any leading zeros. Because the numbers are no longer in a string, the leading zeros are truncated (taken off).

:Disp "2345
Remove the Quotes
:Disp 2345

With the small screen size, you have to keep formatting in mind when displaying text. Because the text does not wrap to the next line if it is longer than sixteen characters, the text gets cut off and an ellipsis is displayed at the end of the line. When the text you want to display is longer than sixteen characters, you should break the text up and display each part with its own Disp command.

:Disp "Just Saying Hello
Break the text up
:Disp "Just Saying
:Disp "Hello

When you have a list of Disp commands (and each one has its own argument), you can just use the first Disp command and combine the rest of the other Disp commands with it. You remove the Disp commands and combine the arguments, separating each argument with a comma. The arguments can be composed of whatever combination of text, numbers, variables, or expressions is desired.

The advantages of combining Disp commands are that it makes scrolling through code faster, and it is smaller when just displaying numbers, variables, or expressions. The disadvantages are that it can hinder readability (make the code harder to read) when you have lots of varied arguments, and it is easier to accidently erase a Disp command with multiple arguments.

:Disp A
:Disp B
Combine the Disp commands
:Disp A,B

The Disp command displays text line by line, giving each argument its own blank line. If the screen is clear, the arguments are displayed beginning at the first line. But if there is text on the first line, the arguments are displayed beginning at the first available blank line. When all the lines have text on them including the last, the screen will automatically scroll up until every line is blank.

This means that, while a Disp command can technically display an unlimited amount of lines of text, you should not display more than seven consecutive lines of text at any one time (because of the screen height). If there are too many arguments, the arguments that were displayed will be pushed up out of sight, to allow the other arguments to be displayed. This is usually not desired, but it can be used to create some cool scrolling effects by messing with the text that you display.

The result is that you can never display text on the last line of the screen using the Disp command; you need to use the Output command. Also, if you have more than seven lines of text to display, you will need to place the Pause command after every seven lines to prevent the screen from scrolling. These two scenarios come up fairly often, so it is good to know how to deal with them.

PROGRAM:DISP
:ClrHome
:Disp A,B,C,D,E,F,G
:Pause
:Disp A,B,C,D,E,F,G
:Output(8,16,H

To use the Disp command, you should first be in the Program editor for your program. In the Program editor, press PRGM, then arrow over to the I/O menu. Then, scroll down to Disp and press ENTER. Now the Disp command has been put into your program. You can then begin typing some text by turning on the alpha-lock with 2nd and ALPHA.

Displaying with Output

The other, more complex way to display text is to use the Output command. The Output command allows you to display text, numbers, variables, or expressions wherever you want on the screen; you can even display two or more things on the same line. The Output command also overwrites any existing text on the screen, so you have to be conscious of what text is already on the screen.

When you use the Output command, you need to specify the starting coordinates of what you want to display (the first character is displayed at the coordinates specified). You first specify the row and then the column. Since the homescreen dimensions are 8 rows by 16 columns, the possible row values are 1 to 8 from top to bottom and the possible column values are 1 to 16 from left to right. The Output command can only display one argument at a time.

Format
:Output(x,y,argument)

A primary feature of the Output command is its automatic text wrapping, which deals with text that is longer than sixteen characters or when you start displaying text and it goes past the sixteenth column. Instead of truncating the text at the end of a line (like Disp does), the Output command will wrap it around to the next row (it will not be shown, however, if it goes past the last row).

This feature not only makes it easier to display text, but it also provides a good way to display lots of text at one time. Displaying text is easier because you do not have to count every sixteen characters for a line; you just let the Output command do it for you. And, since the Output command can display multiple lines of text, you can combine text from two or more Output commands and then add spaces between the text to make it go to the next line in the desired location.

:Output(1,6,"Hello World
:Output(2,2,"Version 1.0
Utilize Automatic Wrapping
:Output(1,6,"Hello World Version 1.0

If you have a string of numbers that you are displaying, you do not need to put quotes around the numbers. You may want to keep the numbers in a string, though, if they have any leading zeros. Because the numbers are no longer in a string, the leading zeros will be truncated (taken off) and not be shown.

:Output(2,2,"2345
Remove the Quotes
:Output(2,2,2345

Although the Output and Disp commands can both be used to display text on the first line of the screen, Disp should usually be used. When the screen is clear, Disp automatically displays the text on the first line. Because you do not need to specify the row anymore, you just have to add spaces to the text to move it to the correct position.

In addition to replacing Disp with Output, you can also use Disp together with Output for displaying multiple things on one line. Since Disp automatically displays text on the left side of the screen (and everything else on the right side), you should use Disp to display text and then use the Output command to display the other things.

PROGRAM:OUTPUT
:ClrHome
:Disp "A*B+C=
:Output(1,8,AB+C

To use the Output command, you should first be in the Program editor for your program. In the Program editor, press the PRGM button, then arrow over to the I/O menu. Then, scroll down to Output and press ENTER. Now the Output command has been put into your program. You can then begin typing some text by turning on the alpha-lock with 2nd and ALPHA.

Removing the "Done" Message

Besides clearing the homescreen when exiting programs, you should also remember to remove the "Done" message that shows up after a program finishes executing. This "Done" message is a clear indicator that your program just finished running (which can be bad if you are in class and your teacher is near by), and it also does not look very good.

When you display text, a number, a variable, or an expression with a display command (either Disp or Output) on the last line of the program, you can remove the command and just put argument by itself. The argument will be displayed instead of the "Done" message that is normally displayed after a program finishes executing, and it will also be stored into the Ans variable.

:ClrHome
:Disp "Hello
Remove Disp
:ClrHome:"Hello

If you do not display any text on the last line, or you do not have any particular text that you want to be shown, you can still remove the "Done" message by just putting a single quotation mark. This will have the same effect, but there will be no text and the cursor will be placed on the second line.

:ClrHome
Put a quote
:ClrHome:"

Pausing Programs

The Pause command is used for suspending the execution of a program at a certain point. This is useful when you have text or instructions on the homescreen that you want the user to read before the program continues on to the next thing. While the program is paused, the pause indicator turns on in the top-right corner of the screen (it is the dotted line that moves around).

After the user is done reading the text or instructions, they must press ENTER to resume program execution. One place the Pause command is commonly used is right before clearing the screen with ClrHome, because otherwise the text on the screen will show up for a split second before it is erased. The Pause command gives the user ample time to look at and read the text.

Format
:Pause

The Pause command has an optional argument that can either be text, a number, a variable, or an expression. This argument will be displayed on the next available blank line on the homescreen while the program is paused, and it can be scrolled if it is larger than the screen. Although the Pause command can be used with the graphscreen, the argument will still be displayed on the homescreen.

Displaying text with the Pause command follows the same pattern as the Disp command, so text is displayed on the left and everything else is displayed on the right. It also means that if there is already text on the seventh row, it will automatically move everything up one row so it can display its text. Unlike the Disp command, however, Pause is not affected by the Output command and its text.

PROGRAM:PAUSE
:ClrHome
:"World!
:Disp " Hello "+Ans
:Output(2,2,"Goodbye
:Pause Ans

When you have a Disp command before a Pause command, you can take the text or variable from the Disp command and place it after the Pause command as its optional argument. This allows you to remove the Disp command. If the Disp command has multiple arguments, you just take the last one off and put it as the optional argument. The optional argument will also be stored into the Ans variable.

:Disp A
:Pause
Use Pause's Optional Argument
:Pause A

To use the Pause command, you should first be in the Program editor for your program. In the Program editor, press the PRGM key, scroll down to Pause and press ENTER (or press the 8 key). Now the Pause command has been put into your program. You can then begin typing some text for an optional argument by turning on the alpha-lock with 2nd and ALPHA.

Menus are used for organization, to provide a list of choices for the user to select from, as well as a good way for users to interact with and navigate programs. Although using the Menu command requires branching (which is generally frowned upon in most circumstances), the menu looks like a generic built-in menu, so it is familiar and easy to use for the user.

When the Menu command is encountered during a program, the menu screen is displayed with the specified menu title in white-on-black text on the top line and each menu item listed below on its own line, the pause indicator turns on, and execution pauses until the user selects a menu item. There is a cursor that the user can move up and down the menu to select a menu item.

Format
:Menu("Menu Title","Text 1",Label 1[,...,"Text 7",Label 7])

The menu title can be sixteen characters or less (because of the screen width), and must be enclosed in a pair of quotation marks. The menu title looks best if you center it on the screen (using spaces to fill in the rest of the line), so that the entire top line will be highlighted. You can also leave the menu title blank to give the illusion that there is no menu title by using two quotes side by side (i.e. "").

After the menu title, you put a comma and then the menu items. There are two parts to a menu item: the text that will be displayed on the screen and the label that program execution will continue at if the user presses ENTER on the menu item or presses its corresponding number. The text can be fourteen characters or less (because the menu item number is displayed on the left) and must be enclosed in a pair of quotation marks, and you have to separate the text and label with a comma.

PROGRAM:MENU
:Lbl NY
:Menu(" Select A Place ","NY",NY,"LA",NY,"MN",MN
:Lbl MN
:Disp "Good Choice!

The menu can have up to seven menu items (because of the screen height and the menu title on top). Since programs frequently need more than seven menu items, you will need to create another menu and then link to that menu from the first menu with one of the menu items. Similarly, you can also have two menu items go to the same label (you do not need two labels if they are right next to each other).

You can use a string variable for the menu title and menu item text instead of the text in quotes, which may sometimes be smaller if the text is used at other places in the program. Unfortunately, variables will not work for the menu item labels. Because the Menu command displays the menu screen instead of clearing the homescreen, you do not need to put the ClrHome command before it.

:ClrHome
:Menu("Choose","Right",1,"Wrong",2
Remove ClrHome
:Menu("Choose","Right",1,"Wrong",2

For many programs, including text-based programs (where menus are heavily used), there is a main menu that is used for navigating to the different parts of the program. While each program's main menu is unique, two of the most standard menu items on a main menu are Start and Quit -- Start goes to the beginning of the program, while Quit goes to the end. It is also fairly common to place a label right before the main menu, so you can return to it again later in the program.

To use the Menu command, you should first be in the Program editor for your program. In the Program editor, press the PRGM key, scroll down to Menu and press ENTER (or press ALPHA PRGM). Now the Menu command has been put into your program. You can then begin typing the menu title and menu items by turning on the alpha-lock with 2nd and ALPHA.

Test Yourself

  1. True or False: The ClrHome command should be used at the end of a program, to ensure that the program does not leave any leftover text on the homescreen.
    • True
    • False
  2. Which of the following uses of the Disp command returns an error?
    • Disp
    • Disp ""
    • Disp "Hello World
    • Disp "Hello","World
  3. Write a program called Area Finder that calculates the area of different shapes. Area Finder should use a menu to list the shapes, so once the user selects a shape, they then input the different measurements needed to find the area. Finally, the program should print out the area and exit. Remember to remove the "Done" message after exiting.

  4. Which of the following statements is true?
    • The homescreen is larger than the graphscreen.
    • The graphscreen is larger than the homescreen.
  5. What is the minimal modification that will allow this code to execute?
    :Menu("Choose One,"Menu Item",1,"Menu Item",2
    :Lbl A
    :Pause "Item 1
    :Stop
    :Lbl 2
    :Pause "Item 2
    
    • Add a closing quote on the menu title.
    • Remove the Stop command.
    • Change Lbl A to Lbl 1.
    • Add a closing quote on the menu title and change Lbl A to Lbl 1.
  6. The Output command can display text at any place on the screen, but what happens when the text goes past the end of the line?
    • Nothing. The text simply does not show up.
    • An error is returned.
    • The text will wrap around to the next line.
    • An ellipsis will be displayed at the end of the line, with the rest of the text not being displayed.
  7. True or False: You need to use a Pause command before clearing the screen, otherwise the user will only see the text on the screen for a couple seconds; it will be a blur.
    • True
    • False
  8. When is using the Menu command appropriate, and even desired? (Choose the best answer.)
    • If you want a generic menu.
    • Your program is going to be text-based.
    • It is the most practical menu available in your situation.
    • You want your program to stand out, so you need a fancy menu.
  9. What would be the effect of replacing a Disp command with an Output command and vice versa? Give any instances where this switch might be useful. Also, when would you use Disp in conjunction with Output?

  10. Which one statement is true about this code?
    :Menu("","",B,"",B
    :Disp "Test
    :Lbl B
    :Disp "Pizza
    :Output(1,1,"Spaghetti
    
    • An error will be returned when the Menu command is executed.
    • The program will execute, but there will not be any text displayed.
    • The "Test" text will be displayed along with the "Pizza" and "Spaghetti" text.
    • The "Pizza" and "Spaghetti" text will be displayed, but not the "Test".
  11. Why is removing the "Done" message important? (Choose the best answer.)
    • You do not want to leave behind any trace of the program.
    • There is no reason; it is just a personal choice.
    • The program looks more professional.
    • Who said it is important?
  12. True or False: Before using the Menu command, you need to clear the homescreen; you do not want to have any text interrupting the menu.
    • True
    • False
  13. Consider the following code:
    :0
    :Menu("Difficulty","Easy",3,"Medium",2,"Hard",1
    :Lbl 1:Ans+1
    :Lbl 2:Ans+1
    :Lbl 3:Ans+1
    

    The Ans variable keeps track of the last answer, often being used in place of more permanent variables. If the user selects the "Hard" menu item, what will Ans's value be? What effect does the label ordering have on the value, if any? Why?

  14. True or False: Using the homescreen is faster than using the graphscreen?
    • True.
    • False.
  15. Write a short story about yourself (maybe something funny) and then display it using the Disp command. As the Disp command can only display seven lines of text before the screen is scrolled, you should place Pause commands so that the user can read the text. Once you have the story written, you can put labels between the text to act as bookmarks and then use a Menu command to access the labels.