资源描述:
《arm与嵌入式技术实验报告》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、ARM与嵌入式技术实验报告姓名:张家瑞^=060105011128班级:06光信[班2.R2高8位传R3低8位程序如下:.global_startstart:MOVR2,#0x11000000@给r2赋值为0x11000000MOVR3,#0x00000022@给r2赋值为0x00000022MOVR1,R2,LSR#24R3,R1,R3,LSL#8stop:stop运行结果为"R3:0x00002211R2的高8位移到了R3的低8位了。3・实现64位加法运算,结构如下:(R1,R0)=(R1,R0)4-(R3,R2)程序如下:.global_start.textstart:MOVR0,#0x
2、01040000@给R0赋值为0x01040000MOVR1,#0x00000104@给R1赋值为0x00000104MOVR2,#0xf000000f@给R2赋值为OxfOOOOOOfMOVR3,#0x000FF000@给R3赋值为OxOOOFFOOOADDSR0,R0,R2@用改变标志位的加法运算ADCR1,R1,R3@考虑地位加法的进位加法stop:stop.end运行结果:eRO:0XF1O4OOOFR1:0x0盹"1仙满足题意。4•实现64位减法f结构如下:(R1,R0)=(RhR0)・(R3,R2)程序如下:.global_start.textstart:MOVR0,#0x0104
3、0000@给R0赋值为0x01040000@给R1赋值为0x00000104@给R2赋值为OxfOOOOOOf@给R3赋值为OxOOOFFOOOMOVR1,#0x00000104MOVR2,#0xf000000fMOVR3,#0x000FF000subsrO,rO,r2sbcsr1,r1,r3stop:bstop.end运行结果:4R0:OxHOSffflQR仁0XFFF011O3题意。减法运算产生了借位,C=0,否则C=1O在减法运算前0CPSR:OxOOO00Od3在之后0CPSR:0x800000d3o6.求两数最大公约数,把所得的公约数放在R0里。程序如下:.global_start.
4、text_start:MOVRO,#0x01040000@给R0赋值为0x01040000MOVR1,#0x00000104@给R1赋值为0x00000104lable:cmprO,r1subgtrO,rO,r1subltr1,r1,rObnelablestop:bstop.end运行结果如下:yR0:0X0103FefC7•编写程序实现计算10!程序如下:.global_start.text_start:movr0,#10movr1,r0lable:subr1,r1,#1mulrO,r1,rOcmpr1,#1bgtlablestop:bstop.end运行结果为:0x00375F008.串拷
5、贝(RO指向源数据区首地址R1指向目的数据区首地址)程序如下:.global_start.text.equnum,20start:adrrO,srcadrr1,dstmovr2,#nummovsp,#0x400blockcopy:movsr3,r2,lsr#3beqcopywordsstmfdsp!,{r4-r11}octcopy:IdmiarO!,{r4-r11}stmiar1!,{r4-r11}subsr3,r3,#1bneoctcopyIdmfdsp!,{r4-r11}copywords:andsr2,r2,#7beqstopwordcopy:Idrr3,[r0],#4strr3,[r1
6、],#4subsr2,r2,#1bnewordcopystop:bstop.Itorgsrc:.long1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20dst:.long0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.end运行结果如下:0x00002000addr0,pc,tt680X00002004addr1,pc,#1440X00002008nour2,tt200x0000200cnousp9tt10240x00002010nousr3,r2,lsrt*30x00002014beq0x20300X0000
7、2018stndbspt,r5fr6fr7fr8fr9,Sl»FP>0x0000201cldniarO?,©0X00002020stmiar1t,