MIX - Architecture - Instructions

Instructions

Each machine instruction in memory occupies one word, and consists of 4 parts: the address (2 bytes and the sign of the word) in memory to read or write; an index specification (1 byte, describing which rI index register to use) to add to the address; a modification (1 byte) that specifies which parts of the register or memory location will be read or altered; and the operation code (1 byte). All operation codes have an associated mnemonic.

MIX programs frequently use self-modifying code, in particular to return from a subroutine, as MIX lacks an automatic subroutine return stack. Self-modifying code is facilitated by the modification byte, allowing the program to store data to, for example, the address part of the target instruction, leaving the rest of the instruction unmodified.

MIX programs are typically constructed using the MIXAL assembly language; for an example, see the list hello world programs page.

LDA ADDR,i(0:5) rA := memory;
LDX ADDR,i(0:5) rX := memory;
LD? ADDR,i(0:5) rI? := memory;
LDAN ADDR,i(0:5) rA := - memory;
LDXN ADDR,i(0:5) rX := - memory;
LD?N ADDR,i(0:5) rI? := - memory;
STA ADDR,i(0:5) memory := rA;
STX ADDR,i(0:5) memory := rX;
ST? ADDR,i(0:5) memory := rI?;
STJ ADDR,i(0:5) memory := rJ;
STZ ADDR,i(0:5) memory := 0;
ADD ADDR,i(0:5) rA := rA + memory;
SUB ADDR,i(0:5) rA := rA - memory;
MUL ADDR,i(0:5) (rA,rX) := rA * memory;
DIV ADDR,i(0:5) rA := int( (rA,rX) / memory );
rX := (rA,rX) % memory;
ENTA ADDR,i rA := ADDR + rIi;
ENTX ADDR,i rX := ADDR + rIi;
ENT? ADDR,i rI? := ADDR + rIi;
ENNA ADDR,i rA := - ADDR - rIi;
ENNX ADDR,i rX := - ADDR - rIi;
ENN? ADDR,i rI? := - ADDR - rIi;
INCA ADDR,i rA := rA + ADDR + rIi;
INCX ADDR,i rX := rX + ADDR + rIi;
INC? ADDR,i rI? := ADDR + rIi;
DECA ADDR,i rA := rA - ADDR - rIi;
DECX ADDR,i rX := rX -ADDR - rIi;
DEC? ADDR,i rI? := rI? - ADDR - rIi;
CMPA ADDR,i(0:5) compare rA with memory;
CMPX ADDR,i(0:5) compare rX with memory;
CMP? ADDR,i(0:5) compare rI? with memory;
JMP ADDR,i rJ := address of next instruction;
goto ADDR + rIi;
JSJ ADDR,i goto ADDR + rIi;
JOV ADDR,i if (overflow) then
overflow := false; goto ADDR + rIi;
JNOV ADDR,i if (no overflow) then
goto ADDR + rIi;
else overflow := false;
JL, JE, JG ADDR,i
JGE, JNE, JLE ADDR,i
if (less, equal, greater) then goto ADDR + rIi;
if (no less, unequal, no greater) then goto ADDR + rIi;
JAN/JAZ/JAP ADDR,i
JANN/JANZ/JANP ADDR,i
if (rA<0 or rA==0 or rA>0) then goto ADDR + rIi;
if (rA>=0 or rA!=0 or rA<=0) then goto ADDR + rIi;
JXN/JXZ/JXP ADDR,i
JXNN/JXNZ/JXNP ADDR,i
if (rX<0 or rX==0 or rX>0) then goto ADDR + rIi;
if (rX>=0 or rX!=0 or rX<=0) then goto ADDR + rIi;
J?N/J?Z/J?P ADDR,i
J?NN/J?NZ/J?NP ADDR,i
if (rI?<0 or rI?==0 or rI?>0) then goto ADDR + rIi;
if (rI?>=0 or rI?!=0 or rI?<=0) then goto ADDR + rIi;
MOVE ADDR,i(F) for (n = 0; n < F; n++, rI1++)
memory := memory;
SLA/SRA ADDR,i
SLAX/SRAX ADDR,i
SLC/SRC ADDR,i
shift rA to the left/right by ADDR+rIi bytes
shift (rA,rX) to the left/right by ADDR+rIi bytes
rotate (rA,rX) to the left/right by ADDR+rIi bytes
NOP do nothing;
HLT halt execution;
IN ADDR,i(F) read in one block from input unit F
into memory onwards;
OUT ADDR,i(F) output one block to unit F
from memory onwards;
IOC ADDR,i(F) send control instruction to i/o unit F;
JRED ADDR,i(F) if (i/o unit F is ready) then goto ADDR + rIi;
JBUS ADDR,i(F) if (i/o unit F is busy) then goto ADDR + rIi;
NUM rA := numerical value of characters in (rA,rX);
CHAR (rA,rX) := character codes representing value of rA;

Read more about this topic:  MIX, Architecture

Famous quotes containing the word instructions:

    Realizing that his time was nearly spent, he gave full oral instructions about his burial and the manner in which he wished to be remembered.... A few minutes later, feeling very tired, he left the room, remarking, ‘I have no disposition to leave this precious circle. I love to be here surrounded by my family and friends.’ Then he gave them his blessing and said, ‘I am ready to go and I wish you goodnight.’
    —For the State of New Hampshire, U.S. public relief program (1935-1943)

    They had supposed their formula was fixed.
    They had obeyed instructions to devise
    A type of cold, a type of hooded gaze.
    But when the Negroes came they were perplexed.
    These Negroes looked like men....
    Gwendolyn Brooks (b. 1917)

    If we consider what happens in conversation, in reveries, in remorse, in times of passion, in surprises, in the instructions of dreams, wherein often we see ourselves in masquerade,—the droll disguises only magnifying and enhancing a real element, and forcing it on our distinct notice,—we shall catch many hints that will broaden and lighten into knowledge of the secret of nature.
    Ralph Waldo Emerson (1803–1882)