New! Dark mode!

Browsing Pinside at night? Getting tired of all the white? Switch to dark mode using the button in the top right (or CTRL-B)!

(Topic ID: 54979)

AC/DC, X-Men : Program modification - Proof of concept

By oga83

7 years ago

Topic Stats

  • 65 posts
  • 35 Pinsiders participating
  • Latest reply 5 years ago by oga83
  • Topic is favorited by 17 Pinsiders


Linked Games

Topic Gallery

One image has been uploaded to this topic. (View topic image gallery).


You're currently viewing posts by Pinsider oga83.
Click here to go back to viewing the entire thread.

#1 7 years ago

I used the Pinball-Browser to add a "Tennis game" on my pinball (

For the Breakout game, see

See the video :

It is a very small program (around 100 lines) and is not meant to be perfect...
It is just a "proof of concept" to show that code modification on a pinball is possible and not so complicated.
It has been tested on AC/DC and X-MEN, but it should work on some other games (MTLE, ...).

Warning : I have not tested the following code with the latest firmwares or latest Pinball Browser version.

How to compile :
Download and install the gnu arm toolchain

And use the following commands :

arm-elf-gcc -mcpu=arm7tdmi -mlong-calls -O2 -g -c tennis.c
arm-elf-ld --script tennis.linkerscript -o tennis.elf tennis.o
arm-elf-objcopy --strip-all --output-target=srec tennis.elf tennis.hex

How to install :
Use Pinball Browser to load the tennis.hex file :
- Load a stock firmware;
- In the "Advanced" tab, click on "Bind patch to service menu Util/Help";
- Click on "Load Patch" and select the tennis.hex file;
If you get any errors at this stage, that means that the game will not work on your pinball.
The patch has to be applied before any other modification (image, message, ...) made on an original firmware.
- Save your modified firmware and upgrade your pinball machine with it.

To start the tennis game, enter the Service menu, and go to Util/Help, as shown in the video

The linker script (tennis.linkerscript) :

    .text 0x410ce00 : { *(.text) }
    .data : { *(.data) }
    .bss : { *(.bss) }

The source code is here (tennis.c) :

// --------------------------------------------------
// Tennis Game v1.02
// --------------------------------------------------

// Pinball functions
void (*VectorTableStart)()=(void *)0xC0FEBABE;
int (*SoundRequest)(int)=(void *)1;
int (*GetSwitchState)(int)=(void *)2;
void (*DisplayTextPrintf)(char *, unsigned, int, int, int, int, int, ...)=(void *)3;
void (*ProcessSleep)(int)=(void *)4;
void (*DisplayShowBuffer)()=(void *)5;
void (*DisplayClearBuffer)()=(void *)6;
volatile struct { unsigned Duration; unsigned Duration2; unsigned u1; unsigned u2; } *ptrKeyPressedTable=(void *)7;
unsigned *ptrCurrentBuffer=(void *)8;
unsigned GameNameId=0xffffff00;
void (*VectorTableEnd)()=(void *)0xBABEC0FE;

// --------------------------------------------------
// Entry point
// --------------------------------------------------

// The entry vector table must be defined before any other function
asm("b TennisGame\n" // Service Menu
    "OldMenuHandler: .int 0\n" // Space for old handler (patched by Pinball Browser)
    ".int 0\n" // Knocker
    "OldKnockerHandler: .int 0\n" // Space for old knocker handler (patched by Pinball Browser)
    ".int 0\n" // Space for future use
    ".int 0\n"
    ".int 0\n"
    ".int 0\n"
    ".int 0\n"
    ".int 0\n"

// --------------------------------------------------
// Utilities
// --------------------------------------------------

int IsKeyPressed(int iKey)
    // Asked for a specific key ?
    if (iKey>0) return (ptrKeyPressedTable[iKey-1].Duration!=0) ? iKey:0;

    // Look if any key is pressed
    int i;
    for (i=0; i<4; i++)
        if (ptrKeyPressedTable[i].Duration) return i+1;
    return 0;

void WaitForKeyRelease(void)
        // Acknowledge all keys
        int i;
        for (i=0; i<4; i++)
        // Wait
    } while (IsKeyPressed(0));

// --------------------------------------------------
// Tennis game main routine
// --------------------------------------------------

void TennisGame(void)
    // Play a song on some games
    if (GameNameId==0x442f4341)
        SoundRequest(217); // AC/DC : Play Whole lotta rosie
    else if (GameNameId=0x4154454d)
        SoundRequest(79); // Metallica : ?

    // Splash screen
    int xText=64;
    while (!IsKeyPressed(0))
        if (++xText>128) xText=0;
        DisplayTextPrintf("- TENNIS GAME V1.02 -", *ptrCurrentBuffer, 10, 2, 64, 10, 0);
        DisplayTextPrintf("PRESS ANY KEY !", *ptrCurrentBuffer, 10, 2, xText, 28, 0);

    // Play tennis
    int Key, xRacket=64, xBall=64, yBall=0, dxBall=1, dyBall=1, iCount=0, iMissedTimer=0;
    while (!IsKeyPressed(KEY_SELECT) && !IsKeyPressed(KEY_BACK))

        // Handle racket
        if (GetSwitchState(137) && --xRacket<0) xRacket=0;
        if (GetSwitchState(141) && (xRacket-=2)<0) xRacket=0;
        if (GetSwitchState(139) && ++xRacket>128) xRacket=128;
        if (GetSwitchState(143) && (xRacket+=2)>128) xRacket=128;
        DisplayTextPrintf("--", *ptrCurrentBuffer, 10, 2, xRacket, 34, 0);

        // Handle ball
        int iSound=0;
        if (xBall<3) { xBall=3; dxBall=1; iSound=0xf; }
        if (xBall>125) { xBall=125; dxBall=-1; iSound=0xf; }
        // Is ball on racket ?
        if (yBall<6) { yBall=6; dyBall=1; iSound=0xf; }
        if (yBall>30)
            yBall=30; dyBall=-1;
            int bOnRacket=(((xBall-xRacket>=0) ? (xBall-xRacket):(xRacket-xBall)) <= 7),
            if (bOnRacket)
                xBall=64; yBall=0; dyBall=1; iMissedTimer=10;
        DisplayTextPrintf("O", *ptrCurrentBuffer, 10, 2, xBall, yBall, 0);

        // Display "Missed message"
        if (iMissedTimer)
            DisplayTextPrintf("YOU MISSED !", *ptrCurrentBuffer, 10, 2, 64, 15, 0);

        // Display initial message
        if (iCount++<50)
            DisplayTextPrintf("PRESS START TO EXIT", *ptrCurrentBuffer, 10, 2, 64, 10, 0);

        // Bounce Sound ?
        if (iSound) SoundRequest(iSound);


#4 7 years ago
Quoted from PanzerFreak:

Great stuff! This is a very cool. Is it possible to modify existing game code (rules) in ACDC if a modification like the one you did can be done?

Very complicated, but everything is possible... it's just a question of time.

#10 7 years ago
Quoted from sd_tom:

Yeah, viewing ROMs is one thing but changing code might get stern's attention (bad way)? Then again you're not in the US so maybe could skirt all that. Not a lawyer but, if there is any copyright circumvention going on the DMCA covers tools for copyright circumvention here in the states.
I just know people are pretty cagey about the existence of modified ROMs for the Williams games that simply fix led ghosting. Sure there is history there?
This all being said, pretty cool

No part of the original firmware is distributed. The hex file has only code that I wrote.
However, I don't want Stern to be upset about this... If there is any potential issue with this, I will stop it and not publish anything

#34 7 years ago

Thanks to all of you who support my work

However, I have to say that I was not prepared for some of the comments saying things that 'it's not legal", 'it's not good for the community' or things like that...
So, let me clarify some points :
- Pinball and programming are 2 of my hobbies. I found a way to combine both of them by writing the Pinball browser; I'm not doing this for money and I don't get any benefits with this.
- Replacing images, sounds and even code seems like any other mod to me. When you change the layout of your playfield, you also change general artwork on which there is a copyright.
- Correct me if I'm wrong, but I don't think there is any software license included in the box at delivery, and we don't have to agree with such a license before using our pinballs.
- There is nothing malicious in all of this.
- I'm not revealing any secrets; Should I find some, I will not publish them.
- I don't really see why Stern should be upset about this : I really thing that this makes their games more attractive and it's all good for them. They did a great work on their pinballs and I really enjoy my AC/DC. If they are upset about this for any reason, they just have to us let know on the forum and I'll do my best to adjust the software to make them happy.

Of course, I might be wrong and if the community thinks that it's not good, I will stop; I could do this on my own, for me and a few friends only, without sharing anything.

#37 7 years ago

I have updated both the .hex file and Pinball-Browser.
This .hex should now work on some other games like MTLE, X-Men, ...

#38 7 years ago
Quoted from thedarkknight77:

oga83..............Worry about nothing, you are completely in the clear. There is absolutely nothing illegal about what you are doing. There is "Zero" Stern can do about changing the images or music on a pinball machine....................No different than they can't stop me from spray painting the side of the cabinet if I want to or putting LEDs on a game. Some of these morons on this sight crack me up. If anything this program makes the value of Sterns machines go up and creates more demand for them. If you were selling hacked files with different content is where you would get slapped.............
Either way, you have managed to create the greatest mod in pinball history and you gave it to us for free. We owe you, we owe you big time brother!

Quoted from frolic:

I'm sorry if I was part of those comments with my early one. I think this is an awesome "mod". Congrats.

Thank you for your message !

#42 7 years ago
Quoted from Wolfmarsh:

The worst thing Stern could do is actively try and stop this, and I have a feeling they won't.

In term of marketing, I think it's good for them, so I also believe they won't.

#50 7 years ago

The tennis game is confirmed to work on X-Men.
Many thanks to DugFreez for his tests !

#51 7 years ago

C-Source and compile instructions added in the op

3 months later
#60 7 years ago
Quoted from ViolatedBird:

Could you please re-upload

Done !

1 year later
#63 5 years ago
Quoted from Mcpit:

- Where do we download tennis102.txt from?
- Looks like both the linker and the compiler are dead links!

The OP has been updated

1 month later
#65 5 years ago
Quoted from Mcpit:

I'm guessing could be a valid alternative?


Promoted items from the Pinside Marketplace
$ 35.00
Cabinet - Other
Arcade Upkeep

You're currently viewing posts by Pinsider oga83.
Click here to go back to viewing the entire thread.

Hey there! Got a moment?

Great to see you're enjoying Pinside! Did you know Pinside is able to run thanks to donations from our visitors? Please donate to Pinside, support the site and get anext to your username to show for it! Donate to Pinside