aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2024-04-12 22:10:29 +0300
committerJan Tuomi <jan@jantuomi.fi>2024-04-12 22:10:29 +0300
commit03f94838c2e77348c7a51abdd0c6653ad204bc37 (patch)
tree1c7c7d20955eb725f22a26568401c65418d489dd
parentd993f522cfd091d35e538a8c3f77bc233a560bf2 (diff)
Add not op
-rw-r--r--atk16_asm/asm_ops.py13
-rw-r--r--pytest.ini3
2 files changed, 14 insertions, 2 deletions
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