The aim of this project was to implement Tetris game as close to the original game as possible within the 1KB code limit.
The game has the following features implemented:
- optimized to 1024B of code (see build.log file attached as a proof or build it yourself)
- real random number generator using free pin ADC noise for next tetrimino randomizing (you will never play the same game twice)
- next tetrimino is shown on the bottom of the screen
- level dependent game speed (the higher level you are the faster tetriminos drop)
- 4 buttons: left, right, down, rotate
- game level indicator (there are levels from 0 to 63 shown as a bar on the right side of the screen)
Technical specification:
- ATMega8A-PU microcontroller running at 8MHz
- Fusebits used: High: 0xD1, Low: 0xE4
- Nokia 3310 monochrome LCD display with 48x84px resolution (PCD8544 controller)
- The game is developed in C language and compiled using avr-gcc 4.9.2 in Atmel Studio 7.0 IDE
- The project uses not connected ADC0 pin to capture the noise to use it as random values. These randomized values are used to select next tetriminos during game play. It means you will never play the same game twice.
- 5V power supply
- 6 classic Tetris tetriminos ("J","L","O","S","T","Z" -shaped), plus 2 non-classic tiles (3-pixel "I"-shape and 1-pixel "." (dot) shape)
- Due to the optimizations the source code might not be as easy to read as it could. I added many comments to the source code
- To drive LCD display I used and optimized existing PCD8544 driver downloaded from https://fandigunawan.wordpress.com/2008/06/18/lcd-nokia-3310-pcd8544-driver-in-winavravr-gcc/
BOM:
- ATMega8A-PU microcontroller
- Nokia 3310 monochrome LCD display
- 100uF/6.3V capacitor
- 1uF/35V capacitor
- 100nF ceramic capacitor
- 5x microswitch
- 8x 10KOhm resistor
- 100KOhm resistor
- bread board
- a couple of insulated wires to connect all the pieces
- 5V power supply
Hmm, I don't remember there being 1-block or 3-block tetrominos in the original Tetris.