Diff for /np2/fdd/sxsi.c between versions 1.2 and 1.6

version 1.2, 2003/10/18 01:21:58 version 1.6, 2003/12/08 00:55:31
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 #include        "dosio.h"  #include        "dosio.h"
   #include        "sysmng.h"
   #include        "cpucore.h"
 #include        "pccore.h"  #include        "pccore.h"
 #include        "sxsi.h"  #include        "sxsi.h"
   
Line 33  typedef struct { Line 35  typedef struct {
 } HDIHDR;  } HDIHDR;
   
 static const _SXSIHDD defsasi = {615*33*8, 615, 256, 33, 8,  static const _SXSIHDD defsasi = {615*33*8, 615, 256, 33, 8,
                                                                                         HDDTYPE_SASI, 256, {0x00}};                                                                                          HDDTYPE_SASI, 256, 0, {0x00}};
 static const _SXSIHDD defscsi = {40*16*32*8, 40*16, 256, 32, 8,  static const _SXSIHDD defscsi = {40*16*32*8, 40*16, 256, 32, 8,
                                                                                         HDDTYPE_SCSI, 220, {0x00}};                                                                                          HDDTYPE_SCSI, 220, 0, {0x00}};
   
   
         _SXSIHDD        sxsi_hd[4];          _SXSIHDD        sxsi_hd[4];
Line 49  void sxsi_initialize(void) { Line 51  void sxsi_initialize(void) {
   
         ZeroMemory(sxsi_hd, sizeof(sxsi_hd));          ZeroMemory(sxsi_hd, sizeof(sxsi_hd));
         for (i=0; i<(sizeof(sxsi_hd)/sizeof(_SXSIHDD)); i++) {          for (i=0; i<(sizeof(sxsi_hd)/sizeof(_SXSIHDD)); i++) {
                 sxsi_hd[i].fh = (void *)FILEH_INVALID;                  sxsi_hd[i].fh = (long)FILEH_INVALID;
         }          }
 }  }
   
Line 103  const char  *ext; Line 105  const char  *ext;
                         sxsi->tracks = LOADINTELWORD(thd.tracks);                          sxsi->tracks = LOADINTELWORD(thd.tracks);
                         sxsi->totals = sxsi->tracks * sxsi->sectors * sxsi->surfaces;                          sxsi->totals = sxsi->tracks * sxsi->sectors * sxsi->surfaces;
                         file_cpyname(sxsi->fname, file, sizeof(sxsi->fname));                          file_cpyname(sxsi->fname, file, sizeof(sxsi->fname));
                         sxsi->fh = (void *)fh;                          sxsi->fh = (long)fh;
                         return(SUCCESS);                          return(SUCCESS);
                 }                  }
                 file_close(fh);                  file_close(fh);
Line 122  const char  *ext; Line 124  const char  *ext;
                         sxsi->sectors = hdi.sectors[0];                          sxsi->sectors = hdi.sectors[0];
                         sxsi->totals = sxsi->tracks * sxsi->sectors * sxsi->surfaces;                          sxsi->totals = sxsi->tracks * sxsi->sectors * sxsi->surfaces;
                         file_cpyname(sxsi->fname, file, sizeof(sxsi->fname));                          file_cpyname(sxsi->fname, file, sizeof(sxsi->fname));
                         sxsi->fh = (void *)fh;                          sxsi->fh = (long)fh;
                         return(SUCCESS);                          return(SUCCESS);
                 }                  }
                 file_close(fh);                  file_close(fh);
Line 142  const char  *ext; Line 144  const char  *ext;
                         sxsi->sectors = v98.sectors;                          sxsi->sectors = v98.sectors;
                         sxsi->surfaces = v98.surfaces;                          sxsi->surfaces = v98.surfaces;
                         file_cpyname(sxsi->fname, file, sizeof(sxsi->fname));                          file_cpyname(sxsi->fname, file, sizeof(sxsi->fname));
                         sxsi->fh = (void *)fh;                          sxsi->fh = (long)fh;
                         return(SUCCESS);                          return(SUCCESS);
                 }                  }
                 file_close(fh);                  file_close(fh);
