Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/24/99 08:52
Read: times


 
#1002 - RE: How to pass parameter from C to Assembler
David,

the compiler make the rules and know, how to say it to the linker.
So its the best, you declare your assembler functions in C and
generate an assembler output.
Then you can see, how you must pass the parameters
and also the naming conventions for the linker.
And then you can insert your assembler code.
Following an example.
Compile it and then look at "test.a51".

Peter



// generate assembler output:
#pragma src(test.a51)

#include <stdio.h>

// define parameters and return value of the assembler function:
// include this line to call the assembler function from C
char asm_function( unsigned long p1, char idata *p2 );


char asm_function( unsigned long p1, char idata *p2 )
{
// define variables:
char idata asm_vars[10];

// use variables to avoid warning messages:
asm_vars[1] = 0xAA;

// use parameters to avoid warning messages:
p1++;
p2[5] = 0;

// call C functions:
printf("Test: %l %sn", 0x12345678L, "text" );

// use return value to avoid warning messages:
return 0xAA;
}


List of 3 messages in thread
TopicAuthorDate
How to pass parameter from C to Assembler            01/01/70 00:00      
RE: How to pass parameter from C to Assembler            01/01/70 00:00      
RE: How to pass parameter from C to Assembler            01/01/70 00:00      

Back to Subject List