RISCOS.com

www.riscos.com Technical Support:
Programmer's Reference Manual

 

Parallel device


Introduction and Overview

This module provides parallel device support. It is not available in RISC OS 2. The module is a client of DeviceFS and can be accessed via that system.

It will setup PrinterType$1 to point at its DeviceFS object, ie:

PrinterType$1 => devices#buffer3:$.Parallel

The module supports SWIs to allow the 82C710 or 82C711 chip driving the parallel port to be directly accessed (if present - some machines use other chips).

The 'parallel:' device can be opened for output (eg to a printer) or input but not for both. The input stream is only available on machines which use an 710/711 controller.

The output stream uses standard parallel printer handshaking, and can send data to many types of printer. In the absence of any standard parallel input protocol the input stream has been provided mainly as a means of passing data between one machine and another (eg downloading data from a portable to a master machine). The input device driver behaves like a printer, and can therefore accept data from another machine which is 'printing' from its parallel port. To enable such data transfer a twisted cable must be made with the following connections:

Pin Signal Direction Pin Signal Direction
1 /STROBE O 10 /ACK I
2 DATA 0 I/O 2 DATA 0 I/O
3 DATA 1 I/O 3 DATA 1 I/O
4 DATA 2 I/O 4 DATA 2 I/O
5 DATA 3 I/O 5 DATA 3 I/O
6 DATA 4 I/O 6 DATA 4 I/O
7 DATA 5 I/O 7 DATA 5 I/O
8 DATA 6 I/O 8 DATA 6 I/O
9 DATA 7 I/O 9 DATA 7 I/O
10 /ACK I 1 /STROBE O
11 BUSY I 17 /SLCTIN O
17 /SLCTIN O 11 BUSY I

Either end of such a cable can be connected to a sending or receiving machine. Note that sending (ie 'printing') machines do not need to be Acorn products, so you can use the parallel input device to transfer data from, for example, a PC.

To send data, the 'parallel:' device should be opened for output as if it were a file. Data can then be written to the open device which should be closed when no more data is to be sent (*Copy file printer#parallel: does this). At the receiving end the 'parallel:' device should be opened for input, the bytes should be read, and then the device should be closed.

SWI calls


Parallel_HardwareAddress
(SWI &42EC0)

This call is for internal use only. Do not use it; use the SWI Parallel_Op instead.


Parallel_Op
(SWI &42EC1)

Provides low level parallel operations

On entry

R0 = reason code
other registers are reason code dependent

On exit

R0 preserved
other registers are reason code dependent

Interrupts

Interrupt status is undefined
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

Not defined

Use

This call provides low level parallel operations, which are only available with newer hardware that uses the 710/711 family of controllers (such as the A5000). The SWI returns an error for (older) machines on which a 710/711 is not present.

The action of the call depends on the reason code passed in R0:

R0 Action Page
0 read data and status registers Parallel_Op 0
1 write data register Parallel_Op 1
2 read/write control register Parallel_Op 2

This call is not available in RISC OS 2, or in RISC OS 3.00.

The call is provided to allow you to drive the 82C710/82C711 for yourself. If you intend to drive the hardware directly then you should open the parallel: device. For example:

lock = OPENOUT("parallel:")
... play around with hardware ...
CLOSE#lock

This stops any other application altering the values that you have setup, preventing any possible confusion.

Related SWIs

OS_ClaimDeviceVector, OS_ReleaseDeviceVector

Related vectors

None


Parallel_Op 0
(SWI &42EC1)

Reads the parallel data and status registers

On entry

R0 = 0

On exit

R0 preserved
R1 = contents of the parallel data register
R2 = contents of the parallel status register

Use

This call is used to obtain the current state of the parallel data lines and status register. The bits in the read only parallel status register correspond to the following inputs:


Parallel status register

Bits 8 to 31 of R2 are undefined. See the 82C710/82C711 data sheet for a description of these bits. If the DIR bit in the parallel control register (see The bits in this value correspond to the following outputs:) is 0 (ie output) then the contents of the data register will be the same as the last data value written. The data register is read after the status register.


Parallel_Op 1
(SWI &42EC1)

Writes the parallel data register

On entry

R0 = 1
R1 = data

On exit

R0, R1 preserved

Use

This call is used to write a byte to the parallel data lines. This will only have an effect if the DIR bit in the parallel control register (see The bits in this value correspond to the following outputs:) is 0 (ie output).


Parallel_Op 2
(SWI &42EC1)

Reads/writes the parallel control register

On entry

R0 = 2
R1 = EOR mask
R2 = AND mask

On exit

R0 preserved
R1 = old contents of the parallel control register
R2 = new contents of the parallel control register

Use

This call is used to read or write the current state of the parallel control register. The new state is determined by:

new state = (old state AND R2) EOR R1

The bits in this value correspond to the following outputs:


Parallel control register

Bits 8 to 31 are undefined and must not be modified. See the 82C710/82C711 data sheet for a description of these bits. These lines are output only, but their current state can be read without changing them by setting R1 = 0 and R2 = &FFFFFFFF. The interrupt enable bit, IRQEN, should normally be 1 and interrupt disabling should be done in IOC.

This edition Copyright © 3QD Developments Ltd 2015
Last Edit: Tue,03 Nov 2015