diff options
| author | uvok | 2026-01-04 17:12:47 +0100 |
|---|---|---|
| committer | uvok | 2026-01-04 17:12:47 +0100 |
| commit | ab8621185b8c583a2df72f98114b23a389d9ec55 (patch) | |
| tree | 8861be850331177b3d411454ab9d40500636e445 | |
| parent | b0fccbd0f3f96b87b5be7dc28be221f1fa33aab7 (diff) | |
finish disasseembler
| -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: |
