| version 1.8, 2004/08/11 13:53:53 | version 1.10, 2004/08/11 17:45:06 | 
| Line 18  void nvitem_fdcbusy(UINT id) { | Line 18  void nvitem_fdcbusy(UINT id) { | 
 | fdc.s.busy = FALSE; | fdc.s.busy = FALSE; | 
 | if (fdc.s.bufdir) { | if (fdc.s.bufdir) { | 
 | TRACEOUT(("dma ready!")); | TRACEOUT(("dma ready!")); | 
| dma.DMA_REDY = 0; | dmac_sendready(TRUE); | 
 | } | } | 
 | } | } | 
 |  |  | 
| Line 130  static REG8 type2cmd(REG8 sc) { | Line 130  static REG8 type2cmd(REG8 sc) { | 
 | fdc.s.bufmark = fdc.s.cmd & 1; | fdc.s.bufmark = fdc.s.cmd & 1; | 
 | fdc.s.bufpos = 0; | fdc.s.bufpos = 0; | 
 | fdc.s.bufsize = size; | fdc.s.bufsize = size; | 
 |  | fdc.s.curtime = 0; | 
 | return(stat); | return(stat); | 
 | } | } | 
 |  |  | 
| Line 169  static REG8 crccmd(void) { | Line 170  static REG8 crccmd(void) { | 
 | fdc.s.bufsize = 0; | fdc.s.bufsize = 0; | 
 | } | } | 
 | fdc.s.bufwrite = FALSE; | fdc.s.bufwrite = FALSE; | 
 |  | fdc.s.curtime = 0; | 
 | return(stat); | return(stat); | 
 | } | } | 
 |  |  | 
| Line 181  static void bufposinc(void) { | Line 183  static void bufposinc(void) { | 
 | return; | return; | 
 | } | } | 
 | fdc.s.bufpos++; | fdc.s.bufpos++; | 
 |  | fdc.s.curtime = 0; | 
 | if (fdc.s.bufpos >= fdc.s.bufsize) { | if (fdc.s.bufpos >= fdc.s.bufsize) { | 
 | r = FALSE; | r = FALSE; | 
 | if (fdc.s.type == 2) { | if (fdc.s.type == 2) { | 
| Line 208  static void bufposinc(void) { | Line 211  static void bufposinc(void) { | 
 | } | } | 
 | } | } | 
 | if (!r) { | if (!r) { | 
 | dma.DMA_REDY = 8; |  | 
 | fdc.s.bufdir = FDCDIR_NONE; | fdc.s.bufdir = FDCDIR_NONE; | 
 |  | dmac_sendready(FALSE); | 
 | } | } | 
 | } | } | 
 | } | } | 
| Line 221  void IOOUTCALL fdc_o(UINT port, REG8 val | Line 224  void IOOUTCALL fdc_o(UINT port, REG8 val | 
 | if ((port & (~7)) != 0x0ff8) { | if ((port & (~7)) != 0x0ff8) { | 
 | return; | return; | 
 | } | } | 
| TRACEOUT(("fdc %.4x,%.2x [%.4x]", port, value, Z80_PC)); | //      TRACEOUT(("fdc %.4x,%.2x [%.4x]", port, value, Z80_PC)); | 
 | switch(port & 7) { | switch(port & 7) { | 
 | case 0:                                                                 // コマンド | case 0:                                                                 // コマンド | 
 | fdc.s.cmd = value; | fdc.s.cmd = value; | 
| Line 232  void IOOUTCALL fdc_o(UINT port, REG8 val | Line 235  void IOOUTCALL fdc_o(UINT port, REG8 val | 
 | fdc.s.stat = type2flash(); | fdc.s.stat = type2flash(); | 
 | } | } | 
 | fdc.s.bufdir = FDCDIR_NONE; | fdc.s.bufdir = FDCDIR_NONE; | 
 |  | // マリオは コマンド発行後にbusyを見張る | 
 |  | // 逆にソーサリアンとかは busyだとエラーになる… | 
 |  | // 条件は何? | 
 | setbusy(20); | setbusy(20); | 
 | switch(cmd) { | switch(cmd) { | 
 | case 0x00:                                                              // リストア | case 0x00:                                                              // リストア | 
| if (value & 8) {                                        // LAYDOCK | //      if (value & 8) {                                        // LAYDOCK | 
| setbusy(0); | //              setbusy(0); | 
| } | //      } | 
 | fdc.s.motor = 0x80;                                     // モーターOn? | fdc.s.motor = 0x80;                                     // モーターOn? | 
 | fdc.s.c = 0; | fdc.s.c = 0; | 
 | fdc.s.step = 1; | fdc.s.step = 1; | 
| Line 301  void IOOUTCALL fdc_o(UINT port, REG8 val | Line 307  void IOOUTCALL fdc_o(UINT port, REG8 val | 
 | case 0x0d:                                                              // フォースインタラプト | case 0x0d:                                                              // フォースインタラプト | 
 | setbusy(0);                                                     // 必要ない? | setbusy(0);                                                     // 必要ない? | 
 | //                                      fdc.s.skip = 0;                                         // 000330 | //                                      fdc.s.skip = 0;                                         // 000330 | 
| dma.DMA_REDY = 8;                                       // ver0.25 | dmac_sendready(FALSE); | 
 | break; | break; | 
 |  |  | 
 | case 0x0e:                                                              // リードトラック | case 0x0e:                                                              // リードトラック | 
| Line 377  REG8 IOINPCALL fdc_i(UINT port) { | Line 383  REG8 IOINPCALL fdc_i(UINT port) { | 
 | if (ret) { | if (ret) { | 
 | return(ret); | return(ret); | 
 | } | } | 
| #if 0 | #if 1 | 
| if (fdc.s.type == 2) { | if (fdc.s.bufdir) {                                     // YsII | 
| if (last_r == _fdc.r && last_off == fdc.off && | fdc.s.curtime++; | 
| !(--timeoutwait)) { | if (fdc.s.curtime >= 8) { | 
| inc_off(); | fdc.s.stat |= 0x04; | 
| timeoutwait = 4; | bufposinc(); | 
 | } | } | 
| last_r = _fdc.r; | } | 
| last_off = fdc.off; |  | 
| }                                                       // Read Write時のみの変化でいい筈 |  | 
 | #endif | #endif | 
 | ret = getstat(); | ret = getstat(); | 
 | if (!(ret & 0x02)) { | if (!(ret & 0x02)) { | 
| dma.DMA_REDY = 8; | dmac_sendready(FALSE); | 
 | } | } | 
 | return(ret); | return(ret); | 
 |  |  |