Phasor A/V PAL Demo Uses ATmega88


Above is a new demo video called Phasor developed by [Lft]. It is run from an AVR ATmega88 and a few passive components, and the result is pretty amazing. [Lft] goes into detail about the tricks he used to get this up and running. The chip is clocked at 17.73447 MHz which is exactly four times the frequency of the PAL color carrier wave which allows him to fake a smooth signal. He also uses a timer trick to get the voltages that he needs. The work done here is beyond hardcore and quite frankly we can’t believe he managed to fit all of this into 8.5 KB of program space with just 1 KB or RAM. We wonder if there’s enough room there to add sound and color to the AVR Tetris project.

[Thanks Sprite_tm]

51 thoughts on “Phasor A/V PAL Demo Uses ATmega88

  1. Wow, spiffy!

    It is always impressive to see this much jammed in to such a small foot print; and it always gives me a bit of hope to see, after dealing with the majority of programmers who seem to need 10MB to print hello world.

  2. Holy crap!!! that is absolutely amazing to be able to generate a pal colour signal from such a low powered device let alone generating all those 3d objects and other effects… as well as music!!

    Nice work… and you are truly beyond hardcore!

  3. That takes me back to the Amiga demo scene and looking at some of the names that pop up such as Fairlight I’d imagine that he used to be part of it too. I wonder what team he was with.

    I did a small bit of coding for Vision Factory a long time back with Rudi Ratlos. Good days.

  4. another question is whats up with the lights?
    is it part of the demo, or is he turning the light dimmer up and down with it in the background?

  5. t&p, that’ll be his camera’s auto exposure over-compensating during the dark scenes. Exposure will increase as the overall mean brightness drops, and vice-versa

  6. @anon
    My brother said the same thing, but I am not too sure about that because of the reflection of the desk, and he turns the lights down on a ‘not really bright screen’ at the beginning, and then later, seems to get even more into the up and down with the lights.

  7. @t&p re the background lighting… It really is the camera overcompensating with spot metering and a little slowness in response. We should all learn from this – When you have an awesome project to capture on video use average or area metering and get closer to the object of interest but keep the cam steady and focused as this wizard did here.

    Super work!

  8. “It is always impressive to see this much jammed in to such a small foot print; and it always gives me a bit of hope to see, after dealing with the majority of programmers who seem to need 10MB to print hello world.”

    DOS version is still 22 bytes, but it can be shortened a little by using some undocumented initial register values to probably 18, 16 with no termination, and I think maybe a little less with direct video memory writes and a hung program.

    Windows version (via messagebox) is 1536 bytes assembled with FASM, and most of that is the PE header and can be reduced farther by stripping out various unused sections (thereby making it noncompliant).

    But then again 1.5T hard drives are ~$100 and my granny has 4GB of RAM in the computer she uses to check e-mail, so I’m not sure why people bitch and moan about this anymore.

  9. That’s a seriously neat piece of work – it warms my heart to see the art of compact coding is not only still alive, but really pushing the envelope of what’s possible.

    Very well done, lft :-)

  10. Astounding work! And talented/modest too! I should think the skills on show here would make him a very valuable asset to any games company or /shudder/ in embedded systems.

    “DOS version is still 22 bytes… …1.5T hard drives are ~$100 and my granny has 4GB of RAM in the computer she uses to check e-mail…”

    Your granny must be very rich.

  11. hehe..
    i was going to try something like this to enable colour 3d night vision on my video glasses.
    the problem was that the pic can’t generate anywhere near this much information, about the only way it would work would be to use a quad bilateral switch, LM1881 (to get the syncs and raw video data), seriesed schottky diodes to get the a-d at video speed and some other tricks.
    the upshot is it would probably work but occupy too much board space.

    on the flip side, something like this would be a perfect use for a digital delay line (aka DDL) made from a PIC10F206.
    internally clocked, and occupies a fraction of the space of anything like it.
    you’d just need four IO lines if MCLR was used as an input and the same chip could be used as a colour shifter by using two lines as +/- phase control.
    Simplez :)

    (now if only i could get these pesky pyroelectric sensors to work, grr… instant thermal imager if i used a round robin technique using pager motors and the good old fashioned trial-and-error image reconstruction trick.

  12. @Drove

    You might want to get a book about distributed/parallel computing.. having 8 “machines” doesn’t usually make your application 8 times faster.

  13. @cantido: Indeed, but being able to dedicate one of its cores to the task of generating the video signal and another to the task of generating the sound would probably make life quite a bit easier in this instance. Getting all the timing right and still having CPU time left over to actually produce something interesting on the screen and from the speakers is the tricky part, in my opinion!

    @Drone: Last time I attempted to buy a Propeller they were going to charge about $80 in all thanks to an absolutely ridiculous P&P charge. I couldn’t find a UK distributor so went into AVR development instead.

  14. you can make a “propeller” clone using eight PICs in parallel with the clocks separated by 1/4 of an instruction cycle.
    this can be done using a single clock and seven 40xx series logic gates (non inverting) in series with the clocks taken from each output.


  15. and for the record he has a demo running on a propeller, its a good demo but knowing whats running it kinda depreciates it IMO

    “i got video out of a propeller” so does everyone else!

    but these atmega88 demos are magical in the way they work

  16. @Ben Ryves

    That is true.. but from what I can see access to the shared memory (where your framebuffer would be) is single port and the arbiter is round-robin.. so if you had a cog rendering display data and then another cog generating your video signal you might end up having two cogs that are basically stepping around each other… that’s not to say that having 8 hardware threads can’t be used effectively, but I’d always prefer to have a faster chip with a ton of timers and interrupts. The ideal solution for video would be an CPLD and some dual port ram mapped into the processor’s address space for your framebuffer, but that’s not really the idea of the Real Wild compos. :)

  17. anyone know where i can find information on the types of effects used in this video and other demos? i know the popular “sine text” and “sine plasma” but im wondering about that twisting ribbon effect

    some of us need that $40 for real necessities, such as food and heating bills, you know?

  18. I’ve just regressed back to my 13yo Amiga owning days, all I can say is

    “Uber mad 1337 skillz” :)

    Really nice chiptuneage too, especially when it all goes a bit Daft Punk with the arpeggiator towards the end.

  19. “some of us need that $40 for real necessities, such as food and heating bills, you know?”

    see my previous statement, if 40$ is going to keep you from eating then maybe you should reconsider your standing in life and your hobbies

    I am no millionaire, but somehow I managed to scrape up a little extra money and got that 4 gigs of ram

  20. “reconsider your standing in life”

    LOL. Ok I probably deserved that. Anyhoo, my point was that the beauty of this is in the method. A Propeller demo would be just as good IMHO. (I think the borked nature of the shared buffer interlocking might make the job harder.) Doing colour composite video on a PIC (8-bit) or *gasp* an 8051 would just rock my little world.

    “I … got that 4 gigs of ram”

    Your capacious yet volatile byte store truly humbles me. :-)

Comments are closed.