RUN


 [Features] To execute the program.

 [Format] RUN ["Filename"],[|i or c|]

 [Explanation]
    To execute the program.
    If 'i' is specified, it runs in interpreter execution mode.
    If 'c' is specified (& omitted), it runs in intermediate code compile execution mode.
    All variables are initialized by execution. Opened files are closed.
    If "Filename" is specified, to load the file.
    The files saved in ".bin" format,
     it can run from intermediate code by [ run"*.bin" ]. (cf.:save)
    When execute ".bin" file, the current program which is being edited is cleared.
 [e.g.]    run ,i

    [Time reservation-execution]
     (The device must be turned on and power saving mode must be turned off)
    If specify Timer, to launch the Basic at the specified time,
     and run the specified program.
    Timer is number of milliseconds unit,
     it's specified by using 'ex_time' function.
    The current time(millsec) can be acquired with 'ex_time(date$,time$)'.
    Can be add the time by adding '1second=1000'.
    'ex_time' func also be able to operate and convert of time,
     please refer also to those item.
    ".bas" & ".bin", be able to reservation-execution both types.
    When receive new reservation during reservation already,
     the previous reservation will be overwritten by new one.(old disappear)
    By describing 'run'reservation and 'system'command-end in reservation program,
    'Regularly consecutive reservation' and recursively-run is possible.
    *Note
    In Android 12 and later, restrictions on launching apps from the background have been strengthened due to security enhancements,
     making it difficult to launch the app itself and its screen directly from an external class.
    For models prior to Android 11, you can still run a program with the scheduled execution function of 'run' after closing the 'Basic app' as before.
    For Android 12 and later, scheduled execution of 'run' will not be performed unless the 'Basic app' is running (the app screen is displayed).
    If you want to use scheduled execution once or continuously on Android 12 and later, please keep the 'Basic app' running.

    e.g.
     'sp_demo is executed at 12:05 on May 2.
     run "sp_demo.bin",,ex_time("2016/05/02","12:05:00"))

     'to launch every 24 hours every day and notify the date.
     '('1000*60*60*24' express 1day in milliseconds)
     100 ' "self.bas"
     110 run "self.bas",,ex_time(date$,time$)+1000*60*60*24
     120 ui_msg date$
     130 system


  END


 [Features] Program is ended.

 [Format] 

 [Explanation]
    Opened files are closed.

 [e.g.]



  STOP


 [Features] Program is stopped.

 [Format] 

 [Explanation]

 [e.g.]



  CONT


 [Features] To continue program after a break.

 [Format] 

 [Explanation]
    It uses in a direct statement.
    If a program line is modified, or after it was stopped in user definition function,
    'cont' will be invalid.

 [e.g.]



  NEW


 [Features] To delete all the program.

 [Format] 

 [Explanation]
    Opened files are closed.
    Variable is initialized.

 [e.g.]



  LIST


 [Features] To list a program to the screen.

 [Format] LIST [line number][-][line number]

 [Explanation]
    While the screen touch, it switch to slow scroll mode.

 [e.g.]
    list 200-
    list -1000



  EDIT


 [Features] It goes to edit mode.

 [Format] EDIT line-number

 [Explanation]
    Program can be edited by cursor movement and scroll.
    It escapes from the mode by stop-key or cls-key.

 [e.g.]



  DELETE


 [Features] To delete program lines.

 [Format] DELETE [line number][-][line number]

 [Explanation]

 [e.g.]
    delete 200-400



  AUTO


 [Features] It goes to auto line edit mode.

 [Format] AUTO [line number][,increment]    (Default[100,10])

 [Explanation]
    In editor, auto number line is made, whenever enter is pressed.
    It will be canceled if a stop key is pressed.
    It begins from the specified number, and increases every increment number.

 [e.g.]
    auto 100,10



  RENUM


 [Features] To renumber program lines.

 [Format] RENUM [new number][,old number][,increment]    (Default[100,,10])

 [Explanation]
    It will be renumbered from new number by increment step.
    If old number is specified, it will consist of the position of a program.
    If omitted, it will consist of heads.
    'go'(jump line number) also be rewritten.

 [e.g.]
    renum 100



  SEARCH


 [Features] The program lines hit to a word is displayed.

 [Format] SEARCH "word"

 [Explanation]



  REPLACE


 [Features] To replace character strings of the program.

 [Format] REPLACE "string1","string2"

 [Explanation]
    'string1' in source code is replaced to 'string2'.
    The replaced line is displayed by listing.
    The small and capital letter is distinguished.
