To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 1217
1216  |  1218
Subject: 
Re: H8/300 Assembler/C interface
Newsgroups: 
lugnet.robotics.rcx
Date: 
Fri, 20 Apr 2001 23:27:18 GMT
Viewed: 
1331 times
  
Ralph Hempel <rhempel@bmts.com> wrote:
One more question for Kekoa before I'm done...

The RCX ROM routines take a parameter in r6, with additional
params on the stack. Return value is in r6 too.

Are all other registers considered volatile through the
call, or do the ROM routines save registers they clobbber?

I've always assumed that they save r4, r5, alter r6, and preserve
the SP (r7) Are r0-r3 volatile or preserved in the ROM?

A brief review of the ROM disassembly seems to indicate the routines in ROM
save r0-r5 if necessary.  For example, the routine at 070c saves all
registers.  Like you said, parameters are passed in r6 with extra
parameters on the stack.  The caller cleans up the stack as with GCC.
There are no 32-bit parameters to worry about.

The only exceptions to this are the copy memory and clear memory functions
at 0x42a and 0x436 respectively.  These use a special calling convention.
The routine at 0x42a takes parameters in registers r0-r2, and destroys
r0, r2, and r3.  The routine at 0x436 takes parameters in r0-r1 and
destroys r1 and r2.

-Kekoa



Message has 1 Reply:
  RE: H8/300 Assembler/C interface
 
(...) Geez Kekoa, get some sleep. The GCC makes the callee clean up the stack. My pbForth ROM interface routines assume that the caller cleans up the stack, just like your RCX library which must have been confusing for you :-) I'll post all this in (...) (23 years ago, 21-Apr-01, to lugnet.robotics.rcx)

Message is in Reply To:
  RE: H8/300 Assembler/C interface
 
One more question for Kekoa before I'm done... The RCX ROM routines take a parameter in r6, with additional params on the stack. Return value is in r6 too. Are all other registers considered volatile through the call, or do the ROM routines save (...) (23 years ago, 20-Apr-01, to lugnet.robotics.rcx)

20 Messages in This Thread:





Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR