Signed Arithmetic

Name:
ADD $X,$Y,$ZADD $X,$Y,Z
SUB $X,$Y,$ZSUB $X,$Y,Z
MUL $X,$Y,$ZMUL $X,$Y,Z
DIV $X,$Y,$ZDIV $X,$Y,Z

Specification:
ADD: s($X) ← s($Y) + s($Z)
SUB: s($X) ← s($Y) - s($Z)
MUL: s($X) ← s($Y) * s($Z)
DIV:
s($X) ← { ⌊s($Y) / s($Z)⌋ if $Z ≠ 0
0 if $Z = 0

the integer part of the Quotient and

s(rR) ← { s($Y) mod s($Z) if $Z ≠ 0
s($Y) if $Z = 0

the remainder in special register rR.

All instructions exist in two variants. The second operand can either be a register $Z or an immediate value Z.

Timing:

ADD:
SUB:
MUL: 10υ
DIV: 60υ

Description:

These are instructions for computations with signed integers. The instructions record exceptions like overflow or division by zero in special register rA and, if enabled, cause a TRIP.

See also:

Unsigned Arithmetic.