summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2023-02-15 19:54:24 -0500
committerTest_User <hax@andrewyu.org>2023-02-15 19:54:24 -0500
commit5a87ffe89c6509c295d22c9b105fa1126328f6c2 (patch)
tree630f3846bb0098417fb3d838c08f16ed19fda886
parent22029d37cbf391a35304d32778bd01ecf40de482 (diff)
downloadspecification-5a87ffe89c6509c295d22c9b105fa1126328f6c2.tar.gz
specification-5a87ffe89c6509c295d22c9b105fa1126328f6c2.zip
Add more instructions
-rw-r--r--cpu/instructions/arithmetic/add.txt10
-rw-r--r--cpu/instructions/arithmetic/decrement.txt10
-rw-r--r--cpu/instructions/arithmetic/increment.txt10
-rw-r--r--cpu/instructions/arithmetic/notes.txt4
-rw-r--r--cpu/instructions/arithmetic/subtract.txt10
-rw-r--r--cpu/instructions/conditions/bitwise_condition.txt12
-rw-r--r--cpu/instructions/conditions/save_condition.txt18
7 files changed, 74 insertions, 0 deletions
diff --git a/cpu/instructions/arithmetic/add.txt b/cpu/instructions/arithmetic/add.txt
new file mode 100644
index 0000000..3668033
--- /dev/null
+++ b/cpu/instructions/arithmetic/add.txt
@@ -0,0 +1,10 @@
+Number of parameters: 3
+
+Usage:
+ Add <output> <value0> <value1>
+
+Effect:
+ Adds <value0> to <value1> and stores it in <output>
+
+Exceptions:
+ None
diff --git a/cpu/instructions/arithmetic/decrement.txt b/cpu/instructions/arithmetic/decrement.txt
new file mode 100644
index 0000000..7d56a45
--- /dev/null
+++ b/cpu/instructions/arithmetic/decrement.txt
@@ -0,0 +1,10 @@
+Number of parameters: 1
+
+Usage:
+ decrement <output>
+
+Effect:
+ Subtracts 1 from <output>
+
+Exceptions:
+ None
diff --git a/cpu/instructions/arithmetic/increment.txt b/cpu/instructions/arithmetic/increment.txt
new file mode 100644
index 0000000..60cd856
--- /dev/null
+++ b/cpu/instructions/arithmetic/increment.txt
@@ -0,0 +1,10 @@
+Number of parameters: 1
+
+Usage:
+ increment <output>
+
+Effect:
+ Adds 1 to <output>
+
+Exceptions:
+ None
diff --git a/cpu/instructions/arithmetic/notes.txt b/cpu/instructions/arithmetic/notes.txt
new file mode 100644
index 0000000..29500cb
--- /dev/null
+++ b/cpu/instructions/arithmetic/notes.txt
@@ -0,0 +1,4 @@
+Unless otherwise specified, all arithmetic instructions:
+ Set the zero flag when the result is 0
+ Set the overflow flag when a signed operation results in inversion of the sign due to lack of bits to store the value
+ Set the carry flag when an unsigned operation results in a lower number due to lack of bits to store the value
diff --git a/cpu/instructions/arithmetic/subtract.txt b/cpu/instructions/arithmetic/subtract.txt
new file mode 100644
index 0000000..273ca46
--- /dev/null
+++ b/cpu/instructions/arithmetic/subtract.txt
@@ -0,0 +1,10 @@
+Number of parameters: 3
+
+Usage:
+ Subtract <output> <value0> <value1>
+
+Effect:
+ Subtracts <value0> from <value1> and stores it in <output>
+
+Exceptions:
+ None
diff --git a/cpu/instructions/conditions/bitwise_condition.txt b/cpu/instructions/conditions/bitwise_condition.txt
new file mode 100644
index 0000000..48ddabd
--- /dev/null
+++ b/cpu/instructions/conditions/bitwise_condition.txt
@@ -0,0 +1,12 @@
+Number of parameters: 3
+
+Usage:
+ bitwise_condition <input> <bits to be compared> <value to compare with>
+
+Effect:
+ Sets the zero flag if exactly one of <bits to be compared> in <input> match <value to compare with>
+ Sets the overflow flag if at least one of <bits to be compared> in <input> match <value to compare with>
+ Sets the carry flag if all of <bits to be compared> in <input> match <value to compare with>
+
+Exceptions:
+ None
diff --git a/cpu/instructions/conditions/save_condition.txt b/cpu/instructions/conditions/save_condition.txt
new file mode 100644
index 0000000..a7df9d2
--- /dev/null
+++ b/cpu/instructions/conditions/save_condition.txt
@@ -0,0 +1,18 @@
+Number of parameters:
+
+Usage:
+ save_condition <output> <offset> <conditional parameter>
+
+conditional parameter: same as is_conditional from ../opcode.txt, but with the following changes:
+ Values to be compared are instead xor'd
+
+Effect:
+ Saves the selected flags to <output> at bitwise position <offset>
+ Flags are xor'd with the comparison value
+ Resulting value is shifted down to not have gaps from unused flags
+
+Exceptions:
+ None
+
+Notes:
+ Will be executed in the conditional phase