aboutsummaryrefslogtreecommitdiff
path: root/hexedit/hexedit.s
blob: 26bc84bdf4b86ad480f88843abed56d77b13c1ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
.syntax unified
.cpu cortex-m0plus
.thumb

.equ SRAM_BASE, 0x20000000

.type hexedit, %function
.global hexedit

hexedit:
  ldr r6, =SRAM_BASE
  adds r5, r6, 1
10:
  movs r4, 0
20:
  bl uart_recv
  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