FPGA Breakout Atari 2600 Video Game FPGA Reproduction

Download Report

Transcript FPGA Breakout Atari 2600 Video Game FPGA Reproduction

FPGA Breakout
Atari 2600 Video Game FPGA Reproduction
Doug Cumbie, CpE MS
UCF Fall 2008
EEL 5772 – FPGA Design
Professor: Jooheung Lee
December 2, 2008
Atari Breakout
 Developed and released by
Atari in 1976 as a coinoperated arcade game
 Originally designed by Steve
Wozniak (Inventor of the Apple
computer) using only discrete
logic chips
 Eventually released for the
Atari 2600 video game system
in 1978
Gameplay
 Break bricks for points by altering the path
of a moving ball with a controllable paddle
 Avoid missing the ball and losing 1 of the 5
available lives
 Destroy all the bricks across 2 levels for a
total possible score of 864 points
FPGA Breakout Design Modules
 Video Generation
 User Input Controller
 Internal Logic





Graphics Display
Collision Logic
Score/Lives Logic
Paddle and Ball Frame Counters
Ball Movement
FPGA Breakout Design Overview
Video Generation
 Model graphics resolution after Atari 2600
native resolution of 160x192 pixels
 Extends the 640x480 Pixel VGA Display Driver
from Lab 2
 Horizontal and Vertical Counters are scaled to
create the appropriate pixel size and resolution
[7:0] Pixel_X = Hcount / 4;
[7:0] Pixel_Y = (Vcount >= 48) ? (Vcount-48)/2;
Graphics Display and Animation

Graphics are displayed by setting the appropriate pixel color for each object when the
Pixel_X and Pixel_Y values are at a specific location


Objects include: Ball, Paddle, Walls, Bricks, Scoreboard
Animations are done by using an adjustable counter
module, FrameCounter, for timing the positional
updates of the ball and paddle
Paddle FrameCounter is fixed at 200Hz rate (5ms refresh)
Ball FrameCounter is adjusted based on the
number of bricks remaining







108 to 95 bricks: 33 Hz (30ms)
94 to 80 bricks: 50 Hz (20ms)
79 to 20 bricks: 100 Hz (10ms)
19 to 0 bricks: 125 Hz (8ms)
Ball movement is varied by slope ΔY/ Δ X, and altered by
colliding with different X-positions on the paddle
Collisions




Ball collisions with objects reverses X or Y direction
Ball collisions occur at object edges (Top, Bottom, Left, Right)
Bricks (6 rows of 18 bricks – 108 total)
Brick collisions are realized by checking ball’s current position and a 108-bit
brick state register
 Bricks are only destroyed on a top or bottom collision
 If a brick top or bottom collision is detected, the following actions are
performed:
if (BRICKS[18*yBallBrick + xBallBrick])
begin
// 1. Clear brick state
BRICKS [18*(yBallBrick) + xBallBrick] = 0;
// 2. Decrement total brick count
brickCount = brickCount - 1;
// 3. Alter ball’s motion
yBallDelta = -yBallDelta;
// 4. Update score
Score = CalcScore(Score, yBallBrick);
end
Score and Lives Logic
 Number fonts are stored in a 16 bit wide x 140 deep Single Port
ROM (predefined in a COE file)
 Each digit has a unique ROM and values are displayed by painting
gray pixels at the top of the screen for every logic ‘1’ in ROM
 The 3-digit Score is contained in a 10-bit register
 Score is converted to 3 BCD values for each digit (hundreds, tens,
and ones place) by using a module Score3BCD
User Input Controller
 Provides input to the gameplay – moves paddle
 Uses original Atari 2600 joystick
 Hardware interface to Joystick:
9-pin male D-sub connector to
Xilinx board’s I/O expansion headers
 Joystick commands send logic lows
 Verilog software module inverts commands
Demonstration…
Questions?