I/O operations with special functions

Besides the "normal" use of the I/O operations for data transfers, these operations are also used to control special functions within the machine, e.g. the processor or the display adapter, or to set special flags. These functions are listed below. If a functions should only be valid either for the 5100 or for the 5110 it will be marked in the first column.

Device 0 (Processor, Display adapter)


Remark Bit Description
510001=Reset Read Data Error
511001=Load jumper information into World Trade Latch and selector
10=Disable Interrupts
20=Enable Interrupts
30=Display off
511040=Display on
50=Toggle RWS/ROS Level 0
511060=Alarm on
511070=Alarm off

Put (only 5110)

Remark Bit Description
10=Level 1 ROS; 1=Level 1 RWS
20=Level 2 ROS; 1=Level 2 RWS
30=Level 3 ROS; 1=Level 3 RWS


The I/O operations perform the shift and rotate instructions of the processor.

Device 1 (Common / Language ROS)


Remark Bit Description
01=ROS write enable
510041=Select BASIC ROS/Common ROS
511041=Select BASIC ROS
51=Select APL ROS
511061=Select Common ROS

To read out the selected ROS the desired address is sent to device 1 with two consecutive PUTB instructions, first the high-byte of the address, then the low byte.
ATTENTION: The address is the word address, not the byte address!

Then the word can be read with two GETB instructions. The second GETB will automatically increase the internal address counter by 1 so you don't have to reload the address when reading a contiguous area.

The current ROS address can be read back with two STAT instructions.

Bit 0 is very interesting: the ability to write to the ROS (or the writable substitute) was apparently used by the developers to test new versions of the non-executable ROS' without the need to burn dozens of EPROMs (we're in the time of 1702s or 2708s!) or create new mask ROMs.

Device 2 (Executable ROS)

only 5110


Remark Bit Description
00=I/O ROS
10=Interpreter ROS
2always 1
3always 1
4always 1
5always 1
6always 1
7always 1

Since only one of the two executable ROS' (I/O routines, meta-interpreter) can be active, this control instruction provides a means to switch between these two. Note that the selection between APL or BASIC executable ROS is done in hardware with the APL/BASIC switch on the front plate.
Obviously there needs to be a transfer subroutine in each of these ROS modules since execution will transfer to the other ROS immediatley following the control instruction.


Remark Bit Description
01=Area 0000-1FFF available
11=Area 2000-3FFF available
21=Area 4000-5FFF available
31=Area 6000-7FFF available
41=Area 8000-9FFF available
51=Area A000-BFFF available
61=Area C000-DFFF available
71=Area E000-FFFF available

OpE gives you one of three status bytes, the selection is done by presetting the destination register (the values in brackets are for the 5110 model 1 APL/BASIC without Feature ROS):

   $80 - Size of the I/O ROS [= $F0]
   $40 - Size of the meta-interpreter ROS [= $C0]
   $20 - (??) [= $80]
Theoretically there may be gaps between the areas, but it seems that this doesn't occur in real systems.
Each ROS area has a setup routine that amongst other tasks sets some variables in RWS. These routines are all located at the end of the corresponding area and are called with a jump to xFFE (see above); the routine returns to R2.
The following is according to my own experience:

Device 4 (Keyboard / Interrupt 1 control)


Remark Bit Description
10=Reset interrupt 3
510030=Keyboard lock; unused!
4(Interrupt 2?)
5(Interrupt 2?)
60=Typamatic on; 1=Typamatic off
70=Enable interrupt 3; 1=disable interrupt 3


The keyboard offers a status byte and a scancode. The selection is done by presetting the destination register for the STAT instruction:

   $80 - Read status
   $40 - Read scancode

Status byte

This is the status byte read via an OpE instruction.

Remark Bit Description
0(always 0?)
10=APL; 1=BASIC (from the console switch)
2always 1
3always 1
51104Key Pending
5always 1
6always 1
51107Katakana Enable (if available)

Device D (Diskette adapter)


Remark Bit Description
01=Start Write
11=Start Read
21=Diag 1
31=Diag 2
41=Erase gate on
51=Read/Write CRC
61=Write Address Mark
71=Reset Read/Write/Diag


The mechanical operations of the disk drive can be controlled while in Access Mode of the controller. Following are the functions:

Remark Bit Description
01=Reset New Media Bit
11=MFM, 0=FM
21=Switch Filter
31=Inner Tracks
41=Engage Head
51=Side 1, 0=Side 0
6Access Line 1
7Access Line 2

During Reset Mode a PUT instruction transfers the desired subdevice address to the diskette controller to select one of the maximum four possible drives.

In Write Mode PUT instructions are used to transfer the data bytes to the diskette.


In Access Mode GET fetches the status byte of the disk drive, not of the diskette adapter (see OpE for this).

Remark Bit Description
01=New Media
11=MFM, 0=FM
21=Switch Filter
31=Inner Tracks
4Head Engage (1=Engaged)
5Head Selected (1=Side 1)
6Access Line 1
7Access Line 2


OpE fetches the status of the diskette adapter.

Remark Bit Description
01=Write Mode
11=Read Mode
21=Diag 1 or 2
31=Index Hole
41=Erase Gate Sense
51=Diskette 2, 0=Diskette 1
61=CRC Error
71=R/W Overrun

Device E (Tape adapter)


Remark Bit Bit=0 Bit=1
2Channel 1Channel 0
4Channel 0 eraseNot channel 0 erase
5Channel 1 eraseNot channel 1 erase
6Diagnostic modeNot diagnostic mode
7Interrupt enabledInterrupt disabled


The following description comes from the IBM 5100 MIM page C-14, but it is also valid for the 5110.

Bemerkung Bit Bit=0 Bit=1
2Byte modeBit mode
6First transitionNo action
7+Serial write data outNo action


This returns the tape status byte, but you need to follow these steps:

The relevant part of the Tape Sense routine within the Executable ROS looks like this:
  CTRL $E, #$FF
  GETB R5, $E
  LBI R5, #$40
  STAT R5, $E
  MOVE $8E, R5    ; Store status in 008F (see MIM page 3-34)

Remark Bit Description
01=End of tape (EOT)
11=No device address E response
21=Tape running
31=Cartridge in place
41=Erase on
51=LED and erase OK
61=File protected
70=Beginning of tape (BOT)

Device F (selective reset of individual devices)


Remark Bit Description
01=Reset Async. comm/Serial I/O
11=Reset tape adapter
21=Reset keyboard
31=Reset printer
41=Reset display adapter
51=Reset device address B (unused)
61=Reset device address C (unused)
71=Reset diskette adapter