Previous: , Up: mixvm   [Contents][Index]


6.3 MIX block devices

The MIX computer comes equipped with a set of block devices for input-output operations (see Input-output operators). mixvm 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 mixvm command devdir (see Configuration commands).

DeviceNo.filenametype and block size
Tape0-7tape[0-7].devbin i/o - 100 words
Disks8-15disk[0-7].devbin i/o - 100 words
Card reader16cardrd.devchar in - 16 words
Card writer17cardwr.devchar out - 16 words
Line printer18printer.devchar out - 24 words
Terminal19stdin/stdoutchar i/o - 14 words
Paper tape20paper.devchar 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.


Previous: , Up: mixvm   [Contents][Index]