[Electronics]  [Files]   [Links]

 
Electronics » the Z80 project » demo


50 Frames per second / Glitch-free. Honest!

Yep, a logo, starfield, some wibbly sinus sprites and a scrolly message... These were the things demos were made of in a time before polygons. There's no music unfortunately, though it does make the classic "phasing noise". Click the pic to download a clip (Div-X 5 format - sorry about the frame-rate and quality, best I can do with a digital camera off the TV screen - the RGB only output makes direct video capture a problem.)

The intro weighs in at 15.5KB (uncompressed), there's 8 hardware sprites (the wavey "PHIL2005" characters you can see there), 90 software sprite blobs - 30 on each bit plane, with a starfield on the 4th - both are double-buffered to avoid tears. I used hardware scroll and double buffering to assist the scrolling message - it moves at 4 pixels per frame so only needs to be byte shifted every other frame.

The old Z80 certainly requires you to jump through a few hoops to get the best speed - I didn't use any self-modifying code, but had to unravel some loops and page align data tables to make indexing quicker (that's one thing that's sorely missing from the Z80 instruction set, a "Load r with (Address + Index)" - of course there's the IX and IY registers but they're slow as it is and the index is in the opcode which is inelegant to say the least). Also the software sprite routine is custom built for those 8x8 spot images and no pixel shifting is being done by the CPU - it just picks the a piece of code to run based the 3 Least Significant Bits of each blobs' x coordinate and that code writes out a pre-shifted definition. Should you wish to peruse the Z80 source code (which as usual isn't well commented or anything..) its here.

Incidentally, I now use PASMO to assemble my Z80 code on the PC - an excellent and free util!