嵌入式汇编文档格式.docx
- 文档编号:17190444
- 上传时间:2022-11-28
- 格式:DOCX
- 页数:14
- 大小:15.35KB
嵌入式汇编文档格式.docx
《嵌入式汇编文档格式.docx》由会员分享,可在线阅读,更多相关《嵌入式汇编文档格式.docx(14页珍藏版)》请在冰豆网上搜索。
03in_out.c
intin_out=10;
mov%1,%0\n"
mov%0,#20\n"
+r"
(in_out),"
in_out=%d\n"
in_out);
04in_out.c
__asm____volatile(
+&
05add.c
intsum=0;
inta=1;
intb=2;
movr0,%1\n"
movr1,%2\n"
add%0,r0,r1\n"
(sum)
(a),"
(b)
r0"
"
r1"
1+2=%d\n"
sum);
return0;
06sub.c
intsub;
movr0,#2\n"
movr1,#3\n"
sub%0,r1,r0\n"
(sub)
3-2=%d\n"
sub);
07mul.c
intout=0;
mul%0,r0,r1\n"
2x3=%d\n"
08cal.c
inta=1,b=2,c=3,d=5,e=0;
addr0,%1,%2\n"
mulr1,r0,%3\n"
sub%0,r1,%4\n"
(e)
(b),"
(c),"
(d)
(1+2)x3-5=%d\n"
e);
09cmp.c
movr0,#1\n"
movr1,#2\n"
cmpr0,r1\n"
movgt%0,#1\n"
movle%0,#2\n"
10sort.c
inta,b,c;
movr2,#3\n"
movltr3,r0\n"
movltr0,r1\n"
movltr1,r3\n"
cmpr0,r2\n"
movltr0,r2\n"
movltr2,r3\n"
cmpr1,r2\n"
movltr3,r2\n"
movltr2,r1\n"
mov%0,r0\n"
mov%1,r1\n"
mov%2,r2\n"
(c)
r2"
r3"
a=%db=%dc=%d\n"
a,b,c);
11and.c
inta,b,c,d,e=5;
movr0,#0x5\n"
movr1,#0x6\n"
and%0,r0,#6\n"
orr%1,r0,r1\n"
eor%2,r0,r1\n"
bic%3,r0,r1\n"
and%4,#6\n"
(d),"
5&
6=%d\n"
a);
5|6=%d\n"
b);
5^6=%d\n"
c);
not(6)=%d\n"
d);
12mrs.c
intcpsr;
mrs%0,cpsr\n"
orr%0,%0,#0x30000000\n"
msrcpsr,%0\n"
(cpsr)
cpsr=%x\n"
cpsr);
13logical.c
inta,b,c,d,e;
movr0,#0xfc\n"
movr1,#-10\n"
mov%0,r0,lsr#1\n"
mov%1,r0,lsl#1\n"
mov%2,r1,asr#1\n"
mov%3,r1,lsr#1\n"
mov%4,r0,ror#4\n"
0xfc>
>
1=%x\n"
0xfc<
<
-10>
a1=%d\n"
l1=%d\n"
0xfcr>
4=%x\n"
14b.c
inttext;
#if0
mov%0,#15\n"
bhere\n"
mov%0,#10\n"
here:
\n"
(text)
text=%d\n"
text);
#endif
blhere\n"
__asm__(
addr0,r0,r1\n"
movpc,lr\n"
15apcs.c
inta;
bladd\n"
(a)
a=%d\n"
intadd(inta,intb)
returna+b;
16ldr.c
inta=5;
ldrr0,%0\n"
addr0,r0,#2\n"
strr0,%0\n"
m"
memeroy"
intb,c;
data:
.word0x1,0x2,0x3,0x4\n"
//"
ldrr0,=data\n"
adrr0,data\n"
ldr%0,[r0]\n"
ldr%1,[r0,#4]\n"
ldr%0,[r0,#4]!
ldr%1,[r0,#4]!
ldr%0,[r0],#4\n"
ldr%1,[r0]\n"
b=%d\n"
17list.c
list_create:
subsp,sp,#24\n"
movr0,sp\n"
movr1,#10\n"
strr1,[sp]\n"
addr0,r0,#8\n"
strr0,[sp,#4]\n"
movr1,#20\n"
strr1,[sp,#8]\n"
strr0,[sp,#12]\n"
movr1,#30\n"
strr1,[sp,#16]\n"
movr0,#0\n"
strr0,[sp,#20]\n"
list_find:
movr4,#340\n"
ldrr1,[r0],#4\n"
loop:
cmpr1,r4\n"
moveq%0,#1\n"
movne%0,#0\n"
beqend\n"
ldrr3,[r0],#8\n"
cmpr3,#0\n"
ldrr1,[r3]\n"
bloop\n"
end:
addsp,sp,#24\n"
r4"
18push.c
inta,b,c,d;
movr3,#4\n"
stmfdsp!
{r0-r3}\n"
ldmfdsp!
{r4-r7}\n"
mov%0,r4\n"
mov%1,r5\n"
mov%2,r6\n"
mov%3,r7\n"
r5"
r6"
r7"
c=%d\n"
d=%d\n"
19imm.c
movr4,#0x00ff00\n"
msrcpsr,#0x80000000\n"
20mod.c
intb,s,g;
ldrr0,=0x123\n"
blmod\n"
mov%0,r1\n"
mov%1,r2\n"
mov%2,r3\n"
(s),"
(g)
s=%d\n"
s);
g=%d\n"
g);
mod:
andr4,r0,#0xf00\n"
movr1,r4,lsr#8\n"
andr4,r0,#0xf0\n"
movr2,r4,lsr#4\n"
andr4,r0,#0xf\n"
movr3,r4,lsr#0\n"
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 嵌入式 汇编
![提示](https://static.bdocx.com/images/bang_tan.gif)