Note : The following functions or statements are not applicable for 
       710/711/720:

       VOL
       ON DIGIN GOSUB and OFF DIGIN
       ON ENQUIRY GOSUB and OFF ENQUIRY
       ON NET GOSUB and OFF NET
       START NETWORK and STOP NETWORK
       INQUIRY
       GET_INQUIRY$ and REPLY
       READ_NET$ and WRITE_NET
       ENABLE PSEUDO_KBD and DISABLE PSEUDO_KBD
       CAP_LOCK and NUM_LOCK
       DIGOUT
       GET_DIGIN
       SHOW_CALENDAR and HIDE_CALENDAR
       GET_STATION_ID and SET_STATION_ID



Revision history :

/--------------------- Version 1.22 on Dec. 1, 1998 ------------------------/

New : The "RETURN" of a subroutine can be appended with a label.

/--------------------- Version 1.24 on Feb. 26, 1999 -----------------------/

New : 
      1. CURSOR (status%)
         status% = 0 : cursor is OFF
         status% = 1 : cursor is ON

      2. ON ESC GOSUB SubName
         OFF ESC

/--------------------- Version 1.26 on Mar. 22, 1999 -----------------------/

Modified : UPCE no addon  => UPCE
           EAN8 no addon  => EAN8
           EAN13 no addon => EAN13 & UPCA  + Config

/--------------------- Version 1.27 on Mar. 30, 1999 -----------------------/

New functions and statements: 

    1. GET_TRANSACTION_DATA$ (N%)
       Purpose    : To read a transaction record from the transaction file.
       Parameters : N% = the N th data of the transaction file
       Usage      : A$ = GET_TRANSACTION_DATA$ (5)
                    REM  read the 5th transaction data

    2. DEL_TRANSACTION_DATA (N%)
       Purpose    : To delete a block of transaction data from the top of
                    transaction file (positive value), or delete from the
                    bottom of transaction file (negative value).
       Parameters : N% = the number of data to be deleted.
       Usage      : DEL_TRANSACTION_DATA$ (10)
                    REM  delete 10 transaction data

    3. SET_VIDEO_MODE (N%)
       Purpose    : To set the display mode for character printing.
       Parameters : N% = 0, normal mode
                         1, reverse mode
       Usage      : SET_VIDEO_MODE (1)
                    PRINT "Reverse mode"
                    REM  print the string in reverse mode

    4. SHOW_IMAGE (x%, y%, size_x%, size_y%, Image$)
       Purpose    : To show a bitmap on the screen
       Parameters : x% = x coordinate of the upper left point of the image
                    y% = y coordinate of the upper left point of the image
                    size_x% = width of the image in pixels
                    size_y% = height of the image in pixels
                    Image$ = string containing the bitmap data of the image
       Usage      : SHOW_IMAGE (1, 1, 30, 30, Data$)


    5. SELECT_FONT (n%)
       Purpose    : To select different font size for the display
       Parameters : n% = 1, font size : 6x8
                         2, font size : 8x16
                         3, font size : 16x24 (520 only)
       Usage      : SELECT_FONT (1)

    6. CHANGE_SPEED (n%)
       Purpose    : To change the CPU running speed (for 7xx series only)
       Parameters : n% = 5, Full speed
                         4, Half speed
                         3, Quarter speed
                         2, 1/8 speed
       Usage      : CHANGE_SPEED (3)


/--------------------- Version 1.28 on Apr. 20, 1999 -----------------------/

New : supports BASIC program download via IR Transceiver (for 710/711/720)

/--------------------- Version 1.29 on Apr. 30, 1999 -----------------------/

New statement : 

       COM_DELIMITER (n%, c%)
       Purpose    : To change the delimiter of COM port receiving string. The
                    default value is 13 (carriage return). If you assign a
                    negative value, then there would be no delimiter, the
                    READ_COM command can read only one character at a time.
       Parameters : n% = 1 / 2 / 3, specify which COM port to be set. For 201,
                    only COM 3 is valid.
                    c% = 0 to 255, negative value if no delimiter.
       Usage      : COM_DELIMITER (1, 10);

/---------------------- Version 1.30 on June 1, 1999 -----------------------/

New functions and statements: 

    1. DEVICE_ID$
       Purpose    : To get the serial number of the terminal.
       Return     : A string of serial number.
       Usage      : A$ = DEVICE_ID$

    2. MAIN_BATTERY
       Purpose    : Get the voltage of main battery.
       Return     : The mini-volt value in integer.
       Usage      : PRINT "Main bat =", MAIN_BATTERY

    3. BACKUP_BATTERY
       Purpose    : Get the voltage of backup battery.
       Return     : The mini-volt value in integer.
       Usage      : PRINT "Backup bat =", BACKUP_BATTERY

    4. RAM_SIZE
       Purpose    : Get the RAM size
       Return     : The integer value of RAM in K bytes
       Usage      : PRINT "SRAM = ", RAM_SIZE

    5. ROM_SIZE
       Purpose    : Get the ROM (flash) size
       Return     : The integer value of ROM in K bytes
       Usage      : PRINT "Flash = ", ROM_SIZE

    6. FREE_MEMORY
       Purpose    : Get the free memory size
       Return     : The long integer value of free memory in bytes
       Usage      : PRINT "Free memory = ", FREE_MEMORY

    7. CODE_TYPE
       Purpose    : Get the type of code (symbology) being decoded upon
                    successful decoding.
       Return     : One of the following values
                          CODE39          65 or 'A'
                          PHARMACODE      66 or 'B'
                          CIP39           67 or 'C'
                          INDUSTRIAL25    68 or 'D'
                          INTERLEAVE25    69 or 'E'
                          MATRIX25        70 or 'F'
                          CODABAR         71 or 'G'
                          CODE93          72 or 'H'
                          CODE128         73 or 'I'
                          UPCENA          74 or 'J'
                          UPCEA2          75 or 'K'
                          UPCEA5          76 or 'L'
                          EAN8NA          77 or 'M'
                          EAN8A2          78 or 'N'
                          EAN8A5          79 or 'O'
                          EAN13NA         80 or 'P'
                          EAN13A2         81 or 'Q'
                          EAN13A5         82 or 'R'
                          MSI             83 or 'S'
                          PLESSEY         84 or 'T'

       Usage      : if (CODE_TYPE = 65) then
                         :
                         :
                    end if

    8. DAY_OF_WEEK
       Purpose    : Get the day of the week
       Return     : A value of 1 to 6 represents Monday to Saturday
                    accordingly. And a value of 7 indicates Sunday.
       Usage      : if (DAY_OF_WEEK = 5) then
                        print "It's Friday"
                    end if

