From 03f94838c2e77348c7a51abdd0c6653ad204bc37 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Fri, 12 Apr 2024 22:10:29 +0300 Subject: Add not op --- atk16_asm/asm_ops.py | 13 +++++++++++-- pytest.ini | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 pytest.ini diff --git a/atk16_asm/asm_ops.py b/atk16_asm/asm_ops.py index 96e0366..d5da1c1 100644 --- a/atk16_asm/asm_ops.py +++ b/atk16_asm/asm_ops.py @@ -181,6 +181,16 @@ def expand_xor(left: str, imm: str, target: str) -> ExpandResult: def expand_xori(left: str, right: str, target: str) -> ExpandResult: return [["ali", "al_xor", left, right, target]] +def expand_not(reg: str) -> ExpandResult: + tmp = "RA" + return [ + *expand_spu(tmp), + ["ldi", "0", tmp], + *expand_subi(tmp, "1", tmp), + *expand_xor(reg, tmp, reg), + *expand_spo(tmp), + ] + def expand_sll(left: str, right: str, target: str) -> ExpandResult: return [["alr", "al_sll", left, right, target]] @@ -294,8 +304,7 @@ expansions: OpExpansionDict = { "sub": expand_sub, "addi": expand_addi, "subi": expand_subi, - # "not": expand_not, - # "noti": expand_noti, + "not": expand_not, "and": expand_and, "andi": expand_andi, "or": expand_or, diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..c2c8abe --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +filterwarnings = + ignore:pkg_resources is deprecated:DeprecationWarning -- cgit v1.3