Mercurial > repos > blastem
comparison cpu_dsl.py @ 1733:1f0a86f5e055
Implemented LDI in new Z80 core
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 02 Feb 2019 23:02:19 -0800 |
parents | b0e01e64d76d |
children | 88fbc4e711fd |
comparison
equal
deleted
inserted
replaced
1732:3b286be82ea5 | 1733:1f0a86f5e055 |
---|---|
871 if prog.lastOp.op == 'cmp': | 871 if prog.lastOp.op == 'cmp': |
872 output.pop() | 872 output.pop() |
873 params = [prog.resolveParam(p, parent, fieldVals) for p in prog.lastOp.params] | 873 params = [prog.resolveParam(p, parent, fieldVals) for p in prog.lastOp.params] |
874 return '\n\tif ({a} >= {b}) '.format(a=params[1], b = params[0]) + '{' | 874 return '\n\tif ({a} >= {b}) '.format(a=params[1], b = params[0]) + '{' |
875 else: | 875 else: |
876 raise ion(">=U not implemented in the general case yet") | 876 raise Exception(">=U not implemented in the general case yet") |
877 | |
878 def _eqCImpl(prog, parent, fieldVals, output): | |
879 return '\n\tif (!{a}) {'.format(a=prog.resolveParam(prog.lastDst, None, {})) | |
880 | |
881 def _neqCImpl(prog, parent, fieldVals, output): | |
882 return '\n\tif ({a}) {'.format(a=prog.resolveParam(prog.lastDst, None, {})) | |
877 | 883 |
878 _ifCmpImpl = { | 884 _ifCmpImpl = { |
879 'c': { | 885 'c': { |
880 '>=U': _geuCImpl | 886 '>=U': _geuCImpl, |
887 '=': _eqCImpl, | |
888 '!=': _neqCImpl | |
881 } | 889 } |
882 } | 890 } |
883 #represents a DSL conditional construct | 891 #represents a DSL conditional construct |
884 class If(ChildBlock): | 892 class If(ChildBlock): |
885 def __init__(self, parent, cond): | 893 def __init__(self, parent, cond): |