--- np2/fdd/sxsi.c 2004/01/26 14:49:14 1.8 +++ np2/fdd/sxsi.c 2004/01/27 07:24:25 1.10 @@ -19,10 +19,12 @@ const SASIHDD sasihdd[7] = { {33, 6, 615}, // 30MB {33, 8, 615}}; // 40MB +#if 0 static const _SXSIDEV defide = {615*33*8, 615, 256, 33, 8, SXSITYPE_IDE | SXSITYPE_HDD, 256, 0, {0x00}}; static const _SXSIDEV defscsi = {40*16*32*8, 40*16, 256, 32, 8, SXSITYPE_SCSI | SXSITYPE_HDD, 220, 0, {0x00}}; +#endif _SXSIDEV sxsi_dev[SASIHDD_MAX + SCSIHDD_MAX]; @@ -35,7 +37,7 @@ const SASIHDD *sasi; UINT i; sasi = sasihdd; - for (i=0; isize == 256) && (sxsi->sectors == sasi->sectors) && (sxsi->surfaces == sasi->surfaces) && @@ -46,6 +48,7 @@ const SASIHDD *sasi; } } + // ---- void sxsi_initialize(void) { @@ -125,18 +128,6 @@ const char *ext; size = 256; totals = cylinders * sectors * surfaces; } - else if ((!file_cmpname(ext, str_hdi)) && (!(drv & 0x20))) { - HDIHDR hdi; // ANEX86 HDD (SASI) thanx Mamiya - if (file_read(fh, &hdi, sizeof(hdi)) != sizeof(hdi)) { - goto sxsiope_err2; - } - headersize = LOADINTELDWORD(hdi.headersize); - surfaces = LOADINTELDWORD(hdi.surfaces); - cylinders = LOADINTELDWORD(hdi.cylinders); - sectors = LOADINTELDWORD(hdi.sectors); - size = LOADINTELDWORD(hdi.sectorsize); - totals = cylinders * sectors * surfaces; - } else if ((!file_cmpname(ext, str_nhd)) && (!(drv & 0x20))) { NHDHDR nhd; // T98Next HDD (IDE) if ((file_read(fh, &nhd, sizeof(nhd)) != sizeof(nhd)) || @@ -150,13 +141,25 @@ const char *ext; size = LOADINTELWORD(nhd.sectorsize); totals = cylinders * sectors * surfaces; } + else if ((!file_cmpname(ext, str_hdi)) && (!(drv & 0x20))) { + HDIHDR hdi; // ANEX86 HDD (SASI) thanx Mamiya + if (file_read(fh, &hdi, sizeof(hdi)) != sizeof(hdi)) { + goto sxsiope_err2; + } + headersize = LOADINTELDWORD(hdi.headersize); + surfaces = LOADINTELDWORD(hdi.surfaces); + cylinders = LOADINTELDWORD(hdi.cylinders); + sectors = LOADINTELDWORD(hdi.sectors); + size = LOADINTELDWORD(hdi.sectorsize); + totals = cylinders * sectors * surfaces; + } else if ((!file_cmpname(ext, str_hdd)) && (drv & 0x20)) { VHDHDR vhd; // Virtual98 HDD (SCSI) if ((file_read(fh, &vhd, sizeof(vhd)) != sizeof(vhd)) || (memcmp(vhd.sig, sig_vhd, 5))) { goto sxsiope_err2; } - headersize = 220; + headersize = sizeof(vhd); surfaces = vhd.surfaces; cylinders = LOADINTELWORD(vhd.cylinders); sectors = vhd.sectors; @@ -282,6 +285,58 @@ static SXSIDEV getdrive(REG8 drv) { return(ret); } +BOOL sxsi_issasi(void) { + + REG8 drv; + SXSIDEV sxsi; + BOOL ret; + UINT sxsiif; + + ret = FALSE; + for (drv=0x00; drv<0x04; drv++) { + sxsi = sxsi_getptr(drv); + if (sxsi) { + sxsiif = sxsi->type & SXSITYPE_IFMASK; + if (sxsiif == SXSITYPE_SASI) { + ret = TRUE; + } + else if (sxsiif == SXSITYPE_IDE) { + ret = FALSE; + break; + } + } + } + return(ret); +} + +BOOL sxsi_isscsi(void) { + + REG8 drv; + SXSIDEV sxsi; + + for (drv=0x20; drv<0x28; drv++) { + sxsi = sxsi_getptr(drv); + if ((sxsi) && (sxsi->type)) { + return(TRUE); + } + } + return(FALSE); +} + +BOOL sxsi_iside(void) { + + REG8 drv; + SXSIDEV sxsi; + + for (drv=0x00; drv<0x04; drv++) { + sxsi = sxsi_getptr(drv); + if ((sxsi) && (sxsi->type)) { + return(TRUE); + } + } + return(FALSE); +} + REG8 sxsi_read(REG8 drv, long pos, BYTE *buf, UINT size) { const _SXSIDEV *sxsi;