Professional Documents
Culture Documents
Micro Hu May
Micro Hu May
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
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