Bluish Coder

Programming Languages, Martials Arts and Computers. The Weblog of Chris Double.


2007-02-04

Emulating other Intel 8080 Based Arcade Games

I've done some refactoring of the Intel 8080 emulator I wrote in Factor and split the games out into separate libraries. ROM's can now be stored anywhere with the path to the root of the ROM directory set in the 'rom-root' variable.

Many of the 8080 based arcade games use similar hardware to Space Invaders. If they use a similar control mechanism and you don't mind non-perfect emulation (colours and sounds will be as per Space Invaders) it's easy to create an emulator if you have the ROM files.

The main thing you need to know is where the ROM files need to be loaded in the emulated RAM. For example, you can get a list of 8080 based games here. For this example I chose 'Balloon Bomber'.

You can find out where the ROM's need to be loaded by looking in MAME's drivers/8080bw.c file. Look for ROM_START( ballbomb ):

ROM_START( ballbomb )
  /* 64k for code */
  ROM_REGION( 0x10000, REGION_CPU1, 0 )     
  ROM_LOAD( "tn01",         0x0000, 0x0800, ... )
  ROM_LOAD( "tn02",         0x0800, 0x0800, ... )
  ROM_LOAD( "tn03",         0x1000, 0x0800, ... )
  ROM_LOAD( "tn04",         0x1800, 0x0800, ... )
  ROM_LOAD( "tn05-1",       0x4000, 0x0800, ... )

  /* color maps player 1/player 2 */
  ROM_REGION( 0x0800, REGION_PROMS, 0 )  
  ROM_LOAD( "tn06",         0x0000, 0x0400, ... )
  ROM_LOAD( "tn07",         0x0400, 0x0400, ... )
ROM_END

For this quick example we're interested in the CPU region, It lists the files and their starting memory locations and lengths.

In Factor this game can be emulated by calling the (run) word from Space Invaders. It takes the title of the window, a sequence describing the ROM files and a CPU object as parameters on the stack.

For the CPU object we just use the <space-invaders> CPU since the hardware is pretty close to the Space Invaders machine. The sequence contains 2 element arrays, each containing the ROM file name and the location to load it. So to run Balloon Bomber, this is all that's needed:

"apps/space-invaders" require
USE: space-invaders
"Balloon Bomber" &lt;space-invaders> {
    { HEX: 0000 "ballbomb/tn01" }
    { HEX: 0800 "ballbomb/tn02" }
    { HEX: 1000 "ballbomb/tn03" }
    { HEX: 1800 "ballbomb/tn04" }
    { HEX: 4000 "ballbomb/tn05-1" }
  } (run)

You'll need the ROM files in the 'ballbomb' subdirectory off the 'rom-root'.

I've added 'Balloon Bomber' to my repository as an example in 'apps/balloon-bomber'.

For some games you need to adjust the controls and graphics displays, etc. I'll do a later post on how to do this but it basically involves specialising various <space-invader> generic words.

Tags


This site is accessable over tor as hidden service mh7mkfvezts5j6yu.onion, or Freenet using key:
USK@1ORdIvjL2H1bZblJcP8hu2LjjKtVB-rVzp8mLty~5N4,8hL85otZBbq0geDsSKkBK4sKESL2SrNVecFZz9NxGVQ,AQACAAE/bluishcoder/-44/


Tags

Archives
Links