Re: Hardware emulation of 6509 using 6502?

From: David Holz <david.holz_at_grindwork.com>
Date: Sat, 4 Nov 2017 09:47:49 -0700
Message-ID: <0c00fc75-de6c-692a-1769-fdf436050ef1@grindwork.com>
On 11/04/2017 07:22 AM, Mia Magnusson wrote:
> Hi!
> Just a crazy idea:
> Since I assume 6509's are rather hard to get a hold of, and since the
> 6509 (and to some extent 6525 and maybe 6551) is the only "hard to get
> a hold of" IC in a CBM-II computer, it might be a nice idea to make
> some kind of logic to make a replica.

If you have plenty of memory available, an I idea for a software
emulator that I had a while ago was to fill the "real" memory with BRKs,
and keep the 6509 code in another bank.  When a BRK is hit, the handler
looks at the 6509 bank to see if it's a 6502-compatible instruction or
not.  If so, it copies the instruction into the executing memory and
returns there.  If not, it runs a software emulation of the 6509
instruction.  In this way, the memory that's executed will fill with
6502 instructions which will run natively, BRKing into 6509 emulation
only when necessary.

There's a few gotchas, but all could theoretically be mitigated.  The
system needs to remember which parts of memory have had native code
written to it, which are BRK'd 6509 instructions that have executed, and
which have been data reads/writes.  Indirect addressing instructions
should always be emulated, so that it can selfmod whichever view of
those computed bytes are active.  Writes to code locations should
invalidate the executing destination back to BRKs, to be reevaluated
when next executed, and so on.  It would take quite a bit of RAM, but it
would be an interesting software-only approach that might end up being
quite quick.

Obviously a hardware approach would run closer to full speed and not
take up all that mirrored memory. :)

       Message was sent through the cbm-hackers mailing list
Received on 2017-11-04 17:01:06

Archive generated by hypermail 2.2.0.