View Javadoc

1   package net.sf.zel.instr;
2   
3   import net.sf.zel.vm.ExecutionContext;
4   import net.sf.zel.vm.ZExecutionException;
5   
6   /**
7    * get a element from the stack referenced by the index from the top of stack and put it on top of the stack
8    * @author zoly
9    */
10  public final class LODS extends Instruction
11  {
12      private static final long serialVersionUID = -8076060068156009247L;
13  
14      private LODS(){};
15  
16      public void execute(ExecutionContext context) throws ZExecutionException
17      {
18          Number idx = (Number) context.stack.pop();
19          context.stack.push(context.stack.getFromPtr(idx.intValue()));
20          context.ip++;
21      }
22      /**
23       * instance
24       */
25      public static final Instruction instance = new LODS();
26  }