Diff for /xmil/fdd/fdd_mtr.c between versions 1.4 and 1.5

version 1.4, 2004/08/03 12:50:54 version 1.5, 2004/08/03 13:08:10
Line 2 Line 2
 #include        "soundmng.h"  #include        "soundmng.h"
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
   #include        "fdd_mtr.h"
   
   
 enum {  enum {
Line 10  enum { Line 11  enum {
         SEKSEC_MS               = 20          SEKSEC_MS               = 20
 };  };
   
 typedef struct {          _FDDMTR         fddmtr;
 //      int             busy;  
         UINT8   head[4];  
 //      UINT    nextevent;  
 //      UINT8   curevent;  
 } _FDDMTR, *FDDMTR;  
   
                 BYTE            curevent = 0;  
                 DWORD           nextevent = 0;  
                 BYTE            FDC_HEAD[4] = {0, 0, 0, 0};  
                 DWORD           FDC_TIME[4] = {0, 0, 0, 0};  
                 short           curdrv = 0;  
   
   
 void fddmtr_event(void) {  static void fddmtr_event(void) {
   
         switch(curevent) {          switch(fddmtr.curevent) {
                 case 100:                  case 100:
                         soundmng_pcmstop(SOUND_PCMSEEK);                          soundmng_pcmstop(SOUND_PCMSEEK);
                         nextevent += MOVEMOTOR1_MS;                          fddmtr.nextevent += MOVEMOTOR1_MS;
                         curevent = 1;                          fddmtr.curevent = 1;
                         break;  
                 case 80:  
                         curevent = 0;  
                         break;                          break;
   
                 default:                  default:
                         curevent = 0;                          fddmtr.curevent = 0;
                         break;                          break;
         }          }
 }  }
   
   
   // ----
   
 void fddmtr_init(void) {  void fddmtr_init(void) {
   
         fddmtr_event();          soundmng_pcmstop(SOUND_PCMSEEK);
         memset(FDC_HEAD, 24, sizeof(FDC_HEAD));          ZeroMemory(&fddmtr, sizeof(fddmtr));
         ZeroMemory(FDC_TIME, sizeof(FDC_TIME));          FillMemory(fddmtr.head, sizeof(fddmtr.head), 24);
 }  }
   
 void fddmtr_callback(DWORD time) {  void fddmtr_callback(DWORD time) {
   
         if ((curevent) && (time >= nextevent)) {          if ((fddmtr.curevent) && (time >= fddmtr.nextevent)) {
                 fddmtr_event();                  fddmtr_event();
         }          }
 }  }
   
 void fddmtr_drvset(void) {  void fddmtr_drvset(void) {
   
         curdrv = fdc.drv;          fddmtr.curdrv = fdc.drv;
         if ((!FDC_TIME[curdrv]) && (!fdc.motor)) {          if ((!fddmtr.eventtime[fddmtr.curdrv]) && (!fdc.motor)) {
                 FDC_TIME[curdrv] = GetTickCount() + 5000;                  fddmtr.eventtime[fddmtr.curdrv] = GETTICK() + 5000;
         }          }
         else if ((FDC_TIME[curdrv]) && (fdc.motor)) {          else if ((fddmtr.eventtime[fddmtr.curdrv]) && (fdc.motor)) {
                 if (FDC_TIME[curdrv] < GetTickCount()) {                  if (fddmtr.eventtime[fddmtr.curdrv] < GETTICK()) {
                         FDC_HEAD[curdrv] = 24;                          fddmtr.head[fddmtr.curdrv] = 24;
                 }                  }
                 FDC_TIME[curdrv] = 0;                  fddmtr.eventtime[fddmtr.curdrv] = 0;
         }          }
 }  }
   
Line 75  void fddmtr_motormove(void) { Line 64  void fddmtr_motormove(void) {
   
         int             regmove;          int             regmove;
   
         regmove = FDC_HEAD[curdrv] - fdc.c;          regmove = fddmtr.head[fddmtr.curdrv] - fdc.c;
         FDC_HEAD[curdrv] = fdc.c;          fddmtr.head[fddmtr.curdrv] = fdc.c;
         if ((!xmilcfg.MOTOR) || (xmilcfg.NOWAIT)) {          if ((!xmilcfg.MOTOR) || (xmilcfg.NOWAIT)) {
                 return;                  return;
         }          }
Line 84  void fddmtr_motormove(void) { Line 73  void fddmtr_motormove(void) {
                 regmove *= (-1);                  regmove *= (-1);
         }          }
         if (regmove == 1) {          if (regmove == 1) {
                 if (curevent < 80) {                  if (fddmtr.curevent < 80) {
                         fddmtr_event();                          fddmtr_event();
                         soundmng_pcmplay(SOUND_PCMSEEK1, FALSE);                          soundmng_pcmplay(SOUND_PCMSEEK1, FALSE);
                         curevent = 80;                          fddmtr.curevent = 80;
                         nextevent = GetTickCount() + MOVEMOTOR1_MS;                          fddmtr.nextevent = GETTICK() + MOVEMOTOR1_MS;
                 }                  }
         }          }
         else if (regmove) {          else if (regmove) {
                 if (curevent < 100) {                  if (fddmtr.curevent < 100) {
                         fddmtr_event();                          fddmtr_event();
                         soundmng_pcmplay(SOUND_PCMSEEK, TRUE);                          soundmng_pcmplay(SOUND_PCMSEEK, TRUE);
                         curevent = 100;                          fddmtr.curevent = 100;
                         nextevent = GetTickCount() + regmove * MOVE1TCK_MS;                          fddmtr.nextevent = GETTICK() + regmove * MOVE1TCK_MS;
                 }                  }
         }          }
 }  }
Line 106  void fddmtr_waitsec(BYTE value) { Line 95  void fddmtr_waitsec(BYTE value) {
         if ((!xmilcfg.MOTOR) || (xmilcfg.NOWAIT)) {          if ((!xmilcfg.MOTOR) || (xmilcfg.NOWAIT)) {
                 return;                  return;
         }          }
         if ((fdc.r != value) && (curevent < 1)) {          if ((fdc.r != value) && (fddmtr.curevent < 1)) {
                 fddmtr_event();                  fddmtr_event();
                 curevent = 1;                  fddmtr.curevent = 1;
                 nextevent = GetTickCount() + SEKSEC_MS;                  fddmtr.nextevent = GETTICK() + SEKSEC_MS;
         }          }
 }  }
   

Removed from v.1.4  
changed lines
  Added in v.1.5


RetroPC.NET-CVS <cvs@retropc.net>