易截截图软件、单文件、免安装、纯绿色、仅160KB

C51: MIXING C AND ASSEMBLY

以下全文转载自http://www.keil.com/support/docs/1671.htm                     Copyright © 2010 Keil™, An ARM® Company.
Information in this article applies to:
C51 Version 6.02
µVision Version 2.06
QUESTION
Do you have any examples of how to mix C and assembly?
ANSWER
The following example program shows how to mix C and assembly in your 8051 programs.
This example starts with a MAIN C function which calls a routine in assembly which then calls a C function.
The MAIN C module appears as follows:
extern void a_func (void);
void main (void)
{
a_func ();
}
The function a_func is an assembly routine:
NAME A_FUNC
?PR?a_func?A_FUNC SEGMENT CODE
EXTRN CODE (c_func)
PUBLIC a_func
RSEG ?PR?a_func?A_FUNC
a_func:
USING 0
LCALL c_func
RET
END
Note that this assembly routine calls c_func which is a C function:
void c_func (void)
{
}
The actual code for the assembly module was generated using the SRC pragma and the following C source file:
extern void c_func (void);
void a_func (void)
{
c_func ();
}
You may download C2ASM2C.ZIP from the Keil web site.
Permission to use documents and related graphics available from this server ("Server") is granted, provided that (1) the below copyright notice appears in all copies and that both the copyright notice and this permission notice appear, (2) use of documents and related graphics available from this Server is for informational and non-commercial or personal use only, (3) no documents or related graphics, including logos, available from this Server are modified in any way, and (4) no graphics, including logos, available from this Server are used separate from accompanying text. Use for any other purpose is expressly prohibited by law, and may result in severe civil and criminal penalties. Violators will be


相关文档:

用C写的3D迷宫

          Boss说,要看OpenGL,看了快一个月,总算出了个像样的东西,用C写了个3D迷宫,
虽然只有350行
       代码,不过边学边写,足足写了一周时间,还是小有成就感的,活活活!
         &n ......

经典C/C++面试题(三)2

32)
  int main()
  {
   int x=3;
   printf("%d",x);
   return 1;
  }
  问函数既然不会被其它函数调用,为什么要返回1?
  mian中,c标准认为0表示成功,非0表示错误。具体的值是某中具体出错信息
33) 要对绝对地址0x100000赋值,我们可以用(unsigned int*)0x100 ......

【入门】用Linux中man命令查询C函数

      大家都知道在Unix/Linux中有个man命令,可以查询常用的命令,函数。可是对于我们这样只知道用"man 函数名"来查询的人来说,会遇到很多问题,比如:
      man read,我想看的是ANSI C中stdio的read函数原型和说明,没想到出来的确是BASH命令的说明,这是怎么回事 ......

Pro*C对inner join的支持情况

整理自:http://forums.oracle.com/forums/thread.jspa?threadID=664180&tstart=0
问:Is it possible to use INNER JOIN's with Pro*C? I'm currently getting this error:
INNER JOIN t_diagnosis b ON a.sak_diag = b.sak_diag
....1
PCC-S-02201, Encountered the symbol "INNER" when expecting on ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号