-
Notifications
You must be signed in to change notification settings - Fork 16
/
putget.s
136 lines (132 loc) · 1.92 KB
/
putget.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
;@-----------------------
.cpu cortex-m0
.thumb
;@-----------------------
.thumb_func
.globl putchar
putchar:
push {r7, lr}
add r7, sp, #0
movs r2, #0xE0
lsl r2, r2, #24
str r0, [r2, #0]
mov sp, r7
pop {r7, pc}
;@-----------------------
.thumb_func
.globl PUT32
PUT32:
str r1,[r0]
bx lr
;@-----------------------
.thumb_func
.globl GET32
GET32:
ldr r0,[r0]
bx lr
;@-----------------------
.thumb_func
.globl PUTGETCLR
PUTGETCLR:
ldr r2,[r0]
bic r2,r1
str r2,[r0]
bx lr
;; @-----------------------
.thumb_func
.globl atest
atest:
add r2,r0,r1
mov r0,#0
bvc atest1
mov r3,#1
orr r0,r3
atest1:
bcc atest2
mov r3,#2
orr r0,r3
atest2:
bx lr
;; @-----------------------
.thumb_func
.globl stest
stest:
sub r2,r0,r1
mov r0,#0
bvc stest1
mov r3,#1
orr r0,r3
stest1:
bcc stest2
mov r3,#2
orr r0,r3
stest2:
bx lr
.thumb_func
returnvcflags:
@swi 0xCC
@bx lr
bvc 1f
bcc 2f
;@ v set c set
mov r0,#3
lsl r0,#28
bx lr
1:
;@ v clear
bcc 3f
;@ v clear c set
mov r0,#2
lsl r0,#28
bx lr
2: ;@ v set c clear
mov r0,#1
lsl r0,#28
bx lr
3: ;@ v clear c clear
mov r0,#0
lsl r0,#28
bx lr
.thumb_func
.globl testfun1
testfun1:
;@ clear carry flag
mov r2,#0
ror r2,r2
adc r0,r1
b returnvcflags
.thumb_func
.globl testfun2
testfun2:
;@ set carry flag
mov r2,#1
ror r2,r2
adc r0,r1
b returnvcflags
.thumb_func
.globl testfun3
testfun3:
;@ clear carry flag
mov r2,#0
ror r2,r2
sbc r0,r1
b returnvcflags
.thumb_func
.globl testfun4
testfun4:
;@ set carry flag
mov r2,#1
ror r2,r2
sbc r0,r1
b returnvcflags
;;@-----------------------
;.thumb_func
;.globl PUTGETSET
;PUTGETSET:
; ldr r2,[r0]
; orr r2,r1
; str r2,[r0]
; bx lr
;;@-----------------------
.end
;@-----------------------