MAX : MAXimum

Short form : The value of the destination register (src1) is compared with the value of the source register (src2). If src2>src1, then the value of src2 is written to src1.

Long form : The value of the immediate field (sign-extended Imm16) is compared with the value of the source register (src2). If src2>Imm16, then the value of Imm16 is written to src1.

The MINimum instruction is identical but with a reversed condition.

The comparison uses the 2s-complement arithmetic.

 MAX R1 R2         ; If R1>R2    then R1->R2
 MAX R1 1234h R2   ; If R1>1234h then 1234h->R2
 MIN R1 R2         ; If R1<R2    then R1->R2
 MIN R1 1234h R2   ; If R1<1234h then 1234h->R2