[Coco] Second eyes needed for C to ASM ABI strangeness.
Walter Zambotti
zambotti at iinet.net.au
Mon Oct 28 02:42:56 EDT 2019
Yes.
I have posted my code on another thread in this list.
Regards
Walter
-----Original Message-----
From: Coco [mailto:coco-bounces at maltedmedia.com] On Behalf Of Joel Rees
Sent: Saturday, 26 October 2019 11:19 AM
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Subject: Re: [Coco] Second eyes needed for C to ASM ABI strangeness.
So Walter, have you got anywhere with this?
2019年10月23日(水) 15:39 lost <lost at l-w.ca>:
> Looks like you may have an issue with value sizes and maybe endianness.
> You haven't included enough information though. We need to know what
> you declared the functions as. Particularly the return types. If you
> haven't declared the asm one, its return type will default to int
> which is probably half the size of long. Depending on endianness and
> calling convention that could mean the high order bits are saved in
> the variable instead of the low order bits. The other cases may only
> be working properly accidentally due to an accident of register allocation or something.
> -------- Original message --------From: Walter Zambotti <
> zambotti at iinet.net.au> Date: 2019-10-23 00:13 (GMT-07:00) To:
> 'CoCoList for Color Computer Enthusiasts' <coco at maltedmedia.com>
> Subject: [Coco] Second eyes needed for C to ASM ABI strangeness. In
> following code where I call two shift functions. One written in C and theother in assembly (both
> functions not shown): long val, val1, val2;short shft; printf("%ld
> %ld\n", shift(val, shft), shiftasm(val, shft)); val1 = shift(val,
> shft);
> val2 = shiftasm(val, shft); printf("%ld %ld\n", val1, val2); where
> val = 1 and shft = 1; outputs the following: 2 22 0 If I change: val2
> = shiftasm(val, shft); to: val2 = 0 + shiftasm(val, shft); Then the
> output
> is: 2 22 2 Which is now correct. It appears I cannot directly assign
> the output of my asm function directlyto a variable without having
> some sort of temporary expression such as "0 +"or passed to another
> function such as printf. So I'm not sure what the C to asm ABI should
> be! Any ideas? Walter
> -- Coco mailing listCoco at maltedmedia.comhttps://
> pairlist5.pair.net/mailman/listinfo/coco
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>
--
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco
More information about the Coco
mailing list