<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Wed, 14 Feb 1996 09:00:50 +0000 (GMT)
From   : Tom Seddon <T.W.Seddon@...>
Subject: Re: The BBC's Logical, Well-Documented and Non-Perverse Keyboard

On Tue, 13 Feb 1996, Mark Cooke wrote:

> On Tue, 13 Feb 1996, lamcw wrote:
> 
> > Here are a few nice tricks.
> > 
> > 1) Use a big SWITCH statement as the heart of your 6502 emulation.
> 
> Depending on your compiler. A potentially better trick is to use an array 
> of function pointers. Mileage will vary with compiler.

gcc does this:

mov eax,opcode
mov eax,[opcodesjumptable+eax*4]
jmp [eax]

which is about as fast as you can get I think!

> 
> > 2) Go into a tight loop for say 50 opcodes, then drop out to update
> > counters, check IRQs etc. This may horrify some purists but I found
> > this essential to get good performance.
> 
> Agreed. You might want to go further, and set a flag/dynamic count for 
> this. Some copy protection/decoding was very very timing specific.

It horrified me, but I've done it now and got an instant massive speedup! 
The keyboard response is also a bit nicer, although the key-repeat is a 
bit quick.

> 
> > 3) Draw the screen every x frames, e.g. 5 for instance.
> 
> Definately. It makes a huge difference.

Yuk. I'll have to try this and see what it looks like. I'm not a great 
one for compromises when it comes to this sort of thing. (although 25 
screen updates per second rather than 50 might look alright)

--Tom

     .                     ** Tom Seddon **                     .
    / \              E-mail: T.W.Seddon@...              / \
   /(o)\                                                      /(o)\
  /=====\            Call out GANDHU and be happy            /=====\
 /       \                                                  /       \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>