|
|
| version 1.11, 2005/03/05 11:58:02 | version 1.14, 2005/04/06 17:44:09 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #ifdef TRACEOUT | |
| #undef TRACEOUT | |
| #endif | |
| #define TRACEOUT(s) trace_fmt s | |
| // winでidentifyまでは取得に行くんだけどな…ってAnex86も同じか | // winでidentifyまでは取得に行くんだけどな…ってAnex86も同じか |
| #if defined(SUPPORT_IDEIO) | #if defined(SUPPORT_IDEIO) |
| Line 16 | Line 11 |
| #include "ideio.h" | #include "ideio.h" |
| #include "atapicmd.h" | #include "atapicmd.h" |
| #include "sxsi.h" | #include "sxsi.h" |
| #include "sound.h" | |
| #include "idebios.res" | #include "idebios.res" |
| Line 56 static const char model[] = "QUANTUM FIR | Line 52 static const char model[] = "QUANTUM FIR |
| static const char cdrom_serial[] = "1.0 "; | static const char cdrom_serial[] = "1.0 "; |
| static const char cdrom_firm[] = " "; | static const char cdrom_firm[] = " "; |
| static const char cdrom_model[] = "NP2 VIRTUAL CD-ROM DRIVE "; | static const char cdrom_model[] = "NEC CD-ROM DRIVE "; |
| static BRESULT setidentify(IDEDRV drv) { | static BRESULT setidentify(IDEDRV drv) { |
| Line 924 REG16 IOINPCALL ideio_r16(UINT port) { | Line 920 REG16 IOINPCALL ideio_r16(UINT port) { |
| // ---- | // ---- |
| #if 1 | |
| static BRESULT SOUNDCALL playdevaudio(IDEDRV drv, SINT32 *pcm, UINT count) { | |
| SXSIDEV sxsi; | |
| UINT r; | |
| const UINT8 *ptr; | |
| SINT sampl; | |
| SINT sampr; | |
| sxsi = sxsi_getptr(drv->sxsidrv); | |
| if ((sxsi == NULL) || (sxsi->devtype != SXSIDEV_CDROM) || | |
| (!(sxsi->flag & SXSIFLAG_READY))) { | |
| drv->daflag = 0x14; | |
| return(FAILURE); | |
| } | |
| while(count) { | |
| r = min(count, drv->dabufrem); | |
| if (r) { | |
| count -= r; | |
| ptr = drv->dabuf + 2352 - (drv->dabufrem * 4); | |
| drv->dabufrem -= r; | |
| do { | |
| sampl = ((SINT8)ptr[1] << 8) + ptr[0]; | |
| sampr = ((SINT8)ptr[3] << 8) + ptr[2]; | |
| pcm[0] += sampl; | |
| pcm[1] += sampr; | |
| ptr += 4; | |
| pcm += 2; | |
| } while(--r); | |
| } | |
| if (count == 0) { | |
| break; | |
| } | |
| if (drv->dalength == 0) { | |
| drv->daflag = 0x13; | |
| return(FAILURE); | |
| } | |
| if (sxsicd_readraw(sxsi, drv->dacurpos, drv->dabuf) != SUCCESS) { | |
| drv->daflag = 0x14; | |
| return(FAILURE); | |
| } | |
| drv->dalength--; | |
| drv->dacurpos++; | |
| drv->dabufrem = sizeof(drv->dabuf) / 4; | |
| } | |
| return(SUCCESS); | |
| } | |
| static void SOUNDCALL playaudio(void *hdl, SINT32 *pcm, UINT count) { | |
| UINT bit; | |
| IDEDRV drv; | |
| bit = ideio.daplaying; | |
| if (!bit) { | |
| return; | |
| } | |
| if (bit & 4) { | |
| drv = ideio.dev[1].drv + 0; | |
| if (playdevaudio(drv, pcm, count) != SUCCESS) { | |
| bit = bit & (~4); | |
| } | |
| } | |
| ideio.daplaying = bit; | |
| } | |
| #endif | |
| // ---- | |
| static void devinit(IDEDRV drv, REG8 sxsidrv) { | static void devinit(IDEDRV drv, REG8 sxsidrv) { |
| SXSIDEV sxsi; | SXSIDEV sxsi; |
| Line 946 static void devinit(IDEDRV drv, REG8 sxs | Line 1011 static void devinit(IDEDRV drv, REG8 sxs |
| drv->error = 0; | drv->error = 0; |
| drv->media = IDEIO_MEDIA_EJECTABLE; | drv->media = IDEIO_MEDIA_EJECTABLE; |
| if (sxsi->flag & SXSIFLAG_READY) { | if (sxsi->flag & SXSIFLAG_READY) { |
| drv->media |= (IDEIO_MEDIA_CHANGED | IDEIO_MEDIA_LOADED); | drv->media |= (IDEIO_MEDIA_CHANGED|IDEIO_MEDIA_LOADED); |
| } | } |
| drv->daflag = 0x15; | |
| } | } |
| else { | else { |
| drv->status = IDESTAT_ERR; | drv->status = IDESTAT_ERR; |
| Line 974 void ideio_reset(void) { | Line 1040 void ideio_reset(void) { |
| void ideio_bind(void) { | void ideio_bind(void) { |
| if (pccore.hddif & PCHDD_IDE) { | if (pccore.hddif & PCHDD_IDE) { |
| #if 1 | |
| sound_streamregist(NULL, (SOUNDCB)playaudio); | |
| #endif | |
| iocore_attachout(0x0430, ideio_o430); | iocore_attachout(0x0430, ideio_o430); |
| iocore_attachout(0x0432, ideio_o430); | iocore_attachout(0x0432, ideio_o430); |
| iocore_attachinp(0x0430, ideio_i430); | iocore_attachinp(0x0430, ideio_i430); |
| Line 1002 void ideio_bind(void) { | Line 1071 void ideio_bind(void) { |
| void ideio_notify(REG8 sxsidrv, UINT action) { | void ideio_notify(REG8 sxsidrv, UINT action) { |
| SXSIDEV sxsi; | |
| IDEDRV drv; | IDEDRV drv; |
| REG8 i; | |
| if ((sxsidrv >= 0) && (sxsidrv < 4)) { | sxsi = sxsi_getptr(sxsidrv); |
| drv = ideio.dev[sxsidrv >> 1].drv + (sxsidrv & 1); | if ((sxsi == NULL) |
| switch(action) { | || (!(sxsi->flag & SXSIFLAG_READY)) |
| case 1: | || (sxsi->devtype != SXSIDEV_CDROM)) { |
| drv->media |= (IDEIO_MEDIA_CHANGED | IDEIO_MEDIA_LOADED); | return; |
| break; | } |
| case 0: | for (i=0; i<4; i++) { |
| drv->media &= ~IDEIO_MEDIA_LOADED; | drv = ideio.dev[i >> 1].drv + (i & 1); |
| break; | if ((drv != NULL) && (drv->sxsidrv == sxsidrv)) { |
| goto do_notify; | |
| } | } |
| } | } |
| return; | |
| do_notify: | |
| switch(action) { | |
| case 1: | |
| drv->media |= (IDEIO_MEDIA_CHANGED|IDEIO_MEDIA_LOADED); | |
| if (sxsi->mediatype & SXSIMEDIA_DATA) | |
| drv->media |= IDEIO_MEDIA_DATA; | |
| if (sxsi->mediatype & SXSIMEDIA_AUDIO) | |
| drv->media |= IDEIO_MEDIA_AUDIO; | |
| break; | |
| case 0: | |
| drv->media &= ~(IDEIO_MEDIA_LOADED|IDEIO_MEDIA_COMBINE); | |
| break; | |
| } | |
| } | } |
| #endif /* SUPPORT_IDEIO */ | #endif /* SUPPORT_IDEIO */ |