Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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++ÃæÊÔÌ⣨¶þ£©

char str1[] = "abc";
char str2[] = "abc";
const char str3[] = "abc";
const char str4[] = "abc";
const char* str5 = "abc";
const char* str6 = "abc";
cout << boolalpha&nb ......

C±à³ÌʵÏÖhttpЭÒé


´ó¼Ò¶¼ºÜÊìϤHTTPЭÒéµÄÓ¦Óã¬ÒòΪÿÌ춼ÔÚÍøÂçÉÏä¯ÀÀ×Ų»ÉÙ¶«Î÷£¬Ò²¶¼ÖªµÀÊÇHTTPЭÒéÊÇÏ൱¼òµ¥µÄ¡£Ã¿´ÎÓÃthunderÖ®ÀàµÄÏÂÔØÈí¼þÏÂÔØÍøÒ³£¬µ±Óõ½ÄǸö“ÓÃthunderÏÂÔØÈ«²¿Á´½Ó”ʱ×ܾõµÃºÜÉñÆæ¡£
ºóÀ´ÏëÏ룬ÆäʵҪʵÏÖÕâЩÏÂÔع¦ÄÜÒ²²¢²»ÄÑ£¬Ö»Òª°´ÕÕHTTPЭÒé·¢ËÍrequest£¬È»ºó¶Ô½ÓÊÕµ½µÄÊý¾Ý½øÐзÖÎö£¬Èç¹ûÒ ......

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ºÅ