Flag maker
authorAlyssa Rosenzweig <alyssa@backtick.town>
Thu, 23 Jun 2016 02:53:06 +0000 (19:53 -0700)
committerAlyssa Rosenzweig <alyssa@backtick.town>
Thu, 23 Jun 2016 02:53:06 +0000 (19:53 -0700)
src/CPU/flag-maker.js [new file with mode: 0644]

diff --git a/src/CPU/flag-maker.js b/src/CPU/flag-maker.js
new file mode 100644 (file)
index 0000000..adcdfe7
--- /dev/null
@@ -0,0 +1,26 @@
+/**
+ * emits clc-family instructions
+ */
+
+var fs = require("fs");
+
+var flags = {
+    "C": ["CLC", "SEC"],
+    "D": ["CLD", "SED"],
+    "I": ["CLI", "SEI"],
+    "V": ["CLV", null],
+};
+
+for(var flag in flags) {
+    if(flags[flag][0]) emit(flags[flag][0], flag, 0);
+    if(flags[flag][1]) emit(flags[flag][1], flag, 1);
+}
+
+function emit(name, flag, value) {
+    var emissions = [
+        "IMPLIED",
+        "set flag" + flag + " to " + value
+    ];
+
+    fs.writeFileSync("instructions/" + name, emissions.join("\n"));
+}
This page took 0.021818 seconds and 4 git commands to generate.