Exemplo n.º 1
0
int easyflash_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, SNAP_MODULE_NAME,
                          CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, (BYTE)easyflash_jumper) < 0)
        || (SMW_B(m, easyflash_register_00) < 0)
        || (SMW_B(m, easyflash_register_02) < 0)
        || (SMW_BA(m, easyflash_ram, 256) < 0)
        || (SMW_BA(m, roml_banks, 0x80000) < 0)
        || (SMW_BA(m, romh_banks, 0x80000) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    snapshot_module_close(m);

    if (0
        || (flash040core_snapshot_write_module(s, easyflash_state_low, FLASH_SNAP_MODULE_NAME) < 0)
        || (flash040core_snapshot_write_module(s, easyflash_state_high, FLASH_SNAP_MODULE_NAME) < 0)) {
        return -1;
    }

    return 0;
}
Exemplo n.º 2
0
static int sid_snapshot_write_module_simple(snapshot_t *s)
{
    int sound, sid_engine;
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name_simple, SNAP_MAJOR_SIMPLE,
                               SNAP_MINOR_SIMPLE);
    if (m == NULL) {
        return -1;
    }

    resources_get_int("Sound", &sound);
    if (SMW_B(m, (BYTE)sound) < 0) {
        snapshot_module_close(m);
        return -1;
    }

    if (sound) {
        resources_get_int("SidEngine", &sid_engine);
        if (SMW_B(m, (BYTE)sid_engine) < 0) {
            snapshot_module_close(m);
            return -1;
        }

        /* FIXME: Only data for first SID stored. */
        if (SMW_BA(m, sid_get_siddata(0), 32) < 0) {
            snapshot_module_close(m);
            return -1;
        }
    }

    snapshot_module_close(m);
    return 0;
}
Exemplo n.º 3
0
int finalexpansion_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, SNAP_MODULE_NAME, VIC20CART_DUMP_VER_MAJOR, VIC20CART_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, register_a) < 0)
        || (SMW_B(m, register_b) < 0)
        || (SMW_B(m, lock_bit) < 0)
        || (SMW_BA(m, cart_ram, CART_RAM_SIZE) < 0)
        || (SMW_BA(m, flash_state.flash_data, CART_ROM_SIZE) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    snapshot_module_close(m);

    if ((flash040core_snapshot_write_module(s, &flash_state, FLASH_SNAP_MODULE_NAME) < 0)) {
        return -1;
    }

    return 0;
}
Exemplo n.º 4
0
int vic_fp_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, SNAP_MODULE_NAME,
                               VIC20CART_DUMP_VER_MAJOR,
                               VIC20CART_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, cart_bank_reg) < 0)
        || (SMW_B(m, cart_cfg_reg) < 0)
        || (SMW_BA(m, cart_ram, CART_RAM_SIZE) < 0)
        || (SMW_BA(m, cart_rom, CART_ROM_SIZE) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    snapshot_module_close(m);

    if ((flash040core_snapshot_write_module(s, &flash_state, FLASH_SNAP_MODULE_NAME) < 0)) {
        return -1;
    }

    return 0;
}
Exemplo n.º 5
0
int fdc_snapshot_write_module(snapshot_t *p, int fnum)
{
    snapshot_module_t *m;
    char *name;

    if (fdc[fnum].fdc_state == FDC_UNUSED) {
        return 0;
    }

    name = lib_msprintf("FDC%i", fnum);

    m = snapshot_module_create(p, name,
                              FDC_DUMP_VER_MAJOR, FDC_DUMP_VER_MINOR);
    lib_free(name);
    if (m == NULL)
        return -1;

    SMW_B(m, (BYTE)(fdc[fnum].fdc_state));

    /* clk till next invocation */
    SMW_DW(m,
                                (DWORD)(fdc[fnum].alarm_clk - drive_clk[fnum]));

    /* number of drives - so far 1 only */
    SMW_B(m, 1);

    /* last accessed track/sector */
    SMW_B(m, ((BYTE)(fdc[fnum].last_track)));
    SMW_B(m, ((BYTE)(fdc[fnum].last_sector)));

    snapshot_module_close(m);

    return 0;
}
Exemplo n.º 6
0
int vic_snapshot_write_module(snapshot_t *s)
{
    int i;
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (SMW_B(m, (BYTE)VIC_RASTER_CYCLE(maincpu_clk)) < 0
        || SMW_W(m, (WORD)VIC_RASTER_Y(maincpu_clk)) < 0) {
        goto fail;
    }

    if (0
        || (SMW_W(m, (WORD)vic.area) < 0)
        || (SMW_W(m, (WORD)vic.fetch_state) < 0)
        || (SMW_DW(m, (DWORD)vic.raster_line) < 0)
        || (SMW_DW(m, (DWORD)vic.text_cols) < 0)
        || (SMW_DW(m, (DWORD)vic.text_lines) < 0)
        || (SMW_DW(m, (DWORD)vic.pending_text_cols) < 0)
        || (SMW_DW(m, (DWORD)vic.line_was_blank) < 0)
        || (SMW_DW(m, (DWORD)vic.memptr) < 0)
        || (SMW_DW(m, (DWORD)vic.memptr_inc) < 0)
        || (SMW_DW(m, (DWORD)vic.row_counter) < 0)
        || (SMW_DW(m, (DWORD)vic.buf_offset) < 0)
        || SMW_B(m, (BYTE)vic.light_pen.state) < 0
        || SMW_B(m, (BYTE)vic.light_pen.triggered) < 0
        || SMW_DW(m, (DWORD)vic.light_pen.x) < 0
        || SMW_DW(m, (DWORD)vic.light_pen.y) < 0
        || SMW_DW(m, (DWORD)vic.light_pen.x_extra_bits) < 0
        || SMW_DW(m, (DWORD)vic.light_pen.trigger_cycle) < 0
        || (SMW_B(m, vic.vbuf) < 0)) {
        goto fail;
    }

    /* Color RAM.  */
    if (SMW_BA(m, mem_ram + 0x9400, 0x400) < 0) {
        goto fail;
    }

    for (i = 0; i < 0x10; i++) {
        if (SMW_B(m, (BYTE)vic.regs[i]) < 0) {
            goto fail;
        }
    }

    return snapshot_module_close(m);

fail:
    if (m != NULL)
        snapshot_module_close(m);
    return -1;
}
Exemplo n.º 7
0
int riotcore_snapshot_write_module(riot_context_t *riot_context, snapshot_t *p)
{
    snapshot_module_t *m;

    m = snapshot_module_create(p, riot_context->myname,
                               RIOT_DUMP_VER_MAJOR, RIOT_DUMP_VER_MINOR);
    if (m == NULL)
        return -1;

    update_timer(riot_context);

    SMW_B(m, riot_context->riot_io[0]);
    SMW_B(m, riot_context->riot_io[1]);
    SMW_B(m, riot_context->riot_io[2]);
    SMW_B(m, riot_context->riot_io[3]);

    SMW_B(m, riot_context->r_edgectrl);
    SMW_B(m, (BYTE)(riot_context->r_irqfl | (riot_context->r_irqline ? 1 : 0)));

    SMW_B(m, (BYTE)(riot_context->r_N - (*(riot_context->clk_ptr)
          - riot_context->r_write_clk)
          / riot_context->r_divider));
    SMW_W(m, (WORD)(riot_context->r_divider));
    SMW_W(m, (BYTE)((*(riot_context->clk_ptr) - riot_context->r_write_clk)
          % riot_context->r_divider));
    SMW_B(m, (BYTE)(riot_context->r_irqen ? 1 : 0));

    snapshot_module_close(m);

    return 0;
}
static int mem_write_rom_snapshot_module(snapshot_t *p, int save_roms)
{
    snapshot_module_t *m;

    if (!save_roms) {
        return 0;
    }

    m = snapshot_module_create(p, SNAP_ROM_MODULE_NAME, VIC20MEM_DUMP_VER_MAJOR, VIC20MEM_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    /* old cart system config bits.  all zero = no roms */
    SMW_B(m, 0x00);

    /* save kernal */
    SMW_BA(m, vic20memrom_kernal_rom, 0x2000);
    /* save basic */
    SMW_BA(m, vic20memrom_basic_rom, 0x2000);

    SMW_BA(m, vic20memrom_chargen_rom, 0x1000);

    snapshot_module_close(m);

    return 0;
}
static int mem_write_ram_snapshot_module(snapshot_t *p)
{
    snapshot_module_t *m;
    BYTE config;

    config = (ram_block_0_enabled ? 1 : 0)
             | (ram_block_1_enabled ? 2 : 0)
             | (ram_block_2_enabled ? 4 : 0)
             | (ram_block_3_enabled ? 8 : 0)
             | (ram_block_5_enabled ? 32 : 0);

    m = snapshot_module_create(p, SNAP_MEM_MODULE_NAME,
                               VIC20MEM_DUMP_VER_MAJOR,
                               VIC20MEM_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    SMW_B(m, config);

    SMW_B(m, vic20_cpu_last_data);
    SMW_B(m, vic20_v_bus_last_data);
    SMW_B(m, vic20_v_bus_last_high);

    SMW_BA(m, mem_ram, 0x0400);
    SMW_BA(m, mem_ram + 0x1000, 0x1000);

    if (config & 1) {
        SMW_BA(m, mem_ram + 0x0400, 0x0c00);
    }
    if (config & 2) {
        SMW_BA(m, mem_ram + 0x2000, 0x2000);
    }
    if (config & 4) {
        SMW_BA(m, mem_ram + 0x4000, 0x2000);
    }
    if (config & 8) {
        SMW_BA(m, mem_ram + 0x6000, 0x2000);
    }
    if (config & 32) {
        SMW_BA(m, mem_ram + 0xA000, 0x2000);
    }

    snapshot_module_close(m);

    return 0;
}
Exemplo n.º 10
0
int rtc72421_write_snapshot(rtc_72421_t *context, snapshot_t *s)
{
    DWORD latch_lo = 0;
    DWORD latch_hi = 0;
    DWORD offset_lo = 0;
    DWORD offset_hi = 0;
    DWORD old_offset_lo = 0;
    DWORD old_offset_hi = 0;
    snapshot_module_t *m;

    /* time_t can be either 32bit or 64bit, so we save as 64bit */
#if (SIZE_OF_TIME_T == 8)
    latch_hi = (DWORD)(context->latch >> 32);
    latch_lo = (DWORD)(context->latch & 0xffffffff);
    offset_hi = (DWORD)(context->offset >> 32);
    offset_lo = (DWORD)(context->offset & 0xffffffff);
    old_offset_hi = (DWORD)(context->old_offset >> 32);
    old_offset_lo = (DWORD)(context->old_offset & 0xffffffff);
#else
    latch_lo = (DWORD)context->latch;
    offset_lo = (DWORD)context->offset;
    old_offset_lo = (DWORD)context->old_offset;
#endif

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);

    if (m == NULL) {
        return -1;
    }

    if (0
        || SMW_B(m, (BYTE)context->stop) < 0
        || SMW_B(m, (BYTE)context->hour24) < 0
        || SMW_DW(m, latch_hi) < 0
        || SMW_DW(m, latch_lo) < 0
        || SMW_DW(m, offset_hi) < 0
        || SMW_DW(m, offset_lo) < 0
        || SMW_DW(m, old_offset_hi) < 0
        || SMW_DW(m, old_offset_lo) < 0
        || SMW_STR(m, context->device) < 0) {
        snapshot_module_close(m);
        return -1;
    }
    return snapshot_module_close(m);
}
Exemplo n.º 11
0
int digimax_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, SNAP_MODULE_NAME,
                               CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_DW(m, (DWORD)digimax_address) < 0)
/* FIXME: implement userport part in userport_digimax.c */
#if 0
        || (SMW_B(m, digimax_userport_address) < 0)
        || (SMW_B(m, digimax_userport_direction_A) < 0)
        || (SMW_B(m, digimax_userport_direction_B) < 0)
#endif
        || (SMW_BA(m, digimax_sound_data, 4) < 0)
        || (SMW_B(m, snd.voice0) < 0)
        || (SMW_B(m, snd.voice1) < 0)
        || (SMW_B(m, snd.voice2) < 0)
        || (SMW_B(m, snd.voice3) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    snapshot_module_close(m);
    return 0;
}
Exemplo n.º 12
0
static int paperclip64_write_snapshot(struct snapshot_s *s, int port)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
 
    if (m == NULL) {
        return -1;
    }

    if (0
        || SMW_DW(m, (DWORD)counter) < 0
        || SMW_B(m, command) < 0
        || SMW_B(m, (BYTE)state) < 0) {
        snapshot_module_close(m);
        return -1;
    }
    return snapshot_module_close(m);
}
Exemplo n.º 13
0
int freezeframe_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);

    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, (BYTE)freezeframe_rom_8000) < 0)
        || (SMW_B(m, (BYTE)freezeframe_rom_e000) < 0)
        || (SMW_BA(m, roml_banks, FREEZE_FRAME_CART_SIZE) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    return snapshot_module_close(m);
}
static int userport_rtc_write_snapshot_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
 
    if (m == NULL) {
        return -1;
    }

    if (0
        || SMW_B(m, ds1307_pb0_sda) < 0
        || SMW_B(m, ds1307_pb1_scl) < 0) {
        snapshot_module_close(m);
        return -1;
    }
    snapshot_module_close(m);

    return ds1307_write_snapshot(ds1307_context, s);
}
Exemplo n.º 15
0
int magicdesk_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, SNAP_MODULE_NAME,
                               CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, (uint8_t)regval) < 0)
        || (SMW_B(m, (uint8_t)bankmask) < 0)
        || (SMW_BA(m, roml_banks, 0x2000 * MAXBANKS) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    snapshot_module_close(m);
    return 0;
}
Exemplo n.º 16
0
int ross_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);

    if (m == NULL) {
        return -1;
    }

    if (0
        || SMW_B(m, (uint8_t)ross_is_32k) < 0
        || SMW_B(m, (uint8_t)currbank) < 0
        || SMW_BA(m, roml_banks, 0x4000) < 0
        || SMW_BA(m, romh_banks, 0x4000) < 0) {
        snapshot_module_close(m);
        return -1;
    }

    return snapshot_module_close(m);
}
Exemplo n.º 17
0
int behrbonz_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, SNAP_MODULE_NAME, VIC20CART_DUMP_VER_MAJOR, VIC20CART_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, bank_reg) < 0)
        || (SMW_B(m, reset_mode) < 0)
        || (SMW_B(m, write_once) < 0)
        || (SMW_BA(m, cart_rom, CART_ROM_SIZE) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    snapshot_module_close(m);
    return 0;
}
Exemplo n.º 18
0
/*! \brief Write the snapshot module for the ACIA

 \param p
   Pointer to the snapshot data

 \return
   0 on success, -1 on error

 \remark
   Is it sensible to put the ACIA into a snapshot? It is unlikely
   the "other side" of the connection will be able to handle this
   case if a transfer was under way, anyway.

 \todo FIXME!!!  Error check.

 \todo FIXME!!!  If no connection, emulate carrier lost or so.
*/
int myacia_snapshot_write_module(snapshot_t *p)
{
    snapshot_module_t *m;

    m = snapshot_module_create(p, module_name, (BYTE)ACIA_DUMP_VER_MAJOR,
                               (BYTE)ACIA_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    SMW_B(m, acia.txdata);
    SMW_B(m, acia.rxdata);
    SMW_B(m, (BYTE)(acia_get_status() | (acia.irq ? ACIA_SR_BITS_IRQ : 0)));
    SMW_B(m, acia.cmd);
    SMW_B(m, acia.ctrl);
    SMW_B(m, (BYTE)(acia.in_tx));

    if (acia.alarm_active_tx) {
        SMW_DW(m, (acia.alarm_clk_tx - myclk));
    } else {
        SMW_DW(m, 0);
    }

    /* new with VICE 2.0.9 */

    if (acia.alarm_active_rx) {
        SMW_DW(m, (acia.alarm_clk_rx - myclk));
    } else {
        SMW_DW(m, 0);
    }

    snapshot_module_close(m);

    return 0;
}
Exemplo n.º 19
0
int freezemachine_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);

    if (m == NULL) {
        return -1;
    }

    if (0
        || SMW_B(m, (BYTE)rom_A14) < 0
        || SMW_B(m, (BYTE)roml_toggle) < 0
        || SMW_B(m, (BYTE)allow_toggle) < 0
        || SMW_BA(m, roml_banks, 0x4000) < 0
        || SMW_BA(m, romh_banks, 0x4000) < 0) {
        snapshot_module_close(m);
        return -1;
    }

    return snapshot_module_close(m);
}
Exemplo n.º 20
0
static int userport_digimax_write_snapshot_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
 
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, userport_digimax_address) < 0)
        || (SMW_BA(m, digimax_sound_data, 4) < 0)
        || (SMW_B(m, snd.voice0) < 0)
        || (SMW_B(m, snd.voice1) < 0)
        || (SMW_B(m, snd.voice2) < 0)
        || (SMW_B(m, snd.voice3) < 0)) {
        snapshot_module_close(m);
        return -1;
    }
    return snapshot_module_close(m);
}
Exemplo n.º 21
0
int maincpu_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, ((BYTE)SNAP_MAJOR),
                               ((BYTE)SNAP_MINOR));
    if (m == NULL) {
        return -1;
    }

    if (0
        || SMW_DW(m, maincpu_clk) < 0
        || SMW_B(m, MOS6510_REGS_GET_A(&maincpu_regs)) < 0
        || SMW_B(m, MOS6510_REGS_GET_X(&maincpu_regs)) < 0
        || SMW_B(m, MOS6510_REGS_GET_Y(&maincpu_regs)) < 0
        || SMW_B(m, MOS6510_REGS_GET_SP(&maincpu_regs)) < 0
        || SMW_W(m, (WORD)MOS6510_REGS_GET_PC(&maincpu_regs)) < 0
        || SMW_B(m, (BYTE)MOS6510_REGS_GET_STATUS(&maincpu_regs)) < 0
        || SMW_DW(m, (DWORD)last_opcode_info) < 0) {
        goto fail;
    }

    if (interrupt_write_snapshot(maincpu_int_status, m) < 0) {
        goto fail;
    }

    if (interrupt_write_new_snapshot(maincpu_int_status, m) < 0) {
        goto fail;
    }

    return snapshot_module_close(m);

fail:
    if (m != NULL) {
        snapshot_module_close(m);
    }
    return -1;
}
Exemplo n.º 22
0
int ds1216e_write_snapshot(rtc_ds1216e_t *context, snapshot_t *s)
{
    DWORD latch_lo = 0;
    DWORD latch_hi = 0;
    DWORD offset_lo = 0;
    DWORD offset_hi = 0;
    DWORD old_offset_lo = 0;
    DWORD old_offset_hi = 0;
    snapshot_module_t *m;

    /* time_t can be either 32bit or 64bit, so we save as 64bit */
#if (SIZE_OF_TIME_T == 8)
    latch_hi = (DWORD)(context->latch >> 32);
    latch_lo = (DWORD)(context->latch & 0xffffffff);
    offset_hi = (DWORD)(context->offset >> 32);
    offset_lo = (DWORD)(context->offset & 0xffffffff);
    old_offset_hi = (DWORD)(context->old_offset >> 32);
    old_offset_lo = (DWORD)(context->old_offset & 0xffffffff);
#else
    latch_lo = (DWORD)context->latch;
    offset_lo = (DWORD)context->offset;
    old_offset_lo = (DWORD)context->old_offset;
#endif

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);

    if (m == NULL) {
        return -1;
    }

    if (0
        || SMW_B(m, (BYTE)context->reset) < 0
        || SMW_B(m, (BYTE)context->inactive) < 0
        || SMW_B(m, (BYTE)context->hours12) < 0
        || SMW_B(m, (BYTE)context->pattern_pos) < 0
        || SMW_B(m, (BYTE)context->pattern_ignore) < 0
        || SMW_B(m, (BYTE)context->output) < 0
        || SMW_B(m, (BYTE)context->output_pos) < 0
        || SMW_DW(m, latch_hi) < 0
        || SMW_DW(m, latch_lo) < 0
        || SMW_DW(m, offset_hi) < 0
        || SMW_DW(m, offset_lo) < 0
        || SMW_DW(m, old_offset_hi) < 0
        || SMW_DW(m, old_offset_lo) < 0
        || SMW_BA(m, context->clock_regs, DS1216E_REG_SIZE) < 0
        || SMW_BA(m, context->old_clock_regs, DS1216E_REG_SIZE) < 0
        || SMW_BA(m, context->clock_regs_changed, DS1216E_REG_SIZE) < 0
        || SMW_STR(m, context->device) < 0) {
        snapshot_module_close(m);
        return -1;
    }
    return snapshot_module_close(m);
}
Exemplo n.º 23
0
int mc6821core_snapshot_write_data(mc6821_state *ctx, snapshot_module_t *m)
{
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, (BYTE)ctx->ctrlA) < 0)
        || (SMW_B(m, (BYTE)ctx->ctrlB) < 0)
        || (SMW_B(m, (BYTE)ctx->dataA) < 0)
        || (SMW_B(m, (BYTE)ctx->dataB) < 0)
        || (SMW_B(m, (BYTE)ctx->ddrA) < 0)
        || (SMW_B(m, (BYTE)ctx->ddrB) < 0)
        || (SMW_B(m, (BYTE)ctx->CA2) < 0)
        || (SMW_B(m, (BYTE)ctx->CA2state) < 0)
        || (SMW_B(m, (BYTE)ctx->CB2) < 0)
        || (SMW_B(m, (BYTE)ctx->CB2state) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    return 0;
}
Exemplo n.º 24
0
Arquivo: kcs.c Projeto: AreaScout/vice
int kcs_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, SNAP_MODULE_NAME,
                               CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, (BYTE)freeze_flag) < 0)
        || (SMW_B(m, (BYTE)config) < 0)
        || (SMW_BA(m, roml_banks, 0x2000) < 0)
        || (SMW_BA(m, romh_banks, 0x2000) < 0)
        || (SMW_BA(m, export_ram0, 0x2000) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    snapshot_module_close(m);
    return 0;
}
Exemplo n.º 25
0
int expert_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, SNAP_MODULE_NAME,
                          CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, (BYTE)cartmode) < 0)
        || (SMW_B(m, (BYTE)expert_register_enabled) < 0)
        || (SMW_B(m, (BYTE)expert_ram_writeable) < 0)
        || (SMW_B(m, (BYTE)expert_ramh_enabled) < 0)
        || (SMW_BA(m, expert_ram, EXPERT_RAM_SIZE) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    snapshot_module_close(m);
    return 0;
}
Exemplo n.º 26
0
int ramcart_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);

    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, (uint8_t)ramcart_enabled) < 0)
        || (SMW_B(m, (uint8_t)ramcart_readonly) < 0)
        || (SMW_DW(m, (uint32_t)ramcart_size) < 0)
        || (SMW_B(m, (uint8_t)ramcart_size_kb) < 0)
        || (SMW_BA(m, ramcart, 2) < 0)
        || (SMW_BA(m, ramcart_ram, ramcart_size) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    return snapshot_module_close(m);
}
Exemplo n.º 27
0
int freezemachine_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, SNAP_MODULE_NAME,
                          CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, (BYTE)rom_A14) < 0)
        || (SMW_B(m, (BYTE)roml_toggle) < 0)
        || (SMW_B(m, (BYTE)allow_toggle) < 0)
        || (SMW_BA(m, roml_banks, 0x4000) < 0)
        || (SMW_BA(m, romh_banks, 0x4000) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    snapshot_module_close(m);
    return 0;
}
Exemplo n.º 28
0
int megacart_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, SNAP_MODULE_NAME, VIC20CART_DUMP_VER_MAJOR, VIC20CART_DUMP_VER_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || (SMW_B(m, bank_low_reg) < 0)
        || (SMW_B(m, bank_high_reg) < 0)
        || (SMW_B(m, (BYTE)oe_flop) < 0)
        || (SMW_B(m, (BYTE)nvram_en_flop) < 0)
        || (SMW_BA(m, cart_ram, CART_RAM_SIZE) < 0)
        || (SMW_BA(m, cart_rom, CART_ROM_SIZE) < 0)
        || (SMW_BA(m, cart_nvram, CART_NVRAM_SIZE) < 0)) {
        snapshot_module_close(m);
        return -1;
    }

    snapshot_module_close(m);
    return 0;
}
Exemplo n.º 29
0
int c64_glue_snapshot_write_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
    if (m == NULL) {
        return -1;
    }

    if (0
        || SMW_B(m, (BYTE)glue_logic_type) < 0
        || SMW_B(m, (BYTE)old_vbank) < 0
        || SMW_B(m, (BYTE)glue_alarm_active) < 0) {
        goto fail;
    }

    return snapshot_module_close(m);

fail:
    if (m != NULL) {
        snapshot_module_close(m);
    }
    return -1;
}
Exemplo n.º 30
0
static int userport_8bss_write_snapshot_module(snapshot_t *s)
{
    snapshot_module_t *m;

    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
 
    if (m == NULL) {
        return -1;
    }

    if (SMW_B(m, (BYTE)userport_8bss_channel) < 0) {
        snapshot_module_close(m);
        return -1;
    }
    return snapshot_module_close(m);
}