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!
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.
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.
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.
“but it’d be the turducken of processors.”
Someone once offered me turducken.
I couldn’t stomach the idea of eating something that begins with turd.
B^)
All food end with turds though!
Right off my head, I would add 1802, 4004, 6800, 6809, 8008, 8086 and 8088. Since you add 286, 386 and 486, you should probably add 68000 and 68008 too.
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.
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).
And then have all that running on a Turing machine.
There still needs to be Bluetooth.
Also, somehow, a floppy drive. Preferably, playing Jingle Bells.
Flopotron Jingle Bells! Sing it, Yeah!
https://youtu.be/B87zdfOIPOc
…running a SPICE sim of a 555.
I like it, I like it, I really do…
However.. Spice does not run on a 6502.
But an emulated 6502 could run on Spice running on an emulated CPU somewhere
Spice might not, but I wonder if a circuit simulator made of cellular automata (like, for example, OKAD, but higher level) could be shoehorned in?
Is there an officially accepted/recognized “world record” of deeply emulated/simulated processors? For example carrying the above to 32 levels?
Did you watch “the 13th Floor” or “World on a wire” by any chance? ;)
Alan Turings Brain is emulated on a Neural net somewhere running on an emulated machine installed in a tarpit. And it simulating amusement.
It’s Matryoshka emulation.
Only instead of the dolls getting smaller, they get slower.