aboutsummaryrefslogtreecommitdiff
path: root/hexedit/hexedit.s
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-05-26 14:21:59 -0500
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-05-26 14:21:59 -0500
commit5bbad5026cb810f61c2466d5c4bf3438ba820842 (patch)
tree1fa99f91c1af046d812485ac52abf7b83eb2acdc /hexedit/hexedit.s
parent7388c270069c2d1418539bca1d2789a6d468ecc2 (diff)
Finish hexedit and update README
Diffstat (limited to 'hexedit/hexedit.s')
-rw-r--r--hexedit/hexedit.s42
1 files changed, 26 insertions, 16 deletions
diff --git a/hexedit/hexedit.s b/hexedit/hexedit.s
index 0bc03a9..26bc84b 100644
--- a/hexedit/hexedit.s
+++ b/hexedit/hexedit.s
@@ -2,24 +2,34 @@
.cpu cortex-m0plus
.thumb
+.equ SRAM_BASE, 0x20000000
+
.type hexedit, %function
.global hexedit
hexedit:
- ldr r2, =0x20000100
- movs r1, 0
-getchar:
+ ldr r6, =SRAM_BASE
+ adds r5, r6, 1
+10:
+ movs r4, 0
+20:
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
+ cmp r0, '\r
+ beq 30f
+ cmp r0, 'G
+ beq 40f
+ bl uart_send
+ subs r0, '0
+ lsls r4, 3
+ adds r4, r0
+ b 20b
+30:
+ movs r0, '\r
+ bl uart_send
+ movs r0, '\n
+ bl uart_send
+ strh r4, [r6]
+ adds r6, 2
+ b 10b
+40:
+ bx r5