/---------------------- Version 1.31 on July 14, 1999 ----------------------/

Modified : If no index file is created for a DBF file, the related settings
           such as Offset and Key length will be set to 0.

/---------------------- Version 1.32 on Aug 14, 1999 -----------------------/

New statement : (For 711 and 720 only)

    1. SET_COM_TYPE (ComPort%, Type%)

       purpose : This routine is used to set the communication types for the
                 COM ports. Before opening the COM port, please call this
                 function to assign communication type

                 Following are the available types for each COM port,

                    ComPort = 1 :  1  direct RS-232
                                   2  docking (via communication cradle)

                    ComPort = 2 :  3  high speed IR (via Transceiver)
                                   4  Standard IrDA communication
                                   5  RF communication

       Usage   : SET_COM_TYPE (2, 3)         ' set COM 2 to IR transmission

/---------------------- Version 1.33 on Sept. 7, 1999 ----------------------/

New statements : (For 711 and 720 only)

    1. SET_WEDGE (Parameter$)

       purpose : 711/720 is able to send data to the host through the
                 keyboard wedge interface by using SEND_WEDGE function. The
                 SEND_WEDGE function is governed by a 3 bytes unsigned
                 character string. User must fill it with appropriate values
                 by calling the SET_WEDGE before using the SEND_WEDGE
                 function.

                 For detail, please refer to "C" Programming for 711/720,
                 Chapter 2.3.
       
    2. SEND_WEDGE (DataString$)

       purpose : Send data to the host through keyboard wedge interface.

/---------------------- Version 1.34 on Oct. 15, 1999 ----------------------/

New init setting : Target Machine
Communication baud rate : supports up to 115200 bps for 711 & 720

/---------------------- Version 1.40 on Nov. 02, 1999 ----------------------/

DBF files : can create up to 5 DBF files, with each one can have up to 3
            index files.

/---------------------- Version 1.50 on Dec. 03, 1999 ----------------------/

New features: up to 6 transaction files can be created.

New functions and statements:

    1. UPDATE_RECORD_EX (file%, index%, data$)
       Purpose    : To update a DBF file's record at the same position.
       Parameters : file%, the ordinal number of the DBF file
                    index%, the ordinal number of the DBF index file
                    data$, the data string for updating.
       Return     : None
       Usage      : update_record_ex (1, 2, data$)

    2. UPDATE_TRANSACTION_EX (file%, record%, data$)
       Purpose    : To update a transaction record at the same position.
       Parameters : file%, the ordinal number of the transaction file
                    record%, the ordinal number of the transaction record
                    data$, the data string to be saved back.
       Return     : None
       Usage      : update_transaction_ex (3, 100, data$)

    3. SAVE_TRANSACTION_EX (file%, data$)
       Purpose    : To append a record to the specified transaction file.
       Parameters : file%, the ordinal number of the transaction file
                    data$, the data string to be saved.
       Return     : None
       Usage      : save_transaction_ex (1, data$)

    4. GET_TRANSACTION_DATA_EX (file%, record%)
       Purpose    : To retrive a record from the specified transaction file.
       Parameters : file%, the ordinal number of the transaction file
                    record%, the ordinal number of the transaction record
       Return     : The transaction record if successful.
       Usage      : data$ = get_transaction_data_ex (3, 100)

    5. EMPTY_TRANSACTION_EX (file%)
       Purpose    : To clear all records of the specified transaction file.
       Parameters : file%, the ordinal number of the transaction file
       Return     : None
       Usage      : empty_transaction_ex (5)

    6. DEL_TRANSACTION_DATA_EX (file%, record%)
       Purpose    : To remove a record from the specified transaction file.
       Parameters : file%, the ordinal number of the transaction file
                    record%, the ordinal number of the transaction record
       Return     : None
       Usage      : del_transaction_data_ex (3, 100)

    7. TRANSACTION_COUNT_EX (file%)
       Purpose    : To get the counts of the records of the specified
                    transaction file.
       Parameters : file%, the ordinal number of the transaction file
       Return     : the records counts
       Usage      : count = transaction_count_ex (5)

/---------------------- Version 1.53 on Jan. 07, 2000 ----------------------/

New setting for barcode scanner:

       Aiming mode : The first trigger is for aiming only, the second trigger
                     will then start to decode. After the first trigger, the 
                     scanner will keep on scanning for one second so that 
                     user may take aim. But user must press the second 
                     trigger within this period (one second), otherwise user
                     must take aim again.

/---------------------- Version 1.54 on Jan. 14, 2000 ----------------------/

New functions: 

    1. SMC_SIZE
       Purpose    : Get the memory size of the Smart-Media Card
       Return     : SMC memory size in K bytes
       Usage      : PRINT "SMC memory size = ", SMC_SIZE

    2. SMC_FREE_MEMORY
       Purpose    : Get free memory space of the Smart-Media Card
       Return     : SMC free memory space in bytes
       Usage      : PRINT "SMC free memory = ", SMC_FREE_MEMORY

/---------------------- Version 1.55 on Feb. 1, 2000 -----------------------/

A compilation bug is fixed.

/---------------------- Version 2.00 on Feb. 22, 2000 ----------------------/

