You are on page 1of 11

BASIC I/Q MIX

DEVICES
The standard programming for MIX I/O
devices varies from device to device.
Because of this we give here a short
description of the standard
programming techniques used for each
of the normal MIX I/O devices: card
reader, card punch, line printer,
magnetic tape, magnetic disk and drum,
teletype, and paper tape reader/punch.
INPUT DEVICES

These devices are the main source of input for a program. They are
all character-oriented and transmit the six-bit MIX character code.
The only difference in their programming is in their record lengths.
For the card reader, the input record is one card, 80 characters, 16
words; for the teletype and paper tape reader, the input record is one
line, 70 characters, 14 words. This affects only the size of the buffer
which needs to be allocated and the values of indices used in loops to
use the input data. For convenience of explanation, we discuss all of
these devices in terms of the card reader. The changes for the other
devices only involve changing the device numbers and record lengths.
Input is initiated by the IN instruction. If we have defined a 16-word buffer CARD
(CARD ORIG *+16), then we can read a card into it by
 
IN CARD(16) BEGIN READING CARD
JBUS *(16) WAIT UNTIL READ

 The card reader is device number 16. The IN instruction sends a command
from the control unit through the I/O system to the controller of the card
reader, telling it to read a card into memory beginning at location CARD.
The controller of the card reader begins the action of reading a card while
the computer continues with the next instruction. Notice that the IN
instruction only began the input of a card. In order to use the card, we
must wait until it has actually been read into memory. Since the card
reader will be in a busy state until the card has been read, we need only
wait until the device is not busy; then we will know that the card has been
read and can be used. We program this by a very short loop (a tight loop)
which does nothing but repetitively test the device state, waiting for it to
become non-busy (JBUS *(device)).
 While the computer is executing the JBUS instruction, the card reader is
reading characters off the card one at a time as they pass in front of the
reading station in the card reader. These are sent, one at a time, to the
card reader controller. When the controller has five characters, it packs
them into one MIX word, sets the sign bit to "+" and stores this word in
the next buffer location in MIX memory. The controller has an internal
register which is used to remember the address of the next memory
location into which the next word will be stored. After each new word is
stored in memory, this register is incremented by one. Thus successive five
character groups are packed together and stored in successive locations in
memory as they are read. Each character may take from 100 to 600 MIX
time units to be read. When the entire card is safely placed in memory, the
controller sets its ready/busy bit back to ready and waits for a new
command from the computer.
All this time the CPU is executing the JBUS *(16) instruction over and over
again. When the controller finally sets its state to ready, the jump test fails
and we drop out of the wait loop and can proceed to use the newly read card.
When we want another card, we can repeat this code.
A programmer must always be very careful that the input device is done with
an input operation before attempting to use the data being read in. For
example if we were to write

IN CARD(16) READ A CARD


ENT1 0 INDEX INTO CARD 0..15
LDA CARD,1 LOAD FIRST FIVE CHARACTERS
 The contents of the A register would not be the contents of the first five columns of
the card read by the IN. It will take 500 to 3000 time units before that new data is
read and put in memory. In the meantime the previous contents of the buffer
locations remain there, and so the LDA, coming only two time units after the card
started to be read, will load these old values into the A register. However, this should
not be depended upon either. Card readers, like all I/O devices, are asynchronous
and have no concept of CPU time. Also, the design of the card reader may be such
that its timing is almost unpredictable. Card reader controllers have been built
which have little 80-character memories built into them. When the card reader is
turned on, they automatically read the first card into this internal memory. When
an IN instruction is issued, they immediately transfer this previously read card into
memory and start to read the next into their private 80-character memory, trying to
always keep one card ahead of the input requests. If a new IN instruction occurs
before the next card is read, however (which is likely), the controller reverts to the
old way of reading and storing into MIX memory as before. The important point is
simply to never make any assumptions about the I/O speeds of I/O devices. Being off
by only one time unit can ruin the entire program.
OUTPUT DEVICES
 The card reader, teletype keyboard, and paper tape reader are the standard
input devices, while the line printer, card punch, teletype printer, and paper
tape punch are the standard output devices. As with the input devices, the
programming of these output devices varies only with respect to their
record lengths and speeds. The record lengths (120 characters for the line
printer, 80 characters for the card punch, 70 characters for the teletype
printer and paper tape punch) only determine the amount of space needed
for the buffers for these devices; thus, we will limit our discussion to the line
printer. The concepts apply equally to the other devices.
 Outputting to the line printer is essentially the same as reading from the card
reader, with the exception that since we are outputting, the programming to
create the output line must be programmed and executed before the line is
output. Once this is done, and the appropriate character codes are stored in
memory -- for example, in a buffer called LINE -- we simply write
 

OUT LINE(18) PRINT A LINE


JBUS *(18) LINE PRINTER IS DEVICE 18

The OUT will start the output and the JBUS will assure that it is
complete before continuing. The controller for the output device loads
five characters (one word) at a time from memory and prints or
punches them. The sign bit of each word is ignored. When the entire
record has been output, the state of the device is reset from busy to
ready.
An IOC 0(18) will cause the line printer to skip to the top of a page. IOC
0(19) will rewind the paper tape. IOC has no effect on a card reader or
card punch.
MAGNETIC
TAPE
 The I/O devices which we have considered so far have been
for the input and output of character representation of
data. Magnetic tape, on the other hand, is basically a
storage I/O device. Information can be written to tape and
then read back into the computer, but it is very diffi cult for
a human to either read or write magnetic tape. Because of
this, programming of magnetic tape devices differs from
the devices which we have already considered.
MAGNETIC
DISK AND
DRUMS

 Magnetic tape is by its nature a sequentially accessed device;


records are accessed from the beginning to the end, one at a
time. This is due to the physical nature of the device. Disk and
drum storage devices have been constructed to allow any
given record to be directly accessible, however, so these are
called direct access, or sometimes random access devices, as
opposed to the sequentially accessed magnetic tape devices

You might also like