//*************************Main.c***********************************************
#include "func.h"
name main
extern func
rseg CODE
main: ld hl,3
push hl //第三个参数压栈
ld de,1
ld bc 2
call func
ld (result),hl
pop hl //保证堆栈匹配
halt
end
//*************************func.h***********************************************
#ifndef _FUNC_H //include protect
#define _FUNC_H
#ifdef __IAR_SYSTEMS_ICC //only include by c module
// add c definitions here
non_banked int func(int a,int b,int c);
#endif /* __IAR_SYSTEMS_ICC */
#ifdef __IAR_SYSTEMS_ASM //only include by asm module
// add asm definitions here
//*************************func.h***********************************************
#include "func.h"
non_banked int func(int a, int b, int c)
{
return a+b+c;
}