New functions and statements:

    1. ALPHA_LOCK (n%)
       Purpose    : To set alpha lock status.
       Parameters : n% = 0, unlock
                         1, lock
       Return     : none
       Usage      : ALPHA_LOCK (1)

    2. GET_ALPHA_LOCK
       Purpose    : To get alpha lock status.
       Parameters : none
       Return     : 1 if locked, 0 if unlocked
       Usage      : Status% = GET_ALPHA_LOCK


    3. SHIFT_LOCK (n%)
       Purpose    : To set shift lock status.
       Parameters : n% = 0, unlock
                         1, lock
       Return     : none
       Usage      : SHIFT_LOCK (1)

    4. GET_SHIFT_LOCK
       Purpose    : To get shift lock status.
       Parameters : none
       Return     : 1 if locked, 0 if unlocked
       Usage      : Status% = GET_SHIFT_LOCK

    5. KEY_CLICK (n%)
       Purpose    : To enable/disable the key click sound.
       Parameters : n% = 1, enable (default)
                         0, disable
       Return     : none
       Usage      : KEY_CLICK (0)

    6. FILL_RECT (x%, y%, size_x%, size_y%)
       Purpose    : To fill a rectangle area.
       Parameters : x% = x coordinate of the rectangle's upper left corner
                    y% = y coordinate of the rectangle's upper left corner
                    size_x% = width of the rectangle in pixels
                    size_y% = height of the rectangle in pixels
       Return     : none
       Usage      : FILL_RECT (1, 1, 20, 20)

    7. CLR_RECT (x%, y%, size_x%, size_y%)
       Purpose    : To clear a rectangle area.
       Parameters : x% = x coordinate of the rectangle's upper left corner
                    y% = y coordinate of the rectangle's upper left corner
                    size_x% = width of the rectangle in pixels
                    size_y% = height of the rectangle in pixels
       Return     : none
       Usage      : CLR_RECT (1, 1, 20, 20)

    8. VERSION (ver$)
       Purpose    : To write version information to the system
       Parameters : string for the version information (cannot exceed 15
                    characters)
       Return     : none
       Usage      : VERSION ("CipherBASIC 1.6")
       Note       : This command must be on the first line of the program,
                    otherwise it will be ignored.

/-------------------- Version 2.01 on April. 26, 2000 ----------------------/

On-line help is updated.

/---------------------- Version 2.02 on May. 5, 2000 -----------------------/

New function : SEND_FILE (port%, file%, field_length, ....)

       Purpose    : To send the data of a transaction file to the host PC.
                    The communication is BHT-protocol compatible so that
                    you may use the DENSO transfer utility "TU3W.EXE" to
                    receive the data.
       Parameters : port%, the communication port for data transmission.
                    file%, an integer in the range of 1 to 6 that specify
                           which transaction file to be sent.
                    field_length%, specify the length for each field. Up to
                                   16 fields can be specified.
       Return     : 1 if succeeded, 0 if failed
       Usage      : SET_COM_TYPE (1, 1)            'use RS-232 communication
                    Error% = SEND_FILE (1, 1, 8, 12, 10)
       Note       : This function will return a value to indicate the data
                    transmission result. So please be sure to use a variable 
                    to receive the return value, otherwise a syntax error
                    will be shown during compilation.
                    Also, please be noted that the sum of each field length
                    can not be over 250. And if the sum of each field is 
                    longer than the true record length, it will fill with 
                    space; if shorter, data will be truncated.

/---------------------- Version 2.03 on May. 11, 2000 ----------------------/

Fixed a bug of the "Config transaction files" dialog box.

/---------------------- Version 2.04 on May. 17, 2000 ----------------------/

New setting for barcode: Convert UPCA to EAN 13

/---------------------- Version 2.06 on Aug. 08, 2000 ----------------------/

Bug fixed : It happened when "Key length" plus "Key offset" is equal to or
            greater to the "Record length" of a DBF file, then
            "Key length" = "Record length" - "Key offset" - 1

/---------------------- Version 2.08 on Aug. 15, 2000 ----------------------/

Bug fixed : It happened when there were more than 20 "ELSE IF" statements
            after the "IF" statement.

/---------------------- Version 2.10 on Nov. 06, 2000 ----------------------/

New statements:

    1. POWER_ON (n%)
       Purpose    : Determine whether to restart or resume the program upon
                    power up.
       Parameters : n% = 0, RESUME
                         1, RESTART
       Return     : none
       Usage      : POWER_ON (0)                 ' set to resume mode

    2. AUTO_OFF (sec%)
       Purpose    : Set the time period for the system to automatically shut
                    down the user's program whenever there is on operation
                    during that period. If this time period is set to zero,
                    the AUTO OFF function will be disable.
       Parameters : time period in unit of second
       Return     : none
       Usage      : AUTO_OFF (30)           ' auto off after 30 seconds
                    AUTO_OFF (0)            ' disable the AUTO OFF function

    3. BACK_LIGHT_DURATION (sec%)
       Purpose    : Determine how long will the backlight lasts once turned
                    on.
       Parameters : duration in unit of second
       Return     : none
       Usage      : BACK_LIGHT_DURATION (20)     ' lasts for 20 seconds

/---------------------- Version 2.20 on Feb. 1, 2001 -----------------------/

TCP/IP statements and functions for 520 / 8060 / 8360 / 8370 terminals

    1. ON TCPIP GOSUB ...
       Purpose    : To activate the " TCP/IP Event Trigger" which executes a
                    specific subroutine when data is comming from the TCP/IP
                    connections or some errors happen.
       Usage      : ON TCPIP GOSUB SubLabel

    2. OFF TCPIP
       Purpose    : To terminate the " TCP/IP Event Trigger".
       Usage      : OFF TCPIP

    3. GET_TCPIP_MESSAGE
       Purpose    : To get the TCP/IP message. This command can also be 
                    called in normal program to detect the TCPIP status.
                    Note when first entering TCPIP trigger, please call this
                    function clear the possible buffered messages.
       Usage      : A%=GET_TCPIP_MESSAGE
       Return     : 
                    value              meaning
                     4000        connection #0 overflow
                     4001        connection #1 overflow
                     4002        connection #2 overflow
                     4003        connection #3 overflow
                     4014        Networking initialization error
                     4015        Port initialization error
                     4020        channel #0 is connected
                     4021        channel #1 is connected
                     4022        channel #2 is connected
                     4023        channel #3 is connected
                     4040        channel #0 is disconnected
                     4041        channel #1 is disconnected
                     4042        channel #2 is disconnected
                     4043        channel #3 is disconnected
                     4060        connection #0 : data is coming
                     4061        connection #1 : data is coming
                     4062        connection #2 : data is coming
                     4063        connection #3 : data is coming

    4. START TCPIP
       Purpose    : To enable the TCP/IP communication.
                    Note once this function has been called, it can not be
                    called again unless STOP TCPIP has been called.
       Usage      : START TCPIP

    5. STOP TCPIP
       Purpose    : To disable the TCP/IP communication.
       Usage      : STOP TCPIP

    6. TCP_OPEN (N%, IP$, RP%, LP%, {Protocol%}, {Delimiter%})
       Purpose    : To open a connection with TCP protocol.
                    Note this function must be called before using any socket
                    read/write commands.
       Parameters : N%,  the connection (channel) number ranging from 0 to 3.
                    IP$, the IP address of the remote port.
                         If it is set to "0.0.0.0", the connection will
                         become server mode and the LP% must be defined.
                    RP%, the port number of the remote port to be connected.
                         If it is 0, any remote port is available. However,
                         it should be 0 in server mode.
                    LP%, the port number of local port.
                         If it is 0, the port number will be defined by the
                         system. However, it should be 0 in client mode.
                    {Protocol%}, this parameter is optional and default to 0,
                         that is, use TCP protocol by default. If set to 1,
                         the system will use UDP protocol.
                    {Delimiter%}, this parameter is optional and default to
                         0x0d (Carriage Return). The valid values range from
                         0 to 255. If set to -1, the system won't transmit
                         any delimeter.
       Usage      : TCP_OPEN (0, "0.0.0.0", 0, 23)
                    TCP_OPEN (1, "0.0.0.0", 0, 24)
                    TCP_OPEN (1, "0.0.0.0", 0, 24, 1)
                    TCP_OPEN (1, "0.0.0.0", 0, 24, 0, 59)

    7. NCLOSE (N%)
       Purpose    : To close a TCP/IP connection.
       Parameters : N% is the connection (channel) number ranging from 0 to 3
       Usage      : NCLOSE (0)

    8. NREAD$ (N%)
       Purpose    : To read data via a TCP/IP connection 
       Parameters : N% is the connection (channel) number ranging from 0 to 3
       Usage      : A$ = NREAD$ (0)

    9. NWRITE (N%, A$)
       Purpose    : To write data to a TCP/IP connection 
       Parameters : N% is the connection (channel) number ranging from 0 to 3
                    A$ is the string to be sent to the connection.
       Usage      : NWRITE (0, "Hello")

   10. SOCKET_OPEN (N%)
       Purpose    : To check if the connection is open or not.
       Parameters : N% is the connection (channel) number ranging from 0 to 3
       Usage      : A% = SOCKET_OPEN (0)
       Return     : 
                    value                meaning
                      0              the connection is open
                     3000            invalid connection (channel) number
                     3004            the connection is closed
                     3012            TCPIP not start yet

   11. SOCKET_IP$ (N%)
       Purpose    : To get the IP address of the connection.
       Parameters :     N%               Return
                     0,1,2,3         Remote IP
                        -1           Local IP
                        -2           Subnet Mask
                        -3           Router IP
                        -4           DNS server IP
                        other        null

       Usage      : IP$ = SOCKET_IP$ (0)
       Error Code : 
                    value                meaning
                      0              normal status
                     3000            invalid connection (channel) number
                     3004            the connection is closed
                     3012            TCPIP not start yet

   12. SOCKET_HAS_DATA (N%)
       Purpose    : To check if the buffer of connection has data or not.
       Parameters : N% is the connection (channel) number ranging from 0 to 3
       Usage      : A% = SOCKET_HAS_DATA (0)
       Return     : 
                    value                meaning
                      0              there is data in the buffer
                     3000            invalid connection (channel) number
                     3004            the connection is closed
                     3005            no data
                     3012            TCPIP not start yet

   13. SOCKET_CAN_SEND (N%, L%)
       Purpose    : To check if the data can be sent or not.
       Parameters : N% is the connection (channel) number ranging from 0 to 3
                    L% is the length of the data.
       Usage      : A% = SOCKET_CAN_SEND (0, 10)
       Return     : 
                    value                meaning
                      0              data can be sent
                     3000            invalid connection (channel) number
                     3004            the connection is closed
                     3007            can not send data
                     3012            TCPIP not start yet

   14. TCP_ERR_CODE
       Purpose    : To check the result after executing any command.
       Usage      : ERR% = TCP_ERR_CODE
       Error Code : 
                    value                meaning
                     3000       invalid connection (channel) number
                     3001       the connection is already open
                     3002       local port undefined in server mode
                     3003       no remote port definition in client mode
                     3004       the connection is closed
                     3005       no data
                     3006       data is too long
                     3007       the networking is busy or data is too long
                     3008       data transmission error
                     3009       hardware initialization failure
                     3010       double run START TCPIP without STOP TCPIP
                     3011       no connection available (all is being used)
                     3012       TCPIP not start yet
                      -10       parameter error
                      -11       host is not reachable
                      -12       time out
                      -13       hardware failure
                      -14       protocol error
                      -15       no buffer space
                      -16       invalid connection block
                      -17       invalid pointer argument
                      -18       operation blocked
                      -19       message too long
                      -20       protocol not available
                      -30       unknown remote name
                      -31       DNS protocol error (package class)
                      -32       DNS protocol error (package type)
                      -33       remote name too long (more than 38 chars)

   15. IP_CFG (INDEX%, IP$) or IP_CONFIGURE (INDEX%, IP$)
       Purpose    : To configure the TCP/IP setting.
                    Note this setting will be written to the flash memory.
                    It is not necessary to configure the setting every time.
       Parameters : INDEX% is the number to indicate the configuration item.
                       1        Local IP
                       2        Subnet Mask
                       3        Default Gateway
                       4        DNS server

                    IP$ is a string that contains the IP address.

       Usage      : IP_CFG (1, "192.168.1.241")        'set local IP
                    IP_CFG (2, "255.255.255.0")        'set subnet mask
                    IP_CFG (3, "192.168.1.250")        'IP of the gateway
                    IP_CFG (4, "168.95.1.1")           'IP of DNS server

   16. DNS_RESOLVER$
       Purpose    : To get the IP address of the remote device.
                    Note it is necessary to define the DNS server IP before
                    executing this command.
       Usage      : IP$ = DNS_RESOLVER ("www.cipherlab.com")

/---------------------- Version 3.00 on Feb. 21, 2001 ----------------------/

New function : WEDGE_READY

       Purpose    : To check if the keyboard wedge cable is well connected
                    and ready to send.
       Parameters : None
       Return     : 1 if ready, 0 if not
       Usage      : state% = Wedge_Ready
       Example    :
                    locate 1,1
                    print "Wedge test"
                    enable reader(1)

                    loop:
                    data$ = get_reader_data$(1)
                    if data$ <> "" then
                         locate 3,1
                         print data$
                         if (WEDGE_READY = 1) THEN
                             send_wedge (data$)
                         end if
                    end if
                    goto loop

       Remark     : It takes about 110 ms to detect the status of keyboard
                    wedge connection. Therefore for continuous and fast data
                    transmission, just call this function once, don't call it
                    repeatedly.

/---------------------- Version 3.01 on March 21, 2001 ---------------------/

Increase the maximum compileable program lines from 5,000 to 10,000.

/---------------------- Version 3.10 on May 29, 2001 -----------------------/

New function : FLASH_WRITE (index%, str$)

       Purpose    : To write a data string to the flash memory. Up to 256
                    records can be saved to the flash memory.
       Parameters : index%, ranging from 1 to 256, represents the ordinal
                            number of the record.
                    str$, the data string to be saved to the flash memory.
       Return     : error code
                  		 1, wrote successfully (normal return)
                 			-1,	the BASIC program is too large, no free flash memory 
                        available
                 			-2,	error command for erasing the FLASH memory
                 			-3,	the given index is over range
                 			-4,	failed to write (probably flash isn't erased yet or
                        something wrong)
       Usage      : err% = FLASH_WRITE (1, "data number #1")
                    ....
                    err% = FLASH_WRITE (256, "data number #256")
       Remark     : Before writing any data to the flash memory, it is
                    necessary to use the following command to erase the flash
                    first:

                    err% = FLASH_WRITE (0, "ERASE")

                    Note the index must 0 and the string must be "ERASE".
                    After erasing the flash, you then can write data to it
                    record by record. But once you need to write data to the
                    same index number, the flash need to be erased again, 
                    otherwise the write command will be failed.

New function : FLASH_READ$ (index%)

       Purpose    : To read a data string from the flash memory.
       Parameters : index%, ranging from 1 to 256, represents the ordinal
                            number of the record.
       Return     : the data reading from the flash memory.
       Usage      : A$ = FLASH_READ$ (3)              ' read the 3rd record

/---------------------- Version 3.11 on June 13, 2001 ----------------------/

Increase the maximum compileable string constant from 1,000 to 2,000.

/---------------------- Version 3.20 on June 29, 2001 ----------------------/

New function for 201, 510, 520 :

    1. MSR_DIRECTION
       Purpose    : To detect the MSR reading (card swiping) direction
       Parameters : none
       Return     : 0 : normal direction
                    1 : reverse direction
       Usage      : d% = MSR_DIRECTION

New statements for 711, 720 :

    1. LCD_CONTRAST (level%)
       Purpose    : To set the contrast for the display.
       Parameters : level%, ranging from 1 to 8
       Return     : none
       Usage      : LCD_CONTRAST (4)           ' set LCD contrast to level 4

    2. ICON_ZONE_PRINT (state%)
       Purpose    : To enable / disable the printing on the icon area.
       Parameters : 0, print on the icon area is not allowed (default).
                    1, allow to print on the icon area.
       Return     : none
       Usage      : ICON_ZONE_PRINT (1)        ' enable icon area printing
       Remark     : The LCD for CPT-711 and CPT-720 is 128x64 pixels, but
                    the default printable area is 120x64, i.e., you can has
                    20x8 characters for small font (6x8 dots per char), and
                    15x4 characters for large font (8x16 dots per char). The
                    icon area is the right-most 8x64 pixels which can be
                    accessed through graphic commands only by default. If the
                    icon area is set to printable, then you can have 21
                    characters per line for small font and 16 characters per
                    line for large font. But please note that the system may
                    still show the battery and alpha icons in this icon area
                    even it is set to printable for the user program.

    3. SYSTEM_PASSWORD (string$)
       Purpose    : To set the password protection for the system menu.
       Parameters : string$, the string constant or variable that represents
                    the password.
       Return     : none
       Usage      : SYSTEM_PASSWORD ("12345")

/---------------------- Version 3.21 on July 26, 2001 ----------------------/

New statements for 711, 720 :

    1. IRDA_TIMEOUT (t%)
       Purpose    : To set the timeout for IrDA connection
       Parameters : t%, ranging from 1 to 8
                        1 :  3 sec
                        2 :  8 sec
                        3 : 12 sec
                        4 : 16 sec
                        5 : 20 sec
                        6 : 25 sec
                        7 : 30 sec
                        8 : 40 sec
       Return     : none
       Usage      : IRDA_TIMEOUT (7)            ' set timeout to 30 seconds

/---------------------- Version 3.22 on Aug. 15, 2001 ----------------------/

New feature: supports "Telepen" code

/---------------------- Version 3.30 on Oct. 22, 2001 ----------------------/

New functions and statements for 8100 RF terminals

    1. SET_RF_ID (id%)
       Purpose    : Sets the ID of the terminal
       Parameters : the ID, from 1 to 45
       Return     : none
       Usage      : SET_RF_ID (1)
       See also   : GET_RF_ID

    2. GET_RF_ID
       Purpose    : Retrieves the ID of the terminal.
       Parameters : none
       Return     : the terminal's ID
       Usage      : Id% = GET_RF_ID
       See also   : SET_RF_ID

    3. SET_RF_CHANNEL (channel%)
       Purpose    : Sets the channel of the terminal.
       Parameters : channel 1 ~ 4
       Return     : none
       Usage      : SET_RF_CHANNEL (1)
       See also   : GET_RF_CHANNEL 

    4. GET_RF_CHANNEL 
       Purpose    : Retrieves the channel of the terminal.
       Parameters : none
       Return     : the channel number 1 ~ 4
       Usage      : Channel% = Get_RF_Channel
       See also   : SET_RF_CHANNEL

    5. SET_RF_TIMEOUT (sec%)
       Purpose    : Sets the duration of retries in seconds for sending data.
       Parameters : the duration in seconds,
                    if set to 0, it's determined by the system.
       Return     : none
       Usage      : Set_RF_Timeout (5)
       See also   : SEARCH_RF_CHANNEL 

    6. SEARCH_RF_CHANNEL (sec%)
       Purpose    : To automatically search the channel when not connected
                    to a base for the specified period.
       Parameters : time in seconds
       Return     : none
       Usage      : Search_RF_Channel (10)                   
       See also   : SET_RF_TIMEOUT

    7. CHECK_RF_BASE
       Purpose    : To check if the terminal is connected to a base.
       Parameters : none
       Return     : 0, no base found
                    1, base present
       Usage      : if (Check_RF_Base = 1) then
                        ...... 

    8. CHECK_RF_SEND
       Purpose    : To check if data has been sent successfully or not.
       Parameters : none
       Return     : 1 for OK, 0 for NG
       Usage      : Write_Com (2, A$)
                    if (Check_RF_SEND = 0) then
                        goto ReSend

    9. SET_RF_POWER (power%)
       Purpose    : Sets the RF output power.      
       Parameters : the power level  1 ~ 5
                    1: 10dbm, 2: 5dbm,  3: 4dbm
                    4: 0dbm,  5: -5dbm
       Return     : none                    
       Usage      : Set_RF_Power (2)
       See also   : GET_RF_POWER

    10.GET_RF_POWER
       Purpose    : Gets the level of the RF output power.
       Parameters : none     
       Return     : the power level  1 ~ 5
                    1: 10dbm, 2: 5dbm,  3: 4dbm
                    4: 0dbm,  5: -5dbm
       Usage      : level% = Get_RF_Power
       See also   : SET_RF_POWER


/---------------------- Version 3.32 on May 3, 2002 ------------------------/

Fix a bug when the step of a FOR loop is negative. For example,

      FOR i=100 TO 1 STEP -1
          ......
          ......
      NEXT i


/---------------------- Version 3.33 on May 9, 2002 ------------------------/

New function for 711, 720, 8300 series:

    1. IRDA_STATUS (condition%)
       Purpose    : To check the IrDA connection or transmission status
       Parameters : condition%
                      0 :  check IrDA connection status
                      1 :  check whether data being send successfully or not
       Return     : 1, OK
                    0, NG
       Usage      : 
                    Cls
                    Set_Com_Type (2, 4)
                    Open_Com (2)

                    Loop1:

                    If (IrDA_Status (0) = 1) Then      ' check connection
                        Beep (4400, 5)
                    Else
                        GoTo Loop1
                    End If

                    Write_Com (2, "My Data")
                    If (IrDA_Status (1) = 1) Then      ' check transmission
                        Print "Write OK"
                    Else
                        Print "Write NG"
                    End If

                    Close_Com (2)


/---------------------- Version 3.36 on Dec 10, 2002 -----------------------/

Change "Target machine" setting from "711, 8100, 8300" to "711, 8 series".

/---------------------- Version 3.40 on Feb 20, 2003 -----------------------/

Allows to define a string constant with its length up to 250 characters.

/---------------------- Version 3.41 on Mar 05, 2003 -----------------------/

Increase the maximum compileable program lines from 10,000 to 12,000.
Increase the maximum number of labels and variables from 600 to 1,000.

/---------------------- Version 3.42 on Mar 31, 2003 -----------------------/

New Function & statement for 8000 and 8300 series:

    1. SET_LANGUAGE (lang%)
       Purpose    : Select the font (language) to be used from the
                    multi-language font file. Note this function will fail if
                    the multi-language font file does not exist.
       Parameters : integer from 16 to 26
                    16     ASCII characters
                    17     French
                    18     Hebrew
                    19     Latin
                    20     Nordic
                    21     Portugal
                    22     Russian
                    23     Slavic
                    24     Polish
                    25     Turkish
                    26     Slovak (CP-1250)
       Return     : none
       Usage      : SET_LANGUAGE (17)          ' select French
       See also   : GET_LANGUAGE

    2. GET_LANGUAGE
       Purpose    : Retrieves the font/language setting.
       Parameters : none
       Return     : the font file or language setting represented by the
                    following integer numbers:
                    0      System font
                    1      Traditional Chinese font (Big-5, 16x16 dots)
                    2      Simplified Chinese font (GB code, 12x12 dots)
                    3      Simplified Chinese font (GB code, 16x16 dots)
                    4      Korean font
                    5      Japanese font
                    6      Hebrew font
                    7      Polish font
                    8      Russian font
                    16     ASCII characters
                    17     French
                    18     Hebrew
                    19     Latin
                    20     Nordic
                    21     Portugal
                    22     Russian
                    23     Slavic
                    24     Polish
                    25     Turkish
                    26     Slovak (CP-1250)
       Usage      : language% = GET_LANGUAGE
       See also   : SET_LANGUAGE

/---------------------- Version 3.50 on May 6, 2003 ------------------------/

New Function for 8060 / 8360 / 8370:

    1. GET_WLAN_STATUS (INDEX%)
       Purpose    : Get the status of the wireless communication.
       Parameters : INDEX% is the number indicating the configuration item.
                      1   Connection status; (802.11b & Bluetooth)
                      2   Communication quality; (802.11b)
                      3   Signal strength; (802.11b & Bluetooth)
                      4   Noise level; (802.11b)
                      5   Current communication channel; (802.11b)
                      6   Transmission rate; (802.11b)
                      7   Check whether the terminal has gotten a valid IP or
                          not if the DHCP is enable. (802.11b & Bluetooth)
                      .    // 0: not ready, 1:ready
       Returns    : INDEX = 1 (connection status)
                          0        Disabled
                          2        Searching
                          4        Connected
                          5        AP out of range
                    INDEX = 2 (comm quality)
                          The return values range from 0 to 80.
                           0 ~ 10  very poor
                          10 ~ 15  poor
                          15 ~ 30  fair
                          30 ~ 50  good
                          50 ~ 80  very good
                    INDEX = 3 (signal strength)
                          The return values range from 0 to 120.
                           0 ~ 30  weak
                          30 ~ 60  moderate
                          over 60  strong
                    INDEX = 4 (noise level)
                          The return values range from 1 to 5.
                                1  weak
                            2 ~ 3  moderate
                            4 ~ 5  strong
                    INDEX = 5 (channel number)
                          Returns the channel numbers ranging from 1 to 11.
                    INDEX = 6 (transmission rate)
                            1      1 Mbps
                            2      2 Mbps
                            4      5.5 Mbps
                            8      11 Mbps
                    INDEX = 7 (terminal IP)
                            0      not ready
                            1      ready 
       Usage      : nQuality = GET_WLAN_STATUS (2)      'check comm quality

New Function for all portable terminals:

    1. GET_TARGET_MACHINE$
       Purpose    : To get the model number of the target terminal.
       Parameters : None.
       Return     : The string of the model number.
       Usage      : A$ = GET_TARGET_MACHINE$
                    IF (A$ = "711") THEN
                        .......
                    ELSE IF (A$ = "8000") THEN
                        .......
                    ELSE IF (A$ = "8300") THEN
                        .......
                    END IF

    2. MENU
       Purpose    : Create a menu and let the user to select an item by using
                    the UP / DOWN arrow keys and use the ENTER key to confirm
                    the selection or ESC to cancel the operation.
       Parameters : The string of the menu items that separated and ended
                    by carriage return (CR, 0x0d).
       Return     : The ordinal number of the menu item that the user has 
                    selected.
       Usage      : A$ = "Collect" + CHR$(13) + "Upload" + CHR$(13) + 
                         "Edit" + CHR$(13)
                    nSelect = MENU (A$)


/---------------------- Version 3.51 on June 6, 2003 -----------------------/

Support new barcode types: RSS14, RSS14 Limited and RSS14 Expanded.

/---------------------- Version 3.60 on Dec. 3, 2003 -----------------------/

two new functions:

    1. BT_INQUIRY$
       Purpose    : To search the available Bluetooth devices
       Parameters : None.
       Return     : The string that contains the address (6 bytes) and name
                    (20 bytes) of the devices. Note there might be many
                    devices concatenated together, each occupies 26 bytes
                    with the first 6 for address and the rest 20 for name.
       Usage      : Bluetooth$ = BT_INQUIRY$

    2. BT_PAIRING (addr$, type%)
       Purpose    : Check whether the device can provide the specified 
                    type of service or not.
       Parameters : addr$, the address string
                    type%, currently support the following 2 types:
                           1, Bluetooth network
                           3, serial port
       Return     : 1 if the device can provide that service, 0 otherwise
       Usage      : Bluetooth$ = BT_INQUIRY$
                    Address$ = LEFT$ (Bluetooth$, 6)
                    IF (BT_PAIRING (Address$, 3)) THEN
                        ...........
                        ...........
                    END IF

/---------------------- Version 3.61 on April 6, 2004 ----------------------/

When existing the BASIC compiler or opening a new file, if the current file
has not been changed but barcode settings have been changed, the BC will
ask the user whether to save the current file or not.

/---------------------- Version 3.62 on June 7, 2004 -----------------------/

Add a checkbox "Share file space with other applications" to the
 "Configure Transaction Files" dialogbox and
 "Create DBF files" dialogbox.

The 8xxx series terminals support multiple applications (but only one of them
is active), this new setting allows different applications share the same files.
    
/---------------------- Version 4.00 on June 21, 2005 ----------------------/
New functions for 8500:

    - FUNCTION_TOGGLE (status%)
    - VIBRATOR (mode%)
    - CIRCLE (cx%, cy%, r%, type%, mode%)
    - LINE (x1%, y1%, x2%, y2%, mode%)
    - PUT_PIXEL (x%, y%, mode%)
    - RECTANGLE (x1%, y1%, x2%, y2%, type%, mode%)
    - WAIT_HOURGLASS (x%, y%, mode%)
    - SET_SCREENITEMS (mode%, TotalItem%, Item$)
    - % = GET_SCREENITEM
    - ENABLE_TOUCHSCREEN
    - DISABLE_TOUCHSCREEN
    - SET_SIGNAREA (UppLeft_x%, UppLeft_y%, LowRight_x%, LowRight_y%)
    - SET_RFID_READ (TagType%, start%, MaxLen%)
    - SET_RFID_WRITE (TagType%, start%, MaxLen%)
    - PUTKEY (KeyVal%)

    - % = GSM_CHANGE_PIN (old$, new$)
    - % = GSM_CHECK_PIN (pin$)
    - % = GSM_SET_PINLOCK (pin$, mode%)

Also, create alias SET_NET_PARAMETER (index%, A$) for IP_CFG (index%, IP$)
               and GET_NET_PARAMETER$ (index%) for SOCKET_IP$ (port%)
               and GET_NET_STATUS (index%) for GET_WLAN_STATUS (index%)

/---------------------- Version 4.02 on Nov 29, 2005 ----------------------/
New function:

   Data$ = SYSTEM_INFORMATION$ (index%)
    where index% = 1 ¡V Library Version
                   2 ¡V Basic Version
                   3 ¡V Kernel Version
                   4 ¡V Hardware Version
                   5 ¡V Manufacture Date
                   6 ¡V Serial Number
                   7 ¡V Original Serial Number
                   8 ¡V Device Type
 
/---------------------- Version 4.03 on Feb 7, 2006 ----------------------/
New statement:
  
   READER_CONFIG

       Purpose    : To enable new settings for the following readers,
                      - Long Range Laser
                      - Extra Long Range Laser
                      - 2D Reader
                    For the above readers, after calling "READER_SEETING",
                    new settings will not take effect until "READER_CONFIG"
                    is being called.

       Parameters : None.
       Return     : None.
       Usage      : READER_CONFIG


/---------------------- Version 4.04 on Mar 21, 2006 ----------------------/
New function:
  
   BIT_OPERATOR (Operator, Op1, Op2)

       Purpose    : To perform bit-wise operations for integers and long integers.
       Parameters : operator = 1 -> Bit-wise AND
                             = 2 -> Bit-wise OR
                             = 3 -> Bit-wise XOR
                    Op1, the 1st operand
                    Op2, the 2nd operand
       Return     : result of the bit-wise operation
       Usage      : C = BIT_OPERATOR (1, A, B)

/---------------------- Version 4.05 on Apr 12, 2006 ----------------------/
Fix a bug:
   The compiler fails to retry the download process.

/---------------------- Version 4.06 on Jun 08, 2006 ----------------------/

Modify the UPDATE_RECORD function so that it can support the following two
formats:

  UPDATE_RECORD (DB_file%, Data$)
  UPDATE_RECORD (DB_file%, Index%, Data$)

If "index" is not given, the default IDX file which keeps the original data
sequence will be used.

/---------------------- Version 4.07 on July 05, 2006 ----------------------/

Add two new functions for RFID:

  1. SET_RFID_KEY (TagType%, KeyString$, KeyType%)
     Purpose    : To enable the READ & WRITE capability of a specific tag
     Parameters : TagType%, should be 3, representing TAG_MifareISO14443A
                  KeyString$, a 12-byte string
                  KeyType%, 1 for type A and 2 for type B
     Return     : None.
     Usage      : SET_RFID_KEY (3, KeyString$, 1)

  2. GET_RFID_KEY$ (TagType%)
     Purpose    : To get the string of the key.
     Parameters : TagType%, should be 3, representing TAG_MifareISO14443A
     Return     : String of the key.
     Usage      : KeyString$ = GET_RFID_KEY (3)

/---------------------- Version 4.08 on Aug 17, 2006 ----------------------/

Supports COM port number (for download) that is greater than 9.

/---------------------- Version 4.10 on Dec 15, 2006 ----------------------/

New command: ON POWER_ON GOSUB....

Purpose: Upon power on the unit, go to a sub-routine first to do an 
         initialization job.

/---------------------- Version 4.11 on Dec 26, 2006 ----------------------/
New FTP service routine:

        String$ = FTP_ROUTINE$ (Service%, File%, ParamA$, ParamB$)
    or  String$ = FTP_ROUTINE$ (Service%, File%, ParamA$)
    or  String$ = FTP_ROUTINE$ (Service%, File%)

/---------------------- Version 4.12 on Apr 09, 2007 ----------------------/

Fixed the bug that compilation error happened if a string included 0xFF.

/---------------------- Version 4.13 on Sept 26, 2007 ----------------------/
Added two new functions:

  1. int Update_BASIC (int file_no)
     Purpose    : To make a BASIC object (*.syn) stored as a transaction file
                  become the active program. 
     Parameters : file_no, file number (0 ~ 5 in C corresponds to 1 ~ 6 in BASIC)
     return     : 0* = Successful but nonsense because new program will replace
                       the old one and the system will restart.
                 -1  = Invalid transaction file
                 -2  = Can't find BASIC object file in this transaction file
                 -3  = No free space in flash before writing
                 -4  = Can't read header(*.ini) of the BASIC App from transaction file
                 -5* = Can't read BASIC object file (*.syn) from the transaction file
                 -6  = RAM size can not fit
                 -7* = write flash error, could be insufficient flash space,
                       illegal address or the sector of flash can't be erased.
                  "*"  means the error code may not returned because the
                       original BASIC App has been overwritten.

  2. int DownLoad_BASIC (int file_no, int port_no)
     Purpose    : To read new a BASIC object file from comm port and store it
                  into the BASIC transaction file specified by file_no.
     Parameters : file_no, the transaction file to store the BASIC object file
     port_no    : the COM port specified by BASIC application.
     return     : 0 = Successful
                 -1 = Invalid transaction file
                 -2 = Invalid COM port
                 -3 = No response from COM port, user can only press <ESC> to abort.
                 -4 = Failed to read basic app version
                 -5 = Failed to read basic ini file
                 -6 = Failed to read basic syn file
                 -7 = Write error, insufficient SRAM space

/---------------------- Version 4.14 on May 16, 2008 ----------------------/

Add a parameter for the RAM_SIZE function, if no parameter is passed,
the RAM_SIZE function behaves as before.

/---------------------- Version 4.15 on June 15, 2009 ----------------------/
1.Target terminal to remove 720 and new add 8400 selection.
2.To remove contents and index sub-menu items under Help menu item.
3.New functions added
  a.IOPIN_STATUS
  b.SD_SIZE
  c.SD_FREE_MEMORY
4.8400 to support DBF and DAT on SD Card
  a.To add ¡§Create files on SD Card¡¨ option on ¡§Create DBF files¡¨ dialog to create DBF on SD card or not.
  b.To add ¡§SD Card¡¨ option on ¡§Configure Transaction Files¡¨ dialog to create transaction files on SD card or not.

/---------------------- Version 4.17 on November 20, 2009 -----------------/
1.Only 8500-2D support Focus Mode settings
2.Only 8400 can select reader type
3.Add Decode Supplementals settings of ENA-13
4.Support Chinese25 code type in 8400-2D

/---------------------- Version 4.18 on January 19, 2011 -----------------/
Modify to add 8200 to Target Machine combo box.

/---------------------- Version 4.19 on January 20, 2011 -----------------/
Fix bug that failed to fetch file name when the file path contains dot or double bytes character.

/---------------------- Version 4.20 on May 31, 2011 -----------------/
1.Support two scan mode "Continuous" and "Alternate" for 2D reader
2.Change the default setting of laser mode of 2D reader from 1 to 15.

/---------------------- Version 4.30 on Aug. 19, 2011---------------------/
1. Add 8700 to Target Machine combo box.
/---------------------- Version 5.00 on Aug. 28, 2012---------------------/

To support new functions of basic runtime
1.	A$=WIFI_SCAN(N1%, N2%)
2.	SET_TRIGGER(N%)
3.	SET_AUTO_BKLIT(N%)
4.	SET_BKLIT_LEVEL(N%)
5.	A%=GET_BKLIT_LEVEL
6.	SET_MIDDLE_ENTER(N%)
7.	A%=GET_TRIGGER
8.	A%=CHECK_ENTER_KEY

/---------------------- Versionv 5.01 on Oct. 17, 2012---------------------/

Add 2 new functions
1.	SET_PWR_KEY(N%)
2.	OSK_TOGGLE

/---------------------- Versionv 5.02 on Nov. 04, 2013---------------------/

< Modification >:
1.  [Configure > Target Machine] Modify target terminal list.

     ¡´ Originally list         
        - 201
        - 510
        - 520
        - 711,8000,8300,8500,5100
        - 8200,8400,8700
        
     ¡´ Modify list
         - 201
         - 510
         - 520
         - 711,5100
         - 8000
         - 8300
         - 8500
         - 8200,8400
         - 8700
      
2.	Modify Symbologies [Configure > Barcode Settings] for 8000, 8300, 8500, 8200/8400, and 8700.
ƒÜ	8000 supports 1D Laser Reader.
ƒÜ	8300 supports 1D Laser Reader.
ƒÜ	8500 supports 1D Laser Reader.
ƒÜ	8200/8400 support 1D Laser Reader and 2D Reader.
ƒÜ	8700 supports 1D Laser / Long Range Laser Reader and 2D Reader.

< Bugs Fixed >:
1.	To fix a bug that IF¡KTHEN¡K[ELSE¡K][END IF] statement can¡¦t be nested 10 levels.
