易截截图软件、单文件、免安装、纯绿色、仅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/C++面试题(三)

1) 什么是预编译,何时需要预编译:总是使用不经常改动的大型代码体。
程序由多个模块组成,所有模块都使用一组标准的包含文件和相同的编译选项。在这种情况下,可以将所有包含文件预编译为一个预编译头。
2) char * const p;
  char const * p
  const char *p ......

经典C/C++面试题(四)

(五)
40. 链表题:一个链表的结点结构
struct Node
{
int data ;
Node *next ;
};
typedef struct Node Node ;
(1)已知链表的头结点head,写一个函数把这个链表逆序 ( Intel)
Node * ReverseList(Node *head) //链表逆序
{
i ......

关于C的思考


关于C的思考
Cong Wang
May, 2006
Network Engineering Department
Institute of Post and Telecommunications, Xi'an, P.R.China
引言
    C语言结合了汇编的所有威力,它的抽象程度碰巧既满足了程序员的要求, 又容易实现。因其独特的灵活性和强大的可移植性,系统程序员和黑客们更是对它钟爱 ......

ARM第一个项目中关于C的总结

1:每一个变量在使用前都得声明,不然在使用的时候就有可能是随机的数字
2:注意头文件中函数声明的时候要在后面加上分号
3:注意串口可以打印变量,就像C中的printf一样
4:DNW中不能打印float型数据
5:注意结构体指针数组 的使用和调用
6: ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号