Hi, I'm new to this newsgroup, however I am continuing work on a
project that Jeremy Wade started. He has posted a few questions to
this group before.
We are designing a cross compiler for the HC12, gcc that compiles C
which interacts with forth. Our compiler requires that items get
pushed to the stack in quantities of 2 bytes, which works just fine.
My problem arises when I call a function with a char. The assembly
generated is this:
ldab #7
pshb
des
The problem is that when forth comes and looks at the stack, it
doesn't know that a char was pushed, and looks at both bytes. The
"des" instruction leaves junk in the upper byte, instead of 0. I want
the asm to look something like: (assembly created for ints)
ldd #7
pshb
psha
I have been editing the gcc/config/m68hc11/m68hc11.h file, and I have
the following options:
#define WCHAR_TYPE "short int"
#define WCHAR_TYPE_SIZE 16
#define PROMOTE_PROTOTYPES 1
#define PROMOTE_FUNCTION_ARGS 1 //not sure about this one
Does anybody know how to force the promotion of char to int when
calling functions? Somehow I'm getting something wrong. Thank you
very much for your time.
-Ben