trunk/src/emu/bus/astrocde/exp.c
r241561 | r241562 | |
37 | 37 | //------------------------------------------------- |
38 | 38 | astrocade_exp_device::astrocade_exp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
39 | 39 | device_t(mconfig, ASTROCADE_EXP_SLOT, "Bally Astrocade expansion", tag, owner, clock, "astrocde_exp", __FILE__), |
40 | | device_slot_interface(mconfig, *this) |
| 40 | device_slot_interface(mconfig, *this), |
| 41 | m_card_mounted(false) |
41 | 42 | { |
42 | 43 | } |
43 | 44 | |
r241561 | r241562 | |
57 | 58 | void astrocade_exp_device::device_start() |
58 | 59 | { |
59 | 60 | m_card = dynamic_cast<device_astrocade_card_interface *>(get_card_device()); |
| 61 | if (m_card) |
| 62 | m_card_mounted = true; |
60 | 63 | } |
61 | 64 | |
62 | 65 | /*------------------------------------------------- |
trunk/src/emu/bus/astrocde/exp.h
r241561 | r241562 | |
13 | 13 | virtual ~device_astrocade_card_interface(); |
14 | 14 | |
15 | 15 | // reading and writing |
16 | | virtual DECLARE_READ8_MEMBER(read) { return 0; } |
| 16 | virtual DECLARE_READ8_MEMBER(read) { return 0xff; } |
17 | 17 | virtual DECLARE_WRITE8_MEMBER(write) {} |
18 | 18 | |
19 | 19 | protected: |
r241561 | r241562 | |
33 | 33 | // device-level overrides |
34 | 34 | virtual void device_start(); |
35 | 35 | |
| 36 | bool get_card_mounted() { return m_card_mounted; } |
| 37 | |
36 | 38 | // reading and writing |
37 | 39 | virtual DECLARE_READ8_MEMBER(read); |
38 | 40 | virtual DECLARE_WRITE8_MEMBER(write); |
39 | 41 | |
40 | 42 | protected: |
41 | | |
| 43 | bool m_card_mounted; |
42 | 44 | device_astrocade_card_interface* m_card; |
43 | 45 | }; |
44 | 46 | |
trunk/src/mess/drivers/astrocde.c
r241561 | r241562 | |
22 | 22 | public: |
23 | 23 | astrocde_mess_state(const machine_config &mconfig, device_type type, const char *tag) |
24 | 24 | : astrocde_state(mconfig, type, tag), |
25 | | m_cart(*this, "cartslot") |
| 25 | m_cart(*this, "cartslot"), |
| 26 | m_exp(*this, "exp") |
26 | 27 | { } |
27 | 28 | |
28 | 29 | required_device<astrocade_cart_slot_device> m_cart; |
| 30 | required_device<astrocade_exp_device> m_exp; |
29 | 31 | DECLARE_MACHINE_START(astrocde); |
30 | 32 | }; |
31 | 33 | |
r241561 | r241562 | |
47 | 49 | AM_RANGE(0x0000, 0x0fff) AM_ROM AM_WRITE(astrocade_funcgen_w) |
48 | 50 | AM_RANGE(0x1000, 0x3fff) AM_ROM /* Star Fortress writes in here?? */ |
49 | 51 | AM_RANGE(0x4000, 0x4fff) AM_RAM AM_SHARE("videoram") /* ASG */ |
50 | | AM_RANGE(0x5000, 0xffff) AM_DEVREADWRITE("exp", astrocade_exp_device, read, write) |
| 52 | //AM_RANGE(0x5000, 0xffff) AM_DEVREADWRITE("exp", astrocade_exp_device, read, write) |
51 | 53 | ADDRESS_MAP_END |
52 | 54 | |
53 | 55 | |
r241561 | r241562 | |
252 | 254 | { |
253 | 255 | if (m_cart->exists()) |
254 | 256 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x3fff, read8_delegate(FUNC(astrocade_cart_slot_device::read_rom),(astrocade_cart_slot_device*)m_cart)); |
| 257 | |
| 258 | // if no RAM is mounted and the handlers are installed, the system starts with garbage on screen and a RESET is necessary |
| 259 | // thus, install RAM only if an expansion is mounted |
| 260 | if (m_exp->get_card_mounted()) |
| 261 | m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x5000, 0xffff, read8_delegate(FUNC(astrocade_exp_device::read),(astrocade_exp_device*)m_exp), write8_delegate(FUNC(astrocade_exp_device::write),(astrocade_exp_device*)m_exp)); |
255 | 262 | } |
256 | 263 | |
257 | 264 | /************************************* |