The MIX computer comes equipped with a set of block devices for
input-output operations (see Input-output operators).
implements these block devices as disk files, with the exception of
block device no. 19 (typewriter terminal) which is redirected to
standard input/output. When you request an output operation on any other
(output) device, a file named according to the following table will be
created, and the specified MIX words will be
written to the file in binary form (for binary devices) or in ASCII (for
char devices). Files corresponding to input block devices should be
created and filled beforehand to be used by the MIX virtual machine (for
input-output devices this creation can be accomplished by a MIXAL
program writing to the device the required data, or, if you prefer, with
your favourite editor). The device files are stored, by default, in the
directory ~/.mdk; this location can be changed using the
devdir (see Configuration commands).
|Device||No.||filename||type and block size
|Tape||0-7||tape[0-7].dev||bin i/o - 100 words
|Disks||8-15||disk[0-7].dev||bin i/o - 100 words
|Card reader||16||cardrd.dev||char in - 16 words
|Card writer||17||cardwr.dev||char out - 16 words
|Line printer||18||printer.dev||char out - 24 words
|Terminal||19||char i/o - 14 words
|Paper tape||20||paper.dev||char in - 14 words
Devices of type char are stored as ASCII files, using one line per block. For instance, since the card reader has blocks of size 16, that is, 80 characters, it will be emulated by an ASCII file consisting of lines with length 80. If the reader finds a line with less than the required number of characters, it pads the memory with zeroes (MIX character 'space') to complete the block size.
Note that the virtual machine automatically converts between the MIX and ASCII character encodings, so that you can manipulate char device files with any ASCII editor. In addition, the reader is not case-sensitive, i.e., it automatically converts lowercase letters to their uppercase counterparts (since the MIX character set does not include the former).
The typewriter (device no. 19) lets you use the standard input and output in your MIXAL programs. For instance, here is a simple 'echo' program:
* simple echo program TERM EQU 19 the typewriter device BUF EQU 500 input buffer ORIG 1000 START IN BUF(TERM) read a block (70 chars) OUT BUF(TERM) write the read chars HLT END START
Input lines longer than 70 characters (14 words) are trimmed. On the other hand, if you type less than a block of characters, whitespace (MIX character zero) is used as padding.