aboutsummaryrefslogtreecommitdiff
path: root/octedit/octedit.s
blob: 7d9e7f42c4b439f10b7dfb1da63443bacdc3557c (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
.syntax unified
.cpu cortex-m0plus
.thumb

.equ SRAM_BASE, 0x20000000

.type octedit, %function
.global octedit

octedit:
  ldr r6, =SRAM_BASE
  adds r5, r6, 1
10:
  movs r4, 11
  movs r0, 0x1E
  rors r6, r0
  movs r0, 0x01
  b 1f
0:
  movs r0, 0x1D
  rors r6, r0
  movs r0, 0x07
1:
  ands r0, r6
  adds r0, 0x30
  bl uart_send
  subs r4, 1
  bne 0b
  movs r0, ' 
  bl uart_send
20:
  bl uart_recv
  cmp r0, '\r
  bne 30f
  bl uart_send
  movs r0, '\n
  bl uart_send
  strh r4, [r6]
  adds r6, 2
  b 10b
30:
  cmp r0, 'G
  bne 40f
  bx r5
40:
  cmp r0, 'B
  bne 50f
  movs r0, '\r
  bl uart_send
  subs r6, 2
  b 10b
50:
  bl uart_send
  subs r0, '0
  lsls r4, 3
  adds r4, r0
  b 20b