1 |
|
/* |
2 |
|
* disk.cpp - Generic disk driver |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-1999 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2000 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
90 |
|
// Icon address (Mac address space, set by PatchROM()) |
91 |
|
uint32 DiskIconAddr; |
92 |
|
|
93 |
– |
// Number of ticks between checks for disk insertion |
94 |
– |
const int driver_delay = 120; |
95 |
– |
|
93 |
|
// Flag: Control(accRun) has been called, interrupt routine is now active |
94 |
|
static bool acc_run_called = false; |
95 |
|
|
427 |
|
uint32 sel = ReadMacInt32(pb + csParam); |
428 |
|
D(bug(" driver gestalt %c%c%c%c\n", sel >> 24, sel >> 16, sel >> 8, sel)); |
429 |
|
switch (sel) { |
430 |
< |
case 'vers': // Version |
430 |
> |
case FOURCC('v','e','r','s'): // Version |
431 |
|
WriteMacInt32(pb + csParam + 4, 0x01008000); |
432 |
|
break; |
433 |
< |
case 'devt': // Device type |
433 |
> |
case FOURCC('d','e','v','t'): // Device type |
434 |
|
if (info != NULL) { |
435 |
|
if (ReadMacInt8(info->status + dsDiskInPlace) == 8) |
436 |
< |
WriteMacInt32(pb + csParam + 4, 'disk'); |
436 |
> |
WriteMacInt32(pb + csParam + 4, FOURCC('d','i','s','k')); |
437 |
|
else |
438 |
< |
WriteMacInt32(pb + csParam + 4, 'rdsk'); |
438 |
> |
WriteMacInt32(pb + csParam + 4, FOURCC('r','d','s','k')); |
439 |
|
} else |
440 |
< |
WriteMacInt32(pb + csParam + 4, 'disk'); |
440 |
> |
WriteMacInt32(pb + csParam + 4, FOURCC('d','i','s','k')); |
441 |
|
break; |
442 |
< |
case 'intf': // Interface type |
443 |
< |
WriteMacInt32(pb + csParam + 4, 'basi'); |
442 |
> |
case FOURCC('i','n','t','f'): // Interface type |
443 |
> |
WriteMacInt32(pb + csParam + 4, EMULATOR_ID_4); |
444 |
|
break; |
445 |
< |
case 'sync': // Only synchronous operation? |
445 |
> |
case FOURCC('s','y','n','c'): // Only synchronous operation? |
446 |
|
WriteMacInt32(pb + csParam + 4, 0x01000000); |
447 |
|
break; |
448 |
< |
case 'boot': // Boot ID |
448 |
> |
case FOURCC('b','o','o','t'): // Boot ID |
449 |
|
if (info != NULL) |
450 |
|
WriteMacInt16(pb + csParam + 4, info->num); |
451 |
|
else |
452 |
|
WriteMacInt16(pb + csParam + 4, 0); |
453 |
|
WriteMacInt16(pb + csParam + 6, (uint16)DiskRefNum); |
454 |
|
break; |
455 |
< |
case 'wide': // 64-bit access supported? |
455 |
> |
case FOURCC('w','i','d','e'): // 64-bit access supported? |
456 |
|
WriteMacInt16(pb + csParam + 4, 0x0100); |
457 |
|
break; |
458 |
< |
case 'purg': // Purge flags |
458 |
> |
case FOURCC('p','u','r','g'): // Purge flags |
459 |
|
WriteMacInt32(pb + csParam + 4, 0); |
460 |
|
break; |
461 |
< |
case 'ejec': // Eject flags |
461 |
> |
case FOURCC('e','j','e','c'): // Eject flags |
462 |
|
WriteMacInt32(pb + csParam + 4, 0x00030003); // Don't eject on shutdown/restart |
463 |
|
break; |
464 |
< |
case 'flus': // Flush flags |
464 |
> |
case FOURCC('f','l','u','s'): // Flush flags |
465 |
|
WriteMacInt16(pb + csParam + 4, 0); |
466 |
|
break; |
467 |
< |
case 'vmop': // Virtual memory attributes |
467 |
> |
case FOURCC('v','m','o','p'): // Virtual memory attributes |
468 |
|
WriteMacInt32(pb + csParam + 4, 0); // Drive not available for VM |
469 |
|
break; |
470 |
|
default: |
492 |
|
|
493 |
|
|
494 |
|
/* |
495 |
< |
* Driver interrupt routine - check for volumes to be mounted |
495 |
> |
* Driver interrupt routine (1Hz) - check for volumes to be mounted |
496 |
|
*/ |
497 |
|
|
498 |
|
void DiskInterrupt(void) |
499 |
|
{ |
503 |
– |
static int tick_count = 0; |
500 |
|
if (!acc_run_called) |
501 |
|
return; |
502 |
|
|
503 |
< |
tick_count++; |
508 |
< |
if (tick_count > driver_delay) { |
509 |
< |
tick_count = 0; |
510 |
< |
mount_mountable_volumes(); |
511 |
< |
} |
503 |
> |
mount_mountable_volumes(); |
504 |
|
} |