Mobile BASIC Phone Edition

Mobile BASIC is a programming language for mobile phones and PDA supporting the MIDP-1.0 / CLDC-1.0 environment. This manual documents the commands, operators and functions that are available to a Mobile BASIC programmer.

Operators

Operators are used during expression evaluation to indicate the computations that are performed on variables and constants. There are four main groups of operators that are used within Mobile BASIC and these are: Arithmetic Operators, Relational Operators, Logical Operators and Bitwise Operators. In addition there are also parenthesis operators that allow you to change the order of evaluation.

Operators are either binary or unary operators. Binary operators work on two data items, the expression, variable or constant immediately before the operator, together with the expression, variable or constant that follows the operator. Unary operators work on the expression, variable or constant that follows the unary operator.

Arithmetic Operators

ADD
SUB
MULT
DIV
POWER
UMINUS

Relational Operators

EQ
NE
LT
LE
GT
GE

Logical Operators

Logical operators are usually used to combine the results of relational operators in order to make more complex expressions. The result of a logical operator will be either true (1) or false (0).

NOT
AND
OR

Bitwise Operators

BITAND
BITOR
BITXOR

Parenthesis amd Operator Precedence

PARENTHESIS
PRECEDENCE

Commands

BLIT
CLOSE #
CLS
DATA
DEG
DELETE
DIM
DIR
DRAWARC
DRAWGEL
DRAWLINE
DRAWRECT
DRAWROUNDRECT
DRAWSTRING
EDIT
END
ENTER
FILLARC
FILLRECT
FILLROUNDRECT
FOR NEXT LOOP
GELGRAB
GELLOAD
GET #
GOTO
GOSUB
IF ... THEN ...
INPUT
INPUT #
LIST
LOAD
NEW
NOTE #
OPEN #
PLOT
POINT #
POP
PRINT
PRINT #
PUT #
RAD
READ
REM
RESTORE
RETURN
SAVE
SETCOLOR
SLEEP
SPRITEGEL
SPRITEMOVE
STOP
TRAP

Functions

All functions within Mobile BASIC are used within expressions. Each functions name is followed by a left parenthesis and a comma separated list of one or more parameters terminated by a right parenthesises.

Mathematical Functions

ABS
ACOS
ASIN
ATAN
COS
EXP
LOG
MOD
SIN
SQR
TAN

User Interface Functions

CHOICEFORM
DATEFORM
EDITFORM
GAUGEFORM
MESSAGEFORM

Graphics Functions

GELHEIGHT
GELWIDTH
ISCOLOR
NUMCOLORS
SCREENHEIGHT
SCREENWIDTH
SPRITEHIT
STRINGHEIGHT
STRINGWIDTH

Date and Time Functions

YEAR
MONTH
DAY
DAYS
HOUR
MINUTE
SECOND
MILLISECOND
MILLISECONDS

Game Functions

The MIDP specification defines various facilities that are useful for games programming. These take the form of Up, Down, Left, Right and Fire buttons together with 4 game specific keys known as GAME A, GAME B, GAME C and GAME D. How these features are physically implemented is left to the hardware designers:- For instance, UP, DOWN, LEFT, RIGHT and FIRE could be implemented using a cursor pad, a joystick or simply the phones numeric keypad.

Mobile BASIC provides access to these features via a series of functions that simply return a non zero value if the key is pressed or zero if the key is not pressed.

DOWN
FIRE
GAMEA
GAMEB
GAMEC
GAMED
LEFT
RIGHT
UP

String Functions

String variables are denoted by the variable name ending with a "$" character. String constants are defined by a text string enclosed within double quotation marks.

ASC
CHR$
LEFT$
LEN
MID$
RIGHT$
STR$
VAL

Miscellaneous Functions

ERR
FRE
PROPERTY$
READDIR$
RND