Previous 199869 Revisions Next

r29634 Monday 14th April, 2014 at 11:58:33 UTC by Alex Jackson
Sync with trunk (nw)
[/branches/old_menus/src/emu]emu.mak
[/branches/old_menus/src/emu/bus]bus.mak
[/branches/old_menus/src/emu/bus/a2bus]a2hsscsi.c a2scsi.c
[/branches/old_menus/src/emu/bus/abcbus]hdc.c hdc.h lux21056.c lux21056.h lux4105.c lux4105.h
[/branches/old_menus/src/emu/bus/cbmiec]cmdhd.c cmdhd.h
[/branches/old_menus/src/emu/bus/econet]e01.c e01.h
[/branches/old_menus/src/emu/bus/ieee488]d9060.c d9060.h
[/branches/old_menus/src/emu/bus/rs232]keyboard.c keyboard.h
[/branches/old_menus/src/emu/bus/scsi]acb4070.c acb4070.h cdu76s.c* cdu76s.h* d9060hd.c d9060hd.h s1410.c s1410.h sa1403d.h scsi.c* scsi.h* scsicd.c* scsicd.h* scsihd.c* scsihd.h* scsihle.c* scsihle.h*
[/branches/old_menus/src/emu/bus/ti99_peb]bwg.c hfdc.c
[/branches/old_menus/src/emu/bus/wangpc]wdc.c
[/branches/old_menus/src/emu/bus/x68k]x68k_scsiext.c
[/branches/old_menus/src/emu/machine]53c810.c 53c810.h adc083x.c adc083x.h adc1213x.c adc1213x.h am53cf96.c am53cf96.h atapihle.h cdu76s.c cdu76s.h legscsi.c* legscsi.h* machine.mak mb89352.c mb89352.h mc68681.c mc68681.h mm58274c.c mm58274c.h ncr5380.c ncr5380.h ncr539x.c ncr539x.h scsibus.c scsibus.h scsicb.c scsicb.h scsicd.c scsicd.h scsidev.c scsidev.h scsihd.c scsihd.h scsihle.c scsihle.h smc92x4.c smc92x4.h wd33c93.c wd33c93.h
[/branches/old_menus/src/emu/netlist]nl_base.c nl_base.h nl_lists.h nl_setup.c
[/branches/old_menus/src/emu/netlist/analog]nld_solver.c
[/branches/old_menus/src/mame]mame.lst mame.mak
[/branches/old_menus/src/mame/drivers]cps1.c cps3.c hornet.c konamigq.c konamigv.c konamigx.c ksys573.c model2.c model3.c namcona1.c nwk-tr.c twinkle.c zr107.c
[/branches/old_menus/src/mame/includes]konamigx.h model2.h model3.h
[/branches/old_menus/src/mame/machine]k573cass.h model3.c
[/branches/old_menus/src/mame/video]cps1.c model3.c
[/branches/old_menus/src/mess]mess.mak
[/branches/old_menus/src/mess/drivers]amust.c apple2.c apple2gs.c bebox.c bullet.c compis.c concept.c fmtowns.c geneve.c hunter2.c ip20.c ip22.c mac.c pc9801.c rmnimbus.c v1050.c v6809.c wicat.c x68k.c xerox820.c
[/branches/old_menus/src/mess/includes]apple2.h bebox.h bullet.h mac.h rmnimbus.h v1050.h xerox820.h
[/branches/old_menus/src/mess/machine]apple2.c apple2gs.c fm_scsi.c fm_scsi.h rmnimbus.c
[/branches/old_menus/src/osd/sdl]draw13.c

branches/old_menus/src/osd/sdl/draw13.c
r29633r29634
354354   else
355355   {
356356      SDL_SetTextureColorMod(texture_id, 0xFF, 0xFF, 0xFF);
357      SDL_SetTextureAlphaMod(texture_id, 0xFF);
357      SDL_SetTextureAlphaMod(texture_id, 0x00);
358358   }
359359}
360360
branches/old_menus/src/emu/netlist/nl_setup.c
r29633r29634
402402#if 1
403403      /* connect all existing terminals to new net */
404404
405      netlist_core_terminal_t *p = out.net().m_list.first();
406      while (p != NULL)
405      for (int i = 0; i < out.net().m_core_terms.count(); i++)
407406      {
408         netlist_core_terminal_t *np = out.net().m_list.next(p);
407           netlist_core_terminal_t *p = out.net().m_core_terms[i];
409408         p->clear_net(); // de-link from all nets ...
410409         connect(proxy->out(), *p);
411         p = np;
412410      }
413      out.net().m_list.clear(); // clear the list
411      out.net().m_core_terms.clear(); // clear the list
414412      out.net().m_num_cons = 0;
415413#endif
416414      out.net().register_con(proxy->m_I);
r29633r29634
620618
621619   for (netlist_net_t *const *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
622620   {
623      if ((*pn)->m_list.is_empty())
621      if ((*pn)->m_core_terms.is_empty())
624622      {
625623         todelete.add(*pn);
626624      }
627625      else
628626      {
627#if 0
629628         for (netlist_core_terminal_t *p = (*pn)->m_list.first(); p != NULL; p = (*pn)->m_list.next(p))
630629            (*pn)->m_registered.add(p);
630#else
631         (*pn)->rebuild_list();
632#endif
631633      }
632634   }
633635
branches/old_menus/src/emu/netlist/nl_lists.h
r29633r29634
4242
4343   ATTR_COLD netlist_list_t &operator=(const netlist_list_t &rhs)
4444   {
45      this->reset();
45      this->clear();
4646      for (int i=0; i<rhs.count(); i++)
4747      {
4848         this->add(rhs[i]);
r29633r29634
129129   ATTR_HOT inline const _ListClass *next(const _ListClass *lc) const { return ((lc < last()) ? lc + 1 : NULL ); }
130130   ATTR_HOT inline const _ListClass *last() const { return &m_list[m_count -1]; }
131131   ATTR_HOT inline int count() const { return m_count; }
132   ATTR_HOT inline bool empty() const { return (m_count == 0); }
132   ATTR_HOT inline bool is_empty() const { return (m_count == 0); }
133133   ATTR_HOT inline void clear() { m_count = 0; }
134134   ATTR_HOT inline int capacity() const { return m_num_elements; }
135135
branches/old_menus/src/emu/netlist/nl_base.c
r29633r29634
496496
497497   if (USE_ADD_REMOVE_LIST)
498498   {
499      m_list.insert(term);
499      m_list_active.insert(term);
500500      //m_list.add(term);
501501   }
502502
r29633r29634
534534
535535   if (USE_ADD_REMOVE_LIST)
536536   {
537      m_list.remove(term);
537      m_list_active.remove(term);
538538   }
539539
540540   if (USE_DEACTIVE_DEVICE)
r29633r29634
548548{
549549   /* rebuild m_list */
550550
551   m_list.clear();
552   for (int i=0; i < m_registered.count(); i++)
553      if (m_registered[i]->state() != netlist_input_t::STATE_INP_PASSIVE)
554         m_list.add(*m_registered[i]);
551   m_list_active.clear();
552   for (int i=0; i < m_core_terms.count(); i++)
553      if (m_core_terms[i]->state() != netlist_input_t::STATE_INP_PASSIVE)
554         m_list_active.add(*m_core_terms[i]);
555555}
556556
557557ATTR_COLD void netlist_net_t::reset()
r29633r29634
568568
569569   /* rebuild m_list */
570570
571   m_list.clear();
572   for (int i=0; i < m_registered.count(); i++)
573      m_list.add(*m_registered[i]);
571   m_list_active.clear();
572   for (int i=0; i < m_core_terms.count(); i++)
573      m_list_active.add(*m_core_terms[i]);
574574
575   for (netlist_core_terminal_t *t = m_list.first(); t != NULL; t = m_list.next(t))
576   {
577      t->do_reset();
578   }
579   for (netlist_core_terminal_t *t = m_list.first(); t != NULL; t = m_list.next(t))
580   {
581      if (t->state() != netlist_input_t::STATE_INP_PASSIVE)
582         m_active++;
583   }
575    for (int i=0; i < m_core_terms.count(); i++)
576        m_core_terms[i]->do_reset();
577
578    for (int i=0; i < m_core_terms.count(); i++)
579        if (m_core_terms[i]->state() != netlist_input_t::STATE_INP_PASSIVE)
580            m_active++;
584581}
585582
586583ATTR_COLD void netlist_net_t::init_object(netlist_base_t &nl, const pstring &aname)
r29633r29634
625622   }
626623   else
627624   {
628      netlist_core_terminal_t *p = othernet->m_list.first();
629      while (p != NULL)
625       for (int i = 0; i < othernet->m_core_terms.count(); i++)
630626      {
631         netlist_core_terminal_t *pn = othernet->m_list.next(p);
627           netlist_core_terminal_t *p = othernet->m_core_terms[i];
632628         register_con(*p);
633         p = pn;
634629      }
635630
636      othernet->m_list.clear(); // FIXME: othernet needs to be free'd from memory
631      othernet->m_core_terms.clear(); // FIXME: othernet needs to be free'd from memory
637632   }
638633}
639634
r29633r29634
641636{
642637   terminal.set_net(*this);
643638
644   m_list.insert(terminal);
639   m_core_terms.add(&terminal);
645640   m_num_cons++;
646641
647642   if (terminal.state() != netlist_input_t::STATE_INP_PASSIVE)
r29633r29634
667662
668663   const UINT32 masks[4] = { 1, 5, 3, 1 };
669664   const UINT32 mask = masks[ (m_last_Q  << 1) | m_new_Q ];
670   netlist_core_terminal_t *p = m_list.first();
665   netlist_core_terminal_t *p = m_list_active.first();
671666
672667   m_in_queue = 2; /* mark as taken ... */
673668   m_cur_Q = m_new_Q;
r29633r29634
680675      {
681676      case 2:
682677         update_dev(p, mask);
683         p = m_list.next(p);
678         p = m_list_active.next(p);
684679         if (p == NULL) break;
685680      case 1:
686681         update_dev(p, mask);
r29633r29634
689684         while (p != NULL)
690685         {
691686            update_dev(p, mask);
692            p = m_list.next(p);
687            p = m_list_active.next(p);
693688         }
694689         break;
695690      }
r29633r29634
700695      {
701696      case 2:
702697         update_dev(p, mask);
703         p = m_list.next(p);
698         p = m_list_active.next(p);
704699      case 1:
705700         update_dev(p, mask);
706701         break;
r29633r29634
708703         do
709704         {
710705            update_dev(p, mask);
711            p = m_list.next(p);
706            p = m_list_active.next(p);
712707         } while (p != NULL);
713708         break;
714709      }
branches/old_menus/src/emu/netlist/nl_base.h
r29633r29634
625625
626626   ATTR_HOT void solve();
627627
628   netlist_list_t<netlist_core_terminal_t *> m_registered; // save post-start m_list ...
629   plinked_list<netlist_core_terminal_t> m_list;
628   netlist_list_t<netlist_core_terminal_t *> m_core_terms; // save post-start m_list ...
629   plinked_list<netlist_core_terminal_t> m_list_active;
630630
631631   ATTR_COLD void rebuild_list();     /* rebuild m_list after a load */
632632
branches/old_menus/src/emu/netlist/analog/nld_solver.c
r29633r29634
3232
3333      (*pn)->m_solver = this;
3434
35      for (netlist_core_terminal_t *p = (*pn)->m_list.first(); p != NULL; p = (*pn)->m_list.next(p))
35        for (int i = 0; i < (*pn)->m_core_terms.count(); i++)
3636      {
37          netlist_core_terminal_t *p = (*pn)->m_core_terms[i];
3738         NL_VERBOSE_OUT(("%s %s %d\n", p->name().cstr(), (*pn)->name().cstr(), (int) (*pn)->isRailNet()));
3839         switch (p->type())
3940         {
r29633r29634
8990   }
9091   for (netlist_core_terminal_t * const *p = m_inps.first(); p != NULL; p = m_inps.next(p))
9192   {
92      (*p)->net().m_last_Analog = (*p)->net().m_cur_Analog;
93        if ((*p)->net().m_last_Analog != (*p)->net().m_cur_Analog)
94            (*p)->net().m_last_Analog = (*p)->net().m_cur_Analog;
9395   }
9496
9597}
r29633r29634
625627
626628ATTR_COLD static void process_net(net_groups_t groups, int &cur_group, netlist_net_t *net)
627629{
628   if (net->m_list.is_empty())
630   if (net->m_core_terms.is_empty())
629631      return;
630632   /* add the net */
631633   SOLVER_VERBOSE_OUT(("add %d - %s\n", cur_group, net->name().cstr()));
632634   groups[cur_group].add(net);
633   for (netlist_core_terminal_t *p = net->m_list.first(); p != NULL; p = net->m_list.next(p))
635   for (int i = 0; i < net->m_core_terms.count(); i++)
634636   {
635      SOLVER_VERBOSE_OUT(("terminal %s\n", p->name().cstr()));
637       netlist_core_terminal_t *p = net->m_core_terms[i];
638       SOLVER_VERBOSE_OUT(("terminal %s\n", p->name().cstr()));
636639      if (p->isType(netlist_terminal_t::TERMINAL))
637640      {
638641         SOLVER_VERBOSE_OUT(("isterminal\n"));
r29633r29634
853856      {
854857         SOLVER_VERBOSE_OUT(("Net %d: %s\n", j, groups[i][j]->name().cstr()));
855858         netlist_net_t *n = groups[i][j];
856         for (netlist_core_terminal_t *p = n->m_list.first(); p != NULL; p = n->m_list.next(p))
859         for (int k = 0; k < n->m_core_terms.count(); k++)
857860         {
861             ATTR_UNUSED netlist_core_terminal_t *p = n->m_core_terms[k];
858862            SOLVER_VERBOSE_OUT(("   %s\n", p->name().cstr()));
859863         }
860864      }
branches/old_menus/src/emu/bus/econet/e01.h
r29633r29634
1414#ifndef __E01__
1515#define __E01__
1616
17#include "emu.h"
1817#include "econet.h"
18#include "bus/centronics/ctronics.h"
19#include "bus/scsi/scsi.h"
1920#include "cpu/m6502/m65c02.h"
2021#include "machine/6522via.h"
21#include "bus/centronics/ctronics.h"
22#include "machine/buffer.h"
23#include "machine/latch.h"
2224#include "machine/mc146818.h"
2325#include "machine/mc6854.h"
2426#include "machine/ram.h"
25#include "machine/scsicb.h"
2627#include "machine/wd_fdc.h"
2728
2829class e01_device : public device_t,
r29633r29634
8687   required_device<mc6854_device> m_adlc;
8788   required_device<mc146818_device> m_rtc;
8889   required_device<ram_device> m_ram;
89   required_device<scsicb_device> m_scsibus;
90   required_device<SCSI_PORT_DEVICE> m_scsibus;
91   required_device<output_latch_device> m_scsi_data_out;
92   required_device<input_buffer_device> m_scsi_data_in;
93   required_device<input_buffer_device> m_scsi_ctrl_in;
9094   required_device<floppy_connector> m_floppy0;
9195   required_device<floppy_connector> m_floppy1;
9296   required_memory_region m_rom;
branches/old_menus/src/emu/bus/econet/e01.c
r29633r29634
5555*/
5656
5757#include "e01.h"
58#include "machine/scsibus.h"
59#include "machine/scsicb.h"
60#include "machine/scsihd.h"
58#include "bus/scsi/scsihd.h"
6159
6260
6361
r29633r29634
206204
207205WRITE_LINE_MEMBER( e01_device::scsi_bsy_w )
208206{
207   m_scsi_ctrl_in->write_bit1(state);
208
209209   if (state)
210210   {
211      m_scsibus->scsi_sel_w(0);
211      m_scsibus->write_sel(0);
212212   }
213213}
214214
215215WRITE_LINE_MEMBER( e01_device::scsi_req_w )
216216{
217   m_scsi_ctrl_in->write_bit5(state);
218
217219   if (!state)
218220   {
219      m_scsibus->scsi_ack_w(0);
221      m_scsibus->write_ack(0);
220222   }
221223
222224   m_hdc_irq = !state;
r29633r29634
240242   AM_RANGE(0xfc28, 0xfc28) AM_MIRROR(0x00c3) AM_READWRITE(network_irq_enable_r, network_irq_enable_w)
241243   AM_RANGE(0xfc2c, 0xfc2c) AM_MIRROR(0x00c3) AM_READ_PORT("FLAP")
242244   AM_RANGE(0xfc30, 0xfc30) AM_MIRROR(0x00c0) AM_READWRITE(hdc_data_r, hdc_data_w)
243   AM_RANGE(0xfc31, 0xfc31) AM_MIRROR(0x00c0) AM_READ(hdc_status_r)
245   AM_RANGE(0xfc31, 0xfc31) AM_MIRROR(0x00c0) AM_DEVREAD("scsi_ctrl_in", input_buffer_device, read)
244246   AM_RANGE(0xfc32, 0xfc32) AM_MIRROR(0x00c0) AM_WRITE(hdc_select_w)
245247   AM_RANGE(0xfc33, 0xfc33) AM_MIRROR(0x00c0) AM_WRITE(hdc_irq_enable_w)
246248ADDRESS_MAP_END
r29633r29634
275277
276278   MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG)
277279
278   MCFG_SCSIBUS_ADD(SCSIBUS_TAG)
279   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":harddisk0", SCSIHD, SCSI_ID_0)
280   MCFG_SCSICB_ADD(SCSIBUS_TAG ":host")
281   MCFG_SCSICB_BSY_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, e01_device, scsi_bsy_w))
282   MCFG_SCSICB_REQ_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, e01_device, scsi_req_w))
280   MCFG_DEVICE_ADD(SCSIBUS_TAG, SCSI_PORT, 0)
281   MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in")
282   MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit0))
283   MCFG_SCSI_BSY_HANDLER(WRITELINE(e01_device, scsi_bsy_w)) // bit1
284   // bit 2 0
285   // bit 3 0
286   // bit 4 NIRQ
287   MCFG_SCSI_REQ_HANDLER(WRITELINE(e01_device, scsi_req_w)) // bit5
288   MCFG_SCSI_IO_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit6))
289   MCFG_SCSI_CD_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit7))
290   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
283291
292   MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SCSIBUS_TAG)
293   MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0)
294   MCFG_DEVICE_ADD("scsi_ctrl_in", INPUT_BUFFER, 0)
295
284296   // internal ram
285297   MCFG_RAM_ADD(RAM_TAG)
286298   MCFG_RAM_DEFAULT_SIZE("64K")
r29633r29634
384396      m_adlc(*this, MC6854_TAG),
385397      m_rtc(*this, HD146818_TAG),
386398      m_ram(*this, RAM_TAG),
387      m_scsibus(*this, SCSIBUS_TAG ":host"),
399      m_scsibus(*this, SCSIBUS_TAG),
400      m_scsi_data_out(*this, "scsi_data_out"),
401      m_scsi_data_in(*this, "scsi_data_in"),
402      m_scsi_ctrl_in(*this, "scsi_ctrl_in"),
388403      m_floppy0(*this, WD2793_TAG":0"),
389404      m_floppy1(*this, WD2793_TAG":1"),
390405      m_rom(*this, R65C102_TAG),
r29633r29634
410425      m_adlc(*this, MC6854_TAG),
411426      m_rtc(*this, HD146818_TAG),
412427      m_ram(*this, RAM_TAG),
413      m_scsibus(*this, SCSIBUS_TAG ":host"),
428      m_scsibus(*this, SCSIBUS_TAG),
429      m_scsi_data_out(*this, "scsi_data_out"),
430      m_scsi_data_in(*this, "scsi_data_in"),
431      m_scsi_ctrl_in(*this, "scsi_ctrl_in"),
414432      m_floppy0(*this, WD2793_TAG":0"),
415433      m_floppy1(*this, WD2793_TAG":1"),
416434      m_rom(*this, R65C102_TAG),
r29633r29634
613631
614632READ8_MEMBER( e01_device::hdc_data_r )
615633{
616   UINT8 data = m_scsibus->scsi_data_r(space, 0);
634   UINT8 data = m_scsi_data_in->read();
617635
618   m_scsibus->scsi_ack_w(1);
636   m_scsibus->write_ack(1);
619637
620638   return data;
621639}
r29633r29634
627645
628646WRITE8_MEMBER( e01_device::hdc_data_w )
629647{
630   m_scsibus->scsi_data_w(space, 0, data);
648   m_scsi_data_out->write(data);
631649
632   m_scsibus->scsi_ack_w(1);
650   m_scsibus->write_ack(1);
633651}
634652
635653
636654//-------------------------------------------------
637//  hdc_status_r -
638//-------------------------------------------------
639
640READ8_MEMBER( e01_device::hdc_status_r )
641{
642   /*
643
644       bit     description
645
646       0       MSG
647       1       BSY
648       2       0
649       3       0
650       4       NIRQ
651       5       REQ
652       6       I/O
653       7       C/D
654
655   */
656
657   UINT8 data = 0;
658
659   // SCSI bus
660   data |= m_scsibus->scsi_msg_r();
661   data |= m_scsibus->scsi_bsy_r() << 1;
662   data |= m_scsibus->scsi_req_r() << 5;
663   data |= m_scsibus->scsi_io_r() << 6;
664   data |= m_scsibus->scsi_cd_r() << 7;
665
666   // TODO NIRQ
667
668   return data;
669}
670
671
672//-------------------------------------------------
673655//  hdc_select_w -
674656//-------------------------------------------------
675657
676658WRITE8_MEMBER( e01_device::hdc_select_w )
677659{
678   m_scsibus->scsi_sel_w(1);
660   m_scsibus->write_sel(1);
679661}
680662
681663
branches/old_menus/src/emu/bus/wangpc/wdc.c
r29633r29634
1010**********************************************************************/
1111
1212#include "wdc.h"
13#include "machine/scsihd.h"
13#include "bus/scsi/scsihd.h"
1414
1515
1616
branches/old_menus/src/emu/bus/bus.mak
r29633r29634
10301030
10311031#-------------------------------------------------
10321032#
1033#@src/emu/bus/scsi/???.h,BUSES += SCSI
1033#@src/emu/bus/scsi/scsi.h,BUSES += SCSI
10341034#-------------------------------------------------
10351035ifneq ($(filter SCSI,$(BUSES)),)
10361036OBJDIRS += $(BUSOBJ)/scsi
1037BUSOBJS += $(BUSOBJ)/scsi/scsi.o
1038BUSOBJS += $(BUSOBJ)/scsi/scsicd.o
1039BUSOBJS += $(BUSOBJ)/scsi/scsihd.o
1040BUSOBJS += $(BUSOBJ)/scsi/scsihle.o
1041BUSOBJS += $(BUSOBJ)/scsi/cdu76s.o
10371042BUSOBJS += $(BUSOBJ)/scsi/acb4070.o
10381043BUSOBJS += $(BUSOBJ)/scsi/d9060hd.o
10391044BUSOBJS += $(BUSOBJ)/scsi/sa1403d.o
branches/old_menus/src/emu/bus/scsi/scsihle.c
r0r29634
1// license:MAME
2// copyright-holders:smf
3/*
4
5scsihle.c
6
7Base class for HLE'd SCSI devices.
8
9*/
10
11#include "scsihle.h"
12
13scsihle_device::scsihle_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
14   device_t(mconfig, type, name, tag, owner, clock, shortname, source),
15   scsi_port_interface(mconfig, *this),
16   m_scsi_id(*this, "SCSI_ID"),
17   m_input_data(0)
18{
19}
20
21static INPUT_PORTS_START(scsihle)
22   PORT_START("SCSI_ID")
23   PORT_CONFNAME(0x07, 0x07, "SCSI ID")
24   PORT_CONFSETTING( 0x00, "0")
25   PORT_CONFSETTING( 0x01, "1")
26   PORT_CONFSETTING( 0x02, "2")
27   PORT_CONFSETTING( 0x03, "3")
28   PORT_CONFSETTING( 0x04, "4")
29   PORT_CONFSETTING( 0x05, "5")
30   PORT_CONFSETTING( 0x06, "6")
31   PORT_CONFSETTING( 0x07, "7")
32INPUT_PORTS_END
33
34DEVICE_INPUT_DEFAULTS_START( SCSI_ID_0 )
35   DEVICE_INPUT_DEFAULTS( "SCSI_ID", 7, 0 )
36DEVICE_INPUT_DEFAULTS_END
37
38DEVICE_INPUT_DEFAULTS_START( SCSI_ID_1 )
39   DEVICE_INPUT_DEFAULTS( "SCSI_ID", 7, 1 )
40DEVICE_INPUT_DEFAULTS_END
41
42DEVICE_INPUT_DEFAULTS_START( SCSI_ID_2 )
43   DEVICE_INPUT_DEFAULTS( "SCSI_ID", 7, 2 )
44DEVICE_INPUT_DEFAULTS_END
45
46DEVICE_INPUT_DEFAULTS_START( SCSI_ID_3 )
47   DEVICE_INPUT_DEFAULTS( "SCSI_ID", 7, 3 )
48DEVICE_INPUT_DEFAULTS_END
49
50DEVICE_INPUT_DEFAULTS_START( SCSI_ID_4 )
51   DEVICE_INPUT_DEFAULTS( "SCSI_ID", 7, 4 )
52DEVICE_INPUT_DEFAULTS_END
53
54DEVICE_INPUT_DEFAULTS_START( SCSI_ID_5 )
55   DEVICE_INPUT_DEFAULTS( "SCSI_ID", 7, 5 )
56DEVICE_INPUT_DEFAULTS_END
57
58DEVICE_INPUT_DEFAULTS_START( SCSI_ID_6 )
59   DEVICE_INPUT_DEFAULTS( "SCSI_ID", 7, 6 )
60DEVICE_INPUT_DEFAULTS_END
61
62DEVICE_INPUT_DEFAULTS_START( SCSI_ID_7 )
63   DEVICE_INPUT_DEFAULTS( "SCSI_ID", 7, 7 )
64DEVICE_INPUT_DEFAULTS_END
65
66ioport_constructor scsihle_device::device_input_ports() const
67{
68   return INPUT_PORTS_NAME(scsihle);
69}
70
71void scsihle_device::device_start()
72{
73   t10_start(*this);
74
75   req_timer = timer_alloc(0);
76   sel_timer = timer_alloc(1);
77   dataout_timer = timer_alloc(2);
78}
79
80void scsihle_device::device_reset()
81{
82   scsiID = m_scsi_id->read();
83   t10_reset();
84}
85
86int scsihle_device::GetDeviceID()
87{
88   return scsiID;
89}
90
91#define BSY_DELAY_NS    50
92#define REQ_DELAY_NS    90
93
94static const char *const phasenames[] =
95{
96   "data out", "data in", "command", "status", "none", "none", "message out", "message in", "bus free","select"
97};
98
99// scsihle
100#define SCSI_CMD_BUFFER_WRITE ( 0x3b )
101#define SCSI_CMD_BUFFER_READ ( 0x3c )
102
103// scsihd
104#define SCSI_CMD_FORMAT_UNIT        0x04
105#define SCSI_CMD_SEARCH_DATA_EQUAL  0x31
106#define SCSI_CMD_READ_DEFECT        0x37
107
108
109#define IS_COMMAND(cmd)             (command[0]==cmd)
110
111#define FORMAT_UNIT_TIMEOUT         5
112
113/*
114    LOGLEVEL
115        0   no logging,
116        1   just commands
117        2   1 + data
118        3   2 + line changes
119*/
120
121#define LOGLEVEL            0
122
123#define LOG(level, ...)     if(LOGLEVEL>=level) logerror(__VA_ARGS__)
124
125void scsihle_device::data_out(UINT8 data)
126{
127//   printf( "%s data out %02x\n", tag(), data );
128   output_data0(BIT(data, 0));
129   output_data1(BIT(data, 1));
130   output_data2(BIT(data, 2));
131   output_data3(BIT(data, 3));
132   output_data4(BIT(data, 4));
133   output_data5(BIT(data, 5));
134   output_data6(BIT(data, 6));
135   output_data7(BIT(data, 7));
136}
137
138void scsihle_device::scsi_out_req_delay(UINT8 state)
139{
140   req_timer->adjust(attotime::from_nsec(REQ_DELAY_NS),state);
141}
142
143void scsihle_device::dump_bytes(UINT8 *buff, int count)
144{
145   int byteno;
146
147   for(byteno=0; byteno<count; byteno++)
148   {
149      logerror("%02X ",buff[byteno]);
150   }
151}
152
153void scsihle_device::dump_command_bytes()
154{
155   logerror("sending command 0x%02X to ScsiID %d\n",command[0],scsiID);
156   dump_bytes(command,cmd_idx);
157   logerror("\n\n");
158}
159
160void scsihle_device::dump_data_bytes(int count)
161{
162   logerror("Data buffer[0..%d]\n",count);
163   dump_bytes(buffer,count);
164   logerror("\n\n");
165}
166
167void scsihle_device::scsibus_read_data()
168{
169   data_last = (bytes_left >= m_sector_bytes) ? m_sector_bytes : bytes_left;
170
171   LOG(2,"SCSIBUS:scsibus_read_data bytes_left=%04X, data_last=%04X\n",bytes_left,data_last);
172
173   data_idx=0;
174
175   if (data_last > 0)
176   {
177      ReadData(buffer, data_last);
178      bytes_left-=data_last;
179
180      data_out(buffer[ data_idx++ ]);
181   }
182}
183
184void scsihle_device::scsibus_write_data()
185{
186   if (data_last > 0)
187   {
188      WriteData(buffer, data_last);
189      bytes_left -= data_last;
190   }
191
192   data_idx=0;
193}
194
195void scsihle_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
196{
197   switch (tid)
198   {
199   case 0:
200      output_req(param);
201      break;
202
203   case 1:
204      output_bsy(param);
205      break;
206
207   case 2:
208      // Some drives, notably the ST225N and ST125N, accept fromat unit commands
209      // with flags set indicating that bad block data should be transfered but
210      // don't then implemnt a data in phase, this timeout it to catch these !
211      if (IS_COMMAND(SCSI_CMD_FORMAT_UNIT) && (data_idx==0))
212      {
213         scsi_change_phase(SCSI_PHASE_STATUS);
214      }
215      break;
216   }
217}
218
219void scsihle_device::scsibus_exec_command()
220{
221   int command_local = 0;
222
223   if (LOGLEVEL)
224      dump_command_bytes();
225
226   //is_linked=command[cmd_idx-1] & 0x01;
227   is_linked=0;
228
229   // Check for locally executed commands, and if found execute them
230   switch (command[0])
231   {
232      // Format unit
233      case SCSI_CMD_FORMAT_UNIT:
234         LOG(1,"SCSIBUS: format unit command[1]=%02X & 0x10\n",(command[1] & 0x10));
235         command_local=1;
236         if ((command[1] & 0x10)==0x10)
237            m_phase = SCSI_PHASE_DATAOUT;
238         else
239            m_phase = SCSI_PHASE_STATUS;
240
241         m_status_code = SCSI_STATUS_CODE_GOOD;
242         bytes_left=4;
243         dataout_timer->adjust(attotime::from_seconds(FORMAT_UNIT_TIMEOUT));
244         break;
245
246      case SCSI_CMD_SEARCH_DATA_EQUAL:
247         LOG(1,"SCSIBUS: Search_data_equaln");
248         command_local=1;
249         bytes_left=0;
250         m_phase = SCSI_PHASE_STATUS;
251         m_status_code = SCSI_STATUS_CODE_GOOD;
252         break;
253
254      case SCSI_CMD_READ_DEFECT:
255         LOG(1,"SCSIBUS: read defect list\n");
256         command_local=1;
257
258         buffer[0] = 0x00;
259         buffer[1] = command[2];
260         buffer[3] = 0x00; // defect list len msb
261         buffer[4] = 0x00; // defect list len lsb
262
263         bytes_left=4;
264         m_phase = SCSI_PHASE_DATAIN;
265         m_status_code = SCSI_STATUS_CODE_GOOD;
266         break;
267
268      // write buffer
269      case SCSI_CMD_BUFFER_WRITE:
270         LOG(1,"SCSIBUS: write_buffer\n");
271         command_local=1;
272         bytes_left=(command[7]<<8)+command[8];
273         m_phase = SCSI_PHASE_DATAOUT;
274         m_status_code = SCSI_STATUS_CODE_GOOD;
275         break;
276
277      // read buffer
278      case SCSI_CMD_BUFFER_READ:
279         LOG(1,"SCSIBUS: read_buffer\n");
280         command_local=1;
281         bytes_left = (command[7]<<8) + command[8];
282         m_phase = SCSI_PHASE_DATAIN;
283         m_status_code = SCSI_STATUS_CODE_GOOD;
284         break;
285   }
286
287
288   // Check for locally executed command, if not then pass it on
289   // to the disk driver
290   if (!command_local)
291   {
292      SetCommand(command, cmd_idx);
293      ExecCommand();
294      GetLength(&bytes_left);
295      data_idx=0;
296   }
297
298   scsi_change_phase(m_phase);
299
300   LOG(1,"SCSIBUS:bytes_left=%02X data_idx=%02X\n",bytes_left,data_idx);
301
302   // This is correct as we need to read from disk for commands other than just read data
303   if ((m_phase == SCSI_PHASE_DATAIN) && (!command_local))
304      scsibus_read_data();
305}
306
307UINT8 scsihle_device::scsibus_driveno(UINT8 drivesel)
308{
309   switch (drivesel)
310   {
311      case 0x01: return 0;
312      case 0x02: return 1;
313      case 0x04: return 2;
314      case 0x08: return 3;
315      case 0x10: return 4;
316      case 0x20: return 5;
317      case 0x40: return 6;
318      case 0x80: return 7;
319      default: return 0;
320   }
321}
322
323void scsihle_device::scsi_change_phase(UINT8 newphase)
324{
325   LOG(1,"scsi_change_phase() from=%s, to=%s\n",phasenames[m_phase],phasenames[newphase]);
326
327   m_phase=newphase;
328   cmd_idx=0;
329   data_idx=0;
330
331   switch(m_phase)
332   {
333      case SCSI_PHASE_BUS_FREE:
334         output_bsy(0);
335         // sel
336         output_cd(0);
337         output_io(0);
338         output_msg(0);
339         output_req(0);
340         // ack
341         // atn
342         // rst
343         data_out(0);
344         LOG(1,"SCSIBUS: done\n\n");
345         break;
346
347      case SCSI_PHASE_COMMAND:
348         output_cd(1);
349         output_io(0);
350         output_msg(0);
351         scsi_out_req_delay(1);
352         data_out(0);
353         LOG(1,"\nSCSIBUS: Command begin\n");
354         break;
355
356      case SCSI_PHASE_DATAOUT:
357         output_cd(0);
358         output_io(0);
359         output_msg(0);
360         scsi_out_req_delay(1);
361         data_out(0);
362         break;
363
364      case SCSI_PHASE_DATAIN:
365         output_cd(0);
366         output_io(1);
367         output_msg(0);
368         scsi_out_req_delay(1);
369         break;
370
371      case SCSI_PHASE_STATUS:
372         output_cd(1);
373         output_io(1);
374         output_msg(0);
375         scsi_out_req_delay(1);
376         data_out(m_status_code);
377         break;
378
379      case SCSI_PHASE_MESSAGE_OUT:
380         output_cd(1);
381         output_io(0);
382         output_msg(1);
383         scsi_out_req_delay(1);
384         data_out(0);
385         break;
386
387      case SCSI_PHASE_MESSAGE_IN:
388         output_cd(1);
389         output_io(1);
390         output_msg(1);
391         scsi_out_req_delay(1);
392         data_out(0); // no errors for the time being !
393         break;
394   }
395}
396
397WRITE_LINE_MEMBER( scsihle_device::input_sel )
398{
399//   printf( "sel %d %d %02x\n", state, m_phase, m_input_data );
400   switch (m_phase)
401   {
402   case SCSI_PHASE_BUS_FREE:
403      // Note this assumes we only have one initiator and therefore
404      // only one line active.
405      if (scsibus_driveno(m_input_data) == scsiID)
406      {
407         void *hdfile = NULL;
408         // Check to see if device had image file mounted, if not, do not set busy,
409         // and stay busfree.
410         GetDevice(&hdfile);
411         if (hdfile != NULL)
412         {
413            if (!state)
414            {
415               scsi_change_phase(SCSI_PHASE_COMMAND);
416            }
417            else
418            {
419               sel_timer->adjust(attotime::from_nsec(BSY_DELAY_NS),1);
420            }
421         }
422      }
423      break;
424   }
425}
426
427WRITE_LINE_MEMBER( scsihle_device::input_ack )
428{
429   switch (m_phase)
430   {
431      case SCSI_PHASE_COMMAND:
432         if (!state)
433         {
434            command[ cmd_idx++ ] = m_input_data;
435
436            // If the command is ready go and execute it
437            if (cmd_idx == get_scsi_cmd_len(command[0]))
438            {
439               scsibus_exec_command();
440            }
441            else
442            {
443               scsi_out_req_delay(1);
444            }
445         }
446         else
447         {
448            scsi_out_req_delay(0);
449         }
450         break;
451
452      case SCSI_PHASE_DATAIN:
453         if (!state)
454         {
455            // check to see if we have reached the end of the block buffer
456            // and that there is more data to read from the scsi disk
457            if (data_idx == m_sector_bytes && bytes_left > 0)
458            {
459               scsibus_read_data();
460               scsi_out_req_delay(1);
461            }
462            else if (data_idx == data_last && bytes_left == 0)
463            {
464               scsi_change_phase(SCSI_PHASE_STATUS);
465            }
466            else
467            {
468               data_out(buffer[data_idx++]);
469               scsi_out_req_delay(1);
470            }
471         }
472         else
473         {
474            scsi_out_req_delay(0);
475         }
476         break;
477
478      case SCSI_PHASE_DATAOUT:
479         if (!state)
480         {
481            //LOG(1,"SCSIBUS:bytes_left=%02X data_idx=%02X\n",bytes_left,data_idx);
482            buffer[data_idx++] = m_input_data;
483
484            if (IS_COMMAND(SCSI_CMD_FORMAT_UNIT))
485            {
486               // If we have the first byte, then cancel the dataout timout
487               if (data_idx == 1)
488                  dataout_timer->adjust(attotime::never);
489
490               // When we have the first 3 bytes, calculate how many more are in the
491               // bad block list.
492               if (data_idx == 3)
493               {
494                  bytes_left += ((buffer[2]<<8) + buffer[3]);
495                  LOG(1, "format_unit reading an extra %d bytes\n", bytes_left - 4);
496                  dump_data_bytes(4);
497               }
498            }
499
500            // If the data buffer is full flush it to the SCSI disk
501
502            data_last = (bytes_left >= m_sector_bytes) ? m_sector_bytes : bytes_left;
503
504            if (data_idx == data_last)
505               scsibus_write_data();
506
507            if (data_idx == 0 && bytes_left == 0)
508            {
509               scsi_change_phase(SCSI_PHASE_STATUS);
510            }
511            else
512            {
513               scsi_out_req_delay(1);
514            }
515         }
516         else
517         {
518            scsi_out_req_delay(0);
519         }
520         break;
521
522      case SCSI_PHASE_STATUS:
523         if (!state)
524         {
525            if (cmd_idx > 0)
526            {
527               scsi_change_phase(SCSI_PHASE_MESSAGE_IN);
528            }
529            else
530            {
531               scsi_out_req_delay(1);
532            }
533         }
534         else
535         {
536            cmd_idx++;
537            scsi_out_req_delay(0);
538         }
539         break;
540
541      case SCSI_PHASE_MESSAGE_IN:
542         if (!state)
543         {
544            if (cmd_idx > 0)
545            {
546               if (is_linked)
547                  scsi_change_phase(SCSI_PHASE_COMMAND);
548               else
549                  scsi_change_phase(SCSI_PHASE_BUS_FREE);
550            }
551            else
552            {
553               scsi_out_req_delay(1);
554            }
555         }
556         else
557         {
558            cmd_idx++;
559            scsi_out_req_delay(0);
560         }
561         break;
562   }
563}
564
565WRITE_LINE_MEMBER( scsihle_device::input_rst )
566{
567   if (state)
568   {
569      scsi_change_phase(SCSI_PHASE_BUS_FREE);
570      cmd_idx = 0;
571      data_idx = 0;
572      is_linked = 0;
573   }
574}
575
576// get the length of a SCSI command based on it's command byte type
577int scsihle_device::get_scsi_cmd_len(int cbyte)
578{
579   int group;
580
581   group = (cbyte>>5) & 7;
582
583   if (group == 0 || group == 3 || group == 6 || group == 7) return 6;
584   if (group == 1 || group == 2) return 10;
585   if (group == 5) return 12;
586
587   fatalerror("scsihle: Unknown SCSI command group %d, command byte=%02X\n", group,cbyte);
588
589   return 6;
590}
Property changes on: branches/old_menus/src/emu/bus/scsi/scsihle.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
branches/old_menus/src/emu/bus/scsi/scsihle.h
r0r29634
1// license:MAME
2// copyright-holders:smf
3/*
4
5scsihle.h
6
7Base class for HLE'd SCSI devices.
8
9*/
10
11#ifndef _SCSIHLE_H_
12#define _SCSIHLE_H_
13
14#include "scsi.h"
15#include "machine/t10spc.h"
16
17class scsihle_device : public device_t,
18   public scsi_port_interface,
19   public virtual t10spc
20{
21public:
22   // construction/destruction
23   scsihle_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
24
25   virtual int GetDeviceID(); // hack for legacy_scsi_host_adapter::get_device
26
27   virtual DECLARE_WRITE_LINE_MEMBER( input_sel );
28   virtual DECLARE_WRITE_LINE_MEMBER( input_ack );
29   virtual DECLARE_WRITE_LINE_MEMBER( input_rst );
30   virtual DECLARE_WRITE_LINE_MEMBER( input_data0 ) { if (state) m_input_data |= 0x01; else m_input_data &= ~0x01; }
31   virtual DECLARE_WRITE_LINE_MEMBER( input_data1 ) { if (state) m_input_data |= 0x02; else m_input_data &= ~0x02; }
32   virtual DECLARE_WRITE_LINE_MEMBER( input_data2 ) { if (state) m_input_data |= 0x04; else m_input_data &= ~0x04; }
33   virtual DECLARE_WRITE_LINE_MEMBER( input_data3 ) { if (state) m_input_data |= 0x08; else m_input_data &= ~0x08; }
34   virtual DECLARE_WRITE_LINE_MEMBER( input_data4 ) { if (state) m_input_data |= 0x10; else m_input_data &= ~0x10; }
35   virtual DECLARE_WRITE_LINE_MEMBER( input_data5 ) { if (state) m_input_data |= 0x20; else m_input_data &= ~0x20; }
36   virtual DECLARE_WRITE_LINE_MEMBER( input_data6 ) { if (state) m_input_data |= 0x40; else m_input_data &= ~0x40; }
37   virtual DECLARE_WRITE_LINE_MEMBER( input_data7 ) { if (state) m_input_data |= 0x80; else m_input_data &= ~0x80; }
38
39protected:
40   // device-level overrides
41   virtual ioport_constructor device_input_ports() const;
42   virtual void device_start();
43   virtual void device_reset();
44   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
45
46private:
47   required_ioport m_scsi_id;
48   void data_out(UINT8 data);
49   void scsi_out_req_delay(UINT8 state);
50   void scsi_change_phase(UINT8 newphase);
51   int get_scsi_cmd_len(int cbyte);
52   UINT8 scsibus_driveno(UINT8  drivesel);
53   void scsibus_read_data();
54   void scsibus_write_data();
55   void scsibus_exec_command();
56   void dump_command_bytes();
57   void dump_data_bytes(int count);
58   void dump_bytes(UINT8 *buff, int count);
59
60   emu_timer *req_timer;
61   emu_timer *sel_timer;
62   emu_timer *dataout_timer;
63
64   UINT8 cmd_idx;
65   UINT8 is_linked;
66
67   UINT8 buffer[ 1024 ];
68   UINT16 data_idx;
69   int bytes_left;
70   int data_last;
71
72   int scsiID;
73   UINT8 m_input_data;
74};
75
76extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_0)[];
77extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_1)[];
78extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_2)[];
79extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_3)[];
80extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_4)[];
81extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_5)[];
82extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_6)[];
83extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_7)[];
84
85#define MCFG_SCSIDEV_ADD(_tag, _option, _type, _id) \
86   MCFG_DEVICE_MODIFY(_tag ) \
87   MCFG_SLOT_OPTION_ADD( _option, _type ) \
88   MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS( _option, _id ) \
89   MCFG_SLOT_DEFAULT_OPTION( _option ) \
90
91#endif
Property changes on: branches/old_menus/src/emu/bus/scsi/scsihle.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/bus/scsi/acb4070.c
r29633r29634
33 *
44 */
55
6#include "emu.h"
76#include "acb4070.h"
87
98// device type definition
branches/old_menus/src/emu/bus/scsi/scsi.c
r0r29634
1// license:MAME
2// copyright-holders:smf
3
4#include "scsi.h"
5
6SCSI_PORT_DEVICE::SCSI_PORT_DEVICE(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
7   : device_t(mconfig, SCSI_PORT, "SCSI Port", tag, owner, clock, "scsi", __FILE__),
8   m_bsy_handler(*this),
9   m_sel_handler(*this),
10   m_cd_handler(*this),
11   m_io_handler(*this),
12   m_msg_handler(*this),
13   m_req_handler(*this),
14   m_ack_handler(*this),
15   m_atn_handler(*this),
16   m_rst_handler(*this),
17   m_data0_handler(*this),
18   m_data1_handler(*this),
19   m_data2_handler(*this),
20   m_data3_handler(*this),
21   m_data4_handler(*this),
22   m_data5_handler(*this),
23   m_data6_handler(*this),
24   m_data7_handler(*this),
25   m_bsy_in(0),
26   m_sel_in(0),
27   m_cd_in(0),
28   m_io_in(0),
29   m_msg_in(0),
30   m_req_in(0),
31   m_ack_in(0),
32   m_rst_in(0),
33   m_data0_in(0),
34   m_data1_in(0),
35   m_data2_in(0),
36   m_data3_in(0),
37   m_data4_in(0),
38   m_data5_in(0),
39   m_data6_in(0),
40   m_data7_in(0),
41   m_bsy_out(0),
42   m_sel_out(0),
43   m_cd_out(0),
44   m_io_out(0),
45   m_msg_out(0),
46   m_req_out(0),
47   m_ack_out(0),
48   m_rst_out(0),
49   m_data0_out(0),
50   m_data1_out(0),
51   m_data2_out(0),
52   m_data3_out(0),
53   m_data4_out(0),
54   m_data5_out(0),
55   m_data6_out(0),
56   m_data7_out(0)
57{
58}
59
60static MACHINE_CONFIG_FRAGMENT( scsi_port )
61   MCFG_DEVICE_ADD( SCSI_PORT_DEVICE1, SCSI_PORT_SLOT, 0 )
62   MCFG_DEVICE_ADD( SCSI_PORT_DEVICE2, SCSI_PORT_SLOT, 0 )
63   MCFG_DEVICE_ADD( SCSI_PORT_DEVICE3, SCSI_PORT_SLOT, 0 )
64   MCFG_DEVICE_ADD( SCSI_PORT_DEVICE4, SCSI_PORT_SLOT, 0 )
65   MCFG_DEVICE_ADD( SCSI_PORT_DEVICE5, SCSI_PORT_SLOT, 0 )
66   MCFG_DEVICE_ADD( SCSI_PORT_DEVICE6, SCSI_PORT_SLOT, 0 )
67   MCFG_DEVICE_ADD( SCSI_PORT_DEVICE7, SCSI_PORT_SLOT, 0 )
68MACHINE_CONFIG_END
69
70machine_config_constructor SCSI_PORT_DEVICE::device_mconfig_additions() const
71{
72   return MACHINE_CONFIG_NAME( scsi_port );
73}
74
75void SCSI_PORT_DEVICE::device_start()
76{
77   const char *deviceName[] =
78   {
79      SCSI_PORT_DEVICE1,
80      SCSI_PORT_DEVICE2,
81      SCSI_PORT_DEVICE3,
82      SCSI_PORT_DEVICE4,
83      SCSI_PORT_DEVICE5,
84      SCSI_PORT_DEVICE6,
85      SCSI_PORT_DEVICE7
86   };
87
88   m_device_count = 0;
89
90   for (int i = 0; i < 7; i++)
91   {
92      SCSI_PORT_SLOT_device *slot = subdevice<SCSI_PORT_SLOT_device>(deviceName[i]);
93      m_slot[i] = slot;
94
95      if (slot != NULL)
96         m_device_count = i + 1;
97   }
98
99   m_bsy_handler.resolve_safe();
100   m_sel_handler.resolve_safe();
101   m_cd_handler.resolve_safe();
102   m_io_handler.resolve_safe();
103   m_msg_handler.resolve_safe();
104   m_req_handler.resolve_safe();
105   m_ack_handler.resolve_safe();
106   m_atn_handler.resolve_safe();
107   m_rst_handler.resolve_safe();
108   m_data0_handler.resolve_safe();
109   m_data1_handler.resolve_safe();
110   m_data2_handler.resolve_safe();
111   m_data3_handler.resolve_safe();
112   m_data4_handler.resolve_safe();
113   m_data5_handler.resolve_safe();
114   m_data6_handler.resolve_safe();
115   m_data7_handler.resolve_safe();
116}
117
118void SCSI_PORT_DEVICE::update_bsy()
119{
120   int bsy = m_bsy_in;
121   for (int i = 0; i < m_device_count; i++)
122   {
123      bsy |= m_slot[i]->m_bsy;
124   }
125
126   if (m_bsy_out != bsy)
127   {
128      m_bsy_out = bsy;
129      m_bsy_handler(bsy);
130
131      for (int i = 0; i < m_device_count; i++)
132      {
133         scsi_port_interface *dev = m_slot[i]->dev();
134         if (dev != NULL)
135            dev->input_bsy(bsy);
136      }
137   }
138}
139
140void SCSI_PORT_DEVICE::update_sel()
141{
142   int sel = m_sel_in;
143   for (int i = 0; i < m_device_count; i++)
144   {
145      sel |= m_slot[i]->m_sel;
146   }
147
148   if (m_sel_out != sel)
149   {
150      m_sel_out = sel;
151      m_sel_handler(sel);
152
153      for (int i = 0; i < m_device_count; i++)
154      {
155         scsi_port_interface *dev = m_slot[i]->dev();
156         if (dev != NULL)
157            dev->input_sel(sel);
158      }
159   }
160}
161
162void SCSI_PORT_DEVICE::update_cd()
163{
164   int cd = m_cd_in;
165   for (int i = 0; i < m_device_count; i++)
166   {
167      cd |= m_slot[i]->m_cd;
168   }
169
170   if (m_cd_out != cd)
171   {
172      m_cd_out = cd;
173      m_cd_handler(cd);
174
175      for (int i = 0; i < m_device_count; i++)
176      {
177         scsi_port_interface *dev = m_slot[i]->dev();
178         if (dev != NULL)
179            dev->input_cd(cd);
180      }
181   }
182}
183
184void SCSI_PORT_DEVICE::update_io()
185{
186   int io = m_io_in;
187   for (int i = 0; i < m_device_count; i++)
188   {
189      io |= m_slot[i]->m_io;
190   }
191
192   if (m_io_out != io)
193   {
194      m_io_out = io;
195      m_io_handler(io);
196
197      for (int i = 0; i < m_device_count; i++)
198      {
199         scsi_port_interface *dev = m_slot[i]->dev();
200         if (dev != NULL)
201            dev->input_io(io);
202      }
203   }
204}
205
206void SCSI_PORT_DEVICE::update_msg()
207{
208   int msg = m_msg_in;
209   for (int i = 0; i < m_device_count; i++)
210   {
211      msg |= m_slot[i]->m_msg;
212   }
213
214   if (m_msg_out != msg)
215   {
216      m_msg_out = msg;
217      m_msg_handler(msg);
218
219      for (int i = 0; i < m_device_count; i++)
220      {
221         scsi_port_interface *dev = m_slot[i]->dev();
222         if (dev != NULL)
223            dev->input_msg(msg);
224      }
225   }
226}
227
228void SCSI_PORT_DEVICE::update_req()
229{
230   int req = m_req_in;
231   for (int i = 0; i < m_device_count; i++)
232   {
233      req |= m_slot[i]->m_req;
234   }
235
236   if (m_req_out != req)
237   {
238      m_req_out = req;
239      m_req_handler(req);
240
241      for (int i = 0; i < m_device_count; i++)
242      {
243         scsi_port_interface *dev = m_slot[i]->dev();
244         if (dev != NULL)
245            dev->input_req(req);
246      }
247   }
248}
249
250void SCSI_PORT_DEVICE::update_ack()
251{
252   int ack = m_ack_in;
253   for (int i = 0; i < m_device_count; i++)
254   {
255      ack |= m_slot[i]->m_ack;
256   }
257
258   if (m_ack_out != ack)
259   {
260      m_ack_out = ack;
261      m_ack_handler(ack);
262
263      for (int i = 0; i < m_device_count; i++)
264      {
265         scsi_port_interface *dev = m_slot[i]->dev();
266         if (dev != NULL)
267            dev->input_ack(ack);
268      }
269   }
270}
271
272void SCSI_PORT_DEVICE::update_atn()
273{
274   int atn = m_atn_in;
275   for (int i = 0; i < m_device_count; i++)
276   {
277      atn |= m_slot[i]->m_atn;
278   }
279
280   if (m_atn_out != atn)
281   {
282      m_atn_out = atn;
283      m_atn_handler(atn);
284
285      for (int i = 0; i < m_device_count; i++)
286      {
287         scsi_port_interface *dev = m_slot[i]->dev();
288         if (dev != NULL)
289            dev->input_atn(atn);
290      }
291   }
292}
293
294void SCSI_PORT_DEVICE::update_rst()
295{
296   int rst = m_rst_in;
297   for (int i = 0; i < m_device_count; i++)
298   {
299      rst |= m_slot[i]->m_rst;
300   }
301
302   if (m_rst_out != rst)
303   {
304      m_rst_out = rst;
305      m_rst_handler(rst);
306
307      for (int i = 0; i < m_device_count; i++)
308      {
309         scsi_port_interface *dev = m_slot[i]->dev();
310         if (dev != NULL)
311            dev->input_rst(rst);
312      }
313   }
314}
315
316void SCSI_PORT_DEVICE::update_data0()
317{
318   int data0 = m_data0_in;
319   for (int i = 0; i < m_device_count; i++)
320   {
321      data0 |= m_slot[i]->m_data0;
322   }
323
324   if (m_data0_out != data0)
325   {
326      m_data0_out = data0;
327      m_data0_handler(data0);
328
329      for (int i = 0; i < m_device_count; i++)
330      {
331         scsi_port_interface *dev = m_slot[i]->dev();
332         if (dev != NULL)
333            dev->input_data0(data0);
334      }
335   }
336}
337
338void SCSI_PORT_DEVICE::update_data1()
339{
340   int data1 = m_data1_in;
341   for (int i = 0; i < m_device_count; i++)
342   {
343      data1 |= m_slot[i]->m_data1;
344   }
345
346   if (m_data1_out != data1)
347   {
348      m_data1_out = data1;
349      m_data1_handler(data1);
350
351      for (int i = 0; i < m_device_count; i++)
352      {
353         scsi_port_interface *dev = m_slot[i]->dev();
354         if (dev != NULL)
355            dev->input_data1(data1);
356      }
357   }
358}
359
360void SCSI_PORT_DEVICE::update_data2()
361{
362   int data2 = m_data2_in;
363   for (int i = 0; i < m_device_count; i++)
364   {
365      data2 |= m_slot[i]->m_data2;
366   }
367
368   if (m_data2_out != data2)
369   {
370      m_data2_out = data2;
371      m_data2_handler(data2);
372
373      for (int i = 0; i < m_device_count; i++)
374      {
375         scsi_port_interface *dev = m_slot[i]->dev();
376         if (dev != NULL)
377            dev->input_data2(data2);
378      }
379   }
380}
381
382void SCSI_PORT_DEVICE::update_data3()
383{
384   int data3 = m_data3_in;
385   for (int i = 0; i < m_device_count; i++)
386   {
387      data3 |= m_slot[i]->m_data3;
388   }
389
390   if (m_data3_out != data3)
391   {
392      m_data3_out = data3;
393      m_data3_handler(data3);
394
395      for (int i = 0; i < m_device_count; i++)
396      {
397         scsi_port_interface *dev = m_slot[i]->dev();
398         if (dev != NULL)
399            dev->input_data3(data3);
400      }
401   }
402}
403
404void SCSI_PORT_DEVICE::update_data4()
405{
406   int data4 = m_data4_in;
407   for (int i = 0; i < m_device_count; i++)
408   {
409      data4 |= m_slot[i]->m_data4;
410   }
411
412   if (m_data4_out != data4)
413   {
414      m_data4_out = data4;
415      m_data4_handler(data4);
416
417      for (int i = 0; i < m_device_count; i++)
418      {
419         scsi_port_interface *dev = m_slot[i]->dev();
420         if (dev != NULL)
421            dev->input_data4(data4);
422      }
423   }
424}
425
426void SCSI_PORT_DEVICE::update_data5()
427{
428   int data5 = m_data5_in;
429   for (int i = 0; i < m_device_count; i++)
430   {
431      data5 |= m_slot[i]->m_data5;
432   }
433
434   if (m_data5_out != data5)
435   {
436      m_data5_out = data5;
437      m_data5_handler(data5);
438
439      for (int i = 0; i < m_device_count; i++)
440      {
441         scsi_port_interface *dev = m_slot[i]->dev();
442         if (dev != NULL)
443            dev->input_data5(data5);
444      }
445   }
446}
447
448void SCSI_PORT_DEVICE::update_data6()
449{
450   int data6 = m_data6_in;
451   for (int i = 0; i < m_device_count; i++)
452   {
453      data6 |= m_slot[i]->m_data6;
454   }
455
456   if (m_data6_out != data6)
457   {
458      m_data6_out = data6;
459      m_data6_handler(data6);
460
461      for (int i = 0; i < m_device_count; i++)
462      {
463         scsi_port_interface *dev = m_slot[i]->dev();
464         if (dev != NULL)
465            dev->input_data6(data6);
466      }
467   }
468}
469
470void SCSI_PORT_DEVICE::update_data7()
471{
472   int data7 = m_data7_in;
473   for (int i = 0; i < m_device_count; i++)
474   {
475      data7 |= m_slot[i]->m_data7;
476   }
477
478   if (m_data7_out != data7)
479   {
480      m_data7_out = data7;
481      m_data7_handler(data7);
482
483      for (int i = 0; i < m_device_count; i++)
484      {
485         scsi_port_interface *dev = m_slot[i]->dev();
486         if (dev != NULL)
487            dev->input_data7(data7);
488      }
489   }
490}
491
492WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_bsy )
493{
494   if (m_bsy_in != state)
495   {
496      m_bsy_in = state;
497      update_bsy();
498   }
499}
500
501WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_sel )
502{
503   if (m_sel_in != state)
504   {
505      m_sel_in = state;
506      update_sel();
507   }
508}
509
510WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_cd )
511{
512   if (m_cd_in != state)
513   {
514      m_cd_in = state;
515      update_cd();
516   }
517}
518
519WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_io )
520{
521   if (m_io_in != state)
522   {
523      m_io_in = state;
524      update_io();
525   }
526}
527
528WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_msg )
529{
530   if (m_msg_in != state)
531   {
532      m_msg_in = state;
533      update_msg();
534   }
535}
536
537WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_req )
538{
539   if (m_req_in != state)
540   {
541      m_req_in = state;
542      update_req();
543   }
544}
545
546WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_ack )
547{
548   if (m_ack_in != state)
549   {
550      m_ack_in = state;
551      update_ack();
552   }
553}
554
555WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_atn )
556{
557   if (m_atn_in != state)
558   {
559      m_atn_in = state;
560      update_atn();
561   }
562}
563
564WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_rst )
565{
566   if (m_rst_in != state)
567   {
568      m_rst_in = state;
569      update_rst();
570   }
571}
572
573WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_data0 )
574{
575   if (m_data0_in != state)
576   {
577      m_data0_in = state;
578      update_data0();
579   }
580}
581
582WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_data1 )
583{
584   if (m_data1_in != state)
585   {
586      m_data1_in = state;
587      update_data1();
588   }
589}
590
591WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_data2 )
592{
593   if (m_data2_in != state)
594   {
595      m_data2_in = state;
596      update_data2();
597   }
598}
599
600WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_data3 )
601{
602   if (m_data3_in != state)
603   {
604      m_data3_in = state;
605      update_data3();
606   }
607}
608
609WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_data4 )
610{
611   if (m_data4_in != state)
612   {
613      m_data4_in = state;
614      update_data4();
615   }
616}
617
618WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_data5 )
619{
620   if (m_data5_in != state)
621   {
622      m_data5_in = state;
623      update_data5();
624   }
625}
626
627WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_data6 )
628{
629   if (m_data6_in != state)
630   {
631      m_data6_in = state;
632      update_data6();
633   }
634}
635
636WRITE_LINE_MEMBER( SCSI_PORT_DEVICE::write_data7 )
637{
638   if (m_data7_in != state)
639   {
640      m_data7_in = state;
641      update_data7();
642   }
643}
644
645const device_type SCSI_PORT = &device_creator<SCSI_PORT_DEVICE>;
646
647SCSI_PORT_SLOT_device::SCSI_PORT_SLOT_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
648   device_t(mconfig, SCSI_PORT_SLOT, "SCSI Connector", tag, owner, clock, "scsi_slot", __FILE__),
649   device_slot_interface(mconfig, *this),
650   m_dev(NULL),
651   m_bsy(0),
652   m_sel(0),
653   m_cd(0),
654   m_io(0),
655   m_msg(0),
656   m_req(0),
657   m_ack(0),
658   m_rst(0),
659   m_data0(0),
660   m_data1(0),
661   m_data2(0),
662   m_data3(0),
663   m_data4(0),
664   m_data5(0),
665   m_data6(0),
666   m_data7(0)
667{
668   m_port = dynamic_cast<SCSI_PORT_DEVICE *>(device().owner());
669}
670
671void SCSI_PORT_SLOT_device::device_config_complete()
672{
673   m_dev = dynamic_cast<scsi_port_interface *>(get_card_device());
674}
675
676void SCSI_PORT_SLOT_device::device_start()
677{
678}
679
680const device_type SCSI_PORT_SLOT = &device_creator<SCSI_PORT_SLOT_device>;
681
682scsi_port_interface::scsi_port_interface(const machine_config &mconfig, device_t &device)
683   : device_slot_card_interface(mconfig, device)
684{
685   m_slot = dynamic_cast<SCSI_PORT_SLOT_device *>(device.owner());
686}
687
688scsi_port_interface::~scsi_port_interface()
689{
690}
Property changes on: branches/old_menus/src/emu/bus/scsi/scsi.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/bus/scsi/acb4070.h
r29633r29634
33#ifndef __ACB4070__
44#define __ACB4070__
55
6#include "machine/scsihd.h"
6#include "scsihd.h"
77
88class acb4070_device : public scsihd_device
99{
branches/old_menus/src/emu/bus/scsi/scsi.h
r0r29634
1// license:MAME
2// copyright-holders:smf
3
4#pragma once
5
6#ifndef _SCSI_H_
7#define _SCSI_H_
8
9#include "emu.h"
10#include "machine/buffer.h"
11#include "machine/latch.h"
12
13#define SCSI_PORT_DEVICE1 "1"
14#define SCSI_PORT_DEVICE2 "2"
15#define SCSI_PORT_DEVICE3 "3"
16#define SCSI_PORT_DEVICE4 "4"
17#define SCSI_PORT_DEVICE5 "5"
18#define SCSI_PORT_DEVICE6 "6"
19#define SCSI_PORT_DEVICE7 "7"
20
21#define MCFG_SCSI_BSY_HANDLER(_devcb) \
22   devcb = &SCSI_PORT_DEVICE::set_bsy_handler(*device, DEVCB2_##_devcb);
23
24#define MCFG_SCSI_SEL_HANDLER(_devcb) \
25   devcb = &SCSI_PORT_DEVICE::set_sel_handler(*device, DEVCB2_##_devcb);
26
27#define MCFG_SCSI_CD_HANDLER(_devcb) \
28   devcb = &SCSI_PORT_DEVICE::set_cd_handler(*device, DEVCB2_##_devcb);
29
30#define MCFG_SCSI_IO_HANDLER(_devcb) \
31   devcb = &SCSI_PORT_DEVICE::set_io_handler(*device, DEVCB2_##_devcb);
32
33#define MCFG_SCSI_MSG_HANDLER(_devcb) \
34   devcb = &SCSI_PORT_DEVICE::set_msg_handler(*device, DEVCB2_##_devcb);
35
36#define MCFG_SCSI_REQ_HANDLER(_devcb) \
37   devcb = &SCSI_PORT_DEVICE::set_req_handler(*device, DEVCB2_##_devcb);
38
39#define MCFG_SCSI_ACK_HANDLER(_devcb) \
40   devcb = &SCSI_PORT_DEVICE::set_ack_handler(*device, DEVCB2_##_devcb);
41
42#define MCFG_SCSI_ATN_HANDLER(_devcb) \
43   devcb = &SCSI_PORT_DEVICE::set_atn_handler(*device, DEVCB2_##_devcb);
44
45#define MCFG_SCSI_RST_HANDLER(_devcb) \
46   devcb = &SCSI_PORT_DEVICE::set_rst_handler(*device, DEVCB2_##_devcb);
47
48#define MCFG_SCSI_DATA0_HANDLER(_devcb) \
49   devcb = &SCSI_PORT_DEVICE::set_data0_handler(*device, DEVCB2_##_devcb);
50
51#define MCFG_SCSI_DATA1_HANDLER(_devcb) \
52   devcb = &SCSI_PORT_DEVICE::set_data1_handler(*device, DEVCB2_##_devcb);
53
54#define MCFG_SCSI_DATA2_HANDLER(_devcb) \
55   devcb = &SCSI_PORT_DEVICE::set_data2_handler(*device, DEVCB2_##_devcb);
56
57#define MCFG_SCSI_DATA3_HANDLER(_devcb) \
58   devcb = &SCSI_PORT_DEVICE::set_data3_handler(*device, DEVCB2_##_devcb);
59
60#define MCFG_SCSI_DATA4_HANDLER(_devcb) \
61   devcb = &SCSI_PORT_DEVICE::set_data4_handler(*device, DEVCB2_##_devcb);
62
63#define MCFG_SCSI_DATA5_HANDLER(_devcb) \
64   devcb = &SCSI_PORT_DEVICE::set_data5_handler(*device, DEVCB2_##_devcb);
65
66#define MCFG_SCSI_DATA6_HANDLER(_devcb) \
67   devcb = &SCSI_PORT_DEVICE::set_data6_handler(*device, DEVCB2_##_devcb);
68
69#define MCFG_SCSI_DATA7_HANDLER(_devcb) \
70   devcb = &SCSI_PORT_DEVICE::set_data7_handler(*device, DEVCB2_##_devcb);
71
72#define MCFG_SCSI_OUTPUT_LATCH_ADD(_tag, scsi_port_tag) \
73   MCFG_DEVICE_ADD(_tag, OUTPUT_LATCH, 0) \
74   MCFG_OUTPUT_LATCH_BIT0_HANDLER(DEVWRITELINE(scsi_port_tag, SCSI_PORT_DEVICE, write_data0)) \
75   MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE(scsi_port_tag, SCSI_PORT_DEVICE, write_data1)) \
76   MCFG_OUTPUT_LATCH_BIT2_HANDLER(DEVWRITELINE(scsi_port_tag, SCSI_PORT_DEVICE, write_data2)) \
77   MCFG_OUTPUT_LATCH_BIT3_HANDLER(DEVWRITELINE(scsi_port_tag, SCSI_PORT_DEVICE, write_data3)) \
78   MCFG_OUTPUT_LATCH_BIT4_HANDLER(DEVWRITELINE(scsi_port_tag, SCSI_PORT_DEVICE, write_data4)) \
79   MCFG_OUTPUT_LATCH_BIT5_HANDLER(DEVWRITELINE(scsi_port_tag, SCSI_PORT_DEVICE, write_data5)) \
80   MCFG_OUTPUT_LATCH_BIT6_HANDLER(DEVWRITELINE(scsi_port_tag, SCSI_PORT_DEVICE, write_data6)) \
81   MCFG_OUTPUT_LATCH_BIT7_HANDLER(DEVWRITELINE(scsi_port_tag, SCSI_PORT_DEVICE, write_data7))
82
83#define MCFG_SCSI_DATA_INPUT_BUFFER(_tag) \
84   MCFG_SCSI_DATA0_HANDLER(DEVWRITELINE(_tag, input_buffer_device, write_bit0)) \
85   MCFG_SCSI_DATA1_HANDLER(DEVWRITELINE(_tag, input_buffer_device, write_bit1)) \
86   MCFG_SCSI_DATA2_HANDLER(DEVWRITELINE(_tag, input_buffer_device, write_bit2)) \
87   MCFG_SCSI_DATA3_HANDLER(DEVWRITELINE(_tag, input_buffer_device, write_bit3)) \
88   MCFG_SCSI_DATA4_HANDLER(DEVWRITELINE(_tag, input_buffer_device, write_bit4)) \
89   MCFG_SCSI_DATA5_HANDLER(DEVWRITELINE(_tag, input_buffer_device, write_bit5)) \
90   MCFG_SCSI_DATA6_HANDLER(DEVWRITELINE(_tag, input_buffer_device, write_bit6)) \
91   MCFG_SCSI_DATA7_HANDLER(DEVWRITELINE(_tag, input_buffer_device, write_bit7))
92
93class SCSI_PORT_SLOT_device;
94class scsi_port_interface;
95
96class SCSI_PORT_DEVICE : public device_t
97{
98   friend class scsi_port_interface;
99
100public:
101   // construction/destruction
102   SCSI_PORT_DEVICE(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
103
104   template<class _Object> static devcb2_base &set_bsy_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_bsy_handler.set_callback(object); }
105   template<class _Object> static devcb2_base &set_sel_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_sel_handler.set_callback(object); }
106   template<class _Object> static devcb2_base &set_cd_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_cd_handler.set_callback(object); }
107   template<class _Object> static devcb2_base &set_io_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_io_handler.set_callback(object); }
108   template<class _Object> static devcb2_base &set_msg_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_msg_handler.set_callback(object); }
109   template<class _Object> static devcb2_base &set_req_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_req_handler.set_callback(object); }
110   template<class _Object> static devcb2_base &set_ack_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_ack_handler.set_callback(object); }
111   template<class _Object> static devcb2_base &set_atn_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_atn_handler.set_callback(object); }
112   template<class _Object> static devcb2_base &set_rst_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_rst_handler.set_callback(object); }
113   template<class _Object> static devcb2_base &set_data0_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_data0_handler.set_callback(object); }
114   template<class _Object> static devcb2_base &set_data1_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_data1_handler.set_callback(object); }
115   template<class _Object> static devcb2_base &set_data2_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_data2_handler.set_callback(object); }
116   template<class _Object> static devcb2_base &set_data3_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_data3_handler.set_callback(object); }
117   template<class _Object> static devcb2_base &set_data4_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_data4_handler.set_callback(object); }
118   template<class _Object> static devcb2_base &set_data5_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_data5_handler.set_callback(object); }
119   template<class _Object> static devcb2_base &set_data6_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_data6_handler.set_callback(object); }
120   template<class _Object> static devcb2_base &set_data7_handler(device_t &device, _Object object) { return downcast<SCSI_PORT_DEVICE &>(device).m_data7_handler.set_callback(object); }
121
122   DECLARE_WRITE_LINE_MEMBER( write_bsy );
123   DECLARE_WRITE_LINE_MEMBER( write_sel );
124   DECLARE_WRITE_LINE_MEMBER( write_cd );
125   DECLARE_WRITE_LINE_MEMBER( write_io );
126   DECLARE_WRITE_LINE_MEMBER( write_msg );
127   DECLARE_WRITE_LINE_MEMBER( write_req );
128   DECLARE_WRITE_LINE_MEMBER( write_ack );
129   DECLARE_WRITE_LINE_MEMBER( write_atn );
130   DECLARE_WRITE_LINE_MEMBER( write_rst );
131   DECLARE_WRITE_LINE_MEMBER( write_data0 );
132   DECLARE_WRITE_LINE_MEMBER( write_data1 );
133   DECLARE_WRITE_LINE_MEMBER( write_data2 );
134   DECLARE_WRITE_LINE_MEMBER( write_data3 );
135   DECLARE_WRITE_LINE_MEMBER( write_data4 );
136   DECLARE_WRITE_LINE_MEMBER( write_data5 );
137   DECLARE_WRITE_LINE_MEMBER( write_data6 );
138   DECLARE_WRITE_LINE_MEMBER( write_data7 );
139
140protected:
141   // device-level overrides
142   virtual void device_start();
143   virtual machine_config_constructor device_mconfig_additions() const;
144
145   void update_bsy();
146   void update_sel();
147   void update_cd();
148   void update_io();
149   void update_msg();
150   void update_req();
151   void update_ack();
152   void update_atn();
153   void update_rst();
154   void update_data0();
155   void update_data1();
156   void update_data2();
157   void update_data3();
158   void update_data4();
159   void update_data5();
160   void update_data6();
161   void update_data7();
162
163private:
164   devcb2_write_line m_bsy_handler;
165   devcb2_write_line m_sel_handler;
166   devcb2_write_line m_cd_handler;
167   devcb2_write_line m_io_handler;
168   devcb2_write_line m_msg_handler;
169   devcb2_write_line m_req_handler;
170   devcb2_write_line m_ack_handler;
171   devcb2_write_line m_atn_handler;
172   devcb2_write_line m_rst_handler;
173   devcb2_write_line m_data0_handler;
174   devcb2_write_line m_data1_handler;
175   devcb2_write_line m_data2_handler;
176   devcb2_write_line m_data3_handler;
177   devcb2_write_line m_data4_handler;
178   devcb2_write_line m_data5_handler;
179   devcb2_write_line m_data6_handler;
180   devcb2_write_line m_data7_handler;
181
182   SCSI_PORT_SLOT_device *m_slot[7];
183   int m_device_count;
184
185   int m_bsy_in;
186   int m_sel_in;
187   int m_cd_in;
188   int m_io_in;
189   int m_msg_in;
190   int m_req_in;
191   int m_ack_in;
192   int m_atn_in;
193   int m_rst_in;
194   int m_data0_in;
195   int m_data1_in;
196   int m_data2_in;
197   int m_data3_in;
198   int m_data4_in;
199   int m_data5_in;
200   int m_data6_in;
201   int m_data7_in;
202   int m_bsy_out;
203   int m_sel_out;
204   int m_cd_out;
205   int m_io_out;
206   int m_msg_out;
207   int m_req_out;
208   int m_ack_out;
209   int m_atn_out;
210   int m_rst_out;
211   int m_data0_out;
212   int m_data1_out;
213   int m_data2_out;
214   int m_data3_out;
215   int m_data4_out;
216   int m_data5_out;
217   int m_data6_out;
218   int m_data7_out;
219};
220
221extern const device_type SCSI_PORT;
222
223class scsi_port_interface;
224
225class SCSI_PORT_SLOT_device : public device_t,
226   public device_slot_interface
227{
228   friend class SCSI_PORT_DEVICE;
229   friend class scsi_port_interface;
230
231public:
232   SCSI_PORT_SLOT_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
233
234   scsi_port_interface *dev() { return m_dev; }
235   SCSI_PORT_DEVICE *port() { return m_port; }
236
237protected:
238   // device-level overrides
239   virtual void device_start();
240   virtual void device_config_complete();
241
242protected:
243   scsi_port_interface *m_dev;
244   SCSI_PORT_DEVICE *m_port;
245
246   int m_bsy;
247   int m_sel;
248   int m_cd;
249   int m_io;
250   int m_msg;
251   int m_req;
252   int m_ack;
253   int m_atn;
254   int m_rst;
255   int m_data0;
256   int m_data1;
257   int m_data2;
258   int m_data3;
259   int m_data4;
260   int m_data5;
261   int m_data6;
262   int m_data7;
263};
264
265extern const device_type SCSI_PORT_SLOT;
266
267class scsi_port_interface : public device_slot_card_interface
268{
269public:
270   scsi_port_interface(const machine_config &mconfig, device_t &device);
271   virtual ~scsi_port_interface();
272
273   virtual DECLARE_WRITE_LINE_MEMBER( input_bsy ) {}
274   virtual DECLARE_WRITE_LINE_MEMBER( input_sel ) {}
275   virtual DECLARE_WRITE_LINE_MEMBER( input_cd ) {}
276   virtual DECLARE_WRITE_LINE_MEMBER( input_io ) {}
277   virtual DECLARE_WRITE_LINE_MEMBER( input_msg ) {}
278   virtual DECLARE_WRITE_LINE_MEMBER( input_req ) {}
279   virtual DECLARE_WRITE_LINE_MEMBER( input_ack ) {}
280   virtual DECLARE_WRITE_LINE_MEMBER( input_atn ) {}
281   virtual DECLARE_WRITE_LINE_MEMBER( input_rst ) {}
282   virtual DECLARE_WRITE_LINE_MEMBER( input_data0 ) {}
283   virtual DECLARE_WRITE_LINE_MEMBER( input_data1 ) {}
284   virtual DECLARE_WRITE_LINE_MEMBER( input_data2 ) {}
285   virtual DECLARE_WRITE_LINE_MEMBER( input_data3 ) {}
286   virtual DECLARE_WRITE_LINE_MEMBER( input_data4 ) {}
287   virtual DECLARE_WRITE_LINE_MEMBER( input_data5 ) {}
288   virtual DECLARE_WRITE_LINE_MEMBER( input_data6 ) {}
289   virtual DECLARE_WRITE_LINE_MEMBER( input_data7 ) {}
290
291   DECLARE_WRITE_LINE_MEMBER( output_bsy ) { if (m_slot->m_bsy != state) { m_slot->m_bsy = state; m_slot->port()->update_bsy(); } }
292   DECLARE_WRITE_LINE_MEMBER( output_sel ) { if (m_slot->m_sel != state) { m_slot->m_sel = state; m_slot->port()->update_sel(); } }
293   DECLARE_WRITE_LINE_MEMBER( output_cd ) { if (m_slot->m_cd != state) { m_slot->m_cd = state; m_slot->port()->update_cd(); } }
294   DECLARE_WRITE_LINE_MEMBER( output_io ) { if (m_slot->m_io != state) { m_slot->m_io = state; m_slot->port()->update_io(); } }
295   DECLARE_WRITE_LINE_MEMBER( output_msg ) { if (m_slot->m_msg != state) { m_slot->m_msg = state; m_slot->port()->update_msg(); } }
296   DECLARE_WRITE_LINE_MEMBER( output_req ) { if (m_slot->m_req != state) { m_slot->m_req = state; m_slot->port()->update_req(); } }
297   DECLARE_WRITE_LINE_MEMBER( output_ack ) { if (m_slot->m_ack != state) { m_slot->m_ack = state; m_slot->port()->update_ack(); } }
298   DECLARE_WRITE_LINE_MEMBER( output_atn ) { if (m_slot->m_atn != state) { m_slot->m_atn = state; m_slot->port()->update_atn(); } }
299   DECLARE_WRITE_LINE_MEMBER( output_rst ) { if (m_slot->m_rst != state) { m_slot->m_rst = state; m_slot->port()->update_rst(); } }
300   DECLARE_WRITE_LINE_MEMBER( output_data0 ) { if (m_slot->m_data0 != state) { m_slot->m_data0 = state; m_slot->port()->update_data0(); } }
301   DECLARE_WRITE_LINE_MEMBER( output_data1 ) { if (m_slot->m_data1 != state) { m_slot->m_data1 = state; m_slot->port()->update_data1(); } }
302   DECLARE_WRITE_LINE_MEMBER( output_data2 ) { if (m_slot->m_data2 != state) { m_slot->m_data2 = state; m_slot->port()->update_data2(); } }
303   DECLARE_WRITE_LINE_MEMBER( output_data3 ) { if (m_slot->m_data3 != state) { m_slot->m_data3 = state; m_slot->port()->update_data3(); } }
304   DECLARE_WRITE_LINE_MEMBER( output_data4 ) { if (m_slot->m_data4 != state) { m_slot->m_data4 = state; m_slot->port()->update_data4(); } }
305   DECLARE_WRITE_LINE_MEMBER( output_data5 ) { if (m_slot->m_data5 != state) { m_slot->m_data5 = state; m_slot->port()->update_data5(); } }
306   DECLARE_WRITE_LINE_MEMBER( output_data6 ) { if (m_slot->m_data6 != state) { m_slot->m_data6 = state; m_slot->port()->update_data6(); } }
307   DECLARE_WRITE_LINE_MEMBER( output_data7 ) { if (m_slot->m_data7 != state) { m_slot->m_data7 = state; m_slot->port()->update_data7(); } }
308
309private:
310   SCSI_PORT_SLOT_device *m_slot;
311};
312
313#endif
Property changes on: branches/old_menus/src/emu/bus/scsi/scsi.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/bus/scsi/scsicd.c
r0r29634
1// license:MAME
2// copyright-holders:smf
3/***************************************************************************
4
5 scsicd.c - Implementation of a SCSI CD-ROM device
6
7***************************************************************************/
8
9#include "scsicd.h"
10
11// device type definition
12const device_type SCSICD = &device_creator<scsicd_device>;
13
14scsicd_device::scsicd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
15   scsihle_device(mconfig, SCSICD, "SCSI CD", tag, owner, clock, "scsicd", __FILE__)
16{
17}
18
19scsicd_device::scsicd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
20   scsihle_device(mconfig, type, name, tag, owner, clock, shortname, source)
21{
22}
23
24void scsicd_device::device_start()
25{
26   m_image = subdevice<cdrom_image_device>("image");
27   m_cdda = subdevice<cdda_device>("cdda");
28
29   scsihle_device::device_start();
30}
31
32cdrom_interface scsicd_device::cd_intf = { "cdrom", NULL };
33
34static MACHINE_CONFIG_FRAGMENT(scsi_cdrom)
35   MCFG_CDROM_ADD("image", scsicd_device::cd_intf)
36   MCFG_SOUND_ADD("cdda", CDDA, 0)
37MACHINE_CONFIG_END
38
39machine_config_constructor scsicd_device::device_mconfig_additions() const
40{
41   return MACHINE_CONFIG_NAME(scsi_cdrom);
42}
Property changes on: branches/old_menus/src/emu/bus/scsi/scsicd.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/bus/scsi/s1410.c
r29633r29634
8686*/
8787
8888
89#include "emu.h"
9089#include "s1410.h"
9190#include "cpu/z80/z80.h"
9291#include "imagedev/harddriv.h"
branches/old_menus/src/emu/bus/scsi/cdu76s.c
r0r29634
1#include "cdu76s.h"
2
3void sony_cdu76s_device::ExecCommand()
4{
5   switch ( command[0] )
6   {
7      case 0x12: // INQUIRY
8         logerror("CDU76S: INQUIRY\n");
9         m_phase = SCSI_PHASE_DATAIN;
10         m_status_code = SCSI_STATUS_CODE_GOOD;
11         m_transfer_length = SCSILengthFromUINT8( &command[ 4 ] );
12         break;
13   }
14}
15
16void sony_cdu76s_device::ReadData( UINT8 *data, int dataLength )
17{
18   switch ( command[0] )
19   {
20      case 0x12: // INQUIRY
21         memset( data, 0, dataLength );
22         data[0] = 0x05; // device is present, device is CD/DVD (MMC-3)
23         data[1] = 0x80; // media is removable
24         data[2] = 0x05; // device complies with SPC-3 standard
25         data[3] = 0x02; // response data format = SPC-3 standard
26         // some Konami games freak out if this isn't "Sony", so we'll lie
27         // this is the actual drive on my Nagano '98 board
28         strcpy((char *)&data[8], "Sony");
29         strcpy((char *)&data[16], "CDU-76S");
30         strcpy((char *)&data[32], "1.0");
31         break;
32
33      default:
34         scsicd_device::ReadData( data, dataLength );
35         break;
36   }
37}
38
39// device type definition
40const device_type CDU76S = &device_creator<sony_cdu76s_device>;
41
42sony_cdu76s_device::sony_cdu76s_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
43   scsicd_device(mconfig, CDU76S, "Sony CDU-76S", tag, owner, clock, "cdu76s", __FILE__)
44{
45}
Property changes on: branches/old_menus/src/emu/bus/scsi/cdu76s.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/bus/scsi/s1410.h
r29633r29634
1414#ifndef __S1410__
1515#define __S1410__
1616
17#include "emu.h"
18#include "machine/scsihd.h"
17#include "scsihd.h"
1918
2019class s1410_device  : public scsihd_device
2120{
branches/old_menus/src/emu/bus/scsi/scsicd.h
r0r29634
1// license:MAME
2// copyright-holders:smf
3/***************************************************************************
4
5 scsicd.h
6
7***************************************************************************/
8
9#ifndef _SCSICD_H_
10#define _SCSICD_H_
11
12#include "scsihle.h"
13#include "machine/t10mmc.h"
14
15class scsicd_device : public scsihle_device,
16   public t10mmc
17{
18public:
19   // construction/destruction
20   scsicd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
21   scsicd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
22   virtual machine_config_constructor device_mconfig_additions() const;
23
24   static struct cdrom_interface cd_intf;
25
26protected:
27   virtual void device_start();
28};
29
30// device type definition
31extern const device_type SCSICD;
32
33#endif
Property changes on: branches/old_menus/src/emu/bus/scsi/scsicd.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/bus/scsi/scsihd.c
r0r29634
1// license:MAME
2// copyright-holders:smf
3/***************************************************************************
4
5 scsihd.c - Implementation of a SCSI hard disk drive
6
7***************************************************************************/
8
9#include "scsihd.h"
10
11// device type definition
12const device_type SCSIHD = &device_creator<scsihd_device>;
13
14scsihd_device::scsihd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
15   : scsihle_device(mconfig, SCSIHD, "SCSI HD", tag, owner, clock, "scsihd", __FILE__)
16{
17}
18
19scsihd_device::scsihd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
20   scsihle_device(mconfig, type, name, tag, owner, clock, shortname, source)
21{
22}
23
24void scsihd_device::device_start()
25{
26   m_image = subdevice<harddisk_image_device>("image");
27
28   scsihle_device::device_start();
29}
30
31harddisk_interface scsihd_device::hd_intf = { "scsi_hdd", NULL };
32
33static MACHINE_CONFIG_FRAGMENT(scsi_harddisk)
34   MCFG_HARDDISK_CONFIG_ADD("image", scsihd_device::hd_intf)
35MACHINE_CONFIG_END
36
37machine_config_constructor scsihd_device::device_mconfig_additions() const
38{
39   return MACHINE_CONFIG_NAME(scsi_harddisk);
40}
Property changes on: branches/old_menus/src/emu/bus/scsi/scsihd.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/bus/scsi/d9060hd.c
r29633r29634
33 *
44 */
55
6#include "emu.h"
76#include "d9060hd.h"
87
98// device type definition
branches/old_menus/src/emu/bus/scsi/cdu76s.h
r0r29634
1/***************************************************************************
2
3    cdu76s.h
4
5    Sony CDU-76S
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __CDU76S_H__
15#define __CDU76S_H__
16
17#include "scsicd.h"
18#include "machine/t10mmc.h"
19
20class sony_cdu76s_device : public scsicd_device
21{
22public:
23   sony_cdu76s_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
24
25   virtual void ExecCommand();
26   virtual void ReadData( UINT8 *data, int dataLength );
27};
28
29// device type definition
30extern const device_type CDU76S;
31
32#endif
Property changes on: branches/old_menus/src/emu/bus/scsi/cdu76s.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/bus/scsi/scsihd.h
r0r29634
1// license:MAME
2// copyright-holders:smf
3/***************************************************************************
4
5 scsihd.h
6
7***************************************************************************/
8
9#ifndef _SCSIHD_H_
10#define _SCSIHD_H_
11
12#include "scsihle.h"
13#include "machine/t10sbc.h"
14
15class scsihd_device : public scsihle_device,
16   public t10sbc
17{
18public:
19   // construction/destruction
20   scsihd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
21   scsihd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
22   virtual machine_config_constructor device_mconfig_additions() const;
23
24   static struct harddisk_interface hd_intf;
25
26protected:
27   virtual void device_start();
28};
29
30// device type definition
31extern const device_type SCSIHD;
32
33#endif
Property changes on: branches/old_menus/src/emu/bus/scsi/scsihd.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/bus/scsi/d9060hd.h
r29633r29634
33#ifndef __D9060HD__
44#define __D9060HD__
55
6#include "machine/scsihd.h"
6#include "scsihd.h"
77
88class d9060hd_device : public scsihd_device
99{
branches/old_menus/src/emu/bus/scsi/sa1403d.h
r29633r29634
1414#ifndef __SA1403D__
1515#define __SA1403D__
1616
17#include "emu.h"
17#include "scsihd.h"
1818#include "imagedev/harddriv.h"
19#include "machine/scsihd.h"
2019
2120class sa1403d_device  : public scsihd_device
2221{
branches/old_menus/src/emu/bus/ieee488/d9060.c
r29633r29634
3232
3333#include "d9060.h"
3434#include "bus/scsi/d9060hd.h"
35#include "machine/scsibus.h"
36#include "machine/scsicb.h"
3735
3836
3937
r29633r29634
336334};
337335
338336
339READ8_MEMBER( base_d9060_device::via_pb_r )
337WRITE8_MEMBER( base_d9060_device::via_pb_w )
340338{
341339   /*
342340
343341       bit     description
344342
345       PB0
346       PB1
343       PB0     SEL
344       PB1     RST
347345       PB2     C/D
348346       PB3     BUSY
349347       PB4     J14 (1=9060, 0=9090)
r29633r29634
353351
354352   */
355353
356   UINT8 data = 0;
357
358   data |= m_sasibus->scsi_cd_r() << 2;
359   data |= m_sasibus->scsi_bsy_r() << 3;
360   data |= m_sasibus->scsi_io_r() << 6;
361   data |= m_sasibus->scsi_msg_r() << 7;
362
363   // drive type
364   data |= (m_variant == TYPE_9060) << 4;
365
366   return data;
354   m_sasibus->write_sel(BIT(data, 0));
355   m_sasibus->write_rst(BIT(data, 1));
367356}
368357
369WRITE8_MEMBER( base_d9060_device::via_pb_w )
370{
371   /*
372
373       bit     description
374
375       PB0     SEL
376       PB1     RST
377       PB2
378       PB3
379       PB4
380       PB5
381       PB6
382       PB7
383
384   */
385
386   m_sasibus->scsi_sel_w(BIT(data, 0));
387   m_sasibus->scsi_rst_w(BIT(data, 1));
388}
389
390358WRITE_LINE_MEMBER( base_d9060_device::ack_w )
391359{
392   m_sasibus->scsi_ack_w(!state);
360   m_sasibus->write_ack(!state);
393361}
394362
395363WRITE_LINE_MEMBER( base_d9060_device::enable_w )
r29633r29634
398366
399367   if( !m_enable )
400368   {
401      m_sasibus->scsi_data_w( m_data );
369      m_sasi_data_out->write( m_data );
402370   }
403371   else
404372   {
405      m_sasibus->scsi_data_w( 0 );
373      m_sasi_data_out->write( 0 );
406374   }
407375}
408376
r29633r29634
412380
413381   if( !m_enable )
414382   {
415      m_sasibus->scsi_data_w( m_data );
383      m_sasi_data_out->write( m_data );
416384   }
417385}
418386
419WRITE_LINE_MEMBER( base_d9060_device::req_w )
420{
421   m_via->write_ca1(state);
422}
423387
424
425388//-------------------------------------------------
426389//  MACHINE_CONFIG_FRAGMENT( d9060 )
427390//-------------------------------------------------
r29633r29634
439402   MCFG_CPU_PROGRAM_MAP(d9060_hdc_mem)
440403
441404   MCFG_DEVICE_ADD(M6522_TAG, VIA6522, XTAL_4MHz/4)
442   MCFG_VIA6522_READPA_HANDLER(DEVREAD8(SASIBUS_TAG ":host", scsicb_device, scsi_data_r))
443   MCFG_VIA6522_READPB_HANDLER(READ8(base_d9060_device, via_pb_r))
444405   MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(base_d9060_device, scsi_data_w))
445406   MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(base_d9060_device, via_pb_w))
446407   MCFG_VIA6522_CA2_HANDLER(WRITELINE(base_d9060_device, ack_w))
447408   MCFG_VIA6522_CB2_HANDLER(WRITELINE(base_d9060_device, enable_w))
448409   MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(M6502_HDC_TAG, m6502_device, irq_line))
449410
450   MCFG_SCSIBUS_ADD(SASIBUS_TAG)
451   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":harddisk0", D9060HD, SCSI_ID_0)
452   MCFG_SCSICB_ADD(SASIBUS_TAG ":host")
453   MCFG_SCSICB_REQ_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, base_d9060_device, req_w))
411   MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0)
412   MCFG_SCSI_REQ_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1))
413   MCFG_SCSI_CD_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pb2))
414   MCFG_SCSI_BSY_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pb3))
415   MCFG_SCSI_IO_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pb6))
416   MCFG_SCSI_MSG_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pb7))
417   MCFG_SCSI_DATA0_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa0))
418   MCFG_SCSI_DATA1_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa1))
419   MCFG_SCSI_DATA2_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa2))
420   MCFG_SCSI_DATA3_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa3))
421   MCFG_SCSI_DATA4_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa4))
422   MCFG_SCSI_DATA5_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa5))
423   MCFG_SCSI_DATA6_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa6))
424   MCFG_SCSI_DATA7_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa7))
425
426   MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", SASIBUS_TAG)
427
428   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", D9060HD, SCSI_ID_0)
454429MACHINE_CONFIG_END
455430
456431
r29633r29634
530505      m_riot0(*this, M6532_0_TAG),
531506      m_riot1(*this, M6532_1_TAG),
532507      m_via(*this, M6522_TAG),
533      m_sasibus(*this, SASIBUS_TAG ":host"),
508      m_sasibus(*this, SASIBUS_TAG),
509      m_sasi_data_out(*this, "sasi_data_out"),
534510      m_address(*this, "ADDRESS"),
535511      m_rfdo(1),
536512      m_daco(1),
r29633r29634
568544   save_item(NAME(m_daco));
569545   save_item(NAME(m_atna));
570546   save_item(NAME(m_enable));
547
548   m_via->write_pb4(!(m_variant == TYPE_9090)); // J14 (6 HEADS)
549   m_via->write_pb5(!(m_variant == TYPE_9060)); // J13 (4 HEADS)
571550}
572551
573552
branches/old_menus/src/emu/bus/ieee488/d9060.h
r29633r29634
1919#include "cpu/m6502/m6502.h"
2020#include "machine/6522via.h"
2121#include "machine/6532riot.h"
22#include "machine/scsicb.h"
22#include "bus/scsi/scsi.h"
2323
2424
2525
r29633r29634
4949   virtual ioport_constructor device_input_ports() const;
5050
5151   // not really public
52   DECLARE_WRITE_LINE_MEMBER( req_w );
5352   DECLARE_READ8_MEMBER( dio_r );
5453   DECLARE_WRITE8_MEMBER( dio_w );
5554   DECLARE_READ8_MEMBER( riot1_pa_r );
r29633r29634
7978   required_device<riot6532_device> m_riot0;
8079   required_device<riot6532_device> m_riot1;
8180   required_device<via6522_device> m_via;
82   required_device<scsicb_device> m_sasibus;
81   required_device<SCSI_PORT_DEVICE> m_sasibus;
82   required_device<output_latch_device> m_sasi_data_out;
8383   required_ioport m_address;
8484
8585   // IEEE-488 bus
branches/old_menus/src/emu/bus/rs232/keyboard.c
r29633r29634
11/***************************************************************************
2Generic ASCII Keyboard
2Generic ASCII Serial Keyboard
33
44Use MCFG_SERIAL_KEYBOARD_ADD to attach this as a serial device to a terminal
55or computer.
66
7Use MCFG_ASCII_KEYBOARD_ADD to attach as a generic ascii input device in
8cases where either the driver isn't developed enough yet; or for testing;
9or for the case of a computer with an inbuilt (not serial) ascii keyboard.
107
118Example of usage in a driver.
129
1310In MACHINE_CONFIG
14    MCFG_ASCII_KEYBOARD_ADD(KEYBOARD_TAG, keyboard_intf)
11   MCFG_SERIAL_KEYBOARD_ADD(KEYBOARD_TAG, keyboard_intf, 0)
12or
13   MCFG_SERIAL_KEYBOARD_ADD(KEYBOARD_TAG, keyboard_intf, initial_baud_rate)
1514
15
1616In the code:
1717
1818WRITE8_MEMBER( xxx_state::kbd_put )
r29633r29634
2525    DEVCB_DRIVER_MEMBER(xxx_state, kbd_put)
2626};
2727
28If a baud_rate is specified, it will be the initial baud rate, with
298 bits, no parity, 1 stop bit. However you can override this with the
30config switches. (Note that the config switch will specify 9600 initially,
31even though it isn't).
32
33If a baud_rate is not specified, the rate will be solely determined
34by the config switches. (Default 9600 baud)
35
36
2837***************************************************************************/
2938
3039#include "keyboard.h"
r29633r29634
96105
97106void serial_keyboard_device::device_start()
98107{
99   int baud = clock();
100   if(!baud) baud = 9600;
108   m_baud = clock();
101109   m_out_tx_func.resolve(m_out_tx_cb, *this);
102110   m_timer = timer_alloc();
103   set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
104   set_tra_rate(baud);
111
112   if (m_baud)
113   {
114      set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
115      set_tra_rate(m_baud);
116   }
105117}
106118
107119INPUT_CHANGED_MEMBER(serial_keyboard_device::update_frame)
108120{
121   m_baud = 0;
109122   reset();
110123}
111124
r29633r29634
118131   else
119132      m_out_tx_func(m_rbit);
120133
121   UINT8 val = m_io_term_frame->read();
122   set_tra_rate(rates[val & 0x0f]);
134   if (m_baud == 0)
135   {
136      UINT8 val = m_io_term_frame->read();
137      set_tra_rate(rates[val & 0x0f]);
123138
124   switch(val & 0x30)
125   {
126   case 0x10:
127      set_data_frame(1, 7, PARITY_EVEN, STOP_BITS_1);
128      break;
129   case 0x00:
130   default:
131      set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
132      break;
133   case 0x20:
134      set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2);
135      break;
136   case 0x30:
137      set_data_frame(1, 8, PARITY_EVEN, STOP_BITS_1);
138      break;
139      switch(val & 0x30)
140      {
141      case 0x10:
142         set_data_frame(1, 7, PARITY_EVEN, STOP_BITS_1);
143         break;
144      case 0x00:
145      default:
146         set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
147         break;
148      case 0x20:
149         set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2);
150         break;
151      case 0x30:
152         set_data_frame(1, 8, PARITY_EVEN, STOP_BITS_1);
153         break;
154      }
139155   }
140156}
141157
branches/old_menus/src/emu/bus/rs232/keyboard.h
r29633r29634
5252   virtual void send_key(UINT8 code);
5353private:
5454   int m_rbit;
55   int m_baud;
5556   UINT8 m_curr_key;
5657   bool m_key_valid;
5758   devcb_resolved_write_line m_out_tx_func;
branches/old_menus/src/emu/bus/a2bus/a2scsi.c
r29633r29634
3131
3232#include "a2scsi.h"
3333#include "includes/apple2.h"
34#include "machine/scsibus.h"
3534#include "machine/nscsi_cd.h"
3635#include "machine/nscsi_hd.h"
3736
r29633r29634
6160SLOT_INTERFACE_END
6261
6362MACHINE_CONFIG_FRAGMENT( scsi )
64   MCFG_SCSIBUS_ADD("scsi")
6563   MCFG_NSCSI_BUS_ADD(SCSI_BUS_TAG)
6664   MCFG_NSCSI_ADD("scsibus:0", scsi_devices, 0, false)
6765   MCFG_NSCSI_ADD("scsibus:1", scsi_devices, 0, false)
branches/old_menus/src/emu/bus/a2bus/a2hsscsi.c
r29633r29634
3838
3939#include "a2hsscsi.h"
4040#include "includes/apple2.h"
41#include "machine/scsibus.h"
4241#include "machine/nscsi_cd.h"
4342#include "machine/nscsi_hd.h"
4443
r29633r29634
6867SLOT_INTERFACE_END
6968
7069static MACHINE_CONFIG_FRAGMENT( hsscsi )
71   MCFG_SCSIBUS_ADD("scsi")
7270   MCFG_NSCSI_BUS_ADD(SCSI_BUS_TAG)
7371   MCFG_NSCSI_ADD("scsibus:0", hsscsi_devices, 0, false)
7472   MCFG_NSCSI_ADD("scsibus:1", hsscsi_devices, 0, false)
branches/old_menus/src/emu/bus/cbmiec/cmdhd.c
r29633r29634
101101   MCFG_I8255A_ADD(I8255A_TAG, ppi_intf)
102102   //MCFG_RTC72421A_ADD(RTC72421A_TAG)
103103
104   MCFG_SCSIBUS_ADD(SCSIBUS_TAG)
105   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":harddisk0", SCSIHD, SCSI_ID_0)
106   MCFG_SCSICB_ADD(SCSIBUS_TAG ":host")
104   MCFG_DEVICE_ADD(SCSIBUS_TAG, SCSI_PORT, 0)
105   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
107106MACHINE_CONFIG_END
108107
109108
r29633r29634
131130   : device_t(mconfig, CMD_HD, "HD", tag, owner, clock, "cmdhd", __FILE__),
132131      device_cbm_iec_interface(mconfig, *this),
133132      m_maincpu(*this, M6502_TAG),
134      m_scsibus(*this, SCSIBUS_TAG":host")
133      m_scsibus(*this, SCSIBUS_TAG)
135134{
136135}
137136
branches/old_menus/src/emu/bus/cbmiec/cmdhd.h
r29633r29634
2020#include "imagedev/harddriv.h"
2121#include "machine/6522via.h"
2222#include "machine/i8255.h"
23#include "machine/scsibus.h"
24#include "machine/scsicb.h"
25#include "machine/scsihd.h"
23#include "bus/scsi/scsihd.h"
2624
2725
2826
r29633r29634
6563   void cbm_iec_reset(int state);
6664
6765   required_device<cpu_device> m_maincpu;
68   required_device<scsicb_device> m_scsibus;
66   required_device<SCSI_PORT_DEVICE> m_scsibus;
6967};
7068
7169
branches/old_menus/src/emu/bus/ti99_peb/hfdc.c
r29633r29634
430430   if (VERBOSE>6) LOG("hfdc: motor off\n");
431431}
432432
433const smc92x4_interface ti99_smc92x4_interface =
434{
435   FALSE,      /* do not use the full track layout */
436};
437
438static const mm58274c_interface floppy_mm58274c_interface =
439{
440   1,  /*  mode 24*/
441   0   /*  first day of week */
442};
443
444433MACHINE_CONFIG_FRAGMENT( ti99_hfdc )
445   MCFG_SMC92X4_ADD(FDC_TAG, ti99_smc92x4_interface )
434   MCFG_DEVICE_ADD(FDC_TAG, SMC92X4, 0)
446435   MCFG_SMC92X4_INTRQ_CALLBACK(WRITELINE(myarc_hfdc_device, intrq_w))
447436   MCFG_SMC92X4_DIP_CALLBACK(WRITELINE(myarc_hfdc_device, dip_w))
448437   MCFG_SMC92X4_AUXBUS_OUT_CALLBACK(WRITE8(myarc_hfdc_device, auxbus_out))
449438   MCFG_SMC92X4_AUXBUS_IN_CALLBACK(READ8(myarc_hfdc_device, auxbus_in))
450439   MCFG_SMC92X4_DMA_IN_CALLBACK(READ8(myarc_hfdc_device, read_buffer))
451440   MCFG_SMC92X4_DMA_OUT_CALLBACK(WRITE8(myarc_hfdc_device, write_buffer))
452   MCFG_MM58274C_ADD(CLOCK_TAG, floppy_mm58274c_interface)
441   MCFG_SMC92X4_FULL_TRACK_LAYOUT(FALSE)    /* do not use the full track layout */
442
443   MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0)
444   MCFG_MM58274C_MODE24(1) // 24 hour
445   MCFG_MM58274C_DAY1(0)   // sunday
453446MACHINE_CONFIG_END
454447
455448ROM_START( ti99_hfdc )
branches/old_menus/src/emu/bus/ti99_peb/bwg.c
r29633r29634
594594   if (subdevice("3")!=NULL) m_floppy[3] = static_cast<floppy_image_device*>(subdevice("3")->first_subdevice());
595595}
596596
597static const mm58274c_interface bwg_mm58274c_interface =
598{
599   1,  /*  mode 24*/
600   0   /*  first day of week */
601};
602
603597INPUT_PORTS_START( bwg_fdc )
604598   PORT_START( "BWGDIP1" )
605599   PORT_DIPNAME( 0x01, 0x00, "BwG step rate" )
r29633r29634
634628   MCFG_WD1773x_ADD(FDC_TAG, XTAL_8MHz)
635629   MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(snug_bwg_device, fdc_irq_w))
636630   MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(snug_bwg_device, fdc_drq_w))
637   MCFG_MM58274C_ADD(CLOCK_TAG, bwg_mm58274c_interface)
638631
632   MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0)
633   MCFG_MM58274C_MODE24(1) // 24 hour
634   MCFG_MM58274C_DAY1(0)   // sunday
635
639636   MCFG_FLOPPY_DRIVE_ADD("0", bwg_floppies, "525dd", snug_bwg_device::floppy_formats)
640637   MCFG_FLOPPY_DRIVE_ADD("1", bwg_floppies, "525dd", snug_bwg_device::floppy_formats)
641638   MCFG_FLOPPY_DRIVE_ADD("2", bwg_floppies, NULL, snug_bwg_device::floppy_formats)
r29633r29634
11151112   { PFLOPPY_0, PFLOPPY_1, PFLOPPY_2, PFLOPPY_3 }
11161113};
11171114
1118static const mm58274c_interface floppyleg_mm58274c_interface =
1119{
1120   1,  /*  mode 24*/
1121   0   /*  first day of week */
1122};
1123
11241115INPUT_PORTS_START( bwg_fdc_legacy )
11251116   PORT_START( "BWGDIP1" )
11261117   PORT_DIPNAME( 0x01, 0x00, "BwG step rate" )
r29633r29634
11421133
11431134MACHINE_CONFIG_FRAGMENT( bwg_fdc_legacy )
11441135   MCFG_WD1773_ADD(FDCLEG_TAG, bwgleg_wd17xx_interface )
1145   MCFG_MM58274C_ADD(CLOCK_TAG, floppyleg_mm58274c_interface)
1136
1137   MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0)
1138   MCFG_MM58274C_MODE24(1) // 24 hour
1139   MCFG_MM58274C_DAY1(0)   // sunday
11461140MACHINE_CONFIG_END
11471141
11481142ROM_START( bwg_fdc_legacy )
branches/old_menus/src/emu/bus/abcbus/hdc.h
r29633r29634
1818#include "abcbus.h"
1919#include "cpu/z80/z80.h"
2020#include "cpu/z80/z80daisy.h"
21#include "machine/scsibus.h"
22#include "machine/scsicb.h"
23#include "machine/scsihd.h"
21#include "bus/scsi/scsihd.h"
2422
2523
2624
r29633r29634
5149
5250private:
5351   required_device<cpu_device> m_maincpu;
54   required_device<scsibus_device> m_sasibus;
5552};
5653
5754
branches/old_menus/src/emu/bus/abcbus/lux21056.c
r29633r29634
7575*/
7676
7777#include "lux21056.h"
78#include "bus/scsi/s1410.h"
7879
7980
8081
r29633r29634
207208   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, luxor_55_21056_device, io_write_byte),
208209};
209210
210WRITE_LINE_MEMBER( luxor_55_21056_device::sasi_bsy_w )
211WRITE_LINE_MEMBER( luxor_55_21056_device::write_sasi_bsy )
211212{
212   if (state)
213   m_sasi_bsy = state;
214
215   if (m_sasi_bsy)
213216   {
214      m_sasibus->scsi_sel_w(0);
217      m_sasibus->write_sel(!m_sasi_bsy);
215218   }
216219}
217220
218WRITE_LINE_MEMBER( luxor_55_21056_device::sasi_io_w )
221WRITE_LINE_MEMBER( luxor_55_21056_device::write_sasi_io )
219222{
220   if (!state)
223   m_sasi_io = state;
224
225   if (!m_sasi_io)
221226   {
222      m_sasibus->scsi_data_w(m_sasi_data);
227      m_sasi_data_out->write(m_sasi_data);
223228   }
224229   else
225230   {
226      m_sasibus->scsi_data_w(0);
231      m_sasi_data_out->write(0);
227232   }
228233}
229234
230WRITE_LINE_MEMBER( luxor_55_21056_device::sasi_req_w )
235WRITE_LINE_MEMBER( luxor_55_21056_device::write_sasi_req )
231236{
232   if (state)
237   m_sasi_req = state;
238
239   if (m_sasi_req)
233240   {
234      m_req = 0;
235      m_sasibus->scsi_ack_w(!m_req);
241      m_sasibus->write_ack(!m_sasi_req);
236242   }
237243}
238244
245WRITE_LINE_MEMBER( luxor_55_21056_device::write_sasi_cd )
246{
247   m_sasi_cd = state;
248}
239249
250WRITE_LINE_MEMBER( luxor_55_21056_device::write_sasi_msg )
251{
252   m_sasi_msg = state;
253}
254
240255//-------------------------------------------------
241256//  MACHINE_DRIVER( luxor_55_21056 )
242257//-------------------------------------------------
r29633r29634
249264
250265   MCFG_Z80DMA_ADD(Z80DMA_TAG, XTAL_8MHz/2, dma_intf)
251266
252   MCFG_SCSIBUS_ADD(SASIBUS_TAG)
253   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":harddisk0", S1410, SCSI_ID_0)
254   MCFG_SCSICB_ADD(SASIBUS_TAG ":host")
255   MCFG_SCSICB_BSY_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, luxor_55_21056_device, sasi_bsy_w))
256   MCFG_SCSICB_IO_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, luxor_55_21056_device, sasi_io_w))
257   MCFG_SCSICB_REQ_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, luxor_55_21056_device, sasi_req_w))
267   MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0)
268   MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in")
269   MCFG_SCSI_REQ_HANDLER(WRITELINE(luxor_55_21056_device, write_sasi_req))
270   MCFG_SCSI_IO_HANDLER(WRITELINE(luxor_55_21056_device, write_sasi_io))
271   MCFG_SCSI_CD_HANDLER(WRITELINE(luxor_55_21056_device, write_sasi_cd))
272   MCFG_SCSI_MSG_HANDLER(WRITELINE(luxor_55_21056_device, write_sasi_msg))
273   MCFG_SCSI_BSY_HANDLER(WRITELINE(luxor_55_21056_device, write_sasi_bsy))
274   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", S1410, SCSI_ID_0)
275
276   MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", SASIBUS_TAG)
277   MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0)
258278MACHINE_CONFIG_END
259279
260280
r29633r29634
329349      device_abcbus_card_interface(mconfig, *this),
330350      m_maincpu(*this, Z80_TAG),
331351      m_dma(*this, Z80DMA_TAG),
332      m_sasibus(*this, SASIBUS_TAG ":host"),
352      m_sasibus(*this, SASIBUS_TAG),
353      m_sasi_data_out(*this, "sasi_data_out"),
354      m_sasi_data_in(*this, "sasi_data_in"),
333355      m_s1(*this, "S1"),
334356      m_cs(false),
335357      m_rdy(0),
336      m_req(0),
358      m_sasi_req(0),
359      m_sasi_io(0),
360      m_sasi_cd(0),
361      m_sasi_msg(0),
362      m_sasi_bsy(0),
337363      m_stat(0),
338364      m_sasi_data(0)
339365{
r29633r29634
349375   // state saving
350376   save_item(NAME(m_cs));
351377   save_item(NAME(m_rdy));
352   save_item(NAME(m_req));
353378   save_item(NAME(m_inp));
354379   save_item(NAME(m_out));
355380   save_item(NAME(m_stat));
381   save_item(NAME(m_sasi_req));
382   save_item(NAME(m_sasi_io));
383   save_item(NAME(m_sasi_cd));
384   save_item(NAME(m_sasi_msg));
385   save_item(NAME(m_sasi_bsy));
356386   save_item(NAME(m_sasi_data));
357387}
358388
r29633r29634
492522
493523   data |= m_rdy ^ STAT_DIR;
494524
495   data |= (m_req || m_sasibus->scsi_req_r()) << 1;
496   data |= m_sasibus->scsi_io_r() << 2;
497   data |= !m_sasibus->scsi_cd_r() << 3;
498   data |= !m_sasibus->scsi_msg_r() << 4;
499   data |= !m_sasibus->scsi_bsy_r() << 5;
525   data |= !m_sasi_req << 1;
526   data |= !m_sasi_io << 2;
527   data |= !m_sasi_cd << 3;
528   data |= !m_sasi_msg << 4;
529   data |= !m_sasi_bsy << 5;
500530
501531   return data ^ 0xff;
502532}
r29633r29634
546576
547577READ8_MEMBER( luxor_55_21056_device::sasi_data_r )
548578{
549   UINT8 data = m_sasibus->scsi_data_r();
579   UINT8 data = m_sasi_data_in->read();
550580
551   m_req = !m_sasibus->scsi_req_r();
552   m_sasibus->scsi_ack_w(!m_req);
581   m_sasibus->write_ack(!m_sasi_req);
553582
554583   return data;
555584}
r29633r29634
563592{
564593   m_sasi_data = data;
565594
566   if (!m_sasibus->scsi_io_r())
595   if (!m_sasi_io)
567596   {
568      m_sasibus->scsi_data_w(m_sasi_data);
597      m_sasi_data_out->write(m_sasi_data);
569598   }
570599
571   m_req = !m_sasibus->scsi_req_r();
572   m_sasibus->scsi_ack_w(!m_req);
600   m_sasibus->write_ack(!m_sasi_req);
573601}
574602
575603
r29633r29634
613641
614642WRITE8_MEMBER( luxor_55_21056_device::sasi_sel_w )
615643{
616   m_sasibus->scsi_sel_w(!m_sasibus->scsi_bsy_r());
644   m_sasibus->write_sel(!m_sasi_bsy);
617645}
618646
619647
r29633r29634
635663
636664WRITE8_MEMBER( luxor_55_21056_device::sasi_rst_w )
637665{
638   m_sasibus->scsi_rst_w(1);
639   m_sasibus->scsi_rst_w(0);
666   m_sasibus->write_rst(1);
667   m_sasibus->write_rst(0);
640668}
641669
642670
branches/old_menus/src/emu/bus/abcbus/lux21056.h
r29633r29634
1616
1717#include "emu.h"
1818#include "abcbus.h"
19#include "bus/scsi/s1410.h"
19#include "bus/scsi/scsi.h"
2020#include "cpu/z80/z80.h"
2121#include "cpu/z80/z80daisy.h"
22#include "machine/scsibus.h"
23#include "machine/scsicb.h"
24#include "machine/scsihd.h"
2522#include "machine/z80dma.h"
2623
2724
r29633r29634
6259   DECLARE_READ8_MEMBER( io_read_byte );
6360   DECLARE_WRITE8_MEMBER( io_write_byte );
6461
65   DECLARE_WRITE_LINE_MEMBER( sasi_bsy_w );
66   DECLARE_WRITE_LINE_MEMBER( sasi_io_w );
67   DECLARE_WRITE_LINE_MEMBER( sasi_req_w );
62   DECLARE_WRITE_LINE_MEMBER( write_sasi_req );
63   DECLARE_WRITE_LINE_MEMBER( write_sasi_io );
64   DECLARE_WRITE_LINE_MEMBER( write_sasi_cd );
65   DECLARE_WRITE_LINE_MEMBER( write_sasi_msg );
66   DECLARE_WRITE_LINE_MEMBER( write_sasi_bsy );
6867
6968protected:
7069   // device-level overrides
r29633r29634
8483
8584   required_device<cpu_device> m_maincpu;
8685   required_device<z80dma_device> m_dma;
87   required_device<scsicb_device> m_sasibus;
86   required_device<SCSI_PORT_DEVICE> m_sasibus;
87   required_device<output_latch_device> m_sasi_data_out;
88   required_device<input_buffer_device> m_sasi_data_in;
8889   required_ioport m_s1;
8990
9091   int m_cs;
9192   int m_rdy;
92   int m_req;
93   int m_sasi_req;
94   int m_sasi_io;
95   int m_sasi_cd;
96   int m_sasi_msg;
97   int m_sasi_bsy;
9398
9499   UINT8 m_inp;
95100   UINT8 m_out;
branches/old_menus/src/emu/bus/abcbus/lux4105.c
r29633r29634
1010*********************************************************************/
1111
1212#include "lux4105.h"
13#include "machine/scsibus.h"
14#include "machine/scsicb.h"
15#include "machine/scsihd.h"
13#include "bus/scsi/scsihd.h"
1614#include "bus/scsi/s1410.h"
1715
1816
r29633r29634
3230const device_type LUXOR_4105 = &device_creator<luxor_4105_device>;
3331
3432
35WRITE_LINE_MEMBER( luxor_4105_device::sasi_bsy_w )
33WRITE_LINE_MEMBER( luxor_4105_device::write_sasi_bsy )
3634{
35   m_sasi_bsy = state;
36
3737   if (state)
3838   {
39      m_sasibus->scsi_sel_w(0);
39      m_sasibus->write_sel(0);
4040   }
4141}
4242
43WRITE_LINE_MEMBER( luxor_4105_device::sasi_io_w )
43WRITE_LINE_MEMBER( luxor_4105_device::write_sasi_io )
4444{
45   if (!state)
45   m_sasi_io = state;
46
47   if (!m_sasi_io)
4648   {
47      m_sasibus->scsi_data_w(m_data);
49      m_sasi_data_out->write(m_data);
4850   }
4951
5052   update_trrq_int();
5153}
5254
53WRITE_LINE_MEMBER( luxor_4105_device::sasi_req_w )
55WRITE_LINE_MEMBER( luxor_4105_device::write_sasi_req )
5456{
55   if (state)
57   m_sasi_req = state;
58
59   if (m_sasi_req)
5660   {
57      m_sasibus->scsi_ack_w(0);
61      m_sasibus->write_ack(0);
5862   }
5963
6064   update_trrq_int();
6165}
6266
67WRITE_LINE_MEMBER( luxor_4105_device::write_sasi_cd )
68{
69   m_sasi_cd = state;
70}
6371
72
6473//-------------------------------------------------
6574//  MACHINE_DRIVER( luxor_4105 )
6675//-------------------------------------------------
6776
6877static MACHINE_CONFIG_FRAGMENT( luxor_4105 )
69   MCFG_SCSIBUS_ADD(SASIBUS_TAG)
70   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":harddisk0", S1410, SCSI_ID_0)
71   MCFG_SCSICB_ADD(SASIBUS_TAG ":host")
72   MCFG_SCSICB_BSY_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, luxor_4105_device, sasi_bsy_w))
73   MCFG_SCSICB_IO_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, luxor_4105_device, sasi_io_w))
74   MCFG_SCSICB_REQ_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, luxor_4105_device, sasi_req_w))
78   MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0)
79   MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in")
80   MCFG_SCSI_BSY_HANDLER(WRITELINE(luxor_4105_device, write_sasi_bsy))
81   MCFG_SCSI_REQ_HANDLER(WRITELINE(luxor_4105_device, write_sasi_req))
82   MCFG_SCSI_CD_HANDLER(WRITELINE(luxor_4105_device, write_sasi_cd))
83   MCFG_SCSI_IO_HANDLER(WRITELINE(luxor_4105_device, write_sasi_io))
84   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", S1410, SCSI_ID_0)
85
86   MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", SASIBUS_TAG)
87   MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0)
7588MACHINE_CONFIG_END
7689
7790
r29633r29634
131144
132145inline void luxor_4105_device::update_trrq_int()
133146{
134   int cd = !m_sasibus->scsi_cd_r();
135   int req = !m_sasibus->scsi_req_r();
147   int cd = !m_sasi_cd;
148   int req = !m_sasi_req;
136149   int trrq = !(cd & !req);
137150
138151   if (BIT(m_dma, 5))
r29633r29634
167180luxor_4105_device::luxor_4105_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
168181   : device_t(mconfig, LUXOR_4105, "Luxor 4105", tag, owner, clock, "lux4105", __FILE__),
169182      device_abcbus_card_interface(mconfig, *this),
170      m_sasibus(*this, SASIBUS_TAG ":host"),
183      m_sasibus(*this, SASIBUS_TAG),
184      m_sasi_data_out(*this, "sasi_data_out"),
185      m_sasi_data_in(*this, "sasi_data_in"),
171186      m_1e(*this, "1E"),
172187      m_5e(*this, "5E")
173188{
r29633r29634
197212   m_data = 0;
198213   m_dma = 0;
199214
200   m_sasibus->scsi_rst_w(1);
201   m_sasibus->scsi_rst_w(0);
215   m_sasibus->write_rst(1);
216   m_sasibus->write_rst(0);
202217
203218   m_slot->trrq_w(1);
204219}
r29633r29634
249264
250265      */
251266
252      data = m_sasibus->scsi_bsy_r();
253      data |= m_sasibus->scsi_req_r() << 2;
254      data |= m_sasibus->scsi_cd_r() << 3;
255      data |= m_sasibus->scsi_io_r() << 6;
267      data = m_sasi_bsy;
268      data |= m_sasi_req << 2;
269      data |= m_sasi_cd << 3;
270      data |= m_sasi_io << 6;
256271   }
257272
258273   return data;
r29633r29634
269284
270285   if (m_cs)
271286   {
272      if (!m_sasibus->scsi_bsy_r())
287      if (!m_sasi_bsy)
273288      {
274289         data = m_1e->read();
275290      }
276291      else
277292      {
278         if (m_sasibus->scsi_io_r())
293         if (m_sasi_io)
279294         {
280            data = m_sasibus->scsi_data_r();
295            data = m_sasi_data_in->read();
281296
282            if (m_sasibus->scsi_req_r())
297            if (m_sasi_req)
283298            {
284               m_sasibus->scsi_ack_w(1);
299               m_sasibus->write_ack(1);
285300            }
286301         }
287302      }
r29633r29634
301316   {
302317      m_data = data;
303318
304      if (!m_sasibus->scsi_io_r())
319      if (!m_sasi_io)
305320      {
306         m_sasibus->scsi_data_w(m_data);
321         m_sasi_data_out->write(m_data);
307322
308         if (m_sasibus->scsi_req_r())
323         if (m_sasi_req)
309324         {
310            m_sasibus->scsi_ack_w(1);
325            m_sasibus->write_ack(1);
311326         }
312327      }
313328   }
r29633r29634
322337{
323338   if (m_cs)
324339   {
325      m_sasibus->scsi_sel_w(1);
340      m_sasibus->write_sel(1);
326341   }
327342}
328343
r29633r29634
338353      m_data = 0;
339354      m_dma = 0;
340355
341      m_sasibus->scsi_rst_w(1);
342      m_sasibus->scsi_rst_w(0);
356      m_sasibus->write_rst(1);
357      m_sasibus->write_rst(0);
343358   }
344359}
345360
branches/old_menus/src/emu/bus/abcbus/lux4105.h
r29633r29634
1717
1818#include "emu.h"
1919#include "abcbus.h"
20#include "machine/scsicb.h"
20#include "bus/scsi/scsi.h"
2121
2222
2323
r29633r29634
3636// ======================> luxor_4105_device
3737
3838class luxor_4105_device :  public device_t,
39                     public device_abcbus_card_interface
39   public device_abcbus_card_interface
4040{
4141public:
4242   // construction/destruction
r29633r29634
4747   virtual ioport_constructor device_input_ports() const;
4848
4949   // not really public
50   DECLARE_WRITE_LINE_MEMBER( sasi_bsy_w );
51   DECLARE_WRITE_LINE_MEMBER( sasi_io_w );
52   DECLARE_WRITE_LINE_MEMBER( sasi_req_w );
50   DECLARE_WRITE_LINE_MEMBER( write_sasi_bsy );
51   DECLARE_WRITE_LINE_MEMBER( write_sasi_req );
52   DECLARE_WRITE_LINE_MEMBER( write_sasi_cd );
53   DECLARE_WRITE_LINE_MEMBER( write_sasi_io );
5354
5455protected:
5556   // device-level overrides
r29633r29634
6970private:
7071   inline void update_trrq_int();
7172
72   required_device<scsicb_device> m_sasibus;
73   required_device<SCSI_PORT_DEVICE> m_sasibus;
74   required_device<output_latch_device> m_sasi_data_out;
75   required_device<input_buffer_device> m_sasi_data_in;
7376   required_ioport m_1e;
7477   required_ioport m_5e;
7578
7679   int m_cs;
7780   UINT8 m_data;
7881   UINT8 m_dma;
82
83   int m_sasi_bsy;
84   int m_sasi_req;
85   int m_sasi_cd;
86   int m_sasi_io;
7987};
8088
8189
branches/old_menus/src/emu/bus/abcbus/hdc.c
r29633r29634
8989   MCFG_CPU_IO_MAP(abc_hdc_io)
9090   MCFG_CPU_CONFIG(daisy_chain)
9191
92   MCFG_SCSIBUS_ADD(SASIBUS_TAG)
93   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":harddisk0", SCSIHD, SCSI_ID_0)
94   MCFG_SCSICB_ADD(SASIBUS_TAG ":host")
92   MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0)
93   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
9594MACHINE_CONFIG_END
9695
9796
r29633r29634
118117abc_hdc_device::abc_hdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
119118   : device_t(mconfig, ABC_HDC, "ABC HDC", tag, owner, clock, "abc_hdc", __FILE__),
120119      device_abcbus_card_interface(mconfig, *this),
121      m_maincpu(*this, Z80_TAG),
122      m_sasibus(*this, SASIBUS_TAG)
120      m_maincpu(*this, Z80_TAG)
123121{
124122}
125123
branches/old_menus/src/emu/bus/x68k/x68k_scsiext.c
r29633r29634
77 */
88
99#include "emu.h"
10#include "machine/scsibus.h"
11#include "machine/scsihd.h"
10#include "bus/scsi/scsi.h"
11#include "bus/scsi/scsihd.h"
1212#include "machine/mb89352.h"
1313#include "x68k_scsiext.h"
1414
r29633r29634
3434
3535// device machine config
3636static MACHINE_CONFIG_FRAGMENT( x68k_scsiext )
37   MCFG_SCSIBUS_ADD("scsi")
38   MCFG_SCSIDEV_ADD("scsi:harddisk0", SCSIHD, SCSI_ID_0)
39   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_1)
40   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_2)
41   MCFG_SCSIDEV_ADD("scsi:harddisk3", SCSIHD, SCSI_ID_3)
42   MCFG_SCSIDEV_ADD("scsi:harddisk4", SCSIHD, SCSI_ID_4)
43   MCFG_SCSIDEV_ADD("scsi:harddisk5", SCSIHD, SCSI_ID_5)
44   MCFG_SCSIDEV_ADD("scsi:harddisk6", SCSIHD, SCSI_ID_6)
45   MCFG_DEVICE_ADD("scsi:mb89352", MB89352A, 0)
46   MCFG_MB89352A_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, x68k_scsiext_device, irq_w))
47   MCFG_MB89352A_DRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, x68k_scsiext_device, drq_w))
37   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
38   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
39   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1)
40   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "harddisk", SCSIHD, SCSI_ID_2)
41   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE4, "harddisk", SCSIHD, SCSI_ID_3)
42   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE5, "harddisk", SCSIHD, SCSI_ID_4)
43   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE6, "harddisk", SCSIHD, SCSI_ID_5)
44   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE7, "harddisk", SCSIHD, SCSI_ID_6)
45
46   MCFG_DEVICE_ADD("mb89352", MB89352A, 0)
47   MCFG_LEGACY_SCSI_PORT("scsi")
48   MCFG_MB89352A_IRQ_CB(WRITELINE(x68k_scsiext_device, irq_w))
49   MCFG_MB89352A_DRQ_CB(WRITELINE(x68k_scsiext_device, drq_w))
4850MACHINE_CONFIG_END
4951
5052machine_config_constructor x68k_scsiext_device::device_mconfig_additions() const
r29633r29634
5557x68k_scsiext_device::x68k_scsiext_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
5658      : device_t(mconfig, X68K_SCSIEXT, "Sharp CZ-6BS1 SCSI-1", tag, owner, clock, "x68k_cz6bs1", __FILE__),
5759      device_x68k_expansion_card_interface(mconfig, *this),
58      m_spc(*this, "scsi:mb89352")
60      m_spc(*this, "mb89352")
5961{
6062}
6163
branches/old_menus/src/emu/emu.mak
r29633r29634
171171   $(EMUMACHINE)/netlist.o     \
172172   $(EMUMACHINE)/nvram.o       \
173173   $(EMUMACHINE)/ram.o         \
174   $(EMUMACHINE)/legscsi.o     \
174175   $(EMUMACHINE)/terminal.o    \
175176
176177EMUIMAGEDEVOBJS = \
branches/old_menus/src/emu/machine/scsicb.c
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/*
4
5scsicb.c
6
7Implementation of a raw SCSI/SASI bus for machines that don't use a SCSI
8controler chip such as the RM Nimbus, which implements it as a bunch of
974LS series chips.
10
11*/
12
13#include "scsicb.h"
14#include "scsibus.h"
15
16#define VERBOSE_LEVEL ( 0 )
17
18INLINE void ATTR_PRINTF( 3, 4 ) verboselog( int n_level, running_machine &machine, const char *s_fmt, ... )
19{
20   if( VERBOSE_LEVEL >= n_level )
21   {
22      va_list v;
23      char buf[ 32768 ];
24      va_start( v, s_fmt );
25      vsprintf( buf, s_fmt, v );
26      va_end( v );
27      logerror( "%s: %s", machine.describe_context( ), buf );
28   }
29}
30
31scsicb_device::scsicb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
32   : scsidev_device(mconfig, SCSICB, "SCSI callback", tag, owner, clock, "scsicb", __FILE__),
33   m_bsy_handler(*this),
34   m_sel_handler(*this),
35   m_cd_handler(*this),
36   m_io_handler(*this),
37   m_msg_handler(*this),
38   m_req_handler(*this),
39   m_ack_handler(*this),
40   m_atn_handler(*this),
41   m_rst_handler(*this)
42{
43}
44
45void scsicb_device::device_start()
46{
47   scsidev_device::device_start();
48
49   linestate = 0;
50
51   m_bsy_handler.resolve_safe();
52   m_sel_handler.resolve_safe();
53   m_cd_handler.resolve_safe();
54   m_io_handler.resolve_safe();
55   m_msg_handler.resolve_safe();
56   m_req_handler.resolve_safe();
57   m_ack_handler.resolve_safe();
58   m_atn_handler.resolve_safe();
59   m_rst_handler.resolve_safe();
60}
61
62void scsicb_device::scsi_in( UINT32 data, UINT32 mask )
63{
64   linestate = data;
65
66   trigger_callback( mask, SCSI_MASK_BSY, m_bsy_handler );
67   trigger_callback( mask, SCSI_MASK_SEL, m_sel_handler );
68   trigger_callback( mask, SCSI_MASK_CD, m_cd_handler );
69   trigger_callback( mask, SCSI_MASK_IO, m_io_handler );
70   trigger_callback( mask, SCSI_MASK_MSG, m_msg_handler );
71   trigger_callback( mask, SCSI_MASK_REQ, m_req_handler );
72   trigger_callback( mask, SCSI_MASK_ACK, m_ack_handler );
73   trigger_callback( mask, SCSI_MASK_ATN, m_atn_handler );
74   trigger_callback( mask, SCSI_MASK_RST, m_rst_handler );
75}
76
77UINT8 scsicb_device::scsi_data_r()
78{
79   UINT8 data = linestate & SCSI_MASK_DATA;
80   verboselog( 1, machine(), "%s scsi_data_r() %02x\n", tag(), data );
81   return data;
82}
83
84void scsicb_device::scsi_data_w( UINT8 data )
85{
86   verboselog( 1, machine(), "%s scsi_data_w( %02x )\n", tag(), data );
87   scsi_out( data, SCSI_MASK_DATA );
88}
89
90READ8_MEMBER( scsicb_device::scsi_data_r )
91{
92   return scsi_data_r();
93}
94
95WRITE8_MEMBER( scsicb_device::scsi_data_w )
96{
97   scsi_data_w( data );
98}
99
100READ_LINE_MEMBER( scsicb_device::scsi_bsy_r ) { return get_scsi_line(SCSI_MASK_BSY); }
101READ_LINE_MEMBER( scsicb_device::scsi_sel_r ) { return get_scsi_line(SCSI_MASK_SEL); }
102READ_LINE_MEMBER( scsicb_device::scsi_cd_r ) { return get_scsi_line(SCSI_MASK_CD); }
103READ_LINE_MEMBER( scsicb_device::scsi_io_r ) { return get_scsi_line(SCSI_MASK_IO); }
104READ_LINE_MEMBER( scsicb_device::scsi_msg_r ) { return get_scsi_line(SCSI_MASK_MSG); }
105READ_LINE_MEMBER( scsicb_device::scsi_req_r ) { return get_scsi_line(SCSI_MASK_REQ); }
106READ_LINE_MEMBER( scsicb_device::scsi_ack_r ) { return get_scsi_line(SCSI_MASK_ACK); }
107READ_LINE_MEMBER( scsicb_device::scsi_atn_r ) { return get_scsi_line(SCSI_MASK_ATN); }
108READ_LINE_MEMBER( scsicb_device::scsi_rst_r ) { return get_scsi_line(SCSI_MASK_RST); }
109
110WRITE_LINE_MEMBER( scsicb_device::scsi_bsy_w ) { set_scsi_line(SCSI_MASK_BSY, state); }
111WRITE_LINE_MEMBER( scsicb_device::scsi_sel_w ) { set_scsi_line(SCSI_MASK_SEL, state); }
112WRITE_LINE_MEMBER( scsicb_device::scsi_cd_w ) { set_scsi_line(SCSI_MASK_CD, state); }
113WRITE_LINE_MEMBER( scsicb_device::scsi_io_w ) { set_scsi_line(SCSI_MASK_IO, state); }
114WRITE_LINE_MEMBER( scsicb_device::scsi_msg_w ) { set_scsi_line(SCSI_MASK_MSG, state); }
115WRITE_LINE_MEMBER( scsicb_device::scsi_req_w ) { set_scsi_line(SCSI_MASK_REQ, state); }
116WRITE_LINE_MEMBER( scsicb_device::scsi_ack_w ) { set_scsi_line(SCSI_MASK_ACK, state); }
117WRITE_LINE_MEMBER( scsicb_device::scsi_atn_w ) { set_scsi_line(SCSI_MASK_ATN, state); }
118WRITE_LINE_MEMBER( scsicb_device::scsi_rst_w ) { set_scsi_line(SCSI_MASK_RST, state); }
119
120UINT8 scsicb_device::get_scsi_line( UINT32 mask )
121{
122   UINT8 state;
123
124   if( ( linestate & mask ) != 0 )
125   {
126      state = 1;
127   }
128   else
129   {
130      state = 0;
131   }
132
133   verboselog( 1, machine(), "%s get_scsi_line %s %d\n", tag(), get_line_name( mask ), state );
134
135   return state;
136}
137
138void scsicb_device::set_scsi_line( UINT32 mask, UINT8 state )
139{
140   verboselog( 1, machine(), "%s set_scsi_line %s %d\n", tag(), get_line_name( mask ), state );
141
142   if( state )
143   {
144      scsi_out( mask, mask );
145   }
146   else
147   {
148      scsi_out( 0, mask );
149   }
150}
151
152void scsicb_device::trigger_callback( UINT32 update_mask, UINT32 line_mask, devcb2_write_line &write_line )
153{
154   if( ( update_mask & line_mask ) != 0 && !write_line.isnull() )
155   {
156      UINT8 state;
157
158      if( ( linestate & line_mask ) != 0 )
159      {
160         state = 1;
161      }
162      else
163      {
164         state = 0;
165      }
166
167      verboselog( 1, machine(), "%s trigger_callback %s %d\n", tag(), get_line_name( line_mask ), state );
168
169      write_line( state );
170   }
171}
172
173const char *scsicb_device::get_line_name( UINT32 mask )
174{
175   switch( mask )
176   {
177   case SCSI_MASK_BSY:
178      return "bsy";
179
180   case SCSI_MASK_SEL:
181      return "sel";
182
183   case SCSI_MASK_CD:
184      return "cd";
185
186   case SCSI_MASK_IO:
187      return "io";
188
189   case SCSI_MASK_MSG:
190      return "msg";
191
192   case SCSI_MASK_REQ:
193      return "req";
194
195   case SCSI_MASK_ACK:
196      return "ack";
197
198   case SCSI_MASK_ATN:
199      return "atn";
200
201   case SCSI_MASK_RST:
202      return "rst";
203   }
204
205   return "?";
206}
207
208const device_type SCSICB = &device_creator<scsicb_device>;
branches/old_menus/src/emu/machine/cdu76s.c
r29633r29634
1#include "cdu76s.h"
2
3void sony_cdu76s_device::ExecCommand()
4{
5   switch ( command[0] )
6   {
7      case 0x12: // INQUIRY
8         logerror("CDU76S: INQUIRY\n");
9         m_phase = SCSI_PHASE_DATAIN;
10         m_status_code = SCSI_STATUS_CODE_GOOD;
11         m_transfer_length = SCSILengthFromUINT8( &command[ 4 ] );
12         break;
13   }
14}
15
16void sony_cdu76s_device::ReadData( UINT8 *data, int dataLength )
17{
18   switch ( command[0] )
19   {
20      case 0x12: // INQUIRY
21         memset( data, 0, dataLength );
22         data[0] = 0x05; // device is present, device is CD/DVD (MMC-3)
23         data[1] = 0x80; // media is removable
24         data[2] = 0x05; // device complies with SPC-3 standard
25         data[3] = 0x02; // response data format = SPC-3 standard
26         // some Konami games freak out if this isn't "Sony", so we'll lie
27         // this is the actual drive on my Nagano '98 board
28         strcpy((char *)&data[8], "Sony");
29         strcpy((char *)&data[16], "CDU-76S");
30         strcpy((char *)&data[32], "1.0");
31         break;
32
33      default:
34         scsicd_device::ReadData( data, dataLength );
35         break;
36   }
37}
38
39// device type definition
40const device_type CDU76S = &device_creator<sony_cdu76s_device>;
41
42sony_cdu76s_device::sony_cdu76s_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
43   scsicd_device(mconfig, CDU76S, "Sony CDU-76S", tag, owner, clock, "cdu76s", __FILE__)
44{
45}
branches/old_menus/src/emu/machine/scsicb.h
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/*
4
5scsicb.h
6
7Implementation of a raw SCSI/SASI bus for machines that don't use a SCSI
8controler chip such as the RM Nimbus, which implements it as a bunch of
974LS series chips.
10
11*/
12
13#pragma once
14
15#ifndef _SCSICB_H_
16#define _SCSICB_H_
17
18#include "scsidev.h"
19
20class scsicb_device : public scsidev_device
21{
22public:
23   // construction/destruction
24   scsicb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
25
26   // static configuration helpers
27   template<class _Object> static devcb2_base &set_bsy_handler(device_t &device, _Object object) { return downcast<scsicb_device &>(device).m_bsy_handler.set_callback(object); }
28   template<class _Object> static devcb2_base &set_sel_handler(device_t &device, _Object object) { return downcast<scsicb_device &>(device).m_sel_handler.set_callback(object); }
29   template<class _Object> static devcb2_base &set_cd_handler(device_t &device, _Object object) { return downcast<scsicb_device &>(device).m_cd_handler.set_callback(object); }
30   template<class _Object> static devcb2_base &set_io_handler(device_t &device, _Object object) { return downcast<scsicb_device &>(device).m_io_handler.set_callback(object); }
31   template<class _Object> static devcb2_base &set_msg_handler(device_t &device, _Object object) { return downcast<scsicb_device &>(device).m_msg_handler.set_callback(object); }
32   template<class _Object> static devcb2_base &set_req_handler(device_t &device, _Object object) { return downcast<scsicb_device &>(device).m_req_handler.set_callback(object); }
33   template<class _Object> static devcb2_base &set_ack_handler(device_t &device, _Object object) { return downcast<scsicb_device &>(device).m_ack_handler.set_callback(object); }
34   template<class _Object> static devcb2_base &set_atn_handler(device_t &device, _Object object) { return downcast<scsicb_device &>(device).m_atn_handler.set_callback(object); }
35   template<class _Object> static devcb2_base &set_rst_handler(device_t &device, _Object object) { return downcast<scsicb_device &>(device).m_rst_handler.set_callback(object); }
36
37   virtual void scsi_in( UINT32 data, UINT32 mask );
38
39   UINT8 scsi_data_r();
40   void scsi_data_w( UINT8 data );
41
42   DECLARE_READ8_MEMBER( scsi_data_r );
43   DECLARE_WRITE8_MEMBER( scsi_data_w );
44
45   DECLARE_READ_LINE_MEMBER( scsi_bsy_r );
46   DECLARE_READ_LINE_MEMBER( scsi_sel_r );
47   DECLARE_READ_LINE_MEMBER( scsi_cd_r );
48   DECLARE_READ_LINE_MEMBER( scsi_io_r );
49   DECLARE_READ_LINE_MEMBER( scsi_msg_r );
50   DECLARE_READ_LINE_MEMBER( scsi_req_r );
51   DECLARE_READ_LINE_MEMBER( scsi_ack_r );
52   DECLARE_READ_LINE_MEMBER( scsi_atn_r );
53   DECLARE_READ_LINE_MEMBER( scsi_rst_r );
54
55   DECLARE_WRITE_LINE_MEMBER( scsi_bsy_w );
56   DECLARE_WRITE_LINE_MEMBER( scsi_sel_w );
57   DECLARE_WRITE_LINE_MEMBER( scsi_cd_w );
58   DECLARE_WRITE_LINE_MEMBER( scsi_io_w );
59   DECLARE_WRITE_LINE_MEMBER( scsi_msg_w );
60   DECLARE_WRITE_LINE_MEMBER( scsi_req_w );
61   DECLARE_WRITE_LINE_MEMBER( scsi_ack_w );
62   DECLARE_WRITE_LINE_MEMBER( scsi_atn_w );
63   DECLARE_WRITE_LINE_MEMBER( scsi_rst_w );
64
65protected:
66   // device-level overrides
67   virtual void device_start();
68
69private:
70   UINT8 get_scsi_line(UINT32 mask);
71   void set_scsi_line(UINT32 mask, UINT8 state);
72   void trigger_callback(UINT32 update_mask, UINT32 line_mask, devcb2_write_line &write_line);
73   const char *get_line_name(UINT32 mask);
74
75   devcb2_write_line m_bsy_handler;
76   devcb2_write_line m_sel_handler;
77   devcb2_write_line m_cd_handler;
78   devcb2_write_line m_io_handler;
79   devcb2_write_line m_msg_handler;
80   devcb2_write_line m_req_handler;
81   devcb2_write_line m_ack_handler;
82   devcb2_write_line m_atn_handler;
83   devcb2_write_line m_rst_handler;
84
85   UINT32 linestate;
86};
87
88#define MCFG_SCSICB_ADD(_tag) \
89   MCFG_DEVICE_ADD(_tag, SCSICB, 0)
90
91#define MCFG_SCSICB_BSY_HANDLER(_devcb) \
92   devcb = &scsicb_device::set_bsy_handler(*device, DEVCB2_##_devcb);
93#define MCFG_SCSICB_SEL_HANDLER(_devcb) \
94   devcb = &scsicb_device::set_sel_handler(*device, DEVCB2_##_devcb);
95#define MCFG_SCSICB_CD_HANDLER(_devcb) \
96   devcb = &scsicb_device::set_cd_handler(*device, DEVCB2_##_devcb);
97#define MCFG_SCSICB_IO_HANDLER(_devcb) \
98   devcb = &scsicb_device::set_io_handler(*device, DEVCB2_##_devcb);
99#define MCFG_SCSICB_MSG_HANDLER(_devcb) \
100   devcb = &scsicb_device::set_msg_handler(*device, DEVCB2_##_devcb);
101#define MCFG_SCSICB_REQ_HANDLER(_devcb) \
102   devcb = &scsicb_device::set_req_handler(*device, DEVCB2_##_devcb);
103#define MCFG_SCSICB_ACK_HANDLER(_devcb) \
104   devcb = &scsicb_device::set_ack_handler(*device, DEVCB2_##_devcb);
105#define MCFG_SCSICB_ATN_HANDLER(_devcb) \
106   devcb = &scsicb_device::set_atn_handler(*device, DEVCB2_##_devcb);
107#define MCFG_SCSICB_RST_HANDLER(_devcb) \
108   devcb = &scsicb_device::set_rst_handler(*device, DEVCB2_##_devcb);
109// device type definition
110extern const device_type SCSICB;
111
112#endif
branches/old_menus/src/emu/machine/cdu76s.h
r29633r29634
1/***************************************************************************
2
3    cdu76s.h
4
5    Sony CDU-76S
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __CDU76S_H__
15#define __CDU76S_H__
16
17#include "scsicd.h"
18#include "t10mmc.h"
19
20class sony_cdu76s_device : public scsicd_device
21{
22public:
23   sony_cdu76s_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
24
25   virtual void ExecCommand();
26   virtual void ReadData( UINT8 *data, int dataLength );
27};
28
29// device type definition
30extern const device_type CDU76S;
31
32#endif
branches/old_menus/src/emu/machine/scsidev.c
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/*
4
5scsidev.c
6
7Base class for SCSI devices.
8
9*/
10
11#include "machine/scsibus.h"
12#include "machine/scsidev.h"
13
14#define LOG ( 0 )
15
16scsidev_device::scsidev_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
17   device_t(mconfig, type, name, tag, owner, clock, shortname, source)
18{
19}
20
21void scsidev_device::device_start()
22{
23   data_out = 0;
24}
25
26void scsidev_device::scsi_out( UINT32 data, UINT32 mask )
27{
28#if LOG
29   printf( "%s scsi_out", tag() );
30
31   printf( " rst " );
32   if( ( mask & SCSI_MASK_RST ) != 0 )
33   {
34      printf( "%d", (int)( ( data & SCSI_MASK_RST ) != 0 ) );
35   }
36   else
37   {
38      printf( "-" );
39   }
40
41   printf( " atn " );
42   if( ( mask & SCSI_MASK_ATN ) != 0 )
43   {
44      printf( " %d", (int)( ( data & SCSI_MASK_ATN ) != 0 ) );
45   }
46   else
47   {
48      printf( "-" );
49   }
50
51   printf( " ack " );
52   if( ( mask & SCSI_MASK_ACK ) != 0 )
53   {
54      printf( "%d", (int)( ( data & SCSI_MASK_ACK ) != 0 ) );
55   }
56   else
57   {
58      printf( "-" );
59   }
60
61   printf( " req " );
62   if( ( mask & SCSI_MASK_REQ ) != 0 )
63   {
64      printf( "%d", (int)( ( data & SCSI_MASK_REQ ) != 0 ) );
65   }
66   else
67   {
68      printf( "-" );
69   }
70
71   printf( " msg " );
72   if( ( mask & SCSI_MASK_MSG ) != 0 )
73   {
74      printf( "%d", (int)( ( data & SCSI_MASK_MSG ) != 0 ) );
75   }
76   else
77   {
78      printf( "-" );
79   }
80
81   printf( " io " );
82   if( ( mask & SCSI_MASK_IO ) != 0 )
83   {
84      printf( "%d", (int)( ( data & SCSI_MASK_IO ) != 0 ) );
85   }
86   else
87   {
88      printf( "-" );
89   }
90
91   printf( " cd " );
92   if( ( mask & SCSI_MASK_CD ) != 0 )
93   {
94      printf( "%d", (int)( ( data & SCSI_MASK_CD ) != 0 ) );
95   }
96   else
97   {
98      printf( "-" );
99   }
100
101   printf( " sel " );
102   if( ( mask & SCSI_MASK_SEL ) != 0 )
103   {
104      printf( "%d", (int)( ( data & SCSI_MASK_SEL ) != 0 ) );
105   }
106   else
107   {
108      printf( "-" );
109   }
110
111   printf( " bsy " );
112   if( ( mask & SCSI_MASK_BSY ) != 0 )
113   {
114      printf( "%d", (int)( ( data & SCSI_MASK_BSY ) != 0 ) );
115   }
116   else
117   {
118      printf( "-" );
119   }
120
121   printf( " p " );
122   if( ( mask & SCSI_MASK_DATAP ) != 0 )
123   {
124      printf( "%d", (int)( ( data & SCSI_MASK_DATAP ) != 0 ) );
125   }
126   else
127   {
128      printf( "-" );
129   }
130
131   printf( " " );
132
133   if( ( mask & SCSI_MASK_DATAH ) != 0 )
134   {
135      printf( "%02x", ( data & SCSI_MASK_DATAH ) >> 8 );
136   }
137   else
138   {
139      printf( "--" );
140   }
141
142   if( ( mask & SCSI_MASK_DATA ) != 0 )
143   {
144      printf( "%02x", data & SCSI_MASK_DATA );
145   }
146   else
147   {
148      printf( "--" );
149   }
150
151   printf( "\n" );
152#endif
153
154   data_out = ( data_out & ~mask ) | ( data & mask );
155
156   m_scsibus->scsi_update();
157}
branches/old_menus/src/emu/machine/scsidev.h
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/*
4
5scsidev.h
6
7Base class for SCSI devices.
8
9*/
10
11#ifndef _SCSIDEV_H_
12#define _SCSIDEV_H_
13
14#include "emu.h"
15
16#define SCSI_MASK_DATA  ( 0x00000ff )
17#define SCSI_MASK_DATAH ( 0x000ff00 )
18#define SCSI_MASK_DATAP ( 0x0010000 )
19#define SCSI_MASK_BSY   ( 0x0020000 )
20#define SCSI_MASK_SEL   ( 0x0040000 )
21#define SCSI_MASK_CD    ( 0x0080000 )
22#define SCSI_MASK_IO    ( 0x0100000 )
23#define SCSI_MASK_MSG   ( 0x0200000 )
24#define SCSI_MASK_REQ   ( 0x0400000 )
25#define SCSI_MASK_ACK   ( 0x0800000 )
26#define SCSI_MASK_ATN   ( 0x1000000 )
27#define SCSI_MASK_RST   ( 0x2000000 )
28#define SCSI_MASK_ALL   ( 0x3ffffff )
29
30class scsibus_device;
31
32// base handler
33class scsidev_device : public device_t
34{
35   friend class scsibus_device;
36
37public:
38   // construction/destruction
39   scsidev_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
40
41protected:
42   // device-level overrides
43   virtual void device_start();
44
45   void scsi_out( UINT32 data, UINT32 mask );
46
47private:
48   virtual void scsi_in( UINT32 data, UINT32 mask ) = 0;
49
50   UINT32 data_out;
51   scsibus_device *m_scsibus;
52};
53
54#endif
branches/old_menus/src/emu/machine/scsibus.c
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/*
4
5scsibus.c
6
7*/
8
9#include "emu.h"
10#include "machine/scsibus.h"
11
12void scsibus_device::scsi_update()
13{
14   UINT32 newdata = 0;
15
16   for( int i = 0; i < deviceCount; i++ )
17   {
18      newdata |= devices[ i ]->data_out;
19   }
20
21   newdata &= SCSI_MASK_ALL;
22
23   UINT32 mask = data ^ newdata;
24
25   if( mask != 0 )
26   {
27      data = newdata;
28
29      for( int i = 0; i < deviceCount; i++ )
30      {
31         devices[ i ]->scsi_in( data, mask );
32      }
33   }
34}
35
36scsibus_device::scsibus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
37   : device_t(mconfig, SCSIBUS, "SCSI bus", tag, owner, clock, "scsibus", __FILE__)
38{
39}
40
41void scsibus_device::device_start()
42{
43   deviceCount = 0;
44
45   for( device_t *device = first_subdevice(); device != NULL; device = device->next() )
46   {
47      scsidev_device *scsidev = dynamic_cast<scsidev_device *>(device);
48      if( scsidev != NULL )
49      {
50         devices[ deviceCount++ ] = scsidev;
51         scsidev->m_scsibus = this;
52      }
53   }
54
55   data = 0;
56}
57
58const device_type SCSIBUS = &device_creator<scsibus_device>;
branches/old_menus/src/emu/machine/scsihd.c
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/***************************************************************************
4
5 scsihd.c - Implementation of a SCSI hard disk drive
6
7***************************************************************************/
8
9#include "scsihd.h"
10
11// device type definition
12const device_type SCSIHD = &device_creator<scsihd_device>;
13
14scsihd_device::scsihd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
15   : scsihle_device(mconfig, SCSIHD, "SCSIHD", tag, owner, clock, "scsihd", __FILE__)
16{
17}
18
19scsihd_device::scsihd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
20   scsihle_device(mconfig, type, name, tag, owner, clock, shortname, source)
21{
22}
23
24void scsihd_device::device_start()
25{
26   m_image = subdevice<harddisk_image_device>("image");
27
28   scsihle_device::device_start();
29}
30
31harddisk_interface scsihd_device::hd_intf = { "scsi_hdd", NULL };
32
33static MACHINE_CONFIG_FRAGMENT(scsi_harddisk)
34   MCFG_HARDDISK_CONFIG_ADD("image", scsihd_device::hd_intf)
35MACHINE_CONFIG_END
36
37machine_config_constructor scsihd_device::device_mconfig_additions() const
38{
39   return MACHINE_CONFIG_NAME(scsi_harddisk);
40}
branches/old_menus/src/emu/machine/scsibus.h
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/*
4
5scsibus.h
6
7*/
8
9#pragma once
10
11#ifndef _SCSIBUS_H_
12#define _SCSIBUS_H_
13
14#include "machine/scsidev.h"
15
16class scsibus_device : public device_t
17{
18public:
19   // construction/destruction
20   scsibus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
21   /* SCSI Bus read/write */
22
23   void scsi_update();
24
25protected:
26   // device-level overrides
27   virtual void device_start();
28
29private:
30   scsidev_device *devices[16];
31
32   UINT32 data;
33   int deviceCount;
34};
35
36#define MCFG_SCSIBUS_ADD(_tag) \
37   MCFG_DEVICE_ADD(_tag, SCSIBUS, 0)
38
39// device type definition
40extern const device_type SCSIBUS;
41
42#endif
branches/old_menus/src/emu/machine/scsihd.h
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/***************************************************************************
4
5 scsihd.h
6
7***************************************************************************/
8
9#ifndef _SCSIHD_H_
10#define _SCSIHD_H_
11
12#include "machine/scsihle.h"
13#include "machine/t10sbc.h"
14
15class scsihd_device : public scsihle_device,
16   public t10sbc
17{
18public:
19   // construction/destruction
20   scsihd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
21   scsihd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
22   virtual machine_config_constructor device_mconfig_additions() const;
23
24   static struct harddisk_interface hd_intf;
25
26protected:
27   virtual void device_start();
28};
29
30// device type definition
31extern const device_type SCSIHD;
32
33#endif
branches/old_menus/src/emu/machine/scsihle.c
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/*
4
5scsihle.c
6
7Base class for HLE'd SCSI devices.
8
9*/
10
11#include "machine/scsihle.h"
12
13scsihle_device::scsihle_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
14   scsidev_device(mconfig, type, name, tag, owner, clock, shortname, source)
15{
16}
17
18void scsihle_device::device_start()
19{
20   scsidev_device::device_start();
21   t10_start(*this);
22
23   req_timer = timer_alloc(0);
24   sel_timer = timer_alloc(1);
25   dataout_timer = timer_alloc(2);
26}
27
28void scsihle_device::device_reset()
29{
30   t10_reset();
31}
32
33int scsihle_device::GetDeviceID()
34{
35   return scsiID;
36}
37
38void scsihle_device::static_set_deviceid( device_t &device, int _scsiID )
39{
40   scsihle_device &scsidev = downcast<scsihle_device &>(device);
41   scsidev.scsiID = _scsiID;
42}
43
44#define BSY_DELAY_NS    50
45#define REQ_DELAY_NS    90
46
47static const char *const phasenames[] =
48{
49   "data out", "data in", "command", "status", "none", "none", "message out", "message in", "bus free","select"
50};
51
52// scsidev
53#define SCSI_CMD_BUFFER_WRITE ( 0x3b )
54#define SCSI_CMD_BUFFER_READ ( 0x3c )
55
56// scsihd
57#define SCSI_CMD_FORMAT_UNIT        0x04
58#define SCSI_CMD_SEARCH_DATA_EQUAL  0x31
59#define SCSI_CMD_READ_DEFECT        0x37
60
61
62#define IS_COMMAND(cmd)             (command[0]==cmd)
63
64#define FORMAT_UNIT_TIMEOUT         5
65
66/*
67    LOGLEVEL
68        0   no logging,
69        1   just commands
70        2   1 + data
71        3   2 + line changes
72*/
73
74#define LOGLEVEL            0
75
76#define LOG(level, ...)     if(LOGLEVEL>=level) logerror(__VA_ARGS__)
77
78void scsihle_device::scsi_out_req_delay(UINT8 state)
79{
80   req_timer->adjust(attotime::from_nsec(REQ_DELAY_NS),state);
81}
82
83void scsihle_device::dump_bytes(UINT8 *buff, int count)
84{
85   int byteno;
86
87   for(byteno=0; byteno<count; byteno++)
88   {
89      logerror("%02X ",buff[byteno]);
90   }
91}
92
93void scsihle_device::dump_command_bytes()
94{
95   logerror("sending command 0x%02X to ScsiID %d\n",command[0],scsiID);
96   dump_bytes(command,cmd_idx);
97   logerror("\n\n");
98}
99
100void scsihle_device::dump_data_bytes(int count)
101{
102   logerror("Data buffer[0..%d]\n",count);
103   dump_bytes(buffer,count);
104   logerror("\n\n");
105}
106
107void scsihle_device::scsibus_read_data()
108{
109   data_last = (bytes_left >= m_sector_bytes) ? m_sector_bytes : bytes_left;
110
111   LOG(2,"SCSIBUS:scsibus_read_data bytes_left=%04X, data_last=%04X\n",bytes_left,data_last);
112
113   data_idx=0;
114
115   if (data_last > 0)
116   {
117      ReadData(buffer, data_last);
118      bytes_left-=data_last;
119
120      scsi_out( buffer[ data_idx++ ], SCSI_MASK_DATA );
121   }
122}
123
124void scsihle_device::scsibus_write_data()
125{
126   if (data_last > 0)
127   {
128      WriteData(buffer, data_last);
129      bytes_left-=data_last;
130   }
131
132   data_idx=0;
133}
134
135void scsihle_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
136{
137   switch( tid )
138   {
139   case 0:
140      scsi_out(param ? SCSI_MASK_REQ : 0, SCSI_MASK_REQ);
141      break;
142
143   case 1:
144      scsi_out(param ? SCSI_MASK_BSY : 0, SCSI_MASK_BSY);
145      break;
146
147   case 2:
148      // Some drives, notably the ST225N and ST125N, accept fromat unit commands
149      // with flags set indicating that bad block data should be transfered but
150      // don't then implemnt a data in phase, this timeout it to catch these !
151      if(IS_COMMAND(SCSI_CMD_FORMAT_UNIT) && (data_idx==0))
152      {
153         scsi_change_phase(SCSI_PHASE_STATUS);
154   }
155      break;
156}
157}
158
159void scsihle_device::scsibus_exec_command()
160{
161   int command_local = 0;
162
163   if(LOGLEVEL)
164      dump_command_bytes();
165
166   //is_linked=command[cmd_idx-1] & 0x01;
167   is_linked=0;
168
169   // Check for locally executed commands, and if found execute them
170   switch (command[0])
171   {
172      // Format unit
173      case SCSI_CMD_FORMAT_UNIT:
174         LOG(1,"SCSIBUS: format unit command[1]=%02X & 0x10\n",(command[1] & 0x10));
175         command_local=1;
176         if((command[1] & 0x10)==0x10)
177            m_phase = SCSI_PHASE_DATAOUT;
178         else
179            m_phase = SCSI_PHASE_STATUS;
180
181         m_status_code = SCSI_STATUS_CODE_GOOD;
182         bytes_left=4;
183         dataout_timer->adjust(attotime::from_seconds(FORMAT_UNIT_TIMEOUT));
184         break;
185
186      case SCSI_CMD_SEARCH_DATA_EQUAL:
187         LOG(1,"SCSIBUS: Search_data_equaln");
188         command_local=1;
189         bytes_left=0;
190         m_phase = SCSI_PHASE_STATUS;
191         m_status_code = SCSI_STATUS_CODE_GOOD;
192         break;
193
194      case SCSI_CMD_READ_DEFECT:
195         LOG(1,"SCSIBUS: read defect list\n");
196         command_local=1;
197
198         buffer[0] = 0x00;
199         buffer[1] = command[2];
200         buffer[3] = 0x00; // defect list len msb
201         buffer[4] = 0x00; // defect list len lsb
202
203         bytes_left=4;
204         m_phase = SCSI_PHASE_DATAIN;
205         m_status_code = SCSI_STATUS_CODE_GOOD;
206         break;
207
208      // write buffer
209      case SCSI_CMD_BUFFER_WRITE:
210         LOG(1,"SCSIBUS: write_buffer\n");
211         command_local=1;
212         bytes_left=(command[7]<<8)+command[8];
213         m_phase = SCSI_PHASE_DATAOUT;
214         m_status_code = SCSI_STATUS_CODE_GOOD;
215         break;
216
217      // read buffer
218      case SCSI_CMD_BUFFER_READ:
219         LOG(1,"SCSIBUS: read_buffer\n");
220         command_local=1;
221         bytes_left=(command[7]<<8)+command[8];
222         m_phase = SCSI_PHASE_DATAIN;
223         m_status_code = SCSI_STATUS_CODE_GOOD;
224         break;
225   }
226
227
228   // Check for locally executed command, if not then pass it on
229   // to the disk driver
230   if(!command_local)
231   {
232      SetCommand(command, cmd_idx);
233      ExecCommand();
234      GetLength(&bytes_left);
235      data_idx=0;
236   }
237
238   scsi_change_phase(m_phase);
239
240   LOG(1,"SCSIBUS:bytes_left=%02X data_idx=%02X\n",bytes_left,data_idx);
241
242   // This is correct as we need to read from disk for commands other than just read data
243   if ((m_phase == SCSI_PHASE_DATAIN) && (!command_local))
244      scsibus_read_data();
245}
246
247UINT8 scsihle_device::scsibus_driveno(UINT8 drivesel)
248{
249   switch (drivesel)
250   {
251      case 0x01: return 0;
252      case 0x02: return 1;
253      case 0x04: return 2;
254      case 0x08: return 3;
255      case 0x10: return 4;
256      case 0x20: return 5;
257      case 0x40: return 6;
258      case 0x80: return 7;
259      default: return 0;
260   }
261}
262
263void scsihle_device::scsi_change_phase(UINT8 newphase)
264{
265   LOG(1,"scsi_change_phase() from=%s, to=%s\n",phasenames[m_phase],phasenames[newphase]);
266
267   m_phase=newphase;
268   cmd_idx=0;
269   data_idx=0;
270
271   switch(m_phase)
272   {
273      case SCSI_PHASE_BUS_FREE:
274         scsi_out( 0, SCSI_MASK_ALL );
275         LOG(1,"SCSIBUS: done\n\n");
276         break;
277
278      case SCSI_PHASE_COMMAND:
279         scsi_out( SCSI_MASK_CD, SCSI_MASK_DATA | SCSI_MASK_CD | SCSI_MASK_IO | SCSI_MASK_MSG );
280         LOG(1,"\nSCSIBUS: Command begin\n");
281         scsi_out_req_delay( 1 );
282         break;
283
284      case SCSI_PHASE_DATAOUT:
285         scsi_out( 0, SCSI_MASK_DATA | SCSI_MASK_CD | SCSI_MASK_IO | SCSI_MASK_MSG );
286         scsi_out_req_delay( 1 );
287         break;
288
289      case SCSI_PHASE_DATAIN:
290         scsi_out( SCSI_MASK_IO, SCSI_MASK_CD | SCSI_MASK_IO | SCSI_MASK_MSG );
291         scsi_out_req_delay( 1 );
292         break;
293
294      case SCSI_PHASE_STATUS:
295         scsi_out( m_status_code | SCSI_MASK_CD | SCSI_MASK_IO, SCSI_MASK_DATA | SCSI_MASK_CD | SCSI_MASK_IO | SCSI_MASK_MSG );
296         scsi_out_req_delay( 1 );
297         break;
298
299      case SCSI_PHASE_MESSAGE_OUT:
300         scsi_out( SCSI_MASK_CD | SCSI_MASK_MSG, SCSI_MASK_DATA | SCSI_MASK_CD | SCSI_MASK_IO | SCSI_MASK_MSG );
301         scsi_out_req_delay( 1 );
302         break;
303
304      case SCSI_PHASE_MESSAGE_IN:
305         scsi_out( 0 | SCSI_MASK_CD | SCSI_MASK_IO | SCSI_MASK_MSG, SCSI_MASK_DATA | SCSI_MASK_CD | SCSI_MASK_IO | SCSI_MASK_MSG );// no errors for the time being !
306         scsi_out_req_delay( 1 );
307         break;
308   }
309}
310
311void scsihle_device::scsi_in( UINT32 data, UINT32 mask )
312{
313   // Reset aborts and returns to bus free
314   if( ( mask & SCSI_MASK_RST ) != 0 && ( data & SCSI_MASK_RST ) != 0 )
315   {
316      scsi_change_phase(SCSI_PHASE_BUS_FREE);
317      cmd_idx=0;
318      data_idx=0;
319      is_linked=0;
320
321      return;
322   }
323
324   switch (m_phase)
325   {
326      case SCSI_PHASE_BUS_FREE:
327         // Note this assumes we only have one initiator and therefore
328         // only one line active.
329         if( ( mask & SCSI_MASK_SEL ) != 0 && scsibus_driveno(data & SCSI_MASK_DATA) == scsiID)
330         {
331            void *hdfile = NULL;
332            // Check to see if device had image file mounted, if not, do not set busy,
333            // and stay busfree.
334            GetDevice(&hdfile);
335            if(hdfile!=(void *)NULL)
336            {
337               if( ( data & SCSI_MASK_SEL ) == 0 )
338               {
339                  scsi_change_phase(SCSI_PHASE_COMMAND);
340               }
341               else
342               {
343                  sel_timer->adjust(attotime::from_nsec(BSY_DELAY_NS),1);
344               }
345            }
346         }
347         break;
348
349      case SCSI_PHASE_COMMAND:
350         if( ( mask & SCSI_MASK_ACK ) != 0 )
351         {
352            if( ( data & SCSI_MASK_ACK ) == 0 )
353            {
354               command[ cmd_idx++ ] = data & SCSI_MASK_DATA;
355
356               // If the command is ready go and execute it
357               if(cmd_idx==get_scsi_cmd_len(command[0]))
358               {
359                  scsibus_exec_command();
360               }
361               else
362               {
363                  scsi_out_req_delay( 1 );
364               }
365            }
366            else
367            {
368               scsi_out_req_delay( 0 );
369            }
370         }
371         break;
372
373      case SCSI_PHASE_DATAIN:
374         if( ( mask & SCSI_MASK_ACK ) != 0 )
375         {
376            if( ( data & SCSI_MASK_ACK ) == 0 )
377            {
378               // check to see if we have reached the end of the block buffer
379               // and that there is more data to read from the scsi disk
380               if(data_idx == m_sector_bytes && bytes_left > 0)
381               {
382                  scsibus_read_data();
383                  scsi_out_req_delay( 1 );
384               }
385               else if(data_idx == data_last && bytes_left == 0)
386               {
387                  scsi_change_phase(SCSI_PHASE_STATUS);
388               }
389               else
390               {
391                  scsi_out( buffer[ data_idx++ ], SCSI_MASK_DATA );
392                  scsi_out_req_delay( 1 );
393               }
394            }
395            else
396            {
397               scsi_out_req_delay( 0 );
398            }
399         }
400         break;
401
402      case SCSI_PHASE_DATAOUT:
403         if( ( mask & SCSI_MASK_ACK ) != 0 )
404         {
405            if( ( data & SCSI_MASK_ACK ) == 0 )
406            {
407               //LOG(1,"SCSIBUS:bytes_left=%02X data_idx=%02X\n",bytes_left,data_idx);
408               buffer[data_idx++]=data & SCSI_MASK_DATA;
409
410               if(IS_COMMAND(SCSI_CMD_FORMAT_UNIT))
411               {
412                  // If we have the first byte, then cancel the dataout timout
413                  if(data_idx==1)
414                     dataout_timer->adjust(attotime::never);
415
416                  // When we have the first 3 bytes, calculate how many more are in the
417                  // bad block list.
418                  if(data_idx==3)
419                  {
420                     bytes_left+=((buffer[2]<<8)+buffer[3]);
421                     LOG(1,"format_unit reading an extra %d bytes\n",bytes_left-4);
422                     dump_data_bytes(4);
423                  }
424               }
425
426               // If the data buffer is full flush it to the SCSI disk
427
428               data_last = (bytes_left >= m_sector_bytes) ? m_sector_bytes : bytes_left;
429
430               if(data_idx == data_last)
431                  scsibus_write_data();
432
433               if(data_idx == 0 && bytes_left == 0)
434               {
435                  scsi_change_phase(SCSI_PHASE_STATUS);
436               }
437               else
438               {
439                  scsi_out_req_delay( 1 );
440               }
441            }
442            else
443            {
444               scsi_out_req_delay( 0 );
445            }
446         }
447         break;
448
449      case SCSI_PHASE_STATUS:
450         if( ( mask & SCSI_MASK_ACK ) != 0 )
451         {
452            if( ( data & SCSI_MASK_ACK ) == 0 )
453            {
454               if(cmd_idx > 0)
455               {
456                  scsi_change_phase(SCSI_PHASE_MESSAGE_IN);
457               }
458               else
459               {
460                  scsi_out_req_delay( 1 );
461               }
462            }
463            else
464            {
465               cmd_idx++;
466               scsi_out_req_delay( 0 );
467            }
468         }
469         break;
470
471      case SCSI_PHASE_MESSAGE_IN:
472         if( ( mask & SCSI_MASK_ACK ) != 0 )
473         {
474            if( ( data & SCSI_MASK_ACK ) == 0 )
475            {
476               if(cmd_idx > 0)
477               {
478                  if(is_linked)
479                     scsi_change_phase(SCSI_PHASE_COMMAND);
480                  else
481                     scsi_change_phase(SCSI_PHASE_BUS_FREE);
482               }
483               else
484               {
485                  scsi_out_req_delay( 1 );
486               }
487            }
488            else
489            {
490               cmd_idx++;
491               scsi_out_req_delay( 0 );
492            }
493         }
494         break;
495   }
496}
497
498// get the length of a SCSI command based on it's command byte type
499int scsihle_device::get_scsi_cmd_len(int cbyte)
500{
501   int group;
502
503   group = (cbyte>>5) & 7;
504
505   if (group == 0 || group == 3 || group == 6 || group == 7) return 6;
506   if (group == 1 || group == 2) return 10;
507   if (group == 5) return 12;
508
509   fatalerror("scsihle: Unknown SCSI command group %d, command byte=%02X\n", group,cbyte);
510
511   return 6;
512}
branches/old_menus/src/emu/machine/scsihle.h
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/*
4
5scsihle.h
6
7Base class for HLE'd SCSI devices.
8
9*/
10
11#ifndef _SCSIHLE_H_
12#define _SCSIHLE_H_
13
14#include "machine/scsibus.h"
15#include "machine/scsidev.h"
16#include "machine/t10spc.h"
17
18class scsihle_device : public scsidev_device,
19   public virtual t10spc
20{
21public:
22   // construction/destruction
23   scsihle_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
24
25   virtual int GetDeviceID();
26
27   virtual void scsi_in( UINT32 data, UINT32 mask );
28
29   // configuration helpers
30   static void static_set_deviceid(device_t &device, int _scsiID);
31
32protected:
33   // device-level overrides
34   virtual void device_start();
35   virtual void device_reset();
36   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
37
38private:
39   void scsi_out_req_delay(UINT8 state);
40   void scsi_change_phase(UINT8 newphase);
41   int get_scsi_cmd_len(int cbyte);
42   UINT8 scsibus_driveno(UINT8  drivesel);
43   void scsibus_read_data();
44   void scsibus_write_data();
45   void scsibus_exec_command();
46   void dump_command_bytes();
47   void dump_data_bytes(int count);
48   void dump_bytes(UINT8 *buff, int count);
49
50   emu_timer *req_timer;
51   emu_timer *sel_timer;
52   emu_timer *dataout_timer;
53
54   UINT8 cmd_idx;
55   UINT8 is_linked;
56
57   UINT8 buffer[ 1024 ];
58   UINT16 data_idx;
59   int bytes_left;
60   int data_last;
61
62   int scsiID;
63};
64
65//
66// Status / Sense data taken from Adaptec ACB40x0 documentation.
67//
68
69// SCSI IDs
70enum
71{
72   SCSI_ID_0 = 0,
73   SCSI_ID_1,
74   SCSI_ID_2,
75   SCSI_ID_3,
76   SCSI_ID_4,
77   SCSI_ID_5,
78   SCSI_ID_6,
79   SCSI_ID_7
80};
81
82#define MCFG_SCSIDEV_ADD(_tag, _type, _id) \
83   MCFG_DEVICE_ADD(_tag, _type, 0) \
84   scsihle_device::static_set_deviceid(*device, _id);
85
86#endif
branches/old_menus/src/emu/machine/scsicd.c
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/***************************************************************************
4
5 scsicd.c - Implementation of a SCSI CD-ROM device
6
7***************************************************************************/
8
9#include "scsicd.h"
10
11// device type definition
12const device_type SCSICD = &device_creator<scsicd_device>;
13
14scsicd_device::scsicd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
15   scsihle_device(mconfig, SCSICD, "SCSICD", tag, owner, clock, "scsicd", __FILE__)
16{
17}
18
19scsicd_device::scsicd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
20   scsihle_device(mconfig, type, name, tag, owner, clock, shortname, source)
21{
22}
23
24void scsicd_device::device_start()
25{
26   m_image = subdevice<cdrom_image_device>("image");
27   m_cdda = subdevice<cdda_device>("cdda");
28
29   scsihle_device::device_start();
30}
31
32cdrom_interface scsicd_device::cd_intf = { "cdrom", NULL };
33
34static MACHINE_CONFIG_FRAGMENT(scsi_cdrom)
35   MCFG_CDROM_ADD("image", scsicd_device::cd_intf)
36   MCFG_SOUND_ADD("cdda", CDDA, 0)
37MACHINE_CONFIG_END
38
39machine_config_constructor scsicd_device::device_mconfig_additions() const
40{
41   return MACHINE_CONFIG_NAME(scsi_cdrom);
42}
branches/old_menus/src/emu/machine/scsicd.h
r29633r29634
1// license:MAME
2// copyright-holders:smf
3/***************************************************************************
4
5 scsicd.h
6
7***************************************************************************/
8
9#ifndef _SCSICD_H_
10#define _SCSICD_H_
11
12#include "machine/scsihle.h"
13#include "machine/t10mmc.h"
14
15class scsicd_device : public scsihle_device,
16   public t10mmc
17{
18public:
19   // construction/destruction
20   scsicd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
21   scsicd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
22   virtual machine_config_constructor device_mconfig_additions() const;
23
24   static struct cdrom_interface cd_intf;
25
26protected:
27   virtual void device_start();
28};
29
30// device type definition
31extern const device_type SCSICD;
32
33#endif
branches/old_menus/src/emu/machine/adc1213x.c
r29633r29634
5959{
6060}
6161
62
6362//-------------------------------------------------
64//  device_config_complete - perform any
65//  operations now that the configuration is
66//  complete
67//-------------------------------------------------
68
69void adc12138_device::device_config_complete()
70{
71   // inherit a copy of the static data
72   const adc12138_interface *intf = reinterpret_cast<const adc12138_interface *>(static_config());
73   if (intf != NULL)
74      *static_cast<adc12138_interface *>(this) = *intf;
75
76   // or initialize to defaults if none provided
77   else
78   {
79      input_callback_r = NULL;
80   }
81}
82
83//-------------------------------------------------
8463//  device_start - device-specific startup
8564//-------------------------------------------------
8665
r29633r29634
9675   m_end_conv = 0;
9776
9877   /* resolve callbacks */
99   m_input_callback_r_func = input_callback_r;
78   m_ipt_read_cb.bind_relative_to(*owner());
10079
10180   /* register for state saving */
10281   save_item(NAME(m_cycle));
r29633r29634
144123
145124void adc12138_device::convert(int channel, int bits16, int lsbfirst)
146125{
147   int i;
148126   int bits;
149127   int input_value;
150128   double input = 0;
r29633r29634
159137   {
160138      case 0x8:       // H L L L - CH0 (single-ended)
161139      {
162         input = m_input_callback_r_func(this, 0);
140         input = m_ipt_read_cb(0);
163141         break;
164142      }
165143      case 0xc:       // H H L L - CH1 (single-ended)
166144      {
167         input = m_input_callback_r_func(this, 1);
145         input = m_ipt_read_cb(1);
168146         break;
169147      }
170148      case 0x9:       // H L L H - CH2 (single-ended)
171149      {
172         input = m_input_callback_r_func(this, 2);
150         input = m_ipt_read_cb(2);
173151         break;
174152      }
175153      case 0xd:       // H H L H - CH3 (single-ended)
176154      {
177         input = m_input_callback_r_func(this, 3);
155         input = m_ipt_read_cb(3);
178156         break;
179157      }
180158      case 0xa:       // H L H L - CH4 (single-ended)
181159      {
182         input = m_input_callback_r_func(this, 4);
160         input = m_ipt_read_cb(4);
183161         break;
184162      }
185163      case 0xe:       // H H H L - CH5 (single-ended)
186164      {
187         input = m_input_callback_r_func(this, 5);
165         input = m_ipt_read_cb(5);
188166         break;
189167      }
190168      case 0xb:       // H L H H - CH6 (single-ended)
191169      {
192         input = m_input_callback_r_func(this, 6);
170         input = m_ipt_read_cb(6);
193171         break;
194172      }
195173      case 0xf:       // H H H H - CH7 (single-ended)
196174      {
197         input = m_input_callback_r_func(this, 7);
175         input = m_ipt_read_cb(7);
198176         break;
199177      }
200178      default:
r29633r29634
216194
217195   m_output_shift_reg = 0;
218196
219   for (i=0; i < bits; i++)
197   for (int i = 0; i < bits; i++)
220198   {
221      if (input_value & (1 << ((bits-1) - i)))
199      if (input_value & (1 << ((bits - 1) - i)))
222200      {
223201         m_output_shift_reg |= (1 << i);
224202      }
branches/old_menus/src/emu/machine/adc1213x.h
r29633r29634
1515    TYPE DEFINITIONS
1616***************************************************************************/
1717
18typedef double (*adc1213x_input_convert_func)(device_t *device, UINT8 input);
18typedef device_delegate<double (UINT8 input)> adc1213x_ipt_convert_delegate;
19#define ADC12138_IPT_CONVERT_CB(name)  double name(UINT8 input)
1920
20struct adc12138_interface
21{
22   adc1213x_input_convert_func input_callback_r;
23};
24
2521/***************************************************************************
2622    MACROS / CONSTANTS
2723***************************************************************************/
2824
29class adc12138_device : public device_t,
30                              public adc12138_interface
25class adc12138_device : public device_t
3126{
3227public:
3328   adc12138_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3429   adc12138_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
3530   ~adc12138_device() {}
3631
32   static void set_ipt_convert_callback(device_t &device, adc1213x_ipt_convert_delegate callback) { downcast<adc12138_device &>(device).m_ipt_read_cb = callback; }
33
3734   DECLARE_WRITE8_MEMBER( di_w );
3835   DECLARE_WRITE8_MEMBER( cs_w );
3936   DECLARE_WRITE8_MEMBER( sclk_w );
r29633r29634
4340
4441protected:
4542   // device-level overrides
46   virtual void device_config_complete();
4743   virtual void device_start();
4844   virtual void device_reset();
4945
5046   void convert(int channel, int bits16, int lsbfirst);
5147
52   adc1213x_input_convert_func m_input_callback_r_func;
48   adc1213x_ipt_convert_delegate m_ipt_read_cb;
5349
54   private:
50private:
5551   // internal state
5652   int m_cycle;
5753   int m_data_out;
r29633r29634
8480
8581extern const device_type ADC12132;
8682
87#define MCFG_ADC12130_ADD(_tag, _config) \
88   MCFG_DEVICE_ADD(_tag, ADC12130, 0) \
89   MCFG_DEVICE_CONFIG(_config)
9083
91#define MCFG_ADC12132_ADD(_tag, _config) \
92   MCFG_DEVICE_ADD(_tag, ADC12132, 0) \
93   MCFG_DEVICE_CONFIG(_config)
84#define MCFG_ADC1213X_IPT_CONVERT_CB(_class, _method) \
85   adc12138_device::set_ipt_convert_callback(*device, adc1213x_ipt_convert_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
9486
95#define MCFG_ADC12138_ADD(_tag, _config) \
96   MCFG_DEVICE_ADD(_tag, ADC12138, 0) \
97   MCFG_DEVICE_CONFIG(_config)
98
99
10087#endif  /* __ADC1213X_H__ */
branches/old_menus/src/emu/machine/53c810.c
r29633r29634
22
33#include "emu.h"
44#include "53c810.h"
5#include "machine/scsihle.h"
5#include "bus/scsi/scsihle.h"
66
77#define DMA_MAX_ICOUNT  512     /* Maximum number of DMA Scripts opcodes to run */
88#define DASM_OPCODES 0
r29633r29634
104104   }
105105   else
106106   {
107      select((dcmd>>16)&7);
108
107109      /* initiator mode */
108110      logerror("53c810: SELECT: our ID %d, target ID %d\n", scid&7, (dcmd>>16)&7);
109111
r29633r29634
616618}
617619
618620lsi53c810_device::lsi53c810_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
619   : device_t(mconfig, LSI53C810, "53C810 SCSI", tag, owner, clock, "lsi53c810", __FILE__)
621   : legacy_scsi_host_adapter(mconfig, LSI53C810, "53C810 SCSI", tag, owner, clock, "lsi53c810", __FILE__)
620622{
621623}
622624
623625void lsi53c810_device::device_start()
624626{
627   legacy_scsi_host_adapter::device_start();
628
625629   m_irq_cb.bind_relative_to(*owner());
626630   m_dma_cb.bind_relative_to(*owner());
627631   m_fetch_cb.bind_relative_to(*owner());
r29633r29634
647651   add_opcode(0xc0, 0xfe, opcode_handler_delegate(FUNC( lsi53c810_device::dmaop_move_memory ), this));
648652   add_opcode(0xe0, 0xed, opcode_handler_delegate(FUNC( lsi53c810_device::dmaop_store ), this));
649653   add_opcode(0xe1, 0xed, opcode_handler_delegate(FUNC( lsi53c810_device::dmaop_load ), this));
650
651   memset(devices, 0, sizeof(devices));
652
653   // try to open the devices
654   for (device_t *device = owner()->first_subdevice(); device != NULL; device = device->next())
655   {
656      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
657      if (scsidev != NULL)
658      {
659         devices[scsidev->GetDeviceID()] = scsidev;
660      }
661   }
662654}
663655
664void lsi53c810_device::lsi53c810_read_data(int bytes, UINT8 *pData)
665{
666   if (devices[last_id])
667   {
668      devices[last_id]->ReadData( pData, bytes);
669   }
670   else
671   {
672      logerror("lsi53c810: read unknown device SCSI ID %d\n", last_id);
673   }
674}
675
676void lsi53c810_device::lsi53c810_write_data(int bytes, UINT8 *pData)
677{
678   if (devices[last_id])
679   {
680      devices[last_id]->WriteData( pData, bytes );
681   }
682   else
683   {
684      logerror("lsi53c810: write to unknown device SCSI ID %d\n", last_id);
685   }
686}
687
688656/*************************************
689657 *
690658 *  Disassembler
branches/old_menus/src/emu/machine/53c810.h
r29633r29634
11#ifndef LSI53C810_H
22#define LSI53C810_H
33
4#include "machine/scsihle.h"
4#include "legscsi.h"
55
66typedef device_delegate<void (int state)> lsi53c810_irq_delegate;
77#define LSI53C810_IRQ_CB(name)  void name(int state)
r29633r29634
1313#define LSI53C810_FETCH_CB(name)  UINT32 name(UINT32 dsp)
1414
1515
16class lsi53c810_device : public device_t
16class lsi53c810_device : public legacy_scsi_host_adapter
1717{
1818public:
1919   // construction/destruction
r29633r29634
6767   UINT32 lsi53c810_dasm_fetch(UINT32 pc);
6868   unsigned lsi53c810_dasm(char *buf, UINT32 pc);
6969
70   scsihle_device *devices[8]; /* SCSI IDs 0-7 */
7170   UINT8 last_id;
7271
7372   UINT8 scntl0;
branches/old_menus/src/emu/machine/mc68681.c
r29633r29634
239239         write_outport(OPR ^ 0xff);
240240      }
241241
242      // timer driving any serial channels?
243      if (BIT(ACR, 7) == 1)
244      {
245         UINT8 csr = m_chanA->get_chan_CSR();
246
247         if ((csr & 0xf0) == 0xd0)   // tx is timer driven
248         {
249            m_chanA->tx_clock_w(half_period);
250         }
251         if ((csr & 0x0f) == 0x0d)    // rx is timer driven
252         {
253            m_chanA->rx_clock_w(half_period);
254         }
255
256         csr = m_chanB->get_chan_CSR();
257         if ((csr & 0xf0) == 0xd0)   // tx is timer driven
258         {
259            m_chanB->tx_clock_w(half_period);
260         }
261         if ((csr & 0x0f) == 0x0d)    // rx is timer driven
262         {
263            m_chanB->rx_clock_w(half_period);
264         }
265      }
266
242267      if (!half_period)
243268      {
244269         ISR |= INT_COUNTER_READY;
r29633r29634
594619      baud_rate = baud_rate_ACR_1[data & 0x0f];
595620   }
596621
597   if ( baud_rate == 0 )
622   if ((baud_rate == 0) && ((data & 0xf) != 0xd))
598623   {
599624      LOG(( "Unsupported transmitter clock: channel %d, clock select = %02x\n", ch, data ));
600625   }
r29633r29634
693718
694719void mc68681_channel::tra_complete()
695720{
696//  printf("%s ch %d Tx complete\n", tag(), m_ch);
721//   printf("%s ch %d Tx complete\n", tag(), m_ch);
697722   tx_ready = 1;
698723   SR |= STATUS_TRANSMITTER_READY;
699724
r29633r29634
11121137{
11131138   write_chan_reg(1, CSR);
11141139}
1140
1141UINT8 mc68681_channel::get_chan_CSR()
1142{
1143   return CSR;
1144}
1145
branches/old_menus/src/emu/machine/mc68681.h
r29633r29634
5656
5757   void ACR_updated();
5858
59   UINT8 get_chan_CSR();
60
5961private:
6062   /* Registers */
6163   UINT8 CR;  /* Command register */
branches/old_menus/src/emu/machine/legscsi.c
r0r29634
1#include "legscsi.h"
2
3legacy_scsi_host_adapter::legacy_scsi_host_adapter(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
4   device_t(mconfig, type, name, tag, owner, clock, shortname, source),
5   m_scsi_port(*this)
6{
7}
8
9void legacy_scsi_host_adapter::device_start()
10{
11}
12
13void legacy_scsi_host_adapter::reset_bus()
14{
15   for (int i = 0; i <= 7; i++)
16   {
17      scsihle_device *scsidev = get_device(i);
18      if (scsidev != NULL)
19      {
20         scsidev->reset();
21      }
22   }
23}
24
25bool legacy_scsi_host_adapter::select(int id)
26{
27   m_selected = id;
28
29   scsihle_device *scsidev = get_device(m_selected);
30   if (scsidev != NULL)
31   {
32      return true;
33   }
34
35   return false;
36}
37
38void legacy_scsi_host_adapter::send_command(UINT8 *data, int bytes)
39{
40   scsihle_device *scsidev = get_device(m_selected);
41   if (scsidev != NULL)
42   {
43      scsidev->SetCommand(data, bytes);
44      scsidev->ExecCommand();
45   }
46   else
47   {
48      logerror("%s: send_command unknown SCSI id %d\n", tag(), m_selected);
49   }
50}
51
52int legacy_scsi_host_adapter::get_length(void)
53{
54   scsihle_device *scsidev = get_device(m_selected);
55   if (scsidev != NULL)
56   {
57      int length;
58      scsidev->GetLength(&length);
59      return length;
60   }
61   else
62   {
63      logerror("%s: get_length unknown SCSI id %d\n", tag(), m_selected);
64      return 0;
65   }
66}
67
68int legacy_scsi_host_adapter::get_phase(void)
69{
70   scsihle_device *scsidev = get_device(m_selected);
71   if (scsidev != NULL)
72   {
73      int phase;
74      scsidev->GetPhase(&phase);
75      return phase;
76   }
77   else
78   {
79      logerror("%s: get_phase unknown SCSI id %d\n", tag(), m_selected);
80      return 0;
81   }
82}
83
84void legacy_scsi_host_adapter::read_data(UINT8 *data, int bytes)
85{
86   scsihle_device *scsidev = get_device(m_selected);
87   if (scsidev != NULL)
88   {
89      scsidev->ReadData(data, bytes);
90   }
91   else
92   {
93      logerror("%s: read_data unknown SCSI id %d\n", tag(), m_selected);
94   }
95}
96
97void legacy_scsi_host_adapter::write_data(UINT8 *data, int bytes)
98{
99   scsihle_device *scsidev = get_device(m_selected);
100   if (scsidev != NULL)
101   {
102      scsidev->WriteData(data, bytes);
103   }
104   else
105   {
106      logerror("%s: write_data unknown SCSI id %d\n", tag(), m_selected);
107   }
108}
109
110UINT8 legacy_scsi_host_adapter::get_status()
111{
112   scsihle_device *scsidev = get_device(m_selected);
113   if (scsidev != NULL)
114   {
115      void *image;
116
117      scsidev->GetDevice(&image);
118      if (image != NULL)
119         return 0x00;
120
121      return 0x02;
122   }
123   else
124   {
125      logerror("%s: get_status unknown SCSI id %d\n", tag(), m_selected);
126      return 0;
127   }
128}
129
130scsihle_device *legacy_scsi_host_adapter::get_device(int id)
131{
132   // steal scsi devices from bus
133   for (device_t *device = m_scsi_port->first_subdevice(); device != NULL; device = device->next())
134   {
135      SCSI_PORT_SLOT_device *slot = dynamic_cast<SCSI_PORT_SLOT_device *>(device);
136      if (slot != NULL)
137      {
138         scsihle_device *scsidev = dynamic_cast<scsihle_device *>(slot->dev());
139         if (scsidev != NULL)
140         {
141            if (scsidev->GetDeviceID() == id)
142            {
143               return scsidev;
144            }
145         }
146      }
147   }
148
149   return NULL;
150}
Property changes on: branches/old_menus/src/emu/machine/legscsi.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/machine/legscsi.h
r0r29634
1#ifndef _LEGSCSI_H_
2#define _LEGSCSI_H_
3
4#pragma once
5
6#include "bus/scsi/scsihle.h"
7
8#define MCFG_LEGACY_SCSI_PORT(_tag) \
9   legacy_scsi_host_adapter::set_scsi_port(*device, "^" _tag);
10
11class legacy_scsi_host_adapter : public device_t
12{
13public:
14   legacy_scsi_host_adapter(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
15
16   static void set_scsi_port(device_t &device, const char *tag) { downcast<legacy_scsi_host_adapter &>(device).m_scsi_port.set_tag(tag); }
17
18protected:
19   virtual void device_start();
20
21   void reset_bus();
22   bool select(int id);
23   void send_command(UINT8 *data, int bytes);
24   int get_length();
25   int get_phase();
26   void read_data(UINT8 *data, int bytes);
27   void write_data(UINT8 *data, int bytes);
28   UINT8 get_status();
29
30private:
31   int m_selected;
32   scsihle_device *get_device(int id);
33
34   required_device<SCSI_PORT_DEVICE> m_scsi_port;
35};
36
37#endif
Property changes on: branches/old_menus/src/emu/machine/legscsi.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/old_menus/src/emu/machine/smc92x4.c
r29633r29634
194194   m_out_auxbus(*this),
195195   m_in_auxbus(*this),
196196   m_in_dma(*this),
197   m_out_dma(*this)
197   m_out_dma(*this),
198   m_full_track_layout(FALSE)
198199{
199200}
200201
r29633r29634
19511952
19521953void smc92x4_device::device_start()
19531954{
1954   const smc92x4_interface *intf = reinterpret_cast<const smc92x4_interface *>(static_config());
1955
19561955   m_out_intrq.resolve_safe();
19571956   m_out_dip.resolve_safe();
19581957   m_out_auxbus.resolve_safe();
r29633r29634
19601959   m_out_dma.resolve_safe();
19611960   m_in_dma.resolve_safe(0);
19621961
1963   m_full_track_layout = intf->full_track_layout;
1964
19651962   // allocate timers
19661963   // m_timer_data = timer_alloc(DATA_TIMER);
19671964   m_timer_rs = timer_alloc(READ_TIMER);
branches/old_menus/src/emu/machine/smc92x4.h
r29633r29634
6666#define MCFG_SMC92X4_DMA_OUT_CALLBACK(_write) \
6767   devcb = &smc92x4_device::set_dma_wr_callback(*device, DEVCB2_##_write);
6868
69struct smc92x4_interface
70{
71   // Disk format support. This flag allows to choose between the full
72   // FM/MFM format and an abbreviated track layout. The difference results
73   // from legal variations of the layout. This is not part of
74   // the smc92x4 specification, but it allows to keep the image format
75   // simple without too much case checking. Should be removed as soon as
76   // the respective disk formats support the full format.
77   int full_track_layout;
78};
69// Disk format support. This flag allows to choose between the full
70// FM/MFM format and an abbreviated track layout. The difference results
71// from legal variations of the layout. This is not part of
72// the smc92x4 specification, but it allows to keep the image format
73// simple without too much case checking. Should be removed as soon as
74// the respective disk formats support the full format.
75#define MCFG_SMC92X4_FULL_TRACK_LAYOUT(_lay) \
76   smc92x4_device::set_full_track_layout(*device, _lay);
7977
8078
8179class smc92x4_device : public device_t
r29633r29634
9088   template<class _Object> static devcb2_base &set_dma_rd_callback(device_t &device, _Object object) { return downcast<smc92x4_device &>(device).m_in_dma.set_callback(object); }
9189   template<class _Object> static devcb2_base &set_dma_wr_callback(device_t &device, _Object object) { return downcast<smc92x4_device &>(device).m_out_dma.set_callback(object); }
9290
91   static void set_full_track_layout(device_t &device, bool lay) { downcast<smc92x4_device &>(device).m_full_track_layout = lay; }
92
9393   DECLARE_READ8_MEMBER( read );
9494   DECLARE_WRITE8_MEMBER( write );
9595
r29633r29634
226226   mfm_harddisk_device           *m_harddisk;
227227};
228228
229#define MCFG_SMC92X4_ADD(_tag, _intrf) \
230   MCFG_DEVICE_ADD(_tag, SMC92X4, 0) \
231   MCFG_DEVICE_CONFIG(_intrf)
232
233229#endif
branches/old_menus/src/emu/machine/atapihle.h
r29633r29634
1717#define __ATAPIHLE_H__
1818
1919#include "atahle.h"
20#include "scsihle.h"
20#include "t10spc.h"
2121
2222class atapi_hle_device : public ata_hle_device,
2323   public virtual t10spc
branches/old_menus/src/emu/machine/ncr5380.c
r29633r29634
7575//  ncr5380_device - constructor/destructor
7676//-------------------------------------------------
7777
78ncr5380_device::ncr5380_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
79   : device_t(mconfig, NCR5380, "5380 SCSI", tag, owner, clock, "ncr5380", __FILE__),
78ncr5380_device::ncr5380_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
79   legacy_scsi_host_adapter(mconfig, NCR5380, "5380 SCSI", tag, owner, clock, "ncr5380", __FILE__),
8080   m_irq_cb(*this)
8181{
8282}
r29633r29634
8787
8888void ncr5380_device::device_start()
8989{
90   legacy_scsi_host_adapter::device_start();
91
9092   memset(m_5380_Registers, 0, sizeof(m_5380_Registers));
9193   memset(m_5380_Data, 0, sizeof(m_5380_Data));
92   memset(m_scsi_devices, 0, sizeof(m_scsi_devices));
9394
9495   m_next_req_flag = 0;
9596   m_irq_cb.resolve_safe();
r29633r29634
102103   save_item(NAME(m_d_ptr));
103104   save_item(NAME(m_d_limit));
104105   save_item(NAME(m_next_req_flag));
105
106   // try to open the devices
107   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
108   {
109      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
110      if( scsidev != NULL )
111      {
112         m_scsi_devices[scsidev->GetDeviceID()] = scsidev;
113      }
114   }
115106}
116107
117108//-------------------------------------------------
r29633r29634
184175                  // don't issue a "false" read
185176                  if (m_d_limit > 0)
186177                  {
187                     ncr5380_read_data((m_d_limit < 512) ? m_d_limit : 512, m_5380_Data);
178                     read_data(m_5380_Data, (m_d_limit < 512) ? m_d_limit : 512);
188179                  }
189180                  else
190181                  {
r29633r29634
282273            // if we've hit a sector, flush
283274            if (m_d_ptr == 511)
284275            {
285               ncr5380_write_data(512, &m_5380_Data[0]);
276               write_data(&m_5380_Data[0], 512);
286277
287278               m_d_limit -= 512;
288279               m_d_ptr = 0;
r29633r29634
318309                  if (VERBOSE)
319310                     logerror("%s NCR5380: Command (to ID %d): %x %x %x %x %x %x %x %x %x %x\n", machine().describe_context(), m_last_id, m_5380_Command[0], m_5380_Command[1], m_5380_Command[2], m_5380_Command[3], m_5380_Command[4], m_5380_Command[5], m_5380_Command[6], m_5380_Command[7], m_5380_Command[8], m_5380_Command[9]);
320311
321                  m_scsi_devices[m_last_id]->SetCommand(&m_5380_Command[0], 16);
322                  m_scsi_devices[m_last_id]->ExecCommand();
323                  m_scsi_devices[m_last_id]->GetLength(&m_d_limit);
312                  send_command(&m_5380_Command[0], 16);
313                  m_d_limit = get_length();
324314
325315                  if (VERBOSE)
326316                     logerror("NCR5380: Command returned %d bytes\n",  m_d_limit);
r29633r29634
337327                     }
338328
339329                     // read back the amount available, or 512 bytes, whichever is smaller
340                     ncr5380_read_data((m_d_limit < 512) ? m_d_limit : 512, m_5380_Data);
330                     read_data(m_5380_Data, (m_d_limit < 512) ? m_d_limit : 512);
341331
342332                     // raise REQ to indicate data is available
343333                     m_5380_Registers[R5380_BUSSTATUS] |= 0x20;
r29633r29634
352342            // if the device exists, make the bus busy.
353343            // otherwise don't.
354344
355            if (m_scsi_devices[m_last_id])
345            if (select(m_last_id))
356346            {
357347               if (VERBOSE)
358348                  logerror("NCR5380: Giving the bus for ID %d\n", m_last_id);
r29633r29634
429419      m_5380_Registers[R5380_BUSANDSTAT] = 0x48;
430420   }
431421}
432
433
434void ncr5380_device::ncr5380_read_data(int bytes, UINT8 *pData)
435{
436   if (m_scsi_devices[m_last_id])
437   {
438      if (VERBOSE)
439         logerror("NCR5380: issuing read for %d bytes\n", bytes);
440      m_scsi_devices[m_last_id]->ReadData(pData, bytes);
441   }
442   else
443   {
444      logerror("ncr5380: read unknown device SCSI ID %d\n", m_last_id);
445   }
446}
447
448
449void ncr5380_device::ncr5380_write_data(int bytes, UINT8 *pData)
450{
451   if (m_scsi_devices[m_last_id])
452   {
453      m_scsi_devices[m_last_id]->WriteData(pData, bytes);
454   }
455   else
456   {
457      logerror("ncr5380: write to unknown device SCSI ID %d\n", m_last_id);
458   }
459}
branches/old_menus/src/emu/machine/ncr5380.h
r29633r29634
66#ifndef _NCR5380_H_
77#define _NCR5380_H_
88
9#include "machine/scsihle.h"
9#include "legscsi.h"
1010
1111// 5380 registers
1212enum
r29633r29634
3535#define MCFG_NCR5380_IRQ_CB(_devcb) \
3636   devcb = &ncr5380_device::set_irq_callback(*device, DEVCB2_##_devcb);
3737
38class ncr5380_device : public device_t
38class ncr5380_device : public legacy_scsi_host_adapter
3939{
4040public:
4141   // construction/destruction
r29633r29634
4747   UINT8 ncr5380_read_reg(UINT32 offset);
4848   void ncr5380_write_reg(UINT32 offset, UINT8 data);
4949
50   void ncr5380_read_data(int bytes, UINT8 *pData);
51   void ncr5380_write_data(int bytes, UINT8 *pData);
52
5350protected:
5451   // device-level overrides
5552   virtual void device_start();
r29633r29634
5754   virtual void device_stop();
5855
5956private:
60   scsihle_device *m_scsi_devices[8];
61
6257   UINT8 m_5380_Registers[8];
6358   UINT8 m_last_id;
6459   UINT8 m_5380_Command[32];
branches/old_menus/src/emu/machine/am53cf96.c
r29633r29634
1111
1212#include "emu.h"
1313#include "am53cf96.h"
14#include "machine/scsihle.h"
14#include "bus/scsi/scsihle.h"
1515
1616READ8_MEMBER( am53cf96_device::read )
1717{
r29633r29634
9090            scsi_regs[REG_IRQSTATE] = 8;    // indicate success
9191            xfer_state = 0;
9292            break;
93         case 2: // reset device
93         case 2: // reset am53cf96
9494            scsi_regs[REG_IRQSTATE] = 8;    // indicate success
9595
9696            logerror("53cf96: reset  target ID = %d (PC = %x)\n", last_id, space.device().safe_pc());
97            if (last_id <= 7 && devices[last_id])
98            {
99               devices[last_id]->reset();
100            }
101            else
102            {
103               logerror("53cf96: reset request for unknown device SCSI ID %d\n", last_id);
104            }
10597
10698            xfer_state = 0;
10799            break;
108100         case 3: // reset SCSI bus
109101            scsi_regs[REG_INTSTATE] = 4;    // command sent OK
102
103            reset_bus();
104
110105            xfer_state = 0;
111106            m_transfer_timer->adjust( attotime::from_hz( 16384 ) );
112107            break;
r29633r29634
122117            }
123118
124119            logerror("53cf96: command %x exec.  target ID = %d (PC = %x)\n", fifo[1], last_id, space.device().safe_pc());
125            if (last_id <= 7 && devices[last_id])
126            {
127               int length;
128120
129               devices[last_id]->SetCommand( &fifo[1], 12 );
130               devices[last_id]->ExecCommand();
131               devices[last_id]->GetLength(&length);
132            }
133            else
134            {
135               logerror("53cf96: request for unknown device SCSI ID %d\n", last_id);
136            }
121            select(last_id);
122            send_command(&fifo[1], 12);
137123            xfer_state = 0;
138124            break;
139125         case 0x44:  // enable selection/reselection
r29633r29634
159145}
160146
161147am53cf96_device::am53cf96_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
162   device_t(mconfig, AM53CF96, "53CF96 SCSI", tag, owner, clock, "am53cf96", __FILE__),
148   legacy_scsi_host_adapter(mconfig, AM53CF96, "53CF96 SCSI", tag, owner, clock, "am53cf96", __FILE__),
163149   m_irq_handler(*this)
164150{
165151}
166152
167153void am53cf96_device::device_start()
168154{
155   legacy_scsi_host_adapter::device_start();
156
169157   m_irq_handler.resolve_safe();
170158
171159   memset(scsi_regs, 0, sizeof(scsi_regs));
172   memset(devices, 0, sizeof(devices));
173160
174   // try to open the devices
175   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
176   {
177      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
178      if( scsidev != NULL )
179      {
180         devices[scsidev->GetDeviceID()] = scsidev;
181      }
182   }
183
184161   fptr = 0;
185162   xfer_state = 0;
186163   last_id = -1;
r29633r29634
199176{
200177   scsi_regs[REG_STATUS] |= 0x10;  // indicate DMA finished
201178
202   if (last_id <= 7 && devices[last_id])
203   {
204      devices[last_id]->ReadData( pData, bytes );
205   }
206   else
207   {
208      logerror("53cf96: request for unknown device SCSI ID %d\n", last_id);
209   }
179   read_data(pData, bytes);
210180}
211181
212182// write data to the SCSI controller
r29633r29634
216186
217187   scsi_regs[REG_STATUS] |= 0x10;  // indicate DMA finished
218188
219   if (last_id <= 7 && devices[last_id])
220   {
221      devices[last_id]->WriteData( pData, bytes );
222   }
223   else
224   {
225      logerror("53cf96: request for unknown device SCSI ID %d\n", last_id);
226   }
189   write_data(pData, bytes);
227190}
228191
229192const device_type AM53CF96 = &device_creator<am53cf96_device>;
branches/old_menus/src/emu/machine/am53cf96.h
r29633r29634
66#ifndef _AM53CF96_H_
77#define _AM53CF96_H_
88
9#include "machine/scsihle.h"
9#pragma once
1010
11#define MCFG_AM53CF96_ADD( _tag ) \
12   MCFG_DEVICE_ADD( _tag, AM53CF96, 0 )
11#include "legscsi.h"
1312
1413#define MCFG_AM53CF96_IRQ_HANDLER(_devcb) \
1514   devcb = &am53cf96_device::set_irq_handler(*device, DEVCB2_##_devcb);
15
1616// 53CF96 register set
1717enum
1818{
r29633r29634
3535   REG_DATAALIGN       // data alignment (write only)
3636};
3737
38class am53cf96_device : public device_t
38class am53cf96_device : public legacy_scsi_host_adapter
3939{
4040public:
4141   // construction/destruction
r29633r29634
5858private:
5959   static const device_timer_id TIMER_TRANSFER = 0;
6060
61   scsihle_device *devices[8];
62
6361   UINT8 scsi_regs[32];
6462   UINT8 fifo[16];
6563   UINT8 fptr;
branches/old_menus/src/emu/machine/mb89352.c
r29633r29634
113113 * Device
114114 */
115115
116mb89352_device::mb89352_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
117   : device_t(mconfig, MB89352A, "MB89352A", tag, owner, clock, "mb89352", __FILE__),
118      m_irq_cb(*this),
119      m_drq_cb(*this)
116mb89352_device::mb89352_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
117   legacy_scsi_host_adapter(mconfig, MB89352A, "MB89352A", tag, owner, clock, "mb89352", __FILE__),
118   m_irq_cb(*this),
119   m_drq_cb(*this)
120120{
121121}
122122
123123void mb89352_device::device_start()
124124{
125   legacy_scsi_host_adapter::device_start();
126
125127   m_phase = SCSI_PHASE_BUS_FREE;
126128   m_target = 0;
127129   m_command_index = 0;
r29633r29634
136138   m_irq_cb.resolve_safe();
137139   m_drq_cb.resolve_safe();
138140
139   memset(m_SCSIdevices,0,sizeof(m_SCSIdevices));
140
141141   // allocate read timer
142142   m_transfer_timer = timer_alloc(TIMER_TRANSFER);
143
144   // try to open the devices
145   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
146   {
147      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
148      if( scsidev != NULL )
149      {
150         m_SCSIdevices[scsidev->GetDeviceID()] = scsidev;
151      }
152   }
153143}
154144
155145void mb89352_device::device_reset()
r29633r29634
304294         m_transfer_index++;
305295         m_transfer_count--;
306296         if(m_transfer_index % 512 == 0)
307            m_SCSIdevices[m_target]->ReadData(m_buffer,512);
297            read_data(m_buffer, 512);
308298         if(m_transfer_count == 0)
309299         {
310300            // End of transfer
r29633r29634
437427         {
438428            //m_ints |= INTS_SELECTION;
439429         }
430         select(m_target);
440431         set_phase(SCSI_PHASE_COMMAND); // straight to command phase, may need a delay between selection and command phases
441432         m_line_status |= MB89352_LINE_SEL;
442433         m_line_status |= MB89352_LINE_BSY;
r29633r29634
462453         if(m_phase == SCSI_PHASE_DATAIN)  // if we are reading data...
463454         {
464455            m_spc_status &= ~SSTS_DREG_EMPTY;  // DREG is no longer empty
465            m_SCSIdevices[m_target]->ReadData(m_buffer,512);
456            read_data(m_buffer, 512);
466457         }
467458         if(m_phase == SCSI_PHASE_MESSAGE_IN)
468459         {
r29633r29634
504495               int x;
505496               int phase;
506497               // execute SCSI command
507               m_SCSIdevices[m_target]->SetCommand(m_command,m_command_index);
508               m_SCSIdevices[m_target]->ExecCommand();
509               m_SCSIdevices[m_target]->GetLength(&m_result_length);
510               m_SCSIdevices[m_target]->GetPhase(&phase);
498               send_command(m_command, m_command_index);
499               phase = get_phase();
511500               if(m_command[0] == 1) // Rezero Unit - not implemented in SCSI code
512501                  set_phase(SCSI_PHASE_STATUS);
513502               else
r29633r29634
521510         }
522511         if(m_phase == SCSI_PHASE_STATUS)
523512         {
524            void *image;
525            m_SCSIdevices[m_target]->GetDevice(&image);
526            if (image != NULL)
527               m_temp = 0x00;
528            else
529               m_temp = 0x02;
513            m_temp = get_status();
530514            set_phase(SCSI_PHASE_MESSAGE_IN);
531515            return;
532516         }
r29633r29634
570554            int x;
571555            int phase;
572556            // execute SCSI command
573            m_SCSIdevices[m_target]->SetCommand(m_command,m_command_index);
574            m_SCSIdevices[m_target]->ExecCommand();
575            m_SCSIdevices[m_target]->GetLength(&m_result_length);
576            m_SCSIdevices[m_target]->GetPhase(&phase);
557            send_command(m_command, m_command_index);
558            phase = get_phase();
577559            if(m_command[0] == 1) // Rezero Unit - not implemented in SCSI code
578560               set_phase(SCSI_PHASE_STATUS);
579561            else
r29633r29634
592574         m_transfer_index++;
593575         m_transfer_count--;
594576         if(m_transfer_index % 512 == 0)
595            m_SCSIdevices[m_target]->WriteData(m_buffer,512);
577            write_data(m_buffer, 512);
596578         if(m_transfer_count == 0)
597579         {
598580            // End of transfer
branches/old_menus/src/emu/machine/adc083x.c
r29633r29634
9898{
9999   clear_sars();
100100
101   /* resolve callbacks */
102   m_input_callback.bind_relative_to(*owner());
103
101104   /* register for state saving */
102105   save_item( NAME(m_cs) );
103106   save_item( NAME(m_clk) );
r29633r29634
178181   int negative_channel = ADC083X_AGND;
179182   double positive = 0;
180183   double negative = 0;
181   double gnd = m_input_callback( this, ADC083X_AGND );
182   double vref = m_input_callback( this, ADC083X_VREF );
184   double gnd = m_input_callback(ADC083X_AGND);
185   double vref = m_input_callback(ADC083X_VREF);
183186
184187   if( type() == ADC0831 )
185188   {
r29633r29634
225228
226229   if( positive_channel != ADC083X_AGND )
227230   {
228      positive = m_input_callback( this, positive_channel ) - gnd;
231      positive = m_input_callback(positive_channel) - gnd;
229232   }
230233
231234   if( negative_channel != ADC083X_AGND )
232235   {
233      negative = m_input_callback( this, negative_channel ) - gnd;
236      negative = m_input_callback(negative_channel) - gnd;
234237   }
235238
236239   result = (int) ( ( ( positive - negative ) * 255 ) / vref );
branches/old_menus/src/emu/machine/mb89352.h
r29633r29634
77#ifndef MB89352_H_
88#define MB89352_H_
99
10#include "machine/scsihle.h"
10#include "legscsi.h"
1111
1212// SCSI lines readable via PSNS register (reg 5)
1313#define MB89352_LINE_REQ 0x80
r29633r29634
5454#define MCFG_MB89352A_DRQ_CB(_devcb) \
5555   devcb = &mb89352_device::set_drq_callback(*device, DEVCB2_##_devcb);
5656
57class mb89352_device : public device_t
57class mb89352_device : public legacy_scsi_host_adapter
5858{
5959public:
6060   // construction/destruction
r29633r29634
8787   devcb2_write_line m_irq_cb;  /* irq callback */
8888   devcb2_write_line m_drq_cb;  /* drq callback */
8989
90   scsihle_device* m_SCSIdevices[8];
91
9290   UINT8 m_phase;  // current SCSI phase
9391   UINT8 m_target; // current SCSI target
9492   UINT8 m_bdid;  // Bus device ID (SCSI ID of the bus?)
r29633r29634
109107   UINT8 m_command_index;
110108   UINT8 m_command[16];
111109   UINT32 m_transfer_index;
112   int m_result_length;
113110   UINT8 m_buffer[512];
114111
115112   emu_timer* m_transfer_timer;
branches/old_menus/src/emu/machine/adc083x.h
r29633r29634
1515    TYPE DEFINITIONS
1616***************************************************************************/
1717
18typedef double (*adc083x_input_callback)(device_t *device, UINT8 input);
18typedef device_delegate<double (UINT8 input)> adc083x_input_delegate;
19#define ADC083X_INPUT_CB(name)  double name(UINT8 input)
1920
20#define MCFG_ADC083X_INPUT_CALLBACK(input_callback) \
21   adc083x_device::set_input_callback(*device, input_callback);
21#define MCFG_ADC083X_INPUT_CB(_class, _method) \
22   adc083x_device::set_input_callback(*device, adc083x_input_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
2223
2324/***************************************************************************
2425    CONSTANTS
r29633r29634
4647   adc083x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
4748
4849   // static configuration helpers
49   static void set_input_callback(device_t &device, adc083x_input_callback input_callback) { downcast<adc083x_device &>(device).m_input_callback = input_callback; }
50   static void set_input_callback(device_t &device, adc083x_input_delegate input_callback) { downcast<adc083x_device &>(device).m_input_callback = input_callback; }
5051
5152   DECLARE_WRITE_LINE_MEMBER( cs_write );
5253   DECLARE_WRITE_LINE_MEMBER( clk_write );
r29633r29634
8182   INT32 m_bit;
8283   INT32 m_output;
8384
84   adc083x_input_callback m_input_callback;
85   adc083x_input_delegate m_input_callback;
8586};
8687
8788class adc0831_device : public adc083x_device
branches/old_menus/src/emu/machine/machine.mak
r29633r29634
372372
373373#-------------------------------------------------
374374#
375#@src/emu/machine/cdu76s.h,MACHINES += CDU76S
376#-------------------------------------------------
377
378ifneq ($(filter CDU76S,$(MACHINES)),)
379MACHINEOBJS += $(MACHINEOBJ)/cdu76s.o
380endif
381
382#-------------------------------------------------
383#
384375#@src/emu/machine/com8116.h,MACHINES += COM8116
385376#-------------------------------------------------
386377
r29633r29634
13701361
13711362#-------------------------------------------------
13721363#
1373#@src/emu/machine/scsibus.h,MACHINES += SCSI
1374#@src/emu/machine/scsicb.h,MACHINES += SCSI
1375#@src/emu/machine/scsicd.h,MACHINES += SCSI
1376#@src/emu/machine/scsidev.h,MACHINES += SCSI
1377#@src/emu/machine/scsihd.h,MACHINES += SCSI
1378#@src/emu/machine/scsihle.h,MACHINES += SCSI
1379#-------------------------------------------------
1380
1381ifneq ($(filter SCSI,$(MACHINES)),)
1382MACHINEOBJS += $(MACHINEOBJ)/scsibus.o
1383MACHINEOBJS += $(MACHINEOBJ)/scsicb.o
1384MACHINEOBJS += $(MACHINEOBJ)/scsicd.o
1385MACHINEOBJS += $(MACHINEOBJ)/scsidev.o
1386MACHINEOBJS += $(MACHINEOBJ)/scsihd.o
1387MACHINEOBJS += $(MACHINEOBJ)/scsihle.o
1388MACHINES += T10
1389endif
1390
1391#-------------------------------------------------
1392#
13931364#@src/emu/machine/seibu_cop.h,MACHINES += SEIBU_COP
13941365#-------------------------------------------------
13951366
r29633r29634
14351406
14361407#-------------------------------------------------
14371408#
1409#
14381410#-------------------------------------------------
14391411
1412ifneq ($(filter SCSI,$(BUSES)),)
1413MACHINES += T10
1414endif
1415
14401416ifneq ($(filter T10,$(MACHINES)),)
14411417MACHINEOBJS += $(MACHINEOBJ)/t10mmc.o
14421418MACHINEOBJS += $(MACHINEOBJ)/t10sbc.o
14431419MACHINEOBJS += $(MACHINEOBJ)/t10spc.o
1444MACHINES += T10
14451420endif
14461421
14471422#-------------------------------------------------
branches/old_menus/src/emu/machine/wd33c93.c
r29633r29634
162162   return count;
163163}
164164
165void wd33c93_device::read_data(int bytes, UINT8 *pData)
166{
167   UINT8 unit = getunit();
168
169   if ( devices[unit] )
170   {
171      devices[unit]->ReadData( pData, bytes );
172   }
173   else
174   {
175      logerror("wd33c93: request for unknown device SCSI ID %d\n", unit);
176   }
177}
178
179165void wd33c93_device::complete_immediate( int status )
180166{
181167   /* reset our timer */
r29633r29634
285271   UINT8 newstatus;
286272
287273   /* see if we can select that device */
288   if ( devices[unit] )
274   if (select(unit))
289275   {
290276      /* device is available - signal selection done */
291277      newstatus = CSR_SELECT;
r29633r29634
321307   UINT8 newstatus;
322308
323309   /* see if we can select that device */
324   if ( devices[unit] )
310   if (select(unit))
325311   {
326312      if ( regs[WD_COMMAND_PHASE] < 0x45 )
327313      {
328314         /* device is available */
329         int xfercount;
330315         int phase;
331316
332317         /* do the request */
333         devices[unit]->SetCommand( &regs[WD_CDB_1], 12 );
334         devices[unit]->ExecCommand();
335         devices[unit]->GetLength( &xfercount );
336         devices[unit]->GetPhase( &phase );
318         send_command(&regs[WD_CDB_1], 12);
319         phase = get_phase();
337320
338321         /* set transfer count */
339322         if ( get_xfer_count() > TEMP_INPUT_LEN )
r29633r29634
357340         if ( get_xfer_count() < len ) len = get_xfer_count();
358341
359342         memset( &temp_input[0], 0, TEMP_INPUT_LEN );
360         read_data( len, &temp_input[0] );
343         read_data(&temp_input[0], len);
361344         temp_input_pos = 0;
362345         read_pending = 0;
363346      }
r29633r29634
549532
550533                     case PHS_COMMAND:
551534                     {
552                        UINT8 unit = getunit();
553535                        int xfercount;
554536                        int phase;
555537
556538                        /* Execute the command. Depending on the command, we'll move to data in or out */
557                        devices[unit]->SetCommand( &fifo[0], 12 );
558                        devices[unit]->ExecCommand();
559                        devices[unit]->GetLength( &xfercount );
560                        devices[unit]->GetPhase( &phase );
539                        send_command(&fifo[0], 12);
540                        xfercount = get_length();
541                        phase = get_phase();
561542
562543                        /* reset fifo */
563544                        fifo_pos = 0;
r29633r29634
586567                     case PHS_DATA_OUT:
587568                     {
588569                        /* write data out to device */
589                        write_data( fifo_pos, fifo );
570                        write_data(fifo, fifo_pos);
590571
591572                        /* reset fifo */
592573                        fifo_pos = 0;
r29633r29634
683664                  int len = TEMP_INPUT_LEN;
684665
685666                  if ( (count+1) < len ) len = count+1;
686                  read_data( len, &temp_input[0] );
667                  read_data(&temp_input[0], len);
687668                  temp_input_pos = 0;
688669                  read_pending = 0;
689670               }
r29633r29634
741722   return 0;
742723}
743724
744wd33c93_device::wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
745   : device_t(mconfig, WD33C93, "33C93 SCSI", tag, owner, clock, "wd33c93", __FILE__),
746      m_irq_cb(*this)
725wd33c93_device::wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
726   legacy_scsi_host_adapter(mconfig, WD33C93, "33C93 SCSI", tag, owner, clock, "wd33c93", __FILE__),
727   m_irq_cb(*this)
747728{
748729}
749730
750731void wd33c93_device::device_start()
751732{
733   legacy_scsi_host_adapter::device_start();
734
752735   memset(regs, 0, sizeof(regs));
753   memset(devices, 0, sizeof(devices));
754736   memset(fifo, 0, sizeof(fifo));
755737   memset(temp_input, 0, sizeof(temp_input));
756738
r29633r29634
761743   identify = 0;
762744   read_pending = 0;
763745
764   // try to open the devices
765   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
766   {
767      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
768      if( scsidev != NULL )
769      {
770         devices[scsidev->GetDeviceID()] = scsidev;
771      }
772   }
773746   m_irq_cb.resolve();
774747
775748   /* allocate a timer for commands */
r29633r29634
788761   save_item( NAME( read_pending ) );
789762}
790763
791void wd33c93_device::get_dma_data( int bytes, UINT8 *pData )
764void wd33c93_device::dma_read_data( int bytes, UINT8 *pData )
792765{
793766   int len = bytes;
794767
r29633r29634
813786   set_xfer_count(len);
814787}
815788
816void wd33c93_device::write_data(int bytes, UINT8 *pData)
789void wd33c93_device::dma_write_data(int bytes, UINT8 *pData)
817790{
818   UINT8 unit = getunit();
819
820   if (devices[unit])
821   {
822      devices[unit]->WriteData( pData, bytes );
823   }
824   else
825   {
826      logerror("wd33c93: request for unknown device SCSI ID %d\n", unit);
827   }
791   write_data(pData, bytes);
828792}
829793
830794void wd33c93_device::clear_dma()
branches/old_menus/src/emu/machine/wd33c93.h
r29633r29634
66#ifndef _WD33C93_H_
77#define _WD33C93_H_
88
9#include "machine/scsihle.h"
9#include "legscsi.h"
1010
1111/* wd register names */
1212
r29633r29634
4848#define MCFG_WD33C93_IRQ_CB(_devcb) \
4949   devcb = &wd33c93_device::set_irq_callback(*device, DEVCB2_##_devcb);
5050
51class wd33c93_device : public device_t
51class wd33c93_device : public legacy_scsi_host_adapter
5252{
5353public:
5454   // construction/destruction
r29633r29634
5959   DECLARE_READ8_MEMBER(read);
6060   DECLARE_WRITE8_MEMBER(write);
6161
62   void get_dma_data( int bytes, UINT8 *pData );
63   void write_data(int bytes, UINT8 *pData);
62   void dma_read_data( int bytes, UINT8 *pData );
63   void dma_write_data(int bytes, UINT8 *pData);
6464   void clear_dma();
6565   int get_dma_count();
6666
r29633r29634
7373   UINT8 getunit( void );
7474   void set_xfer_count( int count );
7575   int get_xfer_count( void );
76   void read_data(int bytes, UINT8 *pData);
7776   void complete_immediate( int status );
7877   void complete_cmd( UINT8 status );
7978   void unimplemented_cmd();
r29633r29634
8786   void xferinfo_cmd();
8887   void dispatch_command();
8988
90   scsihle_device *devices[8]; // SCSI IDs 0-7
91
9289   UINT8       sasr;
9390   UINT8       regs[WD_AUXILIARY_STATUS+1];
9491   UINT8       fifo[FIFO_SIZE];
branches/old_menus/src/emu/machine/mm58274c.c
r29633r29634
4646
4747
4848mm58274c_device::mm58274c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
49            : device_t(mconfig, MM58274C, "National Semiconductor MM58274C", tag, owner, clock, "mm58274c", __FILE__)
49            : device_t(mconfig, MM58274C, "National Semiconductor MM58274C", tag, owner, clock, "mm58274c", __FILE__),
50               m_mode24(0),
51               m_day1(0)
5052{
5153}
5254
5355
5456//-------------------------------------------------
55//  device_config_complete - perform any
56//  operations now that the configuration is
57//  complete
58//-------------------------------------------------
59
60void mm58274c_device::device_config_complete()
61{
62   // inherit a copy of the static data
63   const mm58274c_interface *intf = reinterpret_cast<const mm58274c_interface *>(static_config());
64   if (intf != NULL)
65      *static_cast<mm58274c_interface *>(this) = *intf;
66   // or initialize to defaults if none provided
67   else
68   {
69      m_mode24 = 0;
70      m_day1 = 0;
71   }
72}
73
74//-------------------------------------------------
7557//  device_start - device-specific startup
7658//-------------------------------------------------
7759
branches/old_menus/src/emu/machine/mm58274c.h
r29633r29634
11#ifndef __MM58274C_H__
22#define __MM58274C_H__
33
4
5/*
6 Initializes the clock chip.
7 day1 must be set to a value from 0 (sunday), 1 (monday) ...
8 to 6 (saturday) and is needed to correctly retrieve the day-of-week
9 from the host system clock.
10 */
11
12struct mm58274c_interface
13{
14   int m_mode24;     /* 24/12 mode */
15   int m_day1;       /* first day of week */
16};
17
18
194/***************************************************************************
205    MACROS
216***************************************************************************/
227
23class mm58274c_device : public device_t,
24                  public mm58274c_interface
8class mm58274c_device : public device_t
259{
2610public:
2711   mm58274c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2812   ~mm58274c_device() {}
2913
14   static void set_mode24(device_t &device, int mode) { downcast<mm58274c_device &>(device).m_mode24 = mode; }
15   static void set_day1(device_t &device, int day) { downcast<mm58274c_device &>(device).m_day1 = day; }
16
3017   DECLARE_READ8_MEMBER(read);
3118   DECLARE_WRITE8_MEMBER(write);
3219
r29633r29634
3522
3623protected:
3724   // device-level overrides
38   virtual void device_config_complete();
3925   virtual void device_start();
4026   virtual void device_reset();
4127
4228private:
4329   // internal state
30
31   // Initializion the clock chip:
32   // m_day1 must be set to a value from 0 (sunday), 1 (monday)...
33   // to 6 (saturday) and is needed to correctly retrieve the
34   // day-of-week from the host system clock.
35   int m_mode24;     /* 24/12 mode */
36   int m_day1;       /* first day of week */
37
4438   attotime interrupt_period_table(int val);
4539
4640   int m_status;     /* status register (*read* from address 0 = control register) */
r29633r29634
4943   int m_clk_set;    /* clock setting register */
5044   int m_int_ctl;    /* interrupt control register */
5145
52
5346   int m_wday;       /* day of the week (1-7 (1=day1 as set in init)) */
5447   int m_years1;     /* years (BCD: 0-99) */
5548   int m_years2;
r29633r29634
8073   MCFG_DEVICE_ADD(_tag, MM58274C, 0) \
8174   MCFG_DEVICE_CONFIG(_intrf)
8275
76#define MCFG_MM58274C_MODE24(_mode) \
77   mm58274c_device::set_mode24(*device, _mode);
78
79#define MCFG_MM58274C_DAY1(_day) \
80   mm58274c_device::set_day1(*device, _day);
81
82
8383#endif
branches/old_menus/src/emu/machine/ncr539x.c
r29633r29634
114114//  ncr539x_device - constructor/destructor
115115//-------------------------------------------------
116116
117ncr539x_device::ncr539x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
118   : device_t(mconfig, NCR539X, "539x SCSI", tag, owner, clock, "ncr539x", __FILE__),
117ncr539x_device::ncr539x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
118   legacy_scsi_host_adapter(mconfig, NCR539X, "539x SCSI", tag, owner, clock, "ncr539x", __FILE__),
119119   m_out_irq_cb(*this),
120120   m_out_drq_cb(*this)
121121{
r29633r29634
127127
128128void ncr539x_device::device_start()
129129{
130   memset(m_scsi_devices, 0, sizeof(m_scsi_devices));
130   legacy_scsi_host_adapter::device_start();
131131
132132   // resolve line callbacks
133133   m_out_irq_cb.resolve_safe();
134134   m_out_drq_cb.resolve_safe();
135135
136   // try to open the devices
137   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
138   {
139      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
140      if( scsidev != NULL )
141      {
142         m_scsi_devices[scsidev->GetDeviceID()] = scsidev;
143      }
144   }
145
146136   m_operation_timer = timer_alloc(0, NULL);
147137}
148138
r29633r29634
152142
153143void ncr539x_device::device_reset()
154144{
155   memset(m_scsi_devices, 0, sizeof(m_scsi_devices));
156
157145   m_fifo_ptr = 0;
158146   m_irq_status = 0;
159147   m_status = SCSI_PHASE_STATUS;
r29633r29634
174162
175163void ncr539x_device::dma_read_data(int bytes, UINT8 *pData)
176164{
177   if (m_scsi_devices[m_last_id])
178   {
179      if (VERBOSE)
180         logerror("NCR539x: issuing read for %d bytes\n", bytes);
181      m_scsi_devices[m_last_id]->ReadData(pData, bytes);
182   }
183   else
184   {
185      logerror("ncr539x: read unknown device SCSI ID %d\n", m_last_id);
186   }
165   read_data(pData, bytes);
187166}
188167
189168
190169void ncr539x_device::dma_write_data(int bytes, UINT8 *pData)
191170{
192   if (bytes)
193   {
194      if (m_scsi_devices[m_last_id])
195      {
196         m_scsi_devices[m_last_id]->WriteData(pData, bytes);
197      }
198      else
199      {
200         logerror("ncr539x: write to unknown device SCSI ID %d\n", m_last_id);
201      }
202   }
171   write_data(pData, bytes);
203172}
204173
205174void ncr539x_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
r29633r29634
218187         switch (m_command & 0x7f)
219188         {
220189            case 0x41:  // select without ATN steps
221               if (m_scsi_devices[m_last_id])
190               if (select(m_last_id))
222191               {
223192                  m_irq_status |= IRQ_STATUS_SERVICE_REQUEST | IRQ_STATUS_SUCCESS;
224193                  // we should now be in the command phase
r29633r29634
250219               break;
251220
252221            case 0x42:  // Select with ATN steps
253               if (m_scsi_devices[m_last_id])
222               if (select(m_last_id))
254223               {
255224                  m_irq_status |= IRQ_STATUS_SERVICE_REQUEST | IRQ_STATUS_SUCCESS;
256225                  // we should now be in the command phase
r29633r29634
532501               m_irq_status = IRQ_STATUS_SUCCESS;
533502
534503               int phase;
535               m_scsi_devices[m_last_id]->GetPhase( &phase );
504               phase = get_phase();
536505
537506               #if VERBOSE
538507               printf("Information transfer: phase %d buffer remaining %x\n", phase, m_buffer_remaining);
r29633r29634
556525
557526                     if (amtToGet > 0)
558527                     {
559                        m_scsi_devices[m_last_id]->ReadData(m_buffer, amtToGet);
528                        read_data(m_buffer, amtToGet);
560529
561530                        m_total_data -= amtToGet;
562531                        m_buffer_offset = 0;
r29633r29634
647616               break;
648617
649618            case 0x47:  // Reselect with ATN3 steps
650               if (m_scsi_devices[m_last_id])
619               if (select(m_last_id))
651620               {
652621                  m_irq_status |= IRQ_STATUS_SERVICE_REQUEST | IRQ_STATUS_SUCCESS;
653622                  // we should now be in the command phase
r29633r29634
754723{
755724   int length, phase;
756725
757   m_scsi_devices[m_last_id]->SetCommand(&m_fifo[0], 12);
758   m_scsi_devices[m_last_id]->ExecCommand();
759   m_scsi_devices[m_last_id]->GetLength(&length);
760   m_scsi_devices[m_last_id]->GetPhase(&phase);
726   send_command(&m_fifo[0], 12);
727   length = get_length();
728   phase = get_phase();
761729
762730   #if VERBOSE
763731   printf("Command executed (id %d), new phase %d, length %x\n", m_last_id, phase, length);
r29633r29634
818786         #if VERBOSE
819787         printf("Flushing buffer to device, %x bytes left in buffer (%x total)\n", m_xfer_count, m_total_data);
820788         #endif
821         m_scsi_devices[m_last_id]->WriteData(m_buffer, flush_size);
789         write_data(m_buffer, flush_size);
822790         m_buffer_offset = 0;
823791
824792         // need a service request here too
branches/old_menus/src/emu/machine/ncr539x.h
r29633r29634
66#ifndef _NCR539x_H_
77#define _NCR539x_H_
88
9#include "machine/scsihle.h"
9#include "legscsi.h"
1010
1111//// 539x registers
1212//enum
r29633r29634
2121#define MCFG_NCR539X_OUT_DRQ_CB(_devcb) \
2222   devcb = &ncr539x_device::set_out_drq_callback(*device, DEVCB2_##_devcb);
2323   
24
25class ncr539x_device : public device_t
24class ncr539x_device : public legacy_scsi_host_adapter
2625{
2726public:
2827   // construction/destruction
r29633r29634
5049   void exec_fifo();
5150   void update_fifo_internal_state(int bytes);
5251
53   scsihle_device *m_scsi_devices[8];
54
5552   UINT32 m_xfer_count;
5653   UINT32 m_dma_size;
5754   UINT8 m_command;
branches/old_menus/src/mess/drivers/bebox.c
r29633r29634
2424#include "machine/idectrl.h"
2525#include "bus/pci/mpc105.h"
2626#include "machine/intelfsh.h"
27#include "machine/scsibus.h"
27#include "bus/scsi/scsi.h"
2828#include "machine/53c810.h"
2929
3030/* Devices */
31#include "machine/scsicd.h"
32#include "machine/scsihd.h"
31#include "bus/scsi/scsicd.h"
32#include "bus/scsi/scsihd.h"
3333#include "formats/pc_dsk.h"
3434#include "machine/ram.h"
3535#include "machine/8042kbdc.h"
r29633r29634
188188
189189   MCFG_FUJITSU_29F016A_ADD("flash")
190190
191   MCFG_SCSIBUS_ADD("scsi")
192   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_0)
193   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_3)
191   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
192   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
193   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "cdrom", SCSICD, SCSI_ID_3)
194
194195   MCFG_DEVICE_ADD("scsi:lsi53c810", LSI53C810, 0)
195196   MCFG_LSI53C810_IRQ_CB(bebox_state, scsi_irq_callback)
196197   MCFG_LSI53C810_DMA_CB(bebox_state, scsi_dma_callback)
197198   MCFG_LSI53C810_FETCH_CB(bebox_state, scsi_fetch)
199   MCFG_LEGACY_SCSI_PORT("scsi")
198200
199201   MCFG_IDE_CONTROLLER_ADD( "ide", ata_devices, "hdd", NULL, false ) /* FIXME */
200202   MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(bebox_state, bebox_ide_interrupt))
branches/old_menus/src/mess/drivers/bullet.c
r29633r29634
6060
6161#include "includes/bullet.h"
6262#include "bus/rs232/rs232.h"
63#include "bus/scsi/scsihd.h"
6364
6465
6566
r29633r29634
530531
531532READ8_MEMBER( bulletf_state::scsi_r )
532533{
533   UINT8 data = m_scsibus->scsi_data_r();
534   UINT8 data = m_scsi_data_in->read();
534535
535   m_scsibus->scsi_ack_w(1);
536   m_scsibus->write_ack(1);
536537
537538   m_wack = 0;
538539   update_dma_rdy();
r29633r29634
547548
548549WRITE8_MEMBER( bulletf_state::scsi_w )
549550{
550   m_scsibus->scsi_data_w(data);
551   m_scsi_data_out->write(data);
551552
552   m_scsibus->scsi_ack_w(1);
553   m_scsibus->write_ack(1);
553554
554555   m_wack = 0;
555556   update_dma_rdy();
r29633r29634
970971};
971972
972973
973//-------------------------------------------------
974//  Z80PIO_INTERFACE( bulletf_pio_intf )
975//-------------------------------------------------
976
977READ8_MEMBER( bulletf_state::pio_pa_r )
974WRITE8_MEMBER( bulletf_state::pio_pa_w )
978975{
979976   /*
980977
981978       bit     signal
982979
983       0
984       1
985       2
980       0       ATN
981       1       RST
982       2       SEL
986983       3       BUSY
987984       4       MSG
988985       5       C/D
r29633r29634
991988
992989   */
993990
994   UINT8 data = 0;
995
996   data |= m_scsibus->scsi_bsy_r() << 3;
997   data |= m_scsibus->scsi_msg_r() << 4;
998   data |= m_scsibus->scsi_cd_r() << 5;
999   data |= m_scsibus->scsi_req_r() << 6;
1000   data |= m_scsibus->scsi_io_r() << 7;
1001
1002   return data;
991   m_scsibus->write_atn(BIT(data, 0));
992   m_scsibus->write_rst(BIT(data, 1));
993   m_scsibus->write_sel(BIT(data, 2));
1003994}
1004995
1005WRITE8_MEMBER( bulletf_state::pio_pa_w )
1006{
1007   /*
1008
1009       bit     signal
1010
1011       0       ATN
1012       1       RST
1013       2       SEL
1014       3
1015       4
1016       5
1017       6
1018       7
1019
1020   */
1021
1022   m_scsibus->scsi_atn_w(BIT(data, 0));
1023   m_scsibus->scsi_rst_w(BIT(data, 1));
1024   m_scsibus->scsi_sel_w(BIT(data, 2));
1025}
1026
1027996WRITE_LINE_MEMBER( bulletf_state::cstrb_w )
1028997{
1029998   m_centronics->write_strobe(!state);
r29633r29634
10321001static Z80PIO_INTERFACE( bulletf_pio_intf )
10331002{
10341003   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),
1035   DEVCB_DRIVER_MEMBER(bulletf_state, pio_pa_r),
1004   DEVCB_DEVICE_MEMBER("scsi_ctrl_in", input_buffer_device, read),
10361005   DEVCB_DRIVER_MEMBER(bulletf_state, pio_pa_w),
10371006   DEVCB_DEVICE_MEMBER("cent_data_out", output_latch_device, write),
10381007   DEVCB_NULL,
r29633r29634
10701039{
10711040   if (!state)
10721041   {
1073      m_scsibus->scsi_ack_w(0);
1042      m_scsibus->write_ack(0);
10741043
10751044      m_wack = 1;
10761045   }
10771046
10781047   m_wrdy = !state;
10791048   update_dma_rdy();
1049
1050   m_scsi_ctrl_in->write_bit6(state);
10801051}
10811052
10821053
r29633r29634
13041275   MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL)
13051276   MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w))
13061277
1307   MCFG_SCSIBUS_ADD(SCSIBUS_TAG)
1308   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":harddisk0", SCSIHD, SCSI_ID_0)
1309   MCFG_SCSICB_ADD(SCSIBUS_TAG ":host")
1310   MCFG_SCSICB_REQ_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, bulletf_state, req_w))
1278   MCFG_DEVICE_ADD(SCSIBUS_TAG, SCSI_PORT, 0)
1279   MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit3))
1280   MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit4))
1281   MCFG_SCSI_CD_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit5))
1282   MCFG_SCSI_REQ_HANDLER(WRITELINE(bulletf_state, req_w))
1283   MCFG_SCSI_IO_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit7))
1284   MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in")
13111285
1286   MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SCSIBUS_TAG)
1287   MCFG_DEVICE_ADD("scsi_ctrl_in", INPUT_BUFFER, 0)
1288   MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0)
1289
1290   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
1291
13121292   // software lists
13131293   MCFG_SOFTWARE_LIST_ADD("flop_list", "wmbullet")
13141294
branches/old_menus/src/mess/drivers/compis.c
r29633r29634
625625
626626
627627//-------------------------------------------------
628//  mm58274c_interface rtc_intf
629//-------------------------------------------------
630
631static const mm58274c_interface rtc_intf =
632{
633   0,  /*  mode 24*/
634   1   /*  first day of week */
635};
636
637
638//-------------------------------------------------
639628//  cassette_interface compis_cassette_interface
640629//-------------------------------------------------
641630
r29633r29634
745734   MCFG_COMPIS_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd))
746735
747736   MCFG_I8274_ADD(I8274_TAG, XTAL_16MHz/4, mpsc_intf)
748   MCFG_MM58274C_ADD(MM58174A_TAG, rtc_intf)
737
738   MCFG_DEVICE_ADD(MM58174A_TAG, MM58274C, 0)
739   MCFG_MM58274C_MODE24(0) // 12 hour
740   MCFG_MM58274C_DAY1(1)   // monday
741
749742   MCFG_CASSETTE_ADD(CASSETTE_TAG, compis_cassette_interface)
750743   MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", compis_state, tape_tick, attotime::from_hz(44100))
751744
branches/old_menus/src/mess/drivers/v6809.c
r29633r29634
316316   SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
317317SLOT_INTERFACE_END
318318
319//-------------------------------------------------
320//  mm58274c_interface rtc_intf
321//-------------------------------------------------
322319
323// this is all guess
324static const mm58274c_interface rtc_intf =
325{
326   0,  /*  mode 24*/
327   1   /*  first day of week */
328};
329
330
331320// *** Machine ****
332321
333322static MACHINE_CONFIG_START( v6809, v6809_state )
r29633r29634
379368   MCFG_DEVICE_ADD("acia_clock", CLOCK, 10)
380369   MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(v6809_state, write_acia_clock))
381370
382   MCFG_MM58274C_ADD("rtc", rtc_intf)
371   MCFG_DEVICE_ADD("rtc", MM58274C, 0)
372// this is all guess
373   MCFG_MM58274C_MODE24(0) // 12 hour
374   MCFG_MM58274C_DAY1(1)   // monday
375
383376   MCFG_MB8876x_ADD("fdc", XTAL_16MHz / 16)
384377   MCFG_FLOPPY_DRIVE_ADD("fdc:0", v6809_floppies, "525dd", floppy_image_device::default_floppy_formats)
385378MACHINE_CONFIG_END
branches/old_menus/src/mess/drivers/wicat.c
r29633r29634
747747   }
748748}
749749
750static mm58274c_interface wicat_rtc_intf =
751{
752   0,  // 12 hour
753   1   // first day
754};
755
756750AM9517A_INTERFACE( wicat_videodma_intf )
757751{
758752   DEVCB_DRIVER_LINE_MEMBER(wicat_state,dma_hrq_w), // m_out_hreq_cb;
r29633r29634
776770   MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(wicat_state, via_b_w))
777771   MCFG_VIA6522_IRQ_HANDLER(INPUTLINE("maincpu", M68K_IRQ_1))
778772
779   MCFG_MM58274C_ADD("rtc",wicat_rtc_intf)  // actually an MM58174AN, but should be compatible
773   MCFG_DEVICE_ADD("rtc", MM58274C, 0)  // actually an MM58174AN, but should be compatible
774   MCFG_MM58274C_MODE24(0) // 12 hour
775   MCFG_MM58274C_DAY1(1)   // monday
780776
781777   // internal terminal
782778   MCFG_DEVICE_ADD("uart0", MC2661, XTAL_5_0688MHz)  // connected to terminal board
branches/old_menus/src/mess/drivers/x68k.c
r29633r29634
130130#include "bus/x68k/x68kexp.h"
131131#include "bus/x68k/x68k_neptunex.h"
132132#include "bus/x68k/x68k_scsiext.h"
133#include "machine/scsibus.h"
134#include "machine/scsihd.h"
133#include "bus/scsi/scsi.h"
134#include "bus/scsi/scsihd.h"
135135#include "x68000.lh"
136136
137137
r29633r29634
12751275   AM_RANGE(0xe94000, 0xe94003) AM_DEVICE8("upd72065", upd72065_device, map, 0x00ff)
12761276   AM_RANGE(0xe94004, 0xe94007) AM_READWRITE(x68k_fdc_r, x68k_fdc_w)
12771277//  AM_RANGE(0xe96000, 0xe9601f) AM_DEVREADWRITE("x68k_hdc", x68k_hdc_image_device, hdc_r, hdc_w)
1278   AM_RANGE(0xe96020, 0xe9603f) AM_DEVREADWRITE8("scsi:mb89352",mb89352_device,mb89352_r,mb89352_w,0x00ff)
1278   AM_RANGE(0xe96020, 0xe9603f) AM_DEVREADWRITE8("mb89352",mb89352_device,mb89352_r,mb89352_w,0x00ff)
12791279   AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE(x68k_scc_r, x68k_scc_w)
12801280   AM_RANGE(0xe9a000, 0xe9bfff) AM_READWRITE(x68k_ppi_r, x68k_ppi_w)
12811281   AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE(x68k_ioc_r, x68k_ioc_w)
r29633r29634
13141314   AM_RANGE(0xe94000, 0xe94003) AM_DEVICE8("upd72065", upd72065_device, map, 0x00ff00ff)
13151315   AM_RANGE(0xe94004, 0xe94007) AM_READWRITE16(x68k_fdc_r, x68k_fdc_w,0xffffffff)
13161316//  AM_RANGE(0xe96000, 0xe9601f) AM_DEVREADWRITE16("x68k_hdc", x68k_hdc_image_device, hdc_r, hdc_w, 0xffffffff)
1317   AM_RANGE(0xe96020, 0xe9603f) AM_DEVREADWRITE8("scsi:mb89352",mb89352_device,mb89352_r,mb89352_w,0x00ff00ff)
1317   AM_RANGE(0xe96020, 0xe9603f) AM_DEVREADWRITE8("mb89352",mb89352_device,mb89352_r,mb89352_w,0x00ff00ff)
13181318   AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE16(x68k_scc_r, x68k_scc_w,0xffffffff)
13191319   AM_RANGE(0xe9a000, 0xe9bfff) AM_READWRITE16(x68k_ppi_r, x68k_ppi_w,0xffffffff)
13201320   AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE16(x68k_ioc_r, x68k_ioc_w,0xffffffff)
r29633r29634
19061906   MCFG_CPU_MODIFY("maincpu")
19071907   MCFG_CPU_PROGRAM_MAP(x68kxvi_map)
19081908
1909   MCFG_SCSIBUS_ADD("scsi")
1910   MCFG_SCSIDEV_ADD("scsi:harddisk0", SCSIHD, SCSI_ID_0)
1911   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_1)
1912   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_2)
1913   MCFG_SCSIDEV_ADD("scsi:harddisk3", SCSIHD, SCSI_ID_3)
1914   MCFG_SCSIDEV_ADD("scsi:harddisk4", SCSIHD, SCSI_ID_4)
1915   MCFG_SCSIDEV_ADD("scsi:harddisk5", SCSIHD, SCSI_ID_5)
1916   MCFG_SCSIDEV_ADD("scsi:harddisk6", SCSIHD, SCSI_ID_6)
1917   MCFG_DEVICE_ADD("scsi:mb89352", MB89352A, 0)
1918   MCFG_MB89352A_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, x68k_state, x68k_scsi_irq))
1919   MCFG_MB89352A_DRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, x68k_state, x68k_scsi_drq))
1909   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1910   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
1911   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1)
1912   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "harddisk", SCSIHD, SCSI_ID_2)
1913   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE4, "harddisk", SCSIHD, SCSI_ID_3)
1914   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE5, "harddisk", SCSIHD, SCSI_ID_4)
1915   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE6, "harddisk", SCSIHD, SCSI_ID_5)
1916   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE7, "harddisk", SCSIHD, SCSI_ID_6)
1917
1918   MCFG_DEVICE_ADD("mb89352", MB89352A, 0)
1919   MCFG_LEGACY_SCSI_PORT("scsi")
1920   MCFG_MB89352A_IRQ_CB(WRITELINE(x68k_state, x68k_scsi_irq))
1921   MCFG_MB89352A_DRQ_CB(WRITELINE(x68k_state, x68k_scsi_drq))
19201922MACHINE_CONFIG_END
19211923
19221924static MACHINE_CONFIG_START( x68kxvi, x68k_state )
r29633r29634
19291931   MCFG_CPU_CLOCK(16000000)  /* 16 MHz */
19301932   MCFG_CPU_PROGRAM_MAP(x68kxvi_map)
19311933
1932   MCFG_SCSIBUS_ADD("scsi")
1933   MCFG_SCSIDEV_ADD("scsi:harddisk0", SCSIHD, SCSI_ID_0)
1934   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_1)
1935   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_2)
1936   MCFG_SCSIDEV_ADD("scsi:harddisk3", SCSIHD, SCSI_ID_3)
1937   MCFG_SCSIDEV_ADD("scsi:harddisk4", SCSIHD, SCSI_ID_4)
1938   MCFG_SCSIDEV_ADD("scsi:harddisk5", SCSIHD, SCSI_ID_5)
1939   MCFG_SCSIDEV_ADD("scsi:harddisk6", SCSIHD, SCSI_ID_6)
1940   MCFG_DEVICE_ADD("scsi:mb89352", MB89352A, 0)
1941   MCFG_MB89352A_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, x68k_state, x68k_scsi_irq))
1942   MCFG_MB89352A_DRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, x68k_state, x68k_scsi_drq))
1934   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1935   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
1936   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1)
1937   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "harddisk", SCSIHD, SCSI_ID_2)
1938   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE4, "harddisk", SCSIHD, SCSI_ID_3)
1939   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE5, "harddisk", SCSIHD, SCSI_ID_4)
1940   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE6, "harddisk", SCSIHD, SCSI_ID_5)
1941   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE7, "harddisk", SCSIHD, SCSI_ID_6)
1942
1943   MCFG_DEVICE_ADD("mb89352", MB89352A, 0)
1944   MCFG_LEGACY_SCSI_PORT("scsi")
1945   MCFG_MB89352A_IRQ_CB(WRITELINE(x68k_state, x68k_scsi_irq))
1946   MCFG_MB89352A_DRQ_CB(WRITELINE(x68k_state, x68k_scsi_drq))
19431947MACHINE_CONFIG_END
19441948
19451949static MACHINE_CONFIG_START( x68030, x68k_state )
r29633r29634
19531957
19541958   MCFG_NVRAM_ADD_0FILL("nvram32")
19551959
1956   MCFG_SCSIBUS_ADD("scsi")
1957   MCFG_SCSIDEV_ADD("scsi:harddisk0", SCSIHD, SCSI_ID_0)
1958   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_1)
1959   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_2)
1960   MCFG_SCSIDEV_ADD("scsi:harddisk3", SCSIHD, SCSI_ID_3)
1961   MCFG_SCSIDEV_ADD("scsi:harddisk4", SCSIHD, SCSI_ID_4)
1962   MCFG_SCSIDEV_ADD("scsi:harddisk5", SCSIHD, SCSI_ID_5)
1963   MCFG_SCSIDEV_ADD("scsi:harddisk6", SCSIHD, SCSI_ID_6)
1964   MCFG_DEVICE_ADD("scsi:mb89352", MB89352A, 0)
1965   MCFG_MB89352A_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, x68k_state, x68k_scsi_irq))
1966   MCFG_MB89352A_DRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, x68k_state, x68k_scsi_drq))
1960   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1961   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
1962   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1)
1963   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "harddisk", SCSIHD, SCSI_ID_2)
1964   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE4, "harddisk", SCSIHD, SCSI_ID_3)
1965   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE5, "harddisk", SCSIHD, SCSI_ID_4)
1966   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE6, "harddisk", SCSIHD, SCSI_ID_5)
1967   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE7, "harddisk", SCSIHD, SCSI_ID_6)
1968
1969   MCFG_DEVICE_ADD("mb89352", MB89352A, 0)
1970   MCFG_LEGACY_SCSI_PORT("scsi")
1971   MCFG_MB89352A_IRQ_CB(WRITELINE(x68k_state, x68k_scsi_irq))
1972   MCFG_MB89352A_DRQ_CB(WRITELINE(x68k_state, x68k_scsi_drq))
19671973MACHINE_CONFIG_END
19681974
19691975ROM_START( x68000 )
branches/old_menus/src/mess/drivers/apple2gs.c
r29633r29634
582582ROM_END
583583
584584/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT       INIT      COMPANY            FULLNAME */
585COMP( 1989, apple2gs, 0,        apple2, apple2gs, apple2gs, driver_device,   0, "Apple Computer", "Apple IIgs (ROM03)", GAME_SUPPORTS_SAVE )
586COMP( 198?, apple2gsr3p, apple2gs, 0,   apple2gs, apple2gs, driver_device,   0, "Apple Computer", "Apple IIgs (ROM03 prototype)", GAME_NOT_WORKING )
587COMP( 1989, apple2gsr3lp, apple2gs, 0,  apple2gs, apple2gs, driver_device,   0, "Apple Computer", "Apple IIgs (ROM03 late prototype?)", GAME_NOT_WORKING )
585COMP( 1989, apple2gs, 0,        apple2, apple2gs,   apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM03)", GAME_SUPPORTS_SAVE )
586COMP( 198?, apple2gsr3p, apple2gs, 0,   apple2gs,   apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM03 prototype)", GAME_NOT_WORKING )
587COMP( 1989, apple2gsr3lp, apple2gs, 0,  apple2gs,   apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM03 late prototype?)", GAME_NOT_WORKING )
588588COMP( 1987, apple2gsr1, apple2gs, 0,    apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM01)", GAME_SUPPORTS_SAVE )
589589COMP( 1986, apple2gsr0, apple2gs, 0,    apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM00)", GAME_SUPPORTS_SAVE )
590590COMP( 1986, apple2gsr0p,apple2gs, 0,    apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM00 prototype 6/19/1986)", GAME_SUPPORTS_SAVE )
branches/old_menus/src/mess/drivers/hunter2.c
r29633r29634
344344   palette.set_pen_color(1, rgb_t(92, 83, 88));
345345}
346346
347//-------------------------------------------------
348//  mm58274c_interface rtc_intf
349//-------------------------------------------------
350
351// this is all guess
352static const mm58274c_interface rtc_intf =
353{
354   0,  /*  mode 24*/
355   1   /*  first day of week */
356};
357
358347WRITE_LINE_MEMBER(hunter2_state::timer0_out)
359348{
360349   if(state == ASSERT_LINE)
r29633r29634
411400   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
412401
413402   /* Devices */
414   MCFG_MM58274C_ADD("rtc", rtc_intf)
415   //MCFG_TIMER_DRIVER_ADD_PERIODIC("hunter_a", hunter2_state, a_timer, attotime::from_hz(61))
403   MCFG_DEVICE_ADD("rtc", MM58274C, 0)
404   // this is all guess
405   MCFG_MM58274C_MODE24(0) // 12 hour
406   MCFG_MM58274C_DAY1(1)   // monday
416407
408//MCFG_TIMER_DRIVER_ADD_PERIODIC("hunter_a", hunter2_state, a_timer, attotime::from_hz(61))
409
417410   MCFG_NSC810_ADD("iotimer",XTAL_4MHz,XTAL_4MHz)
418411   MCFG_NSC810_PORTA_READ(READ8(hunter2_state,port00_r))
419412   MCFG_NSC810_PORTB_READ(READ8(hunter2_state,port01_r))
branches/old_menus/src/mess/drivers/geneve.c
r29633r29634
686686   m_mapper->dbin_in(state);
687687}
688688
689static const mm58274c_interface geneve_mm58274c_interface =
690{
691   1,  /*  mode 24*/
692   0   /*  first day of week */
693};
694
695689DRIVER_INIT_MEMBER(geneve_state,geneve)
696690{
697691}
r29633r29634
754748   MCFG_GENEVE_READY_HANDLER( WRITELINE(geneve_state, mapper_ready) )
755749
756750   // Clock
757   MCFG_MM58274C_ADD(GCLOCK_TAG, geneve_mm58274c_interface)
751   MCFG_DEVICE_ADD(GCLOCK_TAG, MM58274C, 0)
752   MCFG_MM58274C_MODE24(1) // 24 hour
753   MCFG_MM58274C_DAY1(0)   // sunday
758754
759755   // Peripheral expansion box (Geneve composition)
760756   MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_GEN, 0)
branches/old_menus/src/mess/drivers/v1050.c
r29633r29634
388388
389389WRITE8_MEMBER( v1050_state::sasi_data_w )
390390{
391   data_out = data;
391   m_sasi_data = data;
392392
393   if( !m_sasibus->scsi_io_r() )
393   if (m_sasi_data_enable)
394394   {
395      m_sasibus->scsi_data_w( data );
395      m_sasi_data_out->write(m_sasi_data);
396396   }
397397}
398398
399WRITE_LINE_MEMBER( v1050_state::sasi_io_w )
399WRITE_LINE_MEMBER( v1050_state::write_sasi_io )
400400{
401   if( !state )
401   m_sasi_ctrl_in->write_bit4(state);
402
403   m_sasi_data_enable = state;
404
405   if (m_sasi_data_enable)
402406   {
403      m_sasibus->scsi_data_w( data_out );
407      m_sasi_data_out->write(m_sasi_data);
404408   }
405409   else
406410   {
407      m_sasibus->scsi_data_w( 0 );
411      m_sasi_data_out->write(0);
408412   }
409413}
410414
411READ8_MEMBER( v1050_state::sasi_status_r )
412{
413   /*
414
415       bit     description
416
417       0       REQ-
418       1       BUSY
419       2       MESSAGE
420       3       C/D-
421       4       I-/O
422       5
423       6
424       7
425
426   */
427
428   UINT8 data = 0;
429
430   data |= !m_sasibus->scsi_req_r();
431   data |= m_sasibus->scsi_bsy_r() << 1;
432   data |= m_sasibus->scsi_msg_r() << 2;
433   data |= m_sasibus->scsi_cd_r() << 3;
434   data |= !m_sasibus->scsi_io_r() << 4;
435
436   return data;
437}
438
439415TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::sasi_ack_tick)
440416{
441   m_sasibus->scsi_ack_w(0);
417   m_sasibus->write_ack(0);
442418}
443419
444420TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::sasi_rst_tick)
445421{
446   m_sasibus->scsi_rst_w(0);
422   m_sasibus->write_rst(0);
447423}
448424
449425WRITE8_MEMBER( v1050_state::sasi_ctrl_w )
r29633r29634
463439
464440   */
465441
466   m_sasibus->scsi_sel_w(BIT(data, 0));
442   m_sasibus->write_sel(BIT(data, 0));
467443
468444   if (BIT(data, 1))
469445   {
470446      // send acknowledge pulse
471      m_sasibus->scsi_ack_w(1);
447      m_sasibus->write_ack(1);
472448
473449      m_timer_ack->adjust(attotime::from_nsec(100));
474450   }
r29633r29634
476452   if (BIT(data, 7))
477453   {
478454      // send reset pulse
479      m_sasibus->scsi_rst_w(1);
455      m_sasibus->write_rst(1);
480456
481457      m_timer_rst->adjust(attotime::from_nsec(100));
482458   }
r29633r29634
510486   AM_RANGE(0xb0, 0xb0) AM_READWRITE(dint_clr_r, dint_clr_w)
511487   AM_RANGE(0xc0, 0xc0) AM_WRITE(v1050_i8214_w)
512488   AM_RANGE(0xd0, 0xd0) AM_WRITE(bank_w)
513   AM_RANGE(0xe0, 0xe0) AM_WRITE(sasi_data_w) AM_DEVREAD(SASIBUS_TAG ":host", scsicb_device, scsi_data_r)
514   AM_RANGE(0xe1, 0xe1) AM_READWRITE(sasi_status_r, sasi_ctrl_w)
489   AM_RANGE(0xe0, 0xe0) AM_WRITE(sasi_data_w) AM_DEVREAD("scsi_data_in", input_buffer_device, read)
490   AM_RANGE(0xe1, 0xe1) AM_DEVREAD("scsi_ctrl_in", input_buffer_device, read) AM_WRITE(sasi_ctrl_w)
515491ADDRESS_MAP_END
516492
517493static ADDRESS_MAP_START( v1050_crt_mem, AS_PROGRAM, 8, v1050_state )
r29633r29634
11571133   MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":3", v1050_floppies, NULL,    floppy_image_device::default_floppy_formats)
11581134
11591135   // SASI bus
1160   MCFG_SCSIBUS_ADD(SASIBUS_TAG)
1161   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":harddisk0", S1410, SCSI_ID_0)
1162   MCFG_SCSICB_ADD(SASIBUS_TAG ":host")
1163   MCFG_SCSICB_IO_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, v1050_state, sasi_io_w))
1136   MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0)
1137   MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in")
1138   MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit0)) MCFG_DEVCB_XOR(1)
1139   MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit1))
1140   MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit2))
1141   MCFG_SCSI_CD_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit3))
1142   MCFG_SCSI_IO_HANDLER(WRITELINE(v1050_state, write_sasi_io)) MCFG_DEVCB_XOR(1) // bit4
1143   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", S1410, SCSI_ID_0)
11641144
1145   MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SASIBUS_TAG)
1146   MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0)
1147   MCFG_DEVICE_ADD("scsi_ctrl_in", INPUT_BUFFER, 0)
1148
11651149   MCFG_TIMER_DRIVER_ADD(TIMER_ACK_TAG, v1050_state, sasi_ack_tick)
11661150   MCFG_TIMER_DRIVER_ADD(TIMER_RST_TAG, v1050_state, sasi_rst_tick)
11671151
branches/old_menus/src/mess/drivers/fmtowns.c
r29633r29634
173173*/
174174
175175#include "includes/fmtowns.h"
176#include "machine/scsibus.h"
177#include "machine/scsihd.h"
176#include "bus/scsi/scsi.h"
177#include "bus/scsi/scsihd.h"
178178
179179// CD controller IRQ types
180180#define TOWNS_CD_IRQ_MPU 1
r29633r29634
22532253   // Keyboard (8042 MCU)
22542254   AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff00ff)
22552255   // SCSI controller
2256   AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8("scsi:fm",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff00ff)
2256   AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8("fmscsi",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff00ff)
22572257   // CMOS
22582258   AM_RANGE(0x3000,0x4fff) AM_READWRITE8(towns_cmos_r, towns_cmos_w,0x00ff00ff)
22592259   // Something (MS-DOS wants this 0x41ff to be 1)
r29633r29634
23052305   // Keyboard (8042 MCU)
23062306   AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff)
23072307   // SCSI controller
2308   AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8("scsi:fm",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff)
2308   AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8("fmscsi",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff)
23092309   // CMOS
23102310   AM_RANGE(0x3000,0x4fff) AM_READWRITE8(towns_cmos_r, towns_cmos_w,0x00ff)
23112311   // Something (MS-DOS wants this 0x41ff to be 1)
r29633r29634
26142614   m_messram = m_ram;
26152615   m_cdrom = machine().device<cdrom_image_device>("cdrom");
26162616   m_cdda = machine().device<cdda_device>("cdda");
2617   m_scsi = machine().device<fmscsi_device>("scsi:fm");
2617   m_scsi = machine().device<fmscsi_device>("fmscsi");
26182618   m_ftimer = 0x00;
26192619   m_freerun_timer = 0x00;
26202620   m_nmi_mask = 0x00;
r29633r29634
27592759
27602760   MCFG_CDROM_ADD("cdrom",towns_cdrom)
27612761
2762   MCFG_SCSIBUS_ADD("scsi")
2763   MCFG_SCSIDEV_ADD("scsi:harddisk0", SCSIHD, SCSI_ID_0)
2764   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_1)
2765   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_2)
2766   MCFG_SCSIDEV_ADD("scsi:harddisk3", SCSIHD, SCSI_ID_3)
2767   MCFG_SCSIDEV_ADD("scsi:harddisk4", SCSIHD, SCSI_ID_4)
2768   MCFG_FMSCSI_ADD("scsi:fm")
2769   MCFG_FMSCSI_IRQ_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, towns_state, towns_scsi_irq))
2770   MCFG_FMSCSI_DRQ_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, towns_state, towns_scsi_drq))
2762   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
2763   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
2764   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1)
2765   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "harddisk", SCSIHD, SCSI_ID_2)
2766   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE4, "harddisk", SCSIHD, SCSI_ID_3)
2767   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE5, "harddisk", SCSIHD, SCSI_ID_4)
27712768
2769   MCFG_FMSCSI_ADD("fmscsi")
2770   MCFG_LEGACY_SCSI_PORT("scsi")
2771   MCFG_FMSCSI_IRQ_HANDLER(WRITELINE(towns_state, towns_scsi_irq))
2772   MCFG_FMSCSI_DRQ_HANDLER(WRITELINE(towns_state, towns_scsi_drq))
2773
27722774   MCFG_UPD71071_ADD("dma_1",towns_dma_config)
27732775   MCFG_UPD71071_ADD("dma_2",towns_dma_config)
27742776
branches/old_menus/src/mess/drivers/apple2.c
r29633r29634
831831   PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C)  PORT_CHAR('C') PORT_CHAR('c')
832832   PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)  PORT_CHAR('V') PORT_CHAR('v')
833833   PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)  PORT_CHAR('B') PORT_CHAR('b')
834   PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)  PORT_CHAR('M') PORT_CHAR('m')
835   PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)  PORT_CHAR('N') PORT_CHAR('n')
834   PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)  PORT_CHAR('N') PORT_CHAR('n')
835   PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)  PORT_CHAR('M') PORT_CHAR('m')
836836   PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA)  PORT_CHAR(',') PORT_CHAR('<')
837837   PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)   PORT_CHAR('.') PORT_CHAR('>')
838838   PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)  PORT_CHAR('/') PORT_CHAR('?')
r29633r29634
10161016   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple2_state, apple2_interrupt, "screen", 0, 1)
10171017   MCFG_QUANTUM_TIME(attotime::from_hz(60))
10181018
1019   MCFG_MACHINE_START_OVERRIDE(apple2_state, apple2 )
1019   MCFG_MACHINE_START_OVERRIDE(apple2_state, apple2e )
10201020
10211021   MCFG_SCREEN_ADD("screen", RASTER)
10221022   MCFG_SCREEN_REFRESH_RATE(60)
r29633r29634
11411141MACHINE_CONFIG_END
11421142
11431143static MACHINE_CONFIG_DERIVED( mprof3, apple2e )
1144   MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2)
1144   MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2c)
11451145   MCFG_VIDEO_START_OVERRIDE(apple2_state,apple2c)
11461146
11471147   /* internal ram */
r29633r29634
11581158MACHINE_CONFIG_END
11591159
11601160static MACHINE_CONFIG_DERIVED( apple2c, apple2ee )
1161   MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2)
1161   MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2c)
11621162   MCFG_VIDEO_START_OVERRIDE(apple2_state,apple2c)
11631163
11641164   MCFG_A2BUS_SLOT_REMOVE("sl1")   // IIc has no slots, of course :)
r29633r29634
11691169   MCFG_A2BUS_SLOT_REMOVE("sl6")
11701170   MCFG_A2BUS_SLOT_REMOVE("sl7")
11711171
1172   MCFG_DEVICE_ADD(IIC_ACIA1_TAG, MOS6551, 0)
1173   MCFG_MOS6551_XTAL(XTAL_14_31818MHz / 8)   // ~1.789 MHz
1174   MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(PRINTER_PORT_TAG, rs232_port_device, write_txd))
1175
1176   MCFG_DEVICE_ADD(IIC_ACIA2_TAG, MOS6551, 0)
1177   MCFG_MOS6551_XTAL(XTAL_1_8432MHz)   // matches SSC so modem software is compatible
1178   MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("modem", rs232_port_device, write_txd))
1179
1180   MCFG_RS232_PORT_ADD(PRINTER_PORT_TAG, default_rs232_devices, NULL)
1181   MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_rxd))
1182   MCFG_RS232_DCD_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_dcd))
1183   MCFG_RS232_DSR_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_dsr))
1184   MCFG_RS232_CTS_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_cts))
1185
1186   MCFG_RS232_PORT_ADD(MODEM_PORT_TAG, default_rs232_devices, NULL)
1187   MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_rxd))
1188   MCFG_RS232_DCD_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_dcd))
1189   MCFG_RS232_DSR_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_dsr))
1190   MCFG_RS232_CTS_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_cts))
1191
11721192   // TODO: populate the IIc's other virtual slots with ONBOARD_ADD
1173   MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl1", A2BUS_SSC, NULL)
1174   MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl2", A2BUS_SSC, NULL)
11751193   MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_DISKIING, NULL)
11761194
11771195   MCFG_A2EAUXSLOT_SLOT_REMOVE("aux")
r29633r29634
11821200   MCFG_RAM_EXTRA_OPTIONS("128K")
11831201MACHINE_CONFIG_END
11841202
1203static MACHINE_CONFIG_DERIVED( apple2cp, apple2c )
1204   MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2cp)
1205MACHINE_CONFIG_END
1206
11851207static MACHINE_CONFIG_DERIVED( apple2c_iwm, apple2c )
11861208
11871209   MCFG_A2BUS_SLOT_REMOVE("sl6")
r29633r29634
11911213static MACHINE_CONFIG_DERIVED( laser128, apple2c )
11921214   MCFG_MACHINE_START_OVERRIDE(apple2_state,laser128)
11931215
1194   MCFG_A2BUS_SLOT_REMOVE("sl1")
1195   MCFG_A2BUS_SLOT_REMOVE("sl2")
11961216   MCFG_A2BUS_SLOT_REMOVE("sl6")
11971217
11981218   MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl1", A2BUS_LASER128, NULL)
r29633r29634
16441664COMP( 1985, apple2c0, apple2c,  0,        apple2c_iwm, apple2e, driver_device,  0,        "Apple Computer",    "Apple //c (UniDisk 3.5)", GAME_SUPPORTS_SAVE )
16451665COMP( 1986, apple2c3, apple2c,  0,        apple2c_iwm, apple2e, driver_device,  0,        "Apple Computer",    "Apple //c (Original Memory Expansion)", GAME_SUPPORTS_SAVE )
16461666COMP( 1986, apple2c4, apple2c,  0,        apple2c_iwm, apple2e, driver_device,  0,        "Apple Computer",    "Apple //c (rev 4)", GAME_NOT_WORKING )
1647COMP( 1988, apple2cp, apple2c,  0,        apple2c_iwm, apple2e, driver_device,  0,        "Apple Computer",    "Apple //c Plus", GAME_SUPPORTS_SAVE )
1667COMP( 1988, apple2cp, apple2c,  0,        apple2cp,    apple2e, driver_device,  0,        "Apple Computer",    "Apple //c Plus", GAME_SUPPORTS_SAVE )
16481668COMP( 1984, ivelultr, apple2,   0,        apple2p,     apple2p, driver_device,  0,        "Ivasim",            "Ivel Ultra", GAME_SUPPORTS_SAVE )
16491669COMP( 1983, agat7,    apple2,   0,        apple2p,     apple2p, driver_device,  0,        "Agat",              "Agat-7", GAME_NOT_WORKING) // disk controller ROM JSRs to $FCA8 which is a delay on apple II, illegal instruction crash here :(
16501670COMP( 1984, agat9,    apple2,   0,        apple2p,     apple2p, driver_device,  0,        "Agat",              "Agat-9", GAME_NOT_WORKING)
branches/old_menus/src/mess/drivers/xerox820.c
r29633r29634
355355   DEVCB_NULL      /* portB ready active callback */
356356};
357357
358READ8_MEMBER( xerox820ii_state::rdpio_pb_r )
358WRITE8_MEMBER( xerox820ii_state::rdpio_pb_w )
359359{
360360   /*
361361
362362       bit     description
363363
364       0       NBSY
364      0       NBSY
365365       1       NMSG
366366       2       NC/D
367367       3       NREQ
368368       4       NI/O
369       5
370       6       LS74 Q
371       7
372
373   */
374
375   UINT8 data = 0;
376
377   data |= !m_sasibus->scsi_bsy_r();
378   data |= !m_sasibus->scsi_msg_r() << 1;
379   data |= !m_sasibus->scsi_cd_r() << 2;
380   data |= !m_sasibus->scsi_req_r() << 3;
381   data |= !m_sasibus->scsi_io_r() << 4;
382
383   return data;
384}
385
386WRITE8_MEMBER( xerox820ii_state::rdpio_pb_w )
387{
388   /*
389
390       bit     description
391
392       0
393       1
394       2
395       3
396       4
397369       5       NSEL
398       6
370       6       LS74 Q
399371       7       NRST
400
401372   */
402373
403   m_sasibus->scsi_sel_w(!BIT(data, 5));
404   m_sasibus->scsi_rst_w(!BIT(data, 7));
374   m_sasibus->write_sel(!BIT(data, 5));
375   m_sasibus->write_rst(!BIT(data, 7));
376   // TODO: LS74 Q
405377}
406378
407379WRITE_LINE_MEMBER( xerox820ii_state::rdpio_pardy_w )
r29633r29634
412384static Z80PIO_INTERFACE( rdpio_intf )
413385{
414386   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0), /* callback when change interrupt status */
415   DEVCB_DEVICE_MEMBER(SASIBUS_TAG ":host", scsicb_device, scsi_data_r),   /* port A read callback */
416   DEVCB_DEVICE_MEMBER(SASIBUS_TAG ":host", scsicb_device, scsi_data_w),   /* port A write callback */
387   DEVCB_DEVICE_MEMBER("sasi_data_in", input_buffer_device, read),   /* port A read callback */
388   DEVCB_DEVICE_MEMBER("sasi_data_out", output_latch_device, write),   /* port A write callback */
417389   DEVCB_DRIVER_LINE_MEMBER(xerox820ii_state, rdpio_pardy_w),      /* portA ready active callback */
418   DEVCB_DRIVER_MEMBER(xerox820ii_state, rdpio_pb_r),      /* port B read callback */
390   DEVCB_DEVICE_MEMBER("sasi_ctrl_in", input_buffer_device, read),      /* port B read callback */
419391   DEVCB_DRIVER_MEMBER(xerox820ii_state, rdpio_pb_w),      /* port B write callback */
420392   DEVCB_NULL      /* portB ready active callback */
421393};
r29633r29634
779751   MCFG_GENERIC_KEYBOARD_CB(WRITE8(xerox820_state, kbd_w))
780752
781753   // SASI bus
782   MCFG_SCSIBUS_ADD(SASIBUS_TAG)
783   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":harddisk0", SA1403D, SCSI_ID_0)
784   MCFG_SCSICB_ADD(SASIBUS_TAG ":host")
754   MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0)
755   MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in")
756   MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit0)) MCFG_DEVCB_XOR(1)
757   MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit1)) MCFG_DEVCB_XOR(1)
758   MCFG_SCSI_CD_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit2)) MCFG_DEVCB_XOR(1)
759   MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3)) MCFG_DEVCB_XOR(1)
760   MCFG_SCSI_IO_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4)) MCFG_DEVCB_XOR(1)
785761
762   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SA1403D, SCSI_ID_0)
763
764   MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", SASIBUS_TAG)
765   MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0)
766   MCFG_DEVICE_ADD("sasi_ctrl_in", INPUT_BUFFER, 0)
767
786768   /* internal ram */
787769   MCFG_RAM_ADD(RAM_TAG)
788770   MCFG_RAM_DEFAULT_SIZE("64K")
branches/old_menus/src/mess/drivers/amust.c
r29633r29634
2020
2121The main rom is identical between the 2 halves, except that the initial
2222crtc parameters are slightly different. I've chosen to ignore the first
23half.
23half. (perhaps 50/60 Hz selectable by jumper?)
2424
25Preliminary I/O ports
26---------------------
2700-01 uart 1
2802-03 uart 2
2904-07 ppi 1
3008-0b ppi 2
310d-0f crtc
3210-11 fdc
3314-17 pit
34
35PIT.
36Having the PIT on ports 14-17 seems to make sense. It sets counters 1 and 2
37to mode 3, binary, initial count = 0x80. Counter 0 not used?
38
39
2540Floppy Parameters:
41------------------
2642Double Density
2743Two Side
284480 track
r29633r29634
3450Skew 1,3,5,2,4
3551
3652
53Stuff that doesn't make sense:
54------------------------------
551. To access the screen, it waits for IRQ presumably from sync pulse. It sets INT
56mode 0 which means a page-zero jump, but doesn't write anything to the zero-page ram.
57That's why I added a RETI at 0008 and set the vector to there. A bit later it writes
58a jump at 0000. Then it sets the interrupting device to the fdc (not sure how yet),
59then proceeds to overwrite all of page-zero with the disk contents. This of course
60kills the jump it just wrote, and my RETI. So it runs into the weeds at high speed.
61What should happen is after loading the boot sector succesfully it will jump to 0000,
62otherwise it will write BOOT NG to the screen and you're in the monitor. The bios
63contains no RETI instructions.
642. At F824 it copies itself to the same address which is presumably shadow ram. But
65it never switches to it. The ram is physically in the machine.
66
67
3768Monitor Commands:
69-----------------
3870B = Boot from floppy
3971(YES! Most useless monitor ever)
4072
r29633r29634
4375- Everything
4476- Need software
4577- If booting straight to CP/M, the load message should be in the middle of the screen.
46- Beeper is a low pulse on bit 0 of port 0b - enable a pit event?
4778
79
4880****************************************************************************/
4981
5082#include "emu.h"
r29633r29634
5284#include "video/mc6845.h"
5385#include "machine/upd765.h"
5486#include "machine/keyboard.h"
55//#include "machine/pit8253.h"
56//#include "machine/i8255.h"
57//#include "machine/i8251.h"
87#include "machine/pit8253.h"
88#include "machine/i8255.h"
89#include "machine/i8251.h"
90#include "sound/beep.h"
5891
5992
6093class amust_state : public driver_device
6194{
6295public:
96   enum
97   {
98      TIMER_BEEP_OFF
99   };
100
63101   amust_state(const machine_config &mconfig, device_type type, const char *tag)
64102      : driver_device(mconfig, type, tag)
65103      , m_palette(*this, "palette")
66104      , m_maincpu(*this, "maincpu")
105      , m_beep(*this, "beeper")
67106      , m_fdc (*this, "fdc")
68107      , m_floppy0(*this, "fdc:0")
69108      , m_floppy1(*this, "fdc:1")
r29633r29634
72111   DECLARE_DRIVER_INIT(amust);
73112   DECLARE_MACHINE_RESET(amust);
74113   DECLARE_READ8_MEMBER(port00_r);
114   DECLARE_READ8_MEMBER(port01_r);
115   DECLARE_READ8_MEMBER(port04_r);
116   DECLARE_WRITE8_MEMBER(port04_w);
117   DECLARE_READ8_MEMBER(port05_r);
118   DECLARE_READ8_MEMBER(port06_r);
119   DECLARE_WRITE8_MEMBER(port06_w);
120   DECLARE_READ8_MEMBER(port08_r);
75121   DECLARE_WRITE8_MEMBER(port08_w);
76122   DECLARE_READ8_MEMBER(port09_r);
77123   DECLARE_READ8_MEMBER(port0a_r);
r29633r29634
83129   const UINT8 *m_p_chargen;
84130   required_device<palette_device> m_palette;
85131private:
132   UINT8 m_port04;
133   UINT8 m_port06;
86134   UINT8 m_port08;
87135   UINT8 m_port0a;
88136   UINT8 m_term_data;
137   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
89138   required_device<cpu_device> m_maincpu;
139   required_device<beep_device> m_beep;
90140   required_device<upd765a_device> m_fdc;
91141   required_device<floppy_connector> m_floppy0;
92142   required_device<floppy_connector> m_floppy1;
93143};
94144
145void amust_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
146{
147   switch (id)
148   {
149   case TIMER_BEEP_OFF:
150      m_beep->set_state(0);
151      break;
152   default:
153      assert_always(FALSE, "Unknown id in amust_state::device_timer");
154   }
155}
156
95157//WRITE8_MEMBER( amust_state::port00_w )
96158//{
97159//  membank("bankr0")->set_entry(BIT(data, 6));
r29633r29634
112174static ADDRESS_MAP_START(amust_io, AS_IO, 8, amust_state)
113175   ADDRESS_MAP_UNMAP_HIGH
114176   ADDRESS_MAP_GLOBAL_MASK(0xff)
177   //AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w)
178   //AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w)
115179   AM_RANGE(0x00, 0x00) AM_READ(port00_r)
116   AM_RANGE(0x08, 0x08) AM_WRITE(port08_w)
117   AM_RANGE(0x09, 0x09) AM_READ(port09_r)
118   AM_RANGE(0x0a, 0x0a) AM_READWRITE(port0a_r,port0a_w)
119   AM_RANGE(0x0d, 0x0d) AM_WRITE(port0d_w)
180   AM_RANGE(0x01, 0x01) AM_READ(port01_r)
181   AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("uart2", i8251_device, data_r, data_w)
182   AM_RANGE(0x03, 0x03) AM_DEVREADWRITE("uart2", i8251_device, status_r, control_w)
183   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi1", i8255_device, read, write)
184   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi2", i8255_device, read, write)
185   AM_RANGE(0x0d, 0x0d) AM_READNOP AM_WRITE(port0d_w)
120186   AM_RANGE(0x0e, 0x0e) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w)
121187   AM_RANGE(0x0f, 0x0f) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
122188   AM_RANGE(0x10, 0x11) AM_DEVICE("fdc", upd765a_device, map)
123   //AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w)
124   //AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w)
125   //AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("uart2", i8251_device, data_r, data_w)
126   //AM_RANGE(0x03, 0x03) AM_DEVREADWRITE("uart2", i8251_device, status_r, control_w)
127   //AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi1", i8255_device, read, write)
128   //AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi2", i8255_device, read, write)
129   //AM_RANGE(0x14, 0x17) AM_DEVREADWRITE("pit", pit8253_device, read, write)
189   AM_RANGE(0x14, 0x17) AM_DEVREADWRITE("pit", pit8253_device, read, write)
130190ADDRESS_MAP_END
131191
132192static SLOT_INTERFACE_START( amust_floppies )
r29633r29634
144204   return ret;
145205}
146206
207READ8_MEMBER( amust_state::port01_r )
208{
209   return 0xff;
210}
211
212// bodgy
213INTERRUPT_GEN_MEMBER( amust_state::irq_vs )
214{
215   m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xcf);
216}
217
218READ8_MEMBER( amust_state::port04_r )
219{
220   return m_port04;
221}
222
223WRITE8_MEMBER( amust_state::port04_w )
224{
225   m_port04 = data;
226}
227
228READ8_MEMBER( amust_state::port05_r )
229{
230   return 0;
231}
232
233READ8_MEMBER( amust_state::port06_r )
234{
235   return m_port06;
236}
237
238// BIT 5 low while writing to screen
239WRITE8_MEMBER( amust_state::port06_w )
240{
241   m_port06 = data;
242}
243
244static I8255_INTERFACE( ppi1_intf )
245{
246   DEVCB_DRIVER_MEMBER(amust_state, port04_r),   // Port A read
247   DEVCB_DRIVER_MEMBER(amust_state, port04_w),   // Port A write
248   DEVCB_DRIVER_MEMBER(amust_state, port05_r),   // Port B read
249   DEVCB_NULL,                                   // Port B write
250   DEVCB_DRIVER_MEMBER(amust_state, port06_r),   // Port C read
251   DEVCB_DRIVER_MEMBER(amust_state, port06_w),   // Port C write
252};
253
254READ8_MEMBER( amust_state::port08_r )
255{
256   return m_port08;
257}
258
259// lower 8 bits of video address
147260WRITE8_MEMBER( amust_state::port08_w )
148261{
149262   m_port08 = data;
150263}
151264
152// bit 4: H = go to monitor; L = boot from disk
265/*
266d0 - something to do with type of disk
267d1 -
268d2 -
269d3 -
270d4 - H = go to monitor; L = boot from disk
271d5 - status of disk-related; loops till NZ
272d6 -
273d7 -
274*/
153275READ8_MEMBER( amust_state::port09_r )
154276{
277   printf("%s\n",machine().describe_context());
155278   return 0xff;
156279}
157280
r29633r29634
160283   return m_port0a;
161284}
162285
286/* Bits 7,6,5,3 something to do
287with selecting which device causes interrupt?
28850, 58 = video sync
28970 disk
290D0 ?
291Bit 4 low = beeper.
292Lower 3 bits = upper part of video address */
163293WRITE8_MEMBER( amust_state::port0a_w )
164294{
165295   m_port0a = data;
296
297   if (!BIT(data, 4))
298   {
299      m_beep->set_state(1);
300      timer_set(attotime::from_msec(150), TIMER_BEEP_OFF);
301   }
166302}
167303
304static I8255_INTERFACE( ppi2_intf )
305{
306   DEVCB_DRIVER_MEMBER(amust_state, port08_r),   // Port A read
307   DEVCB_DRIVER_MEMBER(amust_state, port08_w),   // Port A write
308   DEVCB_DRIVER_MEMBER(amust_state, port09_r),   // Port B read
309   DEVCB_NULL,                                   // Port B write
310   DEVCB_DRIVER_MEMBER(amust_state, port0a_r),   // Port C read
311   DEVCB_DRIVER_MEMBER(amust_state, port0a_w),   // Port C write
312};
313
168314WRITE8_MEMBER( amust_state::port0d_w )
169315{
170316   UINT16 video_address = m_port08 | ((m_port0a & 7) << 8);
171317   m_p_videoram[video_address] = data;
172318}
173319
174// bodgy
175INTERRUPT_GEN_MEMBER( amust_state::irq_vs )
176{
177   m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xcf);
178}
179
180//static I8255_INTERFACE( ppi1_intf )
181//{
182//  DEVCB_DRIVER_MEMBER(amust_state, ppi1_pa_r),   // Port A read
183//  DEVCB_DRIVER_MEMBER(amust_state, ppi1_pa_w),   // Port A write
184//  DEVCB_DRIVER_MEMBER(amust_state, ppi1_pb_r),   // Port B read
185//  DEVCB_DRIVER_MEMBER(amust_state, ppi1_pb_w),   // Port B write
186//  DEVCB_DRIVER_MEMBER(amust_state, ppi1_pc_r),   // Port C read
187//  DEVCB_DRIVER_MEMBER(amust_state, ppi1_pc_w),   // Port C write
188//};
189
190//static I8255_INTERFACE( ppi2_intf )
191//{
192//  DEVCB_DRIVER_MEMBER(amust_state, ppi2_pa_r),   // Port A read
193//  DEVCB_DRIVER_MEMBER(amust_state, ppi2_pa_w),   // Port A write
194//  DEVCB_DRIVER_MEMBER(amust_state, ppi2_pb_r),   // Port B read
195//  DEVCB_DRIVER_MEMBER(amust_state, ppi2_pb_w),   // Port B write
196//  DEVCB_DRIVER_MEMBER(amust_state, ppi2_pc_r),   // Port C read
197//  DEVCB_DRIVER_MEMBER(amust_state, ppi2_pc_w),   // Port C write
198//};
199
200320WRITE8_MEMBER( amust_state::kbd_put )
201321{
202322   m_term_data = data;
r29633r29634
271391   m_p_videoram = memregion("videoram")->base();
272392   membank("bankr0")->set_entry(0); // point at rom
273393   membank("bankw0")->set_entry(0); // always write to ram
394   m_beep->set_frequency(800);
274395   address_space &space = m_maincpu->space(AS_PROGRAM);
275   space.write_byte(8, 0xc9);
396   space.write_byte(8, 0xed);
397   space.write_byte(9, 0x4d);
398   m_port04 = 0;
399   m_port06 = 0;
400   m_port08 = 0;
401   m_port0a = 0;
276402   m_maincpu->set_state_int(Z80_PC, 0xf800);
277403}
278404
r29633r29634
303429   MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette")
304430   MCFG_GFXDECODE_ADD("gfxdecode", "palette", amust)
305431
432   /* sound hardware */
433   MCFG_SPEAKER_STANDARD_MONO("mono")
434   MCFG_SOUND_ADD("beeper", BEEP, 0)
435   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
436
306437   /* Devices */
307438   MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_14_31818MHz / 8, amust_crtc)
308439   MCFG_DEVICE_ADD("keybd", GENERIC_KEYBOARD, 0)
r29633r29634
316447   //MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr))
317448   //MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts))
318449
319   //MCFG_DEVICE_ADD("uart2", I8251, 0)
450   MCFG_DEVICE_ADD("uart2", I8251, 0)
320451   //MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd))
321452   //MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr))
322453   //MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts))
r29633r29634
326457   //MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_cts))
327458   //MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_dsr))
328459
329   //MCFG_DEVICE_ADD("pit", PIT8253, 0)
330
331   //MCFG_I8255A_ADD("ppi1", ppi1_intf)
332   //MCFG_I8255A_ADD("ppi2", ppi2_intf)
460   MCFG_DEVICE_ADD("pit", PIT8253, 0)
461   MCFG_I8255A_ADD("ppi1", ppi1_intf)
462   MCFG_I8255A_ADD("ppi2", ppi2_intf)
333463MACHINE_CONFIG_END
334464
335465/* ROM definition */
r29633r29634
349479/* Driver */
350480
351481/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    CLASS          INIT     COMPANY       FULLNAME       FLAGS */
352COMP( 1983, amust,  0,      0,       amust,     amust,   amust_state,   amust,  "Amust",       "Compak", GAME_IS_SKELETON)
482COMP( 1983, amust,  0,      0,       amust,     amust,   amust_state,   amust,  "Amust", "Amust Executive 816", GAME_NOT_WORKING )
branches/old_menus/src/mess/drivers/ip20.c
r29633r29634
2121#include "machine/8530scc.h"
2222#include "machine/sgi.h"
2323#include "machine/eepromser.h"
24#include "machine/scsibus.h"
25#include "machine/scsicd.h"
24#include "bus/scsi/scsi.h"
25#include "bus/scsi/scsicd.h"
2626#include "machine/wd33c93.h"
2727
2828struct HPC_t
r29633r29634
5151      TIMER_RTC
5252   };
5353
54   ip20_state(const machine_config &mconfig, device_type type, const char *tag)
55      : driver_device(mconfig, type, tag),
56   m_wd33c93(*this, "scsi:wd33c93"),
57   m_scc(*this, "scc"),
58   m_eeprom(*this, "eeprom"),
59   m_maincpu(*this, "maincpu") { }
54   ip20_state(const machine_config &mconfig, device_type type, const char *tag) :
55      driver_device(mconfig, type, tag),
56      m_wd33c93(*this, "wd33c93"),
57      m_scc(*this, "scc"),
58      m_eeprom(*this, "eeprom"),
59      m_maincpu(*this, "maincpu")
60   {
61   }
6062
61
6263   HPC_t m_HPC;
6364   RTC_t m_RTC;
6465   DECLARE_READ32_MEMBER(hpc_r);
r29633r29634
580581};
581582#endif
582583
584static MACHINE_CONFIG_FRAGMENT( cdrom_config )
585   MCFG_DEVICE_MODIFY( "cdda" )
586   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "^^^^mono", 1.0)
587MACHINE_CONFIG_END
588
583589static MACHINE_CONFIG_START( ip204415, ip20_state )
584590   MCFG_CPU_ADD( "maincpu", R4600BE, 50000000*3 )
585591   MCFG_CPU_CONFIG( config )
r29633r29634
604610
605611   MCFG_DEVICE_ADD("sgi_mc", SGI_MC, 0)
606612
607   MCFG_SCSIBUS_ADD("scsi")
608   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_6)
609   MCFG_DEVICE_ADD("scsi:wd33c93", WD33C93, 0)
610   MCFG_WD33C93_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, ip20_state, scsi_irq))      /* command completion IRQ */
613   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
614   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "cdrom", SCSICD, SCSI_ID_6)
615   MCFG_SLOT_OPTION_MACHINE_CONFIG("cdrom", cdrom_config)
611616
612   MCFG_SOUND_MODIFY( "scsi:cdrom:cdda" )
613   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "^^^mono", 1.0)
617   MCFG_DEVICE_ADD("wd33c93", WD33C93, 0)
618   MCFG_LEGACY_SCSI_PORT("scsi")
619   MCFG_WD33C93_IRQ_CB(WRITELINE(ip20_state, scsi_irq))      /* command completion IRQ */
614620
615621   MCFG_EEPROM_SERIAL_93C56_ADD("eeprom")
616622MACHINE_CONFIG_END
branches/old_menus/src/mess/drivers/mac.c
r29633r29634
5353#include "machine/sonydriv.h"
5454#include "formats/ap_dsk35.h"
5555#include "machine/ram.h"
56#include "machine/scsibus.h"
57#include "machine/scsihd.h"
58#include "machine/scsicd.h"
56#include "bus/scsi/scsi.h"
57#include "bus/scsi/scsihd.h"
58#include "bus/scsi/scsicd.h"
5959#include "sound/asc.h"
6060#include "sound/awacs.h"
6161#include "sound/cdda.h"
r29633r29634
972972   MCFG_CPU_MODIFY( "maincpu" )
973973   MCFG_CPU_PROGRAM_MAP(macplus_map)
974974
975   MCFG_SCSIBUS_ADD("scsi")
976   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_6)
977   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_5)
978   MCFG_DEVICE_ADD("scsi:ncr5380", NCR5380, C7M)
979   MCFG_NCR5380_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, mac_state, mac_scsi_irq))
975   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
976   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6)
977   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5)
980978
979   MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M)
980   MCFG_LEGACY_SCSI_PORT("scsi")
981   MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq))
982
981983   MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_MODIFY(mac_floppy_interface)
982984
983985   /* internal ram */
r29633r29634
10641066
10651067   /* devices */
10661068   MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz)
1067   MCFG_SCSIBUS_ADD("scsi")
1068   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_6)
1069   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_5)
1070   MCFG_DEVICE_ADD("scsi:ncr5380", NCR5380, C7M)
1071   MCFG_NCR5380_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, mac_state, mac_scsi_irq))
10721069
1070   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1071   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6)
1072   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5)
1073
1074   MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M)
1075   MCFG_LEGACY_SCSI_PORT("scsi")
1076   MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq))
1077
10731078   MCFG_IWM_ADD("fdc", mac_iwm_interface)
10741079   MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface)
10751080
r29633r29634
11161121   MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL)
11171122   MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL)
11181123
1119   MCFG_SCSIBUS_ADD("scsi")
1120   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_6)
1121   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_5)
1122   MCFG_SCSIDEV_ADD("scsi:cdrom1", SCSICD, SCSI_ID_4)
1123   MCFG_DEVICE_ADD("scsi:ncr5380", NCR5380, C7M)
1124   MCFG_NCR5380_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, mac_state, mac_scsi_irq))
1124   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1125   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6)
1126   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5)
1127   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "cdrom", SCSICD, SCSI_ID_4)
11251128
1129   MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M)
1130   MCFG_LEGACY_SCSI_PORT("scsi")
1131   MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq))
1132
11261133   MCFG_IWM_ADD("fdc", mac_iwm_interface)
11271134   MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface)
11281135
r29633r29634
11811188   MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL)
11821189   MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL)
11831190
1184   MCFG_SCSIBUS_ADD("scsi")
1185   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_6)
1186   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_5)
1187   MCFG_DEVICE_ADD("scsi:ncr5380", NCR5380, C7M)
1188   MCFG_NCR5380_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, mac_state, mac_scsi_irq))
1191   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1192   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6)
1193   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5)
11891194
1195   MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M)
1196   MCFG_LEGACY_SCSI_PORT("scsi")
1197   MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq))
1198
11901199   MCFG_IWM_ADD("fdc", mac_iwm_interface)
11911200   MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface)
11921201
r29633r29634
14241433
14251434   /* devices */
14261435   MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz)
1427   MCFG_SCSIBUS_ADD("scsi")
1428   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_6)
1429   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_5)
1430   MCFG_DEVICE_ADD("scsi:ncr5380", NCR5380, C7M)
1431   MCFG_NCR5380_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, mac_state, mac_scsi_irq))
14321436
1437   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1438   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6)
1439   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5)
1440
1441   MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M)
1442   MCFG_LEGACY_SCSI_PORT("scsi")
1443   MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq))
1444
14331445   MCFG_NUBUS_BUS_ADD("pds", "maincpu", nubus_intf)
14341446   MCFG_NUBUS_SLOT_ADD("pds","pds030", mac_pds030_cards, NULL)
14351447
r29633r29634
14901502   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
14911503
14921504   /* devices */
1493   MCFG_SCSIBUS_ADD("scsi")
1494   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_6)
1495   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_5)
1496   MCFG_DEVICE_ADD("scsi:ncr5380", NCR5380, C7M)
1497   MCFG_NCR5380_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, mac_state, mac_scsi_irq))
1505   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1506   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6)
1507   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5)
14981508
1509   MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M)
1510   MCFG_LEGACY_SCSI_PORT("scsi")
1511   MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq))
1512
14991513   MCFG_SWIM_ADD("fdc", mac_iwm_interface)
15001514   MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface)
15011515
r29633r29634
15731587   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
15741588
15751589   /* devices */
1576   MCFG_SCSIBUS_ADD("scsi")
1577   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_6)
1578   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_5)
1579   MCFG_DEVICE_ADD("scsi:ncr5380", NCR5380, C7M)
1580   MCFG_NCR5380_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, mac_state, mac_scsi_irq))
1590   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1591   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6)
1592   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5)
15811593
1594   MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M)
1595   MCFG_LEGACY_SCSI_PORT("scsi")
1596   MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq))
1597
15821598   MCFG_SWIM_ADD("fdc", mac_iwm_interface)
15831599   MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface)
15841600
r29633r29634
17701786   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
17711787
17721788   /* devices */
1773   MCFG_SCSIBUS_ADD("scsi")
1774   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_6)
1775   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_5)
1776   MCFG_DEVICE_ADD("scsi:ncr5380", NCR5380, C7M)
1777   MCFG_NCR5380_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, mac_state, mac_scsi_irq))
1789   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1790   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6)
1791   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5)
17781792
1793   MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M)
1794   MCFG_LEGACY_SCSI_PORT("scsi")
1795   MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq))
1796
17791797   MCFG_IWM_ADD("fdc", mac_iwm_interface)
17801798   MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface)
17811799
r29633r29634
18591877   MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b))
18601878   MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq))
18611879
1862   MCFG_SCSIBUS_ADD("scsi")
1863   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_6)
1864   MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_5)
1880   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1881   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6)
1882   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5)
1883
18651884   MCFG_DEVICE_ADD(MAC_539X_1_TAG, NCR539X, C7M)
1866   MCFG_NCR539X_OUT_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, mac_state, irq_539x_1_w))
1867   MCFG_NCR539X_OUT_DRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, mac_state, drq_539x_1_w))
1868   
1885   MCFG_LEGACY_SCSI_PORT("scsi")
1886   MCFG_NCR539X_OUT_IRQ_CB(WRITELINE(mac_state, irq_539x_1_w))
1887   MCFG_NCR539X_OUT_DRQ_CB(WRITELINE(mac_state, drq_539x_1_w))
1888
18691889   /* internal ram */
18701890   MCFG_RAM_ADD(RAM_TAG)
18711891   MCFG_RAM_DEFAULT_SIZE("4M")
branches/old_menus/src/mess/drivers/rmnimbus.c
r29633r29634
1414#include "machine/ram.h"
1515#include "formats/pc_dsk.h"
1616#include "includes/rmnimbus.h"
17#include "machine/scsibus.h"
18#include "machine/scsicb.h"
19#include "machine/scsihd.h"
17#include "bus/scsi/scsihd.h"
2018#include "bus/scsi/s1410.h"
2119#include "bus/scsi/acb4070.h"
2220#include "machine/6522via.h"
r29633r29634
297295   MCFG_WD2793_ADD(FDC_TAG, nimbus_wd17xx_interface )
298296   MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(nimbus_floppy_interface)
299297
300   MCFG_SCSIBUS_ADD(SCSIBUS_TAG)
301   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":harddisk0", SCSIHD, SCSI_ID_0)
302   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":harddisk1", SCSIHD, SCSI_ID_1)
303   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":harddisk2", ACB4070, SCSI_ID_2)
304   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":harddisk3", S1410, SCSI_ID_3)
305   MCFG_SCSICB_ADD(SCSIBUS_TAG ":host")
306   MCFG_SCSICB_BSY_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, rmnimbus_state, nimbus_scsi_bsy_w))
307   MCFG_SCSICB_CD_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, rmnimbus_state, nimbus_scsi_cd_w))
308   MCFG_SCSICB_IO_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, rmnimbus_state, nimbus_scsi_io_w))
309   MCFG_SCSICB_MSG_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, rmnimbus_state, nimbus_scsi_msg_w))
310   MCFG_SCSICB_REQ_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, rmnimbus_state, nimbus_scsi_req_w))
298   MCFG_DEVICE_ADD(SCSIBUS_TAG, SCSI_PORT, 0)
299   MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in")
300   MCFG_SCSI_MSG_HANDLER(WRITELINE(rmnimbus_state, write_scsi_msg))
301   MCFG_SCSI_BSY_HANDLER(WRITELINE(rmnimbus_state, write_scsi_bsy))
302   MCFG_SCSI_IO_HANDLER(WRITELINE(rmnimbus_state, write_scsi_io))
303   MCFG_SCSI_CD_HANDLER(WRITELINE(rmnimbus_state, write_scsi_cd))
304   MCFG_SCSI_REQ_HANDLER(WRITELINE(rmnimbus_state, write_scsi_req))
311305
306   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
307   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1)
308   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE3, "harddisk", ACB4070, SCSI_ID_2)
309   MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE4, "harddisk", S1410, SCSI_ID_3)
310
311   MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SCSIBUS_TAG)
312   MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0)
313
314   MCFG_DEVICE_ADD("scsi_ctrl_out", OUTPUT_LATCH, 0)
315   MCFG_OUTPUT_LATCH_BIT0_HANDLER(DEVWRITELINE(SCSIBUS_TAG, SCSI_PORT_DEVICE, write_rst))
316   MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE(SCSIBUS_TAG, SCSI_PORT_DEVICE, write_sel))
317   MCFG_OUTPUT_LATCH_BIT2_HANDLER(WRITELINE(rmnimbus_state, write_scsi_iena))
318
312319   MCFG_RAM_ADD(RAM_TAG)
313320   MCFG_RAM_DEFAULT_SIZE("1536K")
314321   MCFG_RAM_EXTRA_OPTIONS("128K,256K,384K,512K,640K,1024K")
branches/old_menus/src/mess/drivers/pc9801.c
r29633r29634
400400#include "machine/i8251.h"
401401
402402#include "bus/scsi/s1410.h"
403#include "machine/scsibus.h"
404#include "machine/scsicb.h"
405#include "machine/scsihd.h"
403#include "bus/scsi/scsi.h"
404#include "bus/scsi/scsihd.h"
405#include "machine/buffer.h"
406#include "machine/latch.h"
406407
407408#include "sound/beep.h"
408409#include "sound/speaker.h"
r29633r29634
445446      m_sio(*this, UPD8251_TAG),
446447      m_hgdc1(*this, "upd7220_chr"),
447448      m_hgdc2(*this, "upd7220_btm"),
448      m_sasibus(*this, SASIBUS_TAG ":host"),
449      m_sasibus(*this, SASIBUS_TAG),
450      m_sasi_data_out(*this, "sasi_data_out"),
451      m_sasi_data_in(*this, "sasi_data_in"),
452      m_sasi_ctrl_in(*this, "sasi_ctrl_in"),
449453      m_ide(*this, "ide"),
450454      m_video_ram_1(*this, "video_ram_1"),
451455      m_video_ram_2(*this, "video_ram_2"),
r29633r29634
468472   required_device<i8251_device> m_sio;
469473   required_device<upd7220_device> m_hgdc1;
470474   required_device<upd7220_device> m_hgdc2;
471   optional_device<scsicb_device> m_sasibus;
475   optional_device<SCSI_PORT_DEVICE> m_sasibus;
476   optional_device<output_latch_device> m_sasi_data_out;
477   optional_device<input_buffer_device> m_sasi_data_in;
478   optional_device<input_buffer_device> m_sasi_ctrl_in;
472479   optional_device<ata_interface_device> m_ide;
473480   required_shared_ptr<UINT8> m_video_ram_1;
474481   required_shared_ptr<UINT8> m_video_ram_2;
r29633r29634
590597   UINT32 pc9801_286_a20(bool state);
591598
592599   DECLARE_WRITE8_MEMBER(sasi_data_w);
593   DECLARE_WRITE_LINE_MEMBER(sasi_io_w);
594   DECLARE_READ8_MEMBER( sasi_status_r );
595   DECLARE_WRITE8_MEMBER( sasi_ctrl_w );
600   DECLARE_WRITE_LINE_MEMBER(write_sasi_io);
601   DECLARE_READ8_MEMBER(sasi_status_r);
602   DECLARE_WRITE8_MEMBER(sasi_ctrl_w);
596603
597   struct{
598      UINT8 data_out;
599      UINT8 ctrl;
600   }m_sasi;
604   UINT8 m_sasi_data;
605   int m_sasi_data_enable;
606   UINT8 m_sasi_ctrl;
601607
602608   DECLARE_READ8_MEMBER(pc9801rs_wram_r);
603609   DECLARE_WRITE8_MEMBER(pc9801rs_wram_w);
r29633r29634
17231729
17241730WRITE8_MEMBER( pc9801_state::sasi_data_w )
17251731{
1726   m_sasi.data_out = data;
1732   m_sasi_data = data;
17271733
1728   if( !m_sasibus->scsi_io_r() )
1734   if (m_sasi_data_enable)
17291735   {
1730      m_sasibus->scsi_data_w( data );
1736      m_sasi_data_out->write(m_sasi_data);
17311737   }
17321738}
17331739
1734WRITE_LINE_MEMBER( pc9801_state::sasi_io_w )
1740WRITE_LINE_MEMBER( pc9801_state::write_sasi_io )
17351741{
1736   if( !state )
1742   m_sasi_ctrl_in->write_bit2(state);
1743
1744   m_sasi_data_enable = !state;
1745
1746   if (m_sasi_data_enable)
17371747   {
1738      m_sasibus->scsi_data_w( m_sasi.data_out );
1748      m_sasi_data_out->write(m_sasi_data);
17391749   }
17401750   else
17411751   {
1742      m_sasibus->scsi_data_w( 0 );
1752      m_sasi_data_out->write(0);
17431753   }
17441754}
17451755
r29633r29634
17491759{
17501760   UINT8 res = 0;
17511761
1752   if(m_sasi.ctrl & 0x40) // read status
1762   if(m_sasi_ctrl & 0x40) // read status
17531763   {
17541764   /*
17551765       x--- -.-- REQ
r29633r29634
17601770       ---- -x-- IO
17611771       ---- ---x INT?
17621772   */
1763//      res |= m_sasibus->scsi_cd_r() << 0;
1764      res |= m_sasibus->scsi_io_r() << 2;
1765      res |= m_sasibus->scsi_cd_r() << 3;
1766      res |= m_sasibus->scsi_msg_r() << 4;
1767      res |= m_sasibus->scsi_bsy_r() << 5;
1768      res |= m_sasibus->scsi_ack_r() << 6;
1769      res |= m_sasibus->scsi_req_r() << 7;
1773      res |= m_sasi_ctrl_in->read();
17701774   }
17711775   else // read drive info
17721776   {
r29633r29634
17931797       ---- ---x irq enable
17941798   */
17951799
1796   m_sasibus->scsi_sel_w(BIT(data, 5));
1800   m_sasibus->write_sel(BIT(data, 5));
17971801
1798   if(m_sasi.ctrl & 8 && ((data & 8) == 0)) // 1 -> 0 transition
1802   if(m_sasi_ctrl & 8 && ((data & 8) == 0)) // 1 -> 0 transition
17991803   {
1800      m_sasibus->scsi_rst_w(1);
1804      m_sasibus->write_rst(1);
18011805//      m_timer_rst->adjust(attotime::from_nsec(100));
18021806   }
18031807   else
1804      m_sasibus->scsi_rst_w(0); // TODO
1808      m_sasibus->write_rst(0); // TODO
18051809
1806   m_sasi.ctrl = data;
1810   m_sasi_ctrl = data;
18071811
1808//  m_sasibus->scsi_sel_w(BIT(data, 0));
1812//  m_sasibus->write_sel(BIT(data, 0));
18091813}
18101814
18111815static ADDRESS_MAP_START( pc9801_map, AS_PROGRAM, 16, pc9801_state )
r29633r29634
18321836//  AM_RANGE(0x006c, 0x006f) border color / <undefined>
18331837   AM_RANGE(0x0070, 0x007b) AM_READWRITE8(pc9801_70_r,pc9801_70_w,0xffff) //display registers / i8253 pit
18341838//  AM_RANGE(0x0080, 0x0083) AM_READWRITE8(pc9801_sasi_r,pc9801_sasi_w,0xffff) //HDD SASI interface / <undefined>
1835   AM_RANGE(0x0080, 0x0081) AM_DEVREAD8(SASIBUS_TAG ":host", scsicb_device, scsi_data_r, 0x00ff) AM_WRITE8(sasi_data_w, 0x00ff)
1839   AM_RANGE(0x0080, 0x0081) AM_DEVREAD8("scsi_data_in", input_buffer_device, read, 0x00ff) AM_WRITE8(sasi_data_w, 0x00ff)
18361840   AM_RANGE(0x0082, 0x0083) AM_READWRITE8(sasi_status_r, sasi_ctrl_w,0x00ff)
18371841   AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801_fdc_2hd_r,pc9801_fdc_2hd_w,0xffff) //upd765a 2hd / cmt
18381842   AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r,pc9801_a0_w,0xffff) //upd7220 bitmap ports / display registers
r29633r29634
33783382
33793383   m_ipl_rom = memregion("ipl")->base();
33803384   m_sound_bios = memregion("sound_bios")->base();
3385
3386   save_item(NAME(m_sasi_data));
3387   save_item(NAME(m_sasi_data_enable));
3388   save_item(NAME(m_sasi_ctrl));
33813389}
33823390
33833391MACHINE_START_MEMBER(pc9801_state,pc9801f)
r29633r29634
35833591MACHINE_CONFIG_END
35843592
35853593static MACHINE_CONFIG_FRAGMENT( pc9801_sasi )
3586   MCFG_SCSIBUS_ADD(SASIBUS_TAG)
3587   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":harddisk0", S1410, SCSI_ID_0) // TODO: correct one, perhaps ttl
3588   MCFG_SCSICB_ADD(SASIBUS_TAG ":host")
3589   MCFG_SCSICB_IO_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, pc9801_state, sasi_io_w))
3594   MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0)
3595   MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in")
3596   MCFG_SCSI_IO_HANDLER(WRITELINE(pc9801_state, write_sasi_io)) // bit2
3597   MCFG_SCSI_CD_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3))
3598   MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4))
3599   MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit5))
3600   MCFG_SCSI_ACK_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit6))
3601   MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit7))
3602
3603   MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", S1410, SCSI_ID_0) // TODO: correct one, perhaps ttl
3604
3605   MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", SASIBUS_TAG)
3606   MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0)
3607   MCFG_DEVICE_ADD("sasi_ctrl_in", INPUT_BUFFER, 0)
35903608MACHINE_CONFIG_END
35913609
35923610
branches/old_menus/src/mess/drivers/ip22.c
r29633r29634
5050#include "video/newport.h"
5151#include "sound/dac.h"
5252#include "machine/nvram.h"
53#include "machine/scsibus.h"
54#include "machine/scsicd.h"
55#include "machine/scsihd.h"
53#include "bus/scsi/scsi.h"
54#include "bus/scsi/scsicd.h"
55#include "bus/scsi/scsihd.h"
5656#include "machine/wd33c93.h"
5757
5858struct RTC_t
r29633r29634
9797      TIMER_IP22_MSEC
9898   };
9999
100   ip22_state(const machine_config &mconfig, device_type type, const char *tag)
101      : driver_device(mconfig, type, tag),
102   m_maincpu(*this, "maincpu"),
103   m_wd33c93(*this, "scsi:wd33c93"),
104   m_unkpbus0(*this, "unkpbus0"),
105   m_mainram(*this, "mainram"),
106   m_lpt0(*this, "lpt_0"),
107   m_pit(*this, "pit8254"),
108   m_sgi_mc(*this, "sgi_mc"),
109   m_newport(*this, "newport"),
110   m_dac(*this, "dac"),
111   m_kbdc8042(*this, "kbdc")
112   { }
100   ip22_state(const machine_config &mconfig, device_type type, const char *tag) :
101      driver_device(mconfig, type, tag),
102      m_maincpu(*this, "maincpu"),
103      m_wd33c93(*this, "wd33c93"),
104      m_unkpbus0(*this, "unkpbus0"),
105      m_mainram(*this, "mainram"),
106      m_lpt0(*this, "lpt_0"),
107      m_pit(*this, "pit8254"),
108      m_sgi_mc(*this, "sgi_mc"),
109      m_newport(*this, "newport"),
110      m_dac(*this, "dac"),
111      m_kbdc8042(*this, "kbdc")
112   {
113   }
113114
114115   required_device<cpu_device> m_maincpu;
115116   required_device<wd33c93_device> m_wd33c93;
r29633r29634
12751276            if (words <= (512/4))
12761277            {
12771278               // one-shot
1278               //m_wd33c93->get_dma_data(m_wd33c93->get_dma_count(), m_dma_buffer);
1279               //m_wd33c93->dma_read_data(m_wd33c93->get_dma_count(), m_dma_buffer);
12791280
12801281               while (words)
12811282               {
r29633r29634
13021303               }
13031304
13041305               words = m_wd33c93->get_dma_count();
1305               m_wd33c93->write_data(words, m_dma_buffer);
1306               m_wd33c93->dma_write_data(words, m_dma_buffer);
13061307            }
13071308            else
13081309            {
13091310               while (words)
13101311               {
1311                  //m_wd33c93->get_dma_data(512, m_dma_buffer);
1312                  //m_wd33c93->dma_read_data(512, m_dma_buffer);
13121313                  twords = 512/4;
13131314                  m_HPC3.nSCSI0Descriptor += 512;
13141315                  dptr = 0;
r29633r29634
13371338                     twords--;
13381339                  }
13391340
1340                  m_wd33c93->write_data(512, m_dma_buffer);
1341                  m_wd33c93->dma_write_data(512, m_dma_buffer);
13411342
13421343                  words -= (512/4);
13431344               }
r29633r29634
14161417            if (words <= (1024/4))
14171418            {
14181419               // one-shot
1419               m_wd33c93->get_dma_data(m_wd33c93->get_dma_count(), m_dma_buffer);
1420               m_wd33c93->dma_read_data(m_wd33c93->get_dma_count(), m_dma_buffer);
14201421
14211422               while (words)
14221423               {
r29633r29634
14391440            {
14401441               while (words)
14411442               {
1442                  m_wd33c93->get_dma_data(512, m_dma_buffer);
1443                  m_wd33c93->dma_read_data(512, m_dma_buffer);
14431444                  twords = 512/4;
14441445                  sptr = 0;
14451446
r29633r29634
15851586};
15861587#endif
15871588
1589static MACHINE_CONFIG_FRAGMENT( cdrom_config )
1590   MCFG_DEVICE_MODIFY( "cdda" )
1591   MCFG_SOUND_ROUTE( 0, "^^^^lspeaker", 1.0 )
1592   MCFG_SOUND_ROUTE( 1, "^^^^rspeaker", 1.0 )
1593MACHINE_CONFIG_END
1594
15881595static MACHINE_CONFIG_START( ip225015, ip22_state )
15891596   MCFG_CPU_ADD( "maincpu", R5000BE, 50000000*3 )
15901597   MCFG_CPU_CONFIG( config )
r29633r29634
16221629   MCFG_SOUND_ADD( "dac", DAC, 0 )
16231630   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5)
16241631
1625   MCFG_SCSIBUS_ADD("scsi")
1626   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_1)
1627   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_4)
1628   MCFG_DEVICE_ADD("scsi:wd33c93", WD33C93, 0)
1629   MCFG_WD33C93_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, ip22_state,scsi_irq))
1632   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
1633   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_1)
1634   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "cdrom", SCSICD, SCSI_ID_4)
1635   MCFG_SLOT_OPTION_MACHINE_CONFIG("cdrom", cdrom_config)
16301636
1631   MCFG_SOUND_MODIFY( "scsi:cdrom:cdda" )
1632   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "^^^lspeaker", 1.0)
1633   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "^^^rspeaker", 1.0)
1637   MCFG_DEVICE_ADD("wd33c93", WD33C93, 0)
1638   MCFG_LEGACY_SCSI_PORT("scsi")
1639   MCFG_WD33C93_IRQ_CB(WRITELINE(ip22_state,scsi_irq))
16341640
16351641   MCFG_DEVICE_ADD("kbdc", KBDC8042, 0)
16361642   MCFG_KBDC8042_KEYBOARD_TYPE(KBDC8042_STANDARD)
branches/old_menus/src/mess/drivers/concept.c
r29633r29634
190190/* init with simple, fixed, B/W palette */
191191/* Is the palette black on white or white on black??? */
192192
193static const mm58274c_interface concept_mm58274c_interface =
194{
195   0,  /*  mode 24*/
196   1   /*  first day of week */
197};
198
199
200193SLOT_INTERFACE_START( concept_exp_devices )
201194   SLOT_INTERFACE("fdc", CONCEPT_FDC)
202195   SLOT_INTERFACE("hdc", CONCEPT_HDC)
r29633r29634
227220   /* no sound? */
228221
229222   /* rtc */
230   MCFG_MM58274C_ADD("mm58274c", concept_mm58274c_interface)
223   MCFG_DEVICE_ADD("mm58274c", MM58274C, 0)
224   MCFG_MM58274C_MODE24(0) // 12 hour
225   MCFG_MM58274C_DAY1(1)   // monday
231226
232227   /* via */
233228   MCFG_DEVICE_ADD("via6522_0", VIA6522, 1022750)
branches/old_menus/src/mess/mess.mak
r29633r29634
469469MACHINES += S3C2440
470470MACHINES += S3C44B0
471471MACHINES += SATURN
472MACHINES += SCSI
473472MACHINES += SCUDSP
474473MACHINES += SECFLASH
475474MACHINES += SEIBU_COP
branches/old_menus/src/mess/machine/fm_scsi.c
r29633r29634
3737 */
3838
3939fmscsi_device::fmscsi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
40   : device_t(mconfig, FMSCSI, "FM-SCSI", tag, owner, clock, "fmscsi", __FILE__),
40   : legacy_scsi_host_adapter(mconfig, FMSCSI, "FM-SCSI", tag, owner, clock, "fmscsi", __FILE__),
4141   m_irq_handler(*this),
4242   m_drq_handler(*this)
4343{
r29633r29634
5656   m_irq_handler.resolve_safe();
5757   m_drq_handler.resolve_safe();
5858
59   memset(m_SCSIdevices,0,sizeof(m_SCSIdevices));
60
61   // try to open the devices
62   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
63   {
64      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
65      if( scsidev != NULL )
66      {
67         m_SCSIdevices[scsidev->GetDeviceID()] = scsidev;
68      }
69   }
70
7159   // allocate read timer
7260   m_transfer_timer = timer_alloc(TIMER_TRANSFER);
7361   m_phase_timer = timer_alloc(TIMER_PHASE);
r29633r29634
133121      //logerror("FMSCSI: DATAIN phase read data %02x\n",m_data);
134122      m_result_index++;
135123      if(m_result_index % 512 == 0)
136         m_SCSIdevices[m_target]->ReadData(m_buffer,512);  // read next sector
124         read_data(m_buffer,512);  // read next sector
137125
138126      if(m_result_index >= m_result_length)
139127      {
r29633r29634
198186      m_buffer[m_result_index % 512] = m_data;
199187      m_result_index++;
200188      if(m_result_index % 512 == 0)
201         m_SCSIdevices[m_target]->WriteData(m_buffer,512);  // write buffer to disc
189         write_data(m_buffer,512);  // write buffer to disc
202190      if(m_result_index >= m_result_length)
203191      {
204192         // end of data transfer
r29633r29634
219207      if(m_command_index >= get_scsi_cmd_len(m_command[0]))
220208      {
221209         // command complete
222         m_SCSIdevices[m_target]->SetCommand(m_command,m_command_index);
223         m_SCSIdevices[m_target]->ExecCommand();
224         m_SCSIdevices[m_target]->GetLength(&m_result_length);
225         m_SCSIdevices[m_target]->GetPhase(&phase);
210         send_command(m_command,m_command_index);
211         m_result_length = get_length();
212         phase = get_phase();
226213         if(m_command[0] == 1)  // rezero unit command - not implemented in SCSI code
227214            m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS);
228215         else
r29633r29634
275262      set_input_line(FMSCSI_LINE_REQ,1);
276263      // start transfer timer
277264      m_transfer_timer->adjust(attotime::zero,0,attotime::from_hz(3000000));  // arbitrary value for now
278      m_SCSIdevices[m_target]->ReadData(m_buffer,512);
265      read_data(m_buffer,512);
279266      m_result_index = 0;
280267      logerror("FMSCSI: Starting transfer (%i)\n",m_result_length);
281268      break;
r29633r29634
356343   {
357344      if(state != 0 && !(m_output_lines & FMSCSI_LINE_SEL)) // low to high transition
358345      {
359         void *image;
360         m_SCSIdevices[m_target]->GetDevice(&image);
361         if (image != NULL)  // if device is mounted
346         if (select(m_target))
362347         {
363348            m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_COMMAND);
364349            m_data = 0x08;
branches/old_menus/src/mess/machine/fm_scsi.h
r29633r29634
88#ifndef FM_SCSI_H_
99#define FM_SCSI_H_
1010
11#include "machine/scsihle.h"
11#include "machine/legscsi.h"
1212
1313// SCSI input lines (from target)
1414#define FMSCSI_LINE_REQ   0x80
r29633r29634
3737   devcb = &fmscsi_device::set_irq_handler(*device, DEVCB2_##_devcb);
3838#define MCFG_FMSCSI_DRQ_HANDLER(_devcb) \
3939   devcb = &fmscsi_device::set_drq_handler(*device, DEVCB2_##_devcb);
40class fmscsi_device : public device_t
40
41class fmscsi_device : public legacy_scsi_host_adapter
4142{
4243public:
4344   // construction/destruction
r29633r29634
7879   devcb2_write_line m_irq_handler;
7980   devcb2_write_line m_drq_handler;
8081
81   scsihle_device* m_SCSIdevices[8];
8282   UINT8 m_command[32];
8383   //UINT8 m_result[32];
8484   UINT8 m_command_index;
branches/old_menus/src/mess/machine/rmnimbus.c
r29633r29634
6565#include "machine/pit8253.h"
6666#include "machine/i8251.h"
6767#include "machine/6522via.h"
68#include "machine/scsibus.h"
68#include "bus/scsi/scsi.h"
6969
7070#include "includes/rmnimbus.h"
7171
r29633r29634
22052205   wd2793_device *fdc = machine().device<wd2793_device>(FDC_TAG);
22062206
22072207   m_nimbus_drives.reg400=0;
2208   m_nimbus_drives.reg410_in=0;
2209   m_nimbus_drives.reg410_out=0;
2208   m_scsi_ctrl_out->write(0);
22102209   m_nimbus_drives.int_ff=0;
22112210   fdc->set_pause_time(FDC_PAUSE);
22122211}
r29633r29634
22922291         result = fdc->data_r(space, 0);
22932292         break;
22942293      case 0x10 :
2295         m_nimbus_drives.reg410_in &= ~FDC_BITS_410;
2296         m_nimbus_drives.reg410_in |= (FDC_MOTOR() ? FDC_MOTOR_MASKI : 0x00);
2297         m_nimbus_drives.reg410_in |= (drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_INDEX) ? 0x00 : FDC_INDEX_MASK);
2298         m_nimbus_drives.reg410_in |= (drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) ? FDC_READY_MASK : 0x00);
2299
2300         // Flip inverted bits
2301         result=m_nimbus_drives.reg410_in ^ INV_BITS_410;
2294         result |= !m_scsi_req << 7;
2295         result |= !m_scsi_cd << 6;
2296         result |= !m_scsi_io << 5;
2297         result |= !m_scsi_bsy << 4;
2298         result |= m_scsi_msg << 3;
2299         result |= FDC_MOTOR() << 2;
2300         result |= !drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_INDEX) << 1;
2301         result |= drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) << 0;
23022302         break;
23032303      case 0x18 :
2304         result = m_scsibus->scsi_data_r();
2304         result = m_scsi_data_in->read();
23052305         hdc_post_rw();
23062306      default:
23072307         break;
r29633r29634
23752375         fdc->data_w(space, 0, data);
23762376         break;
23772377      case 0x10 :
2378         hdc_ctrl_write(data);
2378         m_scsi_ctrl_out->write(data);
23792379         break;
23802380
23812381      case 0x18 :
2382         m_scsibus->scsi_data_w(data);
2382         m_scsi_data_out->write(data);
23832383         hdc_post_rw();
23842384         break;
23852385   }
r29633r29634
23872387
23882388void rmnimbus_state::hdc_reset()
23892389{
2390   m_nimbus_drives.reg410_in=0;
2391   m_nimbus_drives.reg410_in |= (m_scsibus->scsi_req_r() ? 0 : HDC_REQ_MASK);
2392   m_nimbus_drives.reg410_in |= (m_scsibus->scsi_cd_r()  ? 0 : HDC_CD_MASK);
2393   m_nimbus_drives.reg410_in |= (m_scsibus->scsi_io_r()  ? 0 : HDC_IO_MASK);
2394   m_nimbus_drives.reg410_in |= (m_scsibus->scsi_bsy_r() ? 0 : HDC_BSY_MASK);
2395   m_nimbus_drives.reg410_in |= (m_scsibus->scsi_msg_r() ? 0 : HDC_MSG_MASK);
2396
23972390   m_nimbus_drives.drq_ff=0;
23982391}
23992392
2400void rmnimbus_state::hdc_ctrl_write(UINT8 data)
2393WRITE_LINE_MEMBER(rmnimbus_state::write_scsi_iena)
24012394{
2395   int last = m_scsi_iena;
2396   m_scsi_iena = state;
2397
24022398   // If we enable the HDC interupt, and an interrupt is pending, go deal with it.
2403   if(((data & HDC_IRQ_MASK) && (~m_nimbus_drives.reg410_out & HDC_IRQ_MASK)) &&
2404      ((~m_nimbus_drives.reg410_in & HDC_INT_TRIGGER)==HDC_INT_TRIGGER))
2399   if (m_scsi_iena && !last && !m_scsi_io && !m_scsi_cd && !m_scsi_req)
24052400      set_disk_int(1);
2406
2407   m_nimbus_drives.reg410_out=data;
2408
2409   m_scsibus->scsi_rst_w((data & HDC_RESET_MASK) ? 1 : 0);
2410   m_scsibus->scsi_sel_w((data & HDC_SEL_MASK) ? 1 : 0);
24112401}
24122402
24132403void rmnimbus_state::hdc_post_rw()
24142404{
2415   if((m_nimbus_drives.reg410_in & HDC_REQ_MASK)==0)
2416      m_scsibus->scsi_ack_w(1);
2405   if(!m_scsi_req)
2406      m_scsibus->write_ack(1);
24172407
24182408   m_nimbus_drives.drq_ff=0;
24192409}
r29633r29634
24262416   }
24272417}
24282418
2429WRITE_LINE_MEMBER( rmnimbus_state::nimbus_scsi_bsy_w )
2419WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_bsy )
24302420{
2431   nimbus_scsi_linechange( HDC_BSY_MASK, state );
2421   m_scsi_bsy = state;
24322422}
24332423
2434WRITE_LINE_MEMBER( rmnimbus_state::nimbus_scsi_cd_w )
2424WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_cd )
24352425{
2436   nimbus_scsi_linechange( HDC_CD_MASK, state );
2426   m_scsi_cd = state;
24372427}
24382428
2439WRITE_LINE_MEMBER( rmnimbus_state::nimbus_scsi_io_w )
2429WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_io )
24402430{
2441   nimbus_scsi_linechange( HDC_IO_MASK, state );
2442}
2431   m_scsi_io = state;
24432432
2444WRITE_LINE_MEMBER( rmnimbus_state::nimbus_scsi_msg_w )
2445{
2446   nimbus_scsi_linechange( HDC_MSG_MASK, state );
2433   if (m_scsi_io)
2434   {
2435      m_scsi_data_out->write(0);
2436   }
24472437}
24482438
2449WRITE_LINE_MEMBER( rmnimbus_state::nimbus_scsi_req_w )
2439WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_msg )
24502440{
2451   nimbus_scsi_linechange( HDC_REQ_MASK, state );
2441   m_scsi_msg = state;
24522442}
24532443
2454void rmnimbus_state::nimbus_scsi_linechange( UINT8 mask, UINT8 state )
2444WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_req )
24552445{
2456   UINT8   last = 0;
2446   int last = m_scsi_req;
2447   m_scsi_req = state;
24572448
2458   last=m_nimbus_drives.reg410_in & mask;
2459
2460   if(!state)
2461      m_nimbus_drives.reg410_in|=mask;
2462   else
2463      m_nimbus_drives.reg410_in&=~mask;
2464
2465
2466   if(HDC_IRQ_ENABLED() && ((~m_nimbus_drives.reg410_in & HDC_INT_TRIGGER)==HDC_INT_TRIGGER))
2467      set_disk_int(1);
2468   else
2469      set_disk_int(0);
2470
2471   switch( mask )
2449   if (state)
24722450   {
2473   case HDC_REQ_MASK:
2474      if (state)
2451      if (m_scsi_cd && last)
24752452      {
2476         if(((m_nimbus_drives.reg410_in & HDC_CD_MASK)==HDC_CD_MASK) && (last!=0))
2477         {
2478            m_nimbus_drives.drq_ff=1;
2479            hdc_drq();
2480         }
2453         m_nimbus_drives.drq_ff=1;
2454         hdc_drq();
24812455      }
2482      else
2483      {
2484         m_scsibus->scsi_ack_w(0);
2485      }
2486      break;
2487
2488   case HDC_IO_MASK:
2489      if (state)
2490      {
2491         m_scsibus->scsi_data_w(0);
2492      }
2493      break;
24942456   }
2457   else
2458   {
2459      m_scsibus->write_ack(0);
2460   }
24952461}
24962462
24972463/* 8031/8051 Peripheral controler 80186 side */
branches/old_menus/src/mess/machine/apple2.c
r29633r29634
345345   if(!space.debugger_access())
346346   {
347347      device_a2bus_card_interface *slotdevice;
348      int slot;
348349
349350      offset &= 0x7F;
351      slot = offset / 0x10;
350352
353      if ((m_machinetype == APPLE_IIC) || (m_machinetype == APPLE_IICPLUS))
354      {
355         if (slot == 1)
356         {
357            offset &= 0xf;
358            if (offset >= 8 && offset <= 0xb)
359            {
360               return m_acia1->read(space, offset-8);
361            }
362         }
363         else if (slot == 2)
364         {
365            offset &= 0xf;
366            if (offset >= 8 && offset <= 0xb)
367            {
368               return m_acia2->read(space, offset-8);
369            }
370         }
371      }
372
351373      /* now identify the device */
352      slotdevice = m_a2bus->get_a2bus_card(offset / 0x10);
374      slotdevice = m_a2bus->get_a2bus_card(slot);
353375
354376      /* and if we can, read from the slot */
355377      if (slotdevice != NULL)
r29633r29634
365387WRITE8_MEMBER(apple2_state::apple2_c080_w)
366388{
367389   device_a2bus_card_interface *slotdevice;
390   int slot;
368391
369392   offset &= 0x7F;
393   slot = offset / 0x10;
370394
395   if ((m_machinetype == APPLE_IIC) || (m_machinetype == APPLE_IICPLUS))
396   {
397      if (slot == 1)
398      {
399         offset &= 0xf;
400         if (offset >= 8 && offset <= 0xb)
401         {
402            m_acia1->write(space, offset-8, data);
403            return;
404         }
405      }
406      else if (slot == 2)
407      {
408         offset &= 0xf;
409         if (offset >= 8 && offset <= 0xb)
410         {
411            m_acia2->write(space, offset-8, data);
412            return;
413         }
414      }
415   }
416
371417   /* now identify the device */
372   slotdevice = m_a2bus->get_a2bus_card(offset / 0x10);
418   slotdevice = m_a2bus->get_a2bus_card(slot);
373419
374420   /* and if we can, write to the slot */
375421   if (slotdevice != NULL)
r29633r29634
21252171   apple2_refresh_delegates();
21262172}
21272173
2128MACHINE_START_MEMBER(apple2_state,apple2)
2174void apple2_state::apple2eplus_init_common(void *apple2cp_ce00_ram)
21292175{
21302176   apple2_memmap_config mem_cfg;
2131   void *apple2cp_ce00_ram = NULL;
21322177
21332178   m_flags_mask = 0;
21342179
2135   /* there appears to be some hidden RAM that is swapped in on the Apple
2136    * IIc plus; I have not found any official documentation but the BIOS
2137    * clearly uses this area as writeable memory */
2138   if (!strcmp(machine().system().name, "apple2cp")) {
2139      apple2cp_ce00_ram = auto_alloc_array(machine(), UINT8, 0x200);
2140      memset(apple2cp_ce00_ram, 0, sizeof(UINT8) * 0x200);
2141   }
2142
2143   m_machinetype = APPLE_IIEPLUS;
2144
21452180   apple2_init_common();
21462181
21472182   /* setup memory */
r29633r29634
21522187   apple2_setup_memory(&mem_cfg);
21532188}
21542189
2155MACHINE_START_MEMBER(apple2_state,apple2e)
2190MACHINE_START_MEMBER(apple2_state,apple2c)
21562191{
2157   apple2_memmap_config mem_cfg;
2158   void *apple2cp_ce00_ram = NULL;
2192   m_machinetype = APPLE_IIC;
21592193
2160   m_flags_mask = 0;
2194   apple2eplus_init_common((void *)NULL);
2195}
21612196
2197MACHINE_START_MEMBER(apple2_state,apple2cp)
2198{
2199   void *apple2cp_ce00_ram;
2200
21622201   /* there appears to be some hidden RAM that is swapped in on the Apple
21632202    * IIc plus; I have not found any official documentation but the BIOS
21642203    * clearly uses this area as writeable memory */
2165   if (!strcmp(machine().system().name, "apple2cp")) {
2166      apple2cp_ce00_ram = auto_alloc_array(machine(), UINT8, 0x200);
2167      memset(apple2cp_ce00_ram, 0, sizeof(UINT8) * 0x200);
2168   }
2204   apple2cp_ce00_ram = auto_alloc_array(machine(), UINT8, 0x200);
2205   memset(apple2cp_ce00_ram, 0, sizeof(UINT8) * 0x200);
21692206
2207   m_machinetype = APPLE_IICPLUS;
2208
2209   apple2eplus_init_common(apple2cp_ce00_ram);
2210}
2211
2212MACHINE_START_MEMBER(apple2_state,apple2e)
2213{
2214   apple2_memmap_config mem_cfg;
2215
2216   m_flags_mask = 0;
2217
21702218   m_machinetype = APPLE_IIE;
21712219
21722220   apple2_init_common();
r29633r29634
21752223   memset(&mem_cfg, 0, sizeof(mem_cfg));
21762224   mem_cfg.first_bank = 1;
21772225   mem_cfg.memmap = apple2_memmap_entries;
2178   mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
2226   mem_cfg.auxmem = (UINT8*)NULL;
21792227   apple2_setup_memory(&mem_cfg);
21802228}
21812229
branches/old_menus/src/mess/machine/apple2gs.c
r29633r29634
19981998MACHINE_START_MEMBER(apple2gs_state,apple2gscommon)
19991999{
20002000   apple2gs_refresh_delegates();
2001   apple2_init_common();
20022001
2002   m_machinetype = APPLE_IIGS;
2003   apple2eplus_init_common(NULL);
2004
20032005   /* set up Apple IIgs vectoring */
20042006   g65816_set_read_vector_callback(m_maincpu, read8_delegate(FUNC(apple2gs_state::apple2gs_read_vector),this));
20052007
branches/old_menus/src/mess/includes/bullet.h
r29633r29634
99#include "cpu/z80/z80.h"
1010#include "bus/centronics/ctronics.h"
1111#include "machine/ram.h"
12#include "machine/scsibus.h"
13#include "machine/scsicb.h"
14#include "machine/scsihd.h"
12#include "bus/scsi/scsi.h"
1513#include "machine/wd_fdc.h"
1614#include "machine/z80ctc.h"
1715#include "machine/z80dart.h"
r29633r29634
136134class bulletf_state : public bullet_state
137135{
138136public:
139   bulletf_state(const machine_config &mconfig, device_type type, const char *tag)
140      : bullet_state(mconfig, type, tag),
141         m_floppy8(*this, MB8877_TAG":8"),
142         m_floppy9(*this, MB8877_TAG":9"),
143         m_scsibus(*this, SCSIBUS_TAG ":host")
144   { }
137   bulletf_state(const machine_config &mconfig, device_type type, const char *tag) :
138      bullet_state(mconfig, type, tag),
139      m_floppy8(*this, MB8877_TAG":8"),
140      m_floppy9(*this, MB8877_TAG":9"),
141      m_scsibus(*this, SCSIBUS_TAG),
142      m_scsi_data_in(*this, "scsi_data_in"),
143      m_scsi_data_out(*this, "scsi_data_out"),
144      m_scsi_ctrl_in(*this, "scsi_ctrl_in")
145   {
146   }
145147
146148   required_device<floppy_connector> m_floppy8;
147149   required_device<floppy_connector> m_floppy9;
148   required_device<scsicb_device> m_scsibus;
150   required_device<SCSI_PORT_DEVICE> m_scsibus;
151   required_device<input_buffer_device> m_scsi_data_in;
152   required_device<output_latch_device> m_scsi_data_out;
153   required_device<input_buffer_device> m_scsi_ctrl_in;
149154
150155   virtual void machine_start();
151156   virtual void machine_reset();
r29633r29634
161166
162167   DECLARE_READ8_MEMBER( dma_mreq_r );
163168   DECLARE_WRITE8_MEMBER( dma_mreq_w );
164   DECLARE_READ8_MEMBER( pio_pa_r );
165169   DECLARE_WRITE8_MEMBER( pio_pa_w );
166170   DECLARE_WRITE_LINE_MEMBER( cstrb_w );
167171   DECLARE_WRITE_LINE_MEMBER( req_w );
branches/old_menus/src/mess/includes/apple2.h
r29633r29634
1919#include "machine/kb3600.h"
2020#include "sound/speaker.h"
2121#include "machine/ram.h"
22#include "bus/rs232/rs232.h"
23#include "machine/mos6551.h"
2224
2325#define AUXSLOT_TAG "auxbus"
2426
27#define IIC_ACIA1_TAG "acia1"
28#define IIC_ACIA2_TAG "acia2"
29
30#define PRINTER_PORT_TAG "printer"
31#define MODEM_PORT_TAG "modem"
32
2533/***************************************************************************
2634    SOFTSWITCH VALUES
2735***************************************************************************/
r29633r29634
6876{
6977   APPLE_II,           // Apple II/II+
7078   APPLE_IIE,          // Apple IIe with aux slots
71   APPLE_IIEPLUS,      // Apple IIc/IIgs/IIc+ with permanent aux memory
79   APPLE_IIGS,         // Apple IIgs
80   APPLE_IIC,         // Apple IIc
81   APPLE_IICPLUS,      // Apple IIc+
7282   TK2000,             // Microdigital TK2000
7383   LASER128,           // Laser 128/128EX/128EX2
7484   SPACE84,            // "Space 84" with flipped text mode
r29633r29634
125135      m_kbspecial(*this, "keyb_special"),
126136      m_kbrepeat(*this, "keyb_repeat"),
127137      m_resetdip(*this, "reset_dip"),
128      m_cassette(*this, "cassette")
138      m_cassette(*this, "cassette"),
139      m_acia1(*this, IIC_ACIA1_TAG),
140      m_acia2(*this, IIC_ACIA2_TAG)
129141   { }
130142
131143   required_device<cpu_device> m_maincpu;
r29633r29634
141153   optional_ioport m_resetdip;
142154   optional_device<cassette_image_device> m_cassette;
143155
156   optional_device<mos6551_device> m_acia1, m_acia2;
157
144158   UINT32 m_flags, m_flags_mask;
145159   INT32 m_a2_cnxx_slot;
146160   UINT32 m_a2_mask;
r29633r29634
294308   write8_delegate wd_inh_d000;
295309   read8_delegate rd_inh_e000;
296310   write8_delegate wd_inh_e000;
297   DECLARE_MACHINE_START(apple2);
311   DECLARE_MACHINE_START(apple2orig);
298312   DECLARE_MACHINE_START(apple2e);
313   DECLARE_MACHINE_START(apple2c);
314   DECLARE_MACHINE_START(apple2cp);
315   DECLARE_MACHINE_START(tk2000);
316   DECLARE_MACHINE_START(laser128);
317   DECLARE_MACHINE_START(space84);
318   DECLARE_MACHINE_START(laba2p);
299319   DECLARE_VIDEO_START(apple2);
300320   DECLARE_PALETTE_INIT(apple2);
301   DECLARE_MACHINE_START(apple2orig);
302321   DECLARE_VIDEO_START(apple2p);
303322   DECLARE_VIDEO_START(apple2e);
304323   DECLARE_VIDEO_START(apple2c);
305   DECLARE_MACHINE_START(tk2000);
306   DECLARE_MACHINE_START(laser128);
307   DECLARE_MACHINE_START(space84);
308   DECLARE_MACHINE_START(laba2p);
309324   UINT32 screen_update_apple2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
310325   TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt);
311326   DECLARE_WRITE8_MEMBER(a2bus_irq_w);
r29633r29634
334349   int apple2_fdc_has_525();
335350   void apple2_iwm_setdiskreg(UINT8 data);
336351   void apple2_init_common();
352   void apple2eplus_init_common(void *apple2cp_ce00_ram);
337353   INT8 apple2_slotram_r(address_space &space, int slotnum, int offset);
338354   int a2_no_ctrl_reset();
339355};
branches/old_menus/src/mess/includes/v1050.h
r29633r29634
1616#include "machine/i8255.h"
1717#include "machine/msm58321.h"
1818#include "machine/ram.h"
19#include "machine/scsibus.h"
20#include "machine/scsicb.h"
21#include "machine/scsihd.h"
19#include "bus/scsi/scsi.h"
20#include "bus/scsi/scsihd.h"
2221#include "machine/v1050kb.h"
2322#include "machine/wd_fdc.h"
2423#include "video/mc6845.h"
r29633r29634
8483      m_clock_sio(*this, CLOCK_SIO_TAG),
8584      m_timer_ack(*this, TIMER_ACK_TAG),
8685      m_timer_rst(*this, TIMER_RST_TAG),
87      m_sasibus(*this, SASIBUS_TAG ":host"),
86      m_sasibus(*this, SASIBUS_TAG),
87      m_sasi_data_out(*this, "scsi_data_out"),
88      m_sasi_data_in(*this, "scsi_data_in"),
89      m_sasi_ctrl_in(*this, "scsi_ctrl_in"),
8890      m_rom(*this, Z80_TAG),
8991      m_video_ram(*this, "video_ram"),
9092      m_attr_ram(*this, "attr_ram"),
r29633r29634
124126   DECLARE_WRITE8_MEMBER( videoram_w );
125127   DECLARE_WRITE_LINE_MEMBER( crtc_vs_w );
126128   DECLARE_WRITE8_MEMBER(sasi_data_w);
127   DECLARE_WRITE_LINE_MEMBER(sasi_io_w);
129   DECLARE_WRITE_LINE_MEMBER(write_sasi_io);
128130   DECLARE_READ8_MEMBER( sasi_status_r );
129131   DECLARE_WRITE8_MEMBER( sasi_ctrl_w );
130132
r29633r29634
182184   required_device<clock_device> m_clock_sio;
183185   required_device<timer_device> m_timer_ack;
184186   required_device<timer_device> m_timer_rst;
185   required_device<scsicb_device> m_sasibus;
187   required_device<SCSI_PORT_DEVICE> m_sasibus;
188   required_device<output_latch_device> m_sasi_data_out;
189   required_device<input_buffer_device> m_sasi_data_in;
190   required_device<input_buffer_device> m_sasi_ctrl_in;
186191   required_memory_region m_rom;
187192   required_shared_ptr<UINT8> m_video_ram;
188193   optional_shared_ptr<UINT8> m_attr_ram;
r29633r29634
211216   UINT8 m_attr;               // attribute latch
212217
213218   // sasi state
214   UINT8 data_out;
219   UINT8 m_sasi_data;
220   int m_sasi_data_enable;
215221
216222   UINT8 m_rtc_ppi_pa;
217223   UINT8 m_rtc_ppi_pc;
branches/old_menus/src/mess/includes/rmnimbus.h
r29633r29634
99#include "cpu/i86/i186.h"
1010#include "machine/z80sio.h"
1111#include "machine/wd17xx.h"
12#include "machine/scsicb.h"
12#include "bus/scsi/scsi.h"
1313#include "machine/6522via.h"
1414#include "machine/ram.h"
1515#include "machine/er59256.h"
r29633r29634
133133struct nimbus_drives_t
134134{
135135   UINT8   reg400;
136   UINT8   reg410_in;
137   UINT8   reg410_out;
138136   UINT8   reg418;
139137
140138   UINT8   drq_ff;
r29633r29634
283281#define HDC_DRQ_ENABLED()   ((m_nimbus_drives.reg400 & HDC_DRQ_MASK) ? 1 : 0)
284282#define FDC_DRQ_ENABLED()   ((m_nimbus_drives.reg400 & FDC_DRQ_MASK) ? 1 : 0)
285283
286/* Masks for port 0x410 read*/
287284
288#define FDC_READY_MASK  0x01
289#define FDC_INDEX_MASK  0x02
290#define FDC_MOTOR_MASKI 0x04
291#define HDC_MSG_MASK    0x08
292#define HDC_BSY_MASK    0x10
293#define HDC_IO_MASK     0x20
294#define HDC_CD_MASK     0x40
295#define HDC_REQ_MASK    0x80
296
297#define FDC_BITS_410    (FDC_READY_MASK | FDC_INDEX_MASK | FDC_MOTOR_MASKI)
298#define HDC_BITS_410    (HDC_MSG_MASK | HDC_BSY_MASK | HDC_IO_MASK | HDC_CD_MASK | HDC_REQ_MASK)
299#define INV_BITS_410    (HDC_BSY_MASK | HDC_IO_MASK | HDC_CD_MASK | HDC_REQ_MASK)
300
301#define HDC_INT_TRIGGER (HDC_IO_MASK | HDC_CD_MASK | HDC_REQ_MASK)
302
303/* Masks for port 0x410 write*/
304
305#define HDC_RESET_MASK  0x01
306#define HDC_SEL_MASK    0x02
307#define HDC_IRQ_MASK    0x04
308#define HDC_IRQ_ENABLED()   ((m_nimbus_drives.reg410_out & HDC_IRQ_MASK) ? 1 : 0)
309
310
311#define SCSI_ID_NONE    0x80
312
313
314285/* 8031/8051 Peripheral controler */
315286
316287#define IPC_OUT_ADDR        0X01
r29633r29634
388359class rmnimbus_state : public driver_device
389360{
390361public:
391   rmnimbus_state(const machine_config &mconfig, device_type type, const char *tag)
392      : driver_device(mconfig, type, tag),
362   rmnimbus_state(const machine_config &mconfig, device_type type, const char *tag) :
363      driver_device(mconfig, type, tag),
393364      m_maincpu(*this, "maincpu"),
394365      m_msm(*this, MSM5205_TAG),
395366      m_ay8910(*this, AY8910_TAG),
396      m_scsibus(*this, SCSIBUS_TAG ":host"),
367      m_scsibus(*this, SCSIBUS_TAG),
397368      m_ram(*this, RAM_TAG),
398369      m_eeprom(*this, ER59256_TAG),
399370      m_via(*this, VIA_TAG),
400371      m_centronics(*this, CENTRONICS_TAG),
401      m_palette(*this, "palette")
372      m_palette(*this, "palette"),
373      m_scsi_data_out(*this, "scsi_data_out"),
374      m_scsi_data_in(*this, "scsi_data_in"),
375      m_scsi_ctrl_out(*this, "scsi_ctrl_out")
402376   {
403377   }
404378
405379   required_device<i80186_cpu_device> m_maincpu;
406380   required_device<msm5205_device> m_msm;
407381   required_device<ay8910_device> m_ay8910;
408   required_device<scsicb_device> m_scsibus;
382   required_device<SCSI_PORT_DEVICE> m_scsibus;
409383   required_device<ram_device> m_ram;
410384   required_device<er59256_device> m_eeprom;
411385   required_device<via6522_device> m_via;
412386   required_device<centronics_device> m_centronics;
413387   required_device<palette_device> m_palette;
388   required_device<output_latch_device> m_scsi_data_out;
389   required_device<input_buffer_device> m_scsi_data_in;
390   required_device<output_latch_device> m_scsi_ctrl_out;
414391
415392   UINT32 m_debug_machine;
416393//  i186_state m_i186;
r29633r29634
476453   DECLARE_WRITE8_MEMBER(nimbus_via_write_portb);
477454   DECLARE_WRITE_LINE_MEMBER(nimbus_via_irq_w);
478455   DECLARE_WRITE_LINE_MEMBER(nimbus_ack_w);
479   DECLARE_WRITE_LINE_MEMBER(nimbus_scsi_bsy_w);
480   DECLARE_WRITE_LINE_MEMBER(nimbus_scsi_cd_w);
481   DECLARE_WRITE_LINE_MEMBER(nimbus_scsi_io_w);
482   DECLARE_WRITE_LINE_MEMBER(nimbus_scsi_msg_w);
483   DECLARE_WRITE_LINE_MEMBER(nimbus_scsi_req_w);
456   DECLARE_WRITE_LINE_MEMBER(write_scsi_bsy);
457   DECLARE_WRITE_LINE_MEMBER(write_scsi_cd);
458   DECLARE_WRITE_LINE_MEMBER(write_scsi_io);
459   DECLARE_WRITE_LINE_MEMBER(write_scsi_msg);
460   DECLARE_WRITE_LINE_MEMBER(write_scsi_req);
484461   DECLARE_WRITE_LINE_MEMBER(nimbus_msm5205_vck);
462   DECLARE_WRITE_LINE_MEMBER(write_scsi_iena);
485463
486   void nimbus_scsi_linechange( UINT8 mask, UINT8 state );
487464   IRQ_CALLBACK_MEMBER(int_callback);
488465   UINT8 get_pixel(UINT16 x, UINT16 y);
489466   UINT16 read_pixel_line(UINT16 x, UINT16 y, UINT8 width);
r29633r29634
535512   void iou_reset();
536513   void rmni_sound_reset();
537514   void mouse_js_reset();
515
516   int m_scsi_iena;
517   int m_scsi_msg;
518   int m_scsi_bsy;
519   int m_scsi_io;
520   int m_scsi_cd;
521   int m_scsi_req;
538522};
branches/old_menus/src/mess/includes/bebox.h
r29633r29634
3131      : driver_device(mconfig, type, tag),
3232         m_ppc1(*this, "ppc1"),
3333         m_ppc2(*this, "ppc2"),
34         m_lsi53c810(*this, "scsi:lsi53c810"),
34         m_lsi53c810(*this, "lsi53c810"),
3535         m_dma8237_1(*this, "dma8237_1"),
3636         m_dma8237_2(*this, "dma8237_2"),
3737         m_pic8259_1(*this, "pic8259_1"),
branches/old_menus/src/mess/includes/xerox820.h
r29633r29634
1111#include "machine/com8116.h"
1212#include "machine/keyboard.h"
1313#include "machine/ram.h"
14#include "machine/scsibus.h"
15#include "machine/scsicb.h"
16#include "machine/scsihd.h"
14#include "bus/scsi/scsi.h"
15#include "bus/scsi/scsihd.h"
1716#include "machine/wd_fdc.h"
1817#include "machine/z80pio.h"
1918#include "machine/z80ctc.h"
r29633r29634
140139class xerox820ii_state : public xerox820_state
141140{
142141public:
143   xerox820ii_state(const machine_config &mconfig, device_type type, const char *tag)
144      : xerox820_state(mconfig, type, tag),
145         m_speaker(*this, "speaker"),
146         m_sasibus(*this, SASIBUS_TAG ":host")
147   { }
142   xerox820ii_state(const machine_config &mconfig, device_type type, const char *tag) :
143      xerox820_state(mconfig, type, tag),
144      m_speaker(*this, "speaker"),
145      m_sasibus(*this, SASIBUS_TAG)
146   {
147   }
148148
149149   required_device<speaker_sound_device> m_speaker;
150   required_device<scsicb_device> m_sasibus;
150   required_device<SCSI_PORT_DEVICE> m_sasibus;
151151
152152   virtual void machine_reset();
153153
r29633r29634
157157   DECLARE_WRITE8_MEMBER( lowlite_w );
158158   DECLARE_WRITE8_MEMBER( sync_w );
159159
160   DECLARE_READ8_MEMBER( rdpio_pb_r );
161160   DECLARE_WRITE8_MEMBER( rdpio_pb_w );
162161   DECLARE_WRITE_LINE_MEMBER( rdpio_pardy_w );
163162
branches/old_menus/src/mess/includes/mac.h
r29633r29634
2525#include "cpu/m68000/m68000.h"
2626
2727#define MAC_SCREEN_NAME "screen"
28#define MAC_539X_1_TAG "scsi:539x_1"
29#define MAC_539X_2_TAG "scsi:539x_2"
28#define MAC_539X_1_TAG "539x_1"
29#define MAC_539X_2_TAG "539x_2"
3030#define MACKBD_TAG "mackbd"
3131
3232// uncomment to run i8021 keyboard in orignal Mac/512(e)/Plus
r29633r29634
200200      m_ram(*this, RAM_TAG),
201201      m_539x_1(*this, MAC_539X_1_TAG),
202202      m_539x_2(*this, MAC_539X_2_TAG),
203      m_ncr5380(*this, "scsi:ncr5380"),
203      m_ncr5380(*this, "ncr5380"),
204204      m_mackbd(*this, MACKBD_TAG),
205205      m_rtc(*this,"rtc"),
206206      m_mouse0(*this, "MOUSE0"),
branches/old_menus/src/mame/drivers/konamigq.c
r29633r29634
5353#include "machine/am53cf96.h"
5454#include "machine/eepromser.h"
5555#include "machine/mb89371.h"
56#include "machine/scsibus.h"
57#include "machine/scsihd.h"
56#include "bus/scsi/scsi.h"
57#include "bus/scsi/scsihd.h"
5858#include "sound/k056800.h"
5959#include "sound/k054539.h"
6060
r29633r29634
6666      m_maincpu(*this, "maincpu"),
6767      m_soundcpu(*this, "soundcpu"),
6868      m_dasp(*this, "dasp"),
69      m_am53cf96(*this, "scsi:am53cf96"),
69      m_am53cf96(*this, "am53cf96"),
7070      m_k056800(*this, "k056800")
7171   {
7272   }
r29633r29634
135135/* Video */
136136
137137static ADDRESS_MAP_START( konamigq_map, AS_PROGRAM, 32, konamigq_state )
138   AM_RANGE(0x1f000000, 0x1f00001f) AM_DEVREADWRITE8("scsi:am53cf96", am53cf96_device, read, write, 0x00ff00ff)
138   AM_RANGE(0x1f000000, 0x1f00001f) AM_DEVREADWRITE8("am53cf96", am53cf96_device, read, write, 0x00ff00ff)
139139   AM_RANGE(0x1f100000, 0x1f10001f) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0x00ff00ff)
140140   AM_RANGE(0x1f180000, 0x1f180003) AM_WRITE16(eeprom_w, 0x0000ffff)
141141   AM_RANGE(0x1f198000, 0x1f198003) AM_WRITENOP            /* cabinet lamps? */
r29633r29634
315315   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
316316   MCFG_EEPROM_SERIAL_DATA(konamigq_def_eeprom, 128)
317317
318   MCFG_SCSIBUS_ADD("scsi")
319   MCFG_SCSIDEV_ADD("scsi:disk", SCSIHD, SCSI_ID_0)
320   MCFG_AM53CF96_ADD("scsi:am53cf96")
321   MCFG_AM53CF96_IRQ_HANDLER(DEVWRITELINE("^maincpu:irq", psxirq_device, intin10))
318   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
319   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0)
322320
321   MCFG_DEVICE_ADD("am53cf96", AM53CF96, 0)
322   MCFG_LEGACY_SCSI_PORT("scsi")
323   MCFG_AM53CF96_IRQ_HANDLER(DEVWRITELINE("maincpu:irq", psxirq_device, intin10))
324
323325   /* video hardware */
324326   MCFG_PSXGPU_ADD("maincpu", "gpu", CXD8538Q, 0x200000, XTAL_53_693175MHz)
325327
r29633r29634
433435   ROM_REGION32_LE( 0x080000, "maincpu:rom", 0 ) /* bios */
434436   ROM_LOAD( "420b03.27p",   0x0000000, 0x080000, CRC(aab391b1) SHA1(bf9dc7c0c8168c22a4be266fe6a66d3738df916b) )
435437
436   DISK_REGION( "scsi:disk:image" )
438   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":harddisk:image" )
437439   DISK_IMAGE( "420uaa04", 0, SHA1(67cb1418fc0de2a89fc61847dc9efb9f1bebb347) )
438440ROM_END
439441
branches/old_menus/src/mame/drivers/twinkle.c
r29633r29634
230230#include "cpu/psx/psx.h"
231231#include "cpu/m68000/m68000.h"
232232#include "video/psx.h"
233#include "machine/scsibus.h"
234#include "machine/scsicd.h"
233#include "bus/scsi/scsi.h"
234#include "bus/scsi/scsicd.h"
235235#include "machine/am53cf96.h"
236236#include "machine/rtc65271.h"
237237#include "machine/i2cmem.h"
r29633r29634
246246public:
247247   twinkle_state(const machine_config &mconfig, device_type type, const char *tag)
248248      : driver_device(mconfig, type, tag),
249      m_am53cf96(*this, "scsi:am53cf96"),
249      m_am53cf96(*this, "am53cf96"),
250250      m_maincpu(*this, "maincpu"),
251251      m_audiocpu(*this, "audiocpu")
252252   {
r29633r29634
673673
674674static ADDRESS_MAP_START( main_map, AS_PROGRAM, 32, twinkle_state )
675675   AM_RANGE(0x1f000000, 0x1f0007ff) AM_READWRITE8(shared_psx_r, shared_psx_w, 0x00ff00ff)
676   AM_RANGE(0x1f200000, 0x1f20001f) AM_DEVREADWRITE8("scsi:am53cf96", am53cf96_device, read, write, 0x00ff00ff)
676   AM_RANGE(0x1f200000, 0x1f20001f) AM_DEVREADWRITE8("am53cf96", am53cf96_device, read, write, 0x00ff00ff)
677677   AM_RANGE(0x1f20a01c, 0x1f20a01f) AM_WRITENOP /* scsi? */
678678   AM_RANGE(0x1f210400, 0x1f2107ff) AM_READNOP
679679   AM_RANGE(0x1f218000, 0x1f218003) AM_WRITE8(watchdog_reset_w, 0x000000ff) /* LTC1232 */
r29633r29634
855855}
856856
857857
858static MACHINE_CONFIG_FRAGMENT( cdrom_config )
859   MCFG_DEVICE_MODIFY( "cdda" )
860   MCFG_SOUND_ROUTE( 0, "^^^^speakerleft", 1.0 )
861   MCFG_SOUND_ROUTE( 1, "^^^^speakerright", 1.0 )
862MACHINE_CONFIG_END
863
858864static MACHINE_CONFIG_START( twinkle, twinkle_state )
859865   /* basic machine hardware */
860866   MCFG_CPU_ADD( "maincpu", CXD8530CQ, XTAL_67_7376MHz )
r29633r29634
871877
872878   MCFG_WATCHDOG_TIME_INIT(attotime::from_msec(1200)) /* check TD pin on LTC1232 */
873879
874   MCFG_SCSIBUS_ADD("scsi")
875   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_4)
876   MCFG_AM53CF96_ADD("scsi:am53cf96")
877   MCFG_AM53CF96_IRQ_HANDLER(DEVWRITELINE("^maincpu:irq", psxirq_device, intin10))
880   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
881   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "cdrom", SCSICD, SCSI_ID_4)
882   MCFG_SLOT_OPTION_MACHINE_CONFIG("cdrom", cdrom_config)
878883
884   MCFG_DEVICE_ADD("am53cf96", AM53CF96, 0)
885   MCFG_LEGACY_SCSI_PORT("scsi")
886   MCFG_AM53CF96_IRQ_HANDLER(DEVWRITELINE("maincpu:irq", psxirq_device, intin10))
887
879888   MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, true)
880889   MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(twinkle_state, ide_interrupt))
881890
r29633r29634
894903   MCFG_RF5C400_ADD("rfsnd", 32000000/2)
895904   MCFG_SOUND_ROUTE(0, "speakerleft", 1.0)
896905   MCFG_SOUND_ROUTE(1, "speakerright", 1.0)
897
898   MCFG_SOUND_MODIFY( "scsi:cdrom:cdda" )
899   MCFG_SOUND_ROUTE( 0, "^^^speakerleft", 1.0 )
900   MCFG_SOUND_ROUTE( 1, "^^^speakerright", 1.0 )
901906MACHINE_CONFIG_END
902907
903908static MACHINE_CONFIG_DERIVED( twinklex, twinkle )
r29633r29634
10011006   ROM_REGION( 0x224, "security", 0 )
10021007   ROM_LOAD( "863a02", 0x000000, 0x000224, BAD_DUMP CRC(7b2a429b) SHA1(f710d19c7b900a58584c07ab8fd3ab7b9f0121d7) )
10031008
1004   DISK_REGION( "scsi:cdrom" ) // program
1009   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" ) // program
10051010   DISK_IMAGE_READONLY( "gq863-jab01", 0, SHA1(331f80b40ed560c7e017621b7daeeb8275d92b9a) )
10061011
10071012   DISK_REGION( "cdrom1" ) // video CD
r29633r29634
10171022   ROM_REGION( 0x224, "security", 0 )
10181023   ROM_LOAD( "863a02", 0x000000, 0x000224, BAD_DUMP CRC(7b2a429b) SHA1(f710d19c7b900a58584c07ab8fd3ab7b9f0121d7) )
10191024
1020   DISK_REGION( "scsi:cdrom" ) // program
1025   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" ) // program
10211026   DISK_IMAGE_READONLY( "gq863a01", 0, SHA1(07fc467f6500504729becbaf77dabc093a134e65) )
10221027
10231028   DISK_REGION( "cdrom1" ) // video CD
r29633r29634
10331038   ROM_REGION( 0x100, "security", 0 )
10341039   ROM_LOAD( "985a02", 0x000000, 0x000100, BAD_DUMP CRC(a35143a9) SHA1(1c0feeab60d9dc50dc4b9a2f3dac73ca619e74b0) )
10351040
1036   DISK_REGION( "scsi:cdrom" )
1041   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
10371042   DISK_IMAGE_READONLY( "gc985a01", 0, SHA1(0b783f11317f64552ebf3323459139529e7f315f) )
10381043
10391044   DISK_REGION( "cdrom1" ) // video CD
r29633r29634
10491054   ROM_REGION( 0x100, "security", 0 )
10501055   ROM_LOAD( "992a02", 0x000000, 0x000100, BAD_DUMP CRC(51f24913) SHA1(574b555e3d0c234011198d218d7ae5e95091acb1) )
10511056
1052   DISK_REGION( "scsi:cdrom" )
1057   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
10531058   DISK_IMAGE_READONLY( "gc992-jac01", 0, NO_DUMP )
10541059
10551060   DISK_REGION( "cdrom1" ) // video CD
r29633r29634
10651070   ROM_REGION( 0x100, "security", 0 )
10661071   ROM_LOAD( "992a02", 0x000000, 0x000100, BAD_DUMP CRC(51f24913) SHA1(574b555e3d0c234011198d218d7ae5e95091acb1) )
10671072
1068   DISK_REGION( "scsi:cdrom" )
1073   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
10691074   DISK_IMAGE_READONLY( "gc992-jaa01", 0, BAD_DUMP SHA1(7e5389735dff379bb286ba3744edf59b7dfcc74b) )
10701075
10711076   DISK_REGION( "cdrom1" ) // video CD
r29633r29634
10811086   ROM_REGION( 0x100, "security", 0 )
10821087   ROM_LOAD( "a03", 0x000000, 0x000100, BAD_DUMP CRC(8860cfb6) SHA1(85a5b27f24d4baa7960e692b91c0cf3dc5388e72) )
10831088
1084   DISK_REGION( "scsi:cdrom" )
1089   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
10851090   DISK_IMAGE_READONLY( "a03jaa01", 0, SHA1(f54fc778c2187ccd950402a159babef956b71492   ) )
10861091
10871092   DISK_REGION( "cdrom1" ) // video CD
r29633r29634
10971102   ROM_REGION( 0x100, "security", 0 )
10981103   ROM_LOAD( "a17", 0x000000, 0x000100, BAD_DUMP CRC(9428afb0) SHA1(ba907d3361256b022583d6a42fe223e90590e3c6) )
10991104
1100   DISK_REGION( "scsi:cdrom" )
1105   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
11011106   DISK_IMAGE_READONLY( "a17jaa01", 0, BAD_DUMP SHA1(9f552eaa0acbdbddf93cabe99f8f829afbf29e02) )
11021107
11031108   DISK_REGION( "cdrom1" ) // video CD
r29633r29634
11131118   ROM_REGION( 0x100, "security", 0 )
11141119   ROM_LOAD( "b4u", 0x000000, 0x000100, BAD_DUMP CRC(0ab15633) SHA1(df004ff41f35b16089f69808ccf53a5e5cc13ac3) )
11151120
1116   DISK_REGION( "scsi:cdrom" )
1121   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
11171122   DISK_IMAGE_READONLY( "b4ujab01", 0, NO_DUMP )
11181123
11191124   DISK_REGION( "cdrom1" ) // DVD
r29633r29634
11291134   ROM_REGION( 0x100, "security", 0 )
11301135   ROM_LOAD( "b4u", 0x000000, 0x000100, BAD_DUMP CRC(0ab15633) SHA1(df004ff41f35b16089f69808ccf53a5e5cc13ac3) )
11311136
1132   DISK_REGION( "scsi:cdrom" )
1137   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
11331138   DISK_IMAGE_READONLY( "b4ujaa01", 0, BAD_DUMP SHA1(d8f5d56b8728bea761dc4cdbc04851094d276bd6) )
11341139
11351140   DISK_REGION( "cdrom1" ) // DVD
r29633r29634
11451150   ROM_REGION( 0x100, "security", 0 )
11461151   ROM_LOAD( "b44", 0x000000, 0x000100, BAD_DUMP CRC(5baf4761) SHA1(aa7e07eb2cada03b85bdf11ac6a3de65f4253eef) )
11471152
1148   DISK_REGION( "scsi:cdrom" )
1153   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
11491154   DISK_IMAGE_READONLY( "b44jaa01", 0, SHA1(57fb0312d8102e959658e48a97e46aa16e592b60) )
11501155
11511156   DISK_REGION( "cdrom1" ) // DVD
r29633r29634
11611166   ROM_REGION( 0x100, "security", 0 )
11621167   ROM_LOAD( "c44", 0x000000, 0x000100, BAD_DUMP CRC(04c22349) SHA1(d1cb78911cb1ca660d393a81ed3ed07b24c51525) )
11631168
1164   DISK_REGION( "scsi:cdrom" )
1169   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
11651170   DISK_IMAGE_READONLY( "c44jaa01", 0, BAD_DUMP SHA1(8b544c81bc56b19e4aa1649e68824811d6d51ce5) )
11661171
11671172   DISK_REGION( "cdrom1" ) // DVD
r29633r29634
11771182   ROM_REGION( 0x224, "security", 0 )
11781183   ROM_LOAD( "896a02", 0x000000, 0x000224, BAD_DUMP CRC(7b2a429b) SHA1(f710d19c7b900a58584c07ab8fd3ab7b9f0121d7) )
11791184
1180   DISK_REGION( "scsi:cdrom" )
1185   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
11811186   DISK_IMAGE_READONLY( "896jabbm", 0, BAD_DUMP SHA1(117ae4c876207bbaf9e8fe0fdf5bb161155c1bdb) )
11821187
11831188   DISK_REGION( "cdrom1" ) // video CD
r29633r29634
11931198   ROM_REGION( 0x224, "security", 0 )
11941199   ROM_LOAD( "896a02", 0x000000, 0x000224, BAD_DUMP CRC(7b2a429b) SHA1(f710d19c7b900a58584c07ab8fd3ab7b9f0121d7) )
11951200
1196   DISK_REGION( "scsi:cdrom" )
1201   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
11971202   DISK_IMAGE_READONLY( "896jaabm", 0, SHA1(ea7205f86543d9273efcc226666ab530c32b23c1) )
11981203
11991204   DISK_REGION( "cdrom1" ) // video CD
r29633r29634
12091214   ROM_REGION( 0x224, "security", 0 )
12101215   ROM_LOAD( "983a02", 0x000000, 0x000224, NO_DUMP )
12111216
1212   DISK_REGION( "scsi:cdrom" )
1217   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
12131218   DISK_IMAGE_READONLY( "gc983a01", 0, NO_DUMP )
12141219
12151220   DISK_REGION( "cdrom1" ) // video CD
r29633r29634
12251230   ROM_REGION( 0x224, "security", 0 )
12261231   ROM_LOAD( "984a02", 0x000000, 0x000224, BAD_DUMP CRC(5b08e1ef) SHA1(d43ad5d958313ccb2420246621d9180230b4782d) )
12271232
1228   DISK_REGION( "scsi:cdrom" )
1233   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
12291234   DISK_IMAGE_READONLY( "ge984a01(bm)", 0, SHA1(03b083ba09652dfab6f328000c3c9de2a7a4e618) )
12301235
12311236   DISK_REGION( "cdrom1" ) // video CD
branches/old_menus/src/mame/drivers/cps1.c
r29633r29634
57305730ROM_END
57315731
57325732/* B-Board 89624B-3 */
5733ROM_START( nemoa )
5733ROM_START( nemor1 )
57345734   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
5735   ROM_LOAD16_BYTE( "nme_30.11f",    0x00000, 0x20000, CRC(71b333db) SHA1(8bd8b62d8fef2ad9d2788ccf46e89da953e5817c) )
5736   ROM_LOAD16_BYTE( "nme_35.11h",    0x00001, 0x20000, CRC(d153bc18) SHA1(2b4a9a50081d403a6485b7311e179a31b659b74d) )
5737   ROM_LOAD16_BYTE( "nme_31.12f",    0x40000, 0x20000, CRC(7e83dbd2) SHA1(d4c7e3786faab4dd9ded3c1a8f6fea114d423e64) )
5738   ROM_LOAD16_BYTE( "nme_36.12h",    0x40001, 0x20000, CRC(6aeeec81) SHA1(d7dce52d0f2225d844d852d2c3e81a48cb53a43d) )
5735   ROM_LOAD16_BYTE( "nme_30.11f",     0x00000, 0x20000, CRC(71b333db) SHA1(8bd8b62d8fef2ad9d2788ccf46e89da953e5817c) )
5736   ROM_LOAD16_BYTE( "nme_35.11h",     0x00001, 0x20000, CRC(d153bc18) SHA1(2b4a9a50081d403a6485b7311e179a31b659b74d) )
5737   ROM_LOAD16_BYTE( "nme_31.12f",     0x40000, 0x20000, CRC(7e83dbd2) SHA1(d4c7e3786faab4dd9ded3c1a8f6fea114d423e64) )
5738   ROM_LOAD16_BYTE( "nme_36.12h",     0x40001, 0x20000, CRC(6aeeec81) SHA1(d7dce52d0f2225d844d852d2c3e81a48cb53a43d) )
57395739   ROM_LOAD16_WORD_SWAP( "nm-32m.8h", 0x80000, 0x80000, CRC(d6d1add3) SHA1(61c3013d322dbb7622cca032adcd020ba318e885) )
57405740
57415741   ROM_REGION( 0x200000, "gfx", 0 )
r29633r29634
57605760   ROM_LOAD( "sou1",         0x0000, 0x0117, CRC(84f4b2fe) SHA1(dcc9e86cc36316fe42eace02d6df75d08bc8bb6d) )
57615761
57625762   ROM_REGION( 0x0200, "bboardplds", 0 )
5763   ROM_LOAD( "nm24b.1a",     0x0000, 0x0117, CRC(7b25bac6) SHA1(fa0083c59c8d6da07798cb3a4fc25d388065b7cd) ) // no markings visible, assumed to be the same
5763   ROM_LOAD( "nm24b.1a",     0x0000, 0x0117, CRC(7b25bac6) SHA1(fa0083c59c8d6da07798cb3a4fc25d388065b7cd) )
57645764   ROM_LOAD( "iob1.11e",     0x0000, 0x0117, CRC(3abc0700) SHA1(973043aa46ec6d5d1db20dc9d5937005a0f9f6ae) )
57655765ROM_END
57665766
5767
57685767/* B-Board 89625B-? */
57695768ROM_START( nemoj )
57705769   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
r29633r29634
1150211501GAME( 1990, cawingu,     cawing,   cps1_10MHz, cawing,   cps_state,   cps1,     ROT0,   "Capcom", "Carrier Air Wing (USA 901012)", GAME_SUPPORTS_SAVE )
1150311502GAME( 1990, cawingj,     cawing,   cps1_10MHz, cawing,   cps_state,   cps1,     ROT0,   "Capcom", "U.S. Navy (Japan 901012)", GAME_SUPPORTS_SAVE )
1150411503GAME( 1990, nemo,        0,        cps1_10MHz, nemo,     cps_state,   cps1,     ROT0,   "Capcom", "Nemo (World 901130)", GAME_SUPPORTS_SAVE )   // "ETC"
11505GAME( 1990, nemoa,       nemo,     cps1_10MHz, nemo,     cps_state,   cps1,     ROT0,   "Capcom", "Nemo (World 901109)", GAME_SUPPORTS_SAVE )   // "ETC"
11504GAME( 1990, nemor1,      nemo,     cps1_10MHz, nemo,     cps_state,   cps1,     ROT0,   "Capcom", "Nemo (World 901109)", GAME_SUPPORTS_SAVE )   // "ETC"
1150611505GAME( 1990, nemoj,       nemo,     cps1_10MHz, nemo,     cps_state,   cps1,     ROT0,   "Capcom", "Nemo (Japan 901120)", GAME_SUPPORTS_SAVE )
1150711506GAME( 1991, sf2,         0,        cps1_10MHz, sf2,      cps_state,   cps1,     ROT0,   "Capcom", "Street Fighter II: The World Warrior (World 910522)", GAME_SUPPORTS_SAVE )   // "ETC"
1150811507GAME( 1991, sf2eb,       sf2,      cps1_10MHz, sf2,      cps_state,   cps1,     ROT0,   "Capcom", "Street Fighter II: The World Warrior (World 910214)", GAME_SUPPORTS_SAVE )   // "ETC"
branches/old_menus/src/mame/drivers/zr107.c
r29633r29634
191191      m_k056800(*this, "k056800"),
192192      m_k056832(*this, "k056832"),
193193      m_workram(*this, "workram"),
194      m_in0(*this, "IN0"),
195      m_in1(*this, "IN1"),
196      m_in2(*this, "IN2"),
197      m_in3(*this, "IN3"),
198      m_in4(*this, "IN4"),
199      m_out4(*this, "OUT4"),
200      m_eepromout(*this, "EEPROMOUT"),
201      m_analog1(*this, "ANALOG1"),
202      m_analog2(*this, "ANALOG2"),
203      m_analog3(*this, "ANALOG3"),
194204      m_palette(*this, "palette") { }
195205
196206   required_device<cpu_device> m_maincpu;
r29633r29634
200210   required_device<k056800_device> m_k056800;
201211   optional_device<k056832_device> m_k056832;
202212   optional_shared_ptr<UINT32> m_workram;
213   required_ioport m_in0, m_in1, m_in2, m_in3, m_in4, m_out4, m_eepromout, m_analog1, m_analog2, m_analog3;
203214   required_device<palette_device> m_palette;
204215
205216   UINT32 *m_sharc_dataram;
r29633r29634
229240   UINT32 screen_update_jetwave(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
230241   INTERRUPT_GEN_MEMBER(zr107_vblank);
231242   WRITE_LINE_MEMBER(k054539_irq_gen);
243   ADC083X_INPUT_CB(adc0838_callback);
232244
233245protected:
234246   virtual void machine_start();
r29633r29634
316328READ8_MEMBER(zr107_state::sysreg_r)
317329{
318330   UINT32 r = 0;
319   static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3", "IN4" };
320331
321332   switch (offset)
322333   {
323334      case 0: /* I/O port 0 */
335         r = m_in0->read();
336         break;
324337      case 1: /* I/O port 1 */
338         r = m_in1->read();
339         break;
325340      case 2: /* I/O port 2 */
341         r = m_in2->read();
342         break;
326343      case 3: /* System Port 0 */
344         r = m_in3->read();
345         break;
327346      case 4: /* System Port 1 */
328         r = ioport(portnames[offset])->read();
347         r = m_in4->read();
329348         break;
330
331349      case 5: /* Parallel data port */
332350         break;
333351   }
r29633r29634
361379             0x02 = EEPCLK
362380             0x01 = EEPDI
363381         */
364         ioport("EEPROMOUT")->write(data & 0x07, 0xff);
382         m_eepromout->write(data & 0x07, 0xff);
365383         m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
366384         mame_printf_debug("System register 0 = %02X\n", data);
367385         break;
r29633r29634
382400         if (data & 0x40)    /* CG Board 0 IRQ Ack */
383401            m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
384402         set_cgboard_id((data >> 4) & 3);
385         ioport("OUT4")->write(data, 0xff);
403         m_out4->write(data, 0xff);
386404         mame_printf_debug("System register 1 = %02X\n", data);
387405         break;
388406
r29633r29634
675693
676694/* ADC0838 Interface */
677695
678static double adc0838_callback( device_t *device, UINT8 input )
696ADC083X_INPUT_CB(zr107_state::adc0838_callback)
679697{
680698   switch (input)
681699   {
682700   case ADC083X_CH0:
683      return (double)(5 * device->machine().root_device().ioport("ANALOG1")->read()) / 255.0;
701      return (double)(5 * m_analog1->read()) / 255.0;
684702   case ADC083X_CH1:
685      return (double)(5 * device->machine().root_device().ioport("ANALOG2")->read()) / 255.0;
703      return (double)(5 * m_analog2->read()) / 255.0;
686704   case ADC083X_CH2:
687      return (double)(5 * device->machine().root_device().ioport("ANALOG3")->read()) / 255.0;
705      return (double)(5 * m_analog3->read()) / 255.0;
688706   case ADC083X_CH3:
689707      return 0;
690708   case ADC083X_COM:
r29633r29634
791809   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
792810
793811   MCFG_DEVICE_ADD("adc0838", ADC0838, 0)
794   MCFG_ADC083X_INPUT_CALLBACK(adc0838_callback)
812   MCFG_ADC083X_INPUT_CB(zr107_state, adc0838_callback)
795813MACHINE_CONFIG_END
796814
797815
r29633r29634
855873   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
856874
857875   MCFG_DEVICE_ADD("adc0838", ADC0838, 0)
858   MCFG_ADC083X_INPUT_CALLBACK(adc0838_callback)
876   MCFG_ADC083X_INPUT_CB(zr107_state, adc0838_callback)
859877MACHINE_CONFIG_END
860878
861879/*****************************************************************************/
branches/old_menus/src/mame/drivers/cps3.c
r29633r29634
462462#include "machine/intelfsh.h"
463463#include "machine/nvram.h"
464464#include "includes/cps3.h"
465#include "machine/scsibus.h"
466#include "machine/scsicd.h"
465#include "bus/scsi/scsi.h"
466#include "bus/scsi/scsicd.h"
467467#include "machine/wd33c93.h"
468468
469469#define MASTER_CLOCK    42954500
r29633r29634
22342234   AM_RANGE(0x05100000, 0x05100003) AM_WRITE(cps3_irq12_ack_w )
22352235   AM_RANGE(0x05110000, 0x05110003) AM_WRITE(cps3_irq10_ack_w )
22362236
2237   AM_RANGE(0x05140000, 0x05140003) AM_DEVREADWRITE8("scsi:wd33c93", wd33c93_device, read, write, 0x00ff00ff )
2237   AM_RANGE(0x05140000, 0x05140003) AM_DEVREADWRITE8("wd33c93", wd33c93_device, read, write, 0x00ff00ff )
22382238
22392239   AM_RANGE(0x06000000, 0x067fffff) AM_READWRITE(cps3_flash1_r, cps3_flash1_w ) /* Flash ROMs simm 1 */
22402240   AM_RANGE(0x06800000, 0x06ffffff) AM_READWRITE(cps3_flash2_r, cps3_flash2_w ) /* Flash ROMs simm 2 */
r29633r29634
25602560   MCFG_CPU_PERIODIC_INT_DRIVER(cps3_state, cps3_other_interrupt, 80) /* ?source? */
25612561   MCFG_CPU_CONFIG(sh2_conf_cps3)
25622562
2563   MCFG_SCSIBUS_ADD("scsi")
2564   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_1)
2565   MCFG_DEVICE_ADD("scsi:wd33c93", WD33C93, 0)
2563   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
2564   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "cdrom", SCSICD, SCSI_ID_1)
25662565
2566   MCFG_DEVICE_ADD("wd33c93", WD33C93, 0)
2567   MCFG_LEGACY_SCSI_PORT("scsi")
2568
25672569   /* video hardware */
25682570   MCFG_SCREEN_ADD("screen", RASTER)
25692571   MCFG_SCREEN_RAW_PARAMS(XTAL_60MHz/8, 486, 0, 384, 259, 0, 224)
r29633r29634
26482650   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
26492651   ROM_LOAD( "redearth_euro.29f400.u2", 0x000000, 0x080000, CRC(02e0f336) SHA1(acc37e830dfeb9674f5a0fb24f4cc23217ae4ff5) )
26502652
2651   DISK_REGION( "scsi:cdrom" )
2653   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
26522654   DISK_IMAGE_READONLY( "cap-wzd-5", 0, BAD_DUMP SHA1(e5676752b08283dc4a98c3d7b759e8aa6dcd0679) )
26532655ROM_END
26542656
r29633r29634
26562658   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
26572659   ROM_LOAD( "redearth_euro.29f400.u2", 0x000000, 0x080000, CRC(02e0f336) SHA1(acc37e830dfeb9674f5a0fb24f4cc23217ae4ff5) )
26582660
2659   DISK_REGION( "scsi:cdrom" )
2661   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
26602662   DISK_IMAGE_READONLY( "cap-wzd-3", 0, SHA1(a6ff67093db6bc80ee5fc46e4300e0177b213a52) )
26612663ROM_END
26622664
r29633r29634
26642666   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
26652667   ROM_LOAD( "warzard_japan.29f400.u2", 0x000000, 0x080000, CRC(f8e2f0c6) SHA1(93d6a986f44c211fff014e55681eca4d2a2774d6) )
26662668
2667   DISK_REGION( "scsi:cdrom" )
2669   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
26682670   DISK_IMAGE_READONLY( "cap-wzd-5", 0, BAD_DUMP SHA1(e5676752b08283dc4a98c3d7b759e8aa6dcd0679) )
26692671ROM_END
26702672
r29633r29634
26722674   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
26732675   ROM_LOAD( "warzard_japan.29f400.u2", 0x000000, 0x080000, CRC(f8e2f0c6) SHA1(93d6a986f44c211fff014e55681eca4d2a2774d6) )
26742676
2675   DISK_REGION( "scsi:cdrom" )
2677   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
26762678   DISK_IMAGE_READONLY( "cap-wzd-3", 0, SHA1(a6ff67093db6bc80ee5fc46e4300e0177b213a52) )
26772679ROM_END
26782680
r29633r29634
26812683   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
26822684   ROM_LOAD( "sfiii_euro.29f400.u2", 0x000000, 0x080000, CRC(27699ddc) SHA1(d8b525cd27e584560b129598df31fd2c5b2a682a) )
26832685
2684   DISK_REGION( "scsi:cdrom" )
2686   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
26852687   DISK_IMAGE_READONLY( "cap-sf3-3", 0, BAD_DUMP SHA1(606e62cc5f46275e366e7dbb412dbaeb7e54cd0c) )
26862688ROM_END
26872689
r29633r29634
26892691   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
26902692   ROM_LOAD( "sfiii_usa_region_b1.29f400.u2", 0x000000, 0x080000, CRC(fb172a8e) SHA1(48ebf59910f246835f7dc0c588da30f7a908072f) )
26912693
2692   DISK_REGION( "scsi:cdrom" )
2694   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
26932695   DISK_IMAGE_READONLY( "cap-sf3-3", 0, BAD_DUMP SHA1(606e62cc5f46275e366e7dbb412dbaeb7e54cd0c) )
26942696ROM_END
26952697
r29633r29634
26972699   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
26982700   ROM_LOAD( "sfiii_asia_region_bd.29f400.u2", 0x000000, 0x080000,  CRC(cbd28de7) SHA1(9c15ecb73b9587d20850e62e8683930a45caa01b) )
26992701
2700   DISK_REGION( "scsi:cdrom" )
2702   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27012703   DISK_IMAGE_READONLY( "cap-sf3-3", 0, BAD_DUMP SHA1(606e62cc5f46275e366e7dbb412dbaeb7e54cd0c) )
27022704ROM_END
27032705
r29633r29634
27052707   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27062708   ROM_LOAD( "sfiii_japan.29f400.u2", 0x000000, 0x080000, CRC(74205250) SHA1(c3e83ace7121d32da729162662ec6b5285a31211) )
27072709
2708   DISK_REGION( "scsi:cdrom" )
2710   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27092711   DISK_IMAGE_READONLY( "cap-sf3-3", 0, BAD_DUMP SHA1(606e62cc5f46275e366e7dbb412dbaeb7e54cd0c) )
27102712ROM_END
27112713
r29633r29634
27132715   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27142716   ROM_LOAD( "sfiii_hispanic.29f400.u2", 0x000000, 0x080000, CRC(d2b3cd48) SHA1(00ebb270c24a66515c97e35331de54ff5358000e) )
27152717
2716   DISK_REGION( "scsi:cdrom" )
2718   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27172719   DISK_IMAGE_READONLY( "cap-sf3-3", 0, BAD_DUMP SHA1(606e62cc5f46275e366e7dbb412dbaeb7e54cd0c) )
27182720ROM_END
27192721
r29633r29634
27222724   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27232725   ROM_LOAD( "sfiii2_usa.29f400.u2", 0x000000, 0x080000, CRC(75dd72e0) SHA1(5a12d6ea6734df5de00ecee6f9ef470749d2f242) )
27242726
2725   DISK_REGION( "scsi:cdrom" )
2727   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27262728   DISK_IMAGE_READONLY( "cap-3ga000", 0, BAD_DUMP SHA1(4e162885b0b3265a56e0265037bcf247e820f027) )
27272729ROM_END
27282730
r29633r29634
27302732   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27312733   ROM_LOAD( "sfiii2_japan.29f400.u2", 0x000000, 0x080000, CRC(faea0a3e) SHA1(a03cd63bcf52e4d57f7a598c8bc8e243694624ec) )
27322734
2733   DISK_REGION( "scsi:cdrom" )
2735   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27342736   DISK_IMAGE_READONLY( "cap-3ga000", 0, BAD_DUMP SHA1(4e162885b0b3265a56e0265037bcf247e820f027) )
27352737ROM_END
27362738
r29633r29634
27392741   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27402742   ROM_LOAD( "jojo_usa.29f400.u2", 0x000000, 0x080000, CRC(8d40f7be) SHA1(2a4bd83db2f959c33b071e517941aa55a0f919c0) )
27412743
2742   DISK_REGION( "scsi:cdrom" )
2744   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27432745   DISK_IMAGE_READONLY( "cap-jjk-3", 0, SHA1(dc6e74b5e02e13f62cb8c4e234dd6061501e49c1) )
27442746ROM_END
27452747
r29633r29634
27472749   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27482750   ROM_LOAD( "jojo_usa.29f400.u2", 0x000000, 0x080000, CRC(8d40f7be) SHA1(2a4bd83db2f959c33b071e517941aa55a0f919c0) )
27492751
2750   DISK_REGION( "scsi:cdrom" )
2752   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27512753   DISK_IMAGE_READONLY( "cap-jjk-2", 0, BAD_DUMP SHA1(0f5c09171409213e191a607ee89ca3a91fe9c96a) )
27522754ROM_END
27532755
r29633r29634
27552757   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27562758   ROM_LOAD( "jojo_usa.29f400.u2", 0x000000, 0x080000, CRC(8d40f7be) SHA1(2a4bd83db2f959c33b071e517941aa55a0f919c0) )
27572759
2758   DISK_REGION( "scsi:cdrom" )
2760   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27592761   DISK_IMAGE_READONLY( "cap-jjk000", 0, BAD_DUMP SHA1(09869f6d8c032b527e02d815749dc8fab1289e86) )
27602762ROM_END
27612763
r29633r29634
27632765   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27642766   ROM_LOAD( "jojo_japan.29f400.u2", 0x000000, 0x080000, CRC(02778f60) SHA1(a167f9ebe030592a0cdb0c6a3c75835c6a43be4c) )
27652767
2766   DISK_REGION( "scsi:cdrom" )
2768   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27672769   DISK_IMAGE_READONLY( "cap-jjk-3", 0, SHA1(dc6e74b5e02e13f62cb8c4e234dd6061501e49c1) )
27682770ROM_END
27692771
r29633r29634
27712773   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27722774   ROM_LOAD( "jojo_japan.29f400.u2", 0x000000, 0x080000, CRC(02778f60) SHA1(a167f9ebe030592a0cdb0c6a3c75835c6a43be4c) )
27732775
2774   DISK_REGION( "scsi:cdrom" )
2776   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27752777   DISK_IMAGE_READONLY( "cap-jjk-2", 0, BAD_DUMP SHA1(0f5c09171409213e191a607ee89ca3a91fe9c96a) )
27762778ROM_END
27772779
r29633r29634
27792781   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27802782   ROM_LOAD( "jojo_japan.29f400.u2", 0x000000, 0x080000, CRC(02778f60) SHA1(a167f9ebe030592a0cdb0c6a3c75835c6a43be4c) )
27812783
2782   DISK_REGION( "scsi:cdrom" )
2784   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27832785   DISK_IMAGE_READONLY( "cap-jjk000", 0, BAD_DUMP SHA1(09869f6d8c032b527e02d815749dc8fab1289e86) )
27842786ROM_END
27852787
r29633r29634
27882790   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27892791   ROM_LOAD( "sfiii3_euro.29f400.u2", 0x000000, 0x080000, CRC(30bbf293) SHA1(f094c2eeaf4f6709060197aca371a4532346bf78) )
27902792
2791   DISK_REGION( "scsi:cdrom" )
2793   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
27922794   DISK_IMAGE_READONLY( "cap-33s-2", 0, BAD_DUMP SHA1(41b0e246db91cbfc3f8f0f62d981734feb4b4ab5) )
27932795ROM_END
27942796
r29633r29634
27962798   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
27972799   ROM_LOAD( "sfiii3_euro.29f400.u2", 0x000000, 0x080000, CRC(30bbf293) SHA1(f094c2eeaf4f6709060197aca371a4532346bf78) )
27982800
2799   DISK_REGION( "scsi:cdrom" )
2801   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
28002802   DISK_IMAGE_READONLY( "cap-33s-1", 0, BAD_DUMP SHA1(2f4a9006a31903114f9f9dc09465ae253e565c51) )
28012803ROM_END
28022804
r29633r29634
28042806   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
28052807   ROM_LOAD( "sfiii3_usa.29f400.u2", 0x000000, 0x080000, CRC(ecc545c1) SHA1(e39083820aae914fd8b80c9765129bedb745ceba) )
28062808
2807   DISK_REGION( "scsi:cdrom" )
2809   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
28082810   DISK_IMAGE_READONLY( "cap-33s-2", 0, BAD_DUMP SHA1(41b0e246db91cbfc3f8f0f62d981734feb4b4ab5) )
28092811ROM_END
28102812
r29633r29634
28122814   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
28132815   ROM_LOAD( "sfiii3_usa.29f400.u2", 0x000000, 0x080000, CRC(ecc545c1) SHA1(e39083820aae914fd8b80c9765129bedb745ceba) )
28142816
2815   DISK_REGION( "scsi:cdrom" )
2817   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
28162818   DISK_IMAGE_READONLY( "cap-33s-1", 0, BAD_DUMP SHA1(2f4a9006a31903114f9f9dc09465ae253e565c51) )
28172819ROM_END
28182820
r29633r29634
28212823   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
28222824   ROM_LOAD( "jojoba_japan.29f400.u2", 0x000000, 0x080000, CRC(3085478c) SHA1(055eab1fc42816f370a44b17fd7e87ffcb10e8b7) )
28232825
2824   DISK_REGION( "scsi:cdrom" )
2826   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
28252827   DISK_IMAGE_READONLY( "cap-jjm-1", 0, SHA1(8628d3fa555fbd5f4121082e925c1834b76c5e65) )
28262828ROM_END
28272829
r29633r29634
28292831   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
28302832   ROM_LOAD( "jojoba_japan.29f400.u2", 0x000000, 0x080000, CRC(3085478c) SHA1(055eab1fc42816f370a44b17fd7e87ffcb10e8b7) )
28312833
2832   DISK_REGION( "scsi:cdrom" )
2834   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
28332835   DISK_IMAGE_READONLY( "cap-jjm-0", 0, BAD_DUMP SHA1(0678a0baeb853dcff1d230c14f0873cc9f143d7b) )
28342836ROM_END
28352837
r29633r29634
36903692   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
36913693   ROM_LOAD( "no-battery_bios_29f400_for_hd6417095_sh2.u2", 0x000000, 0x080000, CRC(cb9bd5b0) SHA1(ea7ecb3deb69f5307a62d8f0d7d8e68d49013d07))
36923694
3693   DISK_REGION( "scsi:cdrom" )
3695   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
36943696   DISK_IMAGE_READONLY( "no-battery_multi-game_bootleg_cd_for_hd6417095_sh2", 0, SHA1(123f2fcb0f3dd3d6b859e82a51d0127e46763776) )
36953697ROM_END
36963698
r29633r29634
36983700   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
36993701   ROM_LOAD( "no-battery_bios_29f400_for_hd6417095_sh2.u2", 0x000000, 0x080000, CRC(cb9bd5b0) SHA1(ea7ecb3deb69f5307a62d8f0d7d8e68d49013d07))
37003702
3701   DISK_REGION( "scsi:cdrom" )
3703   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
37023704   DISK_IMAGE_READONLY( "sfiii_2nd_impact_converted_for_standard_sh2_v3", 0, SHA1(8f180d159e88042a1e819cefd39eef67f5e86e3d) )
37033705ROM_END
37043706
r29633r29634
37063708   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
37073709   ROM_LOAD( "no-battery_bios_29f400_for_hd6417095_sh2.u2", 0x000000, 0x080000, CRC(cb9bd5b0) SHA1(ea7ecb3deb69f5307a62d8f0d7d8e68d49013d07))
37083710
3709   DISK_REGION( "scsi:cdrom" )
3711   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
37103712   DISK_IMAGE_READONLY( "sfiii_2nd_impact_converted_for_standard_sh2_older", 0, SHA1(8a8e4138c3bf12435933ab9d9ace510513200843) ) // v1 or v2?
37113713ROM_END
37123714
r29633r29634
37143716   ROM_REGION32_BE( 0x080000, "user1", 0 ) /* bios region */
37153717   ROM_LOAD( "no-battery_bios_29f400_for_dead_security_cart.u2", 0x000000, 0x080000, CRC(0fd56fb3) SHA1(5a8bffc07eb7da73cf4bca6718df72e471296bfd) )
37163718
3717   DISK_REGION( "scsi:cdrom" )
3719   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
37183720   DISK_IMAGE_READONLY( "no-battery_multi-game_bootleg_cd_for_dead_security_cart", 0, SHA1(4b0b673b45dac94da018576c0a7f8644653fc564) )
37193721ROM_END
37203722
branches/old_menus/src/mame/drivers/model3.c
r29633r29634
12231223   m_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::model3_sound_timer_tick),this));
12241224}
12251225
1226static void model3_init(running_machine &machine, int step)
1226void model3_state::model3_init(int step)
12271227{
1228   model3_state *state = machine.driver_data<model3_state>();
1229   state->m_step = step;
1228   m_step = step;
12301229
1231   state->m_sound_irq_enable = 0;
1232   state->m_sound_timer->adjust(attotime::never);
1230   m_sound_irq_enable = 0;
1231   m_sound_timer->adjust(attotime::never);
12331232
1234   state->membank("bank1")->set_base(state->memregion( "user1" )->base() + 0x800000 ); /* banked CROM */
1233   membank("bank1")->set_base(memregion( "user1" )->base() + 0x800000 ); /* banked CROM */
12351234
1236   state->membank("bank4")->set_base(state->memregion("samples")->base() + 0x200000);
1237   state->membank("bank5")->set_base(state->memregion("samples")->base() + 0x600000);
1235   membank("bank4")->set_base(memregion("samples")->base() + 0x200000);
1236   membank("bank5")->set_base(memregion("samples")->base() + 0x600000);
12381237
12391238   // copy the 68k vector table into RAM
1240   memcpy(state->m_soundram, state->memregion("audiocpu")->base()+0x80000, 16);
1241   machine.device("audiocpu")->reset();
1239   memcpy(m_soundram, memregion("audiocpu")->base()+0x80000, 16);
1240   machine().device("audiocpu")->reset();
12421241
1243   model3_machine_init(machine, step); // step 1.5
1244   model3_tap_reset(machine);
1242   m_m3_step = step; // step = BCD hardware rev.  0x10 for 1.0, 0x15 for 1.5, 0x20 for 2.0, etc.
1243   tap_reset();
12451244
1246   if(step < 0x20) {
1247      if( core_stricmp(machine.system().name, "vs215") == 0 ||
1248         core_stricmp(machine.system().name, "vs29815") == 0 ||
1249         core_stricmp(machine.system().name, "bass") == 0 )
1245   if (step < 0x20) {
1246      if( core_stricmp(machine().system().name, "vs215") == 0 ||
1247         core_stricmp(machine().system().name, "vs29815") == 0 ||
1248         core_stricmp(machine().system().name, "bass") == 0 )
12501249      {
1251         mpc106_init(machine);
1250         mpc106_init(machine());
12521251      }
12531252      else
12541253      {
1255         mpc105_init(machine);
1254         mpc105_init(machine());
12561255      }
1257      state->m_real3d_device_id = 0x16c311db; /* PCI Vendor ID (11db = SEGA), Device ID (16c3 = 315-5827) */
1256      m_real3d_device_id = 0x16c311db; /* PCI Vendor ID (11db = SEGA), Device ID (16c3 = 315-5827) */
12581257   }
12591258   else {
1260      mpc106_init(machine);
1259      mpc106_init(machine());
12611260      // some step 2+ games need the older PCI ID (obvious symptom:
12621261      // vbl is enabled briefly then disabled so the game hangs)
1263      if (core_stricmp(machine.system().name, "magtruck") == 0 ||
1264         core_stricmp(machine.system().name, "von254g") == 0)
1262      if (core_stricmp(machine().system().name, "magtruck") == 0 ||
1263         core_stricmp(machine().system().name, "von254g") == 0)
12651264      {
1266         state->m_real3d_device_id = 0x16c311db; /* PCI Vendor ID (11db = SEGA), Device ID (16c3 = 315-5827) */
1265         m_real3d_device_id = 0x16c311db; /* PCI Vendor ID (11db = SEGA), Device ID (16c3 = 315-5827) */
12671266      }
12681267      else
12691268      {
1270         state->m_real3d_device_id = 0x178611db; /* PCI Vendor ID (11db = SEGA), Device ID (1786 = 315-6022) */
1269         m_real3d_device_id = 0x178611db; /* PCI Vendor ID (11db = SEGA), Device ID (1786 = 315-6022) */
12711270      }
12721271   }
12731272}
12741273
1275MACHINE_RESET_MEMBER(model3_state,model3_10){ model3_init(machine(), 0x10); }
1276MACHINE_RESET_MEMBER(model3_state,model3_15){ model3_init(machine(), 0x15); }
1277MACHINE_RESET_MEMBER(model3_state,model3_20){ model3_init(machine(), 0x20); }
1278MACHINE_RESET_MEMBER(model3_state,model3_21){ model3_init(machine(), 0x21); }
1274MACHINE_RESET_MEMBER(model3_state,model3_10){ model3_init(0x10); }
1275MACHINE_RESET_MEMBER(model3_state,model3_15){ model3_init(0x15); }
1276MACHINE_RESET_MEMBER(model3_state,model3_20){ model3_init(0x20); }
1277MACHINE_RESET_MEMBER(model3_state,model3_21){ model3_init(0x21); }
12791278
12801279
12811280READ64_MEMBER(model3_state::model3_ctrl_r)
r29633r29634
14661465      case 0x10/8:
14671466         if (ACCESSING_BITS_56_63)
14681467         {
1469            UINT64 res = model3_tap_read(machine());
1468            UINT64 res = tap_read();
14701469
14711470            return res<<61;
14721471         }
r29633r29634
15451544         if (ACCESSING_BITS_24_31)
15461545         {
15471546            data >>= 24;
1548            model3_tap_write(machine(),
1549               (data >> 6) & 1,// TCK
1547            tap_write((data >> 6) & 1,// TCK
15501548               (data >> 2) & 1,// TMS
15511549               (data >> 5) & 1,// TDI
15521550               (data >> 7) & 1 // TRST
r29633r29634
54385436   MCFG_SOUND_ROUTE(0, "lspeaker", 2.0)
54395437   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
54405438
5441   MCFG_SCSIBUS_ADD("scsi")
5442   MCFG_DEVICE_ADD("scsi:lsi53c810", LSI53C810, 0)
5439   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
5440
5441   MCFG_DEVICE_ADD("lsi53c810", LSI53C810, 0)
54435442   MCFG_LSI53C810_IRQ_CB(model3_state, scsi_irq_callback)
54445443   MCFG_LSI53C810_DMA_CB(model3_state, real3d_dma_callback)
54455444   MCFG_LSI53C810_FETCH_CB(model3_state, scsi_fetch)
5445   MCFG_LEGACY_SCSI_PORT("scsi")
54465446MACHINE_CONFIG_END
54475447
54485448static MACHINE_CONFIG_START( model3_15, model3_state )
r29633r29634
54815481   MCFG_SOUND_ROUTE(0, "lspeaker", 2.0)
54825482   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
54835483
5484   MCFG_SCSIBUS_ADD("scsi")
5485   MCFG_DEVICE_ADD("scsi:lsi53c810", LSI53C810, 0)
5484   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
5485
5486   MCFG_DEVICE_ADD("lsi53c810", LSI53C810, 0)
54865487   MCFG_LSI53C810_IRQ_CB(model3_state, scsi_irq_callback)
54875488   MCFG_LSI53C810_DMA_CB(model3_state, real3d_dma_callback)
54885489   MCFG_LSI53C810_FETCH_CB(model3_state, scsi_fetch)
5490   MCFG_LEGACY_SCSI_PORT("scsi")
54895491MACHINE_CONFIG_END
54905492
54915493static MACHINE_CONFIG_DERIVED(scud, model3_15)
branches/old_menus/src/mame/drivers/ksys573.c
r29633r29634
451451   DECLARE_WRITE8_MEMBER( dmx_output_callback );
452452   DECLARE_WRITE8_MEMBER( mamboagg_output_callback );
453453   DECLARE_WRITE8_MEMBER( punchmania_output_callback );
454   ADC083X_INPUT_CB(analogue_inputs_callback);
454455
455456   void cdrom_dma_read( UINT32 *ram, UINT32 n_address, INT32 n_size );
456457   void cdrom_dma_write( UINT32 *ram, UINT32 n_address, INT32 n_size );
r29633r29634
16801681/* punch mania */
16811682
16821683
1683static double punchmania_inputs_callback( device_t *device, UINT8 input )
1684ADC083X_INPUT_CB(konami573_cassette_xi_device::punchmania_inputs_callback)
16841685{
1685   ksys573_state *state = device->machine().driver_data<ksys573_state>();
1686
1686   ksys573_state *state = machine().driver_data<ksys573_state>();
16871687   double *pad_position = state->m_pad_position;
16881688   int pads = state->m_pads->read();
16891689   for( int i = 0; i < 6; i++ )
r29633r29634
17191719
17201720static MACHINE_CONFIG_FRAGMENT( punchmania_cassette_install )
17211721   MCFG_DEVICE_MODIFY( "adc0838" )
1722   MCFG_ADC083X_INPUT_CALLBACK( punchmania_inputs_callback )
1722   MCFG_ADC083X_INPUT_CB( konami573_cassette_xi_device, punchmania_inputs_callback )
17231723MACHINE_CONFIG_END
17241724
17251725
r29633r29634
19871987
19881988/* ADC0834 Interface */
19891989
1990static double analogue_inputs_callback( device_t *device, UINT8 input )
1990ADC083X_INPUT_CB(ksys573_state::analogue_inputs_callback)
19911991{
1992   ksys573_state *state = device->machine().driver_data<ksys573_state>();
1993
19941992   switch( input )
19951993   {
19961994   case ADC083X_CH0:
1997      return (double)( 5 * state->m_analog0->read() ) / 255.0;
1995      return (double)( 5 * m_analog0->read() ) / 255.0;
19981996   case ADC083X_CH1:
1999      return (double)( 5 * state->m_analog1->read() ) / 255.0;
1997      return (double)( 5 * m_analog1->read() ) / 255.0;
20001998   case ADC083X_CH2:
2001      return (double)( 5 * state->m_analog2->read() ) / 255.0;
1999      return (double)( 5 * m_analog2->read() ) / 255.0;
20022000   case ADC083X_CH3:
2003      return (double)( 5 * state->m_analog3->read() ) / 255.0;
2001      return (double)( 5 * m_analog3->read() ) / 255.0;
20042002   case ADC083X_AGND:
20052003      return 0;
20062004   case ADC083X_VREF:
r29633r29634
20762074   MCFG_M48T58_ADD( "m48t58" )
20772075
20782076   MCFG_DEVICE_ADD( "adc0834", ADC0834, 0 )
2079   MCFG_ADC083X_INPUT_CALLBACK( analogue_inputs_callback )
2077   MCFG_ADC083X_INPUT_CB( ksys573_state, analogue_inputs_callback )
20802078MACHINE_CONFIG_END
20812079
20822080// Variants with additional digital sound board
branches/old_menus/src/mame/drivers/namcona1.c
r29633r29634
10371037
10381038ROM_START( cgangpzlj )
10391039   ROM_REGION( 0x200000, "maincpu", 0 )
1040   ROM_LOAD16_BYTE( "cp1-ep0l.bin", 0x080001, 0x80000, CRC(2825f7ba) SHA1(5f6f8df6bdf0f45656904411cdbb31fdcf8f3be0) ) /* 0xc00000 */
1041   ROM_LOAD16_BYTE( "cp1-ep0u.bin", 0x080000, 0x80000, CRC(94d7d6fc) SHA1(2460741e0dbb2ccff28f4fbc419a7507382467d2) )
1040   ROM_LOAD16_BYTE( "cp1-ep0l.bin", 0x000001, 0x080000, CRC(2825f7ba) SHA1(5f6f8df6bdf0f45656904411cdbb31fdcf8f3be0) ) /* 0xc00000 */
1041   ROM_LOAD16_BYTE( "cp1-ep0u.bin", 0x000000, 0x080000, CRC(94d7d6fc) SHA1(2460741e0dbb2ccff28f4fbc419a7507382467d2) )
10421042
10431043   ROM_REGION16_BE( 0x800000, "maskrom", ROMREGION_ERASE00 )
10441044   /* no mask roms */
branches/old_menus/src/mame/drivers/nwk-tr.c
r29633r29634
238238      m_k056800(*this, "k056800"),
239239      m_k001604(*this, "k001604"),
240240      m_adc12138(*this, "adc12138"),
241      m_in0(*this, "IN0"),
242      m_in1(*this, "IN1"),
243      m_in2(*this, "IN2"),
244      m_dsw(*this, "DSW"),
245      m_analog1(*this, "ANALOG1"),
246      m_analog2(*this, "ANALOG2"),
247      m_analog3(*this, "ANALOG3"),
248      m_analog4(*this, "ANALOG4"),
249      m_analog5(*this, "ANALOG5"),
241250      m_palette(*this, "palette") { }
242251
243252   // TODO: Needs verification on real hardware
r29633r29634
252261   required_device<k056800_device> m_k056800;
253262   required_device<k001604_device> m_k001604;
254263   required_device<adc12138_device> m_adc12138;
264   required_ioport m_in0, m_in1, m_in2, m_dsw, m_analog1, m_analog2, m_analog3, m_analog4, m_analog5;
255265   required_device<palette_device> m_palette;
256266   emu_timer *m_sound_irq_timer;
257267   int m_fpga_uploaded;
r29633r29634
271281   DECLARE_WRITE16_MEMBER(soundtimer_en_w);
272282   DECLARE_WRITE16_MEMBER(soundtimer_count_w);
273283   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_0);
284   ADC12138_IPT_CONVERT_CB(adc12138_input_callback);
285
274286   TIMER_CALLBACK_MEMBER(sound_irq);
275287   DECLARE_DRIVER_INIT(nwktr);
276288   virtual void machine_start();
r29633r29634
282294
283295
284296
285
286
287297WRITE32_MEMBER(nwktr_state::paletteram32_w)
288298{
289299   COMBINE_DATA(&m_generic_paletteram_32[offset]);
r29633r29634
324334   {
325335      if (ACCESSING_BITS_24_31)
326336      {
327         r |= ioport("IN0")->read() << 24;
337         r |= m_in0->read() << 24;
328338      }
329339      if (ACCESSING_BITS_16_23)
330340      {
331         r |= ioport("IN1")->read() << 16;
341         r |= m_in1->read() << 16;
332342      }
333343      if (ACCESSING_BITS_8_15)
334344      {
335         r |= ioport("IN2")->read() << 8;
345         r |= m_in2->read() << 8;
336346      }
337347      if (ACCESSING_BITS_0_7)
338348      {
r29633r29634
343353   {
344354      if (ACCESSING_BITS_24_31)
345355      {
346         r |= ioport("DSW")->read() << 24;
356         r |= m_dsw->read() << 24;
347357      }
348358   }
349359   return r;
r29633r29634
689699INPUT_PORTS_END
690700
691701
692static double adc12138_input_callback( device_t *device, UINT8 input )
702ADC12138_IPT_CONVERT_CB(nwktr_state::adc12138_input_callback)
693703{
694704   int value = 0;
695705   switch (input)
696706   {
697      case 0:     value = device->machine().root_device().ioport("ANALOG1")->read(); break;
698      case 1:     value = device->machine().root_device().ioport("ANALOG2")->read(); break;
699      case 2:     value = device->machine().root_device().ioport("ANALOG3")->read(); break;
700      case 3:     value = device->machine().root_device().ioport("ANALOG4")->read(); break;
701      case 4:     value = device->machine().root_device().ioport("ANALOG5")->read(); break;
707      case 0: value = m_analog1->read(); break;
708      case 1: value = m_analog2->read(); break;
709      case 2: value = m_analog3->read(); break;
710      case 3: value = m_analog4->read(); break;
711      case 4: value = m_analog5->read(); break;
702712   }
703713
704714   return (double)(value) / 4095.0;
705715}
706716
707static const adc12138_interface nwktr_adc_interface = {
708   adc12138_input_callback
709};
710
711
712717void nwktr_state::machine_reset()
713718{
714719   m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
r29633r29634
741746   MCFG_QUANTUM_TIME(attotime::from_hz(9000))
742747
743748   MCFG_M48T58_ADD( "m48t58" )
744   MCFG_ADC12138_ADD( "adc12138", nwktr_adc_interface )
745749
750   MCFG_DEVICE_ADD("adc12138", ADC12138, 0)
751   MCFG_ADC1213X_IPT_CONVERT_CB(nwktr_state, adc12138_input_callback)
752
746753   MCFG_DEVICE_ADD("k033906_1", K033906, 0)
747754   MCFG_K033906_VOODOO("voodoo")
748755
branches/old_menus/src/mame/drivers/konamigv.c
r29633r29634
127127#include "machine/eepromser.h"
128128#include "machine/intelfsh.h"
129129#include "machine/mb89371.h"
130#include "machine/scsibus.h"
131#include "machine/scsicd.h"
130#include "bus/scsi/scsi.h"
131#include "bus/scsi/scsicd.h"
132132#include "sound/spu.h"
133133#include "sound/cdda.h"
134134
r29633r29634
137137public:
138138   konamigv_state(const machine_config &mconfig, device_type type, const char *tag)
139139      : driver_device(mconfig, type, tag),
140      m_am53cf96(*this, "scsi:am53cf96"),
140      m_am53cf96(*this, "am53cf96"),
141141      m_maincpu(*this, "maincpu")
142142   {
143143   }
r29633r29634
174174};
175175
176176static ADDRESS_MAP_START( konamigv_map, AS_PROGRAM, 32, konamigv_state )
177   AM_RANGE(0x1f000000, 0x1f00001f) AM_DEVREADWRITE8("scsi:am53cf96", am53cf96_device, read, write, 0x00ff00ff)
177   AM_RANGE(0x1f000000, 0x1f00001f) AM_DEVREADWRITE8("am53cf96", am53cf96_device, read, write, 0x00ff00ff)
178178   AM_RANGE(0x1f100000, 0x1f100003) AM_READ_PORT("P1")
179179   AM_RANGE(0x1f100004, 0x1f100007) AM_READ_PORT("P2")
180180   AM_RANGE(0x1f100008, 0x1f10000b) AM_READ_PORT("P3_P4")
r29633r29634
309309   save_item(NAME(m_btc_trackball_data));
310310}
311311
312static MACHINE_CONFIG_FRAGMENT( cdrom_config )
313   MCFG_DEVICE_MODIFY( "cdda" )
314   MCFG_SOUND_ROUTE( 0, "^^^^lspeaker", 1.0 )
315   MCFG_SOUND_ROUTE( 1, "^^^^rspeaker", 1.0 )
316MACHINE_CONFIG_END
317
312318static MACHINE_CONFIG_START( konamigv, konamigv_state )
313319   /* basic machine hardware */
314320   MCFG_CPU_ADD( "maincpu", CXD8530BQ, XTAL_67_7376MHz )
r29633r29634
323329   MCFG_DEVICE_ADD("mb89371", MB89371, 0)
324330   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
325331
326   MCFG_SCSIBUS_ADD("scsi")
327   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_4)
328   MCFG_AM53CF96_ADD("scsi:am53cf96")
329   MCFG_AM53CF96_IRQ_HANDLER(DEVWRITELINE("^maincpu:irq", psxirq_device, intin10))
332   MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
333   MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "cdrom", SCSICD, SCSI_ID_4)
334   MCFG_SLOT_OPTION_MACHINE_CONFIG("cdrom", cdrom_config)
330335
336   MCFG_DEVICE_ADD("am53cf96", AM53CF96, 0)
337   MCFG_LEGACY_SCSI_PORT("scsi")
338   MCFG_AM53CF96_IRQ_HANDLER(DEVWRITELINE("maincpu:irq", psxirq_device, intin10))
339
331340   /* video hardware */
332341   MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8514Q, 0x100000, XTAL_53_693175MHz )
333342
r29633r29634
337346   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 )
338347   MCFG_SOUND_ROUTE( 0, "lspeaker", 0.75 )
339348   MCFG_SOUND_ROUTE( 1, "rspeaker", 0.75 )
340
341   MCFG_SOUND_MODIFY( "scsi:cdrom:cdda" )
342   MCFG_SOUND_ROUTE( 0, "^^^lspeaker", 1.0 )
343   MCFG_SOUND_ROUTE( 1, "^^^rspeaker", 1.0 )
344349MACHINE_CONFIG_END
345350
346351
r29633r29634
679684   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
680685   ROM_LOAD( "lacrazyc.25c",   0x000000, 0x000080, CRC(e20e5730) SHA1(066b49236c658a4ef2930f7bacc4b2354dd7f240) )
681686
682   DISK_REGION( "scsi:cdrom" )
687   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
683688   DISK_IMAGE_READONLY( "gv027-a1", 0, BAD_DUMP SHA1(840d0d4876cf1b814c9d8db975aa6c92e1fe4039) )
684689ROM_END
685690
r29633r29634
689694   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
690695   ROM_LOAD( "susume.25c",   0x000000, 0x000080, CRC(52f17df7) SHA1(b8ad7787b0692713439d7d9bebfa0c801c806006) )
691696
692   DISK_REGION( "scsi:cdrom" )
697   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
693698   DISK_IMAGE_READONLY( "gv027j1", 0, BAD_DUMP SHA1(e7e6749ac65de7771eb8fed7d5eefaec3f902255) )
694699ROM_END
695700
r29633r29634
699704   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
700705   ROM_LOAD( "hyperath.25c", 0x000000, 0x000080, CRC(20a8c435) SHA1(a0f203a999757fba68b391c525ac4b9684a57ba9) )
701706
702   DISK_REGION( "scsi:cdrom" )
707   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
703708   DISK_IMAGE_READONLY( "gv021-j1", 0, SHA1(579442444025b18da658cd6455c51459fbc3de0e) )
704709ROM_END
705710
r29633r29634
709714   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
710715   ROM_LOAD( "powyak96.25c", 0x000000, 0x000080, CRC(405a7fc9) SHA1(e2d978f49748ba3c4a425188abcd3d272ec23907) )
711716
712   DISK_REGION( "scsi:cdrom" )
717   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
713718   DISK_IMAGE_READONLY( "powyak96", 0, BAD_DUMP SHA1(ebd0ea18ff9ce300ea1e30d66a739a96acfb0621) )
714719ROM_END
715720
r29633r29634
719724   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
720725   ROM_LOAD( "weddingr.25c", 0x000000, 0x000080, CRC(b90509a0) SHA1(41510a0ceded81dcb26a70eba97636d38d3742c3) )
721726
722   DISK_REGION( "scsi:cdrom" )
727   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
723728   DISK_IMAGE_READONLY( "weddingr", 0, BAD_DUMP SHA1(4e7122b191747ab7220fe4ce1b4483d62ab579af) )
724729ROM_END
725730
r29633r29634
729734   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
730735   ROM_LOAD( "simpbowl.25c", 0x000000, 0x000080, CRC(2c61050c) SHA1(16ae7f81cbe841c429c5c7326cf83e87db1782bf) )
731736
732   DISK_REGION( "scsi:cdrom" )
737   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
733738   DISK_IMAGE_READONLY( "simpbowl", 0, BAD_DUMP SHA1(72b32a863e6891ad3bfc1fdfe9cb90a2bd334d71) )
734739ROM_END
735740
r29633r29634
739744   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
740745   ROM_LOAD( "btchmp.25c", 0x000000, 0x000080, CRC(6d02ea54) SHA1(d3babf481fd89db3aec17f589d0d3d999a2aa6e1) )
741746
742   DISK_REGION( "scsi:cdrom" )
747   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
743748   DISK_IMAGE_READONLY( "btchamp", 0, BAD_DUMP SHA1(c9c858e9034826e1a12c3c003dd068a49a3577e1) )
744749ROM_END
745750
r29633r29634
749754   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
750755   ROM_LOAD( "kdeadeye.25c", 0x000000, 0x000080, CRC(3935d2df) SHA1(cbb855c475269077803c380dbc3621e522efe51e) )
751756
752   DISK_REGION( "scsi:cdrom" )
757   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
753758   DISK_IMAGE_READONLY( "kdeadeye", 0, BAD_DUMP SHA1(3c737c51717925be724dcb93d30769649029b8ce) )
754759ROM_END
755760
r29633r29634
759764   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
760765   ROM_LOAD( "nagano98.25c",  0x000000, 0x000080, CRC(b64b7451) SHA1(a77a37e0cc580934d1e7e05d523bae0acd2c1480) )
761766
762   DISK_REGION( "scsi:cdrom" )
767   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
763768   DISK_IMAGE_READONLY( "nagano98", 0, BAD_DUMP SHA1(1be7bd4531f249ff2233dd40a206c8d60054a8c6) )
764769ROM_END
765770
r29633r29634
769774   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
770775   ROM_LOAD( "720ja.25c",  0x000000, 0x000080, CRC(34c473ba) SHA1(768225b04a293bdbc114a092d14dee28d52044e9) )
771776
772   DISK_REGION( "scsi:cdrom" )
777   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
773778   DISK_IMAGE_READONLY( "720jaa01", 0, SHA1(437160996551ef4dfca43899d1d14beca62eb4c9) )
774779ROM_END
775780
r29633r29634
779784   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
780785   ROM_LOAD( "tmosh.25c", 0x000000, 0x000080, NO_DUMP )
781786
782   DISK_REGION( "scsi:cdrom" )
787   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
783788   DISK_IMAGE_READONLY( "673jaa01", 0, SHA1(eaa76073749f9db48c1bee3dff9bea955683c8a8) )
784789ROM_END
785790
r29633r29634
789794   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
790795   ROM_LOAD( "tmoshs.25c", 0x000000, 0x000080, CRC(e57b833f) SHA1(f18a0974a6be69dc179706643aab837ff61c2738) )
791796
792   DISK_REGION( "scsi:cdrom" )
797   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
793798   DISK_IMAGE_READONLY( "755jaa01", 0, SHA1(fc742a0b763ba38350ba7eb5d775948632aafd9d) )
794799ROM_END
795800
r29633r29634
799804   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
800805   ROM_LOAD( "tmoshsp.25c", 0x000000, 0x000080, CRC(af4cdd87) SHA1(97041e287e4c80066043967450779b81b62b2b8e) )
801806
802   DISK_REGION( "scsi:cdrom" )
807   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
803808   DISK_IMAGE_READONLY( "756jab01", 0, SHA1(b2c59b9801debccbbd986728152f314535c67e53) )
804809ROM_END
805810
r29633r29634
809814   ROM_REGION16_BE( 0x0000080, "eeprom", 0 ) /* default eeprom */
810815   ROM_LOAD( "tmoshsp.25c", 0x000000, 0x000080, CRC(af4cdd87) SHA1(97041e287e4c80066043967450779b81b62b2b8e) )
811816
812   DISK_REGION( "scsi:cdrom" )
817   DISK_REGION( "scsi:" SCSI_PORT_DEVICE1 ":cdrom" )
813818   DISK_IMAGE_READONLY( "756jaa01", 0, BAD_DUMP SHA1(5e6d349ad1a22c0dbb1ec26aa05febc830254339) ) // The CD was damaged
814819ROM_END
815820
branches/old_menus/src/mame/drivers/hornet.c
r29633r29634
341341      m_eeprom(*this, "eeprom"),
342342      m_k037122_1(*this, "k037122_1"),
343343      m_k037122_2(*this, "k037122_2" ),
344      m_adc12138(*this, "adc12138") { }
344      m_adc12138(*this, "adc12138"),
345      m_in0(*this, "IN0"),
346      m_in1(*this, "IN1"),
347      m_in2(*this, "IN2"),
348      m_dsw(*this, "DSW"),
349      m_eepromout(*this, "EEPROMOUT"),
350      m_analog1(*this, "ANALOG1"),
351      m_analog2(*this, "ANALOG2"){ }
345352
346353   // TODO: Needs verification on real hardware
347354   static const int m_sound_timer_usec = 2800;
r29633r29634
359366   optional_device<k037122_device> m_k037122_1;
360367   optional_device<k037122_device> m_k037122_2;
361368   required_device<adc12138_device> m_adc12138;
369   required_ioport m_in0, m_in1, m_in2, m_dsw, m_eepromout;
370   optional_ioport m_analog1, m_analog2;
362371
363372   emu_timer *m_sound_irq_timer;
364373   UINT8 m_led_reg0;
r29633r29634
393402   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_1);
394403   DECLARE_WRITE16_MEMBER(soundtimer_en_w);
395404   DECLARE_WRITE16_MEMBER(soundtimer_count_w);
405   ADC12138_IPT_CONVERT_CB(adc12138_input_callback);
396406
397407   DECLARE_DRIVER_INIT(hornet);
398408   DECLARE_DRIVER_INIT(hornet_2board);
r29633r29634
498508READ8_MEMBER(hornet_state::sysreg_r)
499509{
500510   UINT8 r = 0;
501   static const char *const portnames[] = { "IN0", "IN1", "IN2" };
511
502512   switch (offset)
503513   {
504514      case 0: /* I/O port 0 */
515         r = m_in0->read();
516         break;
505517      case 1: /* I/O port 1 */
518         r = m_in1->read();
519         break;
506520      case 2: /* I/O port 2 */
507         r = ioport(portnames[offset])->read();
521         r = m_in2->read();
508522         break;
509523
510524      case 3: /* I/O port 3 */
r29633r29634
522536         break;
523537
524538      case 4: /* I/O port 4 - DIP switches */
525         r = ioport("DSW")->read();
539         r = m_dsw->read();
526540         break;
527541   }
528542   return r;
r29633r29634
555569             0x02 = LAMP1
556570             0x01 = LAMP0
557571         */
558         ioport("EEPROMOUT")->write(data, 0xff);
572         m_eepromout->write(data, 0xff);
559573         mame_printf_debug("System register 0 = %02X\n", data);
560574         break;
561575
r29633r29634
932946      membank("bank5")->set_base(usr5);
933947}
934948
935static double adc12138_input_callback( device_t *device, UINT8 input )
949ADC12138_IPT_CONVERT_CB(hornet_state::adc12138_input_callback)
936950{
937951   int value = 0;
938952   switch (input)
939953   {
940      case 0: value = device->machine().root_device().ioport("ANALOG1")->read(); break;
941      case 1: value = device->machine().root_device().ioport("ANALOG2")->read(); break;
954      case 0: value = (m_analog1) ? m_analog1->read() : 0; break;
955      case 1: value = (m_analog2) ? m_analog2->read() : 0; break;
942956   }
943957
944958   return (double)(value) / 2047.0;
945959}
946960
947static const adc12138_interface hornet_adc_interface = {
948   adc12138_input_callback
949};
950
951961static const voodoo_config hornet_voodoo_intf =
952962{
953963   2, //               fbmem;
r29633r29634
10091019
10101020   MCFG_M48T58_ADD( "m48t58" )
10111021
1012   MCFG_ADC12138_ADD( "adc12138", hornet_adc_interface )
1022   MCFG_DEVICE_ADD("adc12138", ADC12138, 0)
1023   MCFG_ADC1213X_IPT_CONVERT_CB(hornet_state, adc12138_input_callback)
10131024MACHINE_CONFIG_END
10141025
10151026
branches/old_menus/src/mame/drivers/konamigx.c
r29633r29634
102102#include "sound/k056800.h"
103103#include "sound/k054539.h"
104104#include "includes/konamigx.h"
105#include "machine/adc083x.h"
106105#include "rendlay.h"
107106
108107#define GX_DEBUG     0
r29633r29634
463462        bit 0: eeprom data
464463      */
465464
466      ioport("EEPROMOUT")->write(odata, 0xff);
465      m_eepromout->write(odata, 0xff);
467466
468467      konamigx_wrport1_0 = odata;
469468   }
r29633r29634
708707
709708/* National Semiconductor ADC0834 4-channel serial ADC emulation */
710709
711static double adc0834_callback( device_t *device, UINT8 input )
710ADC083X_INPUT_CB(konamigx_state::adc0834_callback)
712711{
713712   switch (input)
714713   {
715714   case ADC083X_CH0:
716      return (double)(5 * device->machine().root_device().ioport("AN0")->read()) / 255.0; // steer
715      return (double)(5 * m_an0->read()) / 255.0; // steer
717716   case ADC083X_CH1:
718      return (double)(5 * device->machine().root_device().ioport("AN1")->read()) / 255.0; // gas
717      return (double)(5 * m_an1->read()) / 255.0; // gas
719718   case ADC083X_VREF:
720719      return 5;
721720   }
r29633r29634
725724
726725READ32_MEMBER(konamigx_state::le2_gun_H_r)
727726{
728   int p1x = ioport("LIGHT0_X")->read()*290/0xff+20;
729   int p2x = ioport("LIGHT1_X")->read()*290/0xff+20;
727   int p1x = m_light0_x->read()*290/0xff+20;
728   int p2x = m_light1_x->read()*290/0xff+20;
730729
731730   return (p1x<<16)|p2x;
732731}
733732
734733READ32_MEMBER(konamigx_state::le2_gun_V_r)
735734{
736   int p1y = ioport("LIGHT0_Y")->read()*224/0xff;
737   int p2y = ioport("LIGHT1_Y")->read()*224/0xff;
735   int p1y = m_light0_y->read()*224/0xff;
736   int p2y = m_light1_y->read()*224/0xff;
738737
739738   // make "off the bottom" reload too
740739   if (p1y >= 0xdf) p1y = 0;
r29633r29634
17001699   MCFG_CPU_PROGRAM_MAP(gx_type1_map)
17011700
17021701   MCFG_DEVICE_ADD("adc0834", ADC0834, 0)
1703   MCFG_ADC083X_INPUT_CALLBACK(adc0834_callback)
1702   MCFG_ADC083X_INPUT_CB(konamigx_state, adc0834_callback)
17041703MACHINE_CONFIG_END
17051704
17061705static MACHINE_CONFIG_DERIVED( racinfrc, konamigx )
r29633r29634
17141713   MCFG_CPU_PROGRAM_MAP(gx_type1_map)
17151714
17161715   MCFG_DEVICE_ADD("adc0834", ADC0834, 0)
1717   MCFG_ADC083X_INPUT_CALLBACK(adc0834_callback)
1716   MCFG_ADC083X_INPUT_CB(konamigx_state, adc0834_callback)
17181717MACHINE_CONFIG_END
17191718
17201719static MACHINE_CONFIG_DERIVED( gxtype3, konamigx )
branches/old_menus/src/mame/drivers/model2.c
r29633r29634
77    Hardware and protection reverse-engineering and general assistance by ElSemi.
88    MAME driver by R. Belmont, Olivier Galibert, and ElSemi.
99
10   TODO (updated as for April 2014):
11   - all Model 2B games: FIFO comms looks way wrong, and 3d is mostly missing/incomplete. Games also stalls at some point;
12   - daytona: runs at half speed in gameplay;
13   - desert: several 3d bugs, presumably down to FIFO;
14   - dynamcop: stalls at stage select screen;
15   - fvipers: enables timers, but then irq register is empty, hence it crashes with an "interrupt halt" at POST (regression);
16   - manxtt: missing 3d;
17   - motoraid: stalls after course select;
18   - pltkidsa: after few secs of gameplay, background 3d disappears and everything reports a collision against the player;
19   - skytargt: MAME hardlocks after disclaimer screen;
20   - srallyc: opponent cars flickers like wild;
21   - vcop: lightgun input is offsetted;
22   - vcop: sound dies at enter initial screen (i.e. after played the game once);
23   - vcop: priority bug at stage select screen;
24   - vcop2: no 3d;
25   - vf2: stalls after disclaimer screen;
26   - zeroguna: stalls after some seconds of gameplay;
27
1028    OK (controls may be wrong/missing/incomplete)
1129    --
1230    daytona/daytonat/daytonam
r29633r29634
337355   int tnum = (int)(FPTR)ptr;
338356   int bit = tnum + 2;
339357
358   if(m_timerrun[tnum] == 0)
359      return;
360
340361   m_timers[tnum]->reset();
341362
342363   m_intreq |= (1<<bit);
364   if(m_intena & 1<<bit)
365      m_maincpu->set_input_line(I960_IRQ2, ASSERT_LINE);
366   //printf("%08x %08x (%08x)\n",m_intreq,m_intena,1<<bit);
343367   model2_check_irq_state();
344368
345   m_timervals[tnum] = 0;
369   m_timervals[tnum] = -1;
346370   m_timerrun[tnum] = 0;
347371}
348372
r29633r29634
10051029
10061030void model2_state::model2_check_irq_state()
10071031{
1008   const int irq_type[16]= {I960_IRQ0,I960_IRQ1,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ3,I960_IRQ3};
1032   return;
10091033
1010   for(int i=0;i<16;i++)
1034   /* TODO: vf2 and fvipers hangs with an irq halt on POST, disabled for now */
1035   const int irq_type[12]= {I960_IRQ0,I960_IRQ1,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ3,I960_IRQ3};
1036
1037   for(int i=0;i<12;i++)
10111038   {
1012      if (m_intena & (1<<i) && m_intreq & 1<<i)
1039      if (m_intena & (1<<i) && m_intreq & (1<<i))
1040      {
10131041         m_maincpu->set_input_line(irq_type[i], ASSERT_LINE);
1042         return;
1043      }
10141044   }
10151045}
10161046
1047void model2_state::model2_check_irqack_state(UINT32 data)
1048{
1049   const int irq_type[12]= {I960_IRQ0,I960_IRQ1,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ3,I960_IRQ3};
1050
1051   for(int i=0;i<12;i++)
1052   {
1053      if(data & 1<<i)
1054         m_maincpu->set_input_line(irq_type[i], CLEAR_LINE);
1055   }
1056}
1057
10171058WRITE32_MEMBER(model2_state::model2_irq_w)
10181059{
10191060   m_maincpu->i960_noburst();
r29633r29634
10261067   }
10271068
10281069   m_intreq &= data;
1029   /* TODO: improve this */
1030   UINT32 irq_ack = data ^ 0xffffffff;
10311070
1032   if(irq_ack & 1<<0)
1033      m_maincpu->set_input_line(I960_IRQ0, CLEAR_LINE);
1034
1035   if(irq_ack & 1<<10)
1036      m_maincpu->set_input_line(I960_IRQ3, CLEAR_LINE);
1037
1071   model2_check_irqack_state(data ^ 0xffffffff);
10381072}
10391073
10401074/* TODO: rewrite this part. */
r29633r29634
13911425   model2_3d_set_zclip( machine(), data & 0xFF );
13921426}
13931427
1428READ32_MEMBER(model2_state::tgpid_r)
1429{
1430   popmessage("Read from TGP ID, contact MAMEdev");
1431   return 0;
1432}
1433
13941434/* common map for all Model 2 versions */
13951435static ADDRESS_MAP_START( model2_base_mem, AS_PROGRAM, 32, model2_state )
13961436   AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_WRITENOP
r29633r29634
14091449
14101450   AM_RANGE(0x00980004, 0x00980007) AM_READ(fifoctl_r)
14111451   AM_RANGE(0x0098000c, 0x0098000f) AM_READWRITE(videoctl_r,videoctl_w)
1452   AM_RANGE(0x00980030, 0x0098005f) AM_READ(tgpid_r)
14121453
14131454   AM_RANGE(0x00e80000, 0x00e80007) AM_READWRITE(model2_irq_r, model2_irq_w)
14141455
r29633r29634
19802021   if(scanline == 384)
19812022   {
19822023      m_intreq |= (1<<0);
2024      if(m_intena & 1<<0)
2025         m_maincpu->set_input_line(I960_IRQ0, ASSERT_LINE);
19832026      model2_check_irq_state();
19842027   }
19852028   else if(scanline == 0)
19862029   {
19872030      /* From sound to main CPU (TODO: what enables this?) */
19882031      m_intreq |= (1<<10);
2032      if(m_intena & 1<<10)
2033         m_maincpu->set_input_line(I960_IRQ3, ASSERT_LINE);
19892034      model2_check_irq_state();
19902035   }
19912036}
r29633r29634
19942039{
19952040   int scanline = param;
19962041
1997   if(scanline == 0) // 384
2042   if(scanline == 384)
19982043   {
2044      m_intreq |= (1<<0);
2045      if(m_intena & 1<<0)
2046         m_maincpu->set_input_line(I960_IRQ0, ASSERT_LINE);
2047      model2_check_irq_state();
2048   }
2049   else if(scanline == 0) // 384
2050   {
19992051      m_intreq |= (1<<10);
2052      if(m_intena & 1<<10)
2053         m_maincpu->set_input_line(I960_IRQ3, ASSERT_LINE);
20002054      model2_check_irq_state();
20012055   }
2002
2003   if(scanline == 256)
2056   else if(scanline == 256)
20042057   {
2058      /* TODO: irq source? Scroll allocation in dynamcopc? */
20052059      m_intreq |= (1<<2);
2060      if(m_intena & 1<<2)
2061         m_maincpu->set_input_line(I960_IRQ2, ASSERT_LINE);
20062062      model2_check_irq_state();
20072063   }
20082064
2009   if(scanline == 128)
2010   {
2011      m_intreq |= (1<<0);
2012      model2_check_irq_state();
2013   }
2065
20142066}
20152067
20162068/* Model 2 sound board emulation */
r29633r29634
21762228   MCFG_MB86233_FIFO_WRITE_CB(WRITE32(model2_state,copro_tgp_fifoout_push))
21772229   MCFG_MB86233_TABLE_REGION("user5")
21782230
2179
21802231   MCFG_MACHINE_START_OVERRIDE(model2_state,model2)
21812232   MCFG_MACHINE_RESET_OVERRIDE(model2_state,model2)
21822233
branches/old_menus/src/mame/mame.lst
r29633r29634
30693069cawingbl        // bootleg
30703070cawingb2        // bootleg
30713071nemo            // 30/11/1990 (c) 1990 (World)
3072nemoa         // 09/11/1990 (c) 1990 (World)
3072nemor1      // 09/11/1990 (c) 1990 (World)
30733073nemoj           // 20/11/1990 (c) 1990 (Japan)
30743074sf2             // 22/05/1991 (c) 1991 (World)
30753075sf2eb           // 14/02/1991 (c) 1991 (World)
branches/old_menus/src/mame/machine/model3.c
r29633r29634
1919 * 167 of the 3D-RAM manual.
2020 */
2121
22#define NEXT(new_state) fsm[state->m_tap_state][new_state]
22#define NEXT(new_state) fsm[m_tap_state][new_state]
2323
2424static const INT32 fsm[][2] = {
2525                     {  1,  0 },  // 0  Test-Logic/Reset
r29633r29634
6464 * Inserts a 32-bit ID code into the ID bit field.
6565 */
6666
67static void insert_id(model3_state *state, UINT32 id, INT32 start_bit)
67void model3_state::insert_id(UINT32 id, INT32 start_bit)
6868{
69   INT32 i;
70
71   for (i = 31; i >= 0; i--)
72      insert_bit(state->m_id_data, start_bit++, (id >> i) & 1);
69   for (int i = 31; i >= 0; i--)
70      insert_bit(m_id_data, start_bit++, (id >> i) & 1);
7371}
7472
7573/*
r29633r29634
122120 *      TDO.
123121 */
124122
125int model3_tap_read(running_machine &machine)
123int model3_state::tap_read()
126124{
127   model3_state *state = machine.driver_data<model3_state>();
128   return state->m_tdo;
125   return m_tdo;
129126}
130127
131128/*
r29633r29634
141138 *      trst = Reset.
142139 */
143140
144void model3_tap_write(running_machine &machine, int tck, int tms, int tdi, int trst)
141void model3_state::tap_write(int tck, int tms, int tdi, int trst)
145142{
146   model3_state *state = machine.driver_data<model3_state>();
147143   if (!tck)
148144      return;
149145
150   state->m_tap_state = NEXT(tms);
146   m_tap_state = NEXT(tms);
151147
152   switch (state->m_tap_state)
148   switch (m_tap_state)
153149   {
154150   case 3:     // Capture-DR
155151
r29633r29634
175171       * data on TAP reset and when the instruction is issued.
176172       */
177173
178      if (state->m_m3_step == 0x10)
174      if (m_m3_step == 0x10)
179175      {
180         insert_id(state, 0x116C7057, 1 + 0 * 32);
181         insert_id(state, 0x216C3057, 1 + 1 * 32);
182         insert_id(state, 0x116C4057, 1 + 2 * 32);
183         insert_id(state, 0x216C5057, 1 + 3 * 32);
184         insert_id(state, 0x116C6057, 1 + 4 * 32 + 1);
185         insert_id(state, 0x116C6057, 1 + 5 * 32 + 1);
176         insert_id(0x116C7057, 1 + 0 * 32);
177         insert_id(0x216C3057, 1 + 1 * 32);
178         insert_id(0x116C4057, 1 + 2 * 32);
179         insert_id(0x216C5057, 1 + 3 * 32);
180         insert_id(0x116C6057, 1 + 4 * 32 + 1);
181         insert_id(0x116C6057, 1 + 5 * 32 + 1);
186182      }
187      else if (state->m_m3_step == 0x15)
183      else if (m_m3_step == 0x15)
188184      {
189         insert_id(state, 0x316C7057, 1 + 0 * 32);
190         insert_id(state, 0x316C3057, 1 + 1 * 32);
191         insert_id(state, 0x216C4057, 1 + 2 * 32);      // Lost World may to use 0x016C4057
192         insert_id(state, 0x316C5057, 1 + 3 * 32);
193         insert_id(state, 0x216C6057, 1 + 4 * 32 + 1);
194         insert_id(state, 0x216C6057, 1 + 5 * 32 + 1);
185         insert_id(0x316C7057, 1 + 0 * 32);
186         insert_id(0x316C3057, 1 + 1 * 32);
187         insert_id(0x216C4057, 1 + 2 * 32);      // Lost World may to use 0x016C4057
188         insert_id(0x316C5057, 1 + 3 * 32);
189         insert_id(0x216C6057, 1 + 4 * 32 + 1);
190         insert_id(0x216C6057, 1 + 5 * 32 + 1);
195191      }
196      else if (state->m_m3_step >= 0x20)
192      else if (m_m3_step >= 0x20)
197193      {
198         insert_id(state, 0x416C7057, 1 + 0 * 32);
199         insert_id(state, 0x416C3057, 1 + 1 * 32);
200         insert_id(state, 0x316C4057, 1 + 2 * 32);
201         insert_id(state, 0x416C5057, 1 + 3 * 32);
202         insert_id(state, 0x316C6057, 1 + 4 * 32 + 1);
203         insert_id(state, 0x316C6057, 1 + 5 * 32 + 1);
194         insert_id(0x416C7057, 1 + 0 * 32);
195         insert_id(0x416C3057, 1 + 1 * 32);
196         insert_id(0x316C4057, 1 + 2 * 32);
197         insert_id(0x416C5057, 1 + 3 * 32);
198         insert_id(0x316C6057, 1 + 4 * 32 + 1);
199         insert_id(0x316C6057, 1 + 5 * 32 + 1);
204200      }
205201
206202      break;
207203
208204   case 4:     // Shift-DR
209205
210      state->m_tdo = shift(state->m_id_data, state->m_id_size);
206      m_tdo = shift(m_id_data, m_id_size);
211207      break;
212208
213209   case 10:    // Capture-IR
r29633r29634
216212       * Load lower 2 bits with 01 as per IEEE 1149.1-1990
217213       */
218214
219      state->m_ir = 1;
215      m_ir = 1;
220216      break;
221217
222218   case 11:    // Shift-IR
r29633r29634
225221       * Shift IR towards output and load in new data from TDI
226222       */
227223
228      state->m_tdo = state->m_ir & 1;   // shift LSB to output
229      state->m_ir >>= 1;
230      state->m_ir |= ((UINT64) tdi << 45);
224      m_tdo = m_ir & 1;   // shift LSB to output
225      m_ir >>= 1;
226      m_ir |= ((UINT64) tdi << 45);
231227      break;
232228
233229   case 15:    // Update-IR
r29633r29634
237233       * TCK)
238234       */
239235
240      state->m_ir &= U64(0x3fffffffffff);
236      m_ir &= U64(0x3fffffffffff);
241237      break;
242238
243239   default:
r29633r29634
252248 * Resets the TAP (simulating a power up or SCAN_RST signal.)
253249 */
254250
255void model3_tap_reset(running_machine &machine)
251void model3_state::tap_reset()
256252{
257   model3_state *state = machine.driver_data<model3_state>();
258   state->m_id_size = 197;  // 197 bits
259
260   state->m_tap_state = 0;  // test-logic/reset
253   m_id_size = 197;  // 197 bits
254   m_tap_state = 0;  // test-logic/reset
261255}
262256
263/*
264 * void model3_machine_init(int step)
265 *
266 * step = BCD hardware rev.  0x10 for 1.0, 0x15 for 1.5, 0x20 for 2.0, etc.
267 *
268 */
269
270void model3_machine_init(running_machine &machine, int step)
271{
272   model3_state *state = machine.driver_data<model3_state>();
273   state->m_m3_step = step;
274}
275
276257/*****************************************************************************/
277258/* Epson RTC-72421 */
278259
branches/old_menus/src/mame/machine/k573cass.h
r29633r29634
8080   virtual DECLARE_READ_LINE_MEMBER(read_line_adc083x_sars);
8181   virtual DECLARE_WRITE_LINE_MEMBER(write_line_d5);
8282
83   ADC083X_INPUT_CB(punchmania_inputs_callback);
84
8385protected:
8486   virtual machine_config_constructor device_mconfig_additions() const;
8587
branches/old_menus/src/mame/includes/model2.h
r29633r29634
104104   UINT32 m_videocontrol;
105105   UINT32 m_soundack;
106106   void model2_check_irq_state();
107   void model2_check_irqack_state(UINT32 data);
107108
108109   DECLARE_CUSTOM_INPUT_MEMBER(_1c00000_r);
109110   DECLARE_CUSTOM_INPUT_MEMBER(_1c0001c_r);
r29633r29634
166167   DECLARE_WRITE32_MEMBER(copro_sharc_buffer_w);
167168   DECLARE_READ32_MEMBER(copro_tgp_buffer_r);
168169   DECLARE_WRITE32_MEMBER(copro_tgp_buffer_w);
170   DECLARE_READ32_MEMBER(tgpid_r);
169171   DECLARE_READ8_MEMBER(driveio_port_r);
170172   DECLARE_WRITE8_MEMBER(driveio_port_w);
171173   DECLARE_READ8_MEMBER(driveio_port_str_r);
branches/old_menus/src/mame/includes/model3.h
r29633r29634
11#include "video/polylgcy.h"
2#include "machine/scsibus.h"
2#include "bus/scsi/scsi.h"
33#include "machine/53c810.h"
44#include "audio/dsbz80.h"
55#include "machine/eepromser.h"
r29633r29634
2121   model3_state(const machine_config &mconfig, device_type type, const char *tag)
2222      : driver_device(mconfig, type, tag),
2323      m_maincpu(*this,"maincpu"),
24      m_lsi53c810(*this, "scsi:lsi53c810"),
24      m_lsi53c810(*this, "lsi53c810"),
2525      m_audiocpu(*this, "audiocpu"),
2626      m_scsp1(*this, "scsp1"),
2727      m_eeprom(*this, "eeprom"),
r29633r29634
3131      m_dsbz80(*this, DSBZ80_TAG),
3232      m_soundram(*this, "soundram") { }
3333
34   struct TRIANGLE
35   {
36      poly_vertex v[3];
37      UINT8 texture_x, texture_y;
38      UINT8 texture_width, texture_height;
39      UINT8 transparency;
40      UINT8 texture_format, param;
41      int intensity;
42      UINT32 color;
43   };
44     
3445   required_device<cpu_device> m_maincpu;
3546   optional_device<lsi53c810_device> m_lsi53c810;
3647   required_device<cpu_device> m_audiocpu;
r29633r29634
219230   LSI53C810_IRQ_CB(scsi_irq_callback);
220231   void update_irq_state();
221232   void set_irq_line(UINT8 bit, int line);
233   void model3_init(int step);
234   // video
235   void draw_tile_4bit(bitmap_ind16 &bitmap, int tx, int ty, int tilenum);
236   void draw_tile_8bit(bitmap_ind16 &bitmap, int tx, int ty, int tilenum);
237   void draw_layer(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int bitdepth);
238   void invalidate_texture(int page, int texx, int texy, int texwidth, int texheight);
239   cached_texture *get_texture(int page, int texx, int texy, int texwidth, int texheight, int format);
240   inline void write_texture16(int xpos, int ypos, int width, int height, int page, UINT16 *data);
241   void real3d_upload_texture(UINT32 header, UINT32 *data);
242   void init_matrix_stack();
243   void get_top_matrix(MATRIX *out);
244   void push_matrix_stack();
245   void pop_matrix_stack();
246   void multiply_matrix_stack(MATRIX matrix);
247   void translate_matrix_stack(float x, float y, float z);
248   void render_one(TRIANGLE *tri);
249   void draw_model(UINT32 addr);
250   UINT32 *get_memory_pointer(UINT32 address);
251   void load_matrix(int matrix_num, MATRIX *out);
252   void traverse_list4(int lod_num, UINT32 address);
253   void traverse_list(UINT32 address);
254   inline void process_link(UINT32 address, UINT32 link);
255   void draw_block(UINT32 address);
256   void draw_viewport(int pri, UINT32 address);
257   void real3d_traverse_display_list();
258#ifdef UNUSED_FUNCTION
259   inline void write_texture8(int xpos, int ypos, int width, int height, int page, UINT16 *data);
260   void draw_texture_sheet(bitmap_ind16 &bitmap, const rectangle &cliprect);
261   void copy_screen(bitmap_ind16 &bitmap, const rectangle &cliprect);
262#endif
222263   void real3d_display_list_end();
223264   void real3d_display_list1_dma(UINT32 src, UINT32 dst, int length, int byteswap);
224265   void real3d_display_list2_dma(UINT32 src, UINT32 dst, int length, int byteswap);
225266   void real3d_vrom_texture_dma(UINT32 src, UINT32 dst, int length, int byteswap);
226267   void real3d_texture_fifo_dma(UINT32 src, int length, int byteswap);
227268   void real3d_polygon_ram_dma(UINT32 src, UINT32 dst, int length, int byteswap);
269   // machine
270   void insert_id(UINT32 id, INT32 start_bit);
271   int tap_read();
272   void tap_write(int tck, int tms, int tdi, int trst);
273   void tap_reset();
228274};
229
230/*----------- defined in machine/model3.c -----------*/
231
232void model3_machine_init(running_machine &machine, int step);
233int model3_tap_read(running_machine &machine);
234void model3_tap_write(running_machine &machine, int tck, int tms, int tdi, int trst);
235void model3_tap_reset(running_machine &machine);
236
branches/old_menus/src/mame/includes/konamigx.h
r29633r29634
11#include "sound/k056800.h"
22#include "sound/k054539.h"
33#include "cpu/tms57002/tms57002.h"
4#include "machine/adc083x.h"
45#include "video/k054156_k054157_k056832.h"
56#include "video/k053246_k053247_k055673.h"
67#include "video/k055555.h"
r29633r29634
2930      m_k056800(*this, "k056800"),
3031      m_k054539_1(*this,"k054539_1"),
3132      m_k054539_2(*this,"k054539_2"),
33      m_an0(*this, "AN0"),
34      m_an1(*this, "AN1"),
35      m_light0_x(*this, "LIGHT0_X"),
36      m_light0_y(*this, "LIGHT0_Y"),   
37      m_light1_x(*this, "LIGHT1_X"),
38      m_light1_y(*this, "LIGHT1_Y"),   
39      m_eepromout(*this, "EEPROMOUT"),
3240      m_gfxdecode(*this, "gfxdecode"),
3341      m_screen(*this, "screen"),
3442      m_palette(*this, "palette")
r29633r29634
5260   optional_device<k056800_device> m_k056800;
5361   optional_device<k054539_device> m_k054539_1;
5462   optional_device<k054539_device> m_k054539_2;
63   optional_ioport m_an0, m_an1, m_light0_x, m_light0_y, m_light1_x, m_light1_y, m_eepromout;
5564   required_device<gfxdecode_device> m_gfxdecode;
5665   required_device<screen_device> m_screen;
5766   required_device<palette_device> m_palette;
r29633r29634
119128   TIMER_CALLBACK_MEMBER(dmaend_callback);
120129   TIMER_CALLBACK_MEMBER(boothack_callback);
121130   TIMER_DEVICE_CALLBACK_MEMBER(konamigx_hbinterrupt);
131   ADC083X_INPUT_CB(adc0834_callback);
122132
123133   void _gxcommoninitnosprites(running_machine &machine);
124134   void _gxcommoninit(running_machine &machine);
branches/old_menus/src/mame/mame.mak
r29633r29634
494494#-------------------------------------------------
495495BUSES += CENTRONICS
496496BUSES += ISA
497BUSES += SCSI
497498
498499#-------------------------------------------------
499500# this is the list of driver libraries that
branches/old_menus/src/mame/video/model3.c
r29633r29634
99#define pv  p[2]
1010
1111
12
13
14
15struct TRIANGLE
16{
17   poly_vertex v[3];
18   UINT8 texture_x, texture_y;
19   UINT8 texture_width, texture_height;
20   UINT8 transparency;
21   UINT8 texture_format, param;
22   int intensity;
23   UINT32 color;
24};
25
2612struct cached_texture
2713{
2814   cached_texture *next;
r29633r29634
5238#define MAX_TRIANGLES       131072
5339
5440
55/* forward declarations */
56static void real3d_traverse_display_list(running_machine &machine);
57static void draw_model(running_machine &machine, UINT32 addr);
58static void init_matrix_stack(running_machine &machine);
59static void get_top_matrix(model3_state *state, MATRIX *out);
60static void push_matrix_stack(model3_state *state);
61static void pop_matrix_stack(model3_state *state);
62static void multiply_matrix_stack(model3_state *state, MATRIX matrix);
63static void translate_matrix_stack(model3_state *state, float x, float y, float z);
64static void traverse_list(running_machine &machine, UINT32 address);
65static void draw_block(running_machine &machine, UINT32 address);
66static void draw_viewport(running_machine &machine, int pri, UINT32 address);
67static void invalidate_texture(running_machine &machine, int page, int texx, int texy, int texwidth, int texheight);
68
6941/*****************************************************************************/
7042
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
8843/* matrix stack */
8944#define MATRIX_STACK_SIZE   256
9045
r29633r29634
10762
10863void model3_state::model3_exit()
10964{
110   invalidate_texture(machine(), 0, 0, 0, 6, 5);
111   invalidate_texture(machine(), 1, 0, 0, 6, 5);
65   invalidate_texture(0, 0, 0, 6, 5);
66   invalidate_texture(1, 0, 0, 6, 5);
11267   poly_free(m_poly);
11368}
11469
r29633r29634
148103   m_viewport_region_width = 496;
149104   m_viewport_region_height = 384;
150105
151   init_matrix_stack(machine());
106   init_matrix_stack();
152107}
153108
154static void draw_tile_4bit(running_machine &machine, bitmap_ind16 &bitmap, int tx, int ty, int tilenum)
109void model3_state::draw_tile_4bit(bitmap_ind16 &bitmap, int tx, int ty, int tilenum)
155110{
156   model3_state *state = machine.driver_data<model3_state>();
157111   int x, y;
158   UINT8 *tile_base = (UINT8*)state->m_m3_char_ram;
112   UINT8 *tile_base = (UINT8*)m_m3_char_ram;
159113   UINT8 *tile;
160114
161115   int data = (BYTE_REVERSE16(tilenum));
r29633r29634
172126         UINT16 pix0, pix1;
173127         tile0 = *tile >> 4;
174128         tile1 = *tile & 0xf;
175         pix0 = state->m_pal_lookup[c + tile0];
176         pix1 = state->m_pal_lookup[c + tile1];
129         pix0 = m_pal_lookup[c + tile0];
130         pix1 = m_pal_lookup[c + tile1];
177131         if((pix0 & 0x8000) == 0)
178132         {
179133            d[x+0] = pix0;
r29633r29634
187141   }
188142}
189143
190static void draw_tile_8bit(running_machine &machine, bitmap_ind16 &bitmap, int tx, int ty, int tilenum)
144void model3_state::draw_tile_8bit(bitmap_ind16 &bitmap, int tx, int ty, int tilenum)
191145{
192   model3_state *state = machine.driver_data<model3_state>();
193146   int x, y;
194   UINT8 *tile_base = (UINT8*)state->m_m3_char_ram;
147   UINT8 *tile_base = (UINT8*)m_m3_char_ram;
195148   UINT8 *tile;
196149
197150   int data = (BYTE_REVERSE16(tilenum));
r29633r29634
208161         UINT8 tile0;
209162         UINT16 pix;
210163         tile0 = tile[xx^4];
211         pix = state->m_pal_lookup[c + tile0];
164         pix = m_pal_lookup[c + tile0];
212165         if((pix & 0x8000) == 0)
213166         {
214167            d[x] = pix;
r29633r29634
219172   }
220173}
221174#ifdef UNUSED_FUNCTION
222static void draw_texture_sheet(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
175void model3_state::draw_texture_sheet(bitmap_ind16 &bitmap, const rectangle &cliprect)
223176{
224   model3_state *state = machine.driver_data<model3_state>();
225177   int x,y;
226178   for(y = cliprect.min_y; y <= cliprect.max_y; y++)
227179   {
228180      UINT16 *d = &bitmap.pix16(y);
229181      int index = (y*2)*2048;
230182      for(x = cliprect.min_x; x <= cliprect.max_x; x++) {
231         UINT16 pix = state->m_texture_ram[0][index];
183         UINT16 pix = m_texture_ram[0][index];
232184         index+=4;
233185         if(pix != 0) {
234186            d[x] = pix;
r29633r29634
238190}
239191#endif
240192
241static void draw_layer(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int bitdepth)
193void model3_state::draw_layer(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int bitdepth)
242194{
243   model3_state *state = machine.driver_data<model3_state>();
244195   int x, y;
245196   int tile_index = 0;
246   UINT16 *tiles = (UINT16*)&state->m_m3_tile_ram[layer * 0x400];
197   UINT16 *tiles = (UINT16*)&m_m3_tile_ram[layer * 0x400];
247198
248199   //logerror("Layer %d: X: %d, Y: %d\n", layer, x1, y1);
249200
250201   if(layer > 1) {
251      int modr = (state->m_layer_modulate2 >> 8) & 0xff;
252      int modg = (state->m_layer_modulate2 >> 16) & 0xff;
253      int modb = (state->m_layer_modulate2 >> 24) & 0xff;
202      int modr = (m_layer_modulate2 >> 8) & 0xff;
203      int modg = (m_layer_modulate2 >> 16) & 0xff;
204      int modb = (m_layer_modulate2 >> 24) & 0xff;
254205      if(modr & 0x80) {
255         state->m_layer_modulate_r = -(0x7f - (modr & 0x7f)) << 10;
206         m_layer_modulate_r = -(0x7f - (modr & 0x7f)) << 10;
256207      } else {
257         state->m_layer_modulate_r = (modr & 0x7f) << 10;
208         m_layer_modulate_r = (modr & 0x7f) << 10;
258209      }
259210      if(modg & 0x80) {
260         state->m_layer_modulate_g = -(0x7f - (modr & 0x7f)) << 5;
211         m_layer_modulate_g = -(0x7f - (modr & 0x7f)) << 5;
261212      } else {
262         state->m_layer_modulate_g = (modr & 0x7f) << 5;
213         m_layer_modulate_g = (modr & 0x7f) << 5;
263214      }
264215      if(modb & 0x80) {
265         state->m_layer_modulate_b = -(0x7f - (modr & 0x7f));
216         m_layer_modulate_b = -(0x7f - (modr & 0x7f));
266217      } else {
267         state->m_layer_modulate_b = (modr & 0x7f);
218         m_layer_modulate_b = (modr & 0x7f);
268219      }
269220   } else {
270      int modr = (state->m_layer_modulate1 >> 8) & 0xff;
271      int modg = (state->m_layer_modulate1 >> 16) & 0xff;
272      int modb = (state->m_layer_modulate1 >> 24) & 0xff;
221      int modr = (m_layer_modulate1 >> 8) & 0xff;
222      int modg = (m_layer_modulate1 >> 16) & 0xff;
223      int modb = (m_layer_modulate1 >> 24) & 0xff;
273224      if(modr & 0x80) {
274         state->m_layer_modulate_r = -(0x7f - (modr & 0x7f)) << 10;
225         m_layer_modulate_r = -(0x7f - (modr & 0x7f)) << 10;
275226      } else {
276         state->m_layer_modulate_r = (modr & 0x7f) << 10;
227         m_layer_modulate_r = (modr & 0x7f) << 10;
277228      }
278229      if(modg & 0x80) {
279         state->m_layer_modulate_g = -(0x7f - (modr & 0x7f)) << 5;
230         m_layer_modulate_g = -(0x7f - (modr & 0x7f)) << 5;
280231      } else {
281         state->m_layer_modulate_g = (modr & 0x7f) << 5;
232         m_layer_modulate_g = (modr & 0x7f) << 5;
282233      }
283234      if(modb & 0x80) {
284         state->m_layer_modulate_b = -(0x7f - (modr & 0x7f));
235         m_layer_modulate_b = -(0x7f - (modr & 0x7f));
285236      } else {
286         state->m_layer_modulate_b = (modr & 0x7f);
237         m_layer_modulate_b = (modr & 0x7f);
287238      }
288239   }
289240
r29633r29634
294245         tile_index = ((y/8) * 64);
295246         for (x = cliprect.min_x; x <= cliprect.max_x; x+=8) {
296247            UINT16 tile = tiles[tile_index ^ 0x2];
297            draw_tile_4bit(machine, bitmap, x, y, tile);
248            draw_tile_4bit(bitmap, x, y, tile);
298249            ++tile_index;
299250         }
300251      }
r29633r29634
306257         tile_index = ((y/8) * 64);
307258         for (x = cliprect.min_x; x <= cliprect.max_x; x+=8) {
308259            UINT16 tile = tiles[tile_index ^ 0x2];
309            draw_tile_8bit(machine, bitmap, x, y, tile);
260            draw_tile_8bit(bitmap, x, y, tile);
310261            ++tile_index;
311262         }
312263      }
r29633r29634
314265}
315266
316267#ifdef UNUSED_FUNCTION
317static void copy_screen(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
268static void copy_screen(bitmap_ind16 &bitmap, const rectangle &cliprect)
318269{
319   model3_state *state = machine.driver_data<model3_state>();
320270   int x,y;
321271   for(y=cliprect.min_y; y <= cliprect.max_y; y++) {
322272      UINT16 *d = &bitmap.pix16(y);
323      UINT16 *s = &state->m_bitmap3d.pix16(y);
273      UINT16 *s = &m_bitmap3d.pix16(y);
324274      for(x=cliprect.min_x; x <= cliprect.max_x; x++) {
325275         UINT16 pix = s[x];
326276         if(!(pix & 0x8000)) {
r29633r29634
374324   bitmap.fill(0, cliprect);
375325
376326   if (!(m_debug_layer_disable & 0x8))
377      draw_layer(machine(), bitmap, cliprect, 3, (m_layer_enable >> 3) & 0x1);
327      draw_layer(bitmap, cliprect, 3, (m_layer_enable >> 3) & 0x1);
378328
379329   if (!(m_debug_layer_disable & 0x4))
380      draw_layer(machine(), bitmap, cliprect, 2, (m_layer_enable >> 2) & 0x1);
330      draw_layer(bitmap, cliprect, 2, (m_layer_enable >> 2) & 0x1);
381331
382332   if( !(m_debug_layer_disable & 0x10) )
383333   {
r29633r29634
385335      if(m_real3d_display_list) {
386336         m_zbuffer.fill(0, cliprect);
387337         m_bitmap3d.fill(0x8000, cliprect);
388         real3d_traverse_display_list(machine());
338         real3d_traverse_display_list();
389339      }
390340#endif
391341      copybitmap_trans(bitmap, m_bitmap3d, 0, 0, 0, 0, cliprect, 0x8000);
392342   }
393343
394344   if (!(m_debug_layer_disable & 0x2))
395      draw_layer(machine(), bitmap, cliprect, 1, (m_layer_enable >> 1) & 0x1);
345      draw_layer(bitmap, cliprect, 1, (m_layer_enable >> 1) & 0x1);
396346
397347   if (!(m_debug_layer_disable & 0x1))
398      draw_layer(machine(), bitmap, cliprect, 0, (m_layer_enable >> 0) & 0x1);
348      draw_layer(bitmap, cliprect, 0, (m_layer_enable >> 0) & 0x1);
399349
400350   //copy_screen(bitmap, cliprect);
401351
r29633r29634
495445        1024 pixels / 32 pixel resolution vertically
496446        2048 pixels / 32 pixel resolution horizontally
497447*/
498static void invalidate_texture(running_machine &machine, int page, int texx, int texy, int texwidth, int texheight)
448void model3_state::invalidate_texture(int page, int texx, int texy, int texwidth, int texheight)
499449{
500   model3_state *state = machine.driver_data<model3_state>();
501450   int wtiles = 1 << texwidth;
502451   int htiles = 1 << texheight;
503   int x, y;
504452
505   for (y = 0; y < htiles; y++)
506      for (x = 0; x < wtiles; x++)
507         while (state->m_texcache[page][texy + y][texx + x] != NULL)
453   for (int y = 0; y < htiles; y++)
454      for (int x = 0; x < wtiles; x++)
455         while (m_texcache[page][texy + y][texx + x] != NULL)
508456         {
509            cached_texture *freeme = state->m_texcache[page][texy + y][texx + x];
510            state->m_texcache[page][texy + y][texx + x] = freeme->next;
511            auto_free(machine, freeme);
457            cached_texture *freeme = m_texcache[page][texy + y][texx + x];
458            m_texcache[page][texy + y][texx + x] = freeme->next;
459            auto_free(machine(), freeme);
512460         }
513461}
514462
515static cached_texture *get_texture(running_machine &machine, int page, int texx, int texy, int texwidth, int texheight, int format)
463cached_texture *model3_state::get_texture(int page, int texx, int texy, int texwidth, int texheight, int format)
516464{
517   model3_state *state = machine.driver_data<model3_state>();
518   cached_texture *tex = state->m_texcache[page][texy][texx];
465   cached_texture *tex = m_texcache[page][texy][texx];
519466   int pixheight = 32 << texheight;
520467   int pixwidth = 32 << texwidth;
521468   UINT32 alpha = ~0;
522469   int x, y;
523470
524471   /* if we have one already, validate it */
525   for (tex = state->m_texcache[page][texy][texx]; tex != NULL; tex = tex->next)
472   for (tex = m_texcache[page][texy][texx]; tex != NULL; tex = tex->next)
526473      if (tex->width == texwidth && tex->height == texheight && tex->format == format)
527474         return tex;
528475
529476   /* create a new texture */
530   tex = (cached_texture *)auto_alloc_array(machine, UINT8, sizeof(cached_texture) + (2 * pixwidth * 2 * pixheight) * sizeof(rgb_t));
477   tex = (cached_texture *)auto_alloc_array(machine(), UINT8, sizeof(cached_texture) + (2 * pixwidth * 2 * pixheight) * sizeof(rgb_t));
531478   tex->width = texwidth;
532479   tex->height = texheight;
533480   tex->format = format;
534481
535482   /* set the new texture */
536   tex->next = state->m_texcache[page][texy][texx];
537   state->m_texcache[page][texy][texx] = tex;
483   tex->next = m_texcache[page][texy][texx];
484   m_texcache[page][texy][texx] = tex;
538485
539486   /* decode it */
540487   for (y = 0; y < pixheight; y++)
541488   {
542      const UINT16 *texsrc = &state->m_texture_ram[page][(texy * 32 + y) * 2048 + texx * 32];
489      const UINT16 *texsrc = &m_texture_ram[page][(texy * 32 + y) * 2048 + texx * 32];
543490      rgb_t *dest = tex->data + 2 * pixwidth * y;
544491
545492      switch (format)
r29633r29634
660607   50, 51, 54, 55, 58, 59, 62, 63
661608};
662609
663INLINE void write_texture16(model3_state *state, int xpos, int ypos, int width, int height, int page, UINT16 *data)
610inline void model3_state::write_texture16(int xpos, int ypos, int width, int height, int page, UINT16 *data)
664611{
665612   int x,y,i,j;
666613
r29633r29634
668615   {
669616      for(x=xpos; x < xpos+width; x+=8)
670617      {
671         UINT16 *texture = &state->m_texture_ram[page][y*2048+x];
618         UINT16 *texture = &m_texture_ram[page][y*2048+x];
672619         int b = 0;
673620         for(j=y; j < y+8; j++) {
674621            for(i=x; i < x+8; i++) {
r29633r29634
683630}
684631
685632#ifdef UNUSED_FUNCTION
686INLINE void write_texture8(model3_state *state, int xpos, int ypos, int width, int height, int page, UINT16 *data)
633inline void model3_state::write_texture8(int xpos, int ypos, int width, int height, int page, UINT16 *data)
687634{
688635   int x,y,i,j;
689636   UINT16 color = 0x7c00;
r29633r29634
692639   {
693640      for(x=xpos; x < xpos+width; x+=8)
694641      {
695         UINT16 *texture = &state->m_texture_ram[page][y*2048+x];
642         UINT16 *texture = &m_texture_ram[page][y*2048+x];
696643         for(j=y; j < y+4; j++) {
697644            for(i=x; i < x+8; i++) {
698645               *texture = color;
r29633r29634
705652}
706653#endif
707654
708static void real3d_upload_texture(running_machine &machine, UINT32 header, UINT32 *data)
655void model3_state::real3d_upload_texture(UINT32 header, UINT32 *data)
709656{
710   model3_state *state = machine.driver_data<model3_state>();
711657   int width   = 32 << ((header >> 14) & 0x7);
712658   int height  = 32 << ((header >> 17) & 0x7);
713659   int xpos    = (header & 0x3f) * 32;
r29633r29634
719665   {
720666      case 0x00:      /* Texture with mipmaps */
721667         //if(bitdepth) {
722            write_texture16(state, xpos, ypos, width, height, page, (UINT16*)data);
723            invalidate_texture(machine, page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7);
668            write_texture16(xpos, ypos, width, height, page, (UINT16*)data);
669            invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7);
724670         //} else {
725671            /* TODO: 8-bit textures are weird. need to figure out some additional bits */
726672            //logerror("W: %d, H: %d, X: %d, Y: %d, P: %d, Bit: %d, : %08X, %08X\n", width, height, xpos, ypos, page, bitdepth, header & 0x00681040, header);
r29633r29634
729675         break;
730676      case 0x01:      /* Texture without mipmaps */
731677         //if(bitdepth) {
732            write_texture16(state, xpos, ypos, width, height, page, (UINT16*)data);
733            invalidate_texture(machine, page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7);
678            write_texture16(xpos, ypos, width, height, page, (UINT16*)data);
679            invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7);
734680         //} else {
735681            /* TODO: 8-bit textures are weird. need to figure out some additional bits */
736682            //logerror("W: %d, H: %d, X: %d, Y: %d, P: %d, Bit: %d, : %08X, %08X\n", width, height, xpos, ypos, page, bitdepth, header & 0x00681040, header);
r29633r29634
757703      {
758704         int length = (m_texture_fifo[i] / 2) + 2;
759705         UINT32 header = m_texture_fifo[i+1];
760         real3d_upload_texture(machine(), header, &m_texture_fifo[i+2]);
706         real3d_upload_texture(header, &m_texture_fifo[i+2]);
761707         i += length;
762708      };
763709   }
764710   m_texture_fifo_pos = 0;
765711   m_zbuffer.fill(0);
766712   m_bitmap3d.fill(0x8000);
767   real3d_traverse_display_list(machine());
768   //state->m_real3d_display_list = 1;
713   real3d_traverse_display_list();
714   //m_real3d_display_list = 1;
769715}
770716
771717void model3_state::real3d_display_list1_dma(UINT32 src, UINT32 dst, int length, int byteswap)
r29633r29634
815761         address = space.read_dword((src+0));
816762         header = space.read_dword((src+4));
817763      }
818      real3d_upload_texture(space.machine(), header, (UINT32*)&m_vrom[address]);
764      real3d_upload_texture(header, (UINT32*)&m_vrom[address]);
819765   }
820766}
821767
r29633r29634
897843   memcpy(out, &tmp, sizeof(MATRIX));
898844}
899845
900static void init_matrix_stack(running_machine &machine)
846void model3_state::init_matrix_stack()
901847{
902   model3_state *state = machine.driver_data<model3_state>();
903848   MATRIX *matrix_stack;
904   matrix_stack = state->m_matrix_stack = auto_alloc_array_clear(machine, MATRIX, MATRIX_STACK_SIZE);
849   matrix_stack = m_matrix_stack = auto_alloc_array_clear(machine(), MATRIX, MATRIX_STACK_SIZE);
905850
906851   /* initialize the first matrix as identity */
907852   matrix_stack[0][0][0] = 1.0f;
r29633r29634
921866   matrix_stack[0][3][2] = 0.0f;
922867   matrix_stack[0][3][3] = 1.0f;
923868
924   state->m_matrix_stack_ptr = 0;
869   m_matrix_stack_ptr = 0;
925870}
926871
927static void get_top_matrix(model3_state *state, MATRIX *out)
872void model3_state::get_top_matrix(MATRIX *out)
928873{
929   memcpy( out, &state->m_matrix_stack[state->m_matrix_stack_ptr], sizeof(MATRIX));
874   memcpy(out, &m_matrix_stack[m_matrix_stack_ptr], sizeof(MATRIX));
930875}
931876
932static void push_matrix_stack(model3_state *state)
877void model3_state::push_matrix_stack()
933878{
934   state->m_matrix_stack_ptr++;
935   if (state->m_matrix_stack_ptr >= MATRIX_STACK_SIZE)
879   m_matrix_stack_ptr++;
880   if (m_matrix_stack_ptr >= MATRIX_STACK_SIZE)
936881      fatalerror("push_matrix_stack: matrix stack overflow\n");
937882
938   memcpy( &state->m_matrix_stack[state->m_matrix_stack_ptr], &state->m_matrix_stack[state->m_matrix_stack_ptr-1], sizeof(MATRIX));
883   memcpy(&m_matrix_stack[m_matrix_stack_ptr], &m_matrix_stack[m_matrix_stack_ptr - 1], sizeof(MATRIX));
939884}
940885
941static void pop_matrix_stack(model3_state *state)
886void model3_state::pop_matrix_stack()
942887{
943   state->m_matrix_stack_ptr--;
944   if (state->m_matrix_stack_ptr < 0)
888   m_matrix_stack_ptr--;
889   if (m_matrix_stack_ptr < 0)
945890      fatalerror("pop_matrix_stack: matrix stack underflow\n");
946891}
947892
948static void multiply_matrix_stack(model3_state *state, MATRIX matrix)
893void model3_state::multiply_matrix_stack(MATRIX matrix)
949894{
950   matrix_multiply(matrix, state->m_matrix_stack[state->m_matrix_stack_ptr], &state->m_matrix_stack[state->m_matrix_stack_ptr]);
895   matrix_multiply(matrix, m_matrix_stack[m_matrix_stack_ptr], &m_matrix_stack[m_matrix_stack_ptr]);
951896}
952897
953static void translate_matrix_stack(model3_state *state, float x, float y, float z)
898void model3_state::translate_matrix_stack(float x, float y, float z)
954899{
955900   MATRIX tm;
956901
r29633r29634
959904   tm[2][0] = 0.0f;    tm[2][1] = 0.0f;    tm[2][2] = 1.0f;    tm[2][3] = 0.0f;
960905   tm[3][0] = x;       tm[3][1] = y;       tm[3][2] = z;       tm[3][3] = 1.0f;
961906
962   matrix_multiply(tm, state->m_matrix_stack[state->m_matrix_stack_ptr], &state->m_matrix_stack[state->m_matrix_stack_ptr]);
907   matrix_multiply(tm, m_matrix_stack[m_matrix_stack_ptr], &m_matrix_stack[m_matrix_stack_ptr]);
963908}
964909
965910/*****************************************************************************/
r29633r29634
1037982   return clip_verts;
1038983}
1039984
1040static void render_one(running_machine &machine, TRIANGLE *tri)
985void model3_state::render_one(TRIANGLE *tri)
1041986{
1042   model3_state *state = machine.driver_data<model3_state>();
1043   poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(state->m_poly);
987   poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(m_poly);
1044988   poly_draw_scanline_func callback = NULL;
1045989
1046990   tri->v[0].pz = 1.0f / tri->v[0].pz;
1047991   tri->v[1].pz = 1.0f / tri->v[1].pz;
1048992   tri->v[2].pz = 1.0f / tri->v[2].pz;
1049993
1050   extra->zbuffer = &state->m_zbuffer;
994   extra->zbuffer = &m_zbuffer;
1051995   if (tri->param & TRI_PARAM_TEXTURE_ENABLE)
1052996   {
1053997      tri->v[0].pu = tri->v[0].pu * tri->v[0].pz * 256.0f;
r29633r29634
10571001      tri->v[2].pu = tri->v[2].pu * tri->v[2].pz * 256.0f;
10581002      tri->v[2].pv = tri->v[2].pv * tri->v[2].pz * 256.0f;
10591003
1060      extra->texture = get_texture(machine, (tri->param & TRI_PARAM_TEXTURE_PAGE) ? 1 : 0, tri->texture_x, tri->texture_y, tri->texture_width, tri->texture_height, tri->texture_format);
1004      extra->texture = get_texture((tri->param & TRI_PARAM_TEXTURE_PAGE) ? 1 : 0, tri->texture_x, tri->texture_y, tri->texture_width, tri->texture_height, tri->texture_format);
10611005      extra->texture_param        = tri->param;
10621006      extra->polygon_transparency = tri->transparency;
10631007      extra->polygon_intensity    = tri->intensity;
r29633r29634
10681012         callback = (tri->transparency >= 32) ? draw_scanline_normal : draw_scanline_trans;
10691013      else
10701014         callback = draw_scanline_alpha;
1071      poly_render_triangle(state->m_poly, &state->m_bitmap3d, state->m_clip3d, callback, 3, &tri->v[0], &tri->v[1], &tri->v[2]);
1015      poly_render_triangle(m_poly, &m_bitmap3d, m_clip3d, callback, 3, &tri->v[0], &tri->v[1], &tri->v[2]);
10721016   }
10731017   else
10741018   {
r29633r29634
10761020      extra->polygon_intensity    = tri->intensity;
10771021      extra->color                = tri->color;
10781022
1079      poly_render_triangle(state->m_poly, &state->m_bitmap3d, state->m_clip3d, draw_scanline_color, 1, &tri->v[0], &tri->v[1], &tri->v[2]);
1023      poly_render_triangle(m_poly, &m_bitmap3d, m_clip3d, draw_scanline_color, 1, &tri->v[0], &tri->v[1], &tri->v[2]);
10801024   }
10811025}
10821026
1083static void draw_model(running_machine &machine, UINT32 addr)
1027void model3_state::draw_model(UINT32 addr)
10841028{
1085   model3_state *state = machine.driver_data<model3_state>();
1086   UINT32 *model = (addr >= 0x100000) ? &state->m_vrom[addr] :  &state->m_polygon_ram[addr];
1029   UINT32 *model = (addr >= 0x100000) ? &m_vrom[addr] :  &m_polygon_ram[addr];
10871030   UINT32 header[7];
10881031   int index = 0;
10891032   int last_polygon = FALSE, first_polygon = TRUE, back_face = FALSE;
r29633r29634
10971040   MATRIX transform_matrix;
10981041   float center_x, center_y;
10991042
1100   if(state->m_step < 0x15) {  /* position coordinates are 17.15 fixed-point in Step 1.0 */
1043   if(m_step < 0x15) {  /* position coordinates are 17.15 fixed-point in Step 1.0 */
11011044      fixed_point_fraction = 1.0f / 32768.0f;
11021045   } else {                    /* 13.19 fixed-point in other Steps */
11031046      fixed_point_fraction = 1.0f / 524288.0f;
11041047   }
11051048
1106   get_top_matrix(state, &transform_matrix);
1049   get_top_matrix(&transform_matrix);
11071050
11081051   /* current viewport center coordinates on screen */
1109   center_x = (float)(state->m_viewport_region_x + (state->m_viewport_region_width / 2));
1110   center_y = (float)(state->m_viewport_region_y + (state->m_viewport_region_height / 2));
1052   center_x = (float)(m_viewport_region_x + (m_viewport_region_width / 2));
1053   center_y = (float)(m_viewport_region_y + (m_viewport_region_height / 2));
11111054
11121055   memset(prev_vertex, 0, sizeof(prev_vertex));
11131056
r29633r29634
12241167            (normal[1] * transform_matrix[1][2]) +
12251168            (normal[2] * transform_matrix[2][2]);
12261169
1227      sn[0] *= state->m_coordinate_system[0][1];
1228      sn[1] *= state->m_coordinate_system[1][2];
1229      sn[2] *= state->m_coordinate_system[2][0];
1170      sn[0] *= m_coordinate_system[0][1];
1171      sn[1] *= m_coordinate_system[1][2];
1172      sn[2] *= m_coordinate_system[2][0];
12301173
12311174      /* TODO: depth bias */
12321175      /* transform vertices */
r29633r29634
12431186         matrix_multiply_vector(transform_matrix, vect, &p[i]);
12441187
12451188         /* apply coordinate system */
1246         clip_vert[i].x = p[i][0] * state->m_coordinate_system[0][1];
1247         clip_vert[i].y = p[i][1] * state->m_coordinate_system[1][2];
1248         clip_vert[i].pz = p[i][2] * state->m_coordinate_system[2][0];
1189         clip_vert[i].x = p[i][0] * m_coordinate_system[0][1];
1190         clip_vert[i].y = p[i][1] * m_coordinate_system[1][2];
1191         clip_vert[i].pz = p[i][2] * m_coordinate_system[2][0];
12491192         clip_vert[i].pu = vertex[i].pu * texture_coord_scale;
12501193         clip_vert[i].pv = vertex[i].pv * texture_coord_scale;
12511194      }
12521195
12531196      /* clip against view frustum */
1254      num_vertices = clip_polygon(clip_vert, num_vertices, state->m_clip_plane[0], clip_vert);
1255      num_vertices = clip_polygon(clip_vert, num_vertices, state->m_clip_plane[1], clip_vert);
1256      num_vertices = clip_polygon(clip_vert, num_vertices, state->m_clip_plane[2], clip_vert);
1257      num_vertices = clip_polygon(clip_vert, num_vertices, state->m_clip_plane[3], clip_vert);
1258      num_vertices = clip_polygon(clip_vert, num_vertices, state->m_clip_plane[4], clip_vert);
1197      num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[0], clip_vert);
1198      num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[1], clip_vert);
1199      num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[2], clip_vert);
1200      num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[3], clip_vert);
1201      num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[4], clip_vert);
12591202
12601203      /* backface culling */
12611204      if( (header[6] & 0x800000) && (!(header[1] & 0x0010)) ) {
r29633r29634
12711214         /* homogeneous Z-divide, screen-space transformation */
12721215         for(i=0; i < num_vertices; i++) {
12731216            float ooz = 1.0f / clip_vert[i].pz;
1274            clip_vert[i].x = ((clip_vert[i].x * ooz) * state->m_viewport_focal_length) + center_x;
1275            clip_vert[i].y = ((clip_vert[i].y * ooz) * state->m_viewport_focal_length) + center_y;
1217            clip_vert[i].x = ((clip_vert[i].x * ooz) * m_viewport_focal_length) + center_x;
1218            clip_vert[i].y = ((clip_vert[i].y * ooz) * m_viewport_focal_length) + center_y;
12761219         }
12771220
12781221         // lighting
12791222         if ((header[6] & 0x10000) == 0)
12801223         {
1281            dot = dot_product3(sn, state->m_parallel_light);
1282            intensity = ((dot * state->m_parallel_light_intensity) + state->m_ambient_light_intensity) * 256.0f;
1224            dot = dot_product3(sn, m_parallel_light);
1225            intensity = ((dot * m_parallel_light_intensity) + m_ambient_light_intensity) * 256.0f;
12831226            if (intensity > 256)
12841227            {
12851228               intensity = 256;
r29633r29634
13161259            tri.param   |= (header[2] & 0x1) ? TRI_PARAM_TEXTURE_MIRROR_V : 0;
13171260            tri.param   |= (header[6] & 0x80000000) ? TRI_PARAM_ALPHA_TEST : 0;
13181261
1319            render_one(machine, &tri);
1262            render_one(&tri);
13201263         }
13211264      }
13221265   }
r29633r29634
13261269/*****************************************************************************/
13271270/* display list parser */
13281271
1329static UINT32 *get_memory_pointer(model3_state *state, UINT32 address)
1272UINT32 *model3_state::get_memory_pointer(UINT32 address)
13301273{
13311274   if (address & 0x800000)
13321275   {
13331276      if (address >= 0x840000) {
13341277         fatalerror("get_memory_pointer: invalid display list memory address %08X\n", address);
13351278      }
1336      return &state->m_display_list_ram[address & 0x7fffff];
1279      return &m_display_list_ram[address & 0x7fffff];
13371280   }
13381281   else
13391282   {
13401283      if (address >= 0x100000) {
13411284         fatalerror("get_memory_pointer: invalid node ram address %08X\n", address);
13421285      }
1343      return &state->m_culling_ram[address];
1286      return &m_culling_ram[address];
13441287   }
13451288}
13461289
1347static void load_matrix(model3_state *state, int matrix_num, MATRIX *out)
1290void model3_state::load_matrix(int matrix_num, MATRIX *out)
13481291{
1349   float *matrix = (float *)get_memory_pointer(state, state->m_matrix_base_address + matrix_num * 12);
1292   float *matrix = (float *)get_memory_pointer(m_matrix_base_address + matrix_num * 12);
13501293
13511294   (*out)[0][0] = matrix[3];   (*out)[0][1] = matrix[6];   (*out)[0][2] = matrix[9];   (*out)[0][3] = 0.0f;
13521295   (*out)[1][0] = matrix[4];   (*out)[1][1] = matrix[7];   (*out)[1][2] = matrix[10];  (*out)[1][3] = 0.0f;
r29633r29634
13541297   (*out)[3][0] = matrix[0];   (*out)[3][1] = matrix[1];   (*out)[3][2] = matrix[2];   (*out)[3][3] = 1.0f;
13551298}
13561299
1357static void traverse_list4(running_machine &machine, int lod_num, UINT32 address)
1300void model3_state::traverse_list4(int lod_num, UINT32 address)
13581301{
1359   model3_state *state = machine.driver_data<model3_state>();
1360
13611302   /* does something with the LOD selection */
1362   UINT32 *list = get_memory_pointer(state, address);
1303   UINT32 *list = get_memory_pointer(address);
13631304   UINT32 link = list[0];
13641305
1365   draw_model(machine, link & 0xffffff);
1306   draw_model(link & 0xffffff);
13661307}
13671308
1368static void traverse_list(running_machine &machine, UINT32 address)
1309void model3_state::traverse_list(UINT32 address)
13691310{
1370   model3_state *state = machine.driver_data<model3_state>();
1371   UINT32 *list = get_memory_pointer(state, address);
1311   UINT32 *list = get_memory_pointer(address);
13721312   int list_ptr = 0;
13731313
1374   if (state->m_list_depth > 2)
1314   if (m_list_depth > 2)
13751315      return;
13761316
1377   state->m_list_depth++;
1317   m_list_depth++;
13781318
13791319   /* find the end of the list */
13801320   while (1)
r29633r29634
13951335      address = list[--list_ptr] & 0xffffff;
13961336      if (address != 0 && address != 0x800800)
13971337      //if (address != 0)
1398         draw_block(machine, address);
1338         draw_block(address);
13991339   }
14001340
1401   state->m_list_depth--;
1341   m_list_depth--;
14021342}
14031343
1404INLINE void process_link(running_machine &machine, UINT32 address, UINT32 link)
1344inline void model3_state::process_link(UINT32 address, UINT32 link)
14051345{
14061346   if (link != 0 && link != 0x0fffffff && link != 0x00800800 && link != 0x01000000)
14071347   {
14081348      switch (link >> 24)
14091349      {
14101350         case 0x00:      /* link to another node */
1411            draw_block(machine, link & 0xffffff);
1351            draw_block(link & 0xffffff);
14121352            break;
14131353
14141354         case 0x01:
14151355         case 0x03:      /* both of these link to models, is there any difference ? */
1416            draw_model(machine, link & 0xffffff);
1356            draw_model(link & 0xffffff);
14171357            break;
14181358
14191359         case 0x04:      /* list of links */
1420            traverse_list(machine, link & 0xffffff);
1360            traverse_list(link & 0xffffff);
14211361            break;
14221362
14231363         default:
r29633r29634
14271367   }
14281368}
14291369
1430static void draw_block(running_machine &machine, UINT32 address)
1370void model3_state::draw_block(UINT32 address)
14311371{
1432   model3_state *state = machine.driver_data<model3_state>();
1433   const UINT32 *node = get_memory_pointer(state, address);
1372   const UINT32 *node = get_memory_pointer(address);
14341373   UINT32 link;
14351374   int node_matrix;
14361375   float x, y, z;
14371376   MATRIX matrix;
14381377   int offset;
14391378
1440   offset = (state->m_step < 0x15) ? 2 : 0;
1379   offset = (m_step < 0x15) ? 2 : 0;
14411380   link = node[7 - offset];
14421381
14431382   /* apply matrix and translation */
14441383   node_matrix = node[3 - offset] & 0xfff;
1445   load_matrix(state, node_matrix, &matrix);
1384   load_matrix(node_matrix, &matrix);
14461385
1447   push_matrix_stack(state);
1386   push_matrix_stack();
14481387
14491388   if (node[0] & 0x10)
14501389   {
14511390      x = *(float *)&node[4 - offset];
14521391      y = *(float *)&node[5 - offset];
14531392      z = *(float *)&node[6 - offset];
1454      translate_matrix_stack(state, x, y, z);
1393      translate_matrix_stack(x, y, z);
14551394   }
14561395   else if (node_matrix != 0)
1457      multiply_matrix_stack(state, matrix);
1396      multiply_matrix_stack(matrix);
14581397
14591398   /* bit 0x08 of word 0 indicates a pointer list */
14601399   if (node[0] & 0x08)
1461      traverse_list4(machine, (node[3 - offset] >> 12) & 0x7f, link & 0xffffff);
1400      traverse_list4((node[3 - offset] >> 12) & 0x7f, link & 0xffffff);
14621401   else
1463      process_link(machine, address, link);
1402      process_link(address, link);
14641403
1465   pop_matrix_stack(state);
1404   pop_matrix_stack();
14661405
14671406   /* handle the second link */
14681407   link = node[8 - offset];
1469   process_link(machine, address, link);
1408   process_link(address, link);
14701409}
14711410
1472static void draw_viewport(running_machine &machine, int pri, UINT32 address)
1411void model3_state::draw_viewport(int pri, UINT32 address)
14731412{
1474   model3_state *state = machine.driver_data<model3_state>();
1475   const UINT32 *node = get_memory_pointer(state, address);
1413   const UINT32 *node = get_memory_pointer(address);
14761414   UINT32 link_address;
14771415   float /*viewport_left, viewport_right, */viewport_top, viewport_bottom;
14781416   float /*fov_x,*/ fov_y;
r29633r29634
14841422   /* traverse to the link node before drawing this viewport */
14851423   /* check this is correct as this affects the rendering order */
14861424   if (link_address != 0x01000000)
1487      draw_viewport(machine, pri, link_address);
1425      draw_viewport(pri, link_address);
14881426
14891427   /* skip if this isn't the right priority */
14901428   if (pri != ((node[0] >> 3) & 3))
14911429      return;
14921430
14931431   /* set viewport parameters */
1494   state->m_viewport_region_x      = (node[26] & 0xffff) >> 4;         /* 12.4 fixed point */
1495   state->m_viewport_region_y      = ((node[26] >> 16) & 0xffff) >> 4;
1496   state->m_viewport_region_width  = (node[20] & 0xffff) >> 2;         /* 14.2 fixed point */
1497   state->m_viewport_region_height = ((node[20] >> 16) & 0xffff) >> 2;
1432   m_viewport_region_x      = (node[26] & 0xffff) >> 4;         /* 12.4 fixed point */
1433   m_viewport_region_y      = ((node[26] >> 16) & 0xffff) >> 4;
1434   m_viewport_region_width  = (node[20] & 0xffff) >> 2;         /* 14.2 fixed point */
1435   m_viewport_region_height = ((node[20] >> 16) & 0xffff) >> 2;
14981436
14991437   /* frustum plane angles */
15001438   //viewport_left         = RADIAN_TO_DEGREE(asin(*(float *)&node[12]));
r29633r29634
15031441   viewport_bottom         = RADIAN_TO_DEGREE(asin(*(float *)&node[18]));
15041442
15051443   /* build clipping planes */
1506   state->m_clip_plane[0].x = *(float *)&node[13]; state->m_clip_plane[0].y = 0.0f;        state->m_clip_plane[0].z = *(float *)&node[12]; state->m_clip_plane[0].d = 0.0f;
1507   state->m_clip_plane[1].x = *(float *)&node[17]; state->m_clip_plane[1].y = 0.0f;        state->m_clip_plane[1].z = *(float *)&node[16]; state->m_clip_plane[1].d = 0.0f;
1508   state->m_clip_plane[2].x = 0.0f;        state->m_clip_plane[2].y = *(float *)&node[15]; state->m_clip_plane[2].z = *(float *)&node[14]; state->m_clip_plane[2].d = 0.0f;
1509   state->m_clip_plane[3].x = 0.0f;        state->m_clip_plane[3].y = *(float *)&node[19]; state->m_clip_plane[3].z = *(float *)&node[18]; state->m_clip_plane[3].d = 0.0f;
1510   state->m_clip_plane[4].x = 0.0f;        state->m_clip_plane[4].y = 0.0f;        state->m_clip_plane[4].z = 1.0f;        state->m_clip_plane[4].d = 1.0f;
1444   m_clip_plane[0].x = *(float *)&node[13]; m_clip_plane[0].y = 0.0f;        m_clip_plane[0].z = *(float *)&node[12]; m_clip_plane[0].d = 0.0f;
1445   m_clip_plane[1].x = *(float *)&node[17]; m_clip_plane[1].y = 0.0f;        m_clip_plane[1].z = *(float *)&node[16]; m_clip_plane[1].d = 0.0f;
1446   m_clip_plane[2].x = 0.0f;        m_clip_plane[2].y = *(float *)&node[15]; m_clip_plane[2].z = *(float *)&node[14]; m_clip_plane[2].d = 0.0f;
1447   m_clip_plane[3].x = 0.0f;        m_clip_plane[3].y = *(float *)&node[19]; m_clip_plane[3].z = *(float *)&node[18]; m_clip_plane[3].d = 0.0f;
1448   m_clip_plane[4].x = 0.0f;        m_clip_plane[4].y = 0.0f;        m_clip_plane[4].z = 1.0f;        m_clip_plane[4].d = 1.0f;
15111449
15121450   /* compute field of view */
15131451   //fov_x = viewport_left + viewport_right;
15141452   fov_y = viewport_top + viewport_bottom;
1515   state->m_viewport_focal_length = (state->m_viewport_region_height / 2) / tan( (fov_y * M_PI / 180.0f) / 2.0f );
1453   m_viewport_focal_length = (m_viewport_region_height / 2) / tan( (fov_y * M_PI / 180.0f) / 2.0f );
15161454
1517   state->m_matrix_base_address = node[22];
1455   m_matrix_base_address = node[22];
15181456   /* TODO: where does node[23] point to ? LOD table ? */
15191457
15201458   /* set lighting parameters */
1521   state->m_parallel_light[0] = -*(float *)&node[5];
1522   state->m_parallel_light[1] = *(float *)&node[6];
1523   state->m_parallel_light[2] = *(float *)&node[4];
1524   state->m_parallel_light_intensity = *(float *)&node[7];
1525   state->m_ambient_light_intensity = (UINT8)(node[36] >> 8) / 256.0f;
1459   m_parallel_light[0] = -*(float *)&node[5];
1460   m_parallel_light[1] = *(float *)&node[6];
1461   m_parallel_light[2] = *(float *)&node[4];
1462   m_parallel_light_intensity = *(float *)&node[7];
1463   m_ambient_light_intensity = (UINT8)(node[36] >> 8) / 256.0f;
15261464
15271465   /* set coordinate system matrix */
1528   load_matrix(state, 0, &state->m_coordinate_system);
1466   load_matrix(0, &m_coordinate_system);
15291467
15301468   /* process a link */
1531   process_link(machine, link_address, node[2]);
1469   process_link(link_address, node[2]);
15321470}
15331471
15341472
1535static void real3d_traverse_display_list(running_machine &machine)
1473void model3_state::real3d_traverse_display_list()
15361474{
1537   model3_state *state = machine.driver_data<model3_state>();
1538   int pri;
1475   init_matrix_stack();
15391476
1540   init_matrix_stack(machine);
1477   for (int pri = 0; pri < 4; pri++)
1478      draw_viewport(pri, 0x800000);
15411479
1542   for (pri = 0; pri < 4; pri++)
1543      draw_viewport(machine, pri, 0x800000);
1544
1545   poly_wait(state->m_poly, "real3d_traverse_display_list");
1480   poly_wait(m_poly, "real3d_traverse_display_list");
15461481}
branches/old_menus/src/mame/video/cps1.c
r29633r29634
8585Carrier Air Wing (USA 901012)                                      89624B-3   CA24B            IOB1  88622-C-5    CPS-B-16  DL-0411-10011  None
8686U.S. Navy (Japan 901012)                                           89625B-1   CA22B            IOB1  88622-C-5    CPS-B-16  DL-0411-10011  None
8787
88Nemo (World 901130)                                          1990  89624B-3   NM24B            IOB1  88622-C-5    CPS-B-15  DL-0411-10010  None
88Nemo (World 901109)                                          1990  89624B-3   NM24B            IOB1  88622-C-5    CPS-B-15  DL-0411-10010  None
89Nemo (World 901130)                                                89624B-3   NM24B            IOB1  88622-C-5    CPS-B-15  DL-0411-10010  None
8990Nemo (Japan 901120)                                                89625B-1   NM22B            ?     ?            CPS-B-15  DL-0411-10010
9091
9192Street Fighter II: The World Warrior (World 910214)          1991  90629B-2   STF29            IOB1  90632C-1     CPS-B-17  DL-0411-10012  C632
r29633r29634
13221323   {"mtwins",      CPS_B_14,     mapper_CK24B },
13231324   {"chikij",      CPS_B_14,     mapper_CK24B },   // wrong, this set uses CK22B, dumped but equations still not added
13241325   {"nemo",        CPS_B_15,     mapper_NM24B },
1325   {"nemoa",       CPS_B_15,     mapper_NM24B },
1326   {"nemor1",      CPS_B_15,     mapper_NM24B },
13261327   {"nemoj",       CPS_B_15,     mapper_NM24B },   // wrong, this set uses NM22B, still not dumped
13271328   {"cawing",      CPS_B_16,     mapper_CA24B },
13281329   {"cawingr1",    CPS_B_16,     mapper_CA24B },
Property changes on: branches/old_menus
Modified: svn:mergeinfo
   Merged /trunk:r29615-29633

Previous 199869 Revisions Next


© 1997-2024 The MAME Team