Mark Wickens

back to CONTENTS…

Casio Basic - Language Reference

This documentation is reproduced from the Casio FX-850P Owners Manual.

Alphabetic Command Index

All commands are reserved words.

Command Description Manual Page
&H Converts the 1 through 4-digit hexadecimal value following &H to a decimal value 155
ABS Returns the absolute value of the argument 137
ACS Returns the character code corresponding to the character in the first (leftmost) position of a string 147
AND Logical AND operator 58
ANGLE Specifies the angle unit 129
ASC Returns the value of the Inverse Cosine trigonometric function for the argument 131
ASN Returns the value of the Inverse Sine trigonometric function for the argument 131
ATN Returns the value of the Inverse Tan trigonometric function for the argument 131
BEEP Sounds the buzzer 117
CHR$ Returns a single character which corresponds to the specified character code 146
CLEAR Clears all variables and determines the variable area size in accordance with the parameter entered 89
CLOSE Closes files and declares an end to the use of the I/O (input/output) buffer 162
CLS Clears the display screen 115
COS Returns the value of the Cosine trigonometric function value for the argument 130
CUR Returns cube root of argument 136
DATA Holds data for reading by the READ statement 108
DEFSEG Specifies segment base address 125
DEG Converts a sexagesimal value to a decimal value 156
DIM Declares an array 121
DMS$ Converts a decimal value to a sexagesimal string 157
EDIT Enters the BASIC edit mode 93
ELSE Executes the THEN statement or GOTO statement when the specified condition is met. The ELSE statement is executed when the specified condition is not met 103
END Terminates program execution 96
EOF Indicates the end of file reading 166
ERASE Erases a specified array 122
ERL Returns the number of a line in which an error has been generated 128
ERR Returns the error code which corresponds to a generated error 128
ERROR Specifies the line number to which execution branches when an error is generated 126
EXP Returns the value of the exponential function for the argument 134
FACT Returns the factorial of argument 142
FIX Returns the integer part of the argument 139
FOR Executes the program lines between the FOR statement and NEXT statement and increments the control variable, starting with the initial value. Execution is terminated when the value of the control variable exceeds the specified final value 104
FRAC Returns the fractional part of the argument 140
FRE Returns memory area size in accordance with argument 91
GOSUB Jumps to a specified subroutine 99
GOTO Branches unconditionally to a specified branch destination 98
HEX$ Returns a hexadecimal string for a decimal value specified in the argument 154
HYP ACS Returns the value of the Inverse Hyperbolic Sine trigonometric function for the argument 133
HYP ASN Returns the value of the Inverse Hyperbolic Cosine trigonometric function for the argument 133
HYP ATN Returns the value of the Inverse Hyperbolic Tan trigonometric function for the argument 133
HYP SIN Returns the value of the Hyperbolic Sine trigonometric function for the argument 132
HYP COS Returns the value of the Hyperbolic Cosine trigonometric function for the argument 132
HYP TAN Returns the value of the Hyperbolic Tan trigonometric function for the argument 132
IF Executes the THEN statement or GOTO statement when the specified condition is met. The ELSE statement is executed when the specified condition is not met 103
INKEY$ Assigns a single character input from the keyboard to a variable 119
INPUT Assigns keyboard data input to a variable 118
INPUT$ Assigns a specified number of characters from the keyboard to a variable 120
INPUT# Reads data from a sequential file 164
INT Returns the largest integer which does not exceed the value of the argument 139
LEFT$ Returns a substring of a specified length counting from the left of a string 153
LEN Returns a value which represents the number of characters contained in a string 154
LET Assigns the value of an expression on the right side of an equation to the variable on the left side 107
LIST Displays all or a part of the current specified program 92
LIST ALL Displays all programs in sequence from area P0 through P9 92
LIST# Displays all DATA BANK data 170
LLIST Outputs program contents to the printer 158
LLIST# Outputs all DATA BANK data to printer 171
LN Returns the value of the Natural Logarithm function for the argument 135
LOAD Reads a file into memory 168
LOAD ALL Reads ALL files from cassette tape into areas P0 to P9 168
LOAD# Reads data into DATA BANK area 172
LOCATE Moves the cursor to a specified position on the virtual screen 114
LOG Returns the value of the Common Logarithm function for the argument 135
LPRINT Output text to the printer 159
MID$ Returns a substring of a specified length from a specified position within a string 151
MOD Arithmetic Operator giving the remainder of division with the sign of the dividend 57
NCR Returns the combination nCR for the values of n and r 143
NEW Deletes a program  
NEW ALL Clears the programs in all program areas and all variables 89
NEW# Clears DATA BANK data 170
NEXT Executes the program lines between the FOR statement and NEXT statement and increments the control variable, starting with the initial value. Execution is terminated when the value of the control variable exceeds the specified final value 104
NOT Logical Negation Operator 57
NPR Returns the permutation nPr for the values of n and r 143
ON ERROR GOTO Specifies the line number to which execution branches when an error is generated 126
ON GOTO Jumps to a specified branch destination in accordance with a specified branching condition 101
ON GOSUB Jumps to a specified subroutine in accordance with a specified branching condition 102
OPEN Declares a file open for use 161
OR Logical OR operator 58
PASS Specifies or cancels a password 88
PBGET Reads the data file contents under the specified filename and assigns them to $ variable, A() array or A$() array 82
PBLOAD Load PB-100 series programs from cassette tape 80
PBLOAD# Reads data from the specified filename into the DATA BANK 82
PBLOAD ALL Loads all PB-100 series programs from cassette tape 80
PEEK Returns the value stored at the specified memory address 123
PI Returns the value of π 142
POKE Writes data to a specified address 124
POL Converts rectangular coordinates (x,y) to polar coordinates (r, θ) 144
PRINT Displays data on the screen 111
PRINT Outputs data to a sequential file 163
RAN# Returns a random value in the range of 0 to 1 141
READ Reads the contents of the DATA statement into memory 109
READ# Reads data from DATA BANK area 173
REC Converts polar coordinates (r, θ) to rectangular coordinates (x,y) 145
REM Allows remarks or comments to be included within a program. This command is not executed. 106
RESTORE Specifies a DATA line for reading by the READ statement 110
RESTORE# Searches specific data in the DATA BANK area and changes the read sequence of DATA BANK data 174
RESUME Returns from an error handling routine to the main routine 127
RETURN Returns execution from a subroutine to a main program 100
RIGHT$ Returns a substring of a specified length counting from the right of a string 152
ROUND Rounds the argument at the specified digit 140
RUN Executes a program 94
SAVE Saves a program to a specified file 167
SAVE ALL Saves ALL outputs programs from areas P0 through P9 to cassette tape as an ALL file 167
SAVE# Output DATA BANK data to file specified by file descriptor 171
SET Specifies output format of numerical data 116
SGN Returns a value which corresponds to the sign of the argument 138
SIN Returns the value of the Sine trigonometric function value for the argument 130
SQR Returns the square root of the argument 136
STEP Executes the program lines between the FOR statement and NEXT statement and increments the control variable, starting with the initial value. Execution is terminated when the value of the control variable exceeds the specified final value 104
STOP Temporarily halts program execution 97
STR$ Converts the argument (numeric value or numeric expression value) to a string 148
TAB Outputs a horizontal tab specification to the screen or printer 113
TAN Returns the value of the Tan trigonometric function value for the argument 130
THEN Executes the THEN statement or GOTO statement when the specified condition is met. The ELSE statement is executed when the specified condition is not met 103
TROFF Cancels the trace mode 95
TRON Specifies the trace mode 95
VAL Converts a numeric character string to a numeric value 149
VALF Performs calculation of numeric expression expressed as string, and returns the result 150
VARLIST Displays variable names and array names 93
VERIFY Verifies the contents of a file stored on cassette tape 169
WRITE# Rewrites and deletes DATA BANK data 175
XOR Logical XOR operator 58

Operators

Arithmetic Operators

Symbol(s) Description
+, - Signs
+ Addition
- Subtraction
* Multiplication
/ Division
^ Power
¥ Integer division
MOD Integer remainder of integer division

Relational Operators

Symbol(s) Description
= Equal to
<>, >< Does not equal
< Less than
> Greater than
=<, <= Less than or equal to
=>, ‘>= Greater than equal to ~

Logical Operators

Symbol(s) Description
NOT Negation
AND Logical product
OR Logical sum
XOR Exclusive OR

String Operators

Symbol(s) Description
+ Concatenation

Order of Operations

Arithmetic, relational and logical operations are performed in the following orer of precedence:

  1. (,)
  2. Scientific function
  3. Power
  4. Sign ( +,- )
  5. *, /, ¥, MOD
  6. Addition and subtraction
  7. Relational operators
  8. NOT
  9. AND
  10. OR, XOR

Reserved Words

Reserved words not listed in the command section.

Command
AS
CALC
CSR
DEF
KEY
MID
MODE
OUT
PUT
RND
TO
VAC
VAR

Errors

See the Error Reference Page.

Calculation Range

± 1 × 10⁻⁹⁹ ~ ± 9.9999999999 × 10⁻⁹⁹ and 0. Internal operation uses 12-digit mantissa.

Variable Types

The three following types of variables are available for use with this unit.

  1. Numeric variables (up to 12-digit mantissa) A, a, NUMBER, POINTS
  2. String variables (up to 255 characters) A$, STRING$
  3. Array variables:
    • Numeric array A(10), XX(3,3,3)
    • String array A$(10), ARRAY$(2,2)

Variable Names

Arrays

  1. Arrays are declared by DIM statements.
  2. Elements are described by subscripts which are integers greater than 0. Fractions are discarded.
  3. The number of dimensions is limited by stack capacity.
  4. The maximum value of subscripts is limited by memory capacity.

Variable/Array Application

  1. Variables and arrays can be used jointly by all program areas.
  2. Arrays cannot be used unless first declared using the DIM statement.

Counting Bytes Used by Variables

The following outlines the number of bytes reserved when a variable appears the first time within a program.

EXAMPLE:

DIM XYZ(3,3,5,2)

String Array Variables (variable name length + 4) + (array size) + (dimension x 2) bytes in variable area.

The lengths of individual strings are required in the variable area when strings are assigned to the array.

EXAMPLE:

10 DIM ABS$(3,3)
20 AB$(0,0) = "*****"

Calculating Program Length The following shows points which must be considered when calculating memory requirements for programs.

EXAMPLE:

10 A = SIN X

2 (line number) + 1 (space following line number) + 1 (A) + 1 (=) + 2 (SIN) + 1 (space) + 1 (X) + 1 (EXE) + 1 = 11

The calculation indicates that a total of 11 bytes are required for storage of the above program.