Previous 15994 Revisions Next

r12139 Sunday 3rd July, 2011 at 17:13:01 UTC by Miodrag Milanović
Made coco cartslot also image device and in case ROM item is loading it will be auto changed to PAK device (no whatsnew)
[src/emu]dislot.h emuopts.c info.c mconfig.c
[src/mess/drivers]coco.c
[src/mess/machine]coco_pak.c cococart.c cococart.h

src/emu/emuopts.c
r12138r12139
251251         entry[0].name = slot->device().tag();
252252         entry[0].description = NULL;
253253         entry[0].flags = OPTION_STRING | OPTION_FLAG_DEVICE;
254         entry[0].defvalue = (slot->get_slot_interfaces() != NULL) ? slot->get_default_card() : NULL;
254         entry[0].defvalue = (slot->get_slot_interfaces() != NULL) ? slot->get_default_card(*this) : NULL;
255255         add_entries(entry, true);
256256
257257         added = true;
r12138r12139
345345      remove_device_options();
346346      add_device_options(true);
347347      bool isfirst = true;
348      result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
348349      while (add_slot_options(isfirst)) {
349350         result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
350351         add_device_options(false);
src/emu/info.c
r12138r12139
11071107      {
11081108         fprintf(m_output, "\t\t\t<slotoption");
11091109         fprintf(m_output, " name=\"%s\"", xml_normalize_string(intf[i].name));
1110         if (slot->get_default_card())
1110         if (slot->get_default_card(m_drivlist.options()))
11111111         {
1112            if (slot->get_default_card() == intf[i].name)
1112            if (slot->get_default_card(m_drivlist.options()) == intf[i].name)
11131113               fprintf(m_output, " default=\"yes\"");
11141114         }
11151115         fprintf(m_output, "/>\n");
src/emu/dislot.h
r12138r12139
4646
4747   static void static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card,const input_device_default *default_input);
4848   const slot_interface* get_slot_interfaces() const { return m_slot_interfaces; };
49   const char * get_default_card() const { return m_default_card; };
49   virtual const char * get_default_card(emu_options &options) const { return m_default_card; };
5050   const input_device_default *input_ports_defaults() const { return m_input_defaults; }
5151   device_t* get_card_device();
5252protected:
src/emu/mconfig.c
r12138r12139
7777         device_t &owner = slot->device();
7878         const char *selval = options.value(owner.tag());
7979         if (!options.exists(owner.tag()))
80            selval = slot->get_default_card();
80            selval = slot->get_default_card(options);
8181
8282         if (selval != NULL)
8383            for (int i = 0; intf[i].name != NULL; i++)
src/mess/machine/cococart.h
r12138r12139
6767
6868class cococart_slot_device : public device_t,
6969                      public cococart_interface,
70                      public device_slot_interface
70                      public device_slot_interface,
71                      public device_image_interface
7172{
7273public:
7374   // construction/destruction
r12138r12139
7879   virtual void device_start();
7980   virtual void device_config_complete();
8081   
82   // image-level overrides
83   virtual bool call_load();
84   virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry);
85
86   virtual iodevice_t image_type() const { return IO_CARTSLOT; }
87
88   virtual bool is_readable()  const { return 1; }
89   virtual bool is_writeable() const { return 0; }
90   virtual bool is_creatable() const { return 0; }
91   virtual bool must_be_loaded() const { return 0; }
92   virtual bool is_reset_on_load() const { return 1; }
93   virtual const char *image_interface() const { return "coco_cart"; }
94   virtual const char *file_extensions() const { return "ccc,rom"; }
95   virtual const option_guide *create_option_guide() const { return NULL; }
96   
97   // slot interface overrides
98   virtual const char * get_default_card(emu_options &options) const;
99   
81100   /* reading and writing to $FF40-$FF7F */
82101   DECLARE_READ8_MEMBER(read);
83102   DECLARE_WRITE8_MEMBER(write);
src/mess/machine/coco_pak.c
r12138r12139
1717***************************************************************************/
1818
1919static MACHINE_CONFIG_FRAGMENT(coco_pak)
20   MCFG_CARTSLOT_ADD(CARTSLOT_TAG)
21   MCFG_CARTSLOT_EXTENSION_LIST("ccc,rom")
22   MCFG_CARTSLOT_NOT_MANDATORY
23   MCFG_CARTSLOT_INTERFACE("coco_cart")
24
25   /* Software lists */
26   MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart")
2720MACHINE_CONFIG_END
2821
2922ROM_START( coco_pak )
r12138r12139
6457
6558void coco_pak_device::device_start()
6659{
67   m_cart = dynamic_cast<device_image_interface *>(subdevice(CARTSLOT_TAG));
60   m_cart = dynamic_cast<device_image_interface *>(owner());
6861   m_owner = dynamic_cast<cococart_slot_device *>(owner());
6962}
7063
src/mess/machine/cococart.c
r12138r12139
88
99#include "emu.h"
1010#include "cococart.h"
11#include "emuopts.h"
1112
1213/***************************************************************************
1314    PARAMETERS
r12138r12139
3031//-------------------------------------------------
3132cococart_slot_device::cococart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
3233        device_t(mconfig, COCOCART_SLOT, "CoCo Cartridge Slot", tag, owner, clock),
33      device_slot_interface(mconfig, *this)
34      device_slot_interface(mconfig, *this),
35      device_image_interface(mconfig, *this)
3436{
3537}
3638
r12138r12139
5052{
5153   for(int i=0; i<TIMER_POOL; i++ )
5254   {
53      m_cart_line.timer[i]      = device().machine().scheduler().timer_alloc(FUNC(cart_timer_callback), (void *) this);
54      m_nmi_line.timer[i]      = device().machine().scheduler().timer_alloc(FUNC(nmi_timer_callback), (void *)  this);
55      m_halt_line.timer[i]      = device().machine().scheduler().timer_alloc(FUNC(halt_timer_callback), (void *) this);
55      m_cart_line.timer[i]      = machine().scheduler().timer_alloc(FUNC(cart_timer_callback), (void *) this);
56      m_nmi_line.timer[i]      = machine().scheduler().timer_alloc(FUNC(nmi_timer_callback), (void *)  this);
57      m_halt_line.timer[i]      = machine().scheduler().timer_alloc(FUNC(halt_timer_callback), (void *) this);
5658   }
5759
5860   m_cart_line.timer_index     = 0;
r12138r12139
100102       memset(&m_nmi_callback,  0, sizeof(m_nmi_callback));
101103       memset(&m_halt_callback, 0, sizeof(m_halt_callback));
102104   }
105   
106   // set brief and instance name
107   update_names();
103108}
104109
105110/*-------------------------------------------------
r12138r12139
163168      line->value = value;
164169
165170      if (LOG_LINE)
166         logerror("[%s]: set_line(): %s <= %s\n", device().machine().describe_context(), line_name, line_value_string(value));
171         logerror("[%s]: set_line(): %s <= %s\n", machine().describe_context(), line_name, line_value_string(value));
167172      /* engage in a bit of gymnastics for this odious 'Q' value */
168173      switch(line->value)
169174      {
r12138r12139
230235{
231236   /* calculate delay; delay dependant on cycles per second */
232237   attotime delay = (line->delay != 0)
233      ? device().machine().firstcpu->cycles_to_attotime(line->delay)
238      ? machine().firstcpu->cycles_to_attotime(line->delay)
234239      : attotime::zero;
235240
236241   line->timer[line->timer_index]->adjust(delay, (int) value);
r12138r12139
301306   return NULL;
302307}
303308
309
310bool cococart_slot_device::call_load()
311{   
312   if (m_cart) {
313      offs_t read_length = 0;
314      if (software_entry() == NULL)
315      {
316         read_length = fread(m_cart->get_cart_base(), 0x8000);
317      }         
318      else
319      {
320         read_length = get_software_region_length("rom");
321         memcpy(m_cart->get_cart_base(), get_software_region("rom"), read_length);
322      }     
323      while(read_length < 0x8000)
324      {
325         offs_t len = MIN(read_length, 0x8000 - read_length);
326         memcpy(m_cart->get_cart_base() + read_length, m_cart->get_cart_base(), len);
327         read_length += len;
328      }
329   }
330   return IMAGE_INIT_PASS;
331}
332
333bool cococart_slot_device::call_softlist_load(char *swlist, char *swname, rom_entry *start_entry)
334{
335   load_software_part_region(this, swlist, swname, start_entry ); return TRUE;
336   return TRUE;
337}
338
339const char * cococart_slot_device::get_default_card(emu_options &options) const
340{
341   if (strlen(options.value(m_instance_name))>0) {
342      return "pak";
343   }
344   return m_default_card;   
345}
346
304347//**************************************************************************
305348//  DEVICE COCO CART  INTERFACE
306349//**************************************************************************
src/mess/drivers/coco.c
r12138r12139
831831   MCFG_RAM_ADD(RAM_TAG)
832832   MCFG_RAM_DEFAULT_SIZE("32K")
833833   MCFG_RAM_EXTRA_OPTIONS("64K")
834   
835   /* Software lists */
836   MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart")     
834837MACHINE_CONFIG_END
835838
836839static MACHINE_CONFIG_START( dragon64, coco_state )
r12138r12139
874877   /* internal ram */
875878   MCFG_RAM_ADD(RAM_TAG)
876879   MCFG_RAM_DEFAULT_SIZE("64K")
880   
881   /* Software lists */
882   MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart")     
877883MACHINE_CONFIG_END
878884
879885static MACHINE_CONFIG_START( d64plus, coco_state )
r12138r12139
918924   /* internal ram */
919925   MCFG_RAM_ADD(RAM_TAG)
920926   MCFG_RAM_DEFAULT_SIZE("128K")
927   
928   /* Software lists */
929   MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart")     
921930MACHINE_CONFIG_END
922931
923932static MACHINE_CONFIG_START( dgnalpha, coco_state )
r12138r12139
972981   /* internal ram */
973982   MCFG_RAM_ADD(RAM_TAG)
974983   MCFG_RAM_DEFAULT_SIZE("64K")
984   
985   /* Software lists */
986   MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart")     
975987MACHINE_CONFIG_END
976988
977989static MACHINE_CONFIG_START( tanodr64, coco_state )
r12138r12139
10161028   /* internal ram */
10171029   MCFG_RAM_ADD(RAM_TAG)
10181030   MCFG_RAM_DEFAULT_SIZE("64K")
1031   
1032   /* Software lists */
1033   MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart")     
10191034MACHINE_CONFIG_END
10201035
10211036static MACHINE_CONFIG_START( coco, coco_state )
r12138r12139
10591074   MCFG_RAM_ADD(RAM_TAG)
10601075   MCFG_RAM_DEFAULT_SIZE("16K")
10611076   MCFG_RAM_EXTRA_OPTIONS("4K,32K,64K")
1077   
1078   /* Software lists */
1079   MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart")     
10621080MACHINE_CONFIG_END
10631081
10641082static MACHINE_CONFIG_START( coco2, coco_state )
r12138r12139
11021120   MCFG_RAM_ADD(RAM_TAG)
11031121   MCFG_RAM_DEFAULT_SIZE("64K")
11041122   MCFG_RAM_EXTRA_OPTIONS("16K")
1123   
1124   /* Software lists */
1125   MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart")     
11051126MACHINE_CONFIG_END
11061127
11071128static MACHINE_CONFIG_START( coco2b, coco_state )
r12138r12139
11451166   MCFG_RAM_ADD(RAM_TAG)
11461167   MCFG_RAM_DEFAULT_SIZE("64K")
11471168   MCFG_RAM_EXTRA_OPTIONS("16K")
1169   
1170   /* Software lists */
1171   MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart")     
11481172MACHINE_CONFIG_END
11491173
11501174static MACHINE_CONFIG_START( coco3, coco3_state )
r12138r12139
11941218
11951219   MCFG_SAM6883_GIME_ADD("sam", coco3_sam_intf)
11961220
1197   MCFG_COCO_CARTRIDGE_ADD("ext", coco3_cococart_interface, coco_cart, "multi", NULL)
1221   MCFG_COCO_CARTRIDGE_ADD("ext", coco3_cococart_interface, coco_cart, "fdcv11", NULL)
11981222
11991223   /* internal ram */
12001224   MCFG_RAM_ADD(RAM_TAG)
12011225   MCFG_RAM_DEFAULT_SIZE("512K")
12021226   MCFG_RAM_EXTRA_OPTIONS("128K,2M,8M")
1227   
1228   /* Software lists */
1229   MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart")     
12031230MACHINE_CONFIG_END
12041231
12051232static MACHINE_CONFIG_DERIVED( coco3p, coco3 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team