Five Address Machine

Instructions take the format:

OPCODE    OPERAND1,OPERAND2,RES,JMPN,JMPP
        e.g       ADD #10,#20,#20,#30,#40;

Add the contents of address 10 to contents of address 20 and
store the result in address 20. Jump to address 30 if the result was
negative. Jump to address 40 if result was zero or positive.

Valid instructions:

OPCODE(hex) OPCODE OPERANDS Explanation
A1 ADD value,#address1,#res,#jmpn,#jmpz; Add this value to the contents of #address1, store result in #res. If #res is negative, jump to #jmpn. If it is zero, jump to #jmpz.
A0 ADD #address1,#address2,#res,#jmpn,#jmpz Add the contents of #address1 to #address2, store result in #res. If #res is negative, jump to #jmpn. If it is zero, jump to #jmpz.
A2 SUB                   " Subtract the contents of #address1 from #address2, store result in #res. If #res is negative, jump to #jmpn. If it is zero, jump to #jmpz.
A3 MUL                   " Multiply the contents of #address1 by #address2, store result in #res. If #res is negative, jump to #jmpn. If it is zero, jump to #jmpz.
A4 DIV                   " Divide the contents of #address1 by #address2, store result in #res. If #res is negative, jump to #jmpn. If it is zero, jump to #jmpz.
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.