Previous 199869 Revisions Next

r21855 Thursday 14th March, 2013 at 14:38:18 UTC by Fabio Priuli
(MESS) simplified handling of must_be_loaded for md slots. nw.
[src/mess/machine]md_sk.c md_sk.h md_slot.c md_slot.h nes_slot.h

trunk/src/mess/machine/md_slot.c
r21854r21855
5151
5252const device_type MD_CART_SLOT = &device_creator<md_cart_slot_device>;
5353const device_type PICO_CART_SLOT = &device_creator<pico_cart_slot_device>;
54const device_type MD_SUBCART_SLOT = &device_creator<md_subcart_slot_device>;
5554
5655
5756//**************************************************************************
r21854r21855
169168                  device_t(mconfig, type, name, tag, owner, clock),
170169                  device_image_interface(mconfig, *this),
171170                  device_slot_interface(mconfig, *this),
172                  m_type(SEGA_STD)
171                  m_type(SEGA_STD),
172                  m_must_be_loaded(1)
173173{
174174}
175175
r21854r21855
178178{
179179}
180180
181md_subcart_slot_device::md_subcart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
182                  base_md_cart_slot_device(mconfig, MD_SUBCART_SLOT, "MD Cartridge SubSlot", tag, owner, clock)
183{
184}
185
186181pico_cart_slot_device::pico_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
187182                  base_md_cart_slot_device(mconfig, PICO_CART_SLOT, "Pico Cartridge Slot", tag, owner, clock)
188183{
trunk/src/mess/machine/md_slot.h
r21854r21855
155155   virtual bool is_readable()  const { return 1; }
156156   virtual bool is_writeable() const { return 0; }
157157   virtual bool is_creatable() const { return 0; }
158   virtual bool must_be_loaded() const { return 1; }
158   virtual bool must_be_loaded() const { return m_must_be_loaded; }
159159   virtual bool is_reset_on_load() const { return 1; }
160160   virtual const option_guide *create_option_guide() const { return NULL; }
161161
r21854r21855
168168   
169169   void setup_custom_mappers();
170170   void setup_nvram();
171   
171   void set_must_be_loaded(bool _must_be_loaded) { m_must_be_loaded = _must_be_loaded; }
172
172173   // reading and writing
173174   virtual DECLARE_READ16_MEMBER(read);
174175   virtual DECLARE_WRITE16_MEMBER(write);
r21854r21855
183184   
184185   int m_type;
185186   device_md_cart_interface*       m_cart;
187   bool                            m_must_be_loaded;
186188};
187189
188190// ======================> md_cart_slot_device
r21854r21855
196198   virtual const char *file_extensions() const { return "smd,bin,md,gen"; }
197199};
198200
199
200// ======================> md_subcart_slot_device
201
202class md_subcart_slot_device :  public base_md_cart_slot_device
203{
204public:
205   // construction/destruction
206   md_subcart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
207   virtual bool must_be_loaded() const { return 0; }
208   virtual const char *image_interface() const { return "megadriv_cart"; }
209   virtual const char *file_extensions() const { return "smd,bin,md,gen"; }
210};
211
212
213201// ======================> pico_cart_slot_device
214202
215203class pico_cart_slot_device :  public base_md_cart_slot_device
r21854r21855
224212
225213// device type definition
226214extern const device_type MD_CART_SLOT;
227extern const device_type MD_SUBCART_SLOT;   // needed to allow S&K pass-through to have non-mandatory cart
228215extern const device_type PICO_CART_SLOT;
229216
230217
r21854r21855
236223   MCFG_DEVICE_ADD(_tag, MD_CART_SLOT, 0) \
237224   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
238225
239#define MCFG_MDSUB_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot,_def_inp) \
240   MCFG_DEVICE_ADD(_tag, MD_SUBCART_SLOT, 0) \
241   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
242
243226#define MCFG_PICO_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot,_def_inp) \
244227   MCFG_DEVICE_ADD(_tag, PICO_CART_SLOT, 0) \
245228   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
246229
230#define MCFG_MD_CARTRIDGE_NOT_MANDATORY                                     \
231   static_cast<md_cart_slot_device *>(device)->set_must_be_loaded(FALSE);
247232
233
248234#endif
trunk/src/mess/machine/nes_slot.h
r21854r21855
113113   virtual bool is_writeable() const { return 0; }
114114   virtual bool is_creatable() const { return 0; }
115115   virtual bool must_be_loaded() const { return m_must_be_loaded; }
116   void set_must_be_loaded(bool _must_be_loaded) { m_must_be_loaded = _must_be_loaded; }
117116   virtual bool is_reset_on_load() const { return 1; }
118117   virtual const char *image_interface() const { return "nes_cart"; }
119118   virtual const char *file_extensions() const { return "nes,unf,unif"; }
r21854r21855
142141   int m_vrc_ls_chr;
143142   int m_crc_hack;
144143
145   virtual int get_chr_open_bus() { return m_chr_open_bus; };
146   virtual int get_ce_mask() { return m_ce_mask; };
147   virtual int get_ce_state() { return m_ce_state; };
148   virtual int get_vrc_ls_prg_a() { return m_vrc_ls_prg_a; };
149   virtual int get_vrc_ls_prg_b() { return m_vrc_ls_prg_b; };
150   virtual int get_vrc_ls_chr() { return m_vrc_ls_chr; };
151   virtual int get_crc_hack() { return m_crc_hack; };
144   int get_chr_open_bus() { return m_chr_open_bus; };
145   int get_ce_mask() { return m_ce_mask; };
146   int get_ce_state() { return m_ce_state; };
147   int get_vrc_ls_prg_a() { return m_vrc_ls_prg_a; };
148   int get_vrc_ls_prg_b() { return m_vrc_ls_prg_b; };
149   int get_vrc_ls_chr() { return m_vrc_ls_chr; };
150   int get_crc_hack() { return m_crc_hack; };
152151
152   void set_must_be_loaded(bool _must_be_loaded) { m_must_be_loaded = _must_be_loaded; }
153
153154   //private:
154155
155156   device_nes_cart_interface*      m_cart;
trunk/src/mess/machine/md_sk.c
r21854r21855
7777SLOT_INTERFACE_END
7878
7979static MACHINE_CONFIG_FRAGMENT( sk_slot )
80   MCFG_MDSUB_CARTRIDGE_ADD("subslot", sk_sub_cart, NULL, NULL)
80   MCFG_MD_CARTRIDGE_ADD("subslot", sk_sub_cart, NULL, NULL)
81   MCFG_MD_CARTRIDGE_NOT_MANDATORY
8182MACHINE_CONFIG_END
8283
8384
trunk/src/mess/machine/md_sk.h
r21854r21855
2424   virtual DECLARE_WRITE16_MEMBER(write);
2525
2626private:
27   required_device<md_subcart_slot_device> m_exp;
27   required_device<md_cart_slot_device> m_exp;
2828};
2929
3030

Previous 199869 Revisions Next


© 1997-2024 The MAME Team