summaryrefslogtreecommitdiff
path: root/input/add-loop-directive.asm
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-04-10 18:37:40 -0400
committerGitHub <noreply@github.com>2025-04-10 18:37:40 -0400
commit5dbf0b63988b42c112ca0087cbbbb090566df5c1 (patch)
treece8ee03b9d25b739a2e687c69b14d9221420e4fa /input/add-loop-directive.asm
parentcc1e5892a25949b996d69a0b07f151a276ef2570 (diff)
parentdf508744ec2975cec0ba05e8a4358c1c41265c4c (diff)
Merge pull request #2 from bdunahu/bdunahu
Finish parser, add .text and .data directives, variable names, label processing
Diffstat (limited to 'input/add-loop-directive.asm')
-rw-r--r--input/add-loop-directive.asm21
1 files changed, 21 insertions, 0 deletions
diff --git a/input/add-loop-directive.asm b/input/add-loop-directive.asm
new file mode 100644
index 0000000..5bccff3
--- /dev/null
+++ b/input/add-loop-directive.asm
@@ -0,0 +1,21 @@
+.data
+ arr 1 2 3 4
+ s 3
+ i 0
+
+.text
+ load $5 s
+ load $10 arr
+ load $6 i
+ jrl CMP
+L:
+ add $9 $10 $6
+ load $7 0($9)
+ load $8 1($9)
+ add $7 $7 $8
+
+ store $7 0($9)
+ addi $6 $6 0x1
+CMP:
+ cmp $6 $5
+ bgt L