diff options
Diffstat (limited to 'nandgame')
| -rwxr-xr-x | nandgame/assembler/disas.py | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/nandgame/assembler/disas.py b/nandgame/assembler/disas.py index 4994a69..21cd081 100755 --- a/nandgame/assembler/disas.py +++ b/nandgame/assembler/disas.py @@ -68,34 +68,22 @@ def decode_arg1(ins: int) -> str: if zx: return "0" - # and not sw? - # zx and swap: don't care, other arg is zeroed - - if not zx and not sw and not use_mem: - return "A" - if not zx and not sw and use_mem: - return "M" - - return "?" + if not sw: + return "D" + return "M" if use_mem else "A" # normally, Y = arg2 = A def decode_arg2(ins: int) -> str: use_mem = (ins & (1 << 12)) != 0 - zx = (ins & (1 << 7)) != 0 - sw = (ins & (1 << 6)) != 0 - if zx and sw: - return "0" - # zx and not swap: don't care, other arg is zeroed - - # zx ??? - if sw and not use_mem: - return "A" - if sw and use_mem: - return "M" + # don't care, only X is zeroed + # zx = (ins & (1 << 7)) != 0 + sw = (ins & (1 << 6)) != 0 - return "?" + if sw: + return "D" + return "M" if use_mem else "A" def decode_dest(ins: int) -> str: |
