浙江工业大学-嵌入式系统原理-实验4
-CAL-FENGHAI-(2024YEAR-YICAI)_JINGBIAN
嵌入式系统 实验四
#include <>
extern int strcmp(char *d,char *s); int main() {
int result;
char *str1=\ char *str2=\ printf (\ printf (\ result=strcmp(str1,str2); printf (\ return(0); }
AREA SCopy, CODE, READONLY GLOBAL strcmp strcmp
MOV R4, #1
LE LDRB R2, [R0],#1 LDRB R3, [R1],#1 CMP R2,R3 MOVNE R4, #0 CMP R2, #0 BNE LE
MOV R0, R4 MOV PC, LR END
#include <>
extern void strscopy(char *d,char *s); int main() {
char *str1=\Technology\ char *str2;
strscopy(str2,str1); printf (\ printf (\ return(0); }
2
AREA SCopy, CODE, READONLY GLOBAL strscopy
strscopy
LE LDRB R2, [R1],#1 STRB R2, [R0],#1 CMP R2, #0 BNE LE
MOV PC, LR END
int add1(int a, int b, int c, int d, int e, int f) {int sum;
sum=a+b+c+d+e+f; return sum; }
AREA SCopy, CODE, READONLY GLOBAL strscmp IMPORT add1 ENTRY CODE32 strscmp
MOV R0, #2 ADD R1, R0, R0 ADD R2, R1, R0 ADD R3, R1, R2 ADD R3, R3, R0 STR R3, [SP, #-4]! ADD R3, R1, R2 STR R3, [SP, #-4]! ADD R3, R2, R0 BL add1 MOV R8, R0 END