SW006010 Microchip Technology, SW006010 Datasheet - Page 73

no-image

SW006010

Manufacturer Part Number
SW006010
Description
MPLAB 17C SOFTWARE
Manufacturer
Microchip Technology
Datasheets

Specifications of SW006010

Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC17C
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
MPLAB®
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
8.6
 2002 Microchip Technology Inc.
USING IN-LINE ASSEMBLY LANGUAGE
The following example shows how to call an assembly function with a parameter.
These example files may be found in
the compiler install directory.
Most of the work is done in the file
the software stack.
call_c.c
// File call_c.c
unsigned char asm_function( auto unsigned char a );
unsigned char x;
void main( void )
{
}
call_asm.asm
; File call_asm.asm
MYCODE CODE
asm_function
x = asm_function( 0xff );
LIST P=17C756
EXTERN _stack
GLOBAL asm_function
banksel _stack
movfp
decf
movfp
decf
movwf
return
END
Mixing Assembly Language and C Modules
; The convention is that we return
; with FSR0 pointing at the return value.
; allocated for the argument since we're already
; pointed there.
; We'll just reuse the space
_stack, 0x01
0x01, f
0x00, 0x0a
0x0a, f
0x00
call_c.c
; Store the return value
; Get the stack pointer into 0x00
; Point FSR1 at the argument
; Get the argument
calls the
call_asm.asm
c:\mcc\examples\example3
asm_function
where the parameter is taken off of
with a parameter.
, where
apRNOVM^-page 67
c:\mcc
is
Part
Part
Part
Part
1
2
3
4

Related parts for SW006010