易截截图软件、单文件、免安装、纯绿色、仅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 ......

语言混编之java调用c dll jni技术小试

刚从网上看到c和java混编的文章,就亟不可待的尝试了一下。呵呵,效果还是很好的。下面将自己成果粘贴出来
(转载于http://www.zxbc.cn/html/20070518/19986.html)。实验之后可以通过。
1java中调用c语言
首先编写Main.java
public class Main 
{
 public native static int getStrNum(byte str[], int s ......

语言混编之c调用java

经过验证可以实现,先将实现代码贴出,以备以后使用。
本文默认你的java开发环境已经安装成功,并且对于java语言和c++语言有过了解。
编写测试用类:Demo.java
代码如下:
public class Demo
{
 public static int COUNT = 8;
 
 private String msg;
 private int[] counts;
 
  ......

A51: CALLING C FUNCTIONS from ASSEMBLY

以下全文转载自http://www.keil.com/support/docs/697.htm                       Copyright © 2010 Keil™, An ARM® Company.
Information in this article applies to:
C51 Versio ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号