View Javadoc

1   package com.tapina.robe.runtime.instruction;
2   
3   import com.tapina.robe.runtime.CPU;
4   
5   import java.io.Writer;
6   import java.io.IOException;
7   
8   /***
9    * Created by IntelliJ IDEA.
10   * User: gareth
11   * Date: Aug 23, 2003
12   * Time: 10:56:45 PM
13   */
14  public abstract class Operator {
15      public abstract int getValue(int op1, int op2, CPU cpu, boolean setConditionFlags);
16  
17      static void setZNFlags(int result, CPU cpu) {
18          if (result == 0) {
19              cpu.setZ();
20          } else {
21              cpu.clearZ();
22          }
23          if (result < 0) {
24              cpu.setN();
25          } else {
26              cpu.clearN();
27          }
28      }
29  
30      public abstract void dumpJavaSource(String varName, boolean setFlags, Writer out) throws IOException;
31  }