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)
; {
相关文档:
整理自: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的思考
Cong Wang
May, 2006
Network Engineering Department
Institute of Post and Telecommunications, Xi'an, P.R.China
引言
C语言结合了汇编的所有威力,它的抽象程度碰巧既满足了程序员的要求, 又容易实现。因其独特的灵活性和强大的可移植性,系统程序员和黑客们更是对它钟爱 ......
刚从网上看到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 ......
--摘自 《Oracle Pro*C 程序开发》 --Create/Modify Email:xingchengli@gmail.com
SQLDA 的结构如下:
struct SQLDA
{
long N; /* Descriptor size in number of entries */
char **V; Ptr to Arr of addresses of main variables */
long *L; /* Ptr to Arr of lengths of buffe ......
以下全文转载自http://www.keil.com/support/docs/697.htm Copyright © 2010 Keil™, An ARM® Company.
Information in this article applies to:
C51 Versio ......