asm文件是宏汇编文件,在c中调用方法如下:
1、编写汇编程序:
#include
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); // 开始调用上面声明的汇编函数
}