Flag maker
[ScratchNES.git] / src / CPU / flag-maker.js
1 /**
2 * emits clc-family instructions
3 */
4
5 var fs = require("fs");
6
7 var flags = {
8 "C": ["CLC", "SEC"],
9 "D": ["CLD", "SED"],
10 "I": ["CLI", "SEI"],
11 "V": ["CLV", null],
12 };
13
14 for(var flag in flags) {
15 if(flags[flag][0]) emit(flags[flag][0], flag, 0);
16 if(flags[flag][1]) emit(flags[flag][1], flag, 1);
17 }
18
19 function emit(name, flag, value) {
20 var emissions = [
21 "IMPLIED",
22 "set flag" + flag + " to " + value
23 ];
24
25 fs.writeFileSync("instructions/" + name, emissions.join("\n"));
26 }
This page took 0.072934 seconds and 4 git commands to generate.