Blinky Project Is 6502s All The Way Down

Virtually any platform you might find yourself programming on has some simple method of running a delay. [Joey Shepard] got rather creative on a recent project, though, relying on a rather silly nesting method that we’re calling 6502s All The Way Down.

The project in question was a simple PCB that was shaped like a robot, with blinking LED eyes. Typically, you’d simply reach for the usual sleep() or delay() function to control the blink rate, but [Joey] went off-piste for this one. Instead, the PIC32 on the board runs a 6502 emulator written in MIPS assembly. This emulated 6502 is then charged with running a further 6502 emulator coded in 6502 assembly, and so on, until there’s 6502 emulators running six-deep on the humble microcontroller. The innermost emulator runs a simple program that blinks the LED eyes in a simple loop. With the overhead of running six emulators, though, the eyes only blink at a rate of roughly once every two seconds.

It’s an amusing and complicated way to write a blink program, and we applaud [Joey] for going to all that trouble. We imagine it was a great way to learn about programming the PIC32 as well as emulation in general. Meanwhile, if you’re working on your own emulator feats, be sure to let us know!

18 thoughts on “Blinky Project Is 6502s All The Way Down

  1. A 6502 emulator? Bah! The only reasonable way to do this (not not a 555) is an FPGA configured to be running a 6502 at maybe 100 Mhz. I don’t see that anything else really makes sense for something like this.

    1. Nah, you need to emulate all the iconic chips, in numerical order:
      Esp32 -> Z80 -> 286 -> atmega328 -> 386 -> 486 -> 6502 -> 8080 -> 68020…

      I think I’m missing some – others can fill in the gaps – but it’d be the turducken of processors.

      1. Yeah baby! Now that’s what I’m talkin’ about!! Maybe limit the nested emulation to 8 bit chips. I honestly expected a board with several real 6502 chips somehow playing some one inside the other game when I saw the “all the way down” title. Your idea though has great merit for someone with some time on their hands.

        1. When I worked for Uncle Sam, one of the few (the only?) off the shelf processors certified for space avionics was the RCA Cosmac Elf 1802. The fact it was CMOS made it more resistant to cosmic radiation. The 1802 was a pretty weird and annoying target to code for. Later we were able to use the 80C85, and that was a much more pleasant device to work with.

      2. Haha, I originally thought about nesting all the old video game console processors (6502 -> Z80 -> 68000, etc) but did not have enough patience for all those emulators. The other idea was having the first emulated 6502 emulate the MIPS emulator emulating it so you would get MIPS -> 6502 -> MIPS -> 6502, etc).

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.