Paul Leaman, MAMEDEV, has been working with emulators for almost two
years now. He has contributed a good number of drivers the likes of you
have to know about. 1942, Speed Rumbler and more recently, Strider and
the Street Fighter 2 games. In this InterView we get to know Paul and
his views regarding stand alone emulation vs. MAME and also the latest
happenings related to IDSA. Enjoy!
|EV talks to Paul Leaman - November 16, '98 by JoseQ
1) Typical starter question. Can you introduce yourself and tell us how you
found Emulation, and how you ended up in MAMEDEV?
OK. I'm a 29 year old Visual C++ programmer and make my living writing
Windows NT applications. I graduated with a BSc. in Computer Science about
six or seven years ago and spent five years in my first job writing a
Windows application. I left there about a year ago and am now working
My first brush with emulation was when someone showed me a ZX spectrum
emulator about six years ago. I was very impressed.
Although I had a spectrum for a couple of years the machine I grew up with
was a C64, so what I really wanted to see was a C64 emulator. I even made a
start on writing one but gave up because my little 386sx just wasn't up to
I forgot about it for a while and one day tried looking for a C64 emulator.
On the way, I heard a lot of talk about Sparcade. When it was released I was
Up to that point, I never really thought about arcade machines. I always
assumed that they ran on some magic custom processor since they were so much
better than home computers. When I found out how simple the hardware was I
was very surprised. It's the extra graphics hardware that made them
We went through a phase at work trying to find other emulators. A couple of
months later, we discovered Gyruss and then an early version of MAME. We
downloaded the source and the compiler and had a play around.
I chose to look at 1942 and found some basic information on the game. I
pinched some of the MAME graphics code, Marat's Z80 core and Mike Cuddy's
sound chip code. These were all the components needed for the game. I just
had to glue them together (so I thought).
It took a lot of work to get it running. When the logo appeared it was
fantastic feeling of achievement. The whole project became an obsession from
that point onwards. I don't think that anything since has matched that
feeling of initial discovery.
The game advanced in steps. I seemed to hit a wall and remember feeling
suitably pleased whenever I got over it. I had a lot of problems with
colours in the early days. I didn't realise that I was missing the palette
data and so started to put in colours by hand. It was a nightmare.
If it wasn't for MAME I wouldn't have started in the first place. It would
have been selfish to keep everything to myself so I sent Nicola the source
code and a technical document. I don't know what he thought of the source...
it was terrible.
In the meantime, I worked on stand-alone Ghosts and Goblins and Diamond Run
The original intention was to make my own multi-arcade emulator. It soon
became obvious that I was going to have to start from scratch and redesign
it all with the benefit of hindsight. It was becoming a monster and was
getting out of control. Then I thought... what's the point? Why bother
re-developing all the graphics routines? It's all been done so many times
So I converted all work in progress to MAME drivers and submitted them to
Nicola. This was still a fairly fleeting arrangement. It was like "here you
go here's some drivers... goodbye".
I suppose that I only properly joined the team when I added Speed Rumbler
and joined the mailing list last Christmas.
2) Do you think developing stand-alone emulators is worth it, or would you
rather just work on MAME?
I definitely prefer developing in MAME. I like having everything in one
place and a library of routines to fall back on.
I am always complaining about how little time I get to do anything. It is
sometimes difficult to balance work / social / entertainment / relaxing /
When you have limited time, you tend to only do the things that you enjoy
doing. For me, the discovery is much more fun than the implementation. I
reckon that 90% of the time was spent on reverse engineering the game and
only 10% spent on the code. As a result, the stand-alone emulators I wrote
were never really finished.
The stand-alone emulators are far too much work to be fun. For example, if I
needed a new sound chip. I would have to write one from scratch.
You have to bear in mind that I program all day at work. I still sometimes
think that it is a little sad to come home and do more of what you have been
doing all day.
3) How would you describe the flexibility of working on a stand-alone
Emulator vs. a MAME driver, is one any easier than the other?
Once you know what you are doing, a MAME driver is definitely easier to
write. All the fundamental things such as graphic conversion routines are
It frees you up to concentrate on the task in hand. I personally don't find
the framework limiting in any way.
However, for the uninitiated MAME can be rather daunting. It is a large
project and there is a lot going on.
When I started, it was early days. I didn't think that MAME could do what I
needed to do at the time. More to the point, I didn't know what I had to do.
In the end, I needed twin processor support, bank switching and scrolling.
I had no idea at the start how and whether or not it would work, let alone
how to add it all to MAME.
Initially, I wanted the flexibility to experiment a little. If it's your own
code, you can do what you want to it.
This approach works very well if you only have one game. This was my
original intention… 1942 and that's it! When I started adding extra games
whilst still sharing common source code I began to cause myself problems. I
was often tweaking something and breaking something else. What I ended up
with was a version control nightmare.
Flexibility has it's problems and it was tempting to hack game specific
stuff into the core. In the end, I was moving towards a multiple game
This freedom to hack around did have advantages. I found it easier to
prototype Gunsmoke, 1943, Legendary Wings, SectionZ, Black Tiger and
Sidearms in my stand-alone emulators because I had a debugger.
When the debugger was added to MAME the stand-alone stuff had no further
reason to exist so I dropped it.
4) Are there some things that you would change on the MAME architecture if
you had the power to do so?
A little power is probably dangerous in the wrong hands.
I haven't really looked much at the MAME architecture. I try to avoid doing
any core changes. I am often a release behind and I would cause too much
5) You have a long list of Capcom games in your list of projects, is there
any particular reason for this?
1942 was the reason that I started. It was a game that I remembered and I
figured that it would be about the right complexity. I wanted something that
wasn't too easy. It's always good to do something you care about.
Capcom's games are among my favourite arcade games (1942, Commando, Ghosts
'n' Goblins, Strider, Pang).
Once I got going, it was the easiest path to follow. I suppose that you
adopt some of the design philosophy and start thinking like the original
6) How would you categorize the Capcom system hardware in comparison to
other platforms being emulated?
The basic design hasn't changed much since 1984. The CPS1 system is not that
far removed from 1942. It's just that there's so much more of it. I still
think that these are among the simplest systems in MAME.
Around 1987 they started to put copy protection in games which made things a
little more tricky. Fortunately they didn't include it in the CPS1 games.
I think that I have had a fairly easy life in comparison to something like
the vector games.
7) Could you comment on the CPS speed performance differences between MAME
and Callus? Would being a CPS only emulator allow for more optimisation and
flexibility, thus achieving better performance?
Callus is an awesome piece of work. It is very well polished and is built
for speed. I believe that a large portion is written in assembly language.
The hardware is also more completely emulated than the MAME drivers.
A well written CPS only emulator will always have an advantage over a
That doesn't mean that if you remove all the games from MAME the CPS games
will run faster because they won't. To make any improvements, the whole lot
would need to be re-written from scratch with speed in mind.
There is further scope for optimisation, however the display code isn't
complete yet. I still don't know how the high priority layer system works.
Until that is 100% there is no point optimising the graphics drawing
8) You have been lately working a lot on the CPS1 system. What CPS games do
you plan to tackle on next?
I don't plan on adding any more new CPS drivers (other than finishing the
hidden ones that are in the driver source code and finishing those that
don't work yet).
Quite a few of the non-working drivers in MAME are my fault. If I do
anything, I ought to get these games going first.
However, I might not even get that far.
9) What do you think about the CPS2 being emulated? Is there any light for
this becoming playable soon? Can you mention the major barriers and what
would be a good (if any) approach to break them?
CPS2 emulation is certainly possible although it is going to take some time.
I have had a brief look at Street Fighter Alpha out of interest.
I certainly wouldn't expect to see CPS2 games in MAME in the near future.
The biggest barrier is the encryption. The game program is encrypted. If you
look, you can make out the text, but all the machine code instructions and
instruction data are scrambled. Until the code can be unscrambled, the game just won't work.
Rockman and SF Alpha seem to have similar startup code. It may be possible
(though unlikely) to compare pieces of the two and work out some pattern.
If it sounds simple, it's not. There are also other issues that would involve more work.
Anything else that is different
I am assuming that CPS2 is similar to CPS1. Until the code is running there
is no way of telling how similar they are. Some or all of the graphics
hardware may have changed.
Different sound system
A whole new sound system needs to be implemented. All the instruments are
played as samples as opposed to using an FM generator.
Age of the games
I'm a little worried about the age of these games. The CPS2 system was being
used right up to August 1996. That's only just over two years old! The games
may still be in circulation.
CPS2 emulation will likely the final straw for Capcom. There has to be a
cut-off date. I can see CPS2 emulation becoming a test case and emulating
CPS2 games could be legal suicide.
10) What is your opinion on the recent IDSA happenings and the future of
Emulation in general?
I suppose that it was inevitable. It looks like we are about to see some
clarification about the whole issue of emulation :(
Emulation has been gathering increasing press and popularity. When it
reaches a stage that mainstream magazines start covering it then people are
bound to sit up and take notice.
I hate it when albums or films get deleted just because they are deemed to
have had their day. All these games (even the bad ones) are a little piece
of history and culture. I grew up with some of these games and I think that
it will be a real shame to lose them forever.
Although companies are starting to release commercial emulators, they are
hardly likely to release some of their more embarrassing or less successful
creations. As far as they are concerned, it would be a waste of development
time, money and effort. If they didn't sell the first time what's the point
of re-releasing them?
What I'd love to see is companies selling collections of their ROM images
for use on emulators. If the price is reasonable in today's terms, then I am
sure that there will be more than enough interest to make it viable. I think
that it is unreasonable (though it would be nice) to expect them to donate
them to the public domain.
Unless there is a guaranteed market and there are clear financial benefits
for doing it, I doubt that we will see ROMS for sale. In cases where
companies have folded or the rights have been sold on, it may be difficult
finding the copyright owner.
Unfortunately, it has reached a stage where I think that it would be
dangerous for me to carry on developing emulators. I have always believed
that the creation of black-box emulators is perfectly legal but there is a
small grey area. There is bound to be a test case at some point and the last
thing that I need is for it to be me. I haven't got the time or money to
fight any legal battles.
Anyway, it's now approaching two years since I started writing emulators.
It's been fun along the way, but it's time I had my life back.
11) What would you say to someone wanting to join MAMEDEV and help with the
If I haven't put you off (that's just me being paranoid) then go for it. It
is very rewarding.
Emulating games isn't easy. If it was then it wouldn't be fun. You will need
a reasonable general knowledge of Computer Science principles, a broad
understanding of how hardware works and a lot of time and patience. Unless
you are only making minor changes, you will also need to know how to program
in C. Although you can learn how to program C from the MAME source a good
book would be a lot easier.
If you want to contribute then first read the FAQ on compiling MAME. If you
understand that then download and build the source code. There is quite a
lot to get. Once you have built the source you can then make a start at
examining what is going on.
Pick a game and enable the debugger. Step into it to get a good feel for
what is going on. Look at the driver source code and work out what is what.
There are quite a few structures and macros to get to grips with.
Here are some broad hints for adding a new driver:
If you are going to add a new driver, you need to at least get a feel for
the system you are trying to emulate. How many processors does it have? What
are the processors? What sound chips does it use? Is it likely to be related
to another game?
You can pick a game with a similar configuration and use that as a start.
Copy the vidhrdw and driver code to a new file and trim it down to the
basics. Make sure that you change all references to the old game.
You will have a number of ROM files that contain seemingly random numbers.
Then you need to look at these and identify roughly what's what. You will
have to identify code, graphic and possibly music code and sample data.
There are a number of utilities you can use to help. There are graphic
viewers to identify the graphics. You may be able to see text (such as "GAME
OVER") in the game code. Try loading files as raw PCM files into a sound
editor. You should be able to identify sound samples in this way.
People on the MAME team are very friendly and helpful. Please bear in mind
that they are also very busy. It would be helpful to get as far as you can
past the initial stages of writing a driver before as you can before asking
12) Any words for the public, or for any Emulator author 'wannabe'?
Perhaps that should be any last words. Oh well, it was fun while it lasted…
There you can see folks. Could this
be the beginning of a very sad trend? Are emulator authors
being pushed away by the IDSA? We can honestly say that
things like this shouldn't happen, and that this Emulation
legality case should be put to rest once and for all. Only
time will tell what will happen in the emulation world.
One Article Up: MAME News & fixed vMAME
One Article Down: Retrogames joins Emu World