diff options
author | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-08-21 00:21:54 -0500 |
---|---|---|
committer | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-08-21 00:21:54 -0500 |
commit | ed6f1106322f8ca4a6e26d08365bb9558ffa9d09 (patch) | |
tree | 0258d4a7b0429c82b4f7af8d63106ea93e7150de /newasm/string.s | |
parent | d23ab4295a865580f6cb7bb4526978bac388b5ac (diff) |
Start new assembler
Diffstat (limited to 'newasm/string.s')
-rw-r--r-- | newasm/string.s | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/newasm/string.s b/newasm/string.s new file mode 100644 index 0000000..c1dad1c --- /dev/null +++ b/newasm/string.s @@ -0,0 +1,32 @@ +.syntax unified +.cpu cortex-m0plus +.thumb + +.type putstr, %function +.type cmpstr, %function + +.global putstr, cmpstr + +putstr: LDR R3, =0x40034000 + MOVS R2, 0x20 +1: LDR R1, [R3, 0x18] + TST R1, R2 + BNE 1b + LDRB R1, [R0] + TST R1, R1 + BEQ 2f + STRB R1, [R3] + ADDS R0, 1 + B 1b +2: BX LR + +cmpstr: MOVS R4, 0 +1: LDRB R2, [R0, R4] + LDRB R3, [R1, R4] + CMP R2, R3 + BNE 2f + CMP R2, 0 + BEQ 2f + ADDS R4, 1 + B 1b +2: BX LR |