# unit cio

### CIO interface

author: Tomasz Biela (Tebe), Daniel Koźmiński (Dely)

## Interface:

name: | description:
--- | ---
Opn | #### procedure Opn(chn, ax1, ax2: byte; device: PByte); assembler; Open channel ##### parameters: chn - channel 0..7 ax1 - parameter ax2 - parameter device - name of device, example "D:"
Cls | #### procedure Cls(chn: byte); assembler; Close channel ##### parameters: chn - channel 0..7
Get | #### function Get(chn: byte): byte; assembler; Get one byte ##### parameters: chn - channel 0..7
BGet | #### procedure BGet(chn: byte; buf: PByte; cnt: word); assembler; register; Get CNT bytes to BUF ##### parameters: chn - channel 0..7 buf - buffer cnt - bytes counter
Put | #### procedure Put(chn, a: byte); assembler; Write one byte ##### parameters: chn - channel 0..7 a - byte
BPut | #### procedure BPut(chn: byte; buf: PByte; cnt: word); assembler; register; Put CNT bytes from BUF ##### parameters: chn - channel 0..7 buf - buffer cnt - bytes counter
XIO | #### procedure XIO(cmd, chn, ax1, ax2: byte; device: PByte); assembler; Special command ##### parameters: cmd - command chn - channel 0..7 ax1 - parameter ax2 - parameter device - name of device, example "S2:"
RGet | #### function RGet(chn: byte; buffer: PByte): TString; register; Gets text record and returns as Tstring. Equivalent in Atari BASIC: INPUT #channel VAR$ ##### parameters: (byte) chn - Free IOCB channel. (PByte) buffer - Where to place data. ##### returns: (Tstring) - Record contents.
RSkip | #### procedure RSkip(chn: byte; buffer: PByte); assembler; register; Skips record. Equivalent in Atari BASIC: INPUT #channel VAR$ ##### parameters: (byte) chn - Free IOCB channel. (PByte) buffer - Where to place data.
FindFirstFreeChannel | #### function FindFirstFreeChannel: byte; assembler; Find first available IOCB channel ##### returns: (byte) - first available channel number (multiplied by 16) or error -95.Source: http://atariki.krap.pl/index.php/Programowanie:_Jak_wyszuka%C4%87_pierwszy_wolny_IOCB