aboutsummaryrefslogtreecommitdiff
path: root/newasm/main.s
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-08-23 19:46:17 -0500
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-08-23 19:46:17 -0500
commit80d8f3ae48255f786bd4d52a1819ea0c339f6946 (patch)
tree70126a16181caf459cfcf79fce983655a7a704e5 /newasm/main.s
parentb08def431c09449b5ad2ff4379fb403b2e1bf67b (diff)
Add register parser and binary search for opcodes
Diffstat (limited to 'newasm/main.s')
-rw-r--r--newasm/main.s23
1 files changed, 12 insertions, 11 deletions
diff --git a/newasm/main.s b/newasm/main.s
index 57a1b98..a27fec9 100644
--- a/newasm/main.s
+++ b/newasm/main.s
@@ -5,33 +5,34 @@
.type main, %function
.global main, strbuf
-main: LDR R4, =0x20002000
+main: LDR R5, =0x20002000
BL uart_recv
loop: BL prompt
LDR R0, inpbuf
BL getline
LDR R0, inpbuf
BL putstrln
- LDR R1, inpbuf
+ LDR R4, inpbuf
LDR R2, strbuf
MOVS R0, 0
STRB R0, [R2]
BL statement
BNE bad
+
good: ADR R0, success
PUSH {R1}
BL putstrln
- POP {R0}
- BL putstrln
- LDR R0, strbuf
+ MOVS R0, R4
BL putstrln
+ POP {R0}
+ BL send_hex
+ LDR R0, =crlf
+ BL putstr
B loop
+
bad: ADR R0, fail
- PUSH {R1}
- BL putstrln
- POP {R0}
BL putstrln
- LDR R0, strbuf
+ MOVS R0, R4
BL putstrln
B loop
never: BL uart_recv
@@ -39,11 +40,11 @@ never: BL uart_recv
BX R0
prompt: PUSH {LR}
- MOVS R0, R4
+ MOVS R0, R5
BL send_hex
MOVS R0, '
BL uart_send
- LDR R0, [R4]
+ LDR R0, [R5]
BL send_hex
MOVS R0, '
BL uart_send