| | Re: H8/300 Assembler/C interface
|
|
(...) Somebody correct me if I'm wrong. I just compiled some programs to check this. I believe that maybe the *ROM* calling convection is as Ralph described, but almost definitely the GCC calling convention is: - r0, r1, r2 hold parameters from left (...) (24 years ago, 18-Apr-01, to lugnet.robotics.rcx)
|
|
| | Re: H8/300 Assembler/C interface
|
|
(...) Also: - caller cleans up parameters on stack - stack pointer is r7 The caller must clean up stack parameters b/c the return address is pushed after parameters are. -Kekoa (24 years ago, 18-Apr-01, to lugnet.robotics.rcx)
|
|
| | RE: H8/300 Assembler/C interface
|
|
(...) Not necessarily, that's why I'm asking. If the caller cleans up the stack, then the function just does an RTS and the caller adjusts the stack because it knows how much stuff was pushed on. For programs with lots of calls, this generates extra (...) (24 years ago, 19-Apr-01, to lugnet.robotics.rcx)
|
|
| | Re: H8/300 Assembler/C interface
|
|
(...) Yeah, you are right. My bad. -Kekoa (24 years ago, 19-Apr-01, to lugnet.robotics.rcx)
|
|
| | RE: H8/300 Assembler/C interface
|
|
(...) Thanks Kekoa. One more question, are the other registers r3,r4,r5,r6 considered volatile across a function call in GCC? Cheers, Ralph (24 years ago, 19-Apr-01, to lugnet.robotics.rcx)
|
|
| | Re: H8/300 Assembler/C interface
|
|
(...) By the caller? No. They are callee-save. -Kekoa (24 years ago, 19-Apr-01, to lugnet.robotics.rcx)
|
|
| | RE: H8/300 Assembler/C interface
|
|
(...) Ahhh, that makes it awkward with the RCX ROM calls, but I'm pretty sure I can make my assembler source compatible with this. I'm just getting ready to release an assembler RCX serial library that is either polled or interrupt driven. Any (...) (24 years ago, 19-Apr-01, to lugnet.robotics.rcx)
|
|
| | RE: H8/300 Assembler/C interface
|
|
(...) I've just done some more browsing and found this tidbit: (URL) It seems to indicate that tghe registers are always filled and that a long may be split across r2 and the stack. Comments? Cheers, Ralph (24 years ago, 20-Apr-01, to lugnet.robotics.rcx)
|
|
| | Re: H8/300 Assembler/C interface
|
|
(...) I wrote C code and then disassembled it. :) -Kekoa (24 years ago, 20-Apr-01, to lugnet.robotics.rcx)
|
|
| | Re: H8/300 Assembler/C interface
|
|
(...) To be more specific, I wrote C code, then disassembled it. The C types "long" and "float" are both split. -Kekoa (24 years ago, 20-Apr-01, to lugnet.robotics.rcx)
|
|
| | RE: H8/300 Assembler/C interface
|
|
(...) Not to be too obtuse, but your first message says that long and float are never split across r2 and stack. So you're saying that they ARE split? That's fine, because it makes things a lot easier - not that any of my functions actually need to (...) (24 years ago, 20-Apr-01, to lugnet.robotics.rcx)
|
|
| | Re: H8/300 Assembler/C interface
|
|
(...) No no no! Sorry. They are NOT split. Boy am I dumb. -Kekoa (24 years ago, 20-Apr-01, to lugnet.robotics.rcx)
|
|
| | Re: H8/300 Assembler/C interface
|
|
(...) By looking at your work with 'RCX internals', dumb is not the word i'd use :) I'd rather think of something like 'bit wizard' Björn (24 years ago, 21-Apr-01, to lugnet.robotics.rcx)
|