trunk/src/mame/drivers/4enraya.c
| r20539 | r20540 | |
| 56 | 56 | |
| 57 | 57 | #include "emu.h" |
| 58 | 58 | #include "cpu/z80/z80.h" |
| 59 | | #include "sound/ay8910.h" |
| 60 | 59 | #include "machine/nvram.h" |
| 61 | 60 | #include "includes/4enraya.h" |
| 62 | 61 | |
| r20539 | r20540 | |
| 69 | 68 | |
| 70 | 69 | WRITE8_MEMBER(_4enraya_state::sound_control_w) |
| 71 | 70 | { |
| 72 | | device_t *device = machine().device("aysnd"); |
| 73 | | |
| 74 | 71 | if ((m_last_snd_ctrl & m_snd_latch_bit ) == m_snd_latch_bit && (data & m_snd_latch_bit) == 0x00) |
| 75 | | ay8910_data_address_w(device, space, m_last_snd_ctrl, m_soundlatch); |
| 72 | ay8910_data_address_w(m_ay, space, m_last_snd_ctrl, m_soundlatch); |
| 76 | 73 | |
| 77 | 74 | m_last_snd_ctrl = data; |
| 78 | 75 | } |
| 79 | 76 | |
| 80 | 77 | READ8_MEMBER(_4enraya_state::fenraya_custom_map_r) |
| 81 | 78 | { |
| 82 | | UINT8 *prom = memregion("pal_prom")->base(); |
| 83 | | UINT8 prom_routing = (prom[offset >> 12] & 0xf) ^ 0xf; |
| 79 | UINT8 prom_routing = (m_prom[offset >> 12] & 0xf) ^ 0xf; |
| 84 | 80 | UINT8 res; |
| 85 | 81 | |
| 86 | 82 | res = 0; |
| 87 | 83 | |
| 88 | 84 | if(prom_routing & 1) //ROM5 |
| 89 | 85 | { |
| 90 | | UINT8 *rom = memregion("maincpu")->base(); |
| 91 | | res |= rom[offset & 0x7fff]; |
| 86 | res |= m_rom[offset & 0x7fff]; |
| 92 | 87 | } |
| 93 | 88 | |
| 94 | 89 | if(prom_routing & 2) //ROM4 |
| 95 | 90 | { |
| 96 | | UINT8 *rom = memregion("maincpu")->base(); |
| 97 | | res |= rom[(offset & 0x7fff) | 0x8000]; |
| 91 | res |= m_rom[(offset & 0x7fff) | 0x8000]; |
| 98 | 92 | } |
| 99 | 93 | |
| 100 | 94 | if(prom_routing & 4) //RAM |
| r20539 | r20540 | |
| 112 | 106 | |
| 113 | 107 | WRITE8_MEMBER(_4enraya_state::fenraya_custom_map_w) |
| 114 | 108 | { |
| 115 | | UINT8 *prom = memregion("pal_prom")->base(); |
| 116 | | UINT8 prom_routing = (prom[offset >> 12] & 0xf) ^ 0xf; |
| 109 | UINT8 prom_routing = (m_prom[offset >> 12] & 0xf) ^ 0xf; |
| 117 | 110 | |
| 118 | 111 | if(prom_routing & 1) //ROM5 |
| 119 | 112 | { |
| r20539 | r20540 | |
| 296 | 289 | { |
| 297 | 290 | save_item(NAME(m_soundlatch)); |
| 298 | 291 | save_item(NAME(m_last_snd_ctrl)); |
| 292 | |
| 293 | m_prom = memregion("pal_prom")->base(); |
| 294 | m_rom = memregion("maincpu")->base(); |
| 295 | |
| 299 | 296 | } |
| 300 | 297 | |
| 301 | 298 | void _4enraya_state::machine_reset() |
trunk/src/mame/includes/4enraya.h
| r20539 | r20540 | |
| 4 | 4 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | #include "sound/ay8910.h" |
| 8 | |
| 7 | 9 | class _4enraya_state : public driver_device |
| 8 | 10 | { |
| 9 | 11 | public: |
| 10 | 12 | _4enraya_state(const machine_config &mconfig, device_type type, const char *tag) |
| 11 | 13 | : driver_device(mconfig, type, tag), |
| 12 | | m_snd_latch_bit(4) { } |
| 14 | m_ay(*this, "aysnd"), |
| 15 | m_snd_latch_bit(4) |
| 16 | { } |
| 13 | 17 | |
| 18 | |
| 19 | required_device<ay8910_device> m_ay; |
| 20 | |
| 14 | 21 | /* memory pointers */ |
| 15 | 22 | UINT8 m_videoram[0x1000]; |
| 16 | 23 | UINT8 m_workram[0x1000]; |
| r20539 | r20540 | |
| 30 | 37 | DECLARE_WRITE8_MEMBER(sound_control_w); |
| 31 | 38 | DECLARE_DRIVER_INIT(unkpacg); |
| 32 | 39 | TILE_GET_INFO_MEMBER(get_tile_info); |
| 40 | |
| 41 | UINT8* m_prom; |
| 42 | UINT8* m_rom; |
| 43 | |
| 33 | 44 | virtual void machine_start(); |
| 34 | 45 | virtual void machine_reset(); |
| 35 | 46 | virtual void video_start(); |