Re: Software 6502-on-6502

From: Cameron Kaiser (
Date: 2002-10-31 08:33:16

> I was just catching up with old postings and this idea caught my attention.
> C't Aug1985 (German magazine) had an article about simulation of a 65C02
> with a software 6502 emulator, and so it raises the question how about a
> software 65816.

Did this actually have any code for the 65C02 emulator? My project is just
doing NMOS opcodes.

> With an REU some of the block-move type functions would
> execute very fast, and the 16bit indexing could be done with zp
> instructions.... as you say with a virtual memory manager you could use any
> RAM expansion to pretend to be real RAM.

Yep! Although the 16-bit indexing still seems like it would be very
hard to implement efficiently.

> I did have some questions about the actually code you used:
> 1) what did your decode routine look like. How did decode the op code and
> jmp to the right routine (an efficient way of doing this would be handy for
> some other coding projects...)

Well, going back to the vector table,

vectab	.word	opbrk,	opora,	opbad,	opbad
 	.word 	opbad,	opora,	opasl,	opbad	; $00-7

opbrk, opora, etc., are all xa labels to the various servant routines that
figure out addressing modes and distill the instruction down.

I just took the opcode, shifted it left, and used that as an index to get
the vector to the servant routine (obviously adding 256 if the high bit
were set), and then did an indirect JMP.

> 2) what do you estimate the emulated through-put was relative to the 1MHz
> base, ie did your sample program run effective at 0.2Mhz or slower/faster?

I'd say it was about 15-20% actual speed but I haven't done any official
testing or optimization.

----------------------------- personal page: --
 Cameron Kaiser, Point Loma Nazarene University *
-- Helmet: But when will Now be Then?!?! Sandurz: Soon. -- "Spaceballs" -------

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail 2.1.4.