This project is submitted for

Description

Back in college, I had an itch to use one of these things. After looking up the datasheet, I found they're pretty easy to use, and interface easily with RAM, ROM, bus latches, bus registers, whatever.

The CPU runs at 4MHz. Instead of using Flash or EEPROM (or EPROMs with UV erase, eww!), I used a handy battery-backed 2KiB NVRAM for program storage. 8KiB SRAM provided additional scratch space (a somewhat necessary addition, along with making the NVRAM read-only: random logic glitches wrote into the NVRAM, corrupting the program!), hardly any of which was actually used. A couple 74LS273s provided output ports, including a matrixed 8-digit LED display.

Details

I don't have documentation for the entire circuit, unfortunately, so a description will have to do: the timer section was a one-shot timer, built from a chain of four 4-bit synchronous counters, with a bus pre-load function, and an interrupt output.

To generate a continuous square wave, the CPU loads the timer-high and timer-low registers, enables the count-down bit, and goes off doing its own thing. Some time later, the interrupt fires. The ISR complements an output bit (the square wave output pin), re-initializes the timer registers, and returns.

To generate music, the number of half-cycles is counted. When that finishes, the next entry in the music table is loaded, providing a new timer count and half-cycle count. When the table is finished, it loops back to the beginning, playing the song on loop.

With the tone generator code, it doesn't fit in 1k, so I'm providing that as information, and optional hardware. But the display stuff works great, and looks great, using well under 1k.

(To be precise, the 1k challenge part of this project is only what's on the web pages above: the circuit and code (which assembles to under 1KiB used code) are provided, as well as the means of programming.)