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 / 3589
3588  |  3590
Subject: 
Re: NQC v. LegOS / size
Newsgroups: 
lugnet.robotics
Date: 
Tue, 9 Feb 1999 17:45:02 GMT
Original-From: 
Ben Laurie <ben@algroup.co.SAYNOTOSPAMuk>
Viewed: 
1343 times
  
dave madden wrote:

=>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 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...

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.)

It didn't matter much to me either - I was trying to do a rolling
average, but I didn't mind having 8 on the bottom instead of 10 :-)

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi
--
Did you check the web site first?: http://www.crynwr.com/lego-robotics



Message is in Reply To:
  Re: NQC v. LegOS / size
 
=>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), (...) (25 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
    

Custom Search

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