Previous 199869 Revisions Next

r31530 Wednesday 6th August, 2014 at 17:18:52 UTC by Wilbert Pol
(MESS) msx.c: Made members private and added members to save state (nw)
[src/mess/includes]msx.h
[src/mess/machine]msx.c

trunk/src/mess/includes/msx.h
r31529r31530
113113public:
114114   msx_state(const machine_config &mconfig, device_type type, const char *tag)
115115      : driver_device(mconfig, type, tag)
116      , m_psg_b(0)
117      , m_rtc_latch(0)
118      , m_kanji_latch(0)
119      , m_primary_slot(0)
120      , m_port_c_old(0)
121      , m_keylatch(0)
122      , m_current_switched_device(0)
123116      , m_maincpu(*this, "maincpu")
124117      , m_v9938(*this, "v9938")
125118      , m_v9958(*this, "v9958")
r31529r31530
141134      , m_io_key3(*this, "KEY3")
142135      , m_io_key4(*this, "KEY4")
143136      , m_io_key5(*this, "KEY5")
137      , m_psg_b(0)
138      , m_rtc_latch(0)
139      , m_kanji_latch(0)
140      , m_primary_slot(0)
141      , m_port_c_old(0)
142      , m_keylatch(0)
143      , m_current_switched_device(0)
144144   {
145145      for (int prim = 0; prim < 4; prim++ )
146146      {
r31529r31530
182182   DECLARE_WRITE8_MEMBER(msx_switched_w);
183183   DECLARE_WRITE_LINE_MEMBER(turbo_w);
184184
185   /* PSG */
186   int m_psg_b;
187   /* mouse */
188   UINT16 m_mouse[2];
189   int m_mouse_stat[2];
190   /* rtc */
191   int m_rtc_latch;
192   /* kanji */
193   int m_kanji_latch;
194   /* memory */
195   msx_internal_slot_interface m_empty_slot;
196   msx_internal_slot_interface *m_all_slots[4][4][4];
197   msx_internal_slot_interface *m_current_page[4];
198   bool m_slot_expanded[4];
199   UINT8 m_primary_slot;
200   UINT8 m_secondary_slot[4];
201   int m_port_c_old;
202   int m_keylatch;
203   UINT8 m_current_switched_device;
204   void msx_memory_map_all ();
205   void msx_memory_map_page (UINT8 page);
206   void msx_ch_reset_core ();
207   void msx_memory_reset ();
185   void msx_memory_map_all();
186   void msx_memory_map_page(UINT8 page);
187   void msx_ch_reset_core();
188   void msx_memory_reset();
208189
209   required_device<z80_device> m_maincpu;
210   optional_device<v9938_device> m_v9938;
211   optional_device<v9958_device> m_v9958;
212   required_device<cassette_image_device> m_cassette;
213   required_device<ay8910_device> m_ay8910;
214   required_device<dac_device> m_dac;
215   optional_device<rp5c01_device> m_rtc;
216190   DECLARE_FLOPPY_FORMATS(floppy_formats);
217191
218192   DECLARE_READ8_MEMBER(msx_psg_port_a_r);
r31529r31530
229203   TIMER_DEVICE_CALLBACK_MEMBER(msx2p_interrupt);
230204   DECLARE_WRITE8_MEMBER(msx_ay8910_w);
231205   void msx_memory_init();
206   void post_load();
232207
233208   DECLARE_WRITE_LINE_MEMBER(msx_irq_source0) { msx_irq_source(0, state); }  // usually tms9918/v9938/v9958
234209   DECLARE_WRITE_LINE_MEMBER(msx_irq_source1) { msx_irq_source(1, state); }  // usually first cartridge slot
r31529r31530
238213protected:
239214   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == 0) ? &m_switched_device_as_config : NULL; }
240215
216private:
217   required_device<z80_device> m_maincpu;
218   optional_device<v9938_device> m_v9938;
219   optional_device<v9958_device> m_v9958;
220   required_device<cassette_image_device> m_cassette;
221   required_device<ay8910_device> m_ay8910;
222   required_device<dac_device> m_dac;
223   optional_device<rp5c01_device> m_rtc;
241224   address_space_config m_switched_device_as_config;
242225   required_memory_region m_region_maincpu;
243226   optional_memory_region m_region_kanji;
r31529r31530
253236   required_ioport m_io_key4;
254237   required_ioport m_io_key5;
255238
256private:
239   /* PSG */
240   int m_psg_b;
241   /* mouse */
242   UINT16 m_mouse[2];
243   int m_mouse_stat[2];
244   /* rtc */
245   int m_rtc_latch;
246   /* kanji */
247   int m_kanji_latch;
248   /* memory */
249   msx_internal_slot_interface m_empty_slot;
250   msx_internal_slot_interface *m_all_slots[4][4][4];
251   msx_internal_slot_interface *m_current_page[4];
252   bool m_slot_expanded[4];
253   UINT8 m_primary_slot;
254   UINT8 m_secondary_slot[4];
255   int m_port_c_old;
256   int m_keylatch;
257   UINT8 m_current_switched_device;
258
257259   int m_irq_state[4];
258260
259261   void msx_irq_source(int source, int level);
trunk/src/mess/machine/msx.c
r31529r31530
196196   msx_memory_init();
197197
198198   m_maincpu->z80_set_cycle_tables( cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex );
199
200   save_item(NAME(m_psg_b));
201   save_item(NAME(m_mouse));
202   save_item(NAME(m_mouse_stat));
203   save_item(NAME(m_rtc_latch));
204   save_item(NAME(m_kanji_latch));
205   save_item(NAME(m_slot_expanded));
206   save_item(NAME(m_primary_slot));
207   save_item(NAME(m_secondary_slot));
208   save_item(NAME(m_port_c_old));
209   save_item(NAME(m_keylatch));
210   save_item(NAME(m_current_switched_device));
211   save_item(NAME(m_irq_state));
212
213   machine().save().register_postload(save_prepost_delegate(FUNC(msx_state::post_load), this));
199214}
200215
216void msx_state::post_load()
217{
218   for (int page = 0; page < 4; page++)
219   {
220      int slot_primary = (m_primary_slot >> (page * 2)) & 3;
221      int slot_secondary = (m_secondary_slot[slot_primary] >> (page * 2)) & 3;
222
223      m_current_page[page] = m_all_slots[slot_primary][slot_secondary][page];
224   }
225}
226
201227TIMER_DEVICE_CALLBACK_MEMBER(msx_state::msx2_interrupt)
202228{
203229   m_v9938->set_resolution(m_io_dsw->read() & 0x03);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team