IOX

From NDWiki
Revision as of 22:24, 20 December 2011 by Tingo (talk | contribs) (added Address range section)
Jump to navigation Jump to search
IOX
Description Exchange information between
I/O system and A register.
Format IOX <device register address>
Code 164 0008
Affected See description
Type See description
Architecture ND-100, ND-110


IOX is an assembly instruction used for programmed IO, and it transfers data between a device I/O register and the CPU's A register.

IOX (the Input/Output Instruction) is a privileged instruction in normal cases, but if there is no OS running and the paging system is turned off then IOX is an unprivileged instruction. IOX and IOXT are the only instructions used to communicate with external interfaces.

Direction of transfer

The actual transfer direction of the IOX and IOXT instructions is decoded from the device-register address, based on the following convention: the transfer direction is input (from device to CPU) if the device-register address is even.

This means that all I/O device registers which need to be loaded from the CPU A register are assigned and odd device register address. Similarly I/O device input registers are assigned even addresses.

Device register address

Register addresses can hold data, command or status information for a device.

Bit 0-10 of the instruction code sets the direction and IO address:

  • Bit 0 gives the direction of transfer:
    • If bit 0 is zero then IOX reads the value from the IO register into register A
    • If bit 0 is one then IOX writes the contents of register A to the IO register
  • Bit 3-9 is the selected device
  • Bit 0-2 is the selected register within selected device
  • Bit 10 is the type of interface:
    • If bit 10 is zero then it is a Standard ND interface
    • If bit 10 is one then it is a Customer designed interface


An external device may require more than one register address, for example a magnetic tape unit may need several register addresses; these should be given successive device-register addresses (remembering to use odd addresses for input and even addresses for output).

Note

  • Addressing of a non existing device results in a IOX error.
  • The number of external devices that can be controlled by the CPU depends on the configuration of the devices.

Address range

The IOX instruction can address a total of 2048 registers, i.e. addresses from 0 - 3777 (octal). However, the device-registers implemented on interfaces designed at Norsk Data use the address area 0 - 1777 (octal) only. The remaining 1024 register addresses are available for customer-designed interfaces.

Example

To give an instruction to a device

LDA <device command code>
IOX <device register address>

The lsb of IOX will be 1. The A register contents are output to the device addressed within the IOX opcode.

To check the status of a device

IOX <device register address>

The lsb of IOX will be 0. The status code of the device addressed by the IOX opcode will be loaded into the A register.

Transfer data

IOX <device register address>

Data from the device addressed by the IOX instruction is read into the A register if the lsb of IOX is 0. If the lsb of IOX is 1, the A register contents are output to the device.


See also

References