Previous 199869 Revisions Next

r18830 Saturday 3rd November, 2012 at 09:30:05 UTC by O. Galibert
(mess) upd765: Try yet another hypothesis on the IRQ behaviour [O. Galibert]
[src/mess/machine]upd765.c upd765.h

trunk/src/mess/machine/upd765.c
r18829r18830
148148   for(int i=0; i<4; i++) {
149149      flopi[i].main_state = IDLE;
150150      flopi[i].sub_state = IDLE;
151      flopi[i].irq_seek = false;
152151      flopi[i].live = false;
153152      flopi[i].ready = !ready_polled;
154      flopi[i].irq_polled = false;
153      flopi[i].irq = floppy_info::IRQ_NONE;
155154   }
156155   data_irq = false;
156   polled_irq = false;
157157   internal_drq = false;
158158   fifo_pos = 0;
159159   command_pos = 0;
r18829r18830
10971097      main_phase = PHASE_RESULT;
10981098
10991099      int fid;
1100      for(fid=0; fid<4 && !flopi[fid].irq_seek; fid++);
1101      if(fid == 4)
1102         for(fid=0; fid<4 && !flopi[fid].irq_polled; fid++);
1100      for(fid=0; fid<4 && flopi[fid].irq == floppy_info::IRQ_NONE; fid++);
11031101      if(fid == 4) {
11041102         st0 = ST0_UNK;
11051103         result[0] = st0;
r18829r18830
11091107         break;
11101108      }
11111109      floppy_info &fi = flopi[fid];
1112      if(fi.irq_seek)
1113         fi.irq_seek = false;
1114
1115      else if(fi.irq_polled) {
1110      if(fi.irq == floppy_info::IRQ_POLLED) {
11161111         // Documentation is somewhat contradictory w.r.t polling
11171112         // and irq.  PC bios, especially 5150, requires that only
11181113         // one irq happens.  That's also wait the ns82077a doc
11191114         // says it does.  OTOH, a number of docs says you need to
11201115         // call SIS 4 times, once per drive...
11211116         //
1122         // Let's take the option that allows PC to boot.
1117         // There's also the interaction with the seek irq.  The
1118         // somewhat borderline tf20 code seems to think that
1119         // essentially ignoring the polling irq should work.
1120         //
1121         // So at that point the best bet seems to drop the
1122         // "polled" irq as soon as a SIS happens, and override any
1123         // polled-in-waiting information when a seek irq happens
1124         // for a given floppy.
11231125
1124         for(int i=0; i<4; i++)
1125            flopi[i].irq_polled = false;
1126
11271126         st0 = ST0_ABRT | fid;
1128      } else {
1129         abort();
11301127      }
1128      fi.irq = floppy_info::IRQ_NONE;
1129
1130      polled_irq = false;
1131
11311132      result[0] = st0;
11321133      result[1] = fi.pcn;
11331134      logerror("%s: command sense interrupt status (fid=%d %02x %02x)\n", tag(), fid, result[0], result[1]);
r18829r18830
11651166   if(data_completion)
11661167      data_irq = true;
11671168   else
1168      fi.irq_seek = true;
1169      fi.irq = floppy_info::IRQ_SEEK;
11691170   check_irq();
11701171}
11711172
r18829r18830
17851786void upd765_family_device::check_irq()
17861787{
17871788   bool old_irq = cur_irq;
1788   cur_irq = data_irq || internal_drq;
1789   cur_irq = data_irq || polled_irq || internal_drq;
17891790   for(int i=0; i<4; i++)
1790      cur_irq = cur_irq || flopi[i].irq_seek || flopi[i].irq_polled;
1791      cur_irq = cur_irq || flopi[i].irq == floppy_info::IRQ_SEEK;
17911792   cur_irq = cur_irq && (dor & 4) && (dor & 8);
17921793   if(cur_irq != old_irq && !intrq_cb.isnull()) {
17931794      logerror("%s: irq = %d\n", tag(), cur_irq);
r18829r18830
18511852      if(ready != flopi[fid].ready) {
18521853         logerror("%s: polled %d : %d -> %d\n", tag(), fid, flopi[fid].ready, ready);
18531854         flopi[fid].ready = ready;
1854         flopi[fid].irq_polled = true;
1855         changed = true;
1855         if(flopi[fid].irq == floppy_info::IRQ_NONE) {
1856            flopi[fid].irq = floppy_info::IRQ_POLLED;
1857            polled_irq = true;
1858            changed = true;
1859         }
18561860      }
18571861   }
18581862   if(changed)
trunk/src/mess/machine/upd765.h
r18829r18830
249249   };
250250
251251   struct floppy_info {
252      enum { IRQ_NONE, IRQ_SEEK, IRQ_POLLED };
252253      emu_timer *tm;
253254      floppy_image_device *dev;
254255      int id;
255256      int main_state, sub_state;
256257      int dir, counter;
257258      UINT8 pcn;
258      bool irq_seek, live, index, ready, irq_polled;
259      int irq;
260      bool live, index, ready;
259261   };
260262
261263   struct live_info {
r18829r18830
284286
285287   live_info cur_live, checkpoint_live;
286288   line_cb intrq_cb, drq_cb;
287   bool cur_irq, data_irq, drq, internal_drq, tc, tc_done, locked;
289   bool cur_irq, polled_irq, data_irq, drq, internal_drq, tc, tc_done, locked;
288290   floppy_info flopi[4];
289291
290292   int fifo_pos, fifo_expected, command_pos, result_pos;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team