Search the web
Sign In
New User? Sign Up
gnu-m68hc11 · GNU 68HC11/HC12
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
promote char to int   Message List  
Reply | Forward Message #9241 of 9422 |
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




Fri Sep 5, 2008 12:25 am

esromneb
Offline Offline
Send Email Send Email

Forward
Message #9241 of 9422 |
Expand Messages Author Sort by Date

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...
esromneb
Offline Send Email
Sep 5, 2008
12:25 am

... No, your problem is not likely with the compiler, nor likely is it with the receiving routine, as you seem to think. ... Your problem likely is that you do...
Mike McCarty
Mike.McCarty@...
Send Email
Sep 5, 2008
12:56 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help