Blinky robot with emulated 6502

Topics pertaining to the emulation or simulation of the 65xx microprocessors and their peripheral chips.
Post Reply
User avatar
Druzyek
Posts: 367
Joined: 12 May 2014
Contact:

Blinky robot with emulated 6502

Post by Druzyek »

Just for fun, I made a blinky robot with a PIC32 emulating a 6502. Pictures and description on my blog.
blinky-robot-front.jpg
The PIC32 is running a 65C02 emulator I wrote in MIPS assembly. Partly to test the emulator, I got Tali Forth 2 running on it and now use QEMU for MIPS so I can have Tali Forth 2 in my Linux terminal (blog post here). MIPS assembly is now my favorite assembly of all and a lot of fun to use.

The 65C02 program running inside the emulator is itself a 65C02 emulator (GitHub link). On the code I tested, it emulates at about 1/20th the speed of the real thing. When this emulator starts, it points to its own program code so you get an emulator in an emulator. Each new emulator emulates another emulator until it's five levels deep. The fifth level of emulation runs a tight loop blinking the LED eyes on and off as fast as possible. All the layers of emulation combine to reduce the execution speed down to a few hertz so the blink rate is once every 2 seconds or so.

Emulator 1 (MIPS) -> Emulator 2 (65C02) -> Emulator 3 (65C02) -> Emulator 4 (65C02) -> Emulator 5 (65C02) -> Emulator 6 (65C02) -> Blinky (65C02)
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Blinky robot with emulated 6502

Post by BigEd »

Most obscure way to manage a timing loop!
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Blinky robot with emulated 6502

Post by BigDumbDinosaur »

Yes, but can it brew beer?
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
Dr Jefyll
Posts: 3525
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: Blinky robot with emulated 6502

Post by Dr Jefyll »

BigEd wrote:
Most obscure way to manage a timing loop!
I'll say it is!

Brilliantly perverse.

Makes me think of the omni-computer in the Douglas Adams books, "Hitchhiker's Guide To the Galaxy." Could it have been because of nested emulations that Deep Thought took centuries to deliver the enigmatic answer, forty-two? :lol:

-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
User avatar
Druzyek
Posts: 367
Joined: 12 May 2014
Contact:

Re: Blinky robot with emulated 6502

Post by Druzyek »

Hehe, could be, Dr Jefyll! I was thinking more like the movie Inception or The Matrix if the humans in the matrix had invented machines again and the machines made a matrix in that matrix.
Post Reply