EXTERNAL KEYBOARD FOR BAR CODE PRINTER Model: KB-80 BASIC SPECIFICATION First Edition: February 4, 1999 Second Edition: July 16, 1999 TOSHIBA TEC CORPORATION
TABLE OF CONTENTS Page CONSTANTS AND VARIABLES........................................................................... 1 LISTS OF COMMANDS, STATEMENTS, AND FUNCTIONS ............................... 3 ABS...................................................................................................................... 9 ASC...................................................................................................................... 10 BEEP................................................
Page LEN ...................................................................................................................... 42 LINE INPUT#........................................................................................................ 43 LOC...................................................................................................................... 44 LOCATE............................................................................................................... 45 LOF ....
CONSTANTS AND VARIABLES CONSTANTS Character constants: A string which is 255 digits or less including alphanumeric, Kana, symbol, and Kanji, enclosed in double quotation marks (”). If a double quotation mark (”) is used in the character string, the CHR$ function should be used.
OPERATORS Arithmetic operators: Operator ^ *, / ¥ MOD +, - Operation Exponential operation Sign Multiplication, Real division Integer division (The quotient is output.) Integer division (The remainder is output.) Addition, Subtraction The operations enclosed in parentheses are processed first. Relational operators: Compares between two values. The result is true or false.
LISTS OF COMMANDS, STATEMENTS, AND FUNCTIONS Declarations and definitions Statement CLEAR Format CLEAR Function Initializes a variable. DIM Format DIM ( [, ] ···) [, ( [, ] ···) ] ··· Function Specifies the max. number of array elements, and allocates the memory area in the memory. ERASE Format ERASE [, ] ··· Function Erases the specified array from the program.
IF ~ THEN ~ ELSE Format IF THEN [ELSE ] IF GOTO [ELSE ] Function Judges the condition, and changes the flow of the program.
Character string process Statement ASC Format ASC ( ) Function Provides the character code (ASCII) for the first character of the character string. CHR$ Format CHR$ ( [, ] ···) Function Converts the character code (ASCII and internal sequential code) to a character. RIGHT$ Format RIGHT$ ( , ) Function Provides a character string of the length specified on the right side of the character string.
Error process Statement ON ERROR Format ON ERROR GOTO Function Declares that the interrupt for the error process is enabled, and declares the line number of the subroutine to be executed when an error occurs. RESUME Format RESUME [0] NEXT Function Terminates an error process, and resumes execution of the program. ERL/ERR Format ERR/ERL Function Provides the line number in which an error occurs (ERL) and the error code (ERR).
Communication input/output Statement OPEN COM Format OPEN ”COM : [communication condition] ” AS # Function Opens the communication file. ON COM (n) Format ON COM ( ) GOSUB Function Declares an interrupt which occurs when the data is input into the communication buffer, and declares the start line number for the subroutine to be executed.
File input/output Statement OPEN Format OPEN [FOR ] AS [#] [LEN= ] Function Opens a file. CLOSE Format CLOSE [ [#] [, [#] ] ···] Function Closes a file. INPUT# Format INPUT# , [, ] ··· Function Reads data from the sequential file, and assigns it to a variable. LINE INPUT# Format LINE INPUT# , Function Reads one whole line (record) (max.
ABS Function Format Explanation Provides the absolute value. ABS ( ) The absolute value for (0 or a positive value) is provided as a function value.
ASC Function Format Explanation Provides the character code (ASCII) for the first character of the character string. ASC ( ) The character code for the first character (left side) of is provided. If is a null string, an error occurs.
BEEP Function Format Explanation Sounds the internal buzzer. BEEP The internal buzzer is sounded for 100 ms.
CHAIN Function Format Term Explanation Loads another program, and executes it. CHAIN [, ALL] : The program file to be executed should be specified. (The file name should be included.) The program designated in is executed. CHAIN Program 1 CHAIN Program 2 Program 3 If the ALL option is designated, all variables are passed. If it is necessary to pass variables when the ALL option is omitted, the COMMON statement should be used.
CHR$ Function Format Term Explanation Converts the character code (ASCII and internal sequence code) to a character. CHR$ ( [, ] ···) : The numeric expression within the range between 0 and 255 (&H0 to &HFF) indicating ASCII code The CHR$ function regards a value for as ASCII code, and converts it to a character. The CHR$ is the opposite of the ASC function.
CINT Function Format Explanation Provides the integer value to which a real value is converted. CINT ( ) The value for is rounded off to the nearest whole number, making it into an integer.
CLEAR Function Format Explanation Initializes a variable. CLEAR The memory used for storing data is freed without deleting any programs in the memory. After the CLEAR statement is executed, all numeric variables and character variables become 0 and null strings (“”), respectively. The array declaration becomes invalid. All files are closed. The CLEAR statement executes the following processes. 1. All files are closed. 2. All COMMON statements and user variables are initialized. 3.
CLOSE Function Format Term Explanation Close a file. CLOSE [ [#] [, [#] ] ···] : The number assigned to the file or the device by the OPEN statement The file corresponding to is closed. One or more s can be specified once in the CLOSE statement. If is omitted, all opened files are closed. Once a file has been closed, its number can be used for opening another file.
CLS Function Format Clears the screen.
COMMON Function Format Term Explanation Declares the variable is to be passed from the original program to a program called by the CHAIN statement. COMMON [, ] ··· : The variable name to be passed should be specified. The COMMON statement is used together with the CHAIN statement, and declares that a variable is to be passed from the original program to a called program. The same variable name cannot be used more than once in the COMMON statement.
COM ON/STOP Function Format Term Explanation Enables/Stops an interrupt from the RS-232C communication file. COM ( ) ON COM ( ) STOP : The RS-232C interface number (1 or 2) The interrupt which occurs when the communication flows to the RS-232C from an external source is enabled by the COM ( ) ON statement, or stopped by the COM ( ) STOP statement.
CSNG Function Format Explanation Provides a value which is converted to a single-precision real value. CSNG ( ) The value for is converted to a 7-digit single-precision real value.
CVI/CVS Function Format Explanation Provides a value for numeric value data which is converted to the numeric data. CVI ( <2-byte character string> ) CVS ( <4-byte character string> ) All numeric values in the random file on the disk are converted to the character string type. This function returns the numeric data converted to the character string type to a numeric value. CVI converts the first 2 bytes (2 characters) to an integer.
DATA Function Format Term Explanation Sets a numeric value or a character constant read by the READ statement. DATA [, ] ··· : A numeric constant or character constant The DATA statement is a non-executing statement, and should be placed before a READ statement. The data which can be included in one line (max. 255 characters) can be written in one DATA statement. There is no limit to the number of DATA statements that can be used in one program.
DIM Function Specifies the max. number of array elements, and allocates the memory area in the memory. Format DIM ( ) ] ···) [, ( [, ] ···) ] ··· Term : Array variable name (It should be named according to the usual variable naming conventions.) : Explanation A numeric value or numeric expression indicating the max.
END Function Format Explanation Terminates the execution of the program, closes all opened files, and returns to the command level state. END The END statement can be placed in any position in which the program is to be terminated. One or more END statements can also exist in the program. The END statement placed at the end of the program can be omitted.
EOF Function Format Term Explanation Checks the end of the sequential file, or whether or not the communication buffer becomes empty. EOF ( ) : The number assigned to the file by the OPEN statement The EOF function returns -1 (true) when the specified file reaches EOF (End of File). If the specified file does not reach EOF, the EOF function returns 0 (false). A sequential file and RS-232C communication file are available.
ERASE Function Format Term Explanation Erases the specified array from the program. ERASE [, ] ··· : Array name to be erased When there is not enough memory area while executing the program, arrays which become unnecessary should be erased by using the ERASE statement. The areas of erased arrays can be used for other arrays. The ERASE statement can also be used for reinitializing the array which has been used in the program for another object.
ERR/ERL Function Format Provides the line number in which an error occurs (ERL) and the error code (ERR). ERR ERL Explanation The system variables, ERR and ERL, are used in the IF ~ THEN statement, and used for branching to error processes. (For details, refer to “ON ERROR”.) Immediately after BASIC is started up, ERL is 0. A numeric value for the variable cannot be assigned to ERR and ERL.
FIELD Function Format Term Allocates the variable area to the random file buffer.
FOR ~ NEXT Function Format Term Executes the statements included from the FOR statement to the NEXT statement repeatedly while the given conditions are satisfied.
Other FOR ~ NEXT statements can be used (nested) within the FOR ~ NEXT statement. In this case, each to be set should be different. One FOR ~ NEXT statement should be completely included in the other FOR ~ NEXT statement. Ex.) FOR I=1 TO 5 FOR J=1 TO 5 FOR I=1 TO 5 FOR J=1 TO 5 NEXT J NEXT I NEXT I NEXT J If FOR ~ NEXT statements are terminated at the same point, their NEXT statements can be described in one statement as shown below. Ex.
GET Function Format Term Inputs the data in a file into the buffer. GET [#] [, ] : The number assigned to the file by the OPEN statement : Explanation The record number between 1 and 65535, or the number of bytes of the data read from the RS-232C communication file The GET statement reads the data in the file specified in , and inputs the read data into the corresponding buffer.
GOTO Function Format Term Explanation Moves the execution to the specified line without any conditions. GOTO : The line number to which the execution is moved The GOTO statement moves the execution to the specified line. When the specified line is a non-executable statement (such as a REM statement or a DATA statement), the execution starts from the next executable statement.
HEX$ Function Format Explanation Converts a decimal number to a hexadecimal number, and then provides the character string. HEX$ ( ) is converted to an integer value which is rounded off to a whole number before is used for the HEX$ function. The result of the HEX$ function is a hexadecimal number (0 to FF). However, a character variable should be used for the assignment since the result is handled as a character.
IF ~ THEN ~ ELSE Function Format Judges the condition, and changes the flow of the program.
INKEY$ Function Format Explanation Provides the leading character if any key is pressed on the keyboard, or provides a null string if no key is pressed on the keyboard. INKEY$ The number of characters provided for the INKEY$ variable is 0 (null string) or 1. It is determined according to the key entry. “0” indicates that key entry is not performed. The INKEY$ function does not display the key entry on the screen.
INPUT Function Format Term Reads a numeric value or a character from the keyboard, and assigns it to a variable. INPUT [;] [” ” ; ] [, ] ··· : A character string which is output on the screen when the input is performed (It is used to make it easy to understand the numeric value or character to be input.
INPUT# Function Format Term Reads data from the sequential file, and assigns it to a variable. INPUT# , [, ] ··· : The number assigned to the file by the OPEN statement : The variable name to which data is assigned. A numeric variable or character variable Explanation The data should be read from the sequential file on the disk or the RS-232C communication device. The type of should match the type of data.
INPUT$ Function Format Term Reads the character string with the specified length from the keyboard or the file. INPUT$ ( [, [#] ] ) : : Explanation The number of characters to be read from the keyboard or file (1 to 255.) The number assigned to the file by the OPEN statement The character string with the length specified in is read from the file specified in .
INSTR Function Format Term Searches for the specified characters from the character string, and provides the first character position of the characters. INSTR ( [ , ] , ) : Indicates the position in where the searching of is started.
INT Function Format Explanation Provides the max. integer value not exceeding the specified . INT ( ) The max. integer value not exceeding is provided.
LEFT$ Function Format Term Provides a character string of the length specified on the left side of the character string. LEFT$ ( , ) : Any character string : Explanation The length is specified on the left side of . (Unit: bytes, Range: 0 to 255) is converted to an integer value rounded off to a whole number before it is evaluated.
LEN Function Format Explanation Provides the length of the character string (the number of bytes). Kanji is counted as 2 bytes. LEN ( ) The length should be between 0 and 255 bytes. A space and a code which is not displayed as the control code are also counted and included in the length.
LINE INPUT# Function Format Term Reads one whole line (record) (max. 255 characters) from the sequential file. LINE INPUT# , : The number assigned to the file by the OPEN statement : Explanation A character variable to which one whole line is assigned The LINE INPUT# statement reads one whole line (record) from the sequential file. The record of the carriage return (CR) is used as a delimiter which delimits the line.
LOC Function Format Term Explanation Provides the current theoretical location in the file. LOC ( ) : The number assigned to the file by the OPEN statement The file specified in is: 1. Random file The LOC function returns the record number for which the read/write (GET/PUT) was performed last in a random file. This function is useful for performing read/write in the order of the record number; it is possible to obtain the record number accessed last. 2.
LOCATE Function Format Term Specifies the position of the cursor on the screen and determines the display of the cursor. LOCATE [ ] [, [ ] [, < ] ] ] : The vertical position on the screen (1 to 2) : The horizontal position on the screen (1 to 16) : Explanation Determines whether or not the cursor is displayed when the program is executed. 0: Not displayed 1: Displayed The cursor is moved to the position specified in and .
LOF Function Format Term Explanation Provides the size of the file. LOF ( ) : The number assigned to the file by the OPEN statement The file specified in is: 1. Disk file The file size is provided in units of bytes. 2. RS-232C communication file The remaining number of bytes of the input buffer is returned.
LSET/RSET Function Format Transfers data to the buffer for a random file. (In preparation for the PUT statement) LSET = RSET = Term : The character variable used for the assignment in the FIELD statement.
MID$ Function Format Term Provides the specified character in a given character string.
MKI$/MKS$ Function Format Explanation Converts a numeric value to the numeric data of the character string type. MKI$ ( ) MKS$ ( ) When a random file is created by using the LSET and RSET statements, all values to be written in the buffer should be assigned as the numeric data of the character string type. MKI$ converts an integer value to a 2-byte character string. MKS$ converts a single-precision real value to a 4-byte character string.
ON COM Function Format Term Explanation Declares an interrupt which occurs when the data is input into the communication buffer, and declares the start line number for the subroutine to be executed. ON COM ( ) GOSUB : The line number to which an interrupt is processed (1 or 2) : The line number from which the subroutine for the interrupt process is started should be specified.
ON ERROR Function Format Term Explanation Declares that the interrupt for the error process is enabled, and declares the line number of the subroutine to be executed when an error occurs. ON ERROR GOTO : The first line number of the subroutine for the error process When an error interrupt is enabled by this statement, the subroutine specified in is executed for all errors including the command level state (in the direct mode).
ON GOTO/GOSUB Function Format Term Explanation Branches the execution to the specified line number according to a value for . ON GOTO [, ] ··· ON GOSUB [, ] ··· : An expression to specify which is placed after GOTO/GOSUB. It should be 255 or less. (If a value is not an integer, a decimal is rounded off to the nearest integer).
ON TIMER Function Format Term Declares an interrupt which occurs at specified intervals, and the line number from which the execution of the subroutine is started by the interrupt. ON TIMER ( ) GOSUB : The time interval at which an interrupt occurs should be specified in units of 100 ms. (Range: 1 to 32767) : Explanation The line number from which the subroutine for the interrupt process is started should be specified.
OPEN Function Format Term Opens a file. OPEN [FOR ] AS [#] [LEN= ] : The file name to be opened should be specified. : The type of file should be specified.
OPEN COM Function Format Term Opens the RS-232C communication file. OPEN ”COM : [ ] [, [ ] [, [ ] [, [ ] ] ] ” AS [#] : The RS-232 C interface number (COM 1:, COM2:) : The baud rate for the line COM 1: (9600, 19200, 38400) COM 2: (4800, 9600, 19200) : The parity type is specified. (O (Odd), E, (Even), N (Non)) : The bit length of one character is specified.
PRINT Function Displays the character string and contents of the variable on the screen. Format PRINT [USING ] [ ] [;] Term : A character string to specify the format : Explanation Numeric expressions, character expressions and character strings are delimited by a semicolon (;), listed. (The character string should be enclosed with double quotation marks (”).
PRINT# Function Outputs data (numeric value or character string) to the sequential file. Format PRINT# , [USING ; ], Term : The number assigned to the file by the OPEN statement. : Numeric expressions and characters are delimited by a comma (,) or semicolon (;), and listed.
When a comma (,), semicolon (;), or space is placed at the beginning of the string, carriage return and line feed are included in the character string, and the output can be performed by the PRINT statement. However, when the data is read by the INPUT# statement later, commas, semicolons, carriage returns and line feeds are regarded as delimiters, and a space placed at the beginning of the string is ignored.
PUT Function Format Term Outputs the data to the file. PUT [#] [, ] : The number assigned to the file by the OPEN statement. : Explanation A record number between 1 and 4294967295, or the number of bytes of the data read from the RS-232C communication file. The PUT statement writes the data to the file specified in . operation varies according to the specified file.
READ Function Format Term Explanation Reads a value defined by a DATA statement and assigns it to a variable. READ [, ] ··· : The variable to which the value for the DATA statement is assigned (Numeric or character variables) The READ statement should always be used with the DATA statement. The READ statement reads the data of the DATA statement starting from the beginning, and assigns one data to one variable.
REM/APOSTROPHE (’) Function Format Term Explanation Enters a comment into the program. REM [ ] : Any character string The REM statement is ignored when the program is executed. The REM statement is used for entering a comment into the program to make the program easy to understand. The REM statement occupies memory and affects the execution speed a little. (It takes a little time to read the comment.
RESUME Function Format Term Explanation Terminates an error process, and resumes execution of the program. RESUME [0] NEXT : The line number from which the execution of the program is resumed should be specified. The subroutine defined by the ON ERROR statement processes an error which occurs while the program is being executed. The RESUME statement is used as the termination declaration of the subroutine.
RETURN Function Format Explanation Declares the end of a subroutine, and returns the execution to the location where the subroutine was called up. RETURN The RETURN statement should be placed at the end of the subroutine called by the GOSUB statement. When the RETURN statement is executed, the execution proceeds from the statement following the GOSUB statement which called the subroutine.
RIGHT$ Function Format Term Provides a character string of the length specified on the right side of the character string. RIGHT$ ( , ) : Any character string : Explanation The length is specified on the right side of . (Unit: bytes, Range: 0 to 255) is converted to an integer value rounded off to a whole number before it is evaluated. When the value is 0, a null string is provided.
SGN Function Format Explanation Provides a sign for SGN ( ) If is positive, 0, and negative, 1, 0, -1 is provided, respectively.
SPACE$ Function Format Term Explanation Provides character strings of spaces in the specified length SPACE$ ( ) : Indicates the number of spaces Character strings of spaces for the number specified in are provided. A value in is an integer in which a decimal is rounded off to the nearest integer.
STR$ Function Format Explanation Provides the character string indicating . STR$ ( ) The value for is converted to a character string. For example, the numeric value, 123, is converted to the character string “123”. Both integer and real types are available for the value for . The STR$ function is the opposite of to the VAL function.
TIMER Function Format Explanation Returns the elapse time after the system is reset in a single-precision floating point format. (In units of 100 ms) X = TIMER A fraction is rounded off to the nearest value.
TIMER ON/STOP Function Format Enables/Stops a timer interrupt. TIMER ON TIMER STOP Explanation The interrupt specified by the ON TIMER statement is enabled by the TIMER ON statement, or stopped by the TIMER STOP statement. Before TIMER ON/STOP statements are executed, the interrupt process declaration should be made by the ON TIMER statement. The TIMER ON statement enables the timer interrupt.
VAL Function Format Explanation Converts a character string to a numeric value. VAL ( ) The opposite of the STR$ function, the VAL function converts a character string indicating the numeric value for a 1-byte or 2-byte character (ex. “456”) to a numeric value (ex. 456). Spaces, tabs and line feeds placed at the beginning of the character string are ignored. VAL (“ -6”) is converted to the numeric value, -6.
WHILE ~ WEND Function Format Repeats the statements included between the WHILE statement and the WEND statement for as long as the given conditions are satisfied. WHILE WEND Term : The execution is repeated for as long as the (a numeric value or character) is satisfied. Explanation When is true (other than 0), the steps from WHILE statement to the WEND statement are executed.
WRITE# Function Format Term Outputs data to a sequential file. WRITE# , : The number assigned to the file by the OPEN statement. : Numeric expressions and character expressions are delimited by a comma (,), semicolon (;), and listed. : The character string for which the format for outputting data to a file is specified in detail Explanation The WRITE# statement functions similar to the PRINT# statement.
KEY ENTRY CODE LIST Key Name 0 1 2 3 4 5 6 7 8 9 .
RESTORE Function Format Explanation Returns the starting position where the DATA statement is read by the READ statement to the beginning of the program. RESTORE When the READ statement is placed after the RESTORE statement, the READ statement starts finding the DATA statement from the beginning of the program, and starts reading the first DATA statement.
SENDCMD Function Format Term Explanation Sends a command packet of character strings to the printer, and makes a response to an ACK or a NAK from the printer. SENDCMD : List of character expressions or character strings (A character string should be enclosed in quotation marks (”).) This statement adds “STX” to the beginning of character strings, adds the command length, adds BCC data to the end of character strings, and then sends a command packet through COM1 (fixed).
ERROR CODE TABLE Code Meaning 1 There is no FOR statement for the NEXT statement, or the number of NEXT statements does not match with (is more than) the number of FOR statements. The program is not in accordance with the grammar. Statements which are not defined are included in the program. The GOSUB statement and RETURN statement do not match each other properly. Data to be read by the READ statement is not included in the DATA statement, or the amount of data is small.