TI-Basic Z80 Programming/Output
There are a few different ways to display text and values to the screen in TI-Basic. These include Disp, Output, Pause and Text. We'll cover each of their uses and their syntaxes.
Disp ( I/O 3) displays text or values to the home screen. It creates a new line on the home screen and prints the text left-aligned for strings, and right-aligned for values.
- Where valueA, etc., are strings or values
Str1 to the home screen:
X to the home screen:
To print a literal string or value to the home screen:
There can be multiple expressions or variables with each having its own line:
An example of a simple program that uses Disp:
THE VALUE OF X IS 3.14
If you try to print a string or value that is longer than 16 tokens, it will be trimmed and appended with an ellipse:
If no arguments are added, the home screen is displayed.
THE VALUE OF X ... 3.14
Pause ( CTL 8) freezes the program mid-execution and can optionally display text as well. When a pause token is reached in the program, execution pauses until the user presses to resume. If text is passed as an argument, the specified text will be displayed.
:Pause [value] :Pause [value,time]
- Where value is a string or value
- Where time is a time defined in seconds. Time is rounded up to the next tenth.
Some examples of Pause:
Text displayed with Pause can longer than 16 tokens. However, you will need to use the left and right arrow keys to scroll along the text. If no text is provided, the program will simply pause untilis pressed:
Text ([DRAW] DRAW 0) draws small font text to the graph screen. It has precise X and Y coordinate positioning, and can print several values or strings.
- Where row is the pixel row for the bottom of text to be printed on
- Where column is the pixel column for the left of the text to start printing at
- Where text1, etc., are strings or values
- Notice that this command inverts the x and y coordinates when displaying text and that it starts from the upper left 1,1 coordinate.
Some examples of using Text:
If the first argument passed is
-1, Text will draw with the standard font:
Output ( I/O 6) is used for displaying values or strings on the home screen. Output will override anything that the displayed characters may overlap with that is previously on the screen.
- Where row is the vertical positioning of the output. A value of 1 prints on the first row, etc.
- Where column is the horizontal positioning of the output. A value of 1 prints on the first column, etc.
- Where "text" or value is the text or value to be displayed to the screen.
In this example, the calculator would display
WIKIBOOKS at 2 rows down (from the top of the screen) and 6 columns over (from the left of the screen). Notice that to display a string, the string must be enclosed in quotation marks. Make sure to separate values of row column and display value with commas.
- To display a numerical value, do NOT place quotes around the value, as it is not a string.
- Only one value can be displayed per Output statement.