Toshiba KB-80 User Manual

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.................................................................................................................... 11
CHAIN.................................................................................................................. 12
CHR$ ................................................................................................................... 13
CINT..................................................................................................................... 14
CLEAR ................................................................................................................. 15
CLOSE................................................................................................................. 16
CLS...................................................................................................................... 17
COMMON............................................................................................................. 18
COM ON/STOP.................................................................................................... 19
CSNG................................................................................................................... 20
CVI/CVS............................................................................................................... 21
DATA.................................................................................................................... 22
DIM ...................................................................................................................... 23
END...................................................................................................................... 24
EOF...................................................................................................................... 25
ERASE................................................................................................................. 26
ERR/ERL.............................................................................................................. 27
FIELD................................................................................................................... 28
FOR ~ NEXT........................................................................................................ 29
GET...................................................................................................................... 31
GOTO .................................................................................................................. 32
HEX$.................................................................................................................... 33
IF ~ THEN ~ ELSE............................................................................................... 34
INKEY$ ................................................................................................................ 35
INPUT .................................................................................................................. 36
INPUT# ................................................................................................................ 37
INPUT$ ................................................................................................................ 38
INSTR .................................................................................................................. 39
INT....................................................................................................................... 40
LEFT$ .................................................................................................................. 41
Page
LEN...................................................................................................................... 42
LINE INPUT#........................................................................................................ 43
LOC...................................................................................................................... 44
LOCATE............................................................................................................... 45
LOF...................................................................................................................... 46
LSET/RSET.......................................................................................................... 47
MID$..................................................................................................................... 48
MKI$/MKS$.......................................................................................................... 49
ON COM .............................................................................................................. 50
ON ERROR.......................................................................................................... 51
ON GOTO/GOSUB............................................................................................... 52
ON TIMER............................................................................................................ 53
OPEN................................................................................................................... 54
OPEN COM.......................................................................................................... 55
PRINT .................................................................................................................. 56
PRINT# ................................................................................................................ 57
PUT...................................................................................................................... 59
READ................................................................................................................... 60
REM/APOSTROPHE (’)........................................................................................ 61
RESUME.............................................................................................................. 62
RETURN .............................................................................................................. 63
RIGHT$................................................................................................................ 64
SGN ..................................................................................................................... 65
SPACE$............................................................................................................... 66
STR$.................................................................................................................... 67
TIMER.................................................................................................................. 68
TIMER ON/STOP................................................................................................. 69
VAL ...................................................................................................................... 70
WHILE ~ WEND................................................................................................... 71
WRITE# ............................................................................................................... 72
KEY ENTRY CODE LIST...................................................................................... 73
RESTORE............................................................................................................ 74
SENDCMD ........................................................................................................... 75
ERROR CODE TABLE......................................................................................... 76
ii
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.
Numeric constants:
Integer type: Decimal format : -32768 to +32767
Hexadecimal format : &H0000 to &HFFFF
Real type: Single-precision fixed-point format (Entry digits: 7, Effective digits: 6)
Single-precision floating-point format (Entry digits: 7, Effective digits: 6)
VARIABLES
A variable name should be a max. of 10 characters, including alphanumerics and periods, and must start with a letter. The max. number of variables is 256.
Integer type: A “%” should be attached to the end of the variable name. Single-precision real type: A “!” should be attached to the end of the variable name.
The assignment value is in the same range as a numeric constant.
Character type: A ‘$’ should be attached to the end of the variable name.
The assignment value is in the same range as a character constant.
The max. 16 dimensions and 32767 subscripts for an array variable are allowable. However, a subscript starts from 0, and the practical number of elements is the number of subscripts + 1. 32 bytes are used per one array. An array exceeding 32 bytes cannot be used.
- 1 -
OPERATORS
Arithmetic operators:
Operator Operation
^ Exponential operation
- Sign *, / Multiplication, Real division ¥ Integer division (The quotient is output.) MOD 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.
Operator Operation
= Equal to <>, >< Not equal to < Less than > Greater than <=, =< Less than or equal to >=, => Greater than or equal to
Logic operators: Checks more conditions, performs bit handling.
Operator Operation
NOT Negation AND Logic product OR Logic OR XOR Exclusive-OR
- 2 -
LISTS OF COMMANDS, STATEMENTS, AND FUNCTIONS
Declarations and definitions
Statement
CLEAR Format CLEAR
Function Initializes a variable.
DIM Format DIM <variable name> ( <subscript> [, <subscript> ] ···)
[, <variable name> ( <subscript> [, <subscript> ] ···) ] ···
Function Specifies the max. number of array elements, and allocates the memory
area in the memory.
ERASE Format ERASE <array name> [, <array name> ] ···
Function Erases the specified array from the program. REM Format REM [ <comment> ] ’ (Apostrophe) Function Enters a comment into the program. STOP Format STOP
Function Terminates the execution of the program, and returns to the command
level state.
END Format END
Function Terminates the execution of the program, closes all opened files, and
returns to the command level state.
General instructions
Statement
DATA Format DATA <constant> [, <constant> ] ···
Function Sets a numeric value or a character constant read by the READ
statement.
READ Format READ <constant> [, <constant> ] ···
Function Reads a value defined by a DATA statement and assigns it to a variable. RESTORE Format RESTORE
Function Starts reading from the first one of the DATA statements to be read by
the READ statement.
GOTO Format GOTO <line number>
Function Moves the execution to the specified line without any conditions. GOSUB Format GOSUB <line number>
Function Calls the subroutine program. ON GOTO /GOSUB
RETURN Format RETURN
Format ON <expression> GOTO <line number> [, <line number> ] ···
ON <expression> GOSUB <line number> [, <line number> ] ···
Function Branches the execution to the specified line number according to the
value for <expression>.
Function Declares the end of a subroutine, and returns the execution to the
location where the subroutine was called up.
- 3 -
IF ~ THEN ~ ELSE
Format IF <expression> THEN <statement> [ELSE <statement> ]
<line number> <line number>
IF <expression> GOTO <line number> [ELSE <statement> ]
<line number>
Function Judges the condition, and changes the flow of the program. FOR ~ NEXT Format FOR <variable> = <initial value> TO <terminal value> [STEP <increment> ]
NEXT [ <variable> [, <variable> ] ···]
Function Executes the statements included from the FOR statement to the NEXT
statement repeatedly while the given conditions are satisfied.
WHILE ~ WEND
Format WHILE <expression>
WEND
Function Repeats the statements included between the WHILE statement and the
WEND statement for as long as the given conditions are satisfied.
CHAIN Format CHAIN <file designation> [, ALL]
Function Executes another program. COMMON Format COMMON <variable name> [, <variable name> ] ···
Function Declares the variable is to be passed from the original program to the
program called by the CHAIN statement.
Numeric process
Statement
ABS Format ABS ( <numeric expression> )
Function Provides the absolute value. INT Format INT ( <numeric expression> )
Function Provides the max. integer value not exceeding the specified <numeric
expression>.
CINT Format CINT ( <numeric expression> )
Function Provides the integer value to which the real value is converted. CSNG Format CSNG ( <numeric expression> )
Function Provides the value which is converted to the single-precision real value. SGN Format SGN ( <numeric expression> )
Function Provides a sign for <numeric expression>.
- 4 -
Character string process
Statement
ASC Format ASC ( <character string> )
Function Provides the character code (ASCII) for the first character of the
character string.
CHR$ Format CHR$ ( <numeric expression> [, <numeric expression> ] ···)
Function Converts the character code (ASCII and internal sequential code) to a
character.
RIGHT$ Format RIGHT$ ( <character string>, <numeric expression> )
Function Provides a character string of the length specified on the right side of the
character string.
LEFT$ Format LEFT$ ( <character string>, <numeric expression> )
Function Provides a character string of the length specified on the left side of the
character string.
MID$ Format MID$ ( <character string>, <numeric expression 1>
[, <numeric expression 2> ] )
Function Provides the specified character in a given character string. LSET RSET
HEX$ Format HEX$ ( <numeric expression> )
STR$ Format STR$ ( <numeric expression> )
VAL Format VAL ( <character string> )
SPACE$ Format SPACE$ ( <numeric expression> )
LEN Format LEN ( <character string> )
INSTR Format INSTR ( [ <numeric expression> , ] <character string 1>,
MKI$ MKS$
CVI CVS
Format LSET <character variable> = <character expression>
RSET <character variable> = <character expression>
Function Transfers data to the buffer for the random file.
(In preparation for the PUT statement)
Function Converts a decimal number to a hexadecimal number, and then provides
the character string.
Function Provides the character string indicating <numeric expression>.
Function Converts a character string to a numeric value.
Function Provides character strings of spaces in the specified length.
Function Provides the length of the character string (the number of bytes).
Kanji is counted as 2 bytes.
<character string 2> )
Function Searches for the specified characters from the character string, and
provides its first character position of the characters.
Format MKI$ ( <integer value> )
MKS$ ( <single-precision real value> )
Function Converts a numeric value to the numeric data of the character string
type.
Format CVI ( <2-byte character string> )
CVS ( <4-byte character string> )
Function Provides a value for the numeric value data which is converted to the
numeric data.
- 5 -
Error process
Statement
ON ERROR Format ON ERROR GOTO <line number>
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
<line number>
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).
Display input/output
Statement
CLS Format CLS
Function Clears the screen. PRINT Format PRINT [ <expression list> ] [;]
? [ <expression list> ] [;]
Function Displays the character string and contents of the variable on the screen. LOCATE Format LOCATE [ <line> ] [, [ <column> ] [, < <switch> ] ] ]
Function Specifies the position of the cursor on the screen.
Sound output
Statement
BEEP Format BEEP
Function Sounds the internal buzzer.
Keyboard entry
Statement
INPUT Format INPUT [;] [” <prompt statement> ” ; ] <variable> [, <variable> ] ···
Function Reads a numeric value or a character from the keyboard, and assigns it
to a variable. Reads the whole line input from the keyboard (max. 255 characters), and
assigns it to a variable.
INKEY$ Format INKEY$
Function 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.
INPUT$ Format INPUT$ ( <no. of characters> [, [#] <file number> ] )
Function Reads the character string with the specified length from the keyboard or
the file.
- 6 -
Communication input/output
Statement
OPEN COM Format OPEN ”COM <line number> : [communication condition] ” AS # <file
number>
Function Opens the communication file. ON COM (n) Format ON COM ( <line number> ) GOSUB <line number>
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.
COM (n) Format COM ( <line number> ) ON/STOP
Function Enables/Stops an interrupt from the communication file. SENDCMD (n) Format SENDCMD <expression list>
Function Creates a command packet for the printer, and sends it to COM1.
Clock input/output
Statement
ON TIMER Format ON TIMER ( <n> ) GOSUB <line number>
Function Declares an interrupt which occurs at specified intervals, and the line
number from which the execution of the subroutine is started by the interrupt.
TIMER ON Format TIMER ON/STOP
Function Enables/Stops a timer interrupt. TIMER Format TIMER
Function Returns the elapsed time after the system is reset in a single-precision
floating point format.
- 7 -
File input/output
Statement
OPEN Format OPEN <file designation> [FOR <file mode> ] AS [#] <file number>
[LEN= <record length> ]
Function Opens a file. CLOSE Format CLOSE [ [#] <file number> [, [#] <file number> ] ···]
Function Closes a file. INPUT# Format INPUT# <file number>, <variable> [, <variable> ] ···
Function Reads data from the sequential file, and assigns it to a variable. LINE INPUT# Format LINE INPUT# <file number>, <character variable>
Function Reads one whole line (record) (max. 255 characters) from the sequential
file.
INPUT$ Format INPUT$ ( <no. of characters> [, [#] <file number> ] )
Function Reads the character string with the specified length from the keyboard or
the file.
PRINT# Format PRINT# <file number>, [USING <format control character string> ; ],
<expression list>
Function Outputs data (numeric value or character string) to the sequential file. WRITE# Format WRITE# <file number>, <expression list>
Function Outputs data to a sequential file. FIELD# Format FIELD [#] <file number>, <field width> AS <character variable> ]
[,<field width> AS <character variable> ] ···
Function Allocates the variable area to the random file buffer. (Record definition) GET# Format GET [#] <file number> [, <numeric value> ]
Function Inputs the data in a file into the buffer. PUT# Format PUT [#] <file number> ) [, <numeric value> ]
Function Outputs the data to the file. EOF Format EOF ( <file number> )
Function Checks the end of the sequential file, or whether or not the
communication buffer becomes empty.
LOC Format LOC ( <file number> )
Function Provides the current theoretical location in the file. LOF Format LOF ( <file number> )
Function Provides the size of the file.
- 8 -
ABS
Function Provides the absolute value.
Format ABS ( <numeric expression> )
Explanation The absolute value for <numeric expression> (0 or a positive value) is provided as a
function value.
- 9 -
ASC
Function Provides the character code (ASCII) for the first character of the character string.
Format ASC ( <character string> )
Explanation The character code for the first character (left side) of <character string> is provided.
If <character string> is a null string, an error occurs.
- 10 -
BEEP
Function Sounds the internal buzzer.
Format BEEP
Explanation The internal buzzer is sounded for 100 ms.
- 11 -
CHAIN
Function Loads another program, and executes it.
Format CHAIN <file designation> [, ALL]
Term <file designation>: The program file to be executed should be specified.
(The file name should be included.)
Explanation The program designated in <file designation> is executed.
CHAINCHAIN
Program 1
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.
CHAIN ”PROG2”, ALL
The CHAIN statement holds any file which has already been opened as is.
Program 3Program 2
- 12 -
CHR$
Function Converts the character code (ASCII and internal sequence code) to a character.
Format CHR$ ( <numeric expression> [, <numeric expression> ] ···)
Term <numeric expression>: The numeric expression within the range between 0 and 255
(&H0 to &HFF) indicating ASCII code
Explanation The CHR$ function regards a value for <numeric expression> as ASCII code, and
converts it to a character. The CHR$ is the opposite of the ASC function.
- 13 -
CINT
Function Provides the integer value to which a real value is converted.
Format CINT ( <numeric expression> )
Explanation The value for <numeric expression> is rounded off to the nearest whole number,
making it into an integer.
- 14 -
CLEAR
Function Initializes a variable.
Format CLEAR
Explanation 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. The stack area and character area are initialized.
The ERASE statement is similar to the CLEAR statement. For the CLEAR statement, all variables are initialized, however, for the ERASE statement, only the specified array variable is initialized.
- 15 -
CLOSE
Function Close a file.
Format CLOSE [ [#] <file number> [, [#] <file number> ] ···]
Term <file number>: The number assigned to the file or the device by the OPEN
statement
Explanation The file corresponding to <file number> is closed. One or more <file number>s can
be specified once in the CLOSE statement. If <file number> is omitted, all opened files are closed.
Once a file has been closed, its number can be used for opening another file. The closed file can be opened by specifying the same file number as the previous one or a different file number.
For a file that has been opened for an output, the data remaining in the buffer is output by the CLOSE statement.
The END statement closes all opened files automatically.
- 16 -
CLS
Function Clears the screen.
Format CLS
- 17 -
COMMON
Function Declares the variable is to be passed from the original program to a program called
by the CHAIN statement.
Format COMMON <variable name> [, <variable name> ] ···
Term <variable name>: The variable name to be passed should be specified.
Explanation 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.
When the array variable is passed, two parentheses “( )” should be inserted after the variable name to indicate it is an array.
When all the variables are to be passed, not the COMMON statement but the ALL option in the CHAIN statement should be used.
A COMMON statement should be placed before the CHAIN statement. When an array is to be passed to a called program, the array declaration should not
be performed by the DIM statement. However, it is necessary to previously perform the array declaration by the DIM statement in the program to be called.
- 18 -
COM ON/STOP
Function Enables/Stops an interrupt from the RS-232C communication file.
Format COM ( <line number> ) ON
COM ( <line number> ) STOP
Term <line number>: The RS-232C interface number (1 or 2)
Explanation The interrupt which occurs when the communication flows to the RS-232C from an
external source is enabled by the COM ( <line number> ) ON statement, or stopped by the COM ( <line number> ) STOP statement.
When the COM ( <line number> ) ON statement is used, an interrupt should be enabled previously by the ON COM statement. Then, an interrupt occurs every time data is input through the RS-232C interface, and the process specified by the ON COM statement is performed.
When the COM ( <line number> ) STOP statement is executed, an interrupt does not occur if data is input, however, the fact that data has been input is stored. After that, when the interrupt is enabled by the COM ( <line number> ) ON statement, the interrupt occurs immediately, and then the process is performed.
The COM ( <line number> ) STOP statement is used to prevent the process from being suspended by the occurrence of an interrupt.
When a communication interrupt is detected according to <line number> n, the interrupt routine executes the COM ( <line number> ) STOP statement automatically, and disables the interrupt which is being processed. The execution is automatically returned from the interrupt routine to the previous setting state.
- 19 -
CSNG
Function Provides a value which is converted to a single-precision real value.
Format CSNG ( <numeric expression> )
Explanation The value for <numeric expression> is converted to a 7-digit single-precision real
value.
- 20 -
CVI/CVS
Function Provides a value for numeric value data which is converted to the numeric data.
Format CVI ( <2-byte character string> )
CVS ( <4-byte character string> )
Explanation 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. CVS converts the first 4 bytes (4 characters) to a single-precision real value.
- 21 -
Loading...
+ 55 hidden pages