Page 2 of 2

Re: Good emulator for mobile?

Posted: Fri Aug 28, 2015 11:28 am
by nippur72
Looking (superficially) at the code, I haven't found any reference to number of cycles spent per instruction. That would be useful to keep the VIC in synch with the CPU, running the same number of cycles.

Re: Good emulator for mobile?

Posted: Fri Aug 28, 2015 11:38 am
by pixel
Well, mos6502_emulate() runs exactly one instruction. Counting your calls to that function should be rather straightforward. Or what did I miss?

Re: Good emulator for mobile?

Posted: Fri Aug 28, 2015 11:50 am
by pixel
Ah, O.K. Got it! It doesn't count the cycles at all. But that'd require just another table. Got it to work without cycle counting. An illegal opcode tells my emulator to display a new frame when it's time.

EDIT: It also works well with an average number of instructions per frame.

Re: Good emulator for mobile?

Posted: Mon Aug 31, 2015 7:07 am
by nippur72
@pixel another question, I see in your emulator VIC's memory is an array (`m[]`), how do you deal with the fact that some zones are ROM and some others are not even physically connected? (Do you assume you are emulating a 64KRAM VIC 20 ?)

Re: Good emulator for mobile?

Posted: Mon Aug 31, 2015 12:26 pm
by pixel
nippur72 wrote:@pixel another question, I see in your emulator VIC's memory is an array (`m[]`), how do you deal with the fact that some zones are ROM and some others are not even physically connected? (Do you assume you are emulating a 64KRAM VIC 20 ?)
Yes, I do. :D It was all just enough to run Pulse. ROMs are just copied into it. Like the charset.

Would keep it that way and add another status byte array and modify the write back function like this:

Code: Select all

void
e_writeback ()
{
    if (operand_is_accu) {
        a = r;
        operand_is_accu = FALSE;
    } else if (mpermissions[operand]) /* check if writable */
        m[operand] = r;
}                                                                               

Re: Good emulator for mobile?

Posted: Tue Sep 01, 2015 5:04 am
by nippur72
I was thinking that since it's C, one might use macros e.g.

Code: Select all

#define writemem(a,v) (if(mpermission[(a)]) m[(a)] = (v))
so that's more easy to switch back and forth from "fast and inaccurate" and "slow and precise".

Even the micro-code instruction ("e_xxx") could be written as #defines, avoiding the extra function call when they are compiled.

Re: Good emulator for mobile?

Posted: Tue Sep 01, 2015 6:01 am
by pixel
nippur72 wrote:Even the micro-code instruction ("e_xxx") could be written as #defines, avoiding the extra function call when they are compiled.
Modern compilers should optimize all that away. With gcc I use link-time-optimization. Works like a charm. If that's not available you can concatenate the files to get the same effect.

Re: Good emulator for mobile?

Posted: Wed Sep 23, 2015 7:45 am
by pixel
Although it probably won't help out much with your challenge I moved my 6502 emulator code over to https://github.com/svenmichaelklose/bender/c/ and I promised myself to publish the rest of the emulator code as soon as ripped out the arcade tube code… no, hang on… maybe I keep it in… I'll probably grab some fermented vegetable juice, achieve extended stages of mental incompetence and just publish all of it. Let's see…

Re: Good emulator for mobile?

Posted: Fri Sep 25, 2015 9:20 am
by nippur72
good! when people publish something on github it's always a good thing. :D

Regarding my project, unfortunately it has a low-priority among other side-projects, so it ain't advanced much :cry: