Good emulator for mobile?

You need an actual VIC.

Moderator: Moderators

nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Good emulator for mobile?

Post 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.
User avatar
pixel
Vic 20 Scientist
Posts: 1330
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Good emulator for mobile?

Post by pixel »

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
User avatar
pixel
Vic 20 Scientist
Posts: 1330
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Good emulator for mobile?

Post 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.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Good emulator for mobile?

Post 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 ?)
User avatar
pixel
Vic 20 Scientist
Posts: 1330
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Good emulator for mobile?

Post 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;
}                                                                               
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Good emulator for mobile?

Post 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.
User avatar
pixel
Vic 20 Scientist
Posts: 1330
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Good emulator for mobile?

Post 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.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
pixel
Vic 20 Scientist
Posts: 1330
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Good emulator for mobile?

Post 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…
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Good emulator for mobile?

Post 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:
Post Reply