diff options
author | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-08-23 19:46:17 -0500 |
---|---|---|
committer | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-08-23 19:46:17 -0500 |
commit | 80d8f3ae48255f786bd4d52a1819ea0c339f6946 (patch) | |
tree | 70126a16181caf459cfcf79fce983655a7a704e5 /newasm/opcode.s | |
parent | b08def431c09449b5ad2ff4379fb403b2e1bf67b (diff) |
Add register parser and binary search for opcodes
Diffstat (limited to 'newasm/opcode.s')
-rw-r--r-- | newasm/opcode.s | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/newasm/opcode.s b/newasm/opcode.s deleted file mode 100644 index 71a5201..0000000 --- a/newasm/opcode.s +++ /dev/null @@ -1,40 +0,0 @@ -.syntax unified -.cpu cortex-m0plus -.thumb - -.type opcode, %function -.global opcode - -// 1 unexpected first char - -// R1 input buffer -// R2 output buffer - -opcode: PUSH {LR} - LDRB R0, [R1] // get a char - CMP R0, 0x41 // A - BLO 1f - CMP R0, 0x5A // Z - BLS 2f -1: MOVS R0, #1 // unexpected char - POP {PC} -2: ADDS R1, 1 // consume the character - STRB R0, [R2] // store in temp buffer - ADDS R2, 1 // advance temp buffer pointer - LDRB R0, [R1] // get another character - BL goodchar // check if valid symbol char - BEQ 2b // if so keep getting chars - MOVS R0, #0 // return code success - STRB R0, [R2] // write null byte - POP {PC} - -goodchar: CMP R0, '0 - BLO bad - CMP R0, '9 - BLS good - CMP R0, 'A - BLO bad - CMP R0, 'Z - BHI bad -good: CMP R0, R0 -bad: BX LR |