Esempio n. 1
0
C64::C64()
{
    int i,j;
    uint8 *p;

    // The thread is not yet running
    thread_running = false;
    quit_thyself = false;
    have_a_break = false;

    // System-dependent things
    c64_ctor1();

    // Open display
    TheDisplay = new C64Display(this);

    // Allocate RAM/ROM memory
    RAM = new uint8[0x10000];
    Basic = new uint8[0x2000];
    Kernal = new uint8[0x2000];
    Char = new uint8[0x1000];
    Color = new uint8[0x0400];
    RAM1541 = new uint8[0x0800];
    ROM1541 = new uint8[0x4000];

    // Create the chips
    TheCPU = new MOS6510(this, RAM, Basic, Kernal, Char, Color);

    TheJob1541 = new Job1541(RAM1541);
    TheCPU1541 = new MOS6502_1541(this, TheJob1541, TheDisplay, RAM1541, ROM1541);

    TheVIC = TheCPU->TheVIC = new MOS6569(this, TheDisplay, TheCPU, RAM, Char, Color);
    TheSID = TheCPU->TheSID = new MOS6581(this);
    TheCIA1 = TheCPU->TheCIA1 = new MOS6526_1(TheCPU, TheVIC);
    TheCIA2 = TheCPU->TheCIA2 = TheCPU1541->TheCIA2 = new MOS6526_2(TheCPU, TheVIC, TheCPU1541);
    TheIEC = TheCPU->TheIEC = new IEC(TheDisplay);
    TheREU = TheCPU->TheREU = new REU(TheCPU);

    // Initialize RAM with powerup pattern
    for (i=0, p=RAM; i<512; i++) {
        for (j=0; j<64; j++)
            *p++ = 0;
        for (j=0; j<64; j++)
            *p++ = 0xff;
    }

    // Initialize color RAM with random values
    for (i=0, p=Color; i<1024; i++)
        *p++ = rand() & 0x0f;

    // Clear 1541 RAM
    memset(RAM1541, 0, 0x800);

    // Open joystick drivers if required
    open_close_joysticks(false, false, ThePrefs.Joystick1On, ThePrefs.Joystick2On);
    joykey = 0xff;

#ifdef FRODO_SC
    CycleCounter = 0;
#endif

    // System-dependent things
    c64_ctor2();
}
Esempio n. 2
0
C64::C64()
{
    uint8 *p;

    // The thread is not yet running
    thread_running = false;
    quit_thyself = false;
    have_a_break = 0;

    // System-dependent things
    c64_ctor1();

    // Open display
    TheDisplay = new C64Display(this);

    // Allocate RAM/ROM memory
    RAM = new uint8[C64_RAM_SIZE];
    Basic = new uint8[BASIC_ROM_SIZE];
    Kernal = new uint8[KERNAL_ROM_SIZE];
    Char = new uint8[CHAR_ROM_SIZE];
    Color = new uint8[COLOR_RAM_SIZE];
    RAM1541 = new uint8[DRIVE_RAM_SIZE];
    ROM1541 = new uint8[DRIVE_ROM_SIZE];

    // Create the chips
    TheCPU = new MOS6510(this, RAM, Basic, Kernal, Char, Color);

    TheJob1541 = new Job1541(RAM1541);
    TheCPU1541 = new MOS6502_1541(this, TheJob1541, TheDisplay, RAM1541, ROM1541);

    TheVIC = TheCPU->TheVIC = new MOS6569(this, TheDisplay, TheCPU, RAM, Char, Color);
    TheSID = TheCPU->TheSID = new MOS6581(this);
    TheCIA1 = TheCPU->TheCIA1 = new MOS6526_1(TheCPU, TheVIC);
    TheCIA2 = TheCPU->TheCIA2 = TheCPU1541->TheCIA2 = new MOS6526_2(TheCPU, TheVIC, TheCPU1541);
    TheIEC = TheCPU->TheIEC = new IEC(TheDisplay);
    TheREU = TheCPU->TheREU = new REU(TheCPU);

    // Initialize RAM with powerup pattern
    p = RAM;
    for (unsigned i=0; i<512; i++) {
        for (unsigned j=0; j<64; j++)
            *p++ = 0;
        for (unsigned j=0; j<64; j++)
            *p++ = 0xff;
    }

    // Initialize color RAM with random values
    p = Color;
    for (unsigned i=0; i<COLOR_RAM_SIZE; i++)
        *p++ = rand() & 0x0f;

    // Clear 1541 RAM
    memset(RAM1541, 0, DRIVE_RAM_SIZE);

    // Open joystick drivers if required
    open_close_joysticks(0, 0, ThePrefs.Joystick1Port, ThePrefs.Joystick2Port);
    joykey = 0xff;

#ifdef FRODO_SC
    CycleCounter = 0;
#endif

    // System-dependent things
    c64_ctor2();
}