One Address Machine

One Address Machine

Instruction format = OPCODE OPERAND;
e.g ADD 2;

Special cases:
INC and DEC do not take operands.

Valid instructions:

OPCODE(hex) OPCODE OPERANDS Explanation
a0 ADD #address Add the contents of #address to the accumulator
A0 ADD value Add the value to the accumulator
a2 SUB #address Subtract the contents of #address from the accumulator
A2 SUB value Subtract the value from the accumulator
a3 MUL #address; Mulitply the accumulator by the contents of #address
A3 MUL value Multiply the accumulator by this value
a4 DIV #address; Divide the accumulator by the contens of #address
A4 DIV #address; Divide the accumulator by this value
A5 INC no operand Increment the accumulator
A6 DEC no operand Decrement the accumulator
C0 JMP #address; Jump to this address
C1 JMPZ #address; If the accumulator is zero, jump to this address
C2 JMPN #address; If the accumulator is negative, jump to this address
D2 LOAD #address; Load the contents of this address into memory
D3 STORE #address; Store the contents of the accumulator into memory
FF HALT; no operand Stop the machine. Input this as your final instruction. Not required if program loops infinitely.

Return to readme files.

Return to homepage.