You can easily interface C51 to routines written in 8051 Assembler. The A51 Assembler from Franklin Software, Inc. is an 8051 macro assembler that emits object modules in OMF-51 format. By observing a few programming rules, you can call assembly routines from C and vice versa. Public variables declared in the assembly module are available to your C programs.
There are several reasons why you might want to call an assembly routine from your C program. You may have assembly code already written that you wish to use, you may need to improve the speed of a particular function, or you may want to manipulate SFRs or memory-mapped I/O devices directly from assembly. This section describes how to write assembly routines that can be directly interfaced to C programs.
For an assembly routine to be called from C, it must be aware of the parameter passing and return value conventions used in C functions. For all practical purposes, it must appear to be a C function.