6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 2:57 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Dec 20, 2022 6:58 pm 
Offline
User avatar

Joined: Mon May 12, 2014 6:18 pm
Posts: 365
Just for fun, I made a blinky robot with a PIC32 emulating a 6502. Pictures and description on my blog.
Attachment:
blinky-robot-front.jpg
blinky-robot-front.jpg [ 171.08 KiB | Viewed 4101 times ]

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)


Top
 Profile  
Reply with quote  
PostPosted: Tue Dec 20, 2022 9:53 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Most obscure way to manage a timing loop!


Top
 Profile  
Reply with quote  
PostPosted: Tue Dec 20, 2022 10:48 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
Yes, but can it brew beer?

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 21, 2022 3:24 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
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


Top
 Profile  
Reply with quote  
PostPosted: Sat Dec 24, 2022 1:34 pm 
Offline
User avatar

Joined: Mon May 12, 2014 6:18 pm
Posts: 365
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: