Esempio n. 1
0
static void changeCartridge(void* ref, int cartNo, int inserted)
{
    if (cartNo == 0) {
        int slot = inserted ? 2 + cartNo : 0;

        slotSetRamSlot(0, slot);
    }
}
Esempio n. 2
0
static void adamMemMapSet(UInt8 value)
{
    UInt8 pages;
    int i;

    /* Map the Coleco Adam low and high banks to pages */
    pages = (value&1)?(value&2)?(value&4)?BANK_05:BANK_07:BANK_03:BANK_01;
    pages |= (value&8)?(value&16)?(value&32)?BANK_02:BANK_08:BANK_06:BANK_04;

    for (i = 0; i < 4; i++) {
        slotSetRamSlot(i, pages & 3);
        pages >>= 2;
    }
}
Esempio n. 3
0
static void sviMemSetBank(UInt8 value)
{
    UInt8 pages;
    int i;
    psgAYReg15 = value;

    /* Map the SVI-328 bank to pages */
    pages = (value&1)?(value&2)?(value&8)?BANK_01:BANK_31:BANK_21:BANK_11;
    pages |= (value&4)?(value&16)?BANK_02:BANK_32:BANK_22;

    for (i = 0; i < 4; i++) {
        slotSetRamSlot(i, pages & 3);
        pages >>= 2;
    }
}
Esempio n. 4
0
int sg1000Create(Machine* machine, 
                 VdpSyncMode vdpSyncMode,
                 BoardInfo* boardInfo)
{
    int success;
    int i;

    sfRam = NULL;

    r800 = r800Create(0, slotRead, slotWrite, ioPortRead, ioPortWrite, NULL, boardTimerCheckTimeout, NULL, NULL, NULL, NULL);

    boardInfo->cartridgeCount   = 1;
    boardInfo->diskdriveCount   = 0;
    boardInfo->casetteCount     = 0;
    boardInfo->cpuRef           = r800;

    boardInfo->destroy          = destroy;
    boardInfo->softReset        = reset;
    boardInfo->loadState        = loadState;
    boardInfo->saveState        = saveState;
    boardInfo->getRefreshRate   = getRefreshRate;
    boardInfo->getRamPage       = getRamPage;

    boardInfo->run              = r800Execute;
    boardInfo->stop             = r800StopExecution;
    boardInfo->setInt           = r800SetInt;
    boardInfo->clearInt         = r800ClearInt;
    boardInfo->setCpuTimeout    = r800SetTimeoutAt;
    boardInfo->setBreakpoint    = r800SetBreakpoint;
    boardInfo->clearBreakpoint  = r800ClearBreakpoint;
    boardInfo->setDataBus       = r800SetDataBus;

    boardInfo->changeCartridge  = changeCartridge;

    deviceManagerCreate();
    
    boardInit(&r800->systemTime);
    ioPortReset();

    r800Reset(r800, 0);
    mixerReset(boardGetMixer());

    r800DebugCreate(r800);

    sn76489 = sn76489Create(boardGetMixer());

    slotManagerCreate();

    if (vdpSyncMode == VDP_SYNC_AUTO) {
        vdpSyncMode = VDP_SYNC_60HZ;
    }
    vdpCreate(VDP_SG1000, machine->video.vdpVersion, vdpSyncMode, machine->video.vramSize / 0x4000);

    joyIo = sg1000JoyIoCreate();
    if (machine->board.type == BOARD_SC3000) {
        sc3000PPICreate(joyIo);
    }
    if (machine->board.type == BOARD_SF7000) {
        sc3000PPICreate(joyIo);
        sf7000PPICreate();
            
        diskEnable(0, machine->fdc.count > 0);
        diskEnable(1, machine->fdc.count > 1);
    }
    sg1000IoPortCreate();

	ledSetCapslock(0);

    for (i = 0; i < 4; i++) {
        slotSetSubslotted(i, 0);
    }
    for (i = 0; i < 2; i++) {
        cartridgeSetSlotInfo(i, 2 + i, 0);
    }

    success = machineInitialize(machine, &sfRam, &sfRamSize, &sfRamStart);

    for (i = 0; i < 8; i++) {
        slotMapRamPage(0, 0, i);
    }

    if (machine->board.type == BOARD_SF7000) {
        slotSetRamSlot(0, 1);
    }

    if (success) {
        success = boardInsertExternalDevices();
    }

    r800SetFrequency(r800, CPU_Z80,  machine->cpu.freqZ80);
    r800SetFrequency(r800, CPU_R800, machine->cpu.freqR800);

    if (!success) {
        destroy();
    }

    return success;
}