aPong

aPong is a Pong game written in x86 Assembly language.
Download

aPong Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Richard Whitty
  • Publisher web site:
  • http://www.csc.liv.ac.uk/~cs6rlw/misc.html#bbot

aPong Tags


aPong Description

aPong is a Pong game written in x86 Assembly language. 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":· 2-player 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 STPRequirements:· NASM· GCC (for linking)· libSDL (for graphics and input)Compilation:nasm -f elf pong.ogcc -o pong pong.o -lSDLControls:Player one Q (up), A (down)Player two P (up), L (down)Escape - quit


aPong Related Software