This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

creating assembly functions

How can I create an assembly function?

How can I call it from c?

Thanx..

Parents Reply Children
  • 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!