Leon Anavi
IT Tips && Tricks

Mobile & Embedded

Created: 17.01.2015 10:49 Last Modified: 25.01.2015 12:08 Views: 18455
Keywords: Allwinner, Arcade, ARM, ARMv7, Debian, Game, Linux, MAME, OLinuXino, Rockchip, Ubuntu, XMAME

How to Build Arcade Game Machine with Linux, MAME and ARM Development Boards

Getting Started

Recently I was challenged to run old arcade video games on modern low cost ARM development boards. So here is a tutorial which will guide you how to play your favorite games for the '80s such as Moon Patrol with open source software on open source (and not only) hardware ARM device.

MAME stands for Multiple Arcade Machine Emulator and it is an open source project for porting popular arcade games from the late '70s, '80s and '90s. It is available for Windows, Mac OS X and Linux. It was very easy to get MAME working on my laptop with Intel i5 CPU and Ubuntu but it was more complicated with ARM development boards.

In this tutorial you will learn how to run arcade video games with emulator on ARMv7 development boards with Linux distributions. It has been tested on Debian and Ubuntu for the following development boards:

The advantages of the ARM development boards are the low cost and low power consumption. The OLinuXino boards, manufactured by Olimex, are open source hardware so they are they are my preferred choice for rapid prototyping. In general one of the main issues with any ARM development boards is the support of proper drivers for hardware graphic acceleration on Linux. MAME exists as a Debian package for ARM devices but unfortunately I got a segmentation fault when I tried to run it. After that I build version 0.157 from source but I got the same error when I tried to launch it. MAME relies on SDL2 library to provide low level access to graphics hardware via OpenGL. All ARM devices on which I tried to run MAME have Mali GPU and my guess is that its drivers were not properly functioning with SDL2. I switched to plan B: XMAME. This is a port of MAME for X11/Unix systems which was merged into to the mainstream project several years ago. I built XMAME 0.106 from scratch. Although it is possible to cross compile XMAME for ARM on a personal computer with Intel or AMD CPU, I preferred to build it directly on the ARM device. Finally I was able to play arcade games on my ARM development boards!

The procedure for building XMAME for ARM described below has been tested devices with ARMv7 compatible CPU. For owners of Raspberry Pi, which has ARMv6 CPU, it will be easier to use the OS image for gaming called PiPlay.

Building XMAME for ARM

Perform the following steps to download, configure and build the source code of XMAME for ARM:

  1. Install dependencies:
    sudo apt-get install build-essential libgtk2.0-dev libgnome2-dev libsdl1.2-dev libxv-dev libxv1
  2. Download the source code of XMAME:
    wget http://caltaxcn.googlecode.com/files/xmame-0.106.tar.bz2
  3. Extract the downloaded archive and go to its directory:
    tar -xjf xmame-0.106.tar.bz2
    cd xmame-0.106
  4. Edit src/unix/unix.mak with your favorite text editor, for example vim, and change CFLAGS.risc_lsb = -DALIGN_INTS -DALIGN_SHORTS -DLSB_FIRST to CFLAGS.arm = -DALIGN_INTS -DALIGN_SHORTS -DLSB_FIRST
  5. Edit makefile.unix and make the following changes:
    • CFLAGS = to #CFLAGS =
    • CFLAGS = -O2 to #CFLAGS =
    • MY_CPU = i386 to MY_CPU = arm
  6. Build the source code
    make

Playing Arcade Video Games on ARM

You will need a ROM to play a game. ROMs for MAME are distributed as ZIP archives. Several ROMs are officially distributed for free at the website of the MAME project. You can also find a lot of other ROMs for MAME in the web.

Perform these simple steps below to run and play an arcade video game on ARM device with Linux using the XMAME binary that you have compiled following the tutorial above:

  1. Create a directory to store the ROMs:
    mkdir roms
  2. Download a ROM, for example Star Fire and save it at directory roms.
  3. Run the ROM:
    xmame.x11 roms/starfir2.zip
Playing arcade games with MAME on Debian and OLinuXino open source hardware ARM board

I noticed that the fullscreen mode was not properly working. As a work around I enable the auto hide option for the panel of LXDE on the Debian images provided by Olimex for OLinuXino boards with Allwinner A10 or A20 SoCs. After that I manually adjusted the screen height and the scaling for the width to the resolution on my monitor (1280x720px):

xmame.x11 roms/starfir2.zip -ah 720 -ws 5
Running XMAME in full screen on Debian and OLinuXino open source hardware ARM board

  Home | About | Contact | Disclaimer | Sitemap © 2009-2022 Leon Anavi. All rights reserved.