~ubuntu-branches/ubuntu/quantal/vice/quantal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
 * snapshot.h - Implementation of machine snapshot files.
 *
 * Written by
 *  Ettore Perazzoli <ettore@comm2000.it>
 *
 * This file is part of VICE, the Versatile Commodore Emulator.
 * See README for copyright notice.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 *  02111-1307  USA.
 *
 */

#ifndef SNAPSHOT_H
#define SNAPSHOT_H

#include "types.h"

#define SNAPSHOT_MACHINE_NAME_LEN       16
#define SNAPSHOT_MODULE_NAME_LEN        16

typedef struct snapshot_module_s snapshot_module_t;
typedef struct snapshot_s snapshot_t;

extern int snapshot_module_write_byte(snapshot_module_t *m, BYTE data);
extern int snapshot_module_write_word(snapshot_module_t *m, WORD data);
extern int snapshot_module_write_dword(snapshot_module_t *m, DWORD data);
extern int snapshot_module_write_padded_string(snapshot_module_t *m,
                                               const char *s, BYTE pad_char,
                                               int len);
extern int snapshot_module_write_byte_array(snapshot_module_t *m, BYTE *data,
                                            unsigned int num);
extern int snapshot_module_write_word_array(snapshot_module_t *m, WORD *data,
                                            unsigned int num);
extern int snapshot_module_write_dword_array(snapshot_module_t *m, DWORD *data,
                                             unsigned int num);
extern int snapshot_module_write_string(snapshot_module_t *m, const char *s);

extern int snapshot_module_read_byte(snapshot_module_t *m, BYTE *b_return);
extern int snapshot_module_read_word(snapshot_module_t *m, WORD *w_return);
extern int snapshot_module_read_dword(snapshot_module_t *m, DWORD *dw_return);
extern int snapshot_module_read_byte_array(snapshot_module_t *m,
                                           BYTE *b_return, unsigned int num);
extern int snapshot_module_read_word_array(snapshot_module_t *m,
                                           WORD *w_return, unsigned int num);
extern int snapshot_module_read_dword_array(snapshot_module_t *m,
                                            DWORD *dw_return,
                                            unsigned int num);
extern int snapshot_module_read_string(snapshot_module_t *m, char **s);
extern int snapshot_module_read_byte_into_int(snapshot_module_t *m,
                                              int *value_return);
extern int snapshot_module_read_word_into_int(snapshot_module_t *m,
                                              int *value_return);
extern int snapshot_module_read_dword_into_ulong(snapshot_module_t *m,
                                                 unsigned long *value_return);
extern int snapshot_module_read_dword_into_int(snapshot_module_t *m,
                                               int *value_return);

#define SMW_B      snapshot_module_write_byte
#define SMW_W      snapshot_module_write_word
#define SMW_DW     snapshot_module_write_dword
#define SMW_PSTR   snapshot_module_write_padded_string
#define SMW_BA     snapshot_module_write_byte_array
#define SMW_WA     snapshot_module_write_word_array
#define SMW_DWA    snapshot_module_write_dword_array
#define SMW_STR    snapshot_module_write_string
#define SMR_B      snapshot_module_read_byte
#define SMR_W      snapshot_module_read_word
#define SMR_DW     snapshot_module_read_dword
#define SMR_BA     snapshot_module_read_byte_array
#define SMR_WA     snapshot_module_read_word_array
#define SMR_DWA    snapshot_module_read_dword_array
#define SMR_STR    snapshot_module_read_string
#define SMR_B_INT  snapshot_module_read_byte_into_int
#define SMR_W_INT  snapshot_module_read_word_into_int
#define SMR_DW_UL  snapshot_module_read_dword_into_ulong
#define SMR_DW_INT snapshot_module_read_dword_into_int

extern snapshot_module_t *snapshot_module_create(snapshot_t *s,
                                                 const char *name,
                                                 BYTE major_version,
                                                 BYTE minor_version);
extern snapshot_module_t *snapshot_module_open(snapshot_t *s,
                                               const char *name,
                                               BYTE *major_version_return,
                                               BYTE *minor_version_return);
extern int snapshot_module_close(snapshot_module_t *m);

extern snapshot_t *snapshot_create(const char *filename,
                                   BYTE major_version, BYTE minor_version,
                                   const char *snapshot_machine_name);
extern snapshot_t *snapshot_open(const char *filename,
                                 BYTE *major_version_return,
                                 BYTE *minor_version_return,
                                 const char *snapshot_machine_name);
extern int snapshot_close(snapshot_t *s);

#endif