The following is a break down of the opcodes of the simple machine for which you are designing an instruction decoder. It is important to note that when using the opcode for a 16-bit memory address, the byte immediately following the opcode is the most significant byte of the address and the byte following that is the least significant.
If the most significant bit is 0, then the opcode represents a mathematical function. The opcode may be followed by 0, 1, or 2 bytes of operand.
* -- The constant is passed to the processor as an 8-bit operand following
the opcode
** -- The memory address is passed to the processor as a 16-bit operand following
the opcode
If the most significant two bits are 10, then the opcode represents a memory operation. When the "Method" bit is equal to 00, the opcode is followed by a 16-bit operand that serves as the memory address. When the "Method" bit is equal to 01, the opcode is followed by an operand that serves as a constant (8 bits for A or B and 16 bits for X or D). Otherwise, the value contained in index register X is used as the memory address.
If the most significant three bits are 110, then the opcode represents an unconditional or conditional branch. The opcode is always followed by a 16-bit operand that serves as the memory address.
If the most significant three bits are 111, then the opcode represents a special operation not included in the list above. None of the special opcodes require operands. They are either implied by the operation or not required.
The following table (which is poorly formatted because I exported it from Excel) contains a list of the opcodes that you will see for this processor. If you see any errors or have any questions, e-mail me at tarnoffetsu.edu.
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
A=A+[X] |
Uses pointer X as memory address for
source |
|
|
|
|
|
|
|
|
|
A=A+B |
|
|
|
|
|
|
|
|
|
|
A=A+Const |
Constant is an 8-bit value |
|
|
|
|
|
|
|
|
|
A=A+Mem |
|
|
|
|
|
|
|
|
|
|
B=B+[X] |
Uses pointer X as memory address for
source |
|
|
|
|
|
|
|
|
|
B=B+Const |
Constant is an 8-bit value |
|
|
|
|
|
|
|
|
|
B=B+Mem |
|
|
|
SUB |
|
|
|
|
|
|
A=A-[X] |
Uses pointer X as memory address for
source |
|
|
|
|
|
|
|
|
|
A=A-B |
|
|
|
|
|
|
|
|
|
|
A=A-Const |
Constant is an 8-bit value |
|
|
|
|
|
|
|
|
|
A=A-Mem |
|
|
|
|
|
|
|
|
|
|
B=B-[X] |
Uses pointer X as memory address for
source |
|
|
|
|
|
|
|
|
|
B=B-Const |
Constant is an 8-bit value |
|
|
|
|
|
|
|
|
|
B=B-Mem |
|
|
|
|
|
|
|
|
|
|
D=A*B |
Destination and source are implied
|
|
|
|
|
|
|
|
|
|
B=B/A |
Destination and source are implied
|
|
|
|
|
|
|
|
|
|
A=A+1 |
|
|
|
|
|
|
|
|
|
|
B=B+1 |
|
|
|
|
|
|
|
|
|
|
D=D+1 |
|
|
|
|
|
|
|
|
|
|
X=X+1 |
|
|
|
|
|
|
|
|
|
|
A=A-1 |
|
|
|
|
|
|
|
|
|
|
B=B-1 |
|
|
|
|
|
|
|
|
|
|
D=D-1 |
|
|
|
|
|
|
|
|
|
|
X=X-1 |
|
|
|
|
|
|
|
|
|
|
A=A&[X] |
Uses pointer X as memory address for
source |
|
|
|
|
|
|
|
|
|
A=A&B |
Bitwise operation |
|
|
|
|
|
|
|
|
|
A=A&Const |
Bitwise operation |
|
|
|
|
|
|
|
|
|
A=A&Mem |
Bitwise operation |
|
|
|
|
|
|
|
|
|
B=B&[X] |
Uses pointer X as memory address for
source |
|
|
|
|
|
|
|
|
|
B=B&Const |
Bitwise operation |
|
|
|
|
|
|
|
|
|
B=B&Mem |
Bitwise operation |
|
|
|
|
|
|
|
|
|
A=A|[X] |
Uses pointer X as memory address for
source |
|
|
|
|
|
|
|
|
|
A=A|B |
Bitwise operation |
|
|
|
|
|
|
|
|
|
A=A|Const |
Bitwise operation |
|
|
|
|
|
|
|
|
|
A=A|Mem |
Bitwise operation |
|
|
|
|
|
|
|
|
|
B=B|[X] |
Uses pointer X as memory address for
source |
|
|
|
|
|
|
|
|
|
B=B|Const |
Bitwise operation |
|
|
|
|
|
|
|
|
|
B=B|Mem |
Bitwise operation |
|
|
|
|
|
|
|
|
|
A=A^[X] |
Uses pointer X as memory address for
source |
|
|
|
|
|
|
|
|
|
A=A^B |
Bitwise operation |
|
|
|
|
|
|
|
|
|
A=A^Const |
Bitwise operation |
|
|
|
|
|
|
|
|
|
A=A^Mem |
Bitwise operation |
|
|
|
|
|
|
|
|
|
B=B^[X] |
Uses pointer X as memory address for
source |
0100 0100 |
|
|
|
|
|
|
|
|
B=B^Const |
Bitwise operation |
|
|
|
|
|
|
|
|
|
B=B^Mem |
Bitwise operation |
|
|
|
|
|
|
|
|
|
A=!A |
Bitwise operation |
|
|
|
|
|
|
|
|
|
B=!B |
Bitwise operation |
|
|
|
|
|
|
|
|
|
A->Mem |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
B->Mem |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
D->Mem |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
X->Mem |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
Indexed |
|
A->[X] |
Uses value contained in X as memory
address |
|
|
|
|
|
|
|
|
|
B->[X] |
Uses value contained in X as memory
address |
|
|
|
|
|
|
|
|
|
D->[X] |
Uses value contained in X as memory
address |
|
|
|
|
|
|
|
|
|
X->[X] |
Uses value contained in X as memory
address |
|
|
|
|
|
|
|
|
|
A<-Mem |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
B<-Mem |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
D<-Mem |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
X<-Mem |
Always uses 16-bit memory
address |
|
|
|
|
|
|
|
|
|
A<-Const |
Opcode serves as a 1 byte constant |
|
|
|
|
|
|
|
|
|
B<-Const |
Opcode serves as a 1 byte constant
|
|
|
|
|
|
|
|
|
|
D<-Const |
Opcode serves as a 2 byte constant
|
|
|
|
|
|
|
|
|
|
X<-Const |
Opcode serves as a 2 byte constant
|
|
|
|
|
|
|
|
|
|
A<-[X] |
Uses value contained in X as memory
address |
|
|
|
|
|
|
|
|
|
B<-[X] |
Uses value contained in X as memory
address |
|
|
|
|
|
|
|
|
|
D<-[X] |
Uses value contained in X as memory
address |
|
|
|
|
|
|
|
|
|
X<-[X] |
Uses value contained in X as memory
address |
|
|
|
|
|
|
|
|
|
Exchange A and B |
Destination and source are implied
|
|
|
|
|
|
|
|
|
|
IP<-Mem |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
IP<-Mem if A=0 |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
IP<-Mem if A!=0 |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
IP<-Mem if A<0 |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
IP<-Mem if A>0 |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
IP<-Mem if B=0 |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
IP<-Mem if B!=0 |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
IP<-Mem if B<0 |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
IP<-Mem if B>0 |
Always uses 16-bit memory address |
|
|
|
|
|
|
|
|
|
No operation |
|
|
|
|
|
|
|
|
|
|
Halt processor |
|
|
|