From 80d8f3ae48255f786bd4d52a1819ea0c339f6946 Mon Sep 17 00:00:00 2001 From: Jacques Comeaux Date: Fri, 23 Aug 2024 19:46:17 -0500 Subject: Add register parser and binary search for opcodes --- newasm/parsers/whitespace.s | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 newasm/parsers/whitespace.s (limited to 'newasm/parsers/whitespace.s') diff --git a/newasm/parsers/whitespace.s b/newasm/parsers/whitespace.s new file mode 100644 index 0000000..708cab3 --- /dev/null +++ b/newasm/parsers/whitespace.s @@ -0,0 +1,23 @@ +.syntax unified +.cpu cortex-m0plus +.thumb + +.type whitespace, %function +.global whitespace + +// 1 unexpected char + +// R4 input buffer + +whitespace: + LDRB R0, [R4] // get a char + CMP R0, ' // space + BEQ 1f + MOVS R0, #1 // return code 1 (unexpected char) + BX LR +1: ADDS R4, 1 // consume the character + LDRB R0, [R4] // get another character + CMP R0, ' // check if space + BEQ 1b // if so keep getting chars + MOVS R0, #0 // return code 0 (success) + BX LR -- cgit v1.2.3