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

use c variables in inline assembly

main()
{ char a[10]="srikanth";

//----assembly code starts.....

//--------asm ends.........
// c code

}

Parents Reply Children
  • The name of the segment used for local variables varies depending on the memory model (and thus the type of memory used for locals). See the "Advanced Programming / Segment Naming Conventions / Parameters and Local Variables" section of the Cx51 manual.

    Small: ?DT?function_name?module_name
    Large: ?XD?function_name?module_name

    Variables are stored in this segment in order of declaration.

    All that said, I agree with the earlier advice: just write the function in assembler and link it. Intermixing assembly code with a high-level language just isn't worth the development headache and maintenance traps.