Explorar el Código

some refactoring.

Klaas, Wilfried hace 6 años
padre
commit
3466941566
Se han modificado 32 ficheros con 911 adiciones y 1577 borrados
  1. 0 1
      .classpath
  2. 5 0
      examples/Blink.tps
  3. 235 228
      src/main/java/de/mcs/tools/sps/SPSAssembler.java
  4. 0 73
      src/main/java/de/mcs/tools/sps/mnemonic/ADC.java
  5. 0 81
      src/main/java/de/mcs/tools/sps/mnemonic/ARC.java
  6. 0 81
      src/main/java/de/mcs/tools/sps/mnemonic/BADC.java
  7. 0 81
      src/main/java/de/mcs/tools/sps/mnemonic/BARC.java
  8. 119 0
      src/main/java/de/mcs/tools/sps/mnemonic/BLDA.java
  9. 0 81
      src/main/java/de/mcs/tools/sps/mnemonic/BPWM.java
  10. 0 80
      src/main/java/de/mcs/tools/sps/mnemonic/BSRV.java
  11. 120 0
      src/main/java/de/mcs/tools/sps/mnemonic/BSTA.java
  12. 0 75
      src/main/java/de/mcs/tools/sps/mnemonic/DIN.java
  13. 9 4
      src/main/java/de/mcs/tools/sps/mnemonic/LDA.java
  14. 13 19
      src/main/java/de/mcs/tools/sps/mnemonic/PORT.java
  15. 0 73
      src/main/java/de/mcs/tools/sps/mnemonic/PWM.java
  16. 0 81
      src/main/java/de/mcs/tools/sps/mnemonic/SRV.java
  17. 151 0
      src/main/java/de/mcs/tools/sps/mnemonic/STA.java
  18. 2 4
      src/test/java/de/mcs/tools/sps/emulator/emulator/holtek/TestHoltekEmulator.java
  19. 0 68
      src/test/java/de/mcs/tools/sps/mnemonic/TestADC.java
  20. 0 68
      src/test/java/de/mcs/tools/sps/mnemonic/TestARC.java
  21. 0 68
      src/test/java/de/mcs/tools/sps/mnemonic/TestBADC.java
  22. 0 68
      src/test/java/de/mcs/tools/sps/mnemonic/TestBARC.java
  23. 83 0
      src/test/java/de/mcs/tools/sps/mnemonic/TestBLDA.java
  24. 0 68
      src/test/java/de/mcs/tools/sps/mnemonic/TestBPWM.java
  25. 38 21
      src/test/java/de/mcs/tools/sps/mnemonic/TestBSRV.java
  26. 0 68
      src/test/java/de/mcs/tools/sps/mnemonic/TestDIN.java
  27. 0 89
      src/test/java/de/mcs/tools/sps/mnemonic/TestDOUT.java
  28. 1 1
      src/test/java/de/mcs/tools/sps/mnemonic/TestLDA.java
  29. 4 4
      src/test/java/de/mcs/tools/sps/mnemonic/TestMOV.java
  30. 23 24
      src/test/java/de/mcs/tools/sps/mnemonic/TestPORT.java
  31. 0 68
      src/test/java/de/mcs/tools/sps/mnemonic/TestSRV.java
  32. 108 0
      src/test/java/de/mcs/tools/sps/mnemonic/TestSTA.java

+ 0 - 1
.classpath

@@ -26,7 +26,6 @@
 	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
 		<attributes>
-			<attribute name="module" value="true"/>
 			<attribute name="maven.pomderived" value="true"/>
 		</attributes>
 	</classpathentry>

+ 5 - 0
examples/Blink.tps

@@ -0,0 +1,5 @@
+DOUT #0x0F
+WAIT 200ms
+DOUT #0x00
+WAIT 200ms
+RJMP 4

+ 235 - 228
src/main/java/de/mcs/tools/sps/SPSAssembler.java

@@ -59,257 +59,264 @@ import de.mcs.utils.jsap.SwitchOption;
 @Command(help = "SPS Assembler \r\n usage java -jar SPSEmulator-x.x.x.jar <options>")
 public class SPSAssembler {
 
-	private static File source;
-	private static HARDWARE destination;
-	private static int lineNumber;
-	private static int srcLineNumber;
-	private static Map<String, Integer> labels = new HashMap<>();
-	private static boolean inBlockComment;
-	private static List<Mnemonic> mnemonics = new ArrayList<>();
-	private static File destinationFile;
-	private static FORMAT outputFormat;
+  private static File source;
+  private static HARDWARE destination;
+  private static int lineNumber;
+  private static int srcLineNumber;
+  private static Map<String, Integer> labels = new HashMap<>();
+  private static boolean inBlockComment;
+  private static List<Mnemonic> mnemonics = new ArrayList<>();
+  private static File destinationFile;
+  private static FORMAT outputFormat;
 
-	/**
-	 * 
-	 */
-	public SPSAssembler() {
-		// TODO Auto-generated constructor stub
-	}
+  /**
+   * 
+   */
+  public SPSAssembler() {
+    // TODO Auto-generated constructor stub
+  }
 
-	@SwitchOption(shortKey = 'h', longKey = "help", name = "help", help = "show this help page", required = false, defaultValue = false)
-	public static void doHelp(boolean value) {
-		if (value) {
-			CommandlineProcessor.showHelp();
-			System.exit(0);
-		}
-	}
+  @SwitchOption(shortKey = 'h', longKey = "help", name = "help", help = "show this help page", required = false, defaultValue = false)
+  public static void doHelp(boolean value) {
+    if (value) {
+      CommandlineProcessor.showHelp();
+      System.exit(0);
+    }
+  }
 
-	@StringOption(shortKey = 'f', longKey = "format", name = "format", defaultValue = "HEX", help = "the output format. HEX: IntelHEX, TPSTXT: TPS programming text", required = false)
-	public static void setOutputFormat(String value) {
-		outputFormat = FORMAT.valueOf((value.toUpperCase()));
-	}
+  @StringOption(shortKey = 'f', longKey = "format", name = "format", defaultValue = "HEX", help = "the output format. HEX: IntelHEX, TPSTXT: TPS programming text", required = false)
+  public static void setOutputFormat(String value) {
+    outputFormat = FORMAT.valueOf((value.toUpperCase()));
+  }
 
-	@StringOption(shortKey = 'd', longKey = "hardware", name = "hardware system", defaultValue = "HOLTEK", help = "the hardware system to compile to. Passible options are: HOLTEK, ATMEGA8, ARDUINOSPS, TINYSPS", required = false)
-	public static void setDestinationSystem(String value) {
-		destination = HARDWARE.valueOf((value.toUpperCase()));
-	}
+  @StringOption(shortKey = 'd', longKey = "hardware", name = "hardware system", defaultValue = "HOLTEK", help = "the hardware system to compile to. Passible options are: HOLTEK, ATMEGA8, ARDUINOSPS, TINYSPS", required = false)
+  public static void setDestinationSystem(String value) {
+    destination = HARDWARE.valueOf((value.toUpperCase()));
+  }
 
-	@FileOption(index = 1, name = "source file", help = "source file to compile", required = true, mustExists = true)
-	public static void setSourceFile(File file) {
-		source = file;
-	}
+  @FileOption(index = 1, name = "source file", help = "source file to compile", required = true, mustExists = true)
+  public static void setSourceFile(File file) {
+    if ((file != null) && !file.getName().equals("")) {
+      source = file;
+    }
+  }
 
-	@FileOption(index = 2, name = "destination file", help = "destination file to compile to", required = false)
-	public static void setDestinationFile(File file) {
-		if ((file != null) && !file.getName().equals("")) {
-			destinationFile = file;
-		}
-	}
+  @FileOption(index = 2, name = "destination file", help = "destination file to compile to", required = false)
+  public static void setDestinationFile(File file) {
+    if ((file != null) && !file.getName().equals("")) {
+      destinationFile = file;
+    }
+  }
 
-	/**
-	 * @param args
-	 * @throws IOException
-	 */
-	public static void main(String[] args) throws IOException, SyntaxError {
-		destination = HARDWARE.HOLTEK;
+  /**
+   * @param args
+   * @throws IOException
+   */
+  public static void main(String[] args) throws IOException, SyntaxError {
+    destination = HARDWARE.HOLTEK;
 
-		CommandlineProcessor.processCommandline(SPSAssembler.class, args);
+    CommandlineProcessor.processCommandline(SPSAssembler.class, args);
+    if ((source == null) || (!source.exists())) {
+      CommandlineProcessor.showHelp(
+          String.format("source file null or not found. %s", (source == null) ? "" : source.getAbsolutePath()));
+      System.exit(-1);
+    }
+    System.out.printf("source file: %s \r\n", source.getName());
+    if (destinationFile == null) {
+      String name = source.getName();
+      name = name.substring(0, source.getName().lastIndexOf("."));
+      String ext = ".hex";
+      if (outputFormat.equals(FORMAT.TPSTXT)) {
+        ext = ".txt";
+      }
+      destinationFile = new File(source.getParentFile(), name + ext);
+    }
+    System.out.printf("destination file: %s \r\n", destinationFile.getName());
+    System.out.println();
 
-		if (!source.exists()) {
-			throw new FileNotFoundException(String.format("source file not found. %s", source.getAbsolutePath()));
-		}
-		System.out.printf("source file: %s \r\n", source.getName());
-		if (destinationFile == null) {
-			String name = source.getName();
-			name = name.substring(0, source.getName().lastIndexOf("."));
-			String ext = ".hex";
-			if (outputFormat.equals(FORMAT.TPSTXT)) {
-				ext = ".txt";
-			}
-			destinationFile = new File(source.getParentFile(), name + ext);
-		}
-		System.out.printf("destination file: %s \r\n", destinationFile.getName());
-		System.out.println();
+    try {
+      List<String> sourceFile = Files.readAllLines(source.toPath(), Charset.forName("UTF-8"));
+      for (String line : sourceFile) {
+        srcLineNumber++;
+        parseLine(srcLineNumber, line);
+      }
 
-		try {
-			List<String> sourceFile = Files.readAllLines(source.toPath(), Charset.forName("UTF-8"));
-			for (String line : sourceFile) {
-				srcLineNumber++;
-				parseLine(srcLineNumber, line);
-			}
+    } catch (SyntaxError e) {
+      System.err.println(e.getMessage());
+      System.exit(-1);
+    }
+    // Checking destination
+    for (Iterator<Mnemonic> iterator = mnemonics.iterator(); iterator.hasNext();) {
+      Mnemonic mnemonic = iterator.next();
+      if (!mnemonic.allowedHardware().contains(destination)) {
+        throw new SyntaxError(mnemonic.getLineNumber(),
+            String.format("the mnemonic \"%s\" with the argument \"%s\" is not availble on the choosen hardware \"%s\"",
+                mnemonic.getName(), mnemonic.getArgument(), destination.name()));
+      }
+    }
 
-		} catch (SyntaxError e) {
-			System.err.println(e.getMessage());
-			System.exit(-1);
-		}
-		// Checking destination
-		for (Iterator<Mnemonic> iterator = mnemonics.iterator(); iterator.hasNext();) {
-			Mnemonic mnemonic = iterator.next();
-			if (!mnemonic.allowedHardware().contains(destination)) {
-				throw new SyntaxError(mnemonic.getLineNumber(),
-						String.format("the mnemonic \"%s\" with the argument \"%s\" is not availble on the choosen hardware \"%s\"", mnemonic.getName(),
-								mnemonic.getArgument(), destination.name()));
-			}
-		}
+    System.out.println("parsing line numbers");
+    int address = 0;
+    for (Iterator<Mnemonic> iterator = mnemonics.iterator(); iterator.hasNext();) {
+      Mnemonic mnemonic = iterator.next();
+      if (mnemonic instanceof JMP) {
+        if (mnemonic.isLabel()) {
+          processJMP(mnemonic);
+        }
+      }
+      if (mnemonic instanceof RJMP) {
+        if (mnemonic.isLabel()) {
+          processRJMP(address, mnemonic);
+        }
+      }
+      address++;
+    }
 
-		System.out.println("parsing line numbers");
-		int address = 0;
-		for (Iterator<Mnemonic> iterator = mnemonics.iterator(); iterator.hasNext();) {
-			Mnemonic mnemonic = iterator.next();
-			if (mnemonic instanceof JMP) {
-				if (mnemonic.isLabel()) {
-					processJMP(mnemonic);
-				}
-			}
-			if (mnemonic instanceof RJMP) {
-				if (mnemonic.isLabel()) {
-					processRJMP(address, mnemonic);
-				}
-			}
-			address++;
-		}
+    System.out.println("Mnemonics");
+    int pos = 0;
+    for (Iterator<Mnemonic> iterator = mnemonics.iterator(); iterator.hasNext();) {
+      Mnemonic mnemonic = iterator.next();
+      System.out.printf("0x%03x: %s\r\n", pos, mnemonic.toString());
+      pos++;
+    }
 
-		System.out.println("Mnemonics");
-		int pos = 0;
-		for (Iterator<Mnemonic> iterator = mnemonics.iterator(); iterator.hasNext();) {
-			Mnemonic mnemonic = iterator.next();
-			System.out.printf("0x%03x: %s\r\n", pos, mnemonic.toString());
-			pos++;
-		}
+    System.out.println();
+    System.out.println("labels");
+    for (Entry<String, Integer> entry : labels.entrySet()) {
+      System.out.printf("%s: 0x%03x\r\n", entry.getKey(), entry.getValue());
+    }
 
-		System.out.println();
-		System.out.println("labels");
-		for (Entry<String, Integer> entry : labels.entrySet()) {
-			System.out.printf("%s: 0x%03x\r\n", entry.getKey(), entry.getValue());
-		}
+    if (outputFormat.equals(FORMAT.HEX)) {
+      outputHEX();
+    }
+    if (outputFormat.equals(FORMAT.TPSTXT)) {
+      outputTPSTXT();
+    }
+  }
 
-		if (outputFormat.equals(FORMAT.HEX)) {
-			outputHEX();
-		}
-		if (outputFormat.equals(FORMAT.TPSTXT)) {
-			outputTPSTXT();
-		}
-	}
+  private static void outputTPSTXT() {
+    try (Writer writer = new BufferedWriter(new FileWriter(destinationFile))) {
+      writer.write("Addr   BD   Befehl   Daten     Kommentar\r\n");
+      int address = 0;
+      for (Mnemonic mnemonic : mnemonics) {
+        byte lowNibble = (byte) (mnemonic.getByte() & 0x0f);
+        byte highNibble = (byte) ((mnemonic.getByte() >> 4) & 0x0f);
+        writer.write(String.format("0x%03x  %02x   %4s     %4s      %s %s\r\n", address, mnemonic.getByte(),
+            nibbleToString(highNibble), nibbleToString(lowNibble), mnemonic.getName(),
+            StringUtils.isEmpty(mnemonic.getArgument()) ? "" : mnemonic.getArgument()));
+        mnemonic.getByte();
+        address++;
+      }
+    } catch (IOException e) {
+      e.printStackTrace();
+    } finally {
+    }
+  }
 
-	private static void outputTPSTXT() {
-		try (Writer writer = new BufferedWriter(new FileWriter(destinationFile))) {
-			writer.write("Addr   BD   Befehl   Daten     Kommentar\r\n");
-			int address = 0;
-			for (Mnemonic mnemonic : mnemonics) {
-				byte lowNibble = (byte) (mnemonic.getByte() & 0x0f);
-				byte highNibble = (byte) ((mnemonic.getByte() >> 4) & 0x0f);
-				writer.write(String.format("0x%03x  %02x   %4s     %4s      %s %s\r\n", address, mnemonic.getByte(), nibbleToString(highNibble),
-						nibbleToString(lowNibble), mnemonic.getName(), StringUtils.isEmpty(mnemonic.getArgument()) ? "" : mnemonic.getArgument()));
-				mnemonic.getByte();
-				address++;
-			}
-		} catch (IOException e) {
-			e.printStackTrace();
-		} finally {
-		}
-	}
+  private static String nibbleToString(byte lowNibble) {
+    StringBuilder b = new StringBuilder();
+    b.append((lowNibble & 0x08) > 0 ? "X" : "0");
+    b.append((lowNibble & 0x04) > 0 ? "X" : "0");
+    b.append((lowNibble & 0x02) > 0 ? "X" : "0");
+    b.append((lowNibble & 0x01) > 0 ? "X" : "0");
+    return b.toString();
+  }
 
-	private static String nibbleToString(byte lowNibble) {
-		StringBuilder b = new StringBuilder();
-		b.append((lowNibble & 0x08) > 0 ? "X" : "0");
-		b.append((lowNibble & 0x04) > 0 ? "X" : "0");
-		b.append((lowNibble & 0x02) > 0 ? "X" : "0");
-		b.append((lowNibble & 0x01) > 0 ? "X" : "0");
-		return b.toString();
-	}
+  private static void outputHEX() throws FileNotFoundException, IOException {
+    IntelHex intelHex = new IntelHex();
+    byte[] data = new byte[mnemonics.size()];
+    int i = 0;
+    for (Mnemonic mnemonic : mnemonics) {
+      data[i] = (byte) mnemonic.getByte();
+      i++;
+    }
+    FileOutputStream output = new FileOutputStream(destinationFile);
+    intelHex.writeHexStream(output, data);
+    output.close();
+  }
 
-	private static void outputHEX() throws FileNotFoundException, IOException {
-		IntelHex intelHex = new IntelHex();
-		byte[] data = new byte[mnemonics.size()];
-		int i = 0;
-		for (Mnemonic mnemonic : mnemonics) {
-			data[i] = (byte) mnemonic.getByte();
-			i++;
-		}
-		FileOutputStream output = new FileOutputStream(destinationFile);
-		intelHex.writeHexStream(output, data);
-		output.close();
-	}
+  private static void processJMP(Mnemonic mnemonic) throws SyntaxError {
+    String label = mnemonic.getArgument();
+    if (!labels.containsKey(label)) {
+      throw new SyntaxError(mnemonic.getLineNumber(),
+          String.format("used label %s on mnemonic \"%s\" is not defined.", label, mnemonic.getName()));
+    }
+    int lineNumber = (Integer) labels.get(label);
+    int page = lineNumber / 16;
+    lineNumber = lineNumber % 16;
+    mnemonic.setArgument(Integer.toString(lineNumber));
+    mnemonic.checkArgument();
+  }
 
-	private static void processJMP(Mnemonic mnemonic) throws SyntaxError {
-		String label = mnemonic.getArgument();
-		if (!labels.containsKey(label)) {
-			throw new SyntaxError(mnemonic.getLineNumber(), String.format("used label %s on mnemonic \"%s\" is not defined.", label, mnemonic.getName()));
-		}
-		int lineNumber = (Integer) labels.get(label);
-		int page = lineNumber / 16;
-		lineNumber = lineNumber % 16;
-		mnemonic.setArgument(Integer.toString(lineNumber));
-		mnemonic.checkArgument();
-	}
+  private static void processRJMP(int address, Mnemonic mnemonic) throws SyntaxError {
+    String label = mnemonic.getArgument();
+    if (!labels.containsKey(label)) {
+      throw new SyntaxError(mnemonic.getLineNumber(),
+          String.format("used label %s on mnemonic \"%s\" is not defined.", label, mnemonic.getName()));
+    }
+    int lineNumber = (Integer) labels.get(label);
+    lineNumber = address - lineNumber;
+    if (lineNumber < 0) {
+      throw new SyntaxError(mnemonic.getLineNumber(),
+          String.format("label %s defined after mnemonic \"%s\". JMP can only step back!", label, mnemonic.getName()));
+    }
+    mnemonic.setArgument(Integer.toString(lineNumber));
+    mnemonic.checkArgument();
+  }
 
-	private static void processRJMP(int address, Mnemonic mnemonic) throws SyntaxError {
-		String label = mnemonic.getArgument();
-		if (!labels.containsKey(label)) {
-			throw new SyntaxError(mnemonic.getLineNumber(), String.format("used label %s on mnemonic \"%s\" is not defined.", label, mnemonic.getName()));
-		}
-		int lineNumber = (Integer) labels.get(label);
-		lineNumber = address - lineNumber;
-		if (lineNumber < 0) {
-			throw new SyntaxError(mnemonic.getLineNumber(),
-					String.format("label %s defined after mnemonic \"%s\". JMP can only step back!", label, mnemonic.getName()));
-		}
-		mnemonic.setArgument(Integer.toString(lineNumber));
-		mnemonic.checkArgument();
-	}
+  private static void parseLine(int srcLineNumber, String line) throws SyntaxError {
+    if (line.startsWith(":")) {
+      String label = getLabel(line);
+      if (labels.containsKey(label)) {
+        throw new SyntaxError(srcLineNumber,
+            String.format("Label \"%s\" already definied in line %d.", label, labels.get(label)));
+      }
+      labels.put(label, lineNumber);
+    } else {
+      Mnemonic mnemonic = getMnemonic(line);
+      if (mnemonic != null) {
+        lineNumber++;
+        mnemonics.add(mnemonic);
+      }
+    }
+  }
 
-	private static void parseLine(int srcLineNumber, String line) throws SyntaxError {
-		if (line.startsWith(":")) {
-			String label = getLabel(line);
-			if (labels.containsKey(label)) {
-				throw new SyntaxError(srcLineNumber, String.format("Label \"%s\" already definied in line %d.", label, labels.get(label)));
-			}
-			labels.put(label, lineNumber);
-		} else {
-			Mnemonic mnemonic = getMnemonic(line);
-			if (mnemonic != null) {
-				lineNumber++;
-				mnemonics.add(mnemonic);
-			}
-		}
-	}
+  private static Mnemonic getMnemonic(String line) throws SyntaxError {
+    String newLine = stripComments(line);
+    if (StringUtils.isNotEmpty(newLine)) {
+      Mnemonic mnemonic = MnemonicFactory.getMnemonic(newLine, srcLineNumber);
+      return mnemonic;
+    }
+    return null;
+  }
 
-	private static Mnemonic getMnemonic(String line) throws SyntaxError {
-		String newLine = stripComments(line);
-		if (StringUtils.isNotEmpty(newLine)) {
-			Mnemonic mnemonic = MnemonicFactory.getMnemonic(newLine, srcLineNumber);
-			return mnemonic;
-		}
-		return null;
-	}
+  private static String stripComments(String line) {
+    if (line.indexOf("*/") >= 0) {
+      inBlockComment = false;
+      return null;
+    }
+    if (inBlockComment) {
+      return null;
+    }
+    if (line.indexOf(";") >= 0) {
+      line = line.substring(0, line.indexOf(";")).trim();
+      return line;
+    }
+    if (line.startsWith("/*")) {
+      inBlockComment = true;
+      return null;
+    }
+    return line.trim();
+  }
 
-	private static String stripComments(String line) {
-		if (line.indexOf("*/") >= 0) {
-			inBlockComment = false;
-			return null;
-		}
-		if (inBlockComment) {
-			return null;
-		}
-		if (line.indexOf(";") >= 0) {
-			line = line.substring(0, line.indexOf(";")).trim();
-			return line;
-		}
-		if (line.startsWith("/*")) {
-			inBlockComment = true;
-			return null;
-		}
-		return line.trim();
-	}
+  private static String getLabel(String line) {
+    line = stripComments(line);
+    return line;
+  }
 
-	private static String getLabel(String line) {
-		line = stripComments(line);
-		return line;
-	}
-
-	private static void showHelp() {
-		System.out.println("usage SPSAssembler <sorucefile> [<destination>]");
-		System.exit(0);
-	}
+  private static void showHelp() {
+    System.out.println("usage SPSAssembler <sorucefile> [<destination>]");
+    System.exit(0);
+  }
 
 }

+ 0 - 73
src/main/java/de/mcs/tools/sps/mnemonic/ADC.java

@@ -1,73 +0,0 @@
-/**
- * MCS Media Computer Software
- * Copyright 2018 by Wilfried Klaas
- * Project: SPSEmulator
- * File: Not.java
- * EMail: W.Klaas@gmx.de
- * Created: 25.11.2018 wklaa_000
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- */
-package de.mcs.tools.sps.mnemonic;
-
-import org.apache.commons.lang3.StringUtils;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-/**
- * ADC #x: analog input #x to register A. x should be 1 or 2
- * 
- * @author wklaa_000
- *
- */
-public class ADC extends AbstractMnemonic implements Mnemonic {
-
-  byte value;
-
-  public ADC(String line) throws SyntaxError {
-    super(line);
-    value = 0;
-  }
-
-  @Override
-  public void checkArgument() throws SyntaxError {
-    if (StringUtils.isEmpty(getArgument())) {
-      throw new SyntaxError(getLineNumber(),
-          String.format("missing argument for %s.", this.getClass().getSimpleName()));
-    }
-    int myValue = getArgumentAsNumber();
-    if ((myValue < 1) || (myValue > 2)) {
-      throw new IllegalArgument(getLineNumber(),
-          String.format("argument %s is not in range 1..2 for %s.", getArgument(), this.getClass().getSimpleName()));
-    }
-    value = (byte) ((myValue - 1) & 0xFF);
-  }
-
-  @Override
-  public int getByte() {
-    return 0x69 + value;
-  }
-
-  @Override
-  public boolean isUsingPage() {
-    return false;
-  }
-
-  @Override
-  public boolean hasArgument() {
-    return true;
-  }
-
-}

+ 0 - 81
src/main/java/de/mcs/tools/sps/mnemonic/ARC.java

@@ -1,81 +0,0 @@
-/**
- * MCS Media Computer Software
- * Copyright 2018 by Wilfried Klaas
- * Project: SPSEmulator
- * File: Not.java
- * EMail: W.Klaas@gmx.de
- * Created: 25.11.2018 wklaa_000
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- */
-package de.mcs.tools.sps.mnemonic;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-/**
- * ARC #x: rc input #x to register A. x should be 1 or 2
- * 
- * @author wklaa_000
- *
- */
-public class ARC extends AbstractMnemonic implements Mnemonic {
-
-  byte value;
-
-  public ARC(String line) throws SyntaxError {
-    super(line);
-    value = 0;
-  }
-
-  @Override
-  public void checkArgument() throws SyntaxError {
-    if (StringUtils.isEmpty(getArgument())) {
-      throw new SyntaxError(getLineNumber(),
-          String.format("missing argument for %s.", this.getClass().getSimpleName()));
-    }
-    int myValue = getArgumentAsNumber();
-    if ((myValue < 1) || (myValue > 2)) {
-      throw new IllegalArgument(getLineNumber(),
-          String.format("argument %s is not in range 1..2 for %s.", getArgument(), this.getClass().getSimpleName()));
-    }
-    value = (byte) ((myValue - 1) & 0xFF);
-  }
-
-  @Override
-  public int getByte() {
-    return 0x6B + value;
-  }
-
-  @Override
-  public boolean isUsingPage() {
-    return false;
-  }
-
-  @Override
-  public boolean hasArgument() {
-    return true;
-  }
-
-  @Override
-  public Set<HARDWARE> allowedHardware() {
-    return EnumSet.of(HARDWARE.ARDUINOSPS, HARDWARE.TINYSPS);
-  }
-
-}

+ 0 - 81
src/main/java/de/mcs/tools/sps/mnemonic/BADC.java

@@ -1,81 +0,0 @@
-/**
- * MCS Media Computer Software
- * Copyright 2018 by Wilfried Klaas
- * Project: SPSEmulator
- * File: Not.java
- * EMail: W.Klaas@gmx.de
- * Created: 25.11.2018 wklaa_000
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- */
-package de.mcs.tools.sps.mnemonic;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-/**
- * BADC #x: byte analog input #x to register A. x should be 1 or 2
- * 
- * @author wklaa_000
- *
- */
-public class BADC extends AbstractMnemonic implements Mnemonic {
-
-  byte value;
-
-  public BADC(String line) throws SyntaxError {
-    super(line);
-    value = 0;
-  }
-
-  @Override
-  public void checkArgument() throws SyntaxError {
-    if (StringUtils.isEmpty(getArgument())) {
-      throw new SyntaxError(getLineNumber(),
-          String.format("missing argument for %s.", this.getClass().getSimpleName()));
-    }
-    int myValue = getArgumentAsNumber();
-    if ((myValue < 1) || (myValue > 2)) {
-      throw new IllegalArgument(getLineNumber(),
-          String.format("argument %s is not in range 1..2 for %s.", getArgument(), this.getClass().getSimpleName()));
-    }
-    value = (byte) ((myValue - 1) & 0xFF);
-  }
-
-  @Override
-  public int getByte() {
-    return 0xF0 + value;
-  }
-
-  @Override
-  public boolean isUsingPage() {
-    return false;
-  }
-
-  @Override
-  public boolean hasArgument() {
-    return true;
-  }
-
-  @Override
-  public Set<HARDWARE> allowedHardware() {
-    return EnumSet.of(HARDWARE.ARDUINOSPS, HARDWARE.TINYSPS);
-  }
-
-}

+ 0 - 81
src/main/java/de/mcs/tools/sps/mnemonic/BARC.java

@@ -1,81 +0,0 @@
-/**
- * MCS Media Computer Software
- * Copyright 2018 by Wilfried Klaas
- * Project: SPSEmulator
- * File: Not.java
- * EMail: W.Klaas@gmx.de
- * Created: 25.11.2018 wklaa_000
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- */
-package de.mcs.tools.sps.mnemonic;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-/**
- * BARC #x: rc byte input #x to register A. x should be 1 or 2
- * 
- * @author wklaa_000
- *
- */
-public class BARC extends AbstractMnemonic implements Mnemonic {
-
-  byte value;
-
-  public BARC(String line) throws SyntaxError {
-    super(line);
-    value = 0;
-  }
-
-  @Override
-  public void checkArgument() throws SyntaxError {
-    if (StringUtils.isEmpty(getArgument())) {
-      throw new SyntaxError(getLineNumber(),
-          String.format("missing argument for %s.", this.getClass().getSimpleName()));
-    }
-    int myValue = getArgumentAsNumber();
-    if ((myValue < 1) || (myValue > 2)) {
-      throw new IllegalArgument(getLineNumber(),
-          String.format("argument %s is not in range 1..2 for %s.", getArgument(), this.getClass().getSimpleName()));
-    }
-    value = (byte) ((myValue - 1) & 0xFF);
-  }
-
-  @Override
-  public int getByte() {
-    return 0xF2 + value;
-  }
-
-  @Override
-  public boolean isUsingPage() {
-    return false;
-  }
-
-  @Override
-  public boolean hasArgument() {
-    return true;
-  }
-
-  @Override
-  public Set<HARDWARE> allowedHardware() {
-    return EnumSet.of(HARDWARE.ARDUINOSPS, HARDWARE.TINYSPS);
-  }
-
-}

+ 119 - 0
src/main/java/de/mcs/tools/sps/mnemonic/BLDA.java

@@ -0,0 +1,119 @@
+/**
+ * MCS Media Computer Software
+ * Copyright 2018 by Wilfried Klaas
+ * Project: SPSEmulator
+ * File: Not.java
+ * EMail: W.Klaas@gmx.de
+ * Created: 25.11.2018 wklaa_000
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ */
+package de.mcs.tools.sps.mnemonic;
+
+import java.util.EnumSet;
+import java.util.Set;
+
+import org.apache.commons.lang3.StringUtils;
+
+import de.mcs.tools.sps.exceptions.IllegalArgument;
+import de.mcs.tools.sps.exceptions.SyntaxError;
+
+//@formatter:off
+/**
+ * BLDA ADC#x: byte analog input #x to register A. x should be 1 or 2
+ * BLDA RC#x: byte rc receiver input #x to register A. x should be 1 or 2
+ * @author wklaa_000
+ *
+ */
+//@formatter:on
+public class BLDA extends AbstractMnemonic implements Mnemonic {
+
+  byte value;
+
+  enum INPUTSOURCE {
+    ANALOG, RC
+  };
+
+  INPUTSOURCE inputSource;
+
+  public BLDA(String line) throws SyntaxError {
+    super(line);
+    value = 0;
+  }
+
+  @Override
+  public void checkArgument() throws SyntaxError {
+    if (StringUtils.isEmpty(getArgument())) {
+      throw new SyntaxError(getLineNumber(),
+          String.format("missing argument for %s.", this.getClass().getSimpleName()));
+    }
+
+    String inputString = getArgument().toUpperCase();
+    if (inputString.startsWith("ADC")) {
+      inputSource = INPUTSOURCE.ANALOG;
+      int myValue = 0;
+      try {
+        myValue = Integer.parseInt(inputString.substring(3));
+      } catch (NumberFormatException e) {
+      }
+      if ((myValue < 1) || (myValue > 2)) {
+        throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range ADC1..2 for %s.",
+            getArgument(), this.getClass().getSimpleName()));
+      }
+      value = (byte) ((myValue - 1) & 0xFF);
+    } else if (inputString.startsWith("RC")) {
+      inputSource = INPUTSOURCE.RC;
+      int myValue = 0;
+      try {
+        myValue = Integer.parseInt(inputString.substring(2));
+      } catch (NumberFormatException e) {
+      }
+      if ((myValue < 1) || (myValue > 2)) {
+        throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range RC1..2 for %s.",
+            getArgument(), this.getClass().getSimpleName()));
+      }
+      value = (byte) ((myValue - 1) & 0xFF);
+    } else {
+      throw new SyntaxError(getLineNumber(),
+          String.format("unknown argument %s for %s.", this.getArgument(), this.getClass().getSimpleName()));
+    }
+  }
+
+  @Override
+  public int getByte() {
+    switch (inputSource) {
+    case ANALOG:
+      return 0xF0 + value;
+    case RC:
+      return 0xF2 + value;
+    }
+    return 0x00;
+  }
+
+  @Override
+  public boolean isUsingPage() {
+    return false;
+  }
+
+  @Override
+  public boolean hasArgument() {
+    return true;
+  }
+
+  @Override
+  public Set<HARDWARE> allowedHardware() {
+    return EnumSet.of(HARDWARE.ARDUINOSPS, HARDWARE.TINYSPS);
+  }
+
+}

+ 0 - 81
src/main/java/de/mcs/tools/sps/mnemonic/BPWM.java

@@ -1,81 +0,0 @@
-/**
- * MCS Media Computer Software
- * Copyright 2018 by Wilfried Klaas
- * Project: SPSEmulator
- * File: Not.java
- * EMail: W.Klaas@gmx.de
- * Created: 25.11.2018 wklaa_000
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- */
-package de.mcs.tools.sps.mnemonic;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-/**
- * BPWM #x: output byte register A to PWM #x. x should be 1 or 2
- * 
- * @author wklaa_000
- *
- */
-public class BPWM extends AbstractMnemonic implements Mnemonic {
-
-  byte value;
-
-  public BPWM(String line) throws SyntaxError {
-    super(line);
-    value = 0;
-  }
-
-  @Override
-  public void checkArgument() throws SyntaxError {
-    if (StringUtils.isEmpty(getArgument())) {
-      throw new SyntaxError(getLineNumber(),
-          String.format("missing argument for %s.", this.getClass().getSimpleName()));
-    }
-    int myValue = getArgumentAsNumber();
-    if ((myValue < 1) || (myValue > 2)) {
-      throw new IllegalArgument(getLineNumber(),
-          String.format("argument %s is not in range 1..2 for %s.", getArgument(), this.getClass().getSimpleName()));
-    }
-    value = (byte) ((myValue - 1) & 0xFF);
-  }
-
-  @Override
-  public int getByte() {
-    return 0xF4 + value;
-  }
-
-  @Override
-  public boolean isUsingPage() {
-    return false;
-  }
-
-  @Override
-  public boolean hasArgument() {
-    return true;
-  }
-
-  @Override
-  public Set<HARDWARE> allowedHardware() {
-    return EnumSet.of(HARDWARE.ARDUINOSPS, HARDWARE.TINYSPS);
-  }
-
-}

+ 0 - 80
src/main/java/de/mcs/tools/sps/mnemonic/BSRV.java

@@ -1,80 +0,0 @@
-/**
- * MCS Media Computer Software
- * Copyright 2018 by Wilfried Klaas
- * Project: SPSEmulator
- * File: Not.java
- * EMail: W.Klaas@gmx.de
- * Created: 25.11.2018 wklaa_000
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- */
-package de.mcs.tools.sps.mnemonic;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-/**
- * BSRV #x: output byte register A to servo #x. x should be 1 or 2
- * 
- * @author wklaa_000
- *
- */
-public class BSRV extends AbstractMnemonic implements Mnemonic {
-
-  byte value;
-
-  public BSRV(String line) throws SyntaxError {
-    super(line);
-    value = 0;
-  }
-
-  @Override
-  public void checkArgument() throws SyntaxError {
-    if (StringUtils.isEmpty(getArgument())) {
-      throw new SyntaxError(getLineNumber(),
-          String.format("missing argument for %s.", this.getClass().getSimpleName()));
-    }
-    int myValue = getArgumentAsNumber();
-    if ((myValue < 1) || (myValue > 2)) {
-      throw new IllegalArgument(getLineNumber(),
-          String.format("argument %s is not in range 1..2 for %s.", getArgument(), this.getClass().getSimpleName()));
-    }
-    value = (byte) ((myValue - 1) & 0xFF);
-  }
-
-  @Override
-  public int getByte() {
-    return 0xF6 + value;
-  }
-
-  @Override
-  public boolean isUsingPage() {
-    return false;
-  }
-
-  @Override
-  public boolean hasArgument() {
-    return true;
-  }
-
-  @Override
-  public Set<HARDWARE> allowedHardware() {
-    return EnumSet.of(HARDWARE.ARDUINOSPS, HARDWARE.TINYSPS);
-  }
-}

+ 120 - 0
src/main/java/de/mcs/tools/sps/mnemonic/BSTA.java

@@ -0,0 +1,120 @@
+/**
+ * MCS Media Computer Software
+ * Copyright 2018 by Wilfried Klaas
+ * Project: SPSEmulator
+ * File: Not.java
+ * EMail: W.Klaas@gmx.de
+ * Created: 25.11.2018 wklaa_000
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ */
+package de.mcs.tools.sps.mnemonic;
+
+import java.util.EnumSet;
+import java.util.Set;
+
+import org.apache.commons.lang3.StringUtils;
+
+import de.mcs.tools.sps.exceptions.IllegalArgument;
+import de.mcs.tools.sps.exceptions.SyntaxError;
+
+//@formatter:off
+/**
+ * BSTA SRVx: output byte register A to servo #x. x should be 1 or 2
+ * BSTA PWMx: output byte register A to PWM #x. x should be 1 or 2
+ * 
+ * @author wklaa_000
+ *
+ */
+//@formatter:on
+public class BSTA extends AbstractMnemonic implements Mnemonic {
+
+  private static final int PWM = 0xf4;
+  private static final int SRV = 0xf6;
+  byte value;
+
+  enum OUTPUTSOURCE {
+    PWM, SRV
+  };
+
+  OUTPUTSOURCE inputSource;
+
+  public BSTA(String line) throws SyntaxError {
+    super(line);
+    value = 0;
+  }
+
+  @Override
+  public void checkArgument() throws SyntaxError {
+    if (StringUtils.isEmpty(getArgument())) {
+      throw new SyntaxError(getLineNumber(),
+          String.format("missing argument for %s.", this.getClass().getSimpleName()));
+    }
+    String inputString = getArgument().toUpperCase();
+    if (inputString.startsWith("PWM")) {
+      inputSource = OUTPUTSOURCE.PWM;
+      int myValue = 0;
+      try {
+        myValue = Integer.parseInt(inputString.substring(3));
+      } catch (NumberFormatException e) {
+      }
+      if ((myValue < 1) || (myValue > 2)) {
+        throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range PWM1..2 for %s.",
+            getArgument(), this.getClass().getSimpleName()));
+      }
+      value = (byte) ((myValue - 1) & 0xFF);
+    } else if (inputString.startsWith("SRV")) {
+      inputSource = OUTPUTSOURCE.SRV;
+      int myValue = 0;
+      try {
+        myValue = Integer.parseInt(inputString.substring(3));
+      } catch (NumberFormatException e) {
+      }
+      if ((myValue < 1) || (myValue > 2)) {
+        throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range SRV1..2 for %s.",
+            getArgument(), this.getClass().getSimpleName()));
+      }
+      value = (byte) ((myValue - 1) & 0xFF);
+    } else {
+      throw new IllegalArgument(getLineNumber(),
+          String.format("illegal argument %s in %s", getArgument(), this.getClass().getSimpleName()));
+    }
+  }
+
+  @Override
+  public int getByte() {
+    switch (inputSource) {
+    case PWM:
+      return PWM + value;
+    case SRV:
+      return SRV + value;
+    }
+    return 0x00;
+  }
+
+  @Override
+  public boolean isUsingPage() {
+    return false;
+  }
+
+  @Override
+  public boolean hasArgument() {
+    return true;
+  }
+
+  @Override
+  public Set<HARDWARE> allowedHardware() {
+    return EnumSet.of(HARDWARE.ARDUINOSPS, HARDWARE.TINYSPS);
+  }
+}

