|
Re: Power C/asm: returning a value from assembler function? [message #389269 is a reply to message #389107] |
Fri, 13 December 2019 15:51 |
not
Messages: 73 Registered: February 2013
Karma: 0
|
Member |
|
|
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.
--
__ __
#_ < |\| |< _#
|
|
|
Re: Power C/asm: returning a value from assembler function? [message #389283 is a reply to message #389269] |
Sat, 14 December 2019 08:03 |
Harry Potter
Messages: 1304 Registered: March 2012
Karma: 0
|
Senior Member |
|
|
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.
|
|
|
Re: Power C/asm: returning a value from assembler function? [message #389284 is a reply to message #389283] |
Sat, 14 December 2019 08:13 |
Harry Potter
Messages: 1304 Registered: March 2012
Karma: 0
|
Senior Member |
|
|
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. :(
|
|
|
|
Re: Power C/asm: returning a value from asse [message #389286 is a reply to message #389107] |
Fri, 13 December 2019 10:39 |
|
Originally posted by: nospam.K-Guide
On Sat 14-Dec-2019 5:17a, Harry Potter@3:770/3.0 said to Harry Potter:
HP> I found it. :) Sorry for wasting your time. :(
It is never a waste of time to ask a question, especially in a public forum as
others do learn from the dialog. You never know when a simple questions that
has been asked before may spark insights or the imagination of the other
readers.
In your case, I am now courious how Power C does handle passing arguments and
the return value from a function in assembler?
[+] K-Guide
|
|
|
Re: Power C/asm: returning a value from asse [message #389287 is a reply to message #389286] |
Sat, 14 December 2019 11:48 |
Harry Potter
Messages: 1304 Registered: March 2012
Karma: 0
|
Senior Member |
|
|
On Saturday, December 14, 2019 at 11:41:28 AM UTC-5, K-Guide wrote:
> On Sat 14-Dec-2019 5:17a, Harry Potter@3:770/3.0 said to Harry Potter:
> HP> I found it. :) Sorry for wasting your time. :(
>
> It is never a waste of time to ask a question, especially in a public forum as
> others do learn from the dialog. You never know when a simple questions that
> has been asked before may spark insights or the imagination of the other
> readers.
>
> In your case, I am now courious how Power C does handle passing arguments and
> the return value from a function in assembler?
>
> [+] K-Guide
It seems that I have to pass the return value in the TOS, but what if the function has no parameters or too few parameters?
|
|
|
Re: Power C/asm: returning a value from asse [message #389296 is a reply to message #389107] |
Fri, 13 December 2019 23:10 |
|
Originally posted by: nospam.K-Guide
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
|
|
|
Re: Power C/asm: returning a value from asse [message #389297 is a reply to message #389296] |
Sat, 14 December 2019 20:03 |
Harry Potter
Messages: 1304 Registered: March 2012
Karma: 0
|
Senior Member |
|
|
On Saturday, December 14, 2019 at 7:17:21 PM UTC-5, K-Guide wrote:
> 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.
>
The docs. I have reveal that the return value seems to overwrite the last parameter passed to the function. That's why I am worried about the too few parameters.
|
|
|
Re: Power C/asm: returning a value from asse [message #389314 is a reply to message #389107] |
Sat, 14 December 2019 15:01 |
|
Originally posted by: nospam.K-Guide
On Sat 14-Dec-2019 5:03p, Harry Potter@3:770/3.0 said to K-Guide:
HP> The docs. I have reveal that the return value seems to overwrite the last
HP> parameter passed to the function. That's why I am worried about the too
HP> few parameters.
Ahhh. That does seem odd as I would have though the assember routine would
pull from the stack each of its parameters. Sounds like some small prototype
code is needed to test this out and determine how this works.
Are you writing the assembler fuctions or just the C portion of the code?
[+] K-Guide
|
|
|
|
|
Re: Power C/asm: returnin [message #389526 is a reply to message #389319] |
Fri, 27 December 2019 04:33 |
|
Originally posted by: nospam.Ed.Vance
12-15-19 16:21 Harry Potter wrote to All about Re: Power C/asm: returnin
Howdy! Harry,
Did the box Spinnaker BetterWorking Power C for C=64 and C=128 comes in
have a Book/Manual with the Disks?
I have the Disks but have looked for the Book but can't find it.
If there is a Book I sure misplaced it.
On Side 2 of the Power C Disk is a PRG called Instructions, but it only
mentions how to use the Terminal PRG.
I looked at the Index on Zimmers.net to see if there was anything about
the Power C software but didn't find any thing.
I Searched for the words "Spinnaker" "Power C" "book" and saw some sites
that had info but Avast (the Anti-Virus I use) put a Grey mark
(instead of a Green mark) next to some of them so I haven't visited those.
Would You know of any web sites I could look at?
I posted a message to You mentioning the Addresses the Power C PRG files use.
Did You see that message?
73 de Ed W9ODR . .
HP> @MSGID: <5DF701CC.3386.cbm@capitolcityonline.net>
HP> Admittedly, I'm not currently using Power C but am working on special
HP> support for it. I also want to create some libraries for it, and some
HP> of those functions are better off in Assembler.
HP> --- SoupGate-Win32 v1.05
HP> * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway
HP> (3:770/3)
.... North to south is all downhill. Just look at a globe.
|
|
|
|
Re: Power C/asm: returnin [message #389529 is a reply to message #389528] |
Sun, 29 December 2019 02:46 |
|
Originally posted by: nospam.Ed.Vance
12-28-19 08:20 Harry Potter wrote to All about Re: Power C/asm: returnin
Howdy! Harry,
Thanks for finding a URL I could get the POWER C Manual from.
I noticed there were some Downloads in D64 format.
I use a XP computer for the internet and could download those files and
Save them on a 720KB disk and then use the MSDOS64 PRG and the 1581 drive
to Save them to a 1541 disk with the C=64 PC.
That PRG is slow and I wonder if You have a suggestion for another PRG
I could download from the Zimmers Net website?
Thanks Again and 73 de Ed W9ODR . .
HP> @MSGID: <5E07B4A8.3423.cbm@capitolcityonline.net>
HP> Try https://www.lyonlabs.org/commodore/onrequest/powerc/index.ht ml. :)
HP> --- SoupGate-Win32 v1.05
HP> * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway
HP> (3:770/3)
.... Have you checked your smoke detector batteries & Fire Ext, LATELY?!
|
|
|
Re: Power C/asm: returnin [message #389537 is a reply to message #389529] |
Sat, 04 January 2020 07:25 |
Harry Potter
Messages: 1304 Registered: March 2012
Karma: 0
|
Senior Member |
|
|
On Sunday, December 29, 2019 at 11:11:39 PM UTC-5, Ed Vance wrote:
> Thanks for finding a URL I could get the POWER C Manual from.
>
> I noticed there were some Downloads in D64 format.
>
Good. :)
> That PRG is slow and I wonder if You have a suggestion for another PRG
> I could download from the Zimmers Net website?
>
Try the Zoomfloppy device. You should be able to find it using Google. :)
|
|
|
Re: Power C/asm: returnin [message #389545 is a reply to message #389537] |
Sun, 05 January 2020 03:16 |
|
Originally posted by: nospam.Ed.Vance
01-04-20 04:25 Harry Potter wrote to Ed Vance about Re: Power C/asm: returnin
Howdy! Again Harry,
HP> @MSGID: <5E10B6FA.3433.cbm@capitolcityonline.net>
HP> On Sunday, December 29, 2019 at 11:11:39 PM UTC-5, Ed Vance wrote:
> Thanks for finding a URL I could get the POWER C Manual from.
>
> I noticed there were some Downloads in D64 format.
>
HP> Good. :)
> That PRG is slow and I wonder if You have a suggestion for another PRG
> I could download from the Zimmers Net website?
>
HP> Try the Zoomfloppy device. You should be able to find it using Google.
HP> :)
Another person told me about the Zoomfloppy device and I did read some about
it after that.
Thanks, 73 de Ed W9ODR . .
.... There is always one more thing for Me to learn...
|
|
|