PANORAMIC: USER's GUIDE

FOR THE VERSION 0.9.27

PART 1 - REFERENCE LANGUAGE

MAIN PAGE / DOCUMENTATION


1 - GENERALITIES OF THE LANGUAGE

2 - FUNCTIONS FROM BASIC LANGUAGE

3 - COMMANDS FROM BASIC LANGUAGE


This software is named PANORAMIC because it is a "general-purpose" BASIC language, efficient in many different fields of application like:

- 3d world: loads MD2 and 3DS objects, primitive 3D objects, manage them (in position, size, color, texture), pilots a 3d light and a 3d camera,
- 2d world: move SPRITES on a background,
- handle (loads and plays) multimedia objects: sounds, musics, pictures, movies,
- draws on a plane (2d drawing): circles, rectangles, lines, polylines, points,
- creates and handles system objects (from Windows): button, list, combobox, bars, ...
- handles text files on the disk: read, write, creates, ...
- drives Excel software,
- enables mathematic computation: log, exp, sin, cos,...
- etc.

to the top


1 - GENERALITIES

PANORAMIC uses the classical BASIC syntax.
Not case-sensitive: nExT and NeXt have the same meaning.
REM (or single quote) for remarks: characters after REM are not evaluated.
Blanks can be inserted everywhere except inside a keyword or a variable name.
All the variables must be defined by keyword DIM, except system variables (for example TIME$, DATE$, DIR_CURRENT$).
Several commands can be on the same line, separated by "
:"
Uses different types of keywords: declaration (DATA,...), commands (PRINT,...), functions (SIN(30),...), system variables (TIME$,...), operators (AND,...).
A command can have up to 5 parameters.
"." is the decimal separator for the numbers.
If an error occurs, an explaining window is displayed and the program is stopped.

to the top

1.1 - Vocabulary

SYSTEM OBJECT: Operating System object: button, form, combo, scene3d, ...
TARGET: object used to receive all the commands
2D TARGET: object (as
form or picture) designated to receive all the 2D commands
3D TARGET: object (one scene3d among several scene3d) designated to receive all the 3D commands
3D OBJECT: element of a scene3d (3d_sphere, 3d_cone, 3d_torus, ...)
SPRITE OBJECT: picture which can be moved on a background (
scene2d) without disturbing it
COMMAND: an order to be executed immediately.
FUNCTION: an expression which returns a value. It is called with one or more parameters. Example:
sqr(2) returns 1.414
DECLARATION: keyword used to declare something (a label, a variable, )
SYSTEM VARIABLE: variable not defined by user, but used for its own value (
time$, date$, )
SUBROUTINE: group of commands which begins by a LABEL and ends with RETURN and which can be processed a certain number of times.

to the top

1.2 - Usage

1.2.1 Numbering

Every system object (button, list, ) must be created with an associated number. This number is used for any command applied on this object.
Every 3D object must be created with an associated number. This number is used for any 3D command applied on this object.
Every SPRITE object must be created with an associated number. This number is used for any SPRITE command applied on this object.
Numbers of SYSTEM OBJECTS, numbers of SPRITE OBJECTS and numbers of 3D OBJECTS are independent (no relationship): a 3D OBJECT can have a number assigned to a SYSTEM OBJECT or a SPRITE OBJECT.

to the top

1.2.2 Commands

The commands are grouped by families.

Examples :
Every command on a 3D object begins by 3D: 3d_x_position, 3d_z_rotate,
Every command to draw in the plane begins by 2D: 2d_circle, 2d_pen_color,
Every command on a SPRITE object begins by SPRITE:
sprite_position, sprite_hide, ...

to the top

1.2.3 - Brackets

A function has brackets: sin(x), width(N)
A command has no brackets.

to the top

1.2.4 - Commands and object number

All the commands on a SYSTEM object use the SYSTEM object number.
All the commands on a 3D object use the 3D object number.
All the commands on a SPRITE object use the SPRITE object number.

to the top

1.2.5 - Functions and object number

All the functions on a SYSTEM object use the SYSTEM object number.
All the functions on a 3D object use the 3D object number.
All the functions on a SPRITE object use the SPRITE object number.

to the top

1.2.6 - Target of 2D DRAWING commands

The "2D_" commands (to draw on an object) do not refer to an object number, but apply to the "2D_TARGETED" object.
The "2D_TARGET" object is FORM number 0 by default.
To change the "2D_TARGETED" object, use the command "2D_TARGET_IS N". N will be the new "2D_TARGETED" object.

to the top

1.3 - Variables

There are 3 types of variables:

real,
integer (the name is followed by %),
string (the name is followed by $)

a% is an integer (a%=14)
b$ is a string (b$="Hello")
d is a real (d=12.8953)

All the variables (simple and array) must be defined by DIM
DIM Abc, I%, Name$(20)

A variable name is composed of letters, numbers, the character underline (_) and can be ended by % or $. The first character cannot be a number.

A variable can be released by the command FREE.

to the top

1.4 - Arrays of variables

Use DIM to define an array of variable (integer, real or string).

dim a$(20) creates a string array of 21 elements. The first element is a$(0), the last one is a$(20)

To release an array of variable, use FREE without the number of elements: dim a$(20): free a$

to the top


2 - BASIC FUNCTIONS

2.1 - Mathematical functions

The BASIC classical mathematical function can be used:

ABS(X) Returns the absolute value of X.
ACOS(X) Returns the inverse cosine of X.
ASIN(X) Returns the inverse sine of X.
ATN(X) Returns the inverse tangent of X.
COS(X) Returns the cosine of X.
DEGREES Angles are expressed in degrees.
DEGREE_TO_RADIAN(X) Returns in radians the value of angle X expressed in degrees.
EVEN(X) Returns 1 if X is even, 0 otherwise.
EXP(X) Returns the value of e raised to power of X.
FRAC(X) Returns the fractional part of X.
HCOS(X) Returns the hyperbolic cosine of X.
HEX(V$) Returns a decimal value from a hexadecimal value V$.
HEX$(V) Returns a hexadecimal value from a decimal value V.
HSIN(X) Returns the hyperbolic sine of X.
HTAN(X) Returns the hyperbolic tangent of X.
INT(X) Returns the integer value of X.
LOG(X) Returns the natural logarithm (of base e) of X.
LOG10(X) Returns the logarithm base 10 of X.
LOG2(X) Returns the logarithm base 2 of X.
MAX(X,Y) Returns the greater of X and Y.
MIN(X,Y) Returns the lesser of X and Y.
MOD(X,Y) Returns the modulo of X and Y.
ODD(X) Returns 1 if X is odd, 0 otherwise.
POWER(X,Y) Returns X raised to the power of Y.
PI Returns 3.1415926535897932384626433832795
RADIANS Angles are expressed in radians.
RADIAN_TO_DEGREE(X) Returns in degrees the value of angle X expressed in radians.
RND(X) Returns a random value between 0 and X, but non equal to X.
SGN(X) Returns the sign of X.
SIN(X) Returns the sine of X.
SQR(X) Returns the square root of X.
TAN(X) Returns the tangent of X.
WRAP_VALUE(A) Returns a value that wraps the angle A between 0 and 360.

to the top

2.2 - Logical functions

- Implemented BASIC classical logical functions: AND, OR, NOT
- Brackets can be used.

These functions are used in an expression IF, WHILE, UNTIL and the result of evaluation is "TRUE" or "FALSE".
Ex: IF ((A>1) OR B+3<C-4)) AND ((D<>6 OR NOT(A<B)) THEN - - -

The following comparators can be used with numeric values:

= equal to
> greater than
< less than
<= or =< less than or equal to
>= or => greater than or equal to
>< or <> not equal to

But only the following comparators can be used to compare strings:

= equal to
>< or <> not equal to

to the top

2.3 - String functions

LEFT$(A$, N) Returns the left part of A$: takes N characters on the left of A$.
RIGHT$(A$, N) Returns the right part of A$: takes N characters on the right of A$.
LEN(A$) Returns the length of string A$ (that is the number of characters).
STRING$(N, C$) Returns a string with N times the character C$.
MID$(A$, 4, 2) Extracts the 2 characters of A$ from character number 4.
UPPER$(A$) Returns a string converting A$ into uppercase.
LOWER$(A$) Returns a string converting A$ into lowercase.
TRIM$(A$) Returns a string removing leading and trailing space from A$.
LTRIM$(A$) Returns a string removing leading space from A$.
RTRIM$(A$) Returns a string removing trailing space from A$.
NUMERIC(V$) Returns 1 if V$ can be evaluated to a numeric value, 0 otherwise.
INSTR(A$,B$) Returns the position of first character of B$ in A$.
INSTR_LAST(A$,B$) Returns the position in A$ of the last occurence of B$.
INSTR_POS(A$,B$,P) Returns the position of string B$ in the string A$ from position P.
INSTR_RIGHT(A$,B$) Returns the position in A$ of the first character of B$, counting from back to front.
INSERT$(A$, B$, P)

Returns a string made by B$ inserted into A$ in position P.

REVERSE$(A$) Returns the string in which the character order of S is reversed.
RIGHT_POS$(A$,P) Returns a string made with string A$ from position P.

to the top

2.4 - Conversions strings / numbers

VAL("123.4") Converts string "123.4" into its real value 123.4
STR$(123.4) Converts real value 123.4 into the string "123.4"
ASC(A$) Returns the ASCII code of the first character of A$
CHR$(V) Returns the character corresponding to the ASCII code of V

to the top

2.5 - Binary logical functions

BIN_AND(V1, V2) Returns the value of binary logical "AND" operation between V1 and V2
BIN_OR(V1, V2) Returns the value of binary logical "OR" operation between V1 and V2
BIN_XOR(V1, V2) Returns the value of binary logical "EXCLUSIVE OR" operation between V1 and V2

to the top

2.6 - Screen

Some system variables return the screen size in pixels:

SCREEN_X Returns the screen width in pixels.
SCREEN_Y Returns the screen height in pixels.

to the top

2.7 - Memory reading and writing

PEEK(A)

Returns the content (byte from 0 to 255) of address A.

POKE A,V

Places the value V (byte from 0 to 255) at address A.

to the top

2.8 - Decimal separator for floating number

SEPARATOR_IS_COMMA

Decimal separator for floating number is comma

SEPARATOR_IS_POINT

Decimal separator for floating number is point

to the top


3 - COMMANDS FROM BASIC LANGUAGE

3.1 - Structures

IF Condition THEN Statements

Executes "Statements" if Condition is True.

IF Condition

Group of Statements

END_IF

Executes "Group of Statements" if Condition is True.

IF Condition

Group of Statements A

ELSE

Group of Statements B

END_IF

Executes "Group of Statements A" if Condition is True, otherwise executes "Group of Statements B".

FOR Variable = Expression1 TO Expression2

Group of Statements

NEXT variable

Executes "Group of Statements" for Variable varying from Expression1 to Expression2.

A STEP is available for the FOR / NEXT loop: it defines the increment of the variable.

A command EXIT_FOR can be used to exit the loop FOR / NEXT.

WHILE Condition

Group of Statements

END_WHILE

Executes "Group of Statements" while "Condition" is True.

A command EXIT_WHILE can be used to exit the loop WHILE / END_WHILE.

REPEAT

Group of Statements

UNTIL Condition

Executes "Group of Statements" until "Condition" is True.

A command EXIT_REPEAT can be used to exit the loop REPEAT / UNTIL.

SELECT Expression

CASE Numeric Value
Group of Statements

CASE Numeric Value
Group of Statements

- - - -

END_SELECT

Executes "Group of Statements" after the CASE the Numeric Value of which matches with the result of evaluation of Expression.

to the top

3.2 - Label / Goto / Gosub

LABEL NAME Declaration of label (a label is a point of the program which receives a name, it can be the beginning of a subroutine or simply reached by GOTO)
NAME: Label (name given to a program point)
GOTO NAME Jumps to the label NAME
GOSUB NAME Jumps to the subroutine which begins by the label NAME
RETURN End of subroutine

to the top

3.3 - Subroutines

The subroutine ABC is called by its name: ABC()

It is defined by SUB :
SUB ABC
instructions
END_SUB

Parameters can be passed:
PRINTER(2)

SUB PRINTER(V)
PRINT V
END_SUB

By DIM_LOCAL, it is possible to define variables usable only inside a subroutine.

SUB ABC(P1,P2, ...)

Begins the subroutine ABC with parameters P1, P2, ...

END_SUB

Ends a subroutine.

EXIT_SUB

Quits a subroutine without executing END_SUB.

DIM_LOCAL

Defines one or several variables inside a subroutine.

to the top

3.4 Comment

REM or ' (single quote) Remark in the program (do nothing)

to the top

3.5 - End of execution

END Ends main program, stops there and waits for events
STOP Stops program execution. Display the number of the source line
TERMINATE Ends program and closes all. The memory is free
: Separates instructions on the same line

to the top

3.6 - Time and Date

These variables are predefined (no need to be defined).

TIME$ Returns current time.
DATE$ Returns current date.
DATE_YEAR Returns current year.
DATE_MONTH Returns current month.
DATE_DAY Returns current year.
TIME_HOUR Returns current hour.
TIME_MINUTE Returns current minute.
TIME_SECOND Returns current second.

to the top

3.7 - System commands

WAIT N Waits for N milliseconds (0<=N<=30000). The program is stopped until the delay is elapsed. No event can be treated.
PAUSE N Waits for N milliseconds (0<=N<=30000). The program is stopped until the delay is elapsed. However, all the pending treatments (events) are treated.
DISPLAY Updates and displays a 3D scene or 2D figures, then resumes the running of the program.
BEEP Generates a brief sound.
BEEP_ERROR Generates the error system sound.
BEEP_EXCLAMATION Generates the exclamation system sound.
BEEP_INFORMATION Generates the information system sound.
BEEP_QUESTION Generates the question system sound.

to the top

3.8 - Input data inside the program

DATA 10, 34, 71 Values defined in source file.
READ a Reads value from DATA line.
RESTORE Forces to read values from first DATA value.
RESTORE_LABEL Forces to read values (DATA) from label L.

to the top

3.9 - Input data from keyboard

INPUT V Variable V is assigned with the value input from keyboard till ENTER is pressed.
INKEY$ Scans one character of keyboard, then continues.

The command INPUT has options:

INPUT_MARK_ON Displays an interrogation mark when a command INPUT is executed.
INPUT_MARK_OFF Does not display an interrogation mark when a command INPUT is executed.
INPUT_REDO_ON Executes again the command INPUT if no read value.
INPUT_REDO_OFF Does not execute again the command INPUT if no read value.
INPUT_VISIBLE_ON Displays the stroke keys when a command INPUT is executed.
INPUT_VISIBLE_OFF Does not display the stroke keys when a command INPUT is executed.

By default, the behavior of the command INPUT is:

- INPUT_REDO_OFF: if no value is entered (only the key ENTER), there is no new input and the variable is:
set to 0 if it is a numeric variable,
set to the empty string ("") if it is a string variable.
- INPUT_MARK_OFF: no interrogation mark is displayed
- INPUT_VISIBLE_ON: the stroke keys are displayed

to the top

3.10 PRINT

- It is the classical BASIC PRINT to display a text or the value of an expression on a system object.
PRINT N can be used, PRINT "Hello" can be used.
- The semicolon ";" can be used to stick the prints: Example: PRINT "NUMBER =";N
- By default,
print is applied on FORM number 0, but another object can be designated by PRINT_TARGET_IS.
- It is possible to print in a system object at a given place in X and Y by
PRINT_LOCATE.

PRINT Goes to next line (print an empty line).
PRINT variable or expression Prints the result on the screen (or on the target object).
PRINT_LOCATE X, Y Defines the location of the next PRINT in X and Y.
PRINT_X_LOCATE X Defines the location of the next PRINT in X.
PRINT_Y_LOCATE Y Defines the location of the next PRINT in Y.

to the top

3.11 Variables and labels

NUMBER_VARIABLES Returns the number of created and predefined variables.
VARIABLE(T) Returns 1 if the string T represents a defined variable, 0 otherwise.
LABEL(T) Returns 1 if the string T represents an existing LABEL, 0 otherwise.

to the top

3.12 Current line number

NUMBER_CURRENT_LINE Returns the current line number.

to the top


Last update: January 22, 2016