Pad hex (probably fixes multiple bugs)
authorAlyssa Rosenzweig <alyssa@backtick.town>
Thu, 7 Jul 2016 02:04:34 +0000 (19:04 -0700)
committerAlyssa Rosenzweig <alyssa@backtick.town>
Thu, 7 Jul 2016 02:04:34 +0000 (19:04 -0700)
src/CPU/build-lookups.js

index d0b62ef..6e82307 100644 (file)
@@ -8,7 +8,7 @@ var fs = require("fs");
 emit("EOR", function(a,b){return a^b});
 emit("ORA", function(a,b){return a|b});
 emit("AND", function(a,b){return a&b});
-emit("hex", function(a,b){return ((a<<4)|b).toString(16)});
+emit("hex", function(a,b){return ("00" + ((a<<4)|b).toString(16)).substr(-2, 2)});
 emit("bitmask", function(a,b){return ("00000000"+((a<<4)|b).toString(2)).substr(-8,8)});
 emit("obitmask", function(a,b){return "1" + (("00000000"+((a<<4)|b).toString(2)).substr(-8,8))});
 emit("dobitmask", function(a,b){return 2 * ("1" + (("00000000"+((a<<4)|b).toString(2)).substr(-8,8)))});
This page took 0.029777 seconds and 4 git commands to generate.