资源描述:
《指令系统_汇编程序复习》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Arm汇编语言语句分析:(1)数据处理类指令MOVR0,[R2]只能立即数之间SUBR0,R1,[R2]只能立即数之间MOVR0,#0x101立即数要满足一定要求MOVR0,R1,LSL#3合法(2)Load/Store类指令LDRR0,[R1],#4LDRR0,[R1,R2,LSL#2]!STRR0,[R1,R2,LSLR3]移位的数只能是立即数(3)杂类Load/Store指令LDRBR0,[R1,#3]LDRHR0,[R1]STRHR0,[R1,R2,LSL#2]错没有移位(4)批量Load/Store指令Arm用的是FullDescen
2、ding堆栈STMFDR0!,{R1,R2}=STMDBR0!,{R1,R2}LDMFDR0!,{R1,R2}=LDMIAR0!,{R1,R2}(5)状态寄存器访问指令MODE_SVCEQU0x13IRQ_DIS_BITEQU0x80FIQ_DIS_BITEQU0x40MOVR0,#0MOVR0,#MODE_SVC:OR:IRQ_DIS_BIT:OR:FIQ_DIS_BITMSRCPSR_c,R0:OR:为操作把前后的数取或的关系ARM程序代码段分析:AREABlock,CODE,READONLY;namethisblockofcodenumE
3、QU20;SetnumberofwordstobecopiedENTRY;markthefirstinstructiontocallstartLDRr0,=src;r0=pointertosourceblockLDRr1,=dst;r1=pointertodestinationblockMOVr2,#num;r2=numberofwordstocopyMOVsp,#0x400;setupstackpointer(r13)blockcopyMOVSr3,r2,LSR#3;numberofeightwordmultiplesBEQcopywords
4、lessthaneightwordstomove?STMFDsp!,{r4-r11};savesomeworkingregistersoctcopyLDMIAr0!,{r4-r11};load8wordsfromthesourceSTMIAr1!,{r4-r11};andputthematthedestinationSUBSr3,r3,#1;decrementthecounterBNEoctcopy;...copymoreLDMFDsp!,{r4-r11};don'tneedthesenow-restoreoriginalscopywordsA
5、NDSr2,r2,#7;numberofoddwordstocopyBEQstop;Nowordslefttocopy?wordcopyLDRr3,[r0],#4;awordfromthesourceSTRr3,[r1],#4;storeawordtothedestinationSUBSr2,r2,#1;decrementthecounterBNEwordcopy;...copymorestopBENDAREABlockData,DATA,READWRITEsrcDCD1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,
6、4dstDCD0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0END接口技术编程实验: