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 / 1219
1218  |  1220
Subject: 
Re: H8/300 Assembler/C interface
Newsgroups: 
lugnet.robotics.rcx
Date: 
Sat, 21 Apr 2001 04:54:58 GMT
Viewed: 
1415 times
  
Ralph Hempel <rhempel@bmts.com> wrote:
Geez Kekoa, get some sleep. The GCC makes the callee clean up the
stack.

Not my GCC:

00000016 <_main>:
  16:   6d f6             mov.w r6,@-e7    <-- save frame pointer
  18:   0d 76             mov.w r7,r6      <-- new frame pointer
  1a:   6b 00 00 00       mov.w @0x0:16,r0 <-- r0r1 is 1st long param
  1e:   6b 01 00 00       mov.w @0x0:16,r1
  22:   6b 02 00 00       mov.w @0x0:16,r2 <-- load 2nd long param
  26:   6b 03 00 00       mov.w @0x0:16,r3
  2a:   6d f3             mov.w r3,@-e7    <-- put 2nd long param on stack
  2c:   6d f2             mov.w r2,@-e7
  2e:   5e 00 00 00       jsr   @0x0:0     <-- caller calls callee
  32:   0d 10             mov.w r1,r0      <-- return lsw of long return value
  34:   0b 87             adds  #0x2,er7   <-- *** caller cleans up stack ***
  36:   0b 87             adds  #0x2,er7
  38:   6d 76             mov.w @r7+,r6    <-- restore frame pointer
  3a:   54 70             rts

Nobody uses the frame pointer.  There is a way to tell GCC not to generate
it, but I forget the means.  When you write your own routines, you can
ignore the frame pointer and treat it as another register that needs
saving if for some reason you need to use r6.

-Kekoa



Message has 2 Replies:
  Re: H8/300 Assembler/C interface
 
(...) -fomit-frame-pointer, but it can cause problems debugging (obviously not important here). John A. Tamplin jat@jaet.org 770/436-5387 HOME 4116 Manson Ave 770/431-9459 FAX Smyrna, GA 30082-3723 (23 years ago, 21-Apr-01, to lugnet.robotics.rcx)
  RE: H8/300 Assembler/C interface
 
(...) Sorry, looks like I need sleep too! (...) Hmm, looks like r2 is a copy of the high byte of the second long, but the complete long is pushed onto the stack! So the thing about GCC NOT splitting is true, it just keeps a copy of the higher order (...) (23 years ago, 21-Apr-01, to lugnet.robotics.rcx)

Message is in Reply To:
  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)

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