Computer Emulation Resources

by Marat Fayzullin

While working on computer emulators, I have written a bunch of stuff that may come useful to those who do not like to reinvent the wheel every time they reinvent another bicycle. Below, you will find tools and libraries used in writing and debugging emulators, as well as a collection of useful documents, starting with an emulation how-to.


On October 27 2008, I have released the updated EMULib library with Unix and Maemo support.

The new EMULib adds several image processing functions, now moved into Image.c, disk image processing functions (FDIDisk.c and Floppy.c), NetPlay and networking functions (NetPlay.c), and the emulation for new chips: WD2793 and uPD765 floppy disk controllers, Konami's SCC sound chip, C93xx serial EEPROM, etc.

Later, I intend to implement the same EMULib API for Unix and probably other platforms. let me know if you wish to help.

[#] License Terms
  • You can use these resources for any non-profit purposes, as long as you make a proper reference to me.
  • You cannot use any of these resources to gain profit. This includes using them in commercial projects, putting them onto companion CDs, etc. If you want to use my work in a commercial project, please, contact me to negotiate the terms.
  • You cannot distribute these resources yourself, through your own WWW or FTP sites, even if they are non-profit. It is ok to have them as part of your non-profit software though.
  • If you use my code for your own project, please, let me know about it.
  • The above license terms are incompatible with GPL. Thus, you should avoid making the source code from this page and any derived code part of a GPLed project.
[#] HOWTO: Writing An Emulator
This is a little guide I wrote for those who want to write a computer emulator, but are not sure where to start. A lot of people asked for this kind of information. Watch out for more changes and additions to this document.
[#] Nintendo Entertainment System Architecture
This is a document on the NES/Famicom hardware written in the course of development of iNES emulator. Since then, I expanded it, made some corrections, and converted everything into HTML for easy navigation. Watch out for more changes and additions to this document.
[#] Nintendo GameBoy Architecture
This document covers the Nintendo GameBoy hardware architecture. I wrote it when developing the Virtual GameBoy emulator. As the document has not been updated in a while though, it does not cover a lot of things, such as Color GameBoy extensions and various add-ons like Super GameBoy, Pocket Printer, etc.
[#] Z80 Portable Emulation Package August 17 2007
[#] 6502 Portable Emulation Package August 17 2007
  This is the portable source code for my Z80 and 6502 emulation cores. They are used in my projects, such as fMSX, MasterGear, ColEm, Speccy, and iNES, as well as by other people:
  • Z88DK cross-development kit for Z80-based systems by Dominic Morris
  • 80x86-optimized Z80 core and other projects by Marcel de Kogel
  • Microcomputer Design course in the University of York by Don Goodeve
  • Z80 part of the Genesis emulator (GenEm) by Markus Gietzen
  • Atari7800 emulator by Markus Gietzen
  • Canon X-07 emulator by Jacques Brigaud and Jerome Vernet
  • PCEngine emulator by Jens Ch. Restemeier
  • Rygar arcade emulator by Jean-Marc Leang
  • MAME project by Nicola Salmoria and Co
  • Amstrad PCW emulator (Joyce) by John Elliott
  • VZ300 emulator by Guy Thomason
  • Space Invaders arcade emulator by Glenn Neidermeier
  • Game Decoder by Glenn Neidermeier
  • NES emulator (xNES) by Nicolas Hamel
  • KC85/4 emulator by Torsten Paul
  • TestBench by Tom Bampton
  • NES and PCEngine emulators by Bero
  • PCEngine emulator by Olivier Jolly
  • Amstrad CPC emulator by Ulrich Cordes
  • ComeBack64 port to Unix by Domenico Dato
  • MacTX Memotech MTX512 emulator
  • TIKI-100 emulator by Asbjoern Djupdal
  • FunnyMu FunVision emulator by Paul Hayter
  • Dapple Apple ][ emulator by Steve Nickolas
  • Toy Commodore PET emulator by Steve Nickolas
  • FM-7 emulator with CP/M-80 option card by Yasunori Shimura
  • NeoPop NeoGeo Pocket emulator (sound subsystem)
  • FreeNES NES emulator by Samuel Bronson
  • ZX Spectrum emulator for Sony Ericsson P900 phones by Alfonso Martone
  • Z80 Disassembler ported to Mac by Erik Huizing
  • Wilderland ZX Spectrum emulator
  • RunCPM emulator by Marcelo Dantas
  • etc.
[#] EMULib Portable Source October 27 2008
[#] EMULib Documentation (for the April 21 2002 version)
  EMULib contains the emulation code for various support chips and a library of some widely used machine-dependent graphics and sound functions. Currently included:
I8251    -- Emulation for the Intel i8251 programmable serial interface
I8255    -- Emulation for the Intel i8255 programmable parallel interface
UPD765   -- Emulation for the uPD765/i8272 floppy disk controller
WD1793   -- Emulation for the WD 1793/1794/2793/2794 floppy disk controller
AY8910   -- Emulation for the GI AY8910/AY8912 sound chip
YM2413   -- Emulation for the Yamaha YM2413 sound chip
SN76489  -- Emulation for the TI SN76489 sound chip
SCC      -- Emulation for the Konami SCC sound chip
TMS9918  -- Emulation for the TI TMS9918/TMS9928/TMS9929 video controllers
C93XX    -- Emulation for the C93xx serial EEPROM chips
GBCarts  -- Routines to work with GameBoy ROM images (.GB)
GBACarts -- Routines to work with GameBoy Advance ROM images (.GBA)
DSCarts  -- Routines to work with Nintendo DS ROM images (.NDS)
NESCarts -- Routines to work with NES/Famicom ROM images (.NES)
SMSCarts -- Routines to work with MasterSystem/GameGeat ROM images (.SMS/.GG)
Console  -- Routines to draw basic text, frames, and windows in a pixel buffer
INIFile  -- Routines to work read and write values into .INI files
NetPlay  -- Routines for implementing Network Play feature
FDIDisk  -- Routines to work with various disk image formats
Floppy   -- Routines for creating and accessing 720kB floppies
Image    -- Routines for image processing
Sound    -- Common audio framework and MIDI logging routines
Windows/ -- Windows specific implementation
MSDOS/   -- MSDOS specific implementation
Unix/    -- Unix specific implementation
Maemo/   -- Maemo specific implementation

All sound emulation libraries and the MIDI library use the same standardized API. Most of the EMULib source code compiles with any reasonably functional C/C++ compiler. On Windows and MSDOS, you may want to use the free Open Watcom C/C++ compiler.

[#] EMUTools Source November 30 2001
[#] EMUTools MSDOS Binaries November 30 2001
[#] EMUTools Maemo Binaries October 4 2008
[#] EMUTools Documentation
  EMUTools is a bunch of utilities, which can be helpful when writing, debuggin, or using emulators. In the past, I bundled some of these utilities with my emulators, but later decided to gather them all into a standalone package. Currently included:
BDIFF    -- Binary file comparison
UNDOUBLE -- Binary file truncation
BEHEAD   -- Header truncation
NESLIST  -- List/check/fix NES ROM images (.NES)   
GBLIST   -- List/check/fix GameBoy ROM images (.GB)   
GBALIST  -- List/check/fix GameBoy Advance ROM images (.GBA)
FDSLIST  -- List Famicom DiskSystem disk images (.FDS)
FAM2FDS  -- Convert DiskSystem images from .FAM to .FDS format 
DASM6502 -- Little 6502 disassembler
DASMZ80  -- Little Z80 disassembler
GBDASM   -- Little GameBoy disassembler

© Copyright by
Marat Fayzullin