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

A51 help!

Hi,

I need to be able to call a c function from within the STARTUP.A51 file (actually, any *.a51 file), so that the code listing has the startup code, then the call of this new function, then the LJMP to main.

I imagine this will involve 'exporting' the C function name (label), and using this label as an operand of the asm CALL
instruction, but I can't seem to figure out how to do this.

I'd also be really interested if someone can suggest a more readily understandable assembler manual than the A51 user guide...

Thanks for any suggestions!

David

Parents
  • You are right: startup.a51 does not call main; instead, it calls Keil's 'C' initialisation stuff, which then calls main.

    ?c_start is the entry point for Keil's 'C' initialisation stuff.

    Back to your original question, you need to read the section Interfacing C Programs to Assembler in Chapter 6 of the C51 User Guide.

    You could also look at the Assembler listing from C51 - that'll show you how 'C' functions are called in Assembler!

    In fact, this is often a good way to start a mixed 'C'+Assembler project - write the "skeleton" in 'C', then work on the generated Assembler.

Reply
  • You are right: startup.a51 does not call main; instead, it calls Keil's 'C' initialisation stuff, which then calls main.

    ?c_start is the entry point for Keil's 'C' initialisation stuff.

    Back to your original question, you need to read the section Interfacing C Programs to Assembler in Chapter 6 of the C51 User Guide.

    You could also look at the Assembler listing from C51 - that'll show you how 'C' functions are called in Assembler!

    In fact, this is often a good way to start a mixed 'C'+Assembler project - write the "skeleton" in 'C', then work on the generated Assembler.

Children
No data