[Coco] Second eyes needed for C to ASM ABI strangeness.

Walter Zambotti zambotti at iinet.net.au
Wed Oct 23 02:13:39 EDT 2019


In following code where I call two shift functions. One written in C and the
other 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 2

2 0

 

If I change:

 

val2 = shiftasm(val, shft);

 

to:

 

val2 = 0 + shiftasm(val, shft);

 

Then the output is:

 

2 2

2 2

 

Which is now correct.

 

It appears I cannot directly assign the output of my asm function directly
to 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

 

 



More information about the Coco mailing list