/** jump */ public void jump(JumpInstruction currentInstruction) { if (program.checkExistLabel(currentInstruction.getLabel())) setCurrentInstructionIndex(program.getLabelIndex(currentInstruction.getLabel())); else { halt(); System.out.println( "Error. Line: " + (currentInstructionIndex + 1) + " Invalid label: " + currentInstruction.getName() + " " + currentInstruction.getLabel()); } }
/** jgtz */ public void jgtz(JumpInstruction currentInstruction) { if (memoryRegister.getAccumulator() > 0) { if (program.checkExistLabel(currentInstruction.getLabel())) setCurrentInstructionIndex(program.getLabelIndex(currentInstruction.getLabel())); else { halt(); System.out.println( "Error. Line: " + (currentInstructionIndex + 1) + " Invalid label: " + currentInstruction.getName() + " " + currentInstruction.getLabel()); } } else currentInstructionIndex++; }