hskaratekid
That's a tough question to answer simply! How proficient is your programming? It would have to be written it in a lower level language like C (Python isn't going to cut it!) and you would be looking at including modules such as a CPU simulator (many of these already exist and are incorporated into PiMAME4ALL for instance See Here - http://code.google.com/p/mame4all-pi/) and I/O simulators, looking at existing emulator code may be a good place to start. Which machine/system were you looking at writing an emulator for specifically?

It is a mammoth task to do and is very dependant on the target system you wish to emulate.

I would suggest you read up on High Level Emulation as a starting point. You may (or may not) already know this but the following functionality would need to be built into most, if not all, emulators:

Interrupts

DMA (usually implemented in s/w as opposed to using host platforms h/w - better for portability/permissions)

unusual h/w features - N64 has one w.r.t branching and executing instruction after branch

bootloading/startup

FLASH, EEPROM or 'Memory packs/cards'

target system instruction Interpreter/ dynamic re-compiler

The target SDK libraries

The OS, if one exists and you don't want to or can't emulate the original (e.g. PlayStation BIOS)

Other things to consider

Endianness of host and target platforms

Available host system hardware e.g. GLES2

Can the host system do Page File execution (required for dynamic recompiling)

How to handle a target system with multiple CPU/GPUs and their synchronization

Use of plug-ins (e.g. video, audio, input, front-end, ...) or standalone program

Optimizations are done for the target system but these may not be appropriate for the host. e.g. PS2 only has 4MB for GPU but it can do fast texture loading. One could try to reverse that optimization (and cache textures for longer) to increase performance on the host.

The largest hurdle is that you can't test very much until the majority of the system has been coded up. If you can get hold of a compiler for the target then you could experiment with some very basic programs first.

You would also need to decide how portable you want the emulator to be. You could use SDL with some custom OS specific code for full portability between windows or linux. Or you could decide to target very specifically e.g. the Raspberry Pi running Raspian to squeeze more performance though better optimization.

The general rule of thumb for emulation is the host system should be >10x faster than the target. With host specific optimizations one should be able to get away with ~7-8x. I wonder though if an emulator coded for an embedded system largely in assembler could get away with 4x...

Great thread and it's been very helpful. I started with the Retropie bundle, but am slowly trying to replace individual emulators with the best versions. I can't believe how much faster Pudding's PiMame4All is than the RetroArch version that was bundled with RetroPie! I had a little bit of difficulty integrating it with emulationstation, though, because it doesn't like full rom paths. Instead you of "./mame /home/pi/blah/blah/pacman.zip" you need to say "./mame pacman". I ended up writing a 2 line bash script that did the argument conversion on the fly when a selection occurred in emulationstation. Seems to work well, though I wonder if there's an easier way.

I've also replaced the nes emulator with Andrey's Fceux, but I can't figure out how to quit without using a keyboard. Any way to assign controller keys to quit?

I plan on looking at Pudding's PiSNES next, so any advice on configuring the controller would be helpful.

cacophony555
Welcome to the Forum! Thank you for the endorsement of the Thread!

'I started with the Retropie bundle, but am slowly trying to replace individual emulators with the best versions'
That's definitely the way to go, RetroArch is a great all rounder but many systems can be emulated better in Binaries that have appeared recently that are 'Optimised' especially for the RPi. As well as PiSNES (which is better than either RetroArch Core available) puddings PiFBA is also superior to the RA Core.

'Instead you of "./mame /home/pi/blah/blah/pacman.zip" you need to say "./mame pacman'
That's because it a not a RetroArch Core and running MAME from a command line would be -
./mame (run executable) then the code for the game title WITHOUT the file extension, i.e

./mame dkong
NOT
./mame dkong.zip

'I've also replaced the nes emulator with Andrey's Fceux, but I can't figure out how to quit without using a keyboard'
I'm not sure about exit but I did write up an explanation on how to configure a joypad
Here - http://www.raspberrypi.org/forums/viewt ... ux#p406208
'I plan on looking at Pudding's PiSNES next, so any advice on configuring the controller would be helpful'
It should work independently of RetroPie (it has its own config file) button settings can be changed from there if required.

StrawberryDorbs
They should all work fine, I haven't found much it doesn't emulate excluding SuperFX powered Titles and certain Acceleration Chips (if by Street Fighter Alpha you mean Street Fighter Alpha 2 this would be one as it included an S-DD1 AC which many emulators cannot replicate). What format are the ROMS in, compressed .zip/.rar/.7z or uncompressed .smc/.sfc?. Perhaps the ROM files you have are bad dumps/corrupted, try another Website to source them.

StrawberryDorbs
I have found the GUI causes some issues with certain monitors. Try the Command Line version to see if this is causing the problem (don't forget, Linux doesn't like spaces in the file name so remove them e.g. change mario kart.zip to mariokart.zip).

i.e if a Key is mapped to code 122 (z on the Keyboard), changing to 120 it's then x

ACII codes.

Anyway, I installed DOSBox through apt-get, and it runs things like Doom 2 and MFS3.0 slowly while in XWindows. Is this normal, when it's meant to be emulating a 5-10mhz computer? Also, out of XWindows (AKA - in the text console), it registers the key presses wrongly - 'J' is 'Return', 'F1' makes it freeze, ETC. How do I fix the keyboard problem? Cave Story runs fine as a DOS(ish) program in retropi, so why doesn't DOSBox run nice and smooth too? I have tried changing frameskip, CPU speed, ETC. Even my Android tablet (Quad core 1.5ghz proc, quad code Mali-400) won't run it at full speed? Is it DOSbox that is the problem?

I'm happy to help.
https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794 - List of games that work on the Pi.

i.e if a Key is mapped to code 122 (z on the Keyboard), changing to 120 it's then x

ACII codes.

Anyway, I installed DOSBox through apt-get, and it runs things like Doom 2 and MFS3.0 slowly while in XWindows. Is this normal, when it's meant to be emulating a 5-10mhz computer? Also, out of XWindows (AKA - in the text console), it registers the key presses wrongly - 'J' is 'Return', 'F1' makes it freeze, ETC. How do I fix the keyboard problem? Cave Story runs fine as a DOS(ish) program in retropi, so why doesn't DOSBox run nice and smooth too? I have tried changing frameskip, CPU speed, ETC. Even my Android tablet (Quad core 1.5ghz proc, quad code Mali-400) won't run it at full speed? Is it DOSbox that is the problem?

DOSBox is VERY cpu-demanding, and for emulating something able to run DOOM2 at a playable speed, you'll need a computer WAY more powerful than the Pi. Forget about DOXBox on the Pi.
DOOM2 ran fine on a 486@66Mhz computer: it was FAR from playable in a ~10Mhz IBM PC.

...But even so, if you insist on using it, you can set raw keycodes in the config file you're using. Keypresses are handled by SDL, not directly by DOSbox.
But do yourself a favor and use RpiX86 instead....

I tried 8086tiny - it froze. Might try Rpi86. Hang on - if <strike>I were to</strike> someone were to port a DOS operating system to the 700mhz Pi, and run DOOM2, it would work (probably). Anyway, tried using chocolate-pi, and it ran fine. At first it kept on crashing due to it "not supporting 320Xsomething" graphics, but then after some careful persuasion... ("WORK! WORK!!!!!!") it works! yay!

I'm happy to help.
https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794 - List of games that work on the Pi.

There is a new ZX81-emulator that can run in xterm in Raspbian if you get the new xterm and compile it with Sixel-graphics. (I think it would be good if the standard xterm in Raspbian had Sixel-graphics support built-in.)

I think zce is a useful emulator since it can also be used remote for e.g. adventure games and to run ZX81 BASIC-scripts like other Linux-script-languages such as Bash and Perl. It also seems to be in active development.

Now I reinstalled it after installing Raspbian with NOOBS. I wrote down how I did this to help others getting started with ZX80- and ZX81-emulation. I had to do this before make of sz81:
sudo apt-get install libsdl1.2-dev

I could get ZonX sound to work in sz81!

I had to do this before make of xz81:
sudo apt-get install libsvga1-dev

Then I had to do this because there is something wrong with the Makefile.z81 or the source-files:
sudo ln -s /usr/local/lib/z81/zx80kybd.pbm /
sudo ln -s /usr/local/lib/z81/zx81kybd.pbm /
sudo ln -s /usr/local/share/sz81/zx80.rom /
sudo ln -s /usr/local/share/sz81/zx81.rom /

I couldn't get ZonX sound to work in xz81.

Have Pi0&1A&1B&1B+&2B&3B&4B w/ Raspbian. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/https://github.com/mobluse/https://twitter.com/mobluse/https://YouTube.com/MOBiL4u/