aboutsummaryrefslogtreecommitdiff
path: root/assembler/string.s
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-01-26 17:58:33 -0600
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-01-26 17:58:33 -0600
commita63eba62ae9faffea51ba618b0d20f132c23c452 (patch)
treeea38b5ad2da14cbe2fc47f6e4bd3313eee6cd326 /assembler/string.s
parent0d04cd2eba12abdc9b8fca0532261bab879b45ed (diff)
Improve assembler sketch
Diffstat (limited to 'assembler/string.s')
-rw-r--r--assembler/string.s16
1 files changed, 16 insertions, 0 deletions
diff --git a/assembler/string.s b/assembler/string.s
new file mode 100644
index 0000000..0ed7ca3
--- /dev/null
+++ b/assembler/string.s
@@ -0,0 +1,16 @@
+// R0 : string1 address
+// R1 : string2 address
+// Result in R0
+string_compare:
+ MOVS R4, 0
+loop:
+ LDRB R2, [R0, R4]
+ LDRB R3, [R1, R4]
+ CMP R2, R3
+ BNE done
+ CMP R2, 0
+ BEQ done
+ ADDS R4, 1
+ B loop
+done:
+ BX LR