xMachine command summary

Modified from Eck: The Most Complex Machine

Basic Instructions

Some of these instructions (NOT, SHL, SHR, INC, DEC, HLT) take no parameter. If a parameter is present, it will be ignored. The operation will be performed on the accumulator. The other commands in this table take a cell address as a parameter. The operation will always involve the accumulator and the contents of the cell address given. The results will be placed back in the accumulator. All the basic instructions begin with 00
Code Nickname Name Example Description
000000 ADD Add-to-AC ADD 12 Adds contents of address 12 to accumulator
000001 SUB Subtract-from-AC SUB 12 Subtracts contents of address 12 from accumulator
000010 AND Logical-AND-with-AC AND 12 Performs bitwise AND with contents of address 12
000011 OR Logical-OR-with-AC OR 12 Performs bitwise OR with contents of address 12
000100 NOT Logical-NOT-of-AC NOT Performs complement (bitwise NOT) of accumulator
Parameter ignored
000101 SHL Shift-AC-left SHL Shifts each digit of accumulator one digit left
multiplies accumulator by two
000110 SHR Shift-AC-right SHR Shifts each digit of accumulator one digit right
divides accumulator by two
000111 INC Increment-AC INC Adds one to accumulator
001000 DEC Decrement-AC DEC Subtracts one from accumulator
001001 LOD LOD-AC-from-memory LOD 12 Copies the value from address 12 to accumulator
001010 STO STO-AC-in-memory STO 12 Stores the value in accumulator to address 12
001011 HLT Halt HLT Stops program execution
001100 JMP Jump JMP 12 Transfers program control to instruction in address 12
001101 JMZ Jump-if-AC-is-zero JMZ 12 If accumulator is zero, jump to instruction in address 12
Otherwise, move on to next instruction
001110 JMN Jump-if-AC-is-negative JMN 12 If accumulator is negative, jump to instruction in address 12
Otherwise, move on to next instruction
001111 JMF Jump-if-FLAG-is-set JMF 12 If FLAG register is on, jump to instruction in address 12
Otherwise, move on to next instruction

Constant addressing instructions

The constant addressing commands all take a number as a parameter. This actual value is manipulated with the accumulator. All the constant addressed instructions begin with 01.
Code Nickname Name Example Description
010000 ADD-C Add-Constant-to-AC ADD-C 12 Adds value 12 to accumulator
010001 SUB-C Subtract-Constant-from-AC SUB-C 12 Subtracts value 12 from accumulator
010010 AND-C Logical-AND-Constant-with-AC AND-C 12 Performs bitwise AND with value 12
010011 OR-C Logical-OR-Constant-with-AC OR-C 12 Performs bitwise OR with value 12
011001 LOD-C LOD-AC-with-Constant LOD-C 12 Copies the value 12 to accumulator

Indirect Addressing Instructions

The indirect addressing functions add tremendous flexibility to the system. The parameter of the command is an address, but that address does not hold the actual data, but another address, which does hold the data. So, if address 12 contains the value 20, and address 20 contains the value 50, the command STO-I 12 looks at cell 12 to get an address (20). It then looks in cell 20 to get the actual value (50), and stores the value 50 in the accumulator. The advantage of this approach is that a routine can be devised to manipulate multiple address cells within loops. This is useful for manipulating text data or arrays of variables. All indirect addressing commands begin with 10.
Code Nickname Name Example Description
100000 ADD-I Add-Indirect-to-AC ADD-I 12 Adds contents of address referred by 12 to accumulator
100001 SUB-I Subtract-from-AC SUB-I 12 Subtracts contents of address referred by 12 from accumulator
100010 AND-I Logical-AND-Indirect-with-AC AND-I 12 Performs bitwise AND with contents of address referred by 12
100011 OR-I Logical-OR-Indirect-with-AC OR-I 12 Performs bitwise OR with contents of address referred by 12
101001 LOD-I LOD-AC-Indirect-from-memory LOD-I 12 Copies the value from address referred by 12 to accumulator
101010 STO-I STO-AC-Indirect-in-memory STO-I 12 Stores the value in accumulator to address referred by 12
101100 JMP-I Jump-Indirect JMP-I 12 Transfers program control to instruction in address referred by 12
101101 JMZ-I Jump-Indirect-if-AC-is-zero JMZ-I 12 If accumulator is zero, jump to instruction in address referred by 12
Otherwise, move on to next instruction
101110 JMN-I Jump-Indirect-if-AC-is-negative JMN-I 12 If accumulator is negative, jump to instruction in address
referred by 12. Otherwise, move on to next instruction
101111 JMF-I Jump-Indirect-if-FLAG-is-set JMF-I 12 If FLAG register is on, jump to instruction in address
referred by 12. Otherwise, move on to next instruction

© Andy Harris
Indiana University / Purdue University, Indianapolis
email: aharris@cs.iupui.edu
homepage: http://www.cs.iupui.edu/~aharris