aboutsummaryrefslogtreecommitdiff
path: root/assembler/octal.s
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-01-22 15:01:38 -0600
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-01-22 15:01:38 -0600
commiteb87035e06aa45a8b1150ec86f698453d3092340 (patch)
tree818ba8ff7b584f65e0db303827044f2942fb7b9e /assembler/octal.s
parent261c210c9c4c1e55103a7af31dfcc539c0e0e5cc (diff)
Add octal and register name parsers
Diffstat (limited to 'assembler/octal.s')
-rw-r--r--assembler/octal.s25
1 files changed, 25 insertions, 0 deletions
diff --git a/assembler/octal.s b/assembler/octal.s
new file mode 100644
index 0000000..7382ca4
--- /dev/null
+++ b/assembler/octal.s
@@ -0,0 +1,25 @@
+octal:
+ PUSH {LR}
+10:
+ BL get_char
+ MOVS R1, '0
+ CMP R0, R1
+ BNE 10b
+ BL uart_send
+ MOVS R4, 0
+20:
+ BL get_char
+ BEQ 30f
+ MOVS R1, '0
+ CMP R0, R1
+ BLO 20b
+ MOVS R1, '7
+ CMP R0, R1
+ BHI 20b
+ BL uart_send
+ SUBS R0, '0
+ LSLS R4, 3
+ ADDS R4, R0
+ B 20b
+30:
+ POP {PC}