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

including asssembly instruction in c program

How to include a single or few assembly instructions in the c program without using function call?

Parents Reply Children

  • ... instead of directly jumping to a specific route to solving the problem


    www.catb.org/.../smart-questions.html

  • I have used #pragma asm <assembly code> #pragma endasm
    but the c code following this is not running,what might be the problem?
    I want to include org 0x00 sjmp 0x30 org 0x30
    in the c program inorder to set the origin address of c program to 0x30.So i wanted to include assembly instructions in c program.Are there any other method of set the origin address of c program.

  • My problem is, in assembly language we can make use of the org directive to set the origin address of the program to a particular address location in program memory but how to achieve the same using c? I am using core8051 and i want to start the program hex file to be stored from a particular location leaving enough space for the interrupt vector table.I hope you understood the problem.

  • i want to start the program hex file to be stored from a particular location leaving enough space for the interrupt vector table.
    if the code occupies the space after the vector table, why do you care whare it starts?

  • My problem is, in assembly language we can make use of the org directive to set the origin address of the program to a particular address location in program memory but how to achieve the same using c?

    No, that's not actually your problem. Your problem is that you're trying to program C as if it was exactly the same as assembler. Well, it's not ... and if it were, there would be no point in even having C.

    Just because you can (or even must) do something in assembly doesn't mean you have to do it in C, too.