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

Syntax examples :

 - FORM_RR         MAX R1 R2
 - FORM_RIR        MAX R2 1234h R1

JavaScript properties of this opcode :

            opcode : MAX
     opcode number : A2h
             group : MOV
       Description : Set dest to imm/src if dest more than imm/src
             Forms : RR,RIR
             Flags : READ_SRC1orIMM READ_SRC2 WRITE_SRC1
move  hide 
asm form :
hex value :
1: vspsim/asm.html version 2006-09-18