trunk/src/mess/includes/msx.h
| r31529 | r31530 | |
| 113 | 113 | public: |
| 114 | 114 | msx_state(const machine_config &mconfig, device_type type, const char *tag) |
| 115 | 115 | : 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) |
| 123 | 116 | , m_maincpu(*this, "maincpu") |
| 124 | 117 | , m_v9938(*this, "v9938") |
| 125 | 118 | , m_v9958(*this, "v9958") |
| r31529 | r31530 | |
| 141 | 134 | , m_io_key3(*this, "KEY3") |
| 142 | 135 | , m_io_key4(*this, "KEY4") |
| 143 | 136 | , 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) |
| 144 | 144 | { |
| 145 | 145 | for (int prim = 0; prim < 4; prim++ ) |
| 146 | 146 | { |
| r31529 | r31530 | |
| 182 | 182 | DECLARE_WRITE8_MEMBER(msx_switched_w); |
| 183 | 183 | DECLARE_WRITE_LINE_MEMBER(turbo_w); |
| 184 | 184 | |
| 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(); |
| 208 | 189 | |
| 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; |
| 216 | 190 | DECLARE_FLOPPY_FORMATS(floppy_formats); |
| 217 | 191 | |
| 218 | 192 | DECLARE_READ8_MEMBER(msx_psg_port_a_r); |
| r31529 | r31530 | |
| 229 | 203 | TIMER_DEVICE_CALLBACK_MEMBER(msx2p_interrupt); |
| 230 | 204 | DECLARE_WRITE8_MEMBER(msx_ay8910_w); |
| 231 | 205 | void msx_memory_init(); |
| 206 | void post_load(); |
| 232 | 207 | |
| 233 | 208 | DECLARE_WRITE_LINE_MEMBER(msx_irq_source0) { msx_irq_source(0, state); } // usually tms9918/v9938/v9958 |
| 234 | 209 | DECLARE_WRITE_LINE_MEMBER(msx_irq_source1) { msx_irq_source(1, state); } // usually first cartridge slot |
| r31529 | r31530 | |
| 238 | 213 | protected: |
| 239 | 214 | virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == 0) ? &m_switched_device_as_config : NULL; } |
| 240 | 215 | |
| 216 | private: |
| 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; |
| 241 | 224 | address_space_config m_switched_device_as_config; |
| 242 | 225 | required_memory_region m_region_maincpu; |
| 243 | 226 | optional_memory_region m_region_kanji; |
| r31529 | r31530 | |
| 253 | 236 | required_ioport m_io_key4; |
| 254 | 237 | required_ioport m_io_key5; |
| 255 | 238 | |
| 256 | | private: |
| 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 | |
| 257 | 259 | int m_irq_state[4]; |
| 258 | 260 | |
| 259 | 261 | void msx_irq_source(int source, int level); |
trunk/src/mess/machine/msx.c
| r31529 | r31530 | |
| 196 | 196 | msx_memory_init(); |
| 197 | 197 | |
| 198 | 198 | 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)); |
| 199 | 214 | } |
| 200 | 215 | |
| 216 | void 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 | |
| 201 | 227 | TIMER_DEVICE_CALLBACK_MEMBER(msx_state::msx2_interrupt) |
| 202 | 228 | { |
| 203 | 229 | m_v9938->set_resolution(m_io_dsw->read() & 0x03); |