We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
How can I create an assembly function? How can I call it from c? Thanx..
How can this be resolved? by following the following suggestion TO THE LETTER The simplest way to create a C-callable assembly file, is to start with an outline in 'C', then let the compiler turn it into assembly source by using the SRC directive - see the Manual Erik
Assembly language has an "ORG" directive that tells the assembler where the instructions are located. It also lets you declare "segments" to put your code into so that the linker can relocate them. Without the benefit of these mechanisms, your code will go at address 0000h, where it conflicts with the restart vector. Take a look at some of the example assembly to see how this works. Or, as Erik suggests, use the SRC directive and have the compiler generate a sample file from C that actually does what you want.
"use the SRC directive and have the compiler generate a sample file from C that actually does what you want." As I said before, if you let the compiler do it, you can be certain that the compiler will generate code using all the correct conventions for 'C'-compatibility!