To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 3588
3587  |  3589
Subject: 
Re: NQC v. LegOS / size
Newsgroups: 
lugnet.robotics
Date: 
Tue, 9 Feb 1999 17:20:41 GMT
Original-From: 
dave madden <DHM@PARADIGM.nomorespamWEBVISION.COM>
Viewed: 
1562 times
  
=>From: Ben Laurie <ben@algroup.co.uk>
=>...
=>Markus L. Noga wrote:
=>> Apart from the limitations imposed by H8 architecture (an 8/16 bit
=>> platform with the usual constraints on integer length, available memory
=>> and library functions), there's mainly one language limitation I am
=>> aware of.
=>
=>Actually, I ran into another - you can divide by numbers that aren't
=>powers of two. At least, I can't. There seems to be a missing assembler
=>routine.

Yes, the H8 divide instruction can only do (16 bits)/(8 bits), so GCC
calls a helper routine when you attempt to divide an integer by
another integer.  (Same thing with multiplication: the hardware can
only do (8 bits) x (8 bits) -> (16 bits), so GCC often calls a helper
function for that, too.)  Powers of two (division & multiplication)
can be converted to shifts, and multiplication/division by a constant
can often be turned into a combination of shifts and adds; GCC will do
that if it thinks the combination will be more efficient than a
generalized routine.

I haven't had need of any complicated math, so I haven't written the
helper routines; maybe Markus has some.  (Alternatively, I believe
Kekoa identified some math routines in the RCX ROM...it might be
possible to use those.)

d.
--
Did you check the web site first?: http://www.crynwr.com/lego-robotics



Message has 5 Replies:
  Re: NQC v. LegOS / size
 
(...) I knew that! In my youth I got one up on a Z80 assembler guru by doing a divide by 80 with shifts and adds faster than his best optimized version... (...) It didn't matter much to me either - I was trying to do a rolling average, but I didn't (...) (26 years ago, 9-Feb-99, to lugnet.robotics)
  Re: NQC v. LegOS / size
 
(...) Actually, I have the wrappers for GCC. I have been busy with other stuff, but I have been meaning to release my RCX code for a while now. I spent the morning packaging up my development environment, which now lives at: (URL) particular, I (...) (26 years ago, 9-Feb-99, to lugnet.robotics)
  Re: NQC v. LegOS / size
 
(...) Are you linking libgcc.a? I believe it has all the math helper functions that are required. John A. Tamplin Traveller Information Services jat@Traveller.COM 2104 West Ferry Way 256/705-7007 - FAX 256/705-7100 Huntsville, AL 35801 -- Did you (...) (26 years ago, 9-Feb-99, to lugnet.robotics)
  Re: NQC v. LegOS / size
 
(...) It doesn't have to be complex math. I had the same problem using the modulo operator. I did a little digging to figure out why libgcc.a wasn't compiling properly. It turns out that if you add the -Dinhibit_libc to the CFLAGS in the top level (...) (26 years ago, 10-Feb-99, to lugnet.robotics)
  Re: NQC v. LegOS / size
 
The maths routines are somewhere in libgcc.a, though I think there's a single file with all the routines instead of several small ones, so you may end up wasting memory. In addition, you probably need to access libc.a too since some of the libgcc.a (...) (26 years ago, 10-Feb-99, to lugnet.robotics)

Message is in Reply To:
  Re: NQC v. LegOS / size
 
(...) Actually, I ran into another - you can divide by numbers that aren't powers of two. At least, I can't. There seems to be a missing assembler routine. Cheers, Ben. -- (URL) grandfather once told me that there are two kinds of people: those who (...) (26 years ago, 9-Feb-99, to lugnet.robotics)

23 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
    
Active threads in Robotics

 
Verified and Trusted Team of Hackers
14 hours ago
Custom Search

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