SmallBASIC GuideThe language | Programming Tips | Commands | System | Graphics & Sound | Miscellaneous | File system | Mathematics | 2D Algebra | Strings | Console | Glossary |
Console Commands
Command:
PRINT
[USING [format];] [expr|str [,|; [expr|str]] ...
Displays a text or the value of an expression.
PRINT SEPARATORS
| TAB(n) |
Moves cursor position to the nth column. |
| SPC(n) |
Prints a number of spaces specified by n. |
| ; |
Carriage return/line feed suppressed after printing. |
| , |
Carriage return/line feed suppressed after printing. |
The PRINT USING
Print USING, is using the FORMAT() to display numbers and strings.
Unlike the FORMAT, this one can include literals, too.
| _ |
Print next character as a literal. The combination _#, for |
| [other] |
Characters other than the foregoing may be included as |
*, When a PRINT USING command is executed the format will remains
on the memory until a new format is passed.
Calling a PRINT USING without a new format specified the PRINT
will use the format of previous call.}
Examples:
PRINT USING "##: #,###,##0.00";
FOR i=0 TO 20
PRINT USING; i+1, A(i)
NEXT
....
PRINT USING "Total ###,##0 of \ \"; number, "bytes"
*, The symbol ? can be used instead of keyword PRINT
You can use 'USG' instead of 'USING'.}
Function:
CAT
(x)
Returns a console codes
| 0 |
reset |
| 1 |
bold on |
| -1 |
bold off |
| 2 |
underline on |
| -2 |
underline off |
| 3 |
reverse on |
| -3 |
reverse off |
PalmOS only:
| 80..87 |
select system font |
| 90..93 |
select custom font |
Example:
? cat(1);"Bold";cat(0)
Command:
INPUT
[prompt ,|;] var[, var [, ...]]
Reads from "keyboard" a text and store it to variable.
Command:
LINPUT
var
Command:
LINEINPUT
var
Command:
LINE-INPUT
var
Reads a whole text line from console.
Function:
INKEY
0
This function returns the last key-code in keyboard buffer, or
an empty string if there are no keys.
Special key-codes like the function-keys (PC) or the hardware-buttons
(PalmOS) are returned as 2-byte string.
Example:
k=INKEY
IF LEN(k)
IF LEN(k)=2
? "H/W #"+ASC(RIGHT(k,1))
ELSE
? k; " "; ASC(k)
FI
ELSE
? "keyboard buffer is empty"
FI
Command:
CLS
0
Clears the screen.
Command:
AT
x, y
Moves the console cursor to the specified position.
x,y are in pixels
Command:
LOCATE
y, x
Moves the console cursor to the specified position.
x,y are in character cells.
[Prev] [Next]