Commodore 128 Programmer's Reference Manual page 392

Hide thumbs Also See for 128:
Table of Contents

Advertisement

382
COMMODORE 128
THE RS-232 CHANNEL
0
The RS-232 capabilities can be accessed from either BASIC or machine language.
M
The BASIC commands INPUT# and GET# are used to fetch data from the receiving
buffer while PRINT# and CMD place data into the transmitting buffer.
The RS-232 Kernal routines run under the control of the 6526 CIA #2 device
) I
timers and interrupts. The 6526 chip generates NMI (Non-Maskable Interrupt) requests
<-!
for RS-232 processing. This allows background RS-232 processing to take place during
BASIC and machine language programs. There are built-in hold-offs in the Kernal,
j (
cassette and serial bus routines to prevent the disruption of data storage or transmission
(J
by the NMIs that are generated by the RS-232 routines. During cassette or serial bus
activities, data can not be received from RS-232 devices. But because these hold-offs
. - .
are only local, (assuming you're careful about your programming) no interference
| f
should result.
LJ
There are two buffers in the Commodore 128 memory to help prevent the
loss of data when transmitting or receiving RS-232 information.
\
The Commodore 128 RS-232 I/O buffers consist of two first-in/first-out (FIFO)
U
buffers, each 256 bytes long. In C128 mode, the RS-232 I/O buffers are permanently
allocated. The input buffer is located between 3072 and 3327 ($0C00-$0CFF). The
j " ,
output buffer is located between 3328 and 3583 ($0D00-$0DFF). You cannot harm
\J
program storage by opening and closing the RS-232 channel as can happen with the
Commodore 64. By permanently allocating the buffers in a fixed location, no "OUT OF
MEMORY" error can occur, and your program in memory will not get "stepped on."
M
U
OPENING THE RS-232 CHANNEL
Only one RS-232 channel should be open at any time; a second OPEN statement will
[J
cause the buffer pointers to be reset. Any characters in either the transmit buffer or the
receive buffer will be lost.
i I
Up to 4 characters can be sent in the filename field. The first two are the control
i (
and command register characters; the other two are used for user-defined, non-standard
iU
baud rates. Baud rate, parity and other options can be selected through this feature.
No error checking is done on the control word to detect a nonimplemented baud
} [
rate. Any illegal control word will cause the system output to operate at a very slow rate
U
(below 50 baud).
BASIC SYNTAX
! I
OPEN lfn,2,0"<control reg.> <command reg.> <opt baud low> <opt baud high>"
The logical file number (lfn) then can be any number from 1 through 255. But be
aware of the fact that if you choose a logical file number that is greater than 127, then a
j \
line feed will follow all carriage returns.
LJ
THE CONTROL REGISTER
) j
The Control Register is a single-byte required to specify the baud rates and other RS-232
jj
u

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents