home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.sys.cbm      Discussion about Commodore micros      53,866 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 52,884 of 53,866   
   K-Guide to Harry   
   Re: Power C/asm: returning a value from    
   14 Dec 19 17:10:07   
   
   From: nospam.K-Guide@f230.n130.z1.binkp.net   
      
   On Sat 14-Dec-2019  8:48a, Harry Potter@3:770/3.0 said to K-Guide:   
   HP> It seems that I have to pass the return value in the TOS, but what if the   
   HP> function has no parameters or too few parameters?   
      
   Using the stack makes alot of since for the return value of the assembler   
   function.  In the case of no parameter, I suspect you can just call the routine   
   via a function pointer in C. Set that to the address of your assembler routine   
   and call the function.  Please bear in mind I am not a Power C programmer, but   
   am just guessing based on other platforms I program on.  If you have parameters   
   there could be some documemtation on how to pass them via registers in the   
   compiler docs.  Compilers seem to have their own style for stuff like that.  It   
   also could be that you just need to drop the values into a certain memory   
   location as the assember routine expects it there.   
      
   Not sure I follow you about the too few parameters.   
      
   [+] K-Guide   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca