42
static int romset_firmware[5];
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;
47
static char *dos_rom_name_2000 = NULL;
48
static char *dos_rom_name_4000 = NULL;
51
50
static void set_drive_ram(unsigned int dnr)
63
static int set_drive_idling_method(int val, void *param)
68
dnr = vice_ptr_to_uint(param);
69
drive = drive_context[dnr]->drive;
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)
77
drive->idling_method = val;
79
/* FIXME: These traps are duplicated in driverom.c */
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;
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];
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;
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];
117
62
static int set_dos_rom_name_1541(const char *val, void *param)
119
64
if (util_string_set(&dos_rom_name_1541, val))
154
99
return iecrom_load_1581();
102
static int set_dos_rom_name_2000(const char *val, void *param)
104
if (util_string_set(&dos_rom_name_2000, val))
107
return iecrom_load_2000();
110
static int set_dos_rom_name_4000(const char *val, void *param)
112
if (util_string_set(&dos_rom_name_4000, val))
115
return iecrom_load_4000();
157
118
static int set_drive_ram2(int val, void *param)
159
120
drive_t *drive = drive_context[vice_ptr_to_uint(param)]->drive;
202
static int set_romset_firmware(int val, void *param)
204
unsigned int num = vice_ptr_to_uint(param);
206
romset_firmware[num] = val;
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 },
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 },
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;
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);
283
224
if (resources_register_int(res_drive) < 0)