|
|
| version 1.6, 2004/08/06 15:03:50 | version 1.7, 2004/08/07 19:06:59 |
|---|---|
| Line 33 static IDEDEV getidedev(void) { | Line 33 static IDEDEV getidedev(void) { |
| static IDEDRV getidedrv(void) { | static IDEDRV getidedrv(void) { |
| IDEDEV dev; | IDEDEV dev; |
| IDEDRV drv; | |
| dev = getidedev(); | dev = getidedev(); |
| if (dev) { | if (dev) { |
| return(dev->drv + dev->drivesel); | drv = dev->drv + dev->drivesel; |
| } | if (drv->device != IDETYPE_NONE) { |
| else { | return(drv); |
| return(NULL); | } |
| } | } |
| return(NULL); | |
| } | } |
| static const char serial[] = "824919341192 "; | static const char serial[] = "824919341192 "; |
| Line 339 static void IOOUTCALL ideio_o64c(UINT po | Line 341 static void IOOUTCALL ideio_o64c(UINT po |
| static void IOOUTCALL ideio_o64e(UINT port, REG8 dat) { | static void IOOUTCALL ideio_o64e(UINT port, REG8 dat) { |
| IDEDRV drv, d; | IDEDRV drv; |
| IDEDEV dev; | IDEDEV dev; |
| int i; | |
| // execute device diagnostic | |
| if (dat == 0x90) { | |
| TRACEOUT(("ideio set cmd %.2x [%.4x:%.8x]", dat, CPU_CS, CPU_EIP)); | |
| TRACEOUT(("ideio: execute device diagnostic")); | |
| dev = getidedev(); | |
| if (dev) { | |
| IDEDRV d; | |
| int i; | |
| for (i = 0; i < 2; i++) { | |
| d = dev->drv + i; | |
| d->hd = 0x00; | |
| d->sc = 0x01; | |
| d->sn = 0x01; | |
| d->cy = 0x0000; | |
| d->status = IDESTAT_DRDY; | |
| d->error = 0x01; | |
| if (i == 0) { | |
| if (dev->drv[0].device == IDETYPE_NONE) { | |
| d->error = 0x00; | |
| } | |
| if (dev->drv[1].device == IDETYPE_NONE) { | |
| d->error |= 0x80; | |
| } | |
| } | |
| else { | |
| if (dev->drv[1].device == IDETYPE_NONE) { | |
| d->error = 0x00; | |
| } | |
| } | |
| } | |
| } | |
| return; | |
| } | |
| drv = getidedrv(); | drv = getidedrv(); |
| if (drv == NULL) { | if (drv == NULL) { |
| Line 352 static void IOOUTCALL ideio_o64e(UINT po | Line 388 static void IOOUTCALL ideio_o64e(UINT po |
| switch(dat) { | switch(dat) { |
| case 0x08: // device reset | case 0x08: // device reset |
| TRACEOUT(("ideio: device reset")); | TRACEOUT(("ideio: device reset")); |
| if (drv->device == IDETYPE_HDD) { | if (drv->device == IDETYPE_NONE) { |
| cmdabort(drv); | |
| break; | |
| } | |
| else if (drv->device == IDETYPE_HDD) { | |
| drv->hd = 0x00; | drv->hd = 0x00; |
| drv->sc = 0x01; | drv->sc = 0x01; |
| drv->sn = 0x01; | drv->sn = 0x01; |
| Line 382 static void IOOUTCALL ideio_o64e(UINT po | Line 422 static void IOOUTCALL ideio_o64e(UINT po |
| } | } |
| } | } |
| } | } |
| if (drv->device != IDETYPE_NONE) { | setintr(drv); |
| setintr(drv); | |
| } | |
| break; | break; |
| case 0x10: // calibrate | case 0x10: // calibrate |
| Line 411 static void IOOUTCALL ideio_o64e(UINT po | Line 449 static void IOOUTCALL ideio_o64e(UINT po |
| readsec(drv); | readsec(drv); |
| break; | break; |
| case 0x90: // execute device diagnostic | |
| TRACEOUT(("ideio: execute device diagnostic")); | |
| dev = getidedev(); | |
| if (dev) { | |
| for (i = 0; i < 2; i++) { | |
| d = dev->drv + i; | |
| if (d->device == IDETYPE_HDD) { | |
| d->hd = 0x00; | |
| d->sc = 0x01; | |
| d->sn = 0x01; | |
| d->cy = 0x0000; | |
| } | |
| else if (d->device == IDETYPE_CDROM) { | |
| d->hd = 0x10; | |
| d->sc = 0x01; | |
| d->sn = 0x01; | |
| d->cy = 0xeb14; | |
| } | |
| d->status = IDESTAT_DRDY; | |
| d->error = 0x01; | |
| if (i == 0) { | |
| if (dev->drv[0].device == IDETYPE_NONE) { | |
| d->error = 0x00; | |
| } | |
| if (dev->drv[1].device == IDETYPE_NONE) { | |
| d->error |= 0x80; | |
| } | |
| } | |
| else { | |
| if (dev->drv[1].device == IDETYPE_NONE) { | |
| d->error = 0x00; | |
| } | |
| } | |
| } | |
| if (drv->device != IDETYPE_NONE) { | |
| setintr(drv); | |
| } | |
| } | |
| else { | |
| cmdabort(drv); | |
| } | |
| break; | |
| case 0x91: // set parameters | case 0x91: // set parameters |
| TRACEOUT(("ideio: set parameters dh=%x sec=%x", | TRACEOUT(("ideio: set parameters dh=%x sec=%x", |
| drv->dr | drv->hd, drv->sc)); | drv->dr | drv->hd, drv->sc)); |
| if (drv->device) { | if (drv->device != IDETYPE_NONE) { |
| drv->surfaces = drv->hd + 1; | drv->surfaces = drv->hd + 1; |
| drv->sectors = drv->sc; | drv->sectors = drv->sc; |
| drv->status &= ~(IDESTAT_BSY | IDESTAT_DRQ | IDESTAT_ERR); | drv->status &= ~(IDESTAT_BSY | IDESTAT_DRQ | IDESTAT_ERR); |