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

« back to all changes in this revision

Viewing changes to src/c64/georam.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2009-03-31 00:37:15 UTC
  • mfrom: (1.1.7 upstream) (9.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090331003715-i5yisvcfv7mgz3eh
Tags: 2.1.dfsg-1
* New major upstream release (closes: #495937).
* Add desktop files (closes: #501181).

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 *
25
25
 */
26
26
 
 
27
/*
 
28
 * The GeoRAM is a banked memory system. It uses the registers at
 
29
 * $dffe and $dfff to determine what part of the GeoRAM memory should
 
30
 * be mapped to $de00-$deff.
 
31
 *
 
32
 * The BBG (Battery Backed GeoRAM) is a version that retains the
 
33
 * RAM contents after power-off.
 
34
 *
 
35
 * The register at $dfff selects which 16k block to map, and $dffe
 
36
 * selects a 256-byte page in that block. Since there are only 64
 
37
 * 256-byte pages inside of 16k, the value in $dffe ranges from 0 to
 
38
 * 63.
 
39
 *
 
40
 * Register | bits
 
41
 * -------------------
 
42
 * $dffe    | xx543210
 
43
 *
 
44
 * x = unused, not connected.
 
45
 *
 
46
 *
 
47
 * The number of 16k blocks that is available depends on the
 
48
 * size of the GeoRAM/BBG:
 
49
 *
 
50
 * RAM size | $dfff
 
51
 * ------------------
 
52
 *    64k   | $00-$03
 
53
 *   128k   | $00-$07
 
54
 *   256k   | $00-$0f
 
55
 *   512k   | $00-$1f
 
56
 *  1024k   | $00-$3f
 
57
 *  2048k   | $00-$7f
 
58
 *  2048k   | $00-$ff
 
59
 *
 
60
 * The unused bits in both registers are ignore and using them in
 
61
 * software will cause a wrap-around.
 
62
 *
 
63
 * The two registers are write-only. Attempting to read them will
 
64
 * only return random values.
 
65
 *
 
66
 * Currently both the BBG and GeoRAM are emulated, BBG mode is
 
67
 * used when selecting a save-file.
 
68
 *
 
69
 * The current emulation has the two registers mirrorred through the
 
70
 * range of $df80-$dffd
 
71
 *
 
72
 * There is also a user-made clone of the GeoRAM called the NeoRAM,
 
73
 * it works in the same way as the GeoRAM but seems to have extra
 
74
 * RAM sizes currently not supported by this emulation (like 1536k).
 
75
 *
 
76
 */
 
77
 
27
78
#include "vice.h"
28
79
 
29
80
#include <stdio.h>
41
92
#include "resources.h"
42
93
#include "georam.h"
43
94
#include "snapshot.h"
44
 
#ifdef HAS_TRANSLATION
45
95
#include "translate.h"
46
 
#endif
47
96
#include "types.h"
48
97
#include "util.h"
49
98
 
185
234
 
186
235
/* ------------------------------------------------------------------------- */
187
236
 
188
 
#ifdef HAS_TRANSLATION
189
 
static const cmdline_option_t cmdline_options[] =
190
 
{
191
 
    { "-georam", SET_RESOURCE, 0, NULL, NULL, "GEORAM", (resource_value_t)1,
192
 
      0, IDCLS_ENABLE_GEORAM },
193
 
    { "+georam", SET_RESOURCE, 0, NULL, NULL, "GEORAM", (resource_value_t)0,
194
 
      0, IDCLS_DISABLE_GEORAM },
195
 
    { "-georamimage", SET_RESOURCE, 1, NULL, NULL, "GEORAMfilename", NULL,
196
 
      IDCLS_P_NAME, IDCLS_SPECIFY_GEORAM_NAME },
197
 
    { "-georamsize", SET_RESOURCE, 1, NULL, NULL, "GEORAMsize", NULL,
198
 
      IDCLS_P_SIZE_IN_KB, IDCLS_GEORAM_SIZE },
199
 
    { NULL }
200
 
};
201
 
#else
202
 
static const cmdline_option_t cmdline_options[] =
203
 
{
204
 
    { "-georam", SET_RESOURCE, 0, NULL, NULL, "GEORAM", (resource_value_t)1,
205
 
      NULL, N_("Enable the GEORAM expansion unit") },
206
 
    { "+georam", SET_RESOURCE, 0, NULL, NULL, "GEORAM", (resource_value_t)0,
207
 
      NULL, N_("Disable the GEORAM expansion unit") },
208
 
    { "-georamimage", SET_RESOURCE, 1, NULL, NULL, "GEORAMfilename", NULL,
209
 
      N_("<name>"), N_("Specify name of GEORAM image") },
210
 
    { "-georamsize", SET_RESOURCE, 1, NULL, NULL, "GEORAMsize", NULL,
211
 
      N_("<size in KB>"), N_("Size of the GEORAM expansion unit") },
212
 
    { NULL }
213
 
};
214
 
#endif
 
237
static const cmdline_option_t cmdline_options[] =
 
238
{
 
239
    { "-georam", SET_RESOURCE, 0,
 
240
      NULL, NULL, "GEORAM", (resource_value_t)1,
 
241
      USE_PARAM_STRING, USE_DESCRIPTION_ID,
 
242
      IDCLS_UNUSED, IDCLS_ENABLE_GEORAM,
 
243
      NULL, NULL },
 
244
    { "+georam", SET_RESOURCE, 0,
 
245
      NULL, NULL, "GEORAM", (resource_value_t)0,
 
246
      USE_PARAM_STRING, USE_DESCRIPTION_ID,
 
247
      IDCLS_UNUSED, IDCLS_DISABLE_GEORAM,
 
248
      NULL, NULL },
 
249
    { "-georamimage", SET_RESOURCE, 1,
 
250
      NULL, NULL, "GEORAMfilename", NULL,
 
251
      USE_PARAM_ID, USE_DESCRIPTION_ID,
 
252
      IDCLS_P_NAME, IDCLS_SPECIFY_GEORAM_NAME,
 
253
      NULL, NULL },
 
254
    { "-georamsize", SET_RESOURCE, 1,
 
255
      NULL, NULL, "GEORAMsize", NULL,
 
256
      USE_PARAM_ID, USE_DESCRIPTION_ID,
 
257
      IDCLS_P_SIZE_IN_KB, IDCLS_GEORAM_SIZE,
 
258
      NULL, NULL },
 
259
    { NULL }
 
260
};
215
261
 
216
262
int georam_cmdline_options_init(void)
217
263
{
294
340
 
295
341
/* ------------------------------------------------------------------------- */
296
342
 
297
 
BYTE REGPARM1 georam_reg_read(WORD addr)
298
 
{
299
 
    BYTE retval;
300
 
 
301
 
    io_source=IO_SOURCE_GEORAM;
302
 
    retval=georam[addr&1];
303
 
 
304
 
    return retval;
305
 
}
306
 
 
307
343
BYTE REGPARM1 georam_window_read(WORD addr)
308
344
{
309
345
    BYTE retval;