Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C51: CALLING ASSEMBLY ROUTINES from C

ÒÔÏÂÈ«ÎÄתÔØ×Ôhttp://www.keil.com/support/docs/50.htm                            Copyright © 2010 Keil™, An ARM® Company.
Information in this article applies to:
C51 All Versions
QUESTION
In the C51 compiler manual, there is example of an assembly module calling a C function. Is there any example of a C program calling an assembly routine?
ANSWER
There are no examples in the book, but it is easy to create your own. The asm routine must know how parameters are passed, values returned, and the naming conventions of segments. The steps you must follow to create an example are outlined below:
Write a simple function in C that passes parameters and returns values the way you want your assembly routine to.
Use the SRC directive (#PRAGMA SRC at the top of the file) so that the C compiler generates a .SRC file instead of a .OBJ file.
Compile the C file. Since the SRC directive was specified, the .SRC file is generated. The .SRC file contains the assembly code generated for the C code you wrote.
Rename the .SRC file to a .A51 file.
Edit the .A51 file and insert the assembly code you want to execute into the body of the assembly function shell included in the .A51 file.
For example, the following code
#pragma SRC
unsigned char my_assembly_func (
unsigned int argument)
{
return (argument + 1); // Insert dummy lines to access all args and retvals
}
when compiled generates the following assembly SRC file.
NAME TESTCODE
?PR?_my_assembly_func?TESTCODE SEGMENT CODE
PUBLIC _my_assembly_func
; #pragma SRC
; unsigned char my_assembly_func (
RSEG ?PR?_my_assembly_func?TESTCODE
USING 0
_my_assembly_func:
;---- Variable 'argument?040' assigned to Register 'R6/R7' ----
; SOURCE LINE # 2
; unsigned int argument)
; {


Ïà¹ØÎĵµ£º

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 ......

Ïê½âCÅÌWindowsÎļþ¼ÐÀïÖØÒªÎļþµÄ×÷ÓÃ

Ïê½âCÅÌWindowsÎļþ¼ÐÀïÖØÒªÎļþµÄ×÷Óà
ÔÚÕû¸öWindows²Ù×÷ϵͳÖУ¬×îÖØÒªµÄĪ¹ýÓÚ“Windows”Îļþ¼Ð£¬¶ÔµçÄÔ½øÐÐÈκβÙ×÷¼¸ºõ¶¼Óйء£Á˽âÕâÀï¶ÔÓÚÕÆÎÕÕû¸öϵͳµÄÔË×÷ÓкܴóµÄ×÷Óã¬Èç¹ûÓÐÐËȤ²»·ÁÍùÏ¿´¿´¡£
Ò»¡¢Ó¡ÏóÖеÄWindowsÎļþ¼Ð
“Windows”Îļþ¼Ð¸øÈ˵ĵÚÒ»Ó¡Ïó¾ÍÊÇ´ó¶øÂÒ£¬¸Ð¾õÀïÃæ ......

ARMµÚÒ»¸öÏîÄ¿ÖйØÓÚCµÄ×ܽá

1£ºÃ¿Ò»¸ö±äÁ¿ÔÚʹÓÃÇ°¶¼µÃÉùÃ÷£¬²»È»ÔÚʹÓõÄʱºò¾ÍÓпÉÄÜÊÇËæ»úµÄÊý×Ö
2£º×¢ÒâÍ·ÎļþÖк¯ÊýÉùÃ÷µÄʱºòÒªÔÚºóÃæ¼ÓÉÏ·ÖºÅ
3£º×¢Òâ´®¿Ú¿ÉÒÔ´òÓ¡±äÁ¿£¬¾ÍÏñCÖеÄprintfÒ»Ñù
4£ºDNWÖв»ÄÜ´òÓ¡floatÐÍÊý¾Ý
5£º×¢Òâ½á¹¹ÌåÖ¸ÕëÊý×é µÄʹÓú͵÷ÓÃ
6£º ......

c/c++ʵÏÖÒ»¸öÃܼ¯ÐÍserver/socket¶à·¸´ÓÃselect


×÷Ò»¸ötcpµÄ·þÎñ³ÌÐò£¬Í¬Ê±¿ÉÄÜÓдóÁ¿µÄ¿Í»§¶ËÁ¬ÉÏÀ´£¬Ï£Íû·Ö±ð¼Çס¸÷¸ösocket
Ë­ÓÐÊý¾Ý¹ýÀ´£¬¾Í¶Á³öÀ´£¬·Åµ½Ò»¸öÇëÇó¶ÓÁУ­£­ÕâЩÊÂÇéÓÃÒ»¸öÏß³ÌÍê³É
 
ÁíÍâÓÐÒ»¸ö½á¹û¶ÓÁУ¬Èç¹û½á¹ûÀï°üº¬ÁËsocketµÄ±àºÅ£¬ÓÃÒ»¸öÏß³ÌרÃÅ£º
È¡³öÀ´°´±àºÅÕÒ»ØÔ­À´·¢ËÍÕßsocket£¬·¢»Ø¸øÔ­À´µÄ¿Í»§¶Ë
 
»¹ÓÐÒ»¸ö¾ÍÊÇ´¦ÀíÏ ......

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