|
|
| version 1.8, 2004/01/26 14:49:14 | version 1.11, 2004/02/13 20:31:55 |
|---|---|
| Line 19 const SASIHDD sasihdd[7] = { | Line 19 const SASIHDD sasihdd[7] = { |
| {33, 6, 615}, // 30MB | {33, 6, 615}, // 30MB |
| {33, 8, 615}}; // 40MB | {33, 8, 615}}; // 40MB |
| #if 0 | |
| static const _SXSIDEV defide = {615*33*8, 615, 256, 33, 8, | static const _SXSIDEV defide = {615*33*8, 615, 256, 33, 8, |
| SXSITYPE_IDE | SXSITYPE_HDD, 256, 0, {0x00}}; | SXSITYPE_IDE | SXSITYPE_HDD, 256, 0, {0x00}}; |
| static const _SXSIDEV defscsi = {40*16*32*8, 40*16, 256, 32, 8, | static const _SXSIDEV defscsi = {40*16*32*8, 40*16, 256, 32, 8, |
| SXSITYPE_SCSI | SXSITYPE_HDD, 220, 0, {0x00}}; | SXSITYPE_SCSI | SXSITYPE_HDD, 220, 0, {0x00}}; |
| #endif | |
| _SXSIDEV sxsi_dev[SASIHDD_MAX + SCSIHDD_MAX]; | _SXSIDEV sxsi_dev[SASIHDD_MAX + SCSIHDD_MAX]; |
| Line 35 const SASIHDD *sasi; | Line 37 const SASIHDD *sasi; |
| UINT i; | UINT i; |
| sasi = sasihdd; | sasi = sasihdd; |
| for (i=0; i<sizeof(sasihdd)/sizeof(SASIHDD); i++) { | for (i=0; i<sizeof(sasihdd)/sizeof(SASIHDD); i++, sasi++) { |
| if ((sxsi->size == 256) && | if ((sxsi->size == 256) && |
| (sxsi->sectors == sasi->sectors) && | (sxsi->sectors == sasi->sectors) && |
| (sxsi->surfaces == sasi->surfaces) && | (sxsi->surfaces == sasi->surfaces) && |
| Line 46 const SASIHDD *sasi; | Line 48 const SASIHDD *sasi; |
| } | } |
| } | } |
| // ---- | // ---- |
| void sxsi_initialize(void) { | void sxsi_initialize(void) { |
| Line 63 SXSIDEV sxsi_getptr(REG8 drv) { | Line 66 SXSIDEV sxsi_getptr(REG8 drv) { |
| UINT num; | UINT num; |
| num = drv & 0x0f; | num = drv & 0x0f; |
| if (!(drv & 0x20)) { // SASI or IDE | if (!(drv & 0x20)) { // SASI or IDE |
| if (num < 2) { | if (num < SASIHDD_MAX) { |
| return(sxsi_dev + num); | return(sxsi_dev + num); |
| } | } |
| } | } |
| #if defined(SUPPORT_SCSI) | |
| else { | else { |
| if (num < 4) { // SCSI | if (num < SCSIHDD_MAX) { // SCSI |
| return(sxsi_dev + SASIHDD_MAX + num); | return(sxsi_dev + SASIHDD_MAX + num); |
| } | } |
| } | } |
| #endif | |
| return(NULL); | return(NULL); |
| } | } |
| Line 125 const char *ext; | Line 130 const char *ext; |
| size = 256; | size = 256; |
| totals = cylinders * sectors * surfaces; | 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))) { | else if ((!file_cmpname(ext, str_nhd)) && (!(drv & 0x20))) { |
| NHDHDR nhd; // T98Next HDD (IDE) | NHDHDR nhd; // T98Next HDD (IDE) |
| if ((file_read(fh, &nhd, sizeof(nhd)) != sizeof(nhd)) || | if ((file_read(fh, &nhd, sizeof(nhd)) != sizeof(nhd)) || |
| Line 150 const char *ext; | Line 143 const char *ext; |
| size = LOADINTELWORD(nhd.sectorsize); | size = LOADINTELWORD(nhd.sectorsize); |
| totals = cylinders * sectors * surfaces; | 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)) { | else if ((!file_cmpname(ext, str_hdd)) && (drv & 0x20)) { |
| VHDHDR vhd; // Virtual98 HDD (SCSI) | VHDHDR vhd; // Virtual98 HDD (SCSI) |
| if ((file_read(fh, &vhd, sizeof(vhd)) != sizeof(vhd)) || | if ((file_read(fh, &vhd, sizeof(vhd)) != sizeof(vhd)) || |
| (memcmp(vhd.sig, sig_vhd, 5))) { | (memcmp(vhd.sig, sig_vhd, 5))) { |
| goto sxsiope_err2; | goto sxsiope_err2; |
| } | } |
| headersize = 220; | headersize = sizeof(vhd); |
| surfaces = vhd.surfaces; | surfaces = vhd.surfaces; |
| cylinders = LOADINTELWORD(vhd.cylinders); | cylinders = LOADINTELWORD(vhd.cylinders); |
| sectors = vhd.sectors; | sectors = vhd.sectors; |
| Line 216 void sxsi_open(void) { | Line 221 void sxsi_open(void) { |
| drv++; | drv++; |
| } | } |
| } | } |
| #if defined(SUPPORT_SCSI) | |
| drv = 0x20; | drv = 0x20; |
| for (i=0; i<4; i++) { | for (i=0; i<4; i++) { |
| if (sxsi_hddopen(drv, np2cfg.scsihdd[i]) == SUCCESS) { | if (sxsi_hddopen(drv, np2cfg.scsihdd[i]) == SUCCESS) { |
| drv++; | drv++; |
| } | } |
| } | } |
| #endif | |
| } | } |
| void sxsi_flash(void) { | void sxsi_flash(void) { |
| Line 259 void sxsi_trash(void) { | Line 266 void sxsi_trash(void) { |
| static SXSIDEV getdrive(REG8 drv) { | static SXSIDEV getdrive(REG8 drv) { |
| UINT num; | |
| SXSIDEV ret; | SXSIDEV ret; |
| num = drv & 0x0f; | ret = sxsi_getptr(drv); |
| if (num >= 2) { | if ((ret == NULL) || (ret->fname[0] == '\0')) { |
| return(NULL); | |
| } | |
| num += (drv & 0x20) >> 4; | |
| ret = sxsi_dev + num; | |
| if (ret->fname[0] == '\0') { | |
| return(NULL); | return(NULL); |
| } | } |
| if ((FILEH)ret->fh == FILEH_INVALID) { | if ((FILEH)ret->fh == FILEH_INVALID) { |
| Line 282 static SXSIDEV getdrive(REG8 drv) { | Line 283 static SXSIDEV getdrive(REG8 drv) { |
| return(ret); | 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) { | REG8 sxsi_read(REG8 drv, long pos, BYTE *buf, UINT size) { |
| const _SXSIDEV *sxsi; | const _SXSIDEV *sxsi; |