aboutsummaryrefslogtreecommitdiff
path: root/hexedit/hexedit.s
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-01-19 16:41:29 -0600
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-01-19 16:41:29 -0600
commit261c210c9c4c1e55103a7af31dfcc539c0e0e5cc (patch)
tree71840ab97b84dd3f995ea8900b08c98149feac36 /hexedit/hexedit.s
parent473e52cbe7cbee0333b7d97d91c4bbf95c1b3225 (diff)
Add subroutine for printing hexadecimal word
Diffstat (limited to 'hexedit/hexedit.s')
-rw-r--r--hexedit/hexedit.s25
1 files changed, 25 insertions, 0 deletions
diff --git a/hexedit/hexedit.s b/hexedit/hexedit.s
new file mode 100644
index 0000000..0bc03a9
--- /dev/null
+++ b/hexedit/hexedit.s
@@ -0,0 +1,25 @@
+.syntax unified
+.cpu cortex-m0plus
+.thumb
+
+.type hexedit, %function
+.global hexedit
+
+hexedit:
+ ldr r2, =0x20000100
+ movs r1, 0
+getchar:
+ bl uart_recv
+ cmp r0, 'g
+ beq stop
+ subs r0, '0 // The ASCII char '0'
+ bmi next
+ lsls r1, 4
+ adds r1, r0
+ b getchar
+next:
+ ldr r0, [r2, 0]
+ adds r2, 4
+ b hexedit
+stop:
+ b 0x20000100