Introduction


You can use the CIO function to send an I/O command to a compatible peripheral device, such as the printer emulation built into the RPD-95, or the disk storage emulation. This section gives a overview of how CIO uses a peripheral access block (PAB) and a data buffer to send and receive information from a peripheral device.


When Do You Need The CIO Function?

You must use the CIO function to control any peripheral device that cannot be accessed directly from the calculator's keyboard.

You do not normally need to use the CIO function for a printer; the RPD-95 contains built-in functions for printer operations. In some cases, however, you may want to use the CIO function to control a printer.

What is a PAB?

A peripheral access block (PAB) is an area of memory that you use to store the necessary parameters for the CIO function. These parameters include the I/O command you want to send, the device number of the device you want to access, and the address of the data buffer. You can set up the PAB at any location in memory, provided the PAB starts at the beginning of a register.

After you use the CIO function, the device returns certain parameters to the PAB. These parameters include information that tells you if the I/O operation was completed successfully.

What is a Data Buffer?

A data buffer is an area of memory that you use to store the actual data transferred between the calculator and the device. You can set up a data buffer at any location in memory.
  • If your program is sending data to a device, it must store that data in the data buffer before executing the CIO function.
  • If your program is receiving data, the calculator stores the incoming data in the data buffer after the CIO function is executed.

Overview of Sending an I/O Command

For each I/O command that you send to a device, you use the general procedure outlined below. (Each step is described in detail later in this appendix.)
  1. Build a PAB containing the parameters that apply to the I/O command you are sending.
  2. If you are sending data, store that data in the data buffer.
  3. Execute the CIO function to send the command.

If you want to perform the same operation repeatedly, you do not have to build a new PAB each time. However, you may need to change the data in the data buffer.

After the device responds to a command, your program should:
  1. Check the error code returned by the device to see whether the operation was completed successfully or an error occurred.
  2. Read any data returned to the data buffer by the device.

Overview of Accessing a Device

Before you can send or receive any information from a device, you must first send a command that "opens" the device. Once the device is open, you can perform as many I/O operations as needed. When you are finished using the device, send a command to "close" the device. Unless you close the device, any later attempt to open it will fail.


Back