Introduction
In Android6.0 or higher, on
startup,
The permissions dialog is appeared to ask
whether to allow save on SD-card.
When using
external SD-card for save,
Please select
'Allow'.
Execution
run ,i Interpreter mode
Although not speedy but outputs an exact error
message.
Debugging by step execution can be
performed.
run
,c Intermediate code compile
execution mode
It
changes into an original intermediate code, and executes at high speed.
When a switch is omitted, it becomes intermediate
code compile mode.
Free area (flexible)
Although user memory which
can be used by program list is
set as
quantity sufficient by default, even if it exceed this value,
it is in system that upper limit goes up
automatically in the model's capacity range.
The
user memory size of variable and arrangement can be re-set up in the 'clear'
statement.
Keys
Arrow-keys: Movement of a cursor. The cursor
can move also at touch panel.
Enter:
Determination of an input. The input of a program. Direct command.
Stop: Interruption of the program.
Space: Eraseacharacterbyspace.
Bs: Back space and erasing one character.
Del: Immobility position and erasing one
character.
Cls: Erasesalloftheeditingarea.(Textcolor=White,Text=on,BG=off,loop
music stop)
2
consecutive push, (Graphic screen clear & Sprite=off)
Ins: To insert a character.
Upper part(ins,cls) is OK
also by long push.
Also,
in 'Insert Editor' mode, [ins/bs] key functions as 'Del' key.
The upper sign of the key
uses alt key together.
The (Shift,Alt)key is set
by push once and it is canceled with the key to one next.
If (Shift,Alt) is pushed twice, it will be lock
state,
and if it pushes once again, lock
will be canceled.
Grammar, Edit
The input of program.
Linenumber Command Parameter [enter]
e.g.
100 print
"parameter" [enter]
Between Command and Parameter, one space is necessary.
The case that Parameter start Brackets or
Double-quotation,
it shall not apply
to.(omittable)
Capital
letter and small letter can use commands.
Displayed list is revisable. Determined by the Enter key.
c.f. EDIT AUTO statement
When there is no line number,
it becomes a direct command.
'Direct command'
instruction is executed immediately.
Colon':' is used for a pause of a multiple
statement.
Comma',' is used for a pause of a
parameter.
e.g.
box(5,2)=7:print a,b
Deletion of a line is Enter only line number.
e.g.
100
[enter]
Label
Line number is used when specifying a jump
point.
Moreover, the jump point can also
specify by label, all case.(including on~goto,gosub)
The label is attached ':' at the end.
e.g.
100
label:
110 input a$
120 print a$
130 goto label:
Another style label can also
be used.
The label is attached '*' to the top.
e.g.
100
*label
130 goto *label
ver 3.15
Pocket computer type "label"
by double quotation available.
Constant, Variable
The constant used is a real number type and a
character type.
Character type is enclosed by
double-quotation("").
e.g.
3.14
"abc"
Real number,
Variable type:
double (64bit Floating-point
type)
Significant figures: 15 digits of
precision.
The variable is
like a box it can put in and out the data.
The
character variable name is attached '$' at the end.
e.g. st$
The
variable is automatically defined, when it appears first.
Substitution is used '='.
e.g. ab=64
There are two scope area.
The variable defined by the usual global scope can be
referred to on the whole.
The variable which
appeared by the inner side of the function is defined as a local variable.
The local variable can be referred to only within the
function definition.
The variable name, the
capital letter and the small letter are distinguished from another variable.
Please also read "[func]statement-Notes of global
variable definition position."
e.g.
10 no=5 : name$="tree" : 'global
20 func test(f)
30 d=f+no : ' f,d local
40 endfunc d
Array variable
Array
variable is a variable which can attach a number and treat to a lot of data.
A multidimensional array can be treated.
Array variable also have global scope and local
scope.
e.g.
10
dim no(20), a$(20) : ' The range 0-19
20 dim box(80,60) : ' Multidimensional array
Calculation
Arithmetic operation
Order of priority.
(Example)
^ (2^8)
Exponentiation
-
(-16) MinusSign
* ,
/ (5*2 , 10/3) Multiplication, Division
\ (10\3) Integer
division
mod (10 mod
3) Surplus
+ ,
- (12+4 , 20-2) Addition, Subtraction
Priority can be given to calculation by enclosing in
a parenthesis.
e.g.
print 5*(4+6)
50
Relational operation
The relational operators get a value (true:-1 or false:0) by comparing the two
values.
It is used for the conditional judgment of
'IF' statement, etc.
A=B A Equal
B
A<>B (><) A Not
equal B
A<B A Small
A>B A Large
A<=B (=<) less than B
A>=B (=>) more than B
e.g.
10 a=15
20 if a>10 then print "large"
large
Logical operation
After
being transposed to an integer, operation of a bit unit is performed.
The example below is expressed in binary.
Order of priority.
NOT 0101 -> 1010
0011 AND 0101 -> 0001
0011 OR 0101 ->
0111
0011 XOR 0101 -> 0110
0011 INP 0101 -> 1101
0011 EQV 0101 -> 1001
e.g.
10
a=val("&b1010")
20 b=val("&b1100")
30 c=a and b
40 d=a or
b
50 print "and ";bin$(c)
60 print "or ";bin$(d)
and 1000
or
1110
Bit shift
operation
00010100<<2 -> 01010000
00010100>>2 -> 00000101
e.g.
10
a=val("&b1010")
20 b=a>>1
30 c=a<<2
40
print "1010>>1 ";bin$(b)
50 print
"1010<<2 ";bin$(c)
1010>>1 101
1010<<2 101000
Compound assignment operator
To calculate for variable and the value is
substituted for itself.
Format: ValueName+=Numeric
or formula
As calculation type, able to use the
four arithmetic operations.
a+=1 a-=1
a*=1 a/=1
It can be used in array variable.
e.g. 5 is added to variable a.
10 a=2
20 a+=5
30 print a
7
e.g. Value b*2+1 is added to array variable
dt(5,7).
dt(5,7)+=b*2+1
Operation of a character string.
To distinguish whether a character string is
equal.
True(-1) or false(0) is returned.
"ABC"="ABC" Equal
"ABC"<>"AB12" Not equal
Comparison by inequality.
< >
"ABC"<"ABC" two data-equal so,
result: 0(false)
"ABC1">"ABC" a lot
character is larger so, result: -1(true)
"ABD">"ABC" character code large is larger so, result: -1(true)
Connect of character
string.
It can be by '+'.
e.g.
10
a$="ABC"+"123"
20 print a$
ABC123
Built-in function
It calculates in how to have decided the given
value, and returns the value.
(e.g.)
a=sin(3.14/2)
print sqr(8)
The priority of operation
1. The formula enclosed in the parenthesis.
2. Functions.
3.
Exponentiation.
4. MinusSign.
5. Four arithmetic operations.
6. Bit shift operation.
7. Relational operations.
8. Logical
operations.
User function
A user function can be defined and called.
A function definition can be placement anywhere.
'$' is attached when dealing with a string with a
return value, index.
The variable which appeared
by the inner side of the function is defined as a local variable.
It is called in this form. [ f=pow(8,4) ]
Return value is written behind 'ENDFUNC'.
e.g
10
f=pow(8,4)
20 print f
30 func pow(a,b)
40 c=a^b
50 endfunc c
Extension command
As for Extended command of Android control
relationships,
the type is distinguished by
the first two characters+underline.
EX_ Android control extension.
SP_ Sprite.
BG_
BG graphics.
BT_
Bluetooth.
RE_ Regular
expression.
UI_ Android user
interface.
File system
There are two basic current-folder to handle the
file, the next.
Specifying SD card
side:
/mnt/sdcard/ Android4.4
/storage/emulated/0/Android/data/and.bas/files/
Android10
Startup subpath(followed behind the
current-folder)
and.bas/
Android4.4
Android10 or later: The initial subpath is null.
Specifying main storage side:
/data/data/and.bas/ Android4.4
/data/user/0/and.bas/files/ Android10
Startup subpath(followed behind the current-folder)
files/ Android4.4
Android10 or later: The
initial subpath is null.
When specifying SD card side and start-up,
usually, it start
from here.(and.bas/ is subpath)
/mnt/sdcard/and.bas/ Android4.4
/storage/emulated/0/Android/data/and.bas/files/
Android10以降の場合
(Sometimes, there are different case by depend on the
model,
the majority of the models will be in this
location)
A part of this subpath can move by 'chdir'
command.
but can not go up to upper than
current-folder.
The
'mkdir' command can create a new folder.
Key-assign state is saved main storage side.
The current folder name can be acquired in
'curdir$()'.
Save &
load by command.
save"file1.bas"
load"file1.bas"
When the head start with "/", it mean to have
specified the full path.
e.g.
load"/mnt/sdcard/my/test/file1.bas" just described location.
When non "/" beginning,
it's judged as the path & file-name that it
continue in present current-folder.
e.g.
load"file1.bas" -> mnt/sdcard/and.bas/file1.bas (judged as this)
And, to refer to hierarchy
upper, "../" can be used like DOS.(multiple OK)
e.g. load"../my/file1.bas" ->
mnt/sdcard/my/file1.bas (judged as this)
(up to
upper 'sdcard/' once, and down to 'my/')
*The
location without access permission can't be accessed.
[About the change of SD storage system of
Android11]
It is possible to do storage access on Android11 or later
by a way as before,
for some models that cannot be
accessed,
access method called [DOCUMENT_TREE] was
prepared.
This is a method of selecting the folders that users can use
themselves.
The models which storage is special on Android11 or
later,
when selected [Menu>Load],
item "Set
SD Access." will be appear at the top of the list.
When this is
selected, the screen [Select folder to use] will appear.
Please select
the folder to use here.
It become the current folder containing
ID[xxxx-xxxx], and accessible.
The way to return current folder to usual
mode.
On [Select folder to use] screen, press 'Back' button
twice
to return to the 'Basic' screen.
This will
cancel [DOCUMENT_TREE] mode.
*Restrictions on access in
[DOCUMENT_TREE] method.
This mode reduces access speed.
By
SQL access case, please use by limited to internal storage.
Command
'CHDIR', it can change the current folder location, but,
a path
in each command cann't be 'Absolute specify'
("/storage/emulated/0/~test1.png")
and 'Rrelative specify'
("sub/test2.png").
Only 'Single specify' ("test1.png") is
possible.
c.f. Accessing the lower folder "sub".
chdir
"sub"
gload "test1.png"
chdir ".." : 'return to original
position
Please access the lower folder by such switching.
Load by dialog (Menu>Load)
The file list is displayed, it can be loaded by
touch & selection.
When
folder(sentence-end"/") is chosen, it will be in the folder movement.
For move to hierarchy upper, chose '..'.
When load file, it became
that it have been 'chdir' to the location automatically,
Current-folder is transferred to that location.
*When finish dialog by back-button, load is not
executed,
Only current-folder move by
'chdir' is done.
When
chose 'New folder', it becomes text input mode for folder-name,
A new folder can be made.
Save by dialog (Menu>Save)
It can input file name and save.
It's saved in the location of the
current-folder.
By entering the path-name at
the head,
it can specify the path
following a current.
When
want to specifiey the path of the hierarchy upper,
Please put the "../" in the head,(multiple OK)
File deletion management:
Program 'filedel.bas' can do file deletion work in
the current folder.
(Selected one is deleted)
(Not empty folder cann't be deleted)
File name can also be changed by choosing
'Rename'.
Interruption
It has various interruption functions.
on (Interrupt type) gosub
linenumber
return
error When an error occurs.
('goto'-'resume')
stop When STOP key is
pushed.
time$ When the appointed time
comes.
interval When an interval timer is
occurred.
play When music(channel 0)
performance is finished.
touch When the
Panel is Touch-on or released.
bluetooth
When receiving the data.
Error
When an interpretation is impossible and a program
is interrupted,
an error message and a line number
are displayed, and returns to command level.
Autorun
"autorun.bas" is a program first run at the
time of starting.
It is used for a setting program
etc.
Screen mode
This BASIC has the following four kinds of
screens.
T - Text screen.
G - Graphic screen.
S -
Sprite screen.
B - Back ground Graphics screen.
A composite priority can be determined by
'PRIORITY'statement.
The sprite of variable size
can use 256 sheets.
In addition, it has a Graphic
buffer which isn't displayed.
It is used by Sprit
and Back ground graphics.
The size of a screen becomes a different setup
depending on the Android model.
A vertical screen
or a horizontal screen follows the state at the time of starting.
Notation Reference (The following chapter)