安防监控知识
电气知识|C程序调用汇编程序
2017-03-09  浏览:80
安防之家讯:文件strtest.c

1 #include <stdio.h>

2 extern void strcopy(char *d, const char *s);

3 int main()

4 { const char *srcstr = "First string - source";

5 char dststr[] = "Second string - destination";

6

7

8 printf("Before copying:\n");

9 printf(" '%s'\n '%s'\n",srcstr,dststr);

10 strcopy(dststr,srcstr);

11 printf("After copying:\n");

12 printf(" '%s'\n '%s'\n",srcstr,dststr);

13 return 0;

14 }

文件scopy.s

1 AREA SCopy, CODE, READONLY

2 EXPORT strcopy

3 strcopy

4 ; r0 points to destination string

5 ; r1 points to source string

6 LDRB r2, [r1],#1 ; load byte and update address

7 STRB r2, [r0],#1 ; store byte and update address;

8 CMP r2, #0 ; check for zero terminator

9 BNE strcopy ; keep going if not

10 MOV pc,lr ; Return

11 END安防之家专注于各种家居的安防,监控,防盗,安防监控,安防器材,安防设备的新闻资讯和O2O电商导购服务,敬请登陆安防之家:http://anfang.jc68.com/
更多»您可能感兴趣的文章:
更多»有关 安防 的产品:
  • 安防监控资讯
  • 发表评论 | 0评
  • 评论登陆
  • 移动社区 天花之家 木门之家 灯具之家 铁艺之家 幕墙之家 五金头条 楼梯头条 墙纸头条 壁纸头条 玻璃头条 老姚之家 灯饰之家 电气之家 全景头条 照明之家 防水之家 防盗之家 区快洞察 建材 枣庄建材 临沂建材 南昌建材 上饶建材 抚州建材 宜春建材 吉安建材 赣州建材 鹰潭建材 新余建材 九江建材 萍乡建材 景德镇陶瓷 石家庄建材 衡水建材 廊坊建材 沧州建材 承德建材 建材之家 企业之家 720全景
    (c)2015-2017 Bybc.cn SYSTEM All Rights Reserved