Discussion:
Power C/asm: returning a value from asse
(too old to reply)
K-Guide
2019-12-13 15:39:15 UTC
Permalink
On Sat 14-Dec-2019 5:17a, Harry ***@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
Harry Potter
2019-12-14 16:48:02 UTC
Permalink
Post by K-Guide
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?
K-Guide
2019-12-14 04:10:07 UTC
Permalink
On Sat 14-Dec-2019 8:48a, Harry ***@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
Harry Potter
2019-12-15 01:03:23 UTC
Permalink
Post by K-Guide
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.
K-Guide
2019-12-14 20:01:21 UTC
Permalink
On Sat 14-Dec-2019 5:03p, Harry ***@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
Harry Potter
2019-12-16 00:21:23 UTC
Permalink
Admittedly, I'm not currently using Power C but am working on special support for it. I also want to create some libraries for it, and some of those functions are better off in Assembler.
Ed Vance
2019-12-27 09:33:00 UTC
Permalink
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: <***@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.
K-Guide
2019-12-15 08:45:21 UTC
Permalink
That cool your working to expand Power C. I have considered doing some C level
programming on the C64 via cc65, but never got around to it.

[+] K-Guide
Harry Potter
2019-12-28 16:20:30 UTC
Permalink
Try https://www.lyonlabs.org/commodore/onrequest/powerc/index.html. :)
Ed Vance
2019-12-29 07:46:00 UTC
Permalink
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: <***@capitolcityonline.net>
HP> Try https://www.lyonlabs.org/commodore/onrequest/powerc/index.html. :)

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?!
Harry Potter
2020-01-04 12:25:51 UTC
Permalink
Post by Ed Vance
Thanks for finding a URL I could get the POWER C Manual from.
I noticed there were some Downloads in D64 format.
Good. :)
Post by Ed Vance
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. :)
Ed Vance
2020-01-05 08:16:00 UTC
Permalink
01-04-20 04:25 Harry Potter wrote to Ed Vance about Re: Power C/asm: returnin
Howdy! Again Harry,
Post by Ed Vance
Thanks for finding a URL I could get the POWER C Manual from.
I noticed there were some Downloads in D64 format.
HP> Good. :)
Post by Ed Vance
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...

Loading...