[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 65C02 emulation
On Fri, 1 Dec 2006 00:46:10 -0800, RedskullDC wrote
(in article <mZRbh.725$HU.498@news-server.bigpond.net.au>):
> That is very similar to how "Apple2000" (Apple ][ emulator for the Amiga)
> worked:
>
> MOVE.W (A2)+,D1 ;Get next Instruction
> MOVEA.L (A3,D1.W*4),A0
> JMP (A0) ;Off we go!!
On the ARM you jump by loading the program counter "by hand". The shifting is
part of the load instructions, so you get something like:
Load PC <-- (Instruction register) shifted 4 bits
Where Instruction Register points to the next 6502 instruction.
One cycle. All done.
The instruction emulation will have to increment the instruction register (or
there can be a post increment in the Load instruction if that is most common,
which is countered when needed in the instruction emulation) and load the
next instruction. It looks fastest at this time to "inline" the interpreter
(the Load PC instruction) at the end of each 6502 instruction emulation. I
did this on a Forth interpreter for the ARM and got a pretty good boost but
it makes single stepping and debugging harder. I sometimes do it both ways,
with one for development and the other for speed.
-- Charlie Springer