+ 0 - 75
src/main/java/de/mcs/tools/sps/mnemonic/DIN.java

@@ -1,75 +0,0 @@
-/**
- * MCS Media Computer Software
- * Copyright 2018 by Wilfried Klaas
- * Project: SPSEmulator
- * File: Not.java
- * EMail: W.Klaas@gmx.de
- * Created: 25.11.2018 wklaa_000
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- */
-package de.mcs.tools.sps.mnemonic;
-
-import org.apache.commons.lang3.StringUtils;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-/**
- * DIN, DIN #x: Input from digital input to register A. If no #x given, all 4
- * inputs are shown in the register , otherwise the lowest bit of A will show
- * the input value #x. #x in range 1..4
- * 
- * @author wklaa_000
- *
- */
-public class DIN extends AbstractMnemonic implements Mnemonic {
-
-  byte value;
-
-  public DIN(String line) throws SyntaxError {
-    super(line);
-    value = 0;
-  }
-
-  @Override
-  public void checkArgument() throws SyntaxError {
-    if (StringUtils.isEmpty(getArgument())) {
-      value = 0;
-    } else {
-      int myValue = getArgumentAsNumber();
-      if ((myValue < 1) || (myValue > 4)) {
-        throw new IllegalArgument(getLineNumber(),
-            String.format("argument %s is not in range 1..4 for %s.", getArgument(), this.getClass().getSimpleName()));
-      }
-      value = (byte) (myValue & 0xFF);
-    }
-  }
-
-  @Override
-  public int getByte() {
-    return 0x64 + value;
-  }
-
-  @Override
-  public boolean isUsingPage() {
-    return false;
-  }
-
-  @Override
-  public boolean hasArgument() {
-    return true;
-  }
-
-}

+ 9 - 4
src/main/java/de/mcs/tools/sps/mnemonic/LDA.java

@@ -29,13 +29,18 @@ import org.apache.commons.lang3.StringUtils;
 import de.mcs.tools.sps.exceptions.IllegalArgument;
 import de.mcs.tools.sps.exceptions.SyntaxError;
 
+// @formatter:off
 /**
- * LDI #x: Load directly, setting register A to a static value. x in range
+ * LDA ##x: Load directly, setting register A to a static value. x in range
  * 0..15;
- * 
+ * LDA DIN: Load register A from Din
+ * LDA DINx: Load register A from Pin Din.X (x in range 1..4)
+ * LDA ADCx: Load register A from analog input X (x in range 1..2)
+ * LDA RCx: Load register A from rc input X (x in range 1..2)
  * @author wklaa_000
  *
  */
+// @formatter:on
 public class LDA extends AbstractMnemonic implements Mnemonic {
 
   byte value;
@@ -80,7 +85,7 @@ public class LDA extends AbstractMnemonic implements Mnemonic {
         } catch (NumberFormatException e) {
         }
         if ((myValue < 1) || (myValue > 2)) {
-          throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range ADC1..4 for %s.",
+          throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range ADC1..2 for %s.",
               getArgument(), this.getClass().getSimpleName()));
         }
         value = (byte) ((myValue - 1) & 0xFF);
@@ -92,7 +97,7 @@ public class LDA extends AbstractMnemonic implements Mnemonic {
         } catch (NumberFormatException e) {
         }
         if ((myValue < 1) || (myValue > 2)) {
-          throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range RC1..4 for %s.",
+          throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range RC1..2 for %s.",
               getArgument(), this.getClass().getSimpleName()));
         }
         value = (byte) ((myValue - 1) & 0xFF);

+ 13 - 19
src/main/java/de/mcs/tools/sps/mnemonic/DOUT.java → src/main/java/de/mcs/tools/sps/mnemonic/PORT.java

@@ -27,21 +27,20 @@ import de.mcs.tools.sps.exceptions.IllegalArgument;
 import de.mcs.tools.sps.exceptions.SyntaxError;
 
 /**
- * DOUT, DOUT #x: Output of register A. If no #x given, register a is output
- * fully, otherwise the lowest bit of A will be shon on output #x. #x in range
- * 1..4
+ * PORT, PORT #x: Output of register A. If no #x given, register a is output fully, otherwise the lowest bit of A will
+ * be shon on output #x. #x in range 1..4
  * 
  * @author wklaa_000
  *
  */
