Преглед на файлове

FEATURE: add health check skeleton to service
FEATURE: test compile function with jersey 2 client.
BUG: eliminating unnecessary classes

Willie преди 6 години
родител
ревизия
0406c586a8

+ 1 - 2
.classpath

@@ -24,9 +24,8 @@
 			<attribute name="maven.pomderived" value="true"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10">
+	<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>

+ 19 - 0
pom.xml

@@ -28,6 +28,7 @@
     <timestamp>${maven.build.timestamp}</timestamp>
     <maven.build.timestamp.format>dd.mm.yyyy HH:mm</maven.build.timestamp.format>
     <jackson.version>2.9.6</jackson.version>
+    <jersey.client.version>2.28</jersey.client.version>
   </properties>
   <build>
     <plugins>
@@ -204,5 +205,23 @@
       <artifactId>guava</artifactId>
       <version>27.0.1-jre</version>
     </dependency>
+    <dependency>
+      <groupId>org.glassfish.jersey.core</groupId>
+      <artifactId>jersey-client</artifactId>
+      <version>${jersey.client.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.glassfish.jersey.media</groupId>
+      <artifactId>jersey-media-json-jackson</artifactId>
+      <version>${jersey.client.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.glassfish.jersey.inject</groupId>
+      <artifactId>jersey-hk2</artifactId>
+      <version>${jersey.client.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 </project>

+ 12 - 0
src/main/java/de/mcs/tools/sps/emulator/BaseHealthCheck.java

@@ -0,0 +1,12 @@
+package de.mcs.tools.sps.emulator;
+
+import com.codahale.metrics.health.HealthCheck;
+
+public class BaseHealthCheck extends HealthCheck {
+
+  @Override
+  protected Result check() throws Exception {
+    return Result.healthy();
+  }
+
+}

+ 1 - 0
src/main/java/de/mcs/tools/sps/emulator/WebEmulatorApplication.java

@@ -39,6 +39,7 @@ public class WebEmulatorApplication extends Application<WebEmulatorConfiguration
   public void run(WebEmulatorConfiguration configuration, Environment environment) throws Exception {
     final EmulatorResource resource = new EmulatorResource();
     environment.jersey().register(resource);
+    environment.healthChecks().register("BaseHealthCheck", new BaseHealthCheck());
   }
 
 }

+ 3 - 3
src/main/java/de/mcs/tools/sps/emulator/model/ProgramModel.java

@@ -26,9 +26,9 @@ public class ProgramModel {
   @Override
   public String toString() {
     StringBuilder b = new StringBuilder();
-    b.append(String.format("%s:[Hardware: %s, Hash: %s, modified: %s, actualLine: %d, Source: \"%s\", bin: %s ]",
-        this.getClass().getSimpleName(), hardware.name(), hash, modified, actualLine, (source != null) ? source[0] : "",
-        (bin != null)));
+    b.append(String.format("%s:[Hardware: %s, Hash: %s, modified: %s, actualLine: %d, Source: \"%s\", bin: 0x%x ]",
+        this.getClass().getSimpleName(), hardware.name(), hash, modified, actualLine,
+        (source != null) ? source[0] + ((source.length > 1) ? "..." : "") : "", (bin != null) ? bin.length : 0));
     return b.toString();
   }
 

+ 124 - 0
src/test/java/de/mcs/tools/sps/emulator/TestRESTEndpoints.java

@@ -0,0 +1,124 @@
+/**
+ * MCS Media Computer Software
+ * Copyright 2019 by Wilfried Klaas
+ * Project: SPSEmulator
+ * File: TestRESTEndpoints.java
+ * EMail: W.Klaas@gmx.de
+ * Created: 03.02.2019 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.emulator;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.List;
+import java.util.Set;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import de.mcs.tools.sps.emulator.model.CommandModel.COMMAND;
+import de.mcs.tools.sps.emulator.model.WebSessionModel;
+
+/**
+ * @author wklaa_000
+ *
+ */
+class TestRESTEndpoints {
+
+  private static Invocation.Builder invocationBuilder;
+
+  @BeforeAll
+  public static void init() throws KeyManagementException, NoSuchAlgorithmException {
+    TrustManager[] noopTrustManager = new TrustManager[] { new X509TrustManager() {
+
+      @Override
+      public X509Certificate[] getAcceptedIssuers() {
+        return null;
+      }
+
+      @Override
+      public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+      }
+
+      @Override
+      public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+      }
+    } };
+
+    javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
+
+      public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
+        return true;
+      }
+    });
+
+    SSLContext sc = SSLContext.getInstance("ssl");
+    sc.init(null, noopTrustManager, null);
+
+    Client client = ClientBuilder.newBuilder().sslContext(sc).build();
+    WebTarget webTarget = client.target("https://127.0.0.1:8443/emulator");
+    invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
+  }
+
+  /**
+   * @throws java.lang.Exception
+   */
+  @BeforeEach
+  void setUp() throws Exception {
+  }
+
+  @Test
+  void test() throws IOException {
+    WebSessionModel webSessionModel = invocationBuilder.get(WebSessionModel.class);
+    assertNotNull(webSessionModel);
+    System.out.println(webSessionModel.toString());
+
+    try (InputStream inputStream = ClassLoader.getSystemResourceAsStream("test.tps")) {
+      List<String> readLines = IOUtils.readLines(inputStream, "UTF-8");
+      assertNotNull(readLines);
+      webSessionModel.getProgram().setSource(readLines.toArray(new String[0]));
+    }
+
+    Set<COMMAND> availableCommands = webSessionModel.getCommand().getAvailableCommands();
+    assertNotNull(availableCommands);
+    assertTrue(availableCommands.contains(COMMAND.COMPILE));
+    webSessionModel.getCommand().setActualCommand(COMMAND.COMPILE);
+    webSessionModel = invocationBuilder.post(Entity.entity(webSessionModel, MediaType.APPLICATION_JSON),
+        WebSessionModel.class);
+    assertNotNull(webSessionModel);
+    assertTrue(webSessionModel.getProgram().getBin().length > 10);
+    System.out.println(webSessionModel.toString());
+  }
+
+}

+ 0 - 548
src/test/java/de/mcs/tools/sps/emulator/emulator/holtek/TestHoltekCommands.java

@@ -1,548 +0,0 @@
-/**
- * 
- */
-package de.mcs.tools.sps.emulator.emulator.holtek;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.emulator.EmulatorInput;
-import de.mcs.tools.sps.emulator.EmulatorInternals;
-import de.mcs.tools.sps.emulator.EmulatorOutput;
-import de.mcs.tools.sps.emulator.SPSCommandData;
-import de.mcs.tools.sps.emulator.SPSEmulator;
-import de.mcs.tools.sps.emulator.emulator.holtek.HoltekEmulator;
-import de.mcs.tools.sps.emulator.emulator.holtek.HoltekEmulatorInput;
-import de.mcs.tools.sps.emulator.emulator.holtek.HoltekEmulatorInternals;
-import de.mcs.tools.sps.emulator.emulator.holtek.HoltekEmulatorOutput;
-
-/**
- * @author w.klaas
- *
- */
-public class TestHoltekCommands {
-
-  private static SPSEmulator holtekEmulator;
-  private static EmulatorInput input;
-  private static EmulatorOutput output;
-  private static EmulatorInternals internals;
-
-  @BeforeAll
-  static void setUp() throws Exception {
-    holtekEmulator = new HoltekEmulator();
-    input = new HoltekEmulatorInput();
-    output = new HoltekEmulatorOutput();
-    internals = new HoltekEmulatorInternals();
-  }
-
-  SPSCommandData getCommandData(byte command) {
-    return holtekEmulator.getCommandData(command);
-  }
-
-  @Test
-  public void test0x70Empty() {
-    SPSCommandData data = getCommandData((byte) 0x70);
-    assertNull(data);
-  }
-
-  // A = A + 1
-  @Test
-  public void testIncA() {
-    SPSCommandData data = getCommandData((byte) 0x71);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister("A", (byte) 0x03);
-    data.doWork(input, internals, output);
-    assertEquals(0x04, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x0F);
-    data.doWork(input, internals, output);
-    assertEquals(0x00, internals.getRegister("A"));
-  }
-
-  // A = A - 1
-  @Test
-  public void testDecA() {
-    SPSCommandData data = getCommandData((byte) 0x72);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister("A", (byte) 0x03);
-    data.doWork(input, internals, output);
-    assertEquals(0x02, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x00);
-    data.doWork(input, internals, output);
-    assertEquals(0x0F, internals.getRegister("A"));
-  }
-
-  // A = A + B
-  @Test
-  public void testADDB() {
-    SPSCommandData data = getCommandData((byte) 0x73);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister("A", (byte) 0x03);
-    internals.setRegister("B", (byte) 0x04);
-    data.doWork(input, internals, output);
-    assertEquals(0x07, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x07);
-    internals.setRegister("B", (byte) 0x07);
-    data.doWork(input, internals, output);
-    assertEquals(0x0e, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x08);
-    internals.setRegister("B", (byte) 0x08);
-    data.doWork(input, internals, output);
-    assertEquals(0x00, internals.getRegister("A"));
-  }
-
-  // A = A - B
-  @Test
-  public void testSUBB() {
-    SPSCommandData data = getCommandData((byte) 0x74);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister("A", (byte) 0x04);
-    internals.setRegister("B", (byte) 0x03);
-    data.doWork(input, internals, output);
-    assertEquals(0x01, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x07);
-    internals.setRegister("B", (byte) 0x07);
-    data.doWork(input, internals, output);
-    assertEquals(0x00, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x06);
-    internals.setRegister("B", (byte) 0x08);
-    data.doWork(input, internals, output);
-    assertEquals(0x0E, internals.getRegister("A"));
-  }
-
-  // A = A * B
-  @Test
-  public void testMULB() {
-    SPSCommandData data = getCommandData((byte) 0x75);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister("A", (byte) 0x02);
-    internals.setRegister("B", (byte) 0x02);
-    data.doWork(input, internals, output);
-    assertEquals(0x04, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x03);
-    internals.setRegister("B", (byte) 0x03);
-    data.doWork(input, internals, output);
-    assertEquals(0x09, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x06);
-    internals.setRegister("B", (byte) 0x08);
-    data.doWork(input, internals, output);
-    assertEquals(0x00, internals.getRegister("A"));
-  }
-
-  // A = A / B
-  @Test
-  public void testDIVB() {
-    SPSCommandData data = getCommandData((byte) 0x76);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister("A", (byte) 0x02);
-    internals.setRegister("B", (byte) 0x02);
-    data.doWork(input, internals, output);
-    assertEquals(0x01, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x06);
-    internals.setRegister("B", (byte) 0x03);
-    data.doWork(input, internals, output);
-    assertEquals(0x02, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x06);
-    internals.setRegister("B", (byte) 0x04);
-    data.doWork(input, internals, output);
-    assertEquals(0x01, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x06);
-    internals.setRegister("B", (byte) 0x07);
-    data.doWork(input, internals, output);
-    assertEquals(0x00, internals.getRegister("A"));
-  }
-
-  // A = A AND B
-  @Test
-  public void testANDB() {
-    SPSCommandData data = getCommandData((byte) 0x77);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister("A", (byte) 0x02);
-    internals.setRegister("B", (byte) 0x02);
-    data.doWork(input, internals, output);
-    assertEquals(0x02, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x06);
-    internals.setRegister("B", (byte) 0x03);
-    data.doWork(input, internals, output);
-    assertEquals(0x02, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x0F);
-    internals.setRegister("B", (byte) 0x00);
-    data.doWork(input, internals, output);
-    assertEquals(0x00, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x0F);
-    internals.setRegister("B", (byte) 0x0F);
-    data.doWork(input, internals, output);
-    assertEquals(0x0F, internals.getRegister("A"));
-  }
-
-  // A = A OR B
-  @Test
-  public void testORB() {
-    SPSCommandData data = getCommandData((byte) 0x78);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister("A", (byte) 0x02);
-    internals.setRegister("B", (byte) 0x02);
-    data.doWork(input, internals, output);
-    assertEquals(0x02, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x06);
-    internals.setRegister("B", (byte) 0x03);
-    data.doWork(input, internals, output);
-    assertEquals(0x07, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x0F);
-    internals.setRegister("B", (byte) 0x00);
-    data.doWork(input, internals, output);
-    assertEquals(0x0F, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x0F);
-    internals.setRegister("B", (byte) 0x0F);
-    data.doWork(input, internals, output);
-    assertEquals(0x0F, internals.getRegister("A"));
-  }
-
-  // A = A XOR B
-  @Test
-  public void testXORB() {
-    SPSCommandData data = getCommandData((byte) 0x79);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister("A", (byte) 0x02);
-    internals.setRegister("B", (byte) 0x02);
-    data.doWork(input, internals, output);
-    assertEquals(0x00, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x06);
-    internals.setRegister("B", (byte) 0x03);
-    data.doWork(input, internals, output);
-    assertEquals(0x05, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x0F);
-    internals.setRegister("B", (byte) 0x00);
-    data.doWork(input, internals, output);
-    assertEquals(0x0F, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x0F);
-    internals.setRegister("B", (byte) 0x0F);
-    data.doWork(input, internals, output);
-    assertEquals(0x00, internals.getRegister("A"));
-  }
-
-  // A = NOT A
-  @Test
-  public void testNOTA() {
-    SPSCommandData data = getCommandData((byte) 0x7A);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister("A", (byte) 0x02);
-    data.doWork(input, internals, output);
-    assertEquals(0x0D, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x06);
-    data.doWork(input, internals, output);
-    assertEquals(0x09, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x0F);
-    data.doWork(input, internals, output);
-    assertEquals(0x00, internals.getRegister("A"));
-
-    internals.setRegister("A", (byte) 0x00);
-    data.doWork(input, internals, output);
-    assertEquals(0x0F, internals.getRegister("A"));
-  }
-
-  // PAGE = #
-  @Test
-  public void testPage() {
-    for (int i = 0; i < 16; i++) {
-      SPSCommandData data = getCommandData((byte) (0x80 + i));
-      if (i < 0x08) {
-        assertNotNull(data);
-        internals.reset();
-        data.doWork(input, internals, output);
-        assertEquals(i, internals.getRegister(HoltekEmulatorInternals.REGISTER_PAGE));
-      } else {
-        assertNull(data);
-      }
-    }
-  }
-
-  // JUMP #
-  @Test
-  public void testJump() {
-    for (int page = 0; page < 16; page++) {
-      SPSCommandData data = getCommandData((byte) (0x80 + page));
-      if (page < 0x08) {
-        assertNotNull(data);
-        internals.reset();
-        data.doWork(input, internals, output);
-        assertEquals(page, internals.getRegister(HoltekEmulatorInternals.REGISTER_PAGE));
-        for (int x = 0; x < 16; x++) {
-          data = getCommandData((byte) (0x90 + x));
-          data.doWork(input, internals, output);
-          assertEquals((x + 16 * page), internals.getAddress());
-        }
-      } else {
-        assertNull(data);
-      }
-    }
-  }
-
-  // C LOOP #
-  @Test
-  public void testCLoop() {
-    for (int page = 0; page < 16; page++) {
-      SPSCommandData data = getCommandData((byte) (0x80 + page));
-      if (page < 0x08) {
-        assertNotNull(data);
-        internals.reset();
-        data.doWork(input, internals, output);
-        assertEquals(page, internals.getRegister(HoltekEmulatorInternals.REGISTER_PAGE));
-        for (int x = 0; x < 16; x++) {
-          internals.setRegister(HoltekEmulatorInternals.REGISTER_C, (byte) 4);
-          data = getCommandData((byte) (0xA0 + x));
-          data.doWork(input, internals, output);
-          assertEquals((x + 16 * page), internals.getAddress());
-
-          internals.setAddress(0);
-          internals.setRegister(HoltekEmulatorInternals.REGISTER_C, (byte) 0);
-          data.doWork(input, internals, output);
-          assertEquals(0x01, internals.getAddress());
-        }
-      } else {
-        assertNull(data);
-      }
-    }
-  }
-
-  // D LOOP #
-  @Test
-  public void testDLoop() {
-    for (int page = 0; page < 16; page++) {
-      SPSCommandData data = getCommandData((byte) (0x80 + page));
-      if (page < 0x08) {
-        assertNotNull(data);
-        internals.reset();
-        data.doWork(input, internals, output);
-        assertEquals(page, internals.getRegister(HoltekEmulatorInternals.REGISTER_PAGE));
-        for (int x = 0; x < 16; x++) {
-          internals.setRegister(HoltekEmulatorInternals.REGISTER_D, (byte) 4);
-          data = getCommandData((byte) (0xB0 + x));
-          data.doWork(input, internals, output);
-          assertEquals((x + 16 * page), internals.getAddress());
-
-          internals.setAddress(0);
-          internals.setRegister(HoltekEmulatorInternals.REGISTER_D, (byte) 0);
-          data.doWork(input, internals, output);
-          assertEquals(0x01, internals.getAddress());
-        }
-      } else {
-        assertNull(data);
-      }
-    }
-  }
-
-  // SKIP IF A > B
-  @Test
-  public void testSkipIfAgtB() {
-    SPSCommandData data = getCommandData((byte) 0xC1);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister(HoltekEmulatorInternals.REGISTER_A, (byte) 0x03);
-
-    internals.setRegister(HoltekEmulatorInternals.REGISTER_B, (byte) 0x04);
-    internals.setAddress(1);
-    data.doWork(input, internals, output);
-    assertEquals(2, internals.getAddress());
-
-    internals.setRegister(HoltekEmulatorInternals.REGISTER_B, (byte) 0x02);
-    internals.setAddress(1);
-    data.doWork(input, internals, output);
-    assertEquals(3, internals.getAddress());
-  }
-
-  // SKIP IF A < B
-  @Test
-  public void testSkipIfAltB() {
-    SPSCommandData data = getCommandData((byte) 0xC2);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister(HoltekEmulatorInternals.REGISTER_A, (byte) 0x03);
-
-    internals.setRegister(HoltekEmulatorInternals.REGISTER_B, (byte) 0x02);
-    internals.setAddress(1);
-    data.doWork(input, internals, output);
-    assertEquals(2, internals.getAddress());
-
-    internals.setRegister(HoltekEmulatorInternals.REGISTER_B, (byte) 0x04);
-    internals.setAddress(1);
-    data.doWork(input, internals, output);
-    assertEquals(3, internals.getAddress());
-  }
-
-  // SKIP IF A = B
-  @Test
-  public void testSkipIfAeqB() {
-    SPSCommandData data = getCommandData((byte) 0xC3);
-    assertNotNull(data);
-    internals.reset();
-    internals.setRegister(HoltekEmulatorInternals.REGISTER_A, (byte) 0x03);
-
-    internals.setRegister(HoltekEmulatorInternals.REGISTER_B, (byte) 0x02);
-    internals.setAddress(1);
-    data.doWork(input, internals, output);
-    assertEquals(2, internals.getAddress());
-
-    internals.setRegister(HoltekEmulatorInternals.REGISTER_B, (byte) 0x04);
-    internals.setAddress(1);
-    data.doWork(input, internals, output);
-    assertEquals(2, internals.getAddress());
-
-    internals.setRegister(HoltekEmulatorInternals.REGISTER_B, (byte) 0x03);
-    internals.setAddress(1);
-    data.doWork(input, internals, output);
-    assertEquals(3, internals.getAddress());
-  }
-
-  // SKIP IF Input = 1
-  @Test
-  public void testSkipIfIn1() {
-    for (int i = 0; i < 4; i++) {
-      SPSCommandData data = getCommandData((byte) (0xC4 + i));
-      assertNotNull(data);
-      internals.reset();
-      internals.setAddress(1);
-      input.setInput((byte) 0x00);
-      data.doWork(input, internals, output);
-      assertEquals(2, internals.getAddress());
-
-      internals.setAddress(1);
-      input.setInput((byte) (0x01 << i));
-      data.doWork(input, internals, output);
-      assertEquals(3, internals.getAddress());
-    }
-  }
-
-  // SKIP IF Input = 0
-  @Test
-  public void testSkipIfIn0() {
-    for (int i = 0; i < 4; i++) {
-      SPSCommandData data = getCommandData((byte) (0xC8 + i));
-      assertNotNull(data);
-      internals.reset();
-      internals.setAddress(1);
-      input.setInput((byte) 0x00);
-      data.doWork(input, internals, output);
-      assertEquals(3, internals.getAddress());
-
-      internals.setAddress(1);
-      input.setInput((byte) (0x01 << i));
-      data.doWork(input, internals, output);
-      assertEquals(2, internals.getAddress());
-    }
-  }
-
-  // SKIP IF S1, S2
-  @Test
-  public void testSkipIfS12() {
-    for (int i = 0; i < 4; i++) {
-      SPSCommandData data = getCommandData((byte) (0xCC));
-      assertNotNull(data);
-      internals.reset();
-      internals.setAddress(1);
-      input.setFeature(HoltekEmulatorInput.S1, false);
-      data.doWork(input, internals, output);
-      assertEquals(3, internals.getAddress());
-
-      internals.setAddress(1);
-      input.setFeature(HoltekEmulatorInput.S1, true);
-      data.doWork(input, internals, output);
-      assertEquals(2, internals.getAddress());
-
-      data = getCommandData((byte) (0xCD));
-      assertNotNull(data);
-      internals.reset();
-      internals.setAddress(1);
-      input.setFeature(HoltekEmulatorInput.S2, false);
-      data.doWork(input, internals, output);
-      assertEquals(3, internals.getAddress());
-
-      internals.setAddress(1);
-      input.setFeature(HoltekEmulatorInput.S2, true);
-      data.doWork(input, internals, output);
-      assertEquals(2, internals.getAddress());
-
-      data = getCommandData((byte) (0xCE));
-      assertNotNull(data);
-      internals.reset();
-      internals.setAddress(1);
-      input.setFeature(HoltekEmulatorInput.S1, true);
-      data.doWork(input, internals, output);
-      assertEquals(3, internals.getAddress());
-
-      internals.setAddress(1);
-      input.setFeature(HoltekEmulatorInput.S1, false);
-      data.doWork(input, internals, output);
-      assertEquals(2, internals.getAddress());
-
-      data = getCommandData((byte) (0xCF));
-      assertNotNull(data);
-      internals.reset();
-      internals.setAddress(1);
-      input.setFeature(HoltekEmulatorInput.S2, true);
-      data.doWork(input, internals, output);
-      assertEquals(3, internals.getAddress());
-
-      internals.setAddress(1);
-      input.setFeature(HoltekEmulatorInput.S2, false);
-      data.doWork(input, internals, output);
-      assertEquals(2, internals.getAddress());
-    }
-  }
-
-  // Call & Return
-  @Test
-  public void testCallReturn() {
-    for (int i = 0; i < 16; i++) {
-      SPSCommandData data = getCommandData((byte) (0xD0 + i));
-      assertNotNull(data);
-      internals.reset();
-      internals.setAddress(i);
-      internals.setRegister(HoltekEmulatorInternals.REGISTER_PAGE, (byte) i);
-
-      data.doWork(input, internals, output);
-      assertEquals(i + 16 * i, internals.getAddress());
-      assertEquals(i, ((HoltekEmulatorInternals) internals).rtrAddress);
-
-      data = getCommandData((byte) 0xE0);
-      assertNotNull(data);
-      data.doWork(input, internals, output);
-      assertEquals(i, internals.getAddress());
-    }
-  }
-}

