~ubuntu-branches/ubuntu/trusty/vice/trusty

« back to all changes in this revision

Viewing changes to src/drive/iec/iec-resources.c

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2013-07-28 20:38:23 UTC
  • mfrom: (1.1.10) (9.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20130728203823-1h8s6bcv22oundul
Tags: 2.4.dfsg-1
* New upstream release (closes: #693065, #693641).
* Drop vice-ffmpeg.patch , applied upstream.
* Disable architecture specific compilation (closes: #686400, #714136).

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include "drive.h"
32
32
#include "drivemem.h"
33
33
#include "drivetypes.h"
 
34
#include "driverom.h"
34
35
#include "iec-resources.h"
35
36
#include "iecrom.h"
36
37
#include "lib.h"
38
39
#include "traps.h"
39
40
#include "util.h"
40
41
 
41
 
 
42
 
static int romset_firmware[5];
43
 
 
44
42
static char *dos_rom_name_1541 = NULL;
45
43
static char *dos_rom_name_1541ii = NULL;
46
44
static char *dos_rom_name_1570 = NULL;
47
45
static char *dos_rom_name_1571 = NULL;
48
46
static char *dos_rom_name_1581 = NULL;
49
 
 
 
47
static char *dos_rom_name_2000 = NULL;
 
48
static char *dos_rom_name_4000 = NULL;
50
49
 
51
50
static void set_drive_ram(unsigned int dnr)
52
51
{
60
59
    return;
61
60
}
62
61
 
63
 
static int set_drive_idling_method(int val, void *param)
64
 
{
65
 
    unsigned int dnr;
66
 
    drive_t *drive;
67
 
 
68
 
    dnr = vice_ptr_to_uint(param);
69
 
    drive = drive_context[dnr]->drive;
70
 
 
71
 
    /* FIXME: Maybe we should call `drive_cpu_execute()' here?  */
72
 
    if (val != DRIVE_IDLE_SKIP_CYCLES
73
 
        && val != DRIVE_IDLE_TRAP_IDLE
74
 
        && val != DRIVE_IDLE_NO_IDLE)
75
 
        return -1;
76
 
 
77
 
    drive->idling_method = val;
78
 
 
79
 
    /* FIXME: These traps are duplicated in driverom.c */
80
 
    if (rom_loaded &&
81
 
        ((drive->type == DRIVE_TYPE_1541) ||
82
 
         (drive->type == DRIVE_TYPE_1541II))) {
83
 
        if (drive->idling_method == DRIVE_IDLE_TRAP_IDLE) {
84
 
            drive->rom[0xeae4 - 0x8000] = 0xea;
85
 
            drive->rom[0xeae5 - 0x8000] = 0xea;
86
 
            drive->rom[0xeae8 - 0x8000] = 0xea;
87
 
            drive->rom[0xeae9 - 0x8000] = 0xea;
88
 
            drive->rom[0xec9b - 0x8000] = TRAP_OPCODE;
89
 
        } else {
90
 
            drive->rom[0xeae4 - 0x8000] = drive->rom_checksum[0];
91
 
            drive->rom[0xeae5 - 0x8000] = drive->rom_checksum[1];
92
 
            drive->rom[0xeae8 - 0x8000] = drive->rom_checksum[2];
93
 
            drive->rom[0xeae9 - 0x8000] = drive->rom_checksum[3];
94
 
            drive->rom[0xec9b - 0x8000] = drive->rom_idle_trap[0];
95
 
        }
96
 
    }
97
 
    if (rom_loaded && drive->type == DRIVE_TYPE_1551) {
98
 
        if (drive->idling_method == DRIVE_IDLE_TRAP_IDLE) {
99
 
            drive->rom[0xe9f4 - 0x8000] = 0xea;
100
 
            drive->rom[0xe9f5 - 0x8000] = 0xea;
101
 
            drive->rom[0xeabf - 0x8000] = 0xea;
102
 
            drive->rom[0xeac0 - 0x8000] = 0xea;
103
 
            drive->rom[0xead0 - 0x8000] = 0x08;
104
 
            drive->rom[0xead9 - 0x8000] = TRAP_OPCODE;
105
 
        } else {
106
 
            drive->rom[0xe9f4 - 0x8000] = drive->rom_checksum[0];
107
 
            drive->rom[0xe9f5 - 0x8000] = drive->rom_checksum[1];
108
 
            drive->rom[0xeabf - 0x8000] = drive->rom_idle_trap[0];
109
 
            drive->rom[0xeac0 - 0x8000] = drive->rom_idle_trap[1];
110
 
            drive->rom[0xead0 - 0x8000] = drive->rom_idle_trap[2];
111
 
            drive->rom[0xead9 - 0x8000] = drive->rom_idle_trap[3];
112
 
        }
113
 
    }
114
 
    return 0;
115
 
}
116
 
 
117
62
static int set_dos_rom_name_1541(const char *val, void *param)
118
63
{
119
64
    if (util_string_set(&dos_rom_name_1541, val))
154
99
    return iecrom_load_1581();
155
100
}
156
101
 
 
102
static int set_dos_rom_name_2000(const char *val, void *param)
 
103
{
 
104
    if (util_string_set(&dos_rom_name_2000, val))
 
105
        return 0;
 
106
 
 
107
    return iecrom_load_2000();
 
108
}
 
109
 
 
110
static int set_dos_rom_name_4000(const char *val, void *param)
 
111
{
 
112
    if (util_string_set(&dos_rom_name_4000, val))
 
113
        return 0;
 
114
 
 
115
    return iecrom_load_4000();
 
116
}
 
117
 
157
118
static int set_drive_ram2(int val, void *param)
158
119
{
159
120
    drive_t *drive = drive_context[vice_ptr_to_uint(param)]->drive;
199
160
    return 0;
200
161
}
201
162
 
202
 
static int set_romset_firmware(int val, void *param)
203
 
{
204
 
    unsigned int num = vice_ptr_to_uint(param);
205
 
 
206
 
    romset_firmware[num] = val;
207
 
 
208
 
    return 0;
209
 
}
210
 
 
211
163
static const resource_string_t resources_string[] = {
212
164
    { "DosName1541", "dos1541", RES_EVENT_NO, NULL,
213
165
      /* FIXME: should be same but names may differ */
220
172
      &dos_rom_name_1571, set_dos_rom_name_1571, NULL },
221
173
    { "DosName1581", "dos1581", RES_EVENT_NO, NULL,
222
174
      &dos_rom_name_1581, set_dos_rom_name_1581, NULL },
 
175
    { "DosName2000", "dos2000", RES_EVENT_NO, NULL,
 
176
      &dos_rom_name_2000, set_dos_rom_name_2000, NULL },
 
177
    { "DosName4000", "dos4000", RES_EVENT_NO, NULL,
 
178
      &dos_rom_name_4000, set_dos_rom_name_4000, NULL },
223
179
    { NULL }
224
180
};
225
181
 
226
182
static const resource_int_t resources_int[] = {
227
 
    { "RomsetDosName1541", 0, RES_EVENT_NO, NULL,
228
 
      &romset_firmware[0], set_romset_firmware, (void *)0 },
229
 
    { "RomsetDosName1541ii", 0, RES_EVENT_NO, NULL,
230
 
      &romset_firmware[1], set_romset_firmware, (void *)1 },
231
 
    { "RomsetDosName1570", 0, RES_EVENT_NO, NULL,
232
 
      &romset_firmware[2], set_romset_firmware, (void *)2 },
233
 
    { "RomsetDosName1571", 0, RES_EVENT_NO, NULL,
234
 
      &romset_firmware[3], set_romset_firmware, (void *)3 },
235
 
    { "RomsetDosName1581", 0, RES_EVENT_NO, NULL,
236
 
      &romset_firmware[4], set_romset_firmware, (void *)4 },
237
183
    { NULL }
238
184
};
239
185
 
240
186
static resource_int_t res_drive[] = {
241
 
    { NULL, DRIVE_IDLE_TRAP_IDLE, RES_EVENT_SAME, NULL,
242
 
      NULL, set_drive_idling_method, NULL },
243
187
    { NULL, 0, RES_EVENT_SAME, NULL,
244
188
      NULL, set_drive_ram2, NULL },
245
189
    { NULL, 0, RES_EVENT_SAME, NULL,
261
205
    for (dnr = 0; dnr < DRIVE_NUM; dnr++) {
262
206
        drive = drive_context[dnr]->drive;
263
207
 
264
 
        res_drive[0].name = lib_msprintf("Drive%iIdleMethod", dnr + 8);
265
 
        res_drive[0].value_ptr = &(drive->idling_method);
 
208
        res_drive[0].name = lib_msprintf("Drive%iRAM2000", dnr + 8);
 
209
        res_drive[0].value_ptr = &(drive->drive_ram2_enabled);
266
210
        res_drive[0].param = uint_to_void_ptr(dnr);
267
 
        res_drive[1].name = lib_msprintf("Drive%iRAM2000", dnr + 8);
268
 
        res_drive[1].value_ptr = &(drive->drive_ram2_enabled);
 
211
        res_drive[1].name = lib_msprintf("Drive%iRAM4000", dnr + 8);
 
212
        res_drive[1].value_ptr = &(drive->drive_ram4_enabled);
269
213
        res_drive[1].param = uint_to_void_ptr(dnr);
270
 
        res_drive[2].name = lib_msprintf("Drive%iRAM4000", dnr + 8);
271
 
        res_drive[2].value_ptr = &(drive->drive_ram4_enabled);
 
214
        res_drive[2].name = lib_msprintf("Drive%iRAM6000", dnr + 8);
 
215
        res_drive[2].value_ptr = &(drive->drive_ram6_enabled);
272
216
        res_drive[2].param = uint_to_void_ptr(dnr);
273
 
        res_drive[3].name = lib_msprintf("Drive%iRAM6000", dnr + 8);
274
 
        res_drive[3].value_ptr = &(drive->drive_ram6_enabled);
 
217
        res_drive[3].name = lib_msprintf("Drive%iRAM8000", dnr + 8);
 
218
        res_drive[3].value_ptr = &(drive->drive_ram8_enabled);
275
219
        res_drive[3].param = uint_to_void_ptr(dnr);
276
 
        res_drive[4].name = lib_msprintf("Drive%iRAM8000", dnr + 8);
277
 
        res_drive[4].value_ptr = &(drive->drive_ram8_enabled);
 
220
        res_drive[4].name = lib_msprintf("Drive%iRAMA000", dnr + 8);
 
221
        res_drive[4].value_ptr = &(drive->drive_rama_enabled);
278
222
        res_drive[4].param = uint_to_void_ptr(dnr);
279
 
        res_drive[5].name = lib_msprintf("Drive%iRAMA000", dnr + 8);
280
 
        res_drive[5].value_ptr = &(drive->drive_rama_enabled);
281
 
        res_drive[5].param = uint_to_void_ptr(dnr);
282
223
 
283
224
        if (resources_register_int(res_drive) < 0)
284
225
            return -1;
288
229
        lib_free((char *)(res_drive[2].name));
289
230
        lib_free((char *)(res_drive[3].name));
290
231
        lib_free((char *)(res_drive[4].name));
291
 
        lib_free((char *)(res_drive[5].name));
292
232
    }
293
233
 
294
234
    if (resources_register_string(resources_string) < 0)
304
244
    lib_free(dos_rom_name_1570);
305
245
    lib_free(dos_rom_name_1571);
306
246
    lib_free(dos_rom_name_1581);
 
247
    lib_free(dos_rom_name_2000);
 
248
    lib_free(dos_rom_name_4000);
307
249
}
308
250