-
Notifications
You must be signed in to change notification settings - Fork 24
/
demo.S
79 lines (67 loc) · 1.88 KB
/
demo.S
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#
# This file is part of the micropython-esp32-ulp project,
# https://github.com/micropython/micropython-esp32-ulp
#
# SPDX-FileCopyrightText: 2018-2023, the micropython-esp32-ulp authors, see AUTHORS file.
# SPDX-License-Identifier: MIT
# comment-only line
.text
.set constant42, 42
textstart: ld r0, r1, 0 # a comment!
st r0, r1, 0 // another comment!
add r0, r1, r2
add r0, r1, 42
sub r0, r1, r2
sub r0, r1, 42
and r0, r1, r2
and r0, r1, 42
or r0, r1, r2
or r0, r1, 42
lsh r0, r1, r2
lsh r0, r1, 42
rsh r0, r1, r2
rsh r0, r1, 42
move r0, r1
move r0, 42
move r0, textstart # moves abs addr of textstart to r0
move r0, constant42
stage_rst
stage_inc 42
stage_dec 23
rel_b: jumpr -1, 42, lt
jumpr rel_b, 42, LT
jumpr rel_f, 23, ge
rel_f: jumpr +1, 23, GE
jump textstart
jump 0, eq
jump 0, OV
jump r0
jump r0, EQ
jump r0, ov
jumps -1, 42, lt
jumps +1, 23, GT
jumps 0, 0xAD, Eq
reg_rd 0x3ff48000, 7, 0
reg_wr 0x3ff48000, 7, 0, 42
i2c_rd 0x10, 7, 0, 0
i2c_wr 0x23, 0x42, 7, 0, 1
adc r0, 0, 1
tsens r0, 42
nop
wait 1000
wake
sleep 1
halt
textend:
.data
data0: .skip 4, 0x23
data1: .space 4, 0x42
data2: .skip 4
dataw: .word 1, 2, 3, 4
datal: .long 1, 2, 3, 4
datab: .byte 1, 2, 3 # test alignment / fill up of section
dataend:
.bss
bss0: .skip 4
bss1: .skip 2 # test alignment / fill up of section
bssend: