
C中如何使用.asm文件
2个回答
2016-11-12 · 百度知道合伙人官方认证企业
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注

展开全部
asm文件是宏汇编文件,在c中调用方法如下:
1、编写汇编程序:
#include <xc.inc>
GLOBAL _add ; 声明全局可用的函数add
SIGNAT _add,4217 ; 告诉编译器调用方式
;
PSECT mytext,local,class=CODE,delta=2
; our routine to add to ints and return the result
_add:
; W is loaded by the calling function;
BANKSEL (PORTB) ; select the bank of this object
ADDWF BANKMASK(PORTB),w ; add parameter to port
; the result is already in the required location (W)so we can ; just return immediately
RETURN
2、编写c语言程序
//声明调用外部的汇编程序
extern unsigned char add(unsigned char a);
void main(void) {
volatile unsigned char result;
result = add(5); // 开始调用上面声明的汇编函数
}
1、编写汇编程序:
#include <xc.inc>
GLOBAL _add ; 声明全局可用的函数add
SIGNAT _add,4217 ; 告诉编译器调用方式
;
PSECT mytext,local,class=CODE,delta=2
; our routine to add to ints and return the result
_add:
; W is loaded by the calling function;
BANKSEL (PORTB) ; select the bank of this object
ADDWF BANKMASK(PORTB),w ; add parameter to port
; the result is already in the required location (W)so we can ; just return immediately
RETURN
2、编写c语言程序
//声明调用外部的汇编程序
extern unsigned char add(unsigned char a);
void main(void) {
volatile unsigned char result;
result = add(5); // 开始调用上面声明的汇编函数
}
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |