492-byte demo on ATtiny5

Original author: Jari Tulilahti
  • Transfer
  • Tutorial


Demos usually have more complex graphics than games of the same volume. After all, you do not have to spend resources on user interaction and additional calculations. The proposed program runs on an ATtiny5 microcontroller with 512 bytes of ROM, 32 bytes of RAM and 16 processor registers. Rakettitiede is in Finnish “rocket science” (including in the same meaning as in English phraseological units), as well as the name of a software company.

The circuit board for the demo:



Everything is familiar here, except for the LTC1799 component. This is a clock configured by a resistor. It operates at a frequency of 12 MHz. Another fairly stable generator of rectangular pulses at the same frequency is suitable. To obtain the five signals necessary for the VGA monitor from the three outputs of the microcontroller, dividers are used on the LEDs and resistors, which also use 75-ohm resistors built into the monitor. Each of the outputs can be switched by the program to zero, one and a high impedance state.

Since the acceptance of applications at the Hackaday competition was ending, the author sent an intermediate version of the demo there, which did the same thing except for the output of the text:


It occupied 394 bytes, or 197 16-bit words:

avra  -l pentaveega.lst pentaveega.asm
AVRA: advanced AVR macro assembler Version 1.3.0 Build 1 (8 May 2010)
Copyright (C) 1998-2010. Check out README file for more info
   AVRA is an open source assembler for Atmel AVR microcontroller family
   It can be used as a replacement of 'AVRASM32.EXE' the original assembler
   shipped with AVR Studio. We do not guarantee full compatibility for avra.
   AVRA comes with NO WARRANTY, to the extent permitted by law.
   You may redistribute copies of avra under the terms
   of the GNU General Public License.
   For more information about these matters, see the files named COPYING.
Pass 1...
Pass 2...
done
Assembly complete with no errors.
Segment usage:
   Code      :       197 words (394 bytes)
   Data      :         0 bytes
   EEPROM    :         0 bytes

After optimization, the demo was reduced to 354, and then 352 bytes. But then the author decided to add text to the picture, after which the program began to occupy 492 bytes:


The code lies on Bitbucket here , as well as on Hackaday as separate files: pentaveega.asm , tn5def.inc and pentaveega.hex .

The device can be assembled in three versions: on two types of breadboard models using adapter boards, as well as on a printed circuit board (under CC-BY-SA 4.0, files in a separate project folder on Bitbucket). Pay attention to the way to connect the monitor connector during assembly according to the first option:






Also popular now: