// follow the flags
var flags = instruction_cache[x.name][0].replace(/ /g, '').split(',');
- var negQ = false, zeroQ = false, mode = null, operand = null;
+ var negQ = false, zeroQ = false, carryQ = false, mode = null, operand = null;
flags.forEach(function(flag) {
if(flag == "N") negQ = true;
instruction.push("set flagZ to <" + operand + " = 0>");
}
+ if(carryQ) {
+ instruction.push("set flagC to <" + operand + " > 255 or " + operand + " < 0>");
+ }
+
instruction = instruction.concat([
'say "' + x.assembler + '" for 2 secs',
'change PC by ' + x.size
R,N,Z,A
set tmp to A - OP - flagC
-set A to item (tmp mod 256)+1 of hex
-set flagC to <tmp > 255>
+set A to ((tmp mod 256) + 256) mod 256
+set flagC to <tmp > 255 or tmp < 0>
set flagV to <<A < 128 and OP < 128 and (tmp mod 256) > 128> or <A > 127 and OP > 127 and (tmp mod 256) < 128>>