Kids, just say No to bilinear filtering

Published December 11, 2006
Advertisement


The old layout of the emulator was a bit of a mess.

The Z80 emulator needed to sit inside a class of your design that inherited from IHardwareController (and so exposed methods to handle hardware devices) and another that inherited from IMemoryDevice that exposed methods that could be used to read and write to memory.

As you might imagine, this got a little messy what with the various nested classes needing to pass references to eachother around. The new design is much more straightforwards - you build a class that inherits from Z80A (which is the basic Z80 emulator) and override the four functions for reading from/writing to memory addresses/hardware ports.



Further to that, the Master System emulator itself has been shunted out to its own class library, meaning that the code isn't mixed up with interface code. This way I can easily have two different front-ends - an MDI Windows GUI for example, like the one I've posted screenshots of before, with debugging tools and so on, and an XNA interface that runs full-screen, taking input from a connected joypad.



For the moment I have the blurry and slow solution which is just to dump the output Bitmap onto a form. You can probably guess as much from the pathetic framerates reported on the above screenshots.



Overall compatibility is still increasing slowly. Some programs that used to work now don't, of course. It goes both ways.

The VDP emulation has been significantly rewritten. A lot of the main scanline rasteriser is still the same as it was, though, but slight fixes have been made there (including picking the correct backdrop colour - an x & 0xF + y versus (x & 0xF) + y bug - and sorting out the second column) but I still have a lot of interrupt-related bugs to iron out.



Just as a test, I cobbled together an 'alternative' interface that uses that console code I posted here a while back.



It's a sad thing that the above runs at a decent framerate, whereas the graphical versions run at half the rate of they should. At least, that is running in Debug mode within the IDE...



Checking the Release build would always be a better plan. That's still lousy performance in my book, though.



Having written the above, I decided to look at the official Game Gear documents once again, and reread the section on ROM banking. I had not realised that for 1MBit cartridges, area 0 and area 1 ($0000..$3FFF and $4000..$7FFF respectively) were fixed, and only area 2 ($8000..$BFFF) could be changed.

Fixing areas 0 and 1 fixed a number of the smaller games:





It turns out that if I resize the window so the display is at 1:1 pixel scaling, I get ~73FPS on my machine and - most importantly - only 3% CPU usage. If I make the window even twice as large as it was, it drops to about 30FPS and 100% CPU usage. DirectX beckons...
Previous Entry New Z80 emulator
Next Entry Turning Japanese
0 likes 2 comments

Comments

Aardvajk
Never thought I'd see James Pond again. [smile]

Been following this for a while but can never think of anything useful to say about it. Way cool project. That console mode stuff is wicked.
December 12, 2006 07:43 AM
benryves
Thanks! [smile]

I do find it tricky to reply to most journals as there are only so many ways of saying you like a project.

In this case, I'm going rather heavy on the screenshots as I doubt people would find a lot of the lower-level stuff I have to deal with interesting.

That said, I've always found projects that take some externally defined input and render it correctly the most rewarding. For that reason, I quite like reading over file format specs and writing loaders.
December 12, 2006 10:16 AM
Drakkcon
Seeing the sega games rendered in ASCII is the coolest thing ever! Your projects are always interesting.
December 14, 2006 09:02 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement