aPong is a Pong game written in x86 Assembly language.

  Add it to your Download Basket!

 Add it to your Watch List!


Rate it!
send us
an update
GPL (GNU General Public License) 
3.3/5 15
Richard Whitty
ROOT \ Games \ Arcade
aPong is a Pong game written in x86 Assembly language.

As I run Linux on my own machine, I don't do a lot with intel syntax. I needed to learn this for a lab. After scouring the internet for a few hours, I came across NASM. This looked as though I'd be able to just code in this, take it into the Windows computers and have it just work.

No such luck. So, that's beside the point now, but I wrote this in order to get to grips with the syntax (which turned out to be the wrong one.)

Here are some key features of "aPong":


The left one uses Q/A to go up/down, the second one uses P/L. Escape to quit.

Uses SDL from assembly language

I quite like SDL. I quite dislike x86. I already know SDL. It was already a learning exercise, I wasn't going to go off learning xlib or something at the same time. This gave me a way to quickly get the code written.

Avoids the use of frame pointers

Why do you need frame pointers if you're not going to be running it in a debugger. It's not difficult to keep track of the stack frame if you're writing it yourself. You don't need to keep moving the stack pointer inside a function, just once at the start and once at the end. Then all you need is to take offsets from esp (so long as you remember how big the frame is at the time.)

This really gets on my nerves. People don't seem to realise the amount of overhead (in terms of 'lost' cycles) that a function call has. To say global variables are BAD is just plain wrong. Sure, it can lend itself to abuse, but that's like saying you shouldn't code in C or use UNIX because they don't hold your hand.

The input system isn't great.

Because I was trying to keep the code size down, I went the way of using SDL_GetKeyState and SDL_PumpEvents. These mean that if the key is not actually down at the time of the PumpEvents call, it drops the keypress. (if you want to see how you should do it, look at the events system in STP


GCC (for linking)
libSDL (for graphics and input)


nasm -f elf pong.o
gcc -o pong pong.o -lSDL


Player one Q (up), A (down)
Player two P (up), L (down)
Escape - quit

Last updated on March 5th, 2007

#pong game #arcade game #board game #aPong #pong #arcade #board

Add your review!