<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Mon, 25 Jul 1994 11:57:16 +0100
From   : jfid@... (James Fidell)
Subject: Re: Beeb Emulators

> [ discussion on SR being 8 variables or 1 variable ]
> 
> [ JB's ]
> >> #define reset_ZN(x) (P = P & ~(P_Z + P_N) | x & 0x80 | (!x)<<1)
> 
> [ JF's ]
> >      Z = x ? 0 : 2;
> >      N = x & 0x80;
> 
> Ok - so you've looked at the code for both of these. How does Stephen
> Quan's lookup system compare? It was faster than mine by a small
> amount. Also I don't feel my reset_ZN macro listed above is the best
> to play with. I tested and tuned this on a DEC Alpha. I've no idea if
> is fast on a PC.

I haven't tried the lookup table stuff yet, although it ought to be
possible to get a rough estimate of how long it would take just by
analyzing the code and deciding what operations need to be done by
the processor.  Alternatively, maybe Stephen could post an example of
the compiler output ?

> >That's a lot less instructions. Am I missing something blindingly
> >obvious to everyone else ?
>
> Quite possibly not. As I mentioned above, much of my experiments were
> done on a DEC Alpha. Possibly this isn't the wisest of choices - I
> don't feel I really need to optimise for speed on this machine! :-)

I think that when you get down to lots of bit-twiddling, there's not
much you can do to improve performance, other than trying to find
ways to avoid doing it.

> Also, the choice of compiler here can make a huge difference
> (unfortunately) gcc on the Alpha actually performed very badly for me.
>
> Your investigations look interesting. If there genuingly is a large
> difference in speed then I perhaps ought to switch to the 8 variables
> model (well, 6 or 7 infact).

I also realised the other day that since the value of the carry flag
is either 0 or 1, I can use it directly in addition and subtraction
operations.

James.

-- 
 "Yield to temptation --             |
  it may not pass your way again"    |     jfid@...        
                                     |
        - Lazarus Long               |              James Fidell
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>