• Power C/asm: returning a value from assembler function?

    From Harry Potter@3:770/3 to All on Thu Dec 5 17:07:58 2019
    I have Power C and am wondering: I have information on interfacing C with assembler, but it doesn't show how to return a value from an assembler function. How do I do that?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Computer Nerd Kev@3:770/3 to Harry Potter on Fri Dec 13 20:51:23 2019
    Harry Potter <rose.joseph12@yahoo.com> wrote:
    I have Power C and am wondering: I have information on interfacing
    C with assembler, but it doesn't show how to return a value from
    an assembler function. How do I do that?

    Given that nobody with specific knowledge of Power C has replied,
    I'll at least say that generally C compilers use the stack for
    passing values to/from functions. To return a value, you push the
    byte/s on inside the assembly part, then the compiler will pop them
    out when it's at the helm.

    This implementation is all specific to the compiler though, so you
    want to look at the Power C documentation for a real answer including
    the specifics of how the stack is used.

    --
    __ __
    #_ < |\| |< _#

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Harry Potter@3:770/3 to Computer Nerd Kev on Sat Dec 14 05:03:35 2019
    On Friday, December 13, 2019 at 3:51:27 PM UTC-5, Computer Nerd Kev wrote:
    Given that nobody with specific knowledge of Power C has replied,
    I'll at least say that generally C compilers use the stack for
    passing values to/from functions. To return a value, you push the
    byte/s on inside the assembly part, then the compiler will pop them
    out when it's at the helm.

    This implementation is all specific to the compiler though, so you
    want to look at the Power C documentation for a real answer including
    the specifics of how the stack is used.

    Computer Nerd Kev, I thank you for your response. The manual doesn't give any information on using assembler with C. I have the information on linking C to Assembler, but it doesn't give any information on returning a value from an Assembler function.
    :( I'm looking again in case there's something I missed.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Harry Potter@3:770/3 to Harry Potter on Sat Dec 14 05:13:26 2019
    On Saturday, December 14, 2019 at 8:03:36 AM UTC-5, Harry Potter wrote:
    Computer Nerd Kev, I thank you for your response. The manual doesn't give
    any information on using assembler with C. I have the information on linking C to Assembler, but it doesn't give any information on returning a value from an Assembler function.
    :( I'm looking again in case there's something I missed.

    I didn't find it. :(

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Harry Potter@3:770/3 to Harry Potter on Sat Dec 14 05:17:02 2019
    On Saturday, December 14, 2019 at 8:13:27 AM UTC-5, Harry Potter wrote:
    I didn't find it. :(

    I found it. :) Sorry for wasting your time. :(

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)