summaryrefslogtreecommitdiff
path: root/input/adjacent-adder-manual.asm
diff options
context:
space:
mode:
Diffstat (limited to 'input/adjacent-adder-manual.asm')
-rw-r--r--input/adjacent-adder-manual.asm30
1 files changed, 30 insertions, 0 deletions
diff --git a/input/adjacent-adder-manual.asm b/input/adjacent-adder-manual.asm
new file mode 100644
index 0000000..b575959
--- /dev/null
+++ b/input/adjacent-adder-manual.asm
@@ -0,0 +1,30 @@
+;;;;;;;;
+;;; adds adjacent elements of a 4-element vector together,
+;;; storing the result in place.
+;;; Does not make use of variables.
+
+.data
+ ;; empty
+.text
+ addi $2 $0 0x200
+ addi $5 $0 0x1
+ store $5 0($2)
+ addi $5 $0 0x2
+ store $5 1($2)
+ addi $5 $0 0x3
+ store $5 2($2)
+ addi $5 $0 0x4
+ store $5 3($2)
+ addi $5 $0 0x0
+ addi $6 $0 0x3
+ jrl CHECK
+LOOP:
+ add $9 $2 $5
+ load $7 -0($9)
+ load $8 +1($9)
+ add $7 $7 $8
+ store $7 0($9)
+ addi $5 $5 0x1
+CHECK:
+ cmp $6 $5
+ bgt LOOP