|  | @@ -0,0 +1,619 @@
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * 
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +package de.mcs.tools.sps.holtec;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.util.ArrayList;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import de.mcs.tools.sps.AbstractEmulator;
 | 
	
		
			
				|  |  | +import de.mcs.tools.sps.EmulatorInput;
 | 
	
		
			
				|  |  | +import de.mcs.tools.sps.EmulatorInternals;
 | 
	
		
			
				|  |  | +import de.mcs.tools.sps.EmulatorOutput;
 | 
	
		
			
				|  |  | +import de.mcs.tools.sps.SPSCommand;
 | 
	
		
			
				|  |  | +import de.mcs.tools.sps.SPSCommandData;
 | 
	
		
			
				|  |  | +import de.mcs.tools.sps.SPSCommandDataImpl;
 | 
	
		
			
				|  |  | +import de.mcs.tools.sps.SPSCommandImpl;
 | 
	
		
			
				|  |  | +import de.mcs.tools.sps.SPSEmulator;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * @author w.klaas
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +public class HoltekEmulator extends AbstractEmulator implements SPSEmulator {
 | 
	
		
			
				|  |  | +  private List<SPSCommand> commands = new ArrayList<>();
 | 
	
		
			
				|  |  | +  {
 | 
	
		
			
				|  |  | +    commands.add(SPS_NOP);
 | 
	
		
			
				|  |  | +    commands.add(SPS_PORT);
 | 
	
		
			
				|  |  | +    commands.add(SPS_WAIT);
 | 
	
		
			
				|  |  | +    commands.add(SPS_JUMP_DOWN);
 | 
	
		
			
				|  |  | +    commands.add(SPS_A_EQUALS);
 | 
	
		
			
				|  |  | +    commands.add(SPS_EQUALS_A);
 | 
	
		
			
				|  |  | +    commands.add(SPS_A_INPUT);
 | 
	
		
			
				|  |  | +    commands.add(SPS_A_CALCULATE);
 | 
	
		
			
				|  |  | +    commands.add(SPS_PAGE);
 | 
	
		
			
				|  |  | +    commands.add(SPS_JUMP_UP);
 | 
	
		
			
				|  |  | +    commands.add(SPS_C_LOOP);
 | 
	
		
			
				|  |  | +    commands.add(SPS_D_LOOP);
 | 
	
		
			
				|  |  | +    commands.add(SPS_SKIP_IF);
 | 
	
		
			
				|  |  | +    commands.add(SPS_CALL);
 | 
	
		
			
				|  |  | +    commands.add(SPS_RETURN);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_NOP = new SPSCommandImpl().setName("no operation").setMnemonic("NOP")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0x00);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    SPS_NOP.getCommandDatas().add(new SPSCommandDataNOP().setName("nop").setMnemonic("NOP")
 | 
	
		
			
				|  |  | +        .setCommandByte((byte) (SPS_NOP.getCommandByte())).setCommand(SPS_NOP));
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_PORT = new SPSCommandImpl().setName("Port Output").setMnemonic("PORT")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0x10);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    for (int i = 0; i < 16; i++) {
 | 
	
		
			
				|  |  | +      SPS_PORT.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +        @Override
 | 
	
		
			
				|  |  | +        public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +          byte data = getData();
 | 
	
		
			
				|  |  | +          HoltekEmulatorOutput emulatorOutput = (HoltekEmulatorOutput) HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +          emulatorOutput.d0 = (data & (byte) 0x01) > 0;
 | 
	
		
			
				|  |  | +          emulatorOutput.d1 = (data & (byte) 0x02) > 0;
 | 
	
		
			
				|  |  | +          emulatorOutput.d2 = (data & (byte) 0x04) > 0;
 | 
	
		
			
				|  |  | +          emulatorOutput.d3 = (data & (byte) 0x08) > 0;
 | 
	
		
			
				|  |  | +          internals.incAddress(1);
 | 
	
		
			
				|  |  | +          return emulatorOutput;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }.setName("Port " + Integer.toString(i)).setMnemonic("PO" + Integer.toString(i))
 | 
	
		
			
				|  |  | +          .setCommandByte((byte) (SPS_PORT.getCommandByte() + i)).setCommand(SPS_PORT));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_WAIT = new SPSCommandImpl().setName("WAIT").setMnemonic("WAIT")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0x20);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    List<SPSCommandData> datas = SPS_WAIT.getCommandDatas();
 | 
	
		
			
				|  |  | +    for (int i = 0; i < 16; i++) {
 | 
	
		
			
				|  |  | +      datas.add(
 | 
	
		
			
				|  |  | +          new SPSCommandDataWait().setName(SPSCommandDataWait.getName(i)).setMnemonic(SPSCommandDataWait.getMnemonic(i))
 | 
	
		
			
				|  |  | +              .setCommandByte((byte) (SPS_WAIT.getCommandByte() + i)).setCommand(SPS_WAIT));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_JUMP_DOWN = new SPSCommandImpl().setName("jump back").setMnemonic("JMP-")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0x30);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    for (int i = 0; i < 16; i++) {
 | 
	
		
			
				|  |  | +      SPS_JUMP_DOWN.getCommandDatas()
 | 
	
		
			
				|  |  | +          .add(new SPSCommandDataJumpDown().setName("Jump -" + Integer.toString(i))
 | 
	
		
			
				|  |  | +              .setMnemonic("JN" + Integer.toString(i)).setCommandByte((byte) (SPS_JUMP_DOWN.getCommandByte() + i))
 | 
	
		
			
				|  |  | +              .setCommand(SPS_JUMP_DOWN));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_A_EQUALS = new SPSCommandImpl().setName("Set A").setMnemonic("A=")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0x40);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    for (int i = 0; i < 16; i++) {
 | 
	
		
			
				|  |  | +      SPS_A_EQUALS.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +        @Override
 | 
	
		
			
				|  |  | +        public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +          ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +          return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }.setName("A= " + Integer.toString(i)).setMnemonic(String.format("A%02d", i))
 | 
	
		
			
				|  |  | +          .setCommandByte((byte) (SPS_A_EQUALS.getCommandByte() + i)).setCommand(SPS_A_EQUALS));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_EQUALS_A = new SPSCommandImpl().setName("=A").setMnemonic("=A")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0x50);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    List<SPSCommandData> datas = SPS_EQUALS_A.getCommandDatas();
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("B=A").setMnemonic("BEA").setCommandByte((byte) (SPS_EQUALS_A.getCommandByte() + 0x01))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_EQUALS_A));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("C=A").setMnemonic("CEA").setCommandByte((byte) (SPS_EQUALS_A.getCommandByte() + 0x02))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_EQUALS_A));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("D=A").setMnemonic("DEA").setCommandByte((byte) (SPS_EQUALS_A.getCommandByte() + 0x03))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_EQUALS_A));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("Output=A").setMnemonic("OEA").setCommandByte((byte) (SPS_EQUALS_A.getCommandByte() + 0x04))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_EQUALS_A));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("Output.1=A").setMnemonic("O1EA").setCommandByte((byte) (SPS_EQUALS_A.getCommandByte() + 0x05))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_EQUALS_A));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("Output.2=A").setMnemonic("O2EA").setCommandByte((byte) (SPS_EQUALS_A.getCommandByte() + 0x06))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_EQUALS_A));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("Output.3=A").setMnemonic("O3EA").setCommandByte((byte) (SPS_EQUALS_A.getCommandByte() + 0x07))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_EQUALS_A));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("Output.4=A").setMnemonic("O4EA").setCommandByte((byte) (SPS_EQUALS_A.getCommandByte() + 0x08))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_EQUALS_A));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("PWM=A").setMnemonic("PEA").setCommandByte((byte) (SPS_EQUALS_A.getCommandByte() + 0x09))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_EQUALS_A));
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_A_INPUT = new SPSCommandImpl().setName("A=(some input)").setMnemonic("AEI")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0x60);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    List<SPSCommandData> datas = SPS_A_INPUT.getCommandDatas();
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=B").setMnemonic("AEB").setCommandByte((byte) (SPS_A_INPUT.getCommandByte() + 0x01))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_INPUT));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=C").setMnemonic("AEC").setCommandByte((byte) (SPS_A_INPUT.getCommandByte() + 0x02))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_INPUT));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=D").setMnemonic("AED").setCommandByte((byte) (SPS_A_INPUT.getCommandByte() + 0x03))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_INPUT));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=Input").setMnemonic("AEI").setCommandByte((byte) (SPS_A_INPUT.getCommandByte() + 0x04))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_INPUT));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=Input.1").setMnemonic("AEI1").setCommandByte((byte) (SPS_A_INPUT.getCommandByte() + 0x05))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_INPUT));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=Input.2").setMnemonic("AEI2").setCommandByte((byte) (SPS_A_INPUT.getCommandByte() + 0x06))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_INPUT));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=Input.3").setMnemonic("AEI3").setCommandByte((byte) (SPS_A_INPUT.getCommandByte() + 0x07))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_INPUT));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=Input.4").setMnemonic("AEI4").setCommandByte((byte) (SPS_A_INPUT.getCommandByte() + 0x08))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_INPUT));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=AD.1").setMnemonic("AEA1").setCommandByte((byte) (SPS_A_INPUT.getCommandByte() + 0x09))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_INPUT));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=AD.2").setMnemonic("AEA2").setCommandByte((byte) (SPS_A_INPUT.getCommandByte() + 0x0A))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_INPUT));
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_A_CALCULATE = new SPSCommandImpl().setName("Calculate with A").setMnemonic("CALC")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0x70);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    List<SPSCommandData> datas = SPS_A_CALCULATE.getCommandDatas();
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=A+1").setMnemonic("INCA").setCommandByte((byte) (SPS_A_CALCULATE.getCommandByte() + 0x01))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_CALCULATE));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=A-1").setMnemonic("DECA").setCommandByte((byte) (SPS_A_CALCULATE.getCommandByte() + 0x02))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_CALCULATE));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=A+B").setMnemonic("ADDB").setCommandByte((byte) (SPS_A_CALCULATE.getCommandByte() + 0x03))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_CALCULATE));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=A-B").setMnemonic("SUBB").setCommandByte((byte) (SPS_A_CALCULATE.getCommandByte() + 0x04))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_CALCULATE));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=A*B").setMnemonic("MULB").setCommandByte((byte) (SPS_A_CALCULATE.getCommandByte() + 0x05))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_CALCULATE));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=A/B").setMnemonic("DIVB").setCommandByte((byte) (SPS_A_CALCULATE.getCommandByte() + 0x06))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_CALCULATE));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=A AND B").setMnemonic("ANDB").setCommandByte((byte) (SPS_A_CALCULATE.getCommandByte() + 0x07))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_CALCULATE));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=A OR B").setMnemonic("ORB").setCommandByte((byte) (SPS_A_CALCULATE.getCommandByte() + 0x08))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_CALCULATE));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=A XOR B").setMnemonic("XORB").setCommandByte((byte) (SPS_A_CALCULATE.getCommandByte() + 0x09))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_CALCULATE));
 | 
	
		
			
				|  |  | +    datas.add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=NOT A").setMnemonic("NOTA").setCommandByte((byte) (SPS_A_CALCULATE.getCommandByte() + 0x0A))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_A_CALCULATE));
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_PAGE = new SPSCommandImpl().setName("Page").setMnemonic("PG")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0x80);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    for (int i = 0; i < 8; i++) {
 | 
	
		
			
				|  |  | +      SPS_PAGE.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +        @Override
 | 
	
		
			
				|  |  | +        public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +          ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +          return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }.setName("Page " + Integer.toString(i)).setMnemonic("PG" + Integer.toString(i))
 | 
	
		
			
				|  |  | +          .setCommandByte((byte) (SPS_PAGE.getCommandByte() + i)).setCommand(SPS_PAGE));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_JUMP_UP = new SPSCommandImpl().setName("Jump").setMnemonic("JMP")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0x90);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    for (int i = 0; i < 16; i++) {
 | 
	
		
			
				|  |  | +      SPS_JUMP_UP.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +        @Override
 | 
	
		
			
				|  |  | +        public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +          ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +          return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }.setName("Jump " + Integer.toString(i)).setMnemonic("JMP" + Integer.toString(i))
 | 
	
		
			
				|  |  | +          .setCommandByte((byte) (SPS_JUMP_UP.getCommandByte() + i)).setCommand(SPS_JUMP_UP));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_C_LOOP = new SPSCommandImpl().setName("C* Loop").setMnemonic("CLOP")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0xA0);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    for (int i = 0; i < 16; i++) {
 | 
	
		
			
				|  |  | +      SPS_C_LOOP.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +        @Override
 | 
	
		
			
				|  |  | +        public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +          ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +          return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }.setName("C* Loop " + Integer.toString(i)).setMnemonic("CLOP" + Integer.toString(i))
 | 
	
		
			
				|  |  | +          .setCommandByte((byte) (SPS_C_LOOP.getCommandByte() + i)).setCommand(SPS_C_LOOP));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_D_LOOP = new SPSCommandImpl().setName("D* Loop").setMnemonic("DLOP")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0xB0);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    for (int i = 0; i < 16; i++) {
 | 
	
		
			
				|  |  | +      SPS_D_LOOP.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +        @Override
 | 
	
		
			
				|  |  | +        public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +          ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +          return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }.setName("D* Loop " + Integer.toString(i)).setMnemonic("DLOP" + Integer.toString(i))
 | 
	
		
			
				|  |  | +          .setCommandByte((byte) (SPS_D_LOOP.getCommandByte() + i)).setCommand(SPS_D_LOOP));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_SKIP_IF = new SPSCommandImpl().setName("Skip if").setMnemonic("SKIP")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0xC0);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A>B").setMnemonic("AGRB").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x01))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A<B").setMnemonic("ASMB").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x02))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("A=B").setMnemonic("AEQB").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x03))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("In.1=1").setMnemonic("IN11").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x04))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("In.2=1").setMnemonic("IN21").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x05))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("In.3=1").setMnemonic("IN31").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x06))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("In.4=1").setMnemonic("IN41").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x07))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("In.1=0").setMnemonic("IN10").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x08))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("In.2=0").setMnemonic("IN20").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x09))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("In.3=0").setMnemonic("IN30").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x0A))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("In.4=0").setMnemonic("IN40").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x0B))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("S1=0").setMnemonic("S10").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x0C))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("S2=0").setMnemonic("S20").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x0D))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("S1=1").setMnemonic("S11").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x0E))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +    SPS_SKIP_IF.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("S2=1").setMnemonic("S21").setCommandByte((byte) (SPS_SKIP_IF.getCommandByte() + 0x0F))
 | 
	
		
			
				|  |  | +        .setCommand(SPS_SKIP_IF));
 | 
	
		
			
				|  |  | +  };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_CALL = new SPSCommandImpl().setName("Call").setMnemonic("CALL")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0xD0);
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    for (int i = 0; i < 16; i++) {
 | 
	
		
			
				|  |  | +      SPS_CALL.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +        @Override
 | 
	
		
			
				|  |  | +        public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +          ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +          return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }.setName("Call " + Integer.toString(i)).setMnemonic("CALL" + Integer.toString(i))
 | 
	
		
			
				|  |  | +          .setCommandByte((byte) (SPS_CALL.getCommandByte() + i)).setCommand(SPS_CALL));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  private static SPSCommand SPS_RETURN = new SPSCommandImpl().setName("return").setMnemonic("RET")
 | 
	
		
			
				|  |  | +      .setCommandByte((byte) 0xE0);
 | 
	
		
			
				|  |  | +  private static HoltekEmulator instance;
 | 
	
		
			
				|  |  | +  static {
 | 
	
		
			
				|  |  | +    SPS_RETURN.getCommandDatas().add(new SPSCommandDataImpl() {
 | 
	
		
			
				|  |  | +      @Override
 | 
	
		
			
				|  |  | +      public EmulatorOutput doWork(EmulatorInput input, EmulatorInternals internals, EmulatorOutput output) {
 | 
	
		
			
				|  |  | +        ((HoltekEmulatorInternals) internals).address++;
 | 
	
		
			
				|  |  | +        return HoltekEmulator.getInstance().getEmulatorOutput();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }.setName("Return").setMnemonic("RET").setCommandByte((byte) (SPS_RETURN.getCommandByte())).setCommand(SPS_RETURN));
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  protected static HoltekEmulator getInstance() {
 | 
	
		
			
				|  |  | +    return instance;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  public HoltekEmulator() {
 | 
	
		
			
				|  |  | +    instance = this;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  @Override
 | 
	
		
			
				|  |  | +  public List<SPSCommand> getCommands() {
 | 
	
		
			
				|  |  | +    return commands;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  @Override
 | 
	
		
			
				|  |  | +  public int getProgramSize() {
 | 
	
		
			
				|  |  | +    return 128;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  @Override
 | 
	
		
			
				|  |  | +  protected void reset() {
 | 
	
		
			
				|  |  | +    getEmulatorOutput().reset();
 | 
	
		
			
				|  |  | +    getEmulatorInternals().reset();
 | 
	
		
			
				|  |  | +    System.out.println("holtec emulator resettet");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  @Override
 | 
	
		
			
				|  |  | +  protected void callNextCommand() {
 | 
	
		
			
				|  |  | +    byte command = programMemory[getEmulatorInternals().getAddress()];
 | 
	
		
			
				|  |  | +    SPSCommandData commandData = getCommandData(command);
 | 
	
		
			
				|  |  | +    runCommand(commandData);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  @Override
 | 
	
		
			
				|  |  | +  protected EmulatorInput createEmulatorInput() {
 | 
	
		
			
				|  |  | +    return new HoltekEmulatorInput();
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  @Override
 | 
	
		
			
				|  |  | +  protected EmulatorOutput createEmulatorOutput() {
 | 
	
		
			
				|  |  | +    return new HoltekEmulatorOutput();
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  @Override
 | 
	
		
			
				|  |  | +  protected EmulatorInternals createEmulatorInternals() {
 | 
	
		
			
				|  |  | +    return new HoltekEmulatorInternals();
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +}
 |