《浙江工业大学嵌入式系统原理实验(共1页).doc》由会员分享,可在线阅读,更多相关《浙江工业大学嵌入式系统原理实验(共1页).doc(1页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上嵌入式系统 实验三3.1#include extern void strsswap(char *d,char *s);int main() char *str1=content of string1; char *str2=content of string2; strsswap(str1,str2); printf (%sn,str1); printf (%sn,str2); return(0);AREA SCopy, CODE, READONLYGLOBAL strsswapstrsswap LDRB R2, R0 LDRB R3, R1 STRB R2, R1,
2、 #1 STRB R3, R0, #1 CMP R2, #0 BNE strsswap MOV PC, LR END3.3extern int cvar1,cvar2;int cvar1=10;int cvar2=20; AREA SCopy, CODE, READONLY GLOBAL accesscvar IMPORT cvar1 IMPORT cvar2 ENTRY CODE32 accesscvar LDR R1, =cvar1 LDR R2, =cvar2 LDR R0, R1 LDR R3, R2 ADD R0, R0, R3 STR R0, R1 MOV R2, #0xFF EN
3、D3.2#include extern void prosort(char s,int num);int main() int i; char s1=11,24,38,40,126,78,95,204,35,9,2,33,159,146,211,23,67,93,66,54; prosort(s1,20); printf(the sorted numbers:n); for(i=1;i21;i+) printf(%d ,s1i); AREA SCopy, CODE, READONLY GLOBAL prosort prosort SUB R8, R1, #1 MOV R2, #1 LOOP1 MOV R6, #1LOOP2 LDRB R4, R0,R6 ADD R9, R6, #1 LDRB R5, R0,R9 CMP R4, R5 MOVLS R10, R4 MOVLS R4, R5 MOVLS R5, R10 STRB R4, R0,R6 STRB R5, R0,R9 ADD R6, R6, #1 SUB R7, R1, R2 CMP R6, R7 BLS LOOP2 ADD R2, R2, #1 CMP R2, R8 BLS LOOP1 MOV PC, LR END 专心-专注-专业