Friday 6 November 2009

Breakout

I am really enjoying getting back into the code. I've decided to bring all of the individual operation classes into the CPU class and make them inner classes. Lots of reasons for this but to me it just seems to be more logical for the individual instruction methods to access the internals of the CPU directly rather than through some static reference and public methods. This also means I'm removing tons of classes that helped with the previous abstraction and have adopted some simpler ways of decoding opcodes etc.

What this will lead to I hope is a much smaller and cleaner code base with no unnecessary coupling and a nice clean interface. With a bit of luck the performance might be better too, but I'm not really worried about that at the moment.
I am now thinking of creating a new project for the 68k CPU and hosting it on google code or github with a monitor/debugger/disassembler (and perhaps an assembler too) but separate from the Miggy project.

Once this is done I'll then return to Miggy and build it using this CPU core.
Thoughts anyone ?

4 comments:

thomas said...

Hi there - looks like emulation coding is a seasonal event! I also just started picking up my half-finished Atari ST emulation. :-)

Since I've been looking through your code before when I was looking for inspiration on some of the aspects of the 68K emulation, I can only agree! Moving the individual instructions closer to the CPU core as one big class is probably going to be easier to maintain for you.

And abstracting out the system of the Amiga from the CPU is definitely worth it - which among other things will allow you to make the 68K emulation a separate project... I'm definitely looking forward to study your approach for the "new" 68K core, since there are many things about my approach that I think are less than optimal... :-)

Unknown said...

Have you already started on the display code? I wonder if it is possible to make it fast enough in Java.

My own Vic-20 emulator runs only at 11-16kHz on my P3-800 due to the very slow Video-Chip emulation. But I do not know much about code optimization in Java.

How fast is your 68k emulation?

t0ne said...

No, I've not got the display code going yet. I've started a couple of times but not been happy with the architecture. I've not got as far as trying to display anything yet.
The "old" 68k CPU was running about 65Mhz on a 2.4Ghz Quad Core machine running WinXP and 85Mhz on my 2.5Ghz MacBook Pro.
Are you hosting your project anywhere Arndt ?

Unknown said...

Looks like your 68k emulation is fast enough! Emulating the 6502 is certainly easier, but fun as well.

I considered putting the project on sourceforge, but it is more of a fun project to me and there is always something left to improve/fiddle/tweak/extend first...
Emulation is not complete, cycle-counting is not finished,
programming a good debugger would be fun and there are one or two bugs left ;-)