Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

TI-Basic Z80 Programming/Output

From Wikibooks, open books for an open world
<TI-Basic Z80 Programming

There are a few different ways to display text and values to the screen in TI-Basic. These includeDisp,Output,Pause andText. We'll cover each of their uses and their syntaxes.

Disp

[edit |edit source]

Disp (PRGMI/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]
  • WherevalueA, etc., are strings or values

To printStr1 to the home screen:

Disp Str1

To printX 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 usesDisp:

ClrHome
3.14→X
Disp "THE VALUE OF
Disp "X IS"
Disp X
THE VALUE OFX 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 (PRGMCTL 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 pressesENTER to resume. If text is passed as an argument, the specified text will be displayed.

:Pause [value]:Pause [value,time]
  • Wherevalue is a string or value
  • Wheretime is a time defined in seconds. Time is rounded up to the next tenth.

Some examples ofPause:

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

Text displayed withPause 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 untilENTER is pressed:

Pause


Text

[edit |edit source]

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)
  • Whererow is the pixel row for the bottom of text to be printed on
  • Wherecolumn is the pixel column for the left of the text to start printing at
  • Wheretext1, 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 usingText:

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 (PRGMI/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)
  • Whererow is the vertical positioning of the output. A value of1 prints on the first row, etc.
  • Wherecolumn is the horizontal positioning of the output. A value of1 prints on the first column, etc.
  • Where"text" orvalue is the text or value to be displayed to the screen.
Output(2,6,"WIKIBOOKS")

In this example, the calculator would displayWIKIBOOKS 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 perOutput statement.


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

Retrieved from "https://en.wikibooks.org/w/index.php?title=TI-Basic_Z80_Programming/Output&oldid=4058415"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp