miércoles, 14 de agosto de 2013

English user manual


&R0B^SI<






English user manual of
AndroBasic for Android
Version 001

Jordi Sorroche Pérez
jsptron@gmail.com
Barcelona in August 2013




What is AndroBasic?
It is an interpreter for the programming language BASIC (Beginners All-purpose Symbolic Instruction Code) specially designed for tablets with a screen resolution of 1280 x 800 pixels and operating system Android.


Operation and programming environment AndroBasic:
Running AndroBasic screen will appear with a blue background -editor and the subroutine SUB MAIN / END SUB- indicating that we can start programming.
At the top right we have some icons along with a menu with the following options:

New:
It creates a new program.

Undo:
Undo the last change made to the publisher.

Redo:
Redo the last change made to the publisher.

Run:
Will click on this option to run the program that is in that moment editor.

Load Program:
Allows loading a program from the internal SD-card-installed on our tablet to the
device memory.

We can also import files from email. To do this, open the e-mail in particular, keep the attachment (the program) and store it in the location (//SD/AndroBasic Programs) plain and simple.
Save Program:
With this option, you can save the program we found created in the internal SD-Card-
our tablet.
We can also export the program by email. To do this, we go to the file option-in Android-menu will (in the location / / SD / AndroBasic Programs). We choose what interests us, and give you the option 'share send mail Elec .. ', as an attachment, that simple.

Time Change Process:
It gives us the ability to change the processing time in the execution of a program-in
milliseconds between instruction and instruction. The default value is parameterized
10, being able to change this value to a minimum of 1 and a maximum of 2000 (2 seconds). This is important to note that you should not abuse really short time since our device has to process other tasks apart from our own, and that this may lead to
program malfunction. Not counting from overheating and excessive consumption
battery.

Help:
Tutorial program performance in English / Spanish.


About:
About creating AndroBasic.

Exit app:
Exits the application.


Our first program written in AndroBasic:
We make a simple program that will be called 'Hello World'.
In the editor, inside the subroutine Sub Main / End Sub, write Print "Hello World"
the program would look like:

Sub Main
Print "Hello World"
End Sub

Now let's run it by clicking on the icon 'Run'.
We see that displayed the phrase 'Hello World'.


Detailed instructions/functions of the Basic language that supports AndroBasic alphabetical order:

ABS
Returns the absolute value.
Example:
x = -1
Print Abs (x)
Result:
1

ACOS
Returns the cosine of an angle expressed in radians.
Example:
x = 0.4
Print Acos (x)
Result:
1.15928

ACOSD
Returns the cosine of an angle in degrees.
Example:
x = 0.4
Print Acosd (x)
Result:
66.42182

ASC
Returns a number corresponding to the ASCII character code (American Standard Code for Information Interchange).
Example:
x = "@"
Print Asc (x)
Result:
64

ASIN
Returns the sine of an angle in radians.
Example:
x = 0.4
Print Asin (x)
Result:
0.41152

ASIND
Returns the sine of an angle in degrees.
Example:
x = 0.4
Print Asind (x)
Result:
23.57818

ATAN
Returns the tangent angle in radians.
Example:
x = 0.4
Print Atan (x)
Result:
0.38051

ATAND
Returns the tangent angle in degrees.
Example:
x = 0.4
Print Atand (x)
Result:
21.80141

BEEP
Generates a short duration sound.

BUTTONS OFF
Screen Hides the five buttons.

BUTTONS ON
Are displayed five buttons that can control button has been pressed by internal system variable but.
These are the values returned by the variable but when one of the five buttons:
button1 = 1, button2 = 2, Button3 = 3, button4 = 4 and Button5 = 5.
To initialize but we can use the value 0: but = 0.

CALL
Calls the subroutine with the specified name.
Example:
Call namesubroutine

CHR
Give a character corresponding to the ASCII numeric code value.
Example:
x = 64
Print Chr (x)
Result:
@

CLS
Clears the screen.

COLORINK
Sets the foreground color according to the color code [code table look color].
Example:
x = 5
Colorink (x)
Print "Hello"
Result:
Hello [is displayed in green text]

COLORPAPER
Defines the background color according to the color code [code table look color].
Example:
x = 4
Colorpaper (x)
Result:
[Background is displayed red screen]

COS
Returns cosine in radians.
Example:
x = 0.4
Print Cos (x)
Result:
0.92106

COSD
Returns cosine in degrees.
Example:
x = 0.4
Print COSD (x)
Result:
0.99998

DO
Start the loop Do ... Loop ...

DO UNTIL
Start the loop Do Until ... Loop… and the cycle continues until the condition is met.

DO WHILE
Start the loop Do While ... Loop ...and the cycle continues while the condition is met.

ELSE
Yes preceded condition If ... Then is not met, the instructions are processed just
under to End If Else.

ELSEIF ... THEN
Does the same function but adding Else exclusive status.

END IF
Ends the conditional If...Then / Else.

END SUB
Ends the subroutine Sub ... End Sub.

EXIT DO
Exits the loop Do ... Loop ...

EXIT FOR
Exits the For ... Next loop.

EXIT SUB
Exits the subroutine Sub ... End Sub.

FLOOR
Returns the full.
Example:
x = 1.4
Print Floor (x)
Result:
1

FOR ... TO ... STEP
Start a For ... Next loop to a number of times.

IF ... THEN
Determines two or more elements and if satisfied, the instructions are processed just below of If ... Then to Else / End If.

INPUTBOX
Collect the data entered by the user and transfers them to a variable.
Example:
Inputbox "Enter a name"; x
Print "The name entered is" & x
Result:
Enter a name [David]
The entered name is David

LEN
Returns the length of a string.
Example:
x = "Barcelona"
Print Len (x)
Result:
9

LINE
Draw a colored line [look Codes table color]to the coordinates X and Y -End.
The initial x and y coordinates the instruction provides Point or possibly, the last time instruction is called Line.
If not called for the first time to the instruction value Point origin of coordinates X and Y be worth 0.
Example:
Point (0,400,6) [X, Y, Colour]
Line (1280,400,6) [X, Y, Colour]
Result:
[Draws a horizontal line in the center of the screen in blue]

LN
Give the logarithm base e.
Example:
x = 1000
Print Ln (x)
Result:
6.90775

LOG
Take the logarithm base 10.
Example:
x = 1000
Print Log (x)
Result:
3

LOGARITHM
Give the logarithm in any base.
Example:
x = 1000
b = 10 [base]
Print Logarithm (x, b)
Result:
3

LOOP
Closes the Loop Do ... Loop and the cycle continues.

LOOP UNTIL
Shut Do ... Loop Until loop and the cycle continues until the condition is met.

WHILE LOOP
Shut Do ... Loop While loop and the cycle continues while the condition is met.

MAX
Returns two numbers the largest.
Example:
Print Max (4.9)
Result:
9

MID
Select characters from a string starting position to a specified length.
Example:
x = "Barcelona"
Print Mid (x, 4,3)
Result:
cel

MIN
Returns between two numbers is the smallest.
Example:
Print Min (9.4)
Result:
4

MOD
Returns the remainder after a number is divided by a divisor.
Example:
Print Mod (3.2) [number, divisor]
Result:
1

MSGBOX
Shows in the upper display text and wait for it to click 'OK'.
Example:
Msgbox "Think of a number"
Result:
Think for a number

NEXT
Closes For ... Next loop and continues the cycle.

PAUSE
Stops program execution for a time in milliseconds.
Example:
Pause (1000)
Result:
[Stop the process in 1 sec.]

POINT
Draw a colored point [see the table of codes color] in the X and Y.
Example:
Point (640,400,6) [X, Y, Colour]
Result:
[Draws a point at the center of the screen in blue]

POWER
Raised to the power.
Example:
x = 2
e = 8
Print Power (x, e)
Result:
256 [the value 2 is raised to the power of 8]

PRINT
Prints on a text screen.
Example:
Print "Hello World"
Result:
Hello World

RANDOMIZE
Initializes the seed of the pseudo random sequence based on the internal system clock.

REM
There is no process simply can comment on the different lines of our program.
Example:
Rem encryption process

RND
Generates a pseudo-random number between min and max range (inclusive).
Example:
min = 1
max = 10
Print Rnd (min, max)
Result:
4

ROUND
Rounds a number.
Example:
x = 1.5
Print Round (x)
Result:
2

SIN
Returns the sine in radians.
Example:
x = 0.4
Print Sin (x)
Result:
0.38942

SIND
Returns the sine in degrees.
Example:
x = 0.4
Print Sind (x)
Result:
0.00698

SQRT
The square root.
Example:
x = 2
Print Sqrt (x)
Result:
1.414214

STOP
Stops the execution of the program.

SUB
Name the subroutine Sub ... End Sub.
Example:
Sub namesubroutine

TAN
Returns the tangent in radians.
Example:
x = 0.4
Print Tan (x)
Result:
0.42279

TAND
Returns the tangent in degrees.
Example:
x = 0.4
Print Tand (x)
Result:
0.00698


Special features AndroBasic Basic language:
They are not admitted the colon ':' to separate instructions / functions on the same line.
In a conditional-Then statement after and on the same line, there can be nothing writing.
The variables are not sensitive if they are written in upper / lower case and are converted uppercase internally.
Conditionals in parentheses are not admitted.
Pets are only 30 parameters per line maximum.
Programs can not contain more than 2,000 lines.
The constants PI and E are written as CPI and CE respectively.
Both variables and the matrix are of generic, ie can contain numbers or chains. EG: a = 5 or a = "hello".
Variables / array is not declared.
It is not necessary to initialize variables / array but is recommended, especially in calculations math.
You can use up to 100 variables.
We can only use an array called matrix (a, b) where 'a' index and 'b' the subscript
Table. The maximum value for the array index is 10,000 by subscripts 10.
Can be used up to 100 subroutines.
At any time during the execution of a program, we simply abort clicking the icon 'Back' at the bottom-left of the screen.


Arithmetic operators:

+   [Addition]
-    [Abduction]
*   [Multiplication]
/    [Division]
^   [Exponentiation]
%  [Module arithmetic]


Relational operators:

=   [Equals]
<> [Not equal to]
<   [Is less than]
>   [Is greater than]
<= [Is less than or equal to]
>= [Is greater than or equal to]


String operators:

& [Connection string]


Logical operators:

And [two items are true]
Or [At least one of the elements is true]
Xor [Only one element is true]


Color codes:

0 = black
1 = dark gray
2 = medium gray
3 = light gray
4 = red
5 = green
6 = Blue
7 = Yellow
8 = magenta
9 = cyan
10 = white


List of errors:

Nº1: 'If' without 'Else / ElseIf / End If'
Nº2: Program without 'Sub Main'
Nº3: Too many parameters per line: (max.30)
Nº4: Syntax
Nº5: General process
Nº6: Calculation parameters
Nº7: Expected 'End Sub'
Nº8: 'For' without 'Next'
Nº9: 'Next' without 'For'
Nº10: 'Exit For' without 'Next'
Nº11: 'Call X' not found
Nº12: 'Exit Sub' without 'End Sub'
Nº13: 'Do Until' without 'Loop'
Nº14: 'Loop' without 'Do Until / Do While'
Nº15: 'Exit Do' without 'Loop'
Nº16: 'Do While' without 'Loop'
Nº17: 'Loop Until' without 'Do'
Nº18: 'Loop While' without 'Do'
Nº19: 'Else' without 'End If'
Nº20: Too many variables (max.100)



No hay comentarios:

Publicar un comentario