예제 #1
0
파일: wd33c93.c 프로젝트: imclab/CocoaMSX
void  wd33c93SaveState(WD33C93* wd33c93)
{
    SaveState* state = saveStateOpenForWrite("wd33c93");
    int i;

    saveStateSet(state, "myId",         wd33c93->myId);
    saveStateSet(state, "targetId",     wd33c93->targetId);
    saveStateSet(state, "latch",        wd33c93->latch);
    saveStateSet(state, "phase",        wd33c93->phase);
    saveStateSet(state, "counter",      wd33c93->counter);
    saveStateSet(state, "blockCounter", wd33c93->blockCounter);
    saveStateSet(state, "tc",           wd33c93->tc);
    saveStateSet(state, "maxDev",       wd33c93->maxDev);
    saveStateSet(state, "pBuf",         wd33c93->pBuf - wd33c93->buffer);
    //saveStateGet(state, "timeout",    wd33c93->timeout);
    //saveStateGet(state, "timerRunning", wd33c93->timerRunning);

    saveStateSetBuffer(state, "regs",   wd33c93->regs,   sizeof(wd33c93->regs));
    saveStateSetBuffer(state, "buffer", wd33c93->buffer, BUFFER_SIZE);

    saveStateClose(state);

    for (i = 0; i < wd33c93->maxDev; ++i) {
        scsiDeviceSaveState(wd33c93->dev[i]);
    }
}
예제 #2
0
파일: WD2793.c 프로젝트: imclab/CocoaMSX
void wd2793SaveState(WD2793* wd)
{
    SaveState* state = saveStateOpenForWrite("wd2793");

    saveStateSet(state, "step",            wd->step);
    saveStateSet(state, "curStep",         wd->curStep);
    saveStateSet(state, "stepTime",        wd->stepTime);
    saveStateSet(state, "regStatus",       wd->regStatus);
    saveStateSet(state, "regCommand",      wd->regCommand);
    saveStateSet(state, "regSector",       wd->regSector);
    saveStateSet(state, "regTrack",        wd->regTrack);
    saveStateSet(state, "regData",         wd->regData);
    saveStateSet(state, "immediateInt",    wd->immediateInt);
    saveStateSet(state, "intRequest",      wd->intRequest);
    saveStateSet(state, "dataRequest",     wd->dataRequest);
    saveStateSet(state, "dataReady",       wd->dataReady);
    saveStateSet(state, "stepDirection",   wd->stepDirection);
    saveStateSet(state, "headLoaded",      wd->headLoaded);
    saveStateSet(state, "dataRequsetTime", wd->dataRequsetTime);
    saveStateSet(state, "drive",           wd->drive);
    saveStateSet(state, "sectorOffset",    wd->sectorOffset);
    saveStateSet(state, "dataAvailable",   wd->dataAvailable);
    saveStateSet(state, "diskTrack",       wd->diskTrack);
    saveStateSet(state, "diskTracks[0]",   wd->diskTracks[0]);
    saveStateSet(state, "diskTracks[1]",   wd->diskTracks[1]);
    saveStateSet(state, "diskTracks[2]",   wd->diskTracks[2]);
    saveStateSet(state, "diskTracks[3]",   wd->diskTracks[3]);
    saveStateSet(state, "diskSide",        wd->diskSide);
    saveStateSet(state, "diskDensity",     wd->diskDensity);

    saveStateSetBuffer(state, "sectorBuf", wd->sectorBuf, 512);

    saveStateClose(state);
}
예제 #3
0
static void saveState(RomMapperSCCplus* rm)
{
    SaveState* state = saveStateOpenForWrite("mapperSCCplus");
    char tag[16];
    int i;

    for (i = 0; i < 4; i++) {
        sprintf(tag, "romMapper%d", i);
        saveStateSet(state, tag, rm->romMapper[i]);
        
        sprintf(tag, "isRamSegment%d", i);
        saveStateSet(state, tag, rm->isRamSegment[i]);
        
        sprintf(tag, "isMapped%d", i);
        saveStateSet(state, tag,     rm->isMapped[i]);
    }
    
    saveStateSet(state, "modeRegister", rm->modeRegister);
    saveStateSet(state, "sccMode",      rm->sccMode);

    saveStateSetBuffer(state, "romData", rm->romData, sizeof(rm->romData));

    saveStateClose(state);

    sccSaveState(rm->scc);
}
예제 #4
0
static void saveState(RomMapperPAC* rm)
{
    SaveState* state = saveStateOpenForWrite("mapperPAC");

    saveStateSetBuffer(state, "sram", rm->sram, sizeof(rm->sram));
    
    saveStateClose(state);
}
예제 #5
0
static void saveState(Ram1kBMirrored* rm)
{
    SaveState* state = saveStateOpenForWrite("mapperMirroredRam");

    saveStateSet(state, "mask", rm->mask);
    saveStateSetBuffer(state, "ramData", rm->ramData, rm->mask + 1);

    saveStateClose(state);
}
예제 #6
0
static void saveState(RamNormal* rm)
{
    SaveState* state = saveStateOpenForWrite("mapperNormalRam");

    saveStateSet(state, "pages", rm->pages);
    saveStateSetBuffer(state, "ramData", rm->ramData, rm->pages * 0x2000);

    saveStateClose(state);
}
static void saveState(RomMapperOpcodeSaveRam* rm)
{
    SaveState* state = saveStateOpenForWrite("mapperOpcodeSaveRam");

    
    saveStateSetBuffer(state, "saveRam", rm->saveRam, 0x8000);
    
    saveStateClose(state);
}
예제 #8
0
static void saveState(RomMapperMsxAudio* rm)
{
    SaveState* state = saveStateOpenForWrite("mapperMsxAudio");

    saveStateSet(state, "bankSelect", rm->bankSelect);
    saveStateSetBuffer(state, "ram", rm->ram, sizeof(rm->ram));
    
    saveStateClose(state);

    if (rm->y8950 != NULL) {
        y8950SaveState(rm->y8950);
    }
}
예제 #9
0
static void saveState(RomMapperOpcodeMegaRam* rm)
{
    SaveState* state = saveStateOpenForWrite("mapperOpcodeMegaRam");

    saveStateSet(state, "megaRamLatch0", rm->megaRamLatch[0]);
    saveStateSet(state, "megaRamLatch1", rm->megaRamLatch[1]);
    saveStateSet(state, "megaRamLatch2", rm->megaRamLatch[2]);
    saveStateSet(state, "megaRamLatch3", rm->megaRamLatch[3]);
        
    saveStateSetBuffer(state, "megaRam", rm->megaRam, 0x20000);
    
    saveStateClose(state);
}
예제 #10
0
static void ym2148SaveState(YM2148* midi)
{
    SaveState* state = saveStateOpenForWrite("ym2148");

    saveStateSet(state, "command", midi->command);
    saveStateSet(state, "rxData", midi->rxData);
    saveStateSet(state, "status", midi->status);
    saveStateSet(state, "sendByte", midi->sendByte);
    saveStateSet(state, "sendBuffer", midi->sendBuffer);
    saveStateSet(state, "sendByte", midi->sendByte);
    saveStateSet(state, "txPending", midi->txPending);
    saveStateSetBuffer(state, "rxQueue", midi->rxQueue, sizeof(midi->rxQueue));
    saveStateSet(state, "rxHead", midi->rxHead);
    saveStateSet(state, "vector", midi->vector);
    
    saveStateClose(state);
}
static void saveState(RomMapperOpcodeModule* rm)
{
    SaveState* state = saveStateOpenForWrite("mapperOpcodeModule");

    saveStateSet(state, "biosLatch",  rm->biosLatch);
    saveStateSet(state, "slotSelect", rm->slotSelect);
    saveStateSet(state, "megaRamLatch0", rm->megaRamLatch[0]);
    saveStateSet(state, "megaRamLatch1", rm->megaRamLatch[1]);
    saveStateSet(state, "megaRamLatch2", rm->megaRamLatch[2]);
    saveStateSet(state, "megaRamLatch3", rm->megaRamLatch[3]);
    
    
    saveStateSetBuffer(state, "ram", rm->ram, 0x6000);
    
    saveStateClose(state);

    ay8910SaveState(rm->ay8910);
}
예제 #12
0
static void saveState(RomMapperMegaRAM* rm)
{
    SaveState* state = saveStateOpenForWrite("mapperMegaRAM");
    char tag[16];
    int i;

    for (i = 0; i < 4; i++) {
        sprintf(tag, "romMapper%d", i);
        saveStateSet(state, tag, rm->romMapper[i]);
    }
    
    saveStateSet(state, "writeEnabled", rm->writeEnabled);
    saveStateSet(state, "size",         rm->size);
    
    saveStateSetBuffer(state, "ramData", rm->ramData, rm->size);

    saveStateClose(state);
}
예제 #13
0
void archMidiSaveState(void)
{
    SaveState* state = saveStateOpenForWrite("ArchMidi");
    char buf[64];
    int i;

    // Set history
    for (i = 0; i < HISTORY_SIZE; i++) {
        char buf[32];
        sprintf(buf, "history_%d", i);
        saveStateSet(state, buf, midi.out.history.data[i]);
    }
    saveStateSet(state, "history_head", midi.out.history.head);

    for (i = 0; i < 4; i++) {
        DevInfo* di = NULL;
        switch (i) {
        case 0:
            di = midi.out.current[0];
            break;
        case 1:
            di = midi.out.current[1];
            break;
        case 2:
            di = midi.in.current[0];
            break;
        case 3:
            di = midi.in.current[1];
            break;
        }
        if (di != NULL) {
            sprintf(buf, "buffer_%d_count", i);
            saveStateSet(state, buf, di->buffer.count);
            sprintf(buf, "buffer_%d_remain", i);
            saveStateSet(state, buf, di->buffer.remain);
            // no need to save di->buffer.runningStatus
            // (set 0 at archMidiLoadState())
            sprintf(buf, "buffer_%d_data", i);
            saveStateSetBuffer(state, buf, di->buffer.data, sizeof(di->buffer.data));
        }
    }

    saveStateClose(state);
}
예제 #14
0
파일: Board.c 프로젝트: juvenal/CocoaMSX
void boardCaptureStop() {
    boardTimerRemove(cap.timer);

    if (cap.state == CAPTURE_REC) {
        SaveState* state;
        FILE* f;

        cap.endTime = boardSystemTime();
        cap.endTime64 = boardSystemTime64();
        cap.state = CAPTURE_PLAY;
        cap.inputCnt = rleEncGetLength();

        f = fopen(cap.filename, "wb");
        if (f != NULL) {
            fwrite(cap.initState, 1, cap.initStateSize, f);
            fclose(f);
        }

        saveStateCreateForWrite(cap.filename);

        state = saveStateOpenForWrite("capture");

        saveStateSet(state, "version", CAPTURE_VERSION);

        saveStateSet(state, "state", cap.state);
        saveStateSet(state, "endTime", cap.endTime);
        saveStateSet(state, "endTime64Hi", (UInt32)(cap.endTime64 >> 32));
        saveStateSet(state, "endTime64Lo", (UInt32)cap.endTime64);
        saveStateSet(state, "inputCnt", cap.inputCnt);
        
        if (cap.inputCnt > 0) {
            saveStateSetBuffer(state, "inputs", cap.inputs, cap.inputCnt * sizeof(RleData));
        }

        saveStateClose(state);
        saveStateDestroy();
    }