Jump to content

TI-Basic Z80 Programming/Output

From Wikibooks, open books for an open world

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 (PRGM 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.

Disp [valueA,valueB,valueC,...,valueN]
  • Where valueA, etc., are strings or values

To print Str1 to the home screen:

Disp Str1

To print X to the home screen:

Disp X

To print a literal string or value to the home screen:

Disp "HEY!"
Disp 3/2

There can be multiple expressions or variables with each having its own line:

Disp "HELLO","WORLD"

An example of a simple program that uses Disp:

ClrHome
3.14→X
Disp "THE VALUE OF
Disp "X IS"
Disp X
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:

ClrHome
3.14→X
Disp "THE VALUE OF X IS"
Disp X

If no arguments are added, the home screen is displayed.

THE VALUE OF X ...

            3.14

Pause

[edit | edit source]

Pause (PRGM 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 ENTER 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:

Pause "Please press ENTER to continue"
Pause "Resuming in 3 seconds.",3

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 until ENTER is pressed:

Pause


Text (2ND [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.

Text(row,column,text1,text2,...,text n)
  • 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:

Text(1,1,"Hi!")
Text(20,20,A+B)

If the first argument passed is -1, Text will draw with the standard font:

Text(-1,20,40,"Big text!")

Output

[edit | edit source]

Output (PRGM 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.

Output(row,column,"text")
Output(row,column,value)
  • 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.
Output(2,6,"WIKIBOOKS")

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.


Previous: Basic Variables
Next: Input
Table of Contents: TI-Basic Z80 Programming