Good emulator for mobile?
Moderator: Moderators
Re: Good emulator for mobile?
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?
Well, mos6502_emulate() runs exactly one instruction. Counting your calls to that function should be rather straightforward. Or what did I miss?
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
https://github.com/SvenMichaelKlose
Re: Good emulator for mobile?
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.
EDIT: It also works well with an average number of instructions per frame.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
https://github.com/SvenMichaelKlose
Re: Good emulator for mobile?
@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?
Yes, I do.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 ?)

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;
}
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
https://github.com/SvenMichaelKlose
Re: Good emulator for mobile?
I was thinking that since it's C, one might use macros e.g.
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.
Code: Select all
#define writemem(a,v) (if(mpermission[(a)]) m[(a)] = (v))
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?
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.nippur72 wrote:Even the micro-code instruction ("e_xxx") could be written as #defines, avoiding the extra function call when they are compiled.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
https://github.com/SvenMichaelKlose
Re: Good emulator for mobile?
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…
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
https://github.com/SvenMichaelKlose
Re: Good emulator for mobile?
good! when people publish something on github it's always a good thing.
Regarding my project, unfortunately it has a low-priority among other side-projects, so it ain't advanced much

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