Specifications

Commands - 115
SYS
System Function
SYNTAX: a = SYS(n)
PURPOSE: To access system data and addresses.
REMARKS: n is the system number.
The following is a list of system information returned using this function:
n Function
0 Program size
1 End of program of variables
2 Bottom of stack
3 Interrupt table address
4 COM1 spooler status
5 COM2 spooler status
6 COM1 error flag
7 COM2 error flag
8 Keypad string table address
9 COM1 input character count
10 COM2 input character count
11 Buffer full flag for COM1 port
12 Buffer full flag for COM2 port
13 Display row
14 Display column
The SYS function lets you access internal variables within the operating system. In most cases, you
will not need to use this function.
If you need to find memory that is not used by CAMBASIC, you can use all the addresses from the
address returned from SYS(1) up to the address returned by SYS(2). Since the stack moves
downward, it is recommended that you stay at least 300 bytes below the address given by SYS(2).
If you execute: PRINT SYS(2)–SYS(1)
in the Immediate Mode, the result will be the amount of remaining RAM.
SYS(4) and SYS (5) return the status of the console output buffer, the primary output buffer and the
secondary output buffer respectively. When zero is returned, the buffer is empty. A nonzero value
means the buffer has some characters to send. The actual nonzero value does not indicate the number
of characters left.
SYS(6) and SYS(7) provide an important data security function when executing the ON COM$
statement. When a parity, overrun, or framing error occurs on the serial port, CAMBASIC branches
to your ON COM$ interrupt service routine. By testing SYS(6) for the COM1 Port or SYS(7) for the
COM2 Port, you can determine if the serial data was truncated at the error.