-public class DOUT extends AbstractMnemonic implements Mnemonic {
+public class PORT extends AbstractMnemonic implements Mnemonic {
 
   static int PORT = 0x10;
-  static int DOUT = 0x54;
+
   byte value;
   boolean isPort;
 
-  public DOUT(String line) throws SyntaxError {
+  public PORT(String line) throws SyntaxError {
     super(line);
     value = 0;
     isPort = false;
@@ -49,10 +48,12 @@ public class DOUT extends AbstractMnemonic implements Mnemonic {
 
   @Override
   public void checkArgument() throws SyntaxError {
+    if (StringUtils.isEmpty(getArgument())) {
+      throw new SyntaxError(getLineNumber(),
+          String.format("missing argument for %s.", this.getClass().getSimpleName()));
+    }
     String argument = getArgument();
-    if (StringUtils.isEmpty(argument)) {
-      value = 0;
-    } else if (argument.startsWith("#")) {
+    if (argument.startsWith("#")) {
       isPort = true;
       String myArgument = argument.substring(1);
       int myValue = getArgumentAsNumber(myArgument);
@@ -62,21 +63,14 @@ public class DOUT extends AbstractMnemonic implements Mnemonic {
       }
       value = (byte) (myValue & 0xFF);
     } else {
-      int myValue = getArgumentAsNumber();
-      if ((myValue < 1) || (myValue > 4)) {
-        throw new IllegalArgument(getLineNumber(),
-            String.format("argument %s is not in range 1..4 for %s.", argument, this.getClass().getSimpleName()));
-      }
-      value = (byte) (myValue & 0xFF);
+      throw new IllegalArgument(getLineNumber(),
+          String.format("wrong argument for %s. Should start with '#'", argument, this.getClass().getSimpleName()));
     }
   }
 
   @Override
   public int getByte() {
-    if (isPort) {
-      return PORT + value;
-    }
-    return DOUT + value;
+    return PORT + value;
   }
 
   @Override

+ 0 - 73
src/main/java/de/mcs/tools/sps/mnemonic/PWM.java

@@ -1,73 +0,0 @@
-/**
- * MCS Media Computer Software
- * Copyright 2018 by Wilfried Klaas
- * Project: SPSEmulator
- * File: Not.java
- * EMail: W.Klaas@gmx.de
- * Created: 25.11.2018 wklaa_000
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- */
-package de.mcs.tools.sps.mnemonic;
-
-import org.apache.commons.lang3.StringUtils;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-/**
- * PWM #x: output register A to PWM #x. x should be 1 or 2
- * 
- * @author wklaa_000
- *
- */
-public class PWM extends AbstractMnemonic implements Mnemonic {
-
-  byte value;
-
-  public PWM(String line) throws SyntaxError {
-    super(line);
-    value = 0;
-  }
-
-  @Override
-  public void checkArgument() throws SyntaxError {
-    if (StringUtils.isEmpty(getArgument())) {
-      throw new SyntaxError(getLineNumber(),
-          String.format("missing argument for %s.", this.getClass().getSimpleName()));
-    }
-    int myValue = getArgumentAsNumber();
-    if ((myValue < 1) || (myValue > 2)) {
-      throw new IllegalArgument(getLineNumber(),
-          String.format("argument %s is not in range 1..2 for %s.", getArgument(), this.getClass().getSimpleName()));
-    }
-    value = (byte) ((myValue - 1) & 0xFF);
-  }
-
-  @Override
-  public int getByte() {
-    return 0x59 + value;
-  }
-
-  @Override
-  public boolean isUsingPage() {
-    return false;
-  }
-
-  @Override
-  public boolean hasArgument() {
-    return true;
-  }
-
-}

+ 0 - 81
src/main/java/de/mcs/tools/sps/mnemonic/SRV.java

@@ -1,81 +0,0 @@
-/**
- * MCS Media Computer Software
- * Copyright 2018 by Wilfried Klaas
- * Project: SPSEmulator
- * File: Not.java
- * EMail: W.Klaas@gmx.de
- * Created: 25.11.2018 wklaa_000
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- */
-package de.mcs.tools.sps.mnemonic;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-/**
- * SRV #x: output register A to SRV #x. x should be 1 or 2
- * 
- * @author wklaa_000
- *
- */
-public class SRV extends AbstractMnemonic implements Mnemonic {
-
-  byte value;
-
-  public SRV(String line) throws SyntaxError {
-    super(line);
-    value = 0;
-  }
-
-  @Override
-  public void checkArgument() throws SyntaxError {
-    if (StringUtils.isEmpty(getArgument())) {
-      throw new SyntaxError(getLineNumber(),
-          String.format("missing argument for %s.", this.getClass().getSimpleName()));
-    }
-    int myValue = getArgumentAsNumber();
-    if ((myValue < 1) || (myValue > 2)) {
-      throw new IllegalArgument(getLineNumber(),
-          String.format("argument %s is not in range 1..2 for %s.", getArgument(), this.getClass().getSimpleName()));
-    }
-    value = (byte) ((myValue - 1) & 0xFF);
-  }
-
-  @Override
-  public int getByte() {
-    return 0x5B + value;
-  }
-
-  @Override
-  public boolean isUsingPage() {
-    return false;
-  }
-
-  @Override
-  public boolean hasArgument() {
-    return true;
-  }
-
-  @Override
-  public Set<HARDWARE> allowedHardware() {
-    return EnumSet.of(HARDWARE.ARDUINOSPS, HARDWARE.TINYSPS);
-  }
-
-}

+ 151 - 0
src/main/java/de/mcs/tools/sps/mnemonic/STA.java

@@ -0,0 +1,151 @@
+/**
+ * MCS Media Computer Software
+ * Copyright 2018 by Wilfried Klaas
+ * Project: SPSEmulator
+ * File: Not.java
+ * EMail: W.Klaas@gmx.de
+ * Created: 25.11.2018 wklaa_000
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ */
+package de.mcs.tools.sps.mnemonic;
+
+import java.util.EnumSet;
+import java.util.Set;
+
+import org.apache.commons.lang3.StringUtils;
+
+import de.mcs.tools.sps.exceptions.IllegalArgument;
+import de.mcs.tools.sps.exceptions.SyntaxError;
+
+//@formatter:off
+/**
+ * STA PORT: output register A to digital out, all bits
+ * STA DOUTx: output register A lowest bit to digital out x
+ * STA SRVx: output register A to SRV #x. x should be 1 or 2
+ * STA PWMx: output register A to PWM #x. x should be 1 or 2
+ * @author wklaa_000
+ *
+ */
+//@formatter:on
+public class STA extends AbstractMnemonic implements Mnemonic {
+
+  private static final int PWM = 0x59;
+  private static final int SRV = 0x5B;
+  byte value;
+  static int DOUT = 0x54;
+
+  enum OUTPUTSOURCE {
+    DIGITAL, PWM, SRV
+  };
+
+  OUTPUTSOURCE inputSource;
+
+  public STA(String line) throws SyntaxError {
+    super(line);
+    value = 0;
+  }
+
+  @Override
+  public void checkArgument() throws SyntaxError {
+    if (StringUtils.isEmpty(getArgument())) {
+      throw new SyntaxError(getLineNumber(),
+          String.format("missing argument for %s.", this.getClass().getSimpleName()));
+    }
+    // int myValue = getArgumentAsNumber();
+    // if ((myValue < 1) || (myValue > 2)) {
+    // throw new IllegalArgument(getLineNumber(),
+    // String.format("argument %s is not in range 1..2 for %s.", getArgument(), this.getClass().getSimpleName()));
+    // }
+    // value = (byte) ((myValue - 1) & 0xFF);
+    String inputString = getArgument().toUpperCase();
+    if (inputString.startsWith("DOUT")) {
+      inputSource = OUTPUTSOURCE.DIGITAL;
+      if ("DOUT".equalsIgnoreCase(inputString)) {
+        value = 0;
+      } else {
+        int myValue = Integer.parseInt(inputString.substring(4));
+        if ((myValue < 1) || (myValue > 4)) {
+          throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range DOUT1..4 for %s.",
+              getArgument(), this.getClass().getSimpleName()));
+        }
+        value = (byte) (myValue & 0xFF);
+      }
+    } else if (inputString.startsWith("PWM")) {
+      inputSource = OUTPUTSOURCE.PWM;
+      int myValue = 0;
+      try {
+        myValue = Integer.parseInt(inputString.substring(3));
+      } catch (NumberFormatException e) {
+      }
+      if ((myValue < 1) || (myValue > 2)) {
+        throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range PWM1..2 for %s.",
+            getArgument(), this.getClass().getSimpleName()));
+      }
+      value = (byte) ((myValue - 1) & 0xFF);
+    } else if (inputString.startsWith("SRV")) {
+      inputSource = OUTPUTSOURCE.SRV;
+      int myValue = 0;
+      try {
+        myValue = Integer.parseInt(inputString.substring(3));
+      } catch (NumberFormatException e) {
+      }
+      if ((myValue < 1) || (myValue > 2)) {
+        throw new IllegalArgument(getLineNumber(), String.format("argument %s is not in range SRV1..2 for %s.",
+            getArgument(), this.getClass().getSimpleName()));
+      }
+      value = (byte) ((myValue - 1) & 0xFF);
+    } else {
+      throw new IllegalArgument(getLineNumber(),
+          String.format("illegal argument %s in %s", getArgument(), this.getClass().getSimpleName()));
+    }
+  }
+
+  @Override
+  public int getByte() {
+    switch (inputSource) {
+    case DIGITAL:
+      return DOUT + value;
+    case PWM:
+      return PWM + value;
+    case SRV:
+      return SRV + value;
+    }
+    return 0x00;
+  }
+
+  @Override
+  public boolean isUsingPage() {
+    return false;
+  }
+
+  @Override
+  public boolean hasArgument() {
+    return true;
+  }
+
+  @Override
+  public Set<HARDWARE> allowedHardware() {
+    switch (inputSource) {
+    case DIGITAL:
+    case PWM:
+      return super.allowedHardware();
+    case SRV:
+      return EnumSet.of(HARDWARE.ARDUINOSPS, HARDWARE.TINYSPS);
+    default:
+      return super.allowedHardware();
+    }
+  }
+
+}

+ 2 - 4
src/test/java/de/mcs/tools/sps/emulator/emulator/holtek/TestHoltekEmulator.java

@@ -1,10 +1,10 @@
 package de.mcs.tools.sps.emulator.emulator.holtek;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -18,8 +18,6 @@ import de.mcs.tools.sps.emulator.SPSCommand;
 import de.mcs.tools.sps.emulator.SPSCommandData;
 import de.mcs.tools.sps.emulator.SPSEmulator;
 import de.mcs.tools.sps.emulator.TOutputCallback;
-import de.mcs.tools.sps.emulator.emulator.holtek.HoltekEmulator;
-import de.mcs.tools.sps.emulator.emulator.holtek.HoltekEmulatorOutput;
 import de.mcs.tools.sps.emulator.exceptions.WrongProgramSizeException;
 
 class TestHoltekEmulator implements TOutputCallback {

+ 0 - 68
src/test/java/de/mcs/tools/sps/mnemonic/TestADC.java

@@ -1,68 +0,0 @@
-package de.mcs.tools.sps.mnemonic;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-class TestADC {
-
-  private static final int BYTE_VALUE = 0x69;
-  private final String MNEMONIC = "ADC";
-
-  @Test
-  void testMnemonic() throws SyntaxError {
-    ADC mnemonic = new ADC(MNEMONIC + " 0x01");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-    assertTrue(mnemonic.hasArgument());
-    assertFalse(mnemonic.isUsingPage());
-
-    mnemonic = new ADC(MNEMONIC + " 0x02");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      ADC mno1 = new ADC(MNEMONIC + " 0x03");
-      mno1.checkArgument();
-    });
-
-    Assertions.assertThrows(IllegalArgument.class, () -> {
-      ADC mno1 = new ADC(MNEMONIC + " 0");
-      mno1.checkArgument();
-    });
-  }
-
-  @Test
-  void testMnemonicFactory() throws SyntaxError {
-    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(ADC.class, mnemonic.getClass());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC, 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
-    });
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
-    assertEquals(BYTE_VALUE + 0x01, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000010", 0);
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-  }
-}

+ 0 - 68
src/test/java/de/mcs/tools/sps/mnemonic/TestARC.java

@@ -1,68 +0,0 @@
-package de.mcs.tools.sps.mnemonic;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-class TestARC {
-
-  private static final int BYTE_VALUE = 0x6b;
-  private final String MNEMONIC = "ARC";
-
-  @Test
-  void testMnemonic() throws SyntaxError {
-    ARC mnemonic = new ARC(MNEMONIC + " 0x01");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-    assertTrue(mnemonic.hasArgument());
-    assertFalse(mnemonic.isUsingPage());
-
-    mnemonic = new ARC(MNEMONIC + " 0x02");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      ARC mno1 = new ARC(MNEMONIC + " 0x03");
-      mno1.checkArgument();
-    });
-
-    Assertions.assertThrows(IllegalArgument.class, () -> {
-      ARC mno1 = new ARC(MNEMONIC + " 0");
-      mno1.checkArgument();
-    });
-  }
-
-  @Test
-  void testMnemonicFactory() throws SyntaxError {
-    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(ARC.class, mnemonic.getClass());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC, 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
-    });
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
-    assertEquals(BYTE_VALUE + 0x01, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000010", 0);
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-  }
-}

+ 0 - 68
src/test/java/de/mcs/tools/sps/mnemonic/TestBADC.java

@@ -1,68 +0,0 @@
-package de.mcs.tools.sps.mnemonic;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-class TestBADC {
-
-  private static final int BYTE_VALUE = 0xf0;
-  private final String MNEMONIC = "BADC";
-
-  @Test
-  void testMnemonic() throws SyntaxError {
-    BADC mnemonic = new BADC(MNEMONIC + " 0x01");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-    assertTrue(mnemonic.hasArgument());
-    assertFalse(mnemonic.isUsingPage());
-
-    mnemonic = new BADC(MNEMONIC + " 0x02");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      BADC mno1 = new BADC(MNEMONIC + " 0x03");
-      mno1.checkArgument();
-    });
-
-    Assertions.assertThrows(IllegalArgument.class, () -> {
-      BADC mno1 = new BADC(MNEMONIC + " 0");
-      mno1.checkArgument();
-    });
-  }
-
-  @Test
-  void testMnemonicFactory() throws SyntaxError {
-    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BADC.class, mnemonic.getClass());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC, 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
-    });
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
-    assertEquals(BYTE_VALUE + 0x01, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000010", 0);
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-  }
-}

+ 0 - 68
src/test/java/de/mcs/tools/sps/mnemonic/TestBARC.java

@@ -1,68 +0,0 @@
-package de.mcs.tools.sps.mnemonic;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-class TestBARC {
-
-  private static final int BYTE_VALUE = 0xf2;
-  private final String MNEMONIC = "BARC";
-
-  @Test
-  void testMnemonic() throws SyntaxError {
-    BARC mnemonic = new BARC(MNEMONIC + " 0x01");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-    assertTrue(mnemonic.hasArgument());
-    assertFalse(mnemonic.isUsingPage());
-
-    mnemonic = new BARC(MNEMONIC + " 0x02");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      BARC mno1 = new BARC(MNEMONIC + " 0x03");
-      mno1.checkArgument();
-    });
-
-    Assertions.assertThrows(IllegalArgument.class, () -> {
-      BARC mno1 = new BARC(MNEMONIC + " 0");
-      mno1.checkArgument();
-    });
-  }
-
-  @Test
-  void testMnemonicFactory() throws SyntaxError {
-    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BARC.class, mnemonic.getClass());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC, 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
-    });
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
-    assertEquals(BYTE_VALUE + 0x01, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000010", 0);
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-  }
-}

