summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpp2cc.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pp2cc.py b/pp2cc.py
index 232c581..60aaa48 100755
--- a/pp2cc.py
+++ b/pp2cc.py
@@ -396,6 +396,10 @@ class Parse(object):
lines += self.processShift(node.op, reg_first, operand, linked_node)
else:
lines.append(self.asm.binary_op(op, reg_first, operand))
+ # explicitly set the PSW words because DIV and MOD are stupid and set
+ # the Z flag depending on the remainder
+ if op in ("DIV", "MOD"):
+ lines.append(self.asm.binary_op("LOAD", reg_first, reg_first))
return lines
def processShift(self, operator, reg_number, operand_shift, linked_node=None):
"""Returns lines for a shift expression