158
158
drive->mynumber = dnr;
161
if (drive_rom_load_images() < 0) {
161
if (driverom_load_images() < 0) {
162
162
resources_set_value("Drive8Type", (resource_value_t)DRIVE_TYPE_NONE);
163
163
resources_set_value("Drive9Type", (resource_value_t)DRIVE_TYPE_NONE);
220
220
for (dnr = 0; dnr < DRIVE_NUM; dnr++) {
221
221
drive = drive_context[dnr]->drive;
222
drive_rom_initialize_traps(drive);
222
driverom_initialize_traps(drive);
224
drive_sync_clock_frequency(drive->type, drive);
224
drivesync_clock_frequency(drive->type, drive);
226
226
rotation_init((drive->clock_frequency == 2) ? 1 : 0, dnr);
228
drive_cpu_init(drive_context[dnr], drive->type);
228
drivecpu_init(drive_context[dnr], drive->type);
230
230
/* Make sure the sync factor is acknowledged correctly. */
231
drive_sync_factor(drive_context[dnr]);
231
drivesync_factor(drive_context[dnr]);
233
233
/* Make sure the traps are moved as needed. */
234
234
if (drive->enable)
293
293
if (drv->drive->byte_ready_active == 0x06)
294
294
rotation_rotate_disk(drv->drive);
296
drive_sync_clock_frequency(type, drv->drive);
296
drivesync_clock_frequency(type, drv->drive);
298
298
rotation_init(0, dnr);
299
299
drv->drive->type = type;
300
300
drv->drive->side = 0;
301
301
machine_drive_rom_setup_image(dnr);
302
drive_sync_factor(drv);
302
drivesync_factor(drv);
303
303
drive_set_active_led_color(type, dnr);
305
drive_cpu_init(drv, type);
305
drivecpu_init(drv, type);
337
337
if (drive->image != NULL)
338
338
drive_image_attach(drive->image, dnr + 8);
340
drive_cpu_wake_up(drv);
340
drivecpu_wake_up(drv);
342
342
/* Make sure the UI is updated. */
343
343
for (i = 0; i < DRIVE_NUM; i++) {
430
430
unsigned int dnr;
432
432
for (dnr = 0; dnr < DRIVE_NUM; dnr++)
433
drive_cpu_reset(drive_context[dnr]);
436
/*-------------------------------------------------------------------------- */
438
/* The following functions are time critical. */
433
drivecpu_reset(drive_context[dnr]);
436
void drive_current_track_size_set(drive_t *dptr)
438
dptr->GCR_current_track_size =
439
dptr->gcr->track_size[dptr->current_half_track / 2 - 1];
440
442
/* Move the head to half track `num'. */
441
443
void drive_set_half_track(int num, drive_t *dptr)
469
471
dptr->GCR_head_offset = 0;
471
dptr->GCR_current_track_size =
472
dptr->gcr->track_size[dptr->current_half_track / 2 - 1];
475
/* Return the write protect sense status. */
476
inline BYTE drive_write_protect_sense(drive_t *dptr)
478
/* Clear the write protection bit for the time the disk is pulled out on
480
if (dptr->detach_clk != (CLOCK)0) {
481
if (*(dptr->clk) - dptr->detach_clk < DRIVE_DETACH_DELAY)
483
dptr->detach_clk = (CLOCK)0;
485
/* Set the write protection bit for the minimum time until a new disk
487
if (dptr->attach_detach_clk != (CLOCK)0) {
488
if (*(dptr->clk) - dptr->attach_detach_clk
489
< DRIVE_ATTACH_DETACH_DELAY)
491
dptr->attach_detach_clk = (CLOCK)0;
493
/* Clear the write protection bit for the time the disk is put in on
495
if (dptr->attach_clk != (CLOCK)0) {
496
if (*(dptr->clk) - dptr->attach_clk < DRIVE_ATTACH_DELAY)
498
dptr->attach_clk = (CLOCK)0;
501
if (dptr->GCR_image_loaded == 0) {
502
/* No disk in drive, write protection is off. */
505
return dptr->read_only ? 0x0 : 0x10;
509
/* End of time critical functions. */
473
drive_current_track_size_set(dptr);
510
476
/*-------------------------------------------------------------------------- */
512
478
/* Increment the head position by `step' half-tracks. Valid values
607
void drive_gcr_data_writeback_all(void)
612
for (i = 0; i < DRIVE_NUM; i++) {
613
drive = drive_context[i]->drive;
614
drive_gcr_data_writeback(drive);
641
618
static void drive_extend_disk_image(drive_t *drive)
744
721
drv->drive = lib_calloc(1, sizeof(drive_t));
745
722
drv->clk_ptr = &drive_clk[dnr];
747
drive_cpu_setup_context(drv);
724
drivecpu_setup_context(drv);
748
725
machine_drive_setup_context(drv);