+ 0 - 355
src/test/java/de/mcs/tools/sps/emulator/emulator/holtek/TestHoltekEmulator.java

@@ -1,355 +0,0 @@
-package de.mcs.tools.sps.emulator.emulator.holtek;
-
-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;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.emulator.EmulatorInternals;
-import de.mcs.tools.sps.emulator.EmulatorOutput;
-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.exceptions.WrongProgramSizeException;
-
-class TestHoltekEmulator implements TOutputCallback {
-
-  private SPSEmulator holtekEmulator;
-
-  @BeforeEach
-  void setUp() throws Exception {
-    holtekEmulator = new HoltekEmulator();
-    holtekEmulator.addCallback(this);
-  }
-
-  @Test
-  void testOutputAllCommands() {
-    System.out.println("command list holtect");
-    List<SPSCommand> commands = holtekEmulator.getCommands();
-    commands.forEach(c -> {
-      List<SPSCommandData> commandDatas = c.getCommandDatas();
-      System.out.printf("Command %s(%s):", c.getMnemonic(), c.getName());
-      commandDatas.forEach(cd -> {
-        System.out.printf("%s(%s) ,", cd.getMnemonic(), cd.getName());
-      });
-      System.out.println();
-    });
-  }
-
-  @Test
-  void testProgramSize() throws WrongProgramSizeException {
-    assertEquals(128, holtekEmulator.getProgramSize());
-    byte[] prgMemory = new byte[128];
-    holtekEmulator.loadProgram(prgMemory);
-  }
-
-  @Test
-  void testWrongProgramSize() throws WrongProgramSizeException {
-    byte[] prgMemory = new byte[129];
-    Throwable exception = assertThrows(WrongProgramSizeException.class, () -> holtekEmulator.loadProgram(prgMemory));
-  }
-
-  @Test
-  void testCommandArray() {
-    List<SPSCommand> commands = holtekEmulator.getCommands();
-    assertEquals(15, commands.size());
-    for (SPSCommand spsCommand : commands) {
-      switch (spsCommand.getCommandByte()) {
-      case 0x00:
-        assertEquals(1, spsCommand.getCommandDatas().size());
-        break;
-      case 0x10:
-        assertEquals(16, spsCommand.getCommandDatas().size());
-        break;
-      case 0x20:
-        assertEquals(16, spsCommand.getCommandDatas().size());
-        break;
-      case 0x30:
-        assertEquals(16, spsCommand.getCommandDatas().size());
-        break;
-      case 0x40:
-        assertEquals(16, spsCommand.getCommandDatas().size());
-        break;
-      case 0x50:
-        assertEquals(9, spsCommand.getCommandDatas().size());
-        break;
-      case 0x60:
-        assertEquals(10, spsCommand.getCommandDatas().size());
-        break;
-      case 0x70:
-        assertEquals(10, spsCommand.getCommandDatas().size());
-        break;
-      case (byte) 0x80:
-        assertEquals(8, spsCommand.getCommandDatas().size());
-        break;
-      case (byte) 0x90:
-        assertEquals(16, spsCommand.getCommandDatas().size());
-        break;
-      case (byte) 0xA0:
-        assertEquals(16, spsCommand.getCommandDatas().size());
-        break;
-      case (byte) 0xB0:
-        assertEquals(16, spsCommand.getCommandDatas().size());
-        break;
-      case (byte) 0xC0:
-        assertEquals(15, spsCommand.getCommandDatas().size());
-        break;
-      case (byte) 0xD0:
-        assertEquals(16, spsCommand.getCommandDatas().size());
-        break;
-      case (byte) 0xE0:
-        assertEquals(1, spsCommand.getCommandDatas().size());
-        break;
-      default:
-        fail(String.format("unknow command %s", spsCommand.getName()));
-        break;
-      }
-    }
-  }
-
-  @Test
-  void testNOP() throws WrongProgramSizeException {
-    outputList.clear();
-    internalList.clear();
-    byte[] prg = new byte[] { 0x00, 0x00, 0x00 };
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-
-    assertEquals(4, outputList.size());
-    assertEquals(4, internalList.size());
-  }
-
-  List<EmulatorOutput> outputList = new ArrayList();
-  List<EmulatorInternals> internalList = new ArrayList<>();
-
-  @Override
-  public void onOutput(EmulatorOutput output) {
-    outputList.add(output);
-    internalList.add(holtekEmulator.getEmulatorInternals());
-  }
-
-  @Test
-  void testPort() throws WrongProgramSizeException {
-    byte[] prg = new byte[] { 0x10, 0x1F, 0x10 };
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    holtekEmulator.nextStep();
-    HoltekEmulatorOutput emulatorOutput = (HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput();
-    assertFalse(emulatorOutput.d0);
-    assertFalse(emulatorOutput.d1);
-    assertFalse(emulatorOutput.d2);
-    assertFalse(emulatorOutput.d3);
-    holtekEmulator.nextStep();
-    assertTrue(emulatorOutput.d0);
-    assertTrue(emulatorOutput.d1);
-    assertTrue(emulatorOutput.d2);
-    assertTrue(emulatorOutput.d3);
-    holtekEmulator.nextStep();
-    assertFalse(emulatorOutput.d0);
-    assertFalse(emulatorOutput.d1);
-    assertFalse(emulatorOutput.d2);
-    assertFalse(emulatorOutput.d3);
-  }
-
-  @Test
-  void testDelay() throws WrongProgramSizeException {
-    // byte[] prg = new byte[] { 0x29, 0x2C };
-    // holtekEmulator.loadProgram(prg);
-    // holtekEmulator.startProgram(true);
-    // long start = System.currentTimeMillis();
-    // holtekEmulator.nextStep();
-    // long delta = System.currentTimeMillis() - start;
-    // assertTrue(delta > 900 && delta < 1100);
-    // start = System.currentTimeMillis();
-    // holtekEmulator.nextStep();
-    // delta = System.currentTimeMillis() - start;
-    // assertTrue(delta > 9000 && delta < 11000);
-  }
-
-  @Test
-  void testJumpDown() throws WrongProgramSizeException {
-    byte[] prg = new byte[] { 0x00, 0x00, 0x32 };
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    int addr = holtekEmulator.getEmulatorInternals().getAddress();
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getAddress());
-
-    prg = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39 };
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    addr = holtekEmulator.getEmulatorInternals().getAddress();
-    holtekEmulator.nextStep();
-    assertEquals(0x03, holtekEmulator.getEmulatorInternals().getAddress());
-  }
-
-  @Test
-  void testAEquals() throws WrongProgramSizeException {
-    byte[] prg = new byte[16];
-    for (int i = 0; i < prg.length; i++) {
-      prg[i] = (byte) (0x40 + i);
-    }
-    ;
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    for (int i = 0; i < prg.length; i++) {
-      holtekEmulator.nextStep();
-      assertEquals(i, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    }
-  }
-
-  @Test
-  void testEqualsA() throws WrongProgramSizeException {
-    byte[] prg = new byte[] { 0x48, 0x51, 0x52, 0x53, 0x40, 0x54, 0x4F, 0x54, 0x55 };
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    assertEquals(0x08, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    assertEquals(0x08, holtekEmulator.getEmulatorInternals().getRegister("B"));
-    assertEquals(0x08, holtekEmulator.getEmulatorInternals().getRegister("C"));
-    assertEquals(0x08, holtekEmulator.getEmulatorInternals().getRegister("D"));
-
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    assertEquals(0x00, ((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).getOutput());
-
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    assertEquals(0x0F, ((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).getOutput());
-    assertTrue(((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).d0);
-    assertTrue(((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).d1);
-    assertTrue(((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).d2);
-    assertTrue(((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).d3);
-
-    holtekEmulator.stop();
-
-    prg = new byte[] { 0x41, 0x55, 0x56, 0x57, 0x58 };
-
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    assertEquals(0x01, ((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).getOutput());
-    holtekEmulator.nextStep();
-    assertEquals(0x03, ((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).getOutput());
-    assertTrue(((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).d0);
-    assertTrue(((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).d1);
-    assertFalse(((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).d2);
-    assertFalse(((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).d3);
-    holtekEmulator.nextStep();
-    assertEquals(0x07, ((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).getOutput());
-    holtekEmulator.nextStep();
-    assertEquals(0x0f, ((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).getOutput());
-
-    holtekEmulator.stop();
-
-    prg = new byte[] { 0x41, 0x59, 0x4F, 0x59 };
-
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    assertEquals(0x01, ((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).getFeature("PWM"));
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    assertEquals(0x0F, ((HoltekEmulatorOutput) holtekEmulator.getEmulatorOutput()).getFeature("PWM"));
-  }
-
-  @Test
-  void testAInput() throws WrongProgramSizeException {
-    byte[] prg = new byte[] { 0x4F, 0x51, 0x52, 0x53, 0x40, 0x61, 0x40, 0x62, 0x40, 0x63 };
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    for (int i = 0; i < 5; i++) {
-      holtekEmulator.nextStep();
-    }
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x0f, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x0f, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x0f, holtekEmulator.getEmulatorInternals().getRegister("A"));
-
-    holtekEmulator.stop();
-
-    prg = new byte[] { 0x64, 0x64, 0x40, 0x65, 0x40, 0x66, 0x40, 0x67, 0x40, 0x68 };
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    holtekEmulator.getEmulatorInput().setInput((byte) 0x00);
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.getEmulatorInput().setInput((byte) 0x0f);
-    holtekEmulator.nextStep();
-    assertEquals(0x0f, holtekEmulator.getEmulatorInternals().getRegister("A"));
-
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x01, holtekEmulator.getEmulatorInternals().getRegister("A"));
-
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x01, holtekEmulator.getEmulatorInternals().getRegister("A"));
-
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x01, holtekEmulator.getEmulatorInternals().getRegister("A"));
-
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x01, holtekEmulator.getEmulatorInternals().getRegister("A"));
-
-    holtekEmulator.stop();
-
-    prg = new byte[] { 0x40, 0x69, 0x40, 0x69, 0x40, 0x6A, 0x40, 0x6A };
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.getEmulatorInput().setFeature("AD1", (byte) 0x00);
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.getEmulatorInput().setFeature("AD1", (byte) 0x0F);
-    holtekEmulator.nextStep();
-    assertEquals(0x0f, holtekEmulator.getEmulatorInternals().getRegister("A"));
-
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.getEmulatorInput().setFeature("AD2", (byte) 0x00);
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.nextStep();
-    assertEquals(0x00, holtekEmulator.getEmulatorInternals().getRegister("A"));
-    holtekEmulator.getEmulatorInput().setFeature("AD2", (byte) 0x0F);
-    holtekEmulator.nextStep();
-    assertEquals(0x0f, holtekEmulator.getEmulatorInternals().getRegister("A"));
-  }
-}

+ 0 - 55
src/test/java/de/mcs/tools/sps/emulator/emulator/holtek/TestHoltekProgram.java

@@ -1,55 +0,0 @@
-package de.mcs.tools.sps.emulator.emulator.holtek;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import de.mcs.tools.sps.emulator.EmulatorInput;
-import de.mcs.tools.sps.emulator.EmulatorInternals;
-import de.mcs.tools.sps.emulator.EmulatorOutput;
-import de.mcs.tools.sps.emulator.TOutputCallback;
-import de.mcs.tools.sps.emulator.emulator.holtek.HoltekEmulator;
-import de.mcs.tools.sps.emulator.emulator.holtek.HoltekEmulatorInternals;
-import de.mcs.tools.sps.emulator.exceptions.WrongProgramSizeException;
-
-class TestHoltekProgram implements TOutputCallback {
-
-  private HoltekEmulator holtekEmulator;
-
-  @BeforeEach
-  void setUp() throws Exception {
-    holtekEmulator = new HoltekEmulator();
-    holtekEmulator.addCallback(this);
-  }
-
-  @Test
-  void test() throws WrongProgramSizeException {
-    byte[] prg = new byte[] { 0x10, 0x1F, 0x10 };
-    holtekEmulator.loadProgram(prg);
-    holtekEmulator.startProgram(true);
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-    holtekEmulator.nextStep();
-  }
-
-  @Override
-  public void onOutput(EmulatorOutput output) {
-    EmulatorInternals internals = holtekEmulator.getEmulatorInternals();
-    EmulatorInput input = holtekEmulator.getEmulatorInput();
-    System.out.printf("adr: 0x%04x, a:0x%02x, b:0x%02x, c:0x%02x, d:0x%02x, page:0x%02x\r\n", internals.getAddress(),
-        internals.getRegister(HoltekEmulatorInternals.REGISTER_A),
-        internals.getRegister(HoltekEmulatorInternals.REGISTER_B),
-        internals.getRegister(HoltekEmulatorInternals.REGISTER_C),
-        internals.getRegister(HoltekEmulatorInternals.REGISTER_D),
-        internals.getRegister(HoltekEmulatorInternals.REGISTER_PAGE));
-    String value = getNibbleString(output.getOutput());
-    System.out.printf("in: %4s, s1: %b, s2: %b, adc1: 0x%02x, adc2: 0x%02x\r\n", value, input.getFeatureAsBool("S1"),
-        input.getFeatureAsBool("S2"), input.getFeature("ADC1"), input.getFeature("ADC2"));
-    System.out.printf("out: %4s, pwm: 0x%02x\r\n", value, output.getFeature("PWM"));
-    System.out.println();
-  }
-
-  private String getNibbleString(byte value) {
-    return String.format("%4s", Integer.toBinaryString(value & 0xFF)).replace(' ', '0');
-  }
-
-}

+ 37 - 0
src/test/resources/test.tps

@@ -0,0 +1,37 @@
+.macro blink
+PORT #0B0101
+WAIT 200ms
+PORT #0B1010
+WAIT 200ms
+.endmacro
+
+:loop
+.blink
+RJMP :loop
+/* 
+Kommentar über mehrere Zeilen
+*/
+
+.macro macro1 output time
+PORT output
+WAIT time
+PORT #0x00
+WAIT time
+.endmacro
+
+;.include macro_blink
+:loop1
+.macro1 #0x0f 200ms
+
+PORT #0x0F ;Zeilenkommentar
+WAIT 200ms
+PORT #0x00
+WAIT 200ms
+RJMP :loop1
+
+;DFSB 1
+PORT #0x0F ;Zeilenkommentar
+WAIT 200ms
+PORT #0x00
+WAIT 200ms
+RTR