Parse flags
authorAlyssa Rosenzweig <alyssa@backtick.town>
Thu, 23 Jun 2016 17:17:00 +0000 (10:17 -0700)
committerAlyssa Rosenzweig <alyssa@backtick.town>
Thu, 23 Jun 2016 17:17:00 +0000 (10:17 -0700)
src/CPU/build-cpu.js

index 5fa4860..928ed8c 100644 (file)
@@ -46,7 +46,20 @@ var sources = table.map(function(x, i) {
 
         // follow the flags
         var flags = instruction_cache[x.name][0].replace(/ /g, '').split(',');
-        console.log(flags);
+        var negQ = false, zeroQ = false, mode = null, operand = null;
+
+        flags.forEach(function(flag) {
+            if(flag == "N") negQ = true;
+            else if(flag == "Z") zeroQ = true;
+            else if(["R", "RW", "IMPLIED", "RAW", "BRANCH"].indexOf(flag) > -1)
+                mode = flag;
+            else if (["A", "X", "Y", "tmp"].indexOf(flag) > -1)
+                operand = flag;
+            else
+                console.error("Unknown flag " + flag + " for instruction " + x.name);
+        });
+
+        console.log(mode);
 
         // add the actual code of the instruction
         instruction = instruction.concat(instruction_cache[x.name].slice(1));
This page took 0.022086 seconds and 4 git commands to generate.