+ 83 - 0
src/test/java/de/mcs/tools/sps/mnemonic/TestBLDA.java

@@ -0,0 +1,83 @@
+package de.mcs.tools.sps.mnemonic;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import de.mcs.tools.sps.exceptions.IllegalArgument;
+import de.mcs.tools.sps.exceptions.SyntaxError;
+
+class TestBLDA {
+
+  private static final int BYTE_VALUE_ADC = 0xf0;
+  private final String MNEMONIC = "BLDA";
+
+  private static final int BYTE_VALUE_RC = 0xf2;
+
+  @Test
+  void testMnemonicRC() throws SyntaxError {
+    BLDA mnemonic = new BLDA(MNEMONIC + " RC1");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_RC, mnemonic.getByte());
+    assertTrue(mnemonic.hasArgument());
+    assertFalse(mnemonic.isUsingPage());
+
+    mnemonic = new BLDA(MNEMONIC + " RC2");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_RC + 1, mnemonic.getByte());
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      BLDA mno1 = new BLDA(MNEMONIC + " RC3");
+      mno1.checkArgument();
+    });
+
+    Assertions.assertThrows(IllegalArgument.class, () -> {
+      BLDA mno1 = new BLDA(MNEMONIC + " RC0");
+      mno1.checkArgument();
+    });
+  }
+
+  @Test
+  void testMnemonicADC() throws SyntaxError {
+    BLDA mnemonic = new BLDA(MNEMONIC + " ADC1");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_ADC, mnemonic.getByte());
+    assertTrue(mnemonic.hasArgument());
+    assertFalse(mnemonic.isUsingPage());
+
+    mnemonic = new BLDA(MNEMONIC + " ADC2");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_ADC + 1, mnemonic.getByte());
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      BLDA mno1 = new BLDA(MNEMONIC + " ADC3");
+      mno1.checkArgument();
+    });
+
+    Assertions.assertThrows(IllegalArgument.class, () -> {
+      BLDA mno1 = new BLDA(MNEMONIC + " ADC0");
+      mno1.checkArgument();
+    });
+  }
+
+  @Test
+  void testMnemonicFactory() throws SyntaxError {
+    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " ADC1", 0);
+    assertEquals(BLDA.class, mnemonic.getClass());
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      MnemonicFactory.getMnemonic(MNEMONIC, 0);
+    });
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
+    });
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
+    });
+  }
+}

+ 0 - 68
src/test/java/de/mcs/tools/sps/mnemonic/TestBPWM.java

@@ -1,68 +0,0 @@
-package de.mcs.tools.sps.mnemonic;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-class TestBPWM {
-
-  private static final int BYTE_VALUE = 0xf4;
-  private final String MNEMONIC = "BPWM";
-
-  @Test
-  void testMnemonic() throws SyntaxError {
-    BPWM mnemonic = new BPWM(MNEMONIC + " 0x01");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-    assertTrue(mnemonic.hasArgument());
-    assertFalse(mnemonic.isUsingPage());
-
-    mnemonic = new BPWM(MNEMONIC + " 0x02");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      BPWM mno1 = new BPWM(MNEMONIC + " 0x03");
-      mno1.checkArgument();
-    });
-
-    Assertions.assertThrows(IllegalArgument.class, () -> {
-      BPWM mno1 = new BPWM(MNEMONIC + " 0");
-      mno1.checkArgument();
-    });
-  }
-
-  @Test
-  void testMnemonicFactory() throws SyntaxError {
-    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BPWM.class, mnemonic.getClass());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC, 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
-    });
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
-    assertEquals(BYTE_VALUE + 0x01, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000010", 0);
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-  }
-}

+ 38 - 21
src/test/java/de/mcs/tools/sps/mnemonic/TestBSRV.java

@@ -12,36 +12,63 @@ import de.mcs.tools.sps.exceptions.SyntaxError;
 
 class TestBSRV {
 
-  private static final int BYTE_VALUE = 0x5b;
-  private final String MNEMONIC = "SRV";
+  private static final int BYTE_VALUE_PWM = 0xf4;
+  private static final int BYTE_VALUE_SRV = 0xf6;
+  private final String MNEMONIC = "BSTA";
 
   @Test
-  void testMnemonic() throws SyntaxError {
-    SRV mnemonic = new SRV(MNEMONIC + " 0x01");
+  void testMnemonicPWM() throws SyntaxError {
+    BSTA mnemonic = new BSTA(MNEMONIC + " PWM1");
     mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
+    assertEquals(BYTE_VALUE_PWM, mnemonic.getByte());
     assertTrue(mnemonic.hasArgument());
     assertFalse(mnemonic.isUsingPage());
 
-    mnemonic = new SRV(MNEMONIC + " 0x02");
+    mnemonic = new BSTA(MNEMONIC + " PWM2");
     mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
+    assertEquals(BYTE_VALUE_PWM + 1, mnemonic.getByte());
 
     Assertions.assertThrows(SyntaxError.class, () -> {
-      SRV mno1 = new SRV(MNEMONIC + " 0x03");
+      BSTA mno1 = new BSTA(MNEMONIC + " PWM3");
       mno1.checkArgument();
     });
 
     Assertions.assertThrows(IllegalArgument.class, () -> {
-      SRV mno1 = new SRV(MNEMONIC + " 0");
+      BSTA mno1 = new BSTA(MNEMONIC + " PWM0");
+      mno1.checkArgument();
+    });
+  }
+
+  @Test
+  void testMnemonicSRV() throws SyntaxError {
+    BSTA mnemonic = new BSTA(MNEMONIC + " SRV1");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_SRV, mnemonic.getByte());
+    assertTrue(mnemonic.hasArgument());
+    assertFalse(mnemonic.isUsingPage());
+
+    mnemonic = new BSTA(MNEMONIC + " SRV2");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_SRV + 1, mnemonic.getByte());
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      BSTA mno1 = new BSTA(MNEMONIC + " SRV3");
+      mno1.checkArgument();
+    });
+
+    Assertions.assertThrows(IllegalArgument.class, () -> {
+      BSTA mno1 = new BSTA(MNEMONIC + " SRV0");
       mno1.checkArgument();
     });
   }
 
   @Test
   void testMnemonicFactory() throws SyntaxError {
-    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(SRV.class, mnemonic.getClass());
+    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " PWM1", 0);
+    assertEquals(BSTA.class, mnemonic.getClass());
+
+    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " SRV1", 0);
+    assertEquals(BSTA.class, mnemonic.getClass());
 
     Assertions.assertThrows(SyntaxError.class, () -> {
       MnemonicFactory.getMnemonic(MNEMONIC, 0);
@@ -54,15 +81,5 @@ class TestBSRV {
     Assertions.assertThrows(SyntaxError.class, () -> {
       MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
     });
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
-    assertEquals(BYTE_VALUE + 0x01, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000010", 0);
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
   }
 }

+ 0 - 68
src/test/java/de/mcs/tools/sps/mnemonic/TestDIN.java

@@ -1,68 +0,0 @@
-package de.mcs.tools.sps.mnemonic;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-class TestDIN {
-
-  private static final int BYTE_VALUE = 0x64;
-  private final String MNEMONIC = "DIN";
-
-  @Test
-  void testMnemonic() throws SyntaxError {
-    DIN mnemonic = new DIN(MNEMONIC);
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-    assertTrue(mnemonic.hasArgument());
-    assertFalse(mnemonic.isUsingPage());
-
-    mnemonic = new DIN(MNEMONIC + " 0x01");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-    mnemonic = new DIN(MNEMONIC + " 0x04");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 0x04, mnemonic.getByte());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      DIN mno1 = new DIN(MNEMONIC + " 0x05");
-      mno1.checkArgument();
-    });
-
-    Assertions.assertThrows(IllegalArgument.class, () -> {
-      DIN mno1 = new DIN(MNEMONIC + " 0x10");
-      mno1.checkArgument();
-    });
-  }
-
-  @Test
-  void testMnemonicFactory() throws SyntaxError {
-    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC, 0);
-    assertEquals(DIN.class, mnemonic.getClass());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
-    });
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
-    assertEquals(BYTE_VALUE + 0x02, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 3", 0);
-    assertEquals(BYTE_VALUE + 3, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000100", 0);
-    assertEquals(BYTE_VALUE + 4, mnemonic.getByte());
-
-  }
-}

+ 0 - 89
src/test/java/de/mcs/tools/sps/mnemonic/TestDOUT.java

@@ -1,89 +0,0 @@
-package de.mcs.tools.sps.mnemonic;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-class TestDOUT {
-
-  private static final int BYTE_VALUE = 0x54;
-  private static final int PORT_BYTE_VALUE = 0x10;
-  private final String MNEMONIC = "DOUT";
-
-  @Test
-  void testMnemonic() throws SyntaxError {
-    DOUT mnemonic = new DOUT(MNEMONIC);
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-    assertTrue(mnemonic.hasArgument());
-    assertFalse(mnemonic.isUsingPage());
-
-    mnemonic = new DOUT(MNEMONIC + " 0x01");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-    mnemonic = new DOUT(MNEMONIC + " 0x04");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 0x04, mnemonic.getByte());
-
-    mnemonic = new DOUT(MNEMONIC + " #0x04");
-    mnemonic.checkArgument();
-    assertEquals(PORT_BYTE_VALUE + 0x04, mnemonic.getByte());
-
-    mnemonic = new DOUT(MNEMONIC + " #0x00");
-    mnemonic.checkArgument();
-    assertEquals(PORT_BYTE_VALUE + 0x00, mnemonic.getByte());
-
-    mnemonic = new DOUT(MNEMONIC + " #0x0f");
-    mnemonic.checkArgument();
-    assertEquals(PORT_BYTE_VALUE + 0x0f, mnemonic.getByte());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      DOUT mno1 = new DOUT(MNEMONIC + " 0x05");
-      mno1.checkArgument();
-    });
-
-    Assertions.assertThrows(IllegalArgument.class, () -> {
-      DOUT mno1 = new DOUT(MNEMONIC + " 0x10");
-      mno1.checkArgument();
-    });
-
-    Assertions.assertThrows(IllegalArgument.class, () -> {
-      DOUT mno1 = new DOUT(MNEMONIC + " #0x10");
-      mno1.checkArgument();
-    });
-  }
-
-  @Test
-  void testMnemonicFactory() throws SyntaxError {
-    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC, 0);
-    assertEquals(DOUT.class, mnemonic.getClass());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " #0x04", 0);
-    assertEquals(DOUT.class, mnemonic.getClass());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
-    });
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
-    assertEquals(BYTE_VALUE + 0x02, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " #3", 0);
-    assertEquals(PORT_BYTE_VALUE + 3, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000100", 0);
-    assertEquals(BYTE_VALUE + 4, mnemonic.getByte());
-
-  }
-}

+ 1 - 1
src/test/java/de/mcs/tools/sps/mnemonic/TestLDA.java

@@ -67,7 +67,7 @@ class TestLDA {
     assertEquals(BYTE_VALUE_DIN + 0x04, mnemonic.getByte());
 
     Assertions.assertThrows(SyntaxError.class, () -> {
-      LDA mnemonic1 = new LDA(MNEMONIC + " DOUT");
+      LDA mnemonic1 = new LDA(MNEMONIC + " PORT");
       mnemonic1.checkArgument();
     });
 

+ 4 - 4
src/test/java/de/mcs/tools/sps/mnemonic/TestMOV.java

@@ -70,17 +70,17 @@ class TestMOV {
     assertEquals(FA, mnemonic.getByte());
 
     Assertions.assertThrows(SyntaxError.class, () -> {
-      DIN mno1 = new DIN(MNEMONIC + " 0x05");
+      MOV mno1 = new MOV(MNEMONIC + " 0x05");
       mno1.checkArgument();
     });
 
-    Assertions.assertThrows(IllegalArgument.class, () -> {
-      DIN mno1 = new DIN(MNEMONIC + " 0x10");
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      MOV mno1 = new MOV(MNEMONIC + " 0x10");
       mno1.checkArgument();
     });
 
     Assertions.assertThrows(IllegalArgument.class, () -> {
-      DIN mno1 = new DIN(MNEMONIC + " A, G");
+      MOV mno1 = new MOV(MNEMONIC + " A, G");
       mno1.checkArgument();
     });
   }

+ 23 - 24
src/test/java/de/mcs/tools/sps/mnemonic/TestPWM.java → src/test/java/de/mcs/tools/sps/mnemonic/TestPORT.java

@@ -1,8 +1,6 @@
 package de.mcs.tools.sps.mnemonic;
 
-import static org.junit.Assert.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
@@ -10,43 +8,50 @@ import org.junit.jupiter.api.Test;
 import de.mcs.tools.sps.exceptions.IllegalArgument;
 import de.mcs.tools.sps.exceptions.SyntaxError;
 
-class TestPWM {
+class TestPORT {
 
-  private static final int BYTE_VALUE = 0x59;
-  private final String MNEMONIC = "PWM";
+  private static final int PORT_BYTE_VALUE = 0x10;
+  private final String MNEMONIC = "PORT";
 
   @Test
   void testMnemonic() throws SyntaxError {
-    PWM mnemonic = new PWM(MNEMONIC + " 0x01");
+    PORT mnemonic = new PORT(MNEMONIC + " #0x04");
     mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-    assertTrue(mnemonic.hasArgument());
-    assertFalse(mnemonic.isUsingPage());
+    assertEquals(PORT_BYTE_VALUE + 0x04, mnemonic.getByte());
 
-    mnemonic = new PWM(MNEMONIC + " 0x02");
+    mnemonic = new PORT(MNEMONIC + " #0x00");
     mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
+    assertEquals(PORT_BYTE_VALUE + 0x00, mnemonic.getByte());
+
+    mnemonic = new PORT(MNEMONIC + " #0x0f");
+    mnemonic.checkArgument();
+    assertEquals(PORT_BYTE_VALUE + 0x0f, mnemonic.getByte());
 
     Assertions.assertThrows(SyntaxError.class, () -> {
-      PWM mno1 = new PWM(MNEMONIC + " 0x03");
+      PORT mno1 = new PORT(MNEMONIC + " 0x05");
+      mno1.checkArgument();
+    });
+
+    Assertions.assertThrows(IllegalArgument.class, () -> {
+      PORT mno1 = new PORT(MNEMONIC + " 0x10");
       mno1.checkArgument();
     });
 
     Assertions.assertThrows(IllegalArgument.class, () -> {
-      PWM mno1 = new PWM(MNEMONIC + " 0");
+      PORT mno1 = new PORT(MNEMONIC + " #0x10");
       mno1.checkArgument();
     });
   }
 
   @Test
   void testMnemonicFactory() throws SyntaxError {
-    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(PWM.class, mnemonic.getClass());
-
     Assertions.assertThrows(SyntaxError.class, () -> {
       MnemonicFactory.getMnemonic(MNEMONIC, 0);
     });
 
+    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " #0x04", 0);
+    assertEquals(PORT.class, mnemonic.getClass());
+
     Assertions.assertThrows(SyntaxError.class, () -> {
       MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
     });
@@ -55,14 +60,8 @@ class TestPWM {
       MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
     });
 
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
-    assertEquals(BYTE_VALUE + 0x01, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000010", 0);
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
+    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " #3", 0);
+    assertEquals(PORT_BYTE_VALUE + 3, mnemonic.getByte());
 
   }
 }

+ 0 - 68
src/test/java/de/mcs/tools/sps/mnemonic/TestSRV.java

@@ -1,68 +0,0 @@
-package de.mcs.tools.sps.mnemonic;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.exceptions.IllegalArgument;
-import de.mcs.tools.sps.exceptions.SyntaxError;
-
-class TestSRV {
-
-  private static final int BYTE_VALUE = 0x5b;
-  private final String MNEMONIC = "SRV";
-
-  @Test
-  void testMnemonic() throws SyntaxError {
-    SRV mnemonic = new SRV(MNEMONIC + " 0x01");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-    assertTrue(mnemonic.hasArgument());
-    assertFalse(mnemonic.isUsingPage());
-
-    mnemonic = new SRV(MNEMONIC + " 0x02");
-    mnemonic.checkArgument();
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      SRV mno1 = new SRV(MNEMONIC + " 0x03");
-      mno1.checkArgument();
-    });
-
-    Assertions.assertThrows(IllegalArgument.class, () -> {
-      SRV mno1 = new SRV(MNEMONIC + " 0");
-      mno1.checkArgument();
-    });
-  }
-
-  @Test
-  void testMnemonicFactory() throws SyntaxError {
-    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(SRV.class, mnemonic.getClass());
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC, 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
-    });
-
-    Assertions.assertThrows(SyntaxError.class, () -> {
-      MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
-    });
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
-    assertEquals(BYTE_VALUE + 0x01, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 1", 0);
-    assertEquals(BYTE_VALUE, mnemonic.getByte());
-
-    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000010", 0);
-    assertEquals(BYTE_VALUE + 1, mnemonic.getByte());
-
-  }
-}

+ 108 - 0
src/test/java/de/mcs/tools/sps/mnemonic/TestSTA.java

@@ -0,0 +1,108 @@
+package de.mcs.tools.sps.mnemonic;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import de.mcs.tools.sps.exceptions.IllegalArgument;
+import de.mcs.tools.sps.exceptions.SyntaxError;
+
+class TestSTA {
+
+  private static final int BYTE_VALUE_DOUT = 0x54;
+  private static final int BYTE_VALUE_PWM = 0x59;
+  private static final int BYTE_VALUE_SRV = 0x5b;
+  private final String MNEMONIC = "STA";
+
+  @Test
+  void testMnemonicDOUT() throws SyntaxError {
+    STA mnemonic = new STA(MNEMONIC + " DOUT");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_DOUT, mnemonic.getByte());
+    assertTrue(mnemonic.hasArgument());
+    assertFalse(mnemonic.isUsingPage());
+
+    mnemonic = new STA(MNEMONIC + " DOUT1");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_DOUT + 1, mnemonic.getByte());
+
+    mnemonic = new STA(MNEMONIC + " DOUT4");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_DOUT + 0x04, mnemonic.getByte());
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      STA mno1 = new STA(MNEMONIC + " DOUT5");
+      mno1.checkArgument();
+    });
+  }
+
+  @Test
+  void testMnemonicSRV() throws SyntaxError {
+    STA mnemonic = new STA(MNEMONIC + " SRV1");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_SRV, mnemonic.getByte());
+    assertTrue(mnemonic.hasArgument());
+    assertFalse(mnemonic.isUsingPage());
+
+    mnemonic = new STA(MNEMONIC + " SRV2");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_SRV + 1, mnemonic.getByte());
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      STA mno1 = new STA(MNEMONIC + " SRV3");
+      mno1.checkArgument();
+    });
+
+    Assertions.assertThrows(IllegalArgument.class, () -> {
+      STA mno1 = new STA(MNEMONIC + " SRV0");
+      mno1.checkArgument();
+    });
+  }
+
+  @Test
+  void testMnemonicPWM() throws SyntaxError {
+    STA mnemonic = new STA(MNEMONIC + " PWM1");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_PWM, mnemonic.getByte());
+    assertTrue(mnemonic.hasArgument());
+    assertFalse(mnemonic.isUsingPage());
+
+    mnemonic = new STA(MNEMONIC + " PWM2");
+    mnemonic.checkArgument();
+    assertEquals(BYTE_VALUE_PWM + 1, mnemonic.getByte());
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      STA mno1 = new STA(MNEMONIC + " PWM3");
+      mno1.checkArgument();
+    });
+
+    Assertions.assertThrows(IllegalArgument.class, () -> {
+      STA mno1 = new STA(MNEMONIC + " PWM0");
+      mno1.checkArgument();
+    });
+  }
+
+  @Test
+  void testMnemonicFactory() throws SyntaxError {
+    Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " SRV1", 0);
+    assertEquals(STA.class, mnemonic.getClass());
+
+    mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " DOUT", 0);
+    assertEquals(STA.class, mnemonic.getClass());
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      MnemonicFactory.getMnemonic(MNEMONIC, 0);
+    });
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
+    });
+
+    Assertions.assertThrows(SyntaxError.class, () -> {
+      MnemonicFactory.getMnemonic(MNEMONIC + " 5", 0);
+    });
+  }
+}