diff --git a/exercises/practice/proverb/.meta/example.s b/exercises/practice/proverb/.meta/example.s index a043980..4524c1f 100644 --- a/exercises/practice/proverb/.meta/example.s +++ b/exercises/practice/proverb/.meta/example.s @@ -6,20 +6,25 @@ and: .string "And all for the want of a "; end: .string ".\n"; .macro APPEND str + adrp x5, \str + add x5, x5, :lo12:\str + bl append +.endm -.copy_\str: +.text +.globl recite + +append: ldrb w6, [x5], #1 /* load byte, with post-increment */ strb w6, [x0], #1 /* store byte, post-increment */ - cbnz w6, .copy_\str + cbnz w6, append sub x0, x0, #1 -.endm - -.text -.globl recite + ret /* extern void recite(char *buffer, const char **strings); */ recite: + mov x7, lr mov x2, x1 ldr x3, [x2], #8 /* load, post-increment */ cbz x3, .empty @@ -28,39 +33,31 @@ recite: ldr x4, [x2], #8 /* load, post-increment */ cbz x4, .last - adrp x5, for - add x5, x5, :lo12:for APPEND for mov x5, x3 - APPEND cause + bl append - adrp x5, the - add x5, x5, :lo12:the APPEND the mov x5, x4 - APPEND effect + bl append - adrp x5, was - add x5, x5, :lo12:was APPEND was mov x3, x4 b .next_line .last: - adrp x5, and - add x5, x5, :lo12:and APPEND and ldr x5, [x1] - APPEND first + bl append - adrp x5, end - add x5, x5, :lo12:end APPEND end + mov lr, x7 + .empty: strb wzr, [x0] ret