Apart from doing trivial tasks, Atmel AVR does games as well!
Dry specs: | |
---|---|
Schematics: | Circuit.pdf (png) |
Firmware: | BDash16.hex (BDash16.hex is for ATmega164/324/644) |
Source code: | Not yet available |
Operating Voltage: | 5V |
Power usage: | 55mA (please supply at least 100mA) |
CPU frequency: | 20MHz |
Horizontal Sync: | 31446,5409 Hz |
Vertical Sync: | 60.0124826 Hz |
Audio Frequency: | 10482.1803 Hz |
Audio Channels: | 1 (mono) |
Sample Resolution: | 8 bit |
Actual Video Resolution: | 510 pixels x 480 lines |
Shown Video Resolution: | 255 thick pixels x 160 thick lines |
Video Colors: | 6 bit; 63 colors + black |
The ATmega164P-20xx (or 324/644/1284) handles everything. There are no external chips handling the display or sound. Also, there's no external RAM.
Everything happens inside the AVR.
The only extra components needed are the clock-crystal, standard capacitors (100nF, 10uF, 18pF), a number of resistors for the colors and a number of resistors for the sound R2R.
Remember: it has to be a 20MHz chip; eg. ending in -20PU for instance.
Almost the entire ATmega164P has been used; including 'unused' hardware registers.
(The USARTs, for instance are not in use, so several of those registers have been used for flags and counters).
There are currently 34 free bytes available in Flash memory and 3 unused bytes in SRAM.
It's still possible to make optimizations to get more room for code.
FYI: No code or graphics have been copied from any of the original versiosn. Everything has been written in assembler from scratch, every line of code have been carefully optimized, to make everything fit into the Flash memory; this has taken up around 1/3 of the total development time.
Facts about the original game: | |
---|---|
Developed by: | Peter Liepa with Chris Gray |
Game Title: | Boulder Dash |
Year of development: | 1984 (BD1), 1987 (BD2) |
First seen on: | Atari XL |
Platforms: | Atari XL/XE, ZX Spectrum, Commodore VIC20, Commodore 64, BBC, and many others... |
Atmel AVR version features: | |
---|---|
AVR version based on: | ZX Spectrum version (with some inspiration from the Atari XL graphics) |
Number of caves: | 3: 1 Custom + Cave K from BD1 and Cave M from BD1 |
Number of levels per cave | 5 |
Implemented objects: | Everything from BD1 and BD2, plus expanding wall up/down/both, plus one secret object and reserved space for 2 more |
Number of implemented object types: | 28 |
Number of 16x16 pixel sprites: | 57 [not including the top-line] (try using your calculator here, just for fun) |
Number of objects per cave | 40 x 22 (880) |
Initial number of lives: | 3 |
Extra life: | Every 500 points |
Max lives: | 9 |
Time available | Max. 255 Boulder Dash seconds (approximately 1.4 * a normal second) |
Number of diamonds needed | Between 0 and 255 |
Value of diamonds | From 0 to 255 |
Value of bonus diamonds | From 0 to 255 |
Score display | 8 digit (original version shows only 6 digits) |
Colors used: | Probably 20 possible at the same time. Up to 24 should be possible. |
You may complain about the scrolling, and ask if I couldn't do a better scroll. I think I could, but I wanted this to resemble the Spectrum version; I always got kind of dizzy when I looked at the Atari XL/XE version, which scrolled smoothly. Besides, scrolling this way gives me an opportunity to implement a 15 pixel border on each side. Also the top contains 8 pixels of border behind the text.
Goal: Collect enough diamonds (two yellow digits), then the Exit will be opened. Diamonds can be produced by killing butterflies or converting boulders into diamonds by dropping them through a millwall.
Beware of the fireflies, butterflies, falling diamonds and falling boulders. Be greedy, but not too greedy.
Amoeba grows, when fireflies or butterflies touch amoeba, they get killed. If you drop a diamond or boulder on a firefly or butterfly, they get killed as well.
When butterflies are killed, they implode to 9 diamonds.
When fireflies are killed, they explode.
Here's a close-up of our hero; it's just a digital photo of Rockford on my TFT-monitor:

As you can see, there are 'scanlines'. These are made on purpose. I output one black scanline followed by two identical pixel lines.
Some samples of the graphics, so you can see the quality a little better than what the video shows (these are all photos):
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Amoeba | Boulder | Butterfly | Diamond | Dirt | Firefly | Titaniumwall | Wall |
I apologize for the poor quality of my video; it's recorded with my Samsung digital camera; not a camcorder.
My digital camera can only capture 640 x 480 @ 30 FPS, so you'll probably see some 'ghost' graphics now and then.
Also, the colors look better on a real monitor, and the picture is a bit sharper.
The video shows you level 1 (out of 5) of the 3 caves.
Each cave can have its own color palette.
Each level looks slightly different from the previous level and is also a bit more difficult.
Alright.. I'll let you watch the video now... :)
# Fuse bits:
avrdude -c avrispmkii -P usb -p atmega164p -U efuse:w:0xff:m -U hfuse:w:0x99:m -U lfuse:w:0xf7:m
# Flash programming:
avrdude -c avrispmkii -P usb -p atmega164p -U flash:w:BDash16.hex:i
avrdude -c avrispmkii -P usb -p atmega164p -U efuse:w:0xff:m -U hfuse:w:0x99:m -U lfuse:w:0xf7:m
# Flash programming:
avrdude -c avrispmkii -P usb -p atmega164p -U flash:w:BDash16.hex:i
If you do not have an ATmega164P, the following AVRs will work: ATmega324P, ATmega644P, ATmega644A-PU, ATmega644PA-PU.
To flash the ATmega644P instead of the ATmega164P, simply change 164 to 644 in the above command-line code.
To flash the ATmega644A, you'll need to edit avrdude.conf; duplicate the m644 entry and rename it to m644a, rename description to "ATMEGA644A", change signature to 0x1e 0x96 0x09.
Note: If you haven't done so already, you may want to set the speed of AVRISPmkII:
$ avrdude -p atmega164p -c avrispmkii -b 115200 -P usb -tuF
(wait for the terminal prompt)
>sck 10
>quit
You only need to set it once. I use this setting all the time.(wait for the terminal prompt)
>sck 10
>quit
First of all, a huge thank you to Peter Liepa and Chris Gray. Without these two people, the world would have looked very different today.
A special thank you goes to Leonard Ilnius, who donated enough money to get my next tools for making electronics at home. I am very grateful. :)
Likewise, Jörgen Overgaard donated an important amount of money as well, thank you very, very much!
Update: I now have the ability to etch PCBs at home, which means I've already made a prototype PCB for AVR-BDash.
Credits go to the authors of the ATtiny2313 Monitor Tester, Deogen at EOSystems.
Thank you Jepael for correcting me, when I forgot to connect AVCC and AGND, also for pointing out the VGA resistor values were incorrect (now corrected).
Cliff also deserves a great thank you, for his help with GCC and GAS.
Thank you Dean, Brad, Bjønar, Tarek and Richard for encouragment, which is more important than you'd ever think.
Also a big hi to Linus Åkesson aka LFT!
Plans exist to extend the project to use the EEPROM; your guess on what it will be used for, will most likely be correct.