6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 5:30 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Apr 29, 2020 2:55 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
A very high speed emulation can be useful to execute regression tests, or to run interesting programs. Or possibly just to run very accurate emulations on slower platforms.

Over on Stardot, Chris Evans aka scarybeasts has published a work-in-progress emulator that uses just-in-time compilation to deliver very high performance: 10GHz equivalent 6502 speed on a 3GHz x86, for example, or 3GHz 6502 on a 2GHz x86.

It's been tested on many programs including software protection and custom tape loaders, so certainly handles the usual hazards of self-modifying code. It includes a replay facility and a 6502-level debugger.

"The -fast flag is nice for BASIC testing. It runs the CPU as fast as possible while ticking the timers and video hardware at wall clock speed"

See the threads:
Announcement: New emulator: beebjit
Update and some timings: New beebjit release: v0.9.1

From the announcement:
Quote:
It's an open source project, hosted on GitHub.
The README goes into a broad overview
I did a technical blog post overview of how the JIT works, here.


I'd be hopeful that this work could at some point be applied to other targets, such as ARM, or even JavaScript.


Top
 Profile  
Reply with quote  
PostPosted: Fri May 01, 2020 4:33 pm 
Offline

Joined: Wed Oct 06, 2010 9:05 am
Posts: 95
Location: Palma, Spain
Just want to add some enthusiastic support for this project - Chris has achieved something I hadn't thought possible, since, not only does it dynamically recompile 6502 into native x86 code as it encounters it, but also maintains a runtime system emulation layer (in this case, emulating the BBC Micro hardware), which handles the 6522s, disk/tape system, video system, and interrupt handling (among other things) with no cost to the compiled code.

My understanding of how this works is that compiled basic blocks don't have any provision for handling interrupts, so they run as fast as possible; meanwhile, if an interrupt is expected in the near future, the emulator falls back into an "interpreted" mode and performs accurate synchronised emulation of the whole system. I'm not sure how other emulated components are kept in sync with the jitted code in the absence of a pending interrupt, but I can attest that it works very well, and is to date probably the most accurate BBC Micro emulator, as well as the fastest!


Top
 Profile  
Reply with quote  
PostPosted: Fri May 01, 2020 8:08 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
If it runs fast enough, it might perhaps be possible to rip ahead with a basic block, and then if it finds something of interest should have happened in between times, throw away the resultant state updates, and restart the block in a more pedestrian mode.

Just the collapsing of a block into just the final updates to flags and memory could be quite a saving.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 32 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: