pete-gordon / oricutron

Portable Oric-1/Atmos/Telestrat and Pravetz 8D emulator
http://www.petergordon.org.uk/oricutron/
GNU General Public License v2.0
69 stars 25 forks source link

65C02 emulation #99

Open jedeoric opened 7 years ago

jedeoric commented 7 years ago

Hello, i would like to add 65C02 emulation in oricutron (WDC version).

Anyway, what is the best way to code ? I started something but i prefer to ask before i finished it.

I did like this : in 6502 struct, i added : SDL_bool wdccmosversion;

Line 1943 of 6502.c, i did this (i added also cycles to this new opcode.

case 0xFA:  // PLX
    if (cpu->wdccmosversion)
    {
        cpu->x = POPB;
        FLAG_ZN(cpu->x);
        break;
            }

if you think, that it's not the best way let me know, but it's easier than switching to C++ to inherit object, or to duplicate 6502 emulation in order to manage 2 files.

Let me know !

polluks commented 7 years ago

You may look at cc65's sim65, we use two opcode tables.