Previous 199869 Revisions Next

r30684 Tuesday 27th May, 2014 at 02:45:11 UTC by R. Belmont
ncr539x: fix FIFO read/writing to work as expected. (nw)
[src/emu/machine]ncr539x.c ncr539x.h

trunk/src/emu/machine/ncr539x.c
r30683r30684
5757   "Command",              // 3
5858   "Status",               // 4
5959   "Interrupt Status",     // 5
60   "Internal State",
61   "Current FIFO/Internal State",
62   "Control Register 1",
60   "Internal State",      // 6
61   "Current FIFO/Internal State",   // 7
62   "Control Register 1",   // 8
6363   "0x9",
6464   "0xA",
6565   "Control Register 2",
r30683r30684
143143void ncr539x_device::device_reset()
144144{
145145   m_fifo_ptr = 0;
146   m_fifo_read_ptr = 0;
146147   m_irq_status = 0;
147148   m_status = SCSI_PHASE_STATUS;
148149   m_internal_state = 0;
r30683r30684
318319            }
319320            else
320321            {
321               rv = m_fifo[m_fifo_ptr++];
322               rv = m_fifo[m_fifo_read_ptr++];
323               m_fifo_read_ptr &= (m_fifo_size-1);
322324
323325               fifo_bytes--;
324326               m_xfer_count--;
325327               update_fifo_internal_state(fifo_bytes);
326328
327329               #if VERBOSE
328               printf("Read %02x from FIFO[%d], FIFO now contains %d bytes (PC=%x, m_buffer_remaining %x)\n", rv, m_fifo_ptr-1, fifo_bytes, space.device().safe_pc(), m_buffer_remaining);
330               printf("Read %02x from FIFO[%d], FIFO now contains %d bytes (PC=%x, m_buffer_remaining %x)\n", rv, m_fifo_read_ptr-1, fifo_bytes, space.device().safe_pc(), m_buffer_remaining);
329331               #endif
330332
331333               if (fifo_bytes == 0)
r30683r30684
432434WRITE8_MEMBER( ncr539x_device::write )
433435{
434436   #if VERBOSE
435   if (offset != 2) printf("539x: Write %02x @ %s (%02x) (PC=%x)\n", data, wrregs[offset], offset, space.device().safe_pc());
437   //if (offset != 2)
438   printf("539x: Write %02x @ %s (%02x) (PC=%x)\n", data, wrregs[offset], offset, space.device().safe_pc());
436439   #endif
437440
438441   switch (offset)
r30683r30684
757760      printf("539x: Write %02x @ FIFO[%x]\n", data, m_fifo_ptr);
758761      #endif
759762      m_fifo[m_fifo_ptr++] = data;
763      update_fifo_internal_state(m_fifo_ptr);
760764
761765      if (m_selected)
762766      {
trunk/src/emu/machine/ncr539x.h
r30683r30684
6565   bool m_chipid_available, m_chipid_lock;
6666
6767   static const int m_fifo_size = 16;
68   UINT8 m_fifo_ptr, m_fifo[m_fifo_size];
68   UINT8 m_fifo_ptr, m_fifo_read_ptr, m_fifo[m_fifo_size];
6969
7070   //int m_xfer_remaining;   // amount in the FIFO when we're in data in phase
7171

Previous 199869 Revisions Next


© 1997-2024 The MAME Team