/[cebix]/BasiliskII/src/disk.cpp
ViewVC logotype

Diff of /BasiliskII/src/disk.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by cebix, Sun Oct 3 14:16:25 1999 UTC revision 1.2 by cebix, Tue Oct 12 20:00:43 1999 UTC
# Line 90  static DriveInfo *first_drive_info; Line 90  static DriveInfo *first_drive_info;
90  // Icon address (Mac address space, set by PatchROM())  // Icon address (Mac address space, set by PatchROM())
91  uint32 DiskIconAddr;  uint32 DiskIconAddr;
92    
93    // Number of ticks between checks for disk insertion
94    const int driver_delay = 120;
95    
96    // Flag: Control(accRun) has been called, interrupt routine is now active
97    static bool acc_run_called = false;
98    
99    
100  /*  /*
101   *  Get pointer to drive info, NULL = invalid drive number   *  Get pointer to drive info, NULL = invalid drive number
# Line 184  bool DiskMountVolume(void *fh) Line 190  bool DiskMountVolume(void *fh)
190    
191    
192  /*  /*
193     *  Mount volumes for which the to_be_mounted flag is set
194     *  (called during interrupt time)
195     */
196    
197    static void mount_mountable_volumes(void)
198    {
199            DriveInfo *info = first_drive_info;
200            while (info != NULL) {
201    
202                    // Disk in drive?
203                    if (!ReadMacInt8(info->status + dsDiskInPlace)) {
204    
205                            // No, check if disk was inserted
206                            if (SysIsDiskInserted(info->fh))
207                                    DiskMountVolume(info->fh);
208                    }
209    
210                    // Mount disk if flagged
211                    if (info->to_be_mounted) {
212                            D(bug(" mounting drive %d\n", info->num));
213                            M68kRegisters r;
214                            r.d[0] = info->num;
215                            r.a[0] = 7;     // diskEvent
216                            Execute68kTrap(0xa02f, &r);             // PostEvent()
217                            info->to_be_mounted = false;
218                    }
219    
220                    info = info->next;
221            }
222    }
223    
224    
225    /*
226   *  Driver Open() routine   *  Driver Open() routine
227   */   */
228    
# Line 193  int16 DiskOpen(uint32 pb, uint32 dce) Line 232  int16 DiskOpen(uint32 pb, uint32 dce)
232    
233          // Set up DCE          // Set up DCE
234          WriteMacInt32(dce + dCtlPosition, 0);          WriteMacInt32(dce + dCtlPosition, 0);
235            acc_run_called = false;
236    
237          // Install drives          // Install drives
238          for (DriveInfo *info = first_drive_info; info; info = info->next) {          for (DriveInfo *info = first_drive_info; info; info = info->next) {
# Line 306  int16 DiskControl(uint32 pb, uint32 dce) Line 346  int16 DiskControl(uint32 pb, uint32 dce)
346                  case 1:         // KillIO                  case 1:         // KillIO
347                          return noErr;                          return noErr;
348    
349                  case 65: {      // Periodic action ("insert" disks on startup and check for disk changes)                  case 65: {      // Periodic action (accRun, "insert" disks on startup)
350                          DriveInfo *info = first_drive_info;                          mount_mountable_volumes();
351                          while (info != NULL) {                          WriteMacInt16(dce + dCtlFlags, ReadMacInt16(dce + dCtlFlags) & ~0x2000);        // Disable periodic action
352                            acc_run_called = true;
                                 // Disk in drive?  
                                 if (!ReadMacInt8(info->status + dsDiskInPlace)) {  
   
                                         // No, check if disk was inserted  
                                         if (SysIsDiskInserted(info->fh))  
                                                 DiskMountVolume(info->fh);  
                                 }  
   
                                 // Mount disk if flagged  
                                 if (info->to_be_mounted) {  
                                         D(bug(" mounting drive %d\n", info->num));  
                                         M68kRegisters r;  
                                         r.d[0] = info->num;  
                                         r.a[0] = 7;     // diskEvent  
                                         Execute68kTrap(0xa02f, &r);             // PostEvent()  
                                         info->to_be_mounted = false;  
                                 }  
   
                                 info = info->next;  
                         }  
353                          return noErr;                          return noErr;
354                  }                  }
355          }          }
# Line 472  int16 DiskStatus(uint32 pb, uint32 dce) Line 492  int16 DiskStatus(uint32 pb, uint32 dce)
492                          return statusErr;                          return statusErr;
493          }          }
494  }  }
495    
496    
497    /*
498     *  Driver interrupt routine - check for volumes to be mounted
499     */
500    
501    void DiskInterrupt(void)
502    {
503            static int tick_count = 0;
504            if (!acc_run_called)
505                    return;
506    
507            tick_count++;
508            if (tick_count > driver_delay) {
509                    tick_count = 0;
510                    mount_mountable_volumes();
511            }
512    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.15