< br> [e.g.] Tochangethevariablenameinalump.(an->a10)<br>    10an=10:bn=20:cn=30
    20 an=an+bn+cn
    30 print an
    replace "an","a10"
  (Result)
   10a10=10:bn=20:cn=30
    20 a10=a10+bn+cn
    30 print a10



  LOAD


 [Features] Program is loaded from main storage or SD card.

 [Format] LOAD "filename"[,encode]

 [Explanation]
    Opened files are closed.
    As for an extension, ".bas" is generally used.
    The file no linenumbers also, can be read with assignment linenumbers automatically.
    In that case, it cann't run unless in the 'BASIC'.

    When loading, duplication check of line number is also performed.
    In case of duplication, duplicate line number list will be displayed.
    Please correct duplication lines in TextBox mode. 

    In the models which storage is special on Android11 or later,
     it may be possible to access in [DOCUMENT_TREE] method.
    Please see at the next for details.
     Manual> Grammar> Filesystem> [About the change of SD storage system of Android11]

    "file name" is 'http:' 'https:' when starting, it loads from the address of the Internet.
    When encoding was omitted, "UTF-8" is specified.
    For internet file 'http:.../name.bas', when the end of line is ended by a number,
    it is necessary to be had modify that it adds 1 space at the end of line.
     10 print"abc"
     20 print 123 (<-Because it terminate in the number, space is added at the end of line.)
     30 end
    In the SAVE statement with i option, the file of this format is generated automatically.

 [e.g.]
    load "test.bas"
    load "http://androidbasic.ninja-web.net/sp/hanoi.bas"



  SAVE


 [Features] Program is saved to main storage or SD card.

 [Format] SAVE "filename" [ , n | i ]

 [Explanation]
    An extension is generally saved by ".bas".
    When saved with 'n' option, it is saved without line number.
    When saved with 'i' option, it is saved with modified file to it can load from the Internet.
    (When the end of line is a number, one space is added to the line end.
     And if there are numbers by 'rem, it will enclose by "")

    If extension is set to ".c", basic grammar is converted to the C language, and saved.
    For more information about details of conversion, please look at here of homepage.
    http://androidbasic.ninja-web.net/man/bastoc.html

    If extension is set to ".bin", it's saved by the intermediate code form.
    This form, it can be executed by [ run"*.bin" ].
    (In load dialog, the only ".bas" form files are displayed,
     The files of All can be viewed in the 'files' command)

    Notes in the ".bin" save form
    'if' command to the line top.
      50 locate 1,2:if a=1 then print 2
    In this way, if there are described command before 'if',
    please rewrite to the divided line form as follows.
      50 locate 1,2
      55 if a=1 then print 2

 [e.g.]
    save "test.bas"
    save "test.bas",n
    seve "test.c"


  MERGE


 [Features] Program is connected.

 [Format] MERGE "filename" [,start-line][,delete-range]

 [Explanation]
    On-memory-program and specified"filename"-program are connected, and it is made one program.
    When linenumber overlaps, it is overwritten in the file-side line.
    It can be used by both in direct execution and a program.
    When the 'delete-range' is specified, it is connected after the line deletion of the range.
    Specification e.g.:  500  -330  270-720  1000- (Label disabled)
    The difference with 'delete' statement,
    even if the designated line don't exist, it don't become the error.
    It is that all the line in the range of that number be deleted.
    If 'start-line' is specified, it will be resumed from the linenumber.
    When it omits, it is resumed from the line located in the next place of 'MERGE'.
    Resumption, the variables are passed all.
    In (,c)mode, the 'MERGE' statement can describe only one in the program.

 [e.g.]
    merge "test2.bas",100,100-990



  UNLIST


 [Features] List undisplayed section is specified.

 [Format] UNLIST [Hed-Endline] [,Back-Startline]

 [Explanation]
    Undisplayed section can't be edited.
    Execution is performed as usual.
    UNLIST Unspecified - The specified area is released.
    Even if specification line doesn't exist, it doesn't become an error.
    [Back-Startline] After this point will be hidden.
    Mainly, it is the area which User-defined functions are placed.
    The functions here can be called from visible portion.
    It can treat as library by hiding User functions.
    The library function is loaded previously,
     and Main program been 'merge' to visible portion.
    [Hed-Endline] Before this point will be hidden.
    Mainly, It is used to declare global variables-Arrays used in the function,
     and to call the initialization routine backward.
    The command affected by 'UNLIST'.
    -LIST EDIT SEARCH REPLACE
    These are executed only to visible portion.
    -SAVE
    Only visible portion be saved.
    -RENUM
    Only visible portion be changed.
    When change line attains to undisplayed section,
     it becomes an error and doesn't execute.
    If there is 'goto' or jump point -(except label) in undisplayed section,
     it will not work properly.
    -NEW LOAD
    All the original source will be erased.
    The specified area of 'unlist' is released.

 [e.g.]  MERGE & UNLIST Sample
   "lib1.bas"
    10 pi=3.1415926535
    20 dim dt(10)
    30 f=initf()
    40 unlist 99,1000
    50 merge"p1.bas",100,100-999:'only once
    60 '--Forward border--
    100 '
    110 '
    1000 '--Backward border--
    1010 func initf()
    1020  for i=0 to 7:dt(i)=i*pi:next
    1030 endfunc
    1040 func sec(x)
    1050  rt=1/cos(x)
    1060 endfunc rt

   "p1.bas"
    100 print sec(2)
    110 end



  LLIST


 [Features] List or Text-file is printed by a printer.

 [Format] LLIST [TextFileName]

 [Explanation]
    When a Text-file is specified, the text is printed.
    What can be specified are [.txt .bas .sql] file.
    When not specified, to print the present List.
    The size of character to print is specified with 2nd parameter of 'font' command.
    The number is from 1 to 7, 7 is max. Default is 2. (c.f. font)
    When text is garbled, to specify the encoding by 'init' command as follows.
    init"enc:UTF-16"
    (The example is UTF-16 specification)
 [e.g.]
     llist "usage.txt"

    In order to print, it is needed the printer
     which have wireless Wi-Fi function supported to Android.
    A model of Android 4.4 or higher is required.
    (There are some not corresponding, custom ROM etc)

    Procedure to print [LLIST,HARDC-common]
    Install and run the special-app, driver (provided by printer manufacturer) from GooglPlay.
    Turn on the wireless(Wi-Fi,Tethering) of printer or Android, make both sides connection state.
    (Because there are each method for each model, please refer to each manual)
    Please select Android setting>printing, and turn on printing service.
    With this if it is ready for printing, to execute command [LLIST, HARDC] from Basic.
    Then, setting dialog screen of printing will open,
     please make various settings. (Printer select, Paper size, color, direction etc)
    To check the preview screen and press print button to start printing.
    (When background is black, it may be replaced by white on the preview side)
    The program side don't proceed to the next command until the print dialog is closed.
    Notes: [Printer compatibility, connection method, support-app usage, printing quality] etc,
     about the portion depending on each printer manufacturer,
     please understand that app side can not respond to inquiries.

    The print function of Basic manual.
    llist "manual01.sys"
    It's possible to print the Basic manual by this description.
    This number part[01], two-digit number including 0. range: 01~26.
    Each number, start with [1.operation], from the top, it corresponds in order.


  HARDC


 [Features] Screen or Image-file is printed by a printer.

 [Format] HARDC [ImageFileName]

 [Explanation]
    When a Image-file is specified, the picture is printed.
    What can be specified are [.png .jpg .jpeg] files.
    When not specified, to print the hard copy of screen.
    And when "scrn:" is specified, it isn't printed and
     save the screen to "ScreenShot01.png" as screenshot.
    (It doesn't include top status bar and under home button etc)
 [e.g.]
     hardc "mountain.png"


  EXEC


 [Features] To execute the External application.

 [Format] EXEC "App-name or [package+class name]"

 [Explanation]
    When application name is specified,
     package name and class name are searched and performed automatically.
    What was not found is not performed.
    What Package and Class name is known beforehand, it can be performed by directly specifying.
    The Package+Class name is expressed by alphanumeric characters and period-separated.
    When External application is finished, It return to Basic.

 [e.g.]
   'Performs by application name.
     exec "Calendar"
   'Performs by Package+Class name.(Beginning in capital letters'LaunchActivity' is class name)
     exec "com.android.calendar.LaunchActivity"



  SYSTEM


 [Features] BASIC is ended and returns to OS.

 [Format] SYSTEM


  ERROR


 [Features] Simulate and generate an error of specified number.

 [Format] ERROR n



  TRON / TROFF


 [Features] To go into Step-execution-mode with display of line number and command.

 [Format] TRON

 [Explanation]
    TRON  mode-on
    TROFF  mode-off
    It is displayed in the form of [command]-lines on upside bar.
    Command progresses for every step by touching a screen.
    Combined use with variable table editing is possible.
    This command works only interpreter mode.
    The mode is canceled even if 'new','load'commands is executed.

 [e.g.]
    [print a] 200 a=120:print a:b=240:print b

 

  INIT


 [Features] To perform various setting of the following kind by Setting-Type.

 [Format] INIT "Setting-Type:Set-Value"

 [Explanation]
   init"KB:n"  The Keyboard input type is selected.
    n=0 For the Hardware keyboard.
    n=1 Software keyboard of System.
    n=2 Exclusive use AB Software keyboard.
    n=3 Virtual pad. (8way-input)
    n=4 Virtual pad. (4way-input)
    And, by value of second parameter separated by a comma,
    Y-axis adjustment value(0~9) can be given.
    Example of second parameter specification.  init "kb:3,5"
    In Virtual-pad, since for human natural finger placement and hit of thumb's ball,
    A lower portion is input more than human thinks actually.
    For that reason, for natural input,
     it is necessary to correct the touch to the upper side.
    About second parameter. (Default=4)
    2 - detection without correction.
    3~9 - detection shifted upward from the actual input.
    0~1 - detection shifted downward from the actual input.
    The size of the width to 0~9 is the same as the size of the button of pad.
    (specification in button 1/10 size unit)
   [e.g.]    init "kb:3"

   init"dpsw:ItemChar.Number[ItemChar.Number]..."
    Menu-setting is changed from program command.
    This change is effective only during program execution,
    at simultaneous with end, it return to original setting.
   ItemChar  -it can configure with multiple.
    m  Language.      0:eng 1:jp
    l  Locate mode.    0:xy 1:yx
    k  Input mode.    0:rep-on 1:rep-off 2:flick 3:aux 4:ins-ed
    b  Key Click SE.    0:on 1:off
    u  Print Using.    0:doll 1:yen
    s  Strage location.    0:inter 1:sd
    g  GLine Antialias.    0:off 1:on
    c  ColorSet(16) Compatible.    n:0~5
    i  Input correction.    0:normal 1:correction
    [File operation lock.]&[Device access lock.] can't be changed by program because of security.
    [Font size.] Please change font size from 'font' command.
    When increase drawing speed of screen, to set as [init"dpsw:g2"].
    When smooth the enlarged image, to set as [init"dpsw:g1"].
   e.g.
    init "dpsw:b1g1c3"
    'It set to SE-off, Antialias-on, ColorSet-3.

   init"ENC:Character encoding type"
    Encoding used by [ LOAD, SAVE, (OPEN) PRINT#, INPUT# ] is specified.
    UTF-8(Default),SJIS etc.
    Because the encoding by the Web information acquisition is given
     in the second parameter of [LOAD,INET$()], It is distinguished from this setup.
 [e.g.] The example which changes a UTF-8 file into UTF-16 file.
    init "enc:UTF-8"
    load "file.bas"
    init "enc:UTF-16"
    save "file.bas"

   init"ANGLE:RAD or DEG"
    To set the unit of angle, Radian or Degree,
     that used in 'sin','cos','tan' and return value of 'atan'.
    The default is Radian.
   [e.g.]
    init "angle:deg"
    'The following, it will be treated in units of 360 degree.

   init"SPMAX:n"
    The maximum number of Sprite is set up.
    The value [ 256(default),512,1024 ] can be set up.
   [e.g.]
    init "spmax:512"

   init"CRT:n"
    To specify scroll fineness, in the case of using 'print' statement in text screen.
    n=0 Character-unit scroll. High speed.
    n=1 Dot-unit scroll. Smoothly.
   [e.g.]
     init "crt:0" :'character-unit

  KEY


 [Features] The definition of the function key string.

 [Format] KEY keycode-No,"string"

 [Explanation]
    The output(inserted) string which the key pressed after Fn key is defined.
    For keycode-No, please refer to the table later in the manual.
    The keys which can be defined is alphabet keys and number keys.

 [e.g.]
    key 37,"input"
    'Define the 'i'key to "input".



  KEY LIST


 [Features] The list of the contents of defined function keys are displayed.

 [Format] 

 [Explanation]
    In the initial state, function keys are defined as follows.
    E(33) "end"
    F(34) "for "
    G(35) "goto "
    I(37) "if "
    P(44) "print "
    T(48) "then "
    N(42) "next"
    L(40) "locate "
    R(46) "return"
    W(51) "while "
    D(32) "delete "
    M(41) "merge"
    O(43) "open "
    B(30) "bg_"
    S(47) "search "
    X(52) "ex_"
    Q(45) "sql "
    C(31) "case "
    K(39) "key "
    0(7)  "load "http://androidbasic.ninja-web.net/sp/"
    (for sample load)

 [e.g.]