Line 176  void sxsi_flash(void) { Line 178  void sxsi_flash(void) {
         while(sxsi < sxsiterm) {          while(sxsi < sxsiterm) {
                 if ((FILEH)sxsi->fh != FILEH_INVALID) {                  if ((FILEH)sxsi->fh != FILEH_INVALID) {
                         file_close((FILEH)sxsi->fh);                          file_close((FILEH)sxsi->fh);
                         sxsi->fh = (void *)FILEH_INVALID;                          sxsi->fh = (long)FILEH_INVALID;
                 }                  }
                 sxsi++;                  sxsi++;
         }          }
Line 192  void sxsi_trash(void) { Line 194  void sxsi_trash(void) {
         while(sxsi < sxsiterm) {          while(sxsi < sxsiterm) {
                 if ((FILEH)sxsi->fh != FILEH_INVALID) {                  if ((FILEH)sxsi->fh != FILEH_INVALID) {
                         file_close((FILEH)sxsi->fh);                          file_close((FILEH)sxsi->fh);
                         sxsi->fh = (void *)FILEH_INVALID;                          sxsi->fh = (long)FILEH_INVALID;
                 }                  }
                 sxsi->fname[0] = '\0';                  sxsi->fname[0] = '\0';
                 sxsi++;                  sxsi++;
Line 214  static SXSIHDD getdrive(BYTE drv) { Line 216  static SXSIHDD getdrive(BYTE drv) {
                 return(NULL);                  return(NULL);
         }          }
         if ((FILEH)ret->fh == FILEH_INVALID) {          if ((FILEH)ret->fh == FILEH_INVALID) {
                 ret->fh = (void *)file_open(ret->fname);                  ret->fh = (long)file_open(ret->fname);
                 if ((FILEH)ret->fh == FILEH_INVALID) {                  if ((FILEH)ret->fh == FILEH_INVALID) {
                         ret->fname[0] = '\0';                          ret->fname[0] = '\0';
                         return(NULL);                          return(NULL);
                 }                  }
         }          }
           sysmng_hddaccess(drv);
         return(ret);          return(ret);
 }  }
   
Line 243  const _SXSIHDD *sxsi; Line 246  const _SXSIHDD *sxsi;
         }          }
         while(size) {          while(size) {
                 rsize = min(size, sxsi->size);                  rsize = min(size, sxsi->size);
                 nevent.remainclock -= rsize;                  CPU_REMCLOCK -= rsize;
                 if (file_read((FILEH)sxsi->fh, buf, rsize) != rsize) {                  if (file_read((FILEH)sxsi->fh, buf, rsize) != rsize) {
                         return(0xd0);                          return(0xd0);
                 }                  }
Line 273  const _SXSIHDD *sxsi; Line 276  const _SXSIHDD *sxsi;
         }          }
         while(size) {          while(size) {
                 wsize = min(size, sxsi->size);                  wsize = min(size, sxsi->size);
                 nevent.remainclock -= wsize;                  CPU_REMCLOCK -= wsize;
                 if (file_write((FILEH)sxsi->fh, buf, wsize) != wsize) {                  if (file_write((FILEH)sxsi->fh, buf, wsize) != wsize) {
                         return(0x70);                          return(0x70);
                 }                  }
Line 310  const _SXSIHDD *sxsi; Line 313  const _SXSIHDD *sxsi;
                 while(size) {                  while(size) {
                         wsize = min(size, sizeof(work));                          wsize = min(size, sizeof(work));
                         size -= wsize;                          size -= wsize;
                         nevent.remainclock -= wsize;                          CPU_REMCLOCK -= wsize;
                         if (file_write((FILEH)sxsi->fh, work, wsize) != wsize) {                          if (file_write((FILEH)sxsi->fh, work, wsize) != wsize) {
                                 return(0x70);                                  return(0x70);
                         }                          }

Removed from v.1.2  
changed lines
  Added in v.1.6


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