# binop/lit16

## Purpose

Perform the indicated binary op on the indicated register (first argument) and literal value (second argument), storing the result in the destination register.

## Details

Op & Format | Mnemonic / Syntax | Arguments
--- | --- | ---
d0..d7 22s | binop/lit16 vA, vB, #+CCCC d0: add-int/lit16 d1: rsub-int (reverse subtract) d2: mul-int/lit16 d3: div-int/lit16 d4: rem-int/lit16 d5: and-int/lit16 d6: or-int/lit16 d7: xor-int/lit16 | `A:` destination register (4 bits) `B:` source register (4 bits) `C:` signed int constant (16 bits)

## Constraints

- Both A and B must be valid register indices in the current stackframe.
- Registers vA and vB must be defined. They must both contain integer values.
- C is an immediate, signed integer constant taken from the instruction stream (actually this means there are no special requirements for C at all).

## Behavior

- The given operation <binop> is performed according to the semantics specified in table XXX.
- Argument C is sign-extended to 32 bits before.
- The result is stored in register vA, that is, vA'=vB <binop> vC.
- As usual, neighboring registers might get undefined, if vA was part of a register pair originally.

## Exceptions

- ArithmeticException if an error occurs during the instruction.