View Javadoc
1 package jrre.instructionset.controlflow; 2 3 import jrre.Stack; 4 import jrre.types.PrimitiveType; 5 6 public class If_Icmplt extends jrre.instructionset.Instruction { 7 8 int operandOne; 9 int operandTwo; 10 11 public If_Icmplt(int operandOne, int operandTwo){ 12 13 this.operandOne = operandOne; 14 this.operandTwo = operandTwo; 15 16 name = "if_icmplt"; 17 description = "foo foo moo poo"; 18 length = 2; 19 } 20 21 public void execute(){ 22 23 PrimitiveType valueTwo = (PrimitiveType)Stack.popOperand(); 24 PrimitiveType valueOne = (PrimitiveType)Stack.popOperand(); 25 26 if(valueOne.getValue() < valueTwo.getValue()){ 27 28 //int offset = (operandOne << 8) | operandTwo; 29 int offset = -(65536 - ((operandOne << 8) | operandTwo)); 30 if(offset < -60000) 31 offset = ((operandOne << 8) | operandTwo); 32 33 Stack.branch(offset - 2); 34 } 35 36 } 37 38 public String toString(){ 39 return "if_icmplt"; 40 } 41 }

This page was automatically generated by Maven