aboutsummaryrefslogtreecommitdiff
path: root/assembler/get_char.s
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-01-26 17:58:33 -0600
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-01-26 17:58:33 -0600
commita63eba62ae9faffea51ba618b0d20f132c23c452 (patch)
treeea38b5ad2da14cbe2fc47f6e4bd3313eee6cd326 /assembler/get_char.s
parent0d04cd2eba12abdc9b8fca0532261bab879b45ed (diff)
Improve assembler sketch
Diffstat (limited to 'assembler/get_char.s')
-rw-r--r--assembler/get_char.s21
1 files changed, 21 insertions, 0 deletions
diff --git a/assembler/get_char.s b/assembler/get_char.s
new file mode 100644
index 0000000..f1f43e7
--- /dev/null
+++ b/assembler/get_char.s
@@ -0,0 +1,21 @@
+// R9: end_char
+get_char:
+ PUSH {LR}
+ BL uart_recv
+ MOVS R1, 025 // ^U (NAK)
+ CMP R0, R1
+ BEQ redo_line
+ MOVS R1, 004 // ^D (EOT)
+ CMP R0, R1
+ BEQ done_for_real
+ CMP R0, R9
+ POP {PC}
+
+get_line:
+ BL get_char
+ ...
+ B get_line
+
+redo_line:
+ ...
+ B get_line