mirror of
https://github.com/holub/mame
synced 2025-06-06 12:53:46 +03:00
namcofl: use memory view instead of bankdev
This commit is contained in:
parent
3d630a232b
commit
8ec0c59257
@ -163,7 +163,6 @@ OSC3: 48.384MHz
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "includes/namcofl.h"
|
#include "includes/namcofl.h"
|
||||||
|
|
||||||
#include "cpu/i960/i960.h"
|
|
||||||
#include "sound/c352.h"
|
#include "sound/c352.h"
|
||||||
#include "machine/nvram.h"
|
#include "machine/nvram.h"
|
||||||
#include "speaker.h"
|
#include "speaker.h"
|
||||||
@ -194,14 +193,9 @@ void namcofl_state::sysreg_w(offs_t offset, uint32_t data, uint32_t mem_mask)
|
|||||||
{
|
{
|
||||||
if ((offset == 2) && ACCESSING_BITS_0_7) // address space configuration
|
if ((offset == 2) && ACCESSING_BITS_0_7) // address space configuration
|
||||||
{
|
{
|
||||||
if (data == 0) // RAM at 00000000, ROM at 10000000
|
// 0: RAM at 00000000, ROM at 10000000
|
||||||
{
|
// 1: ROM at 00000000, RAM at 10000000
|
||||||
set_bank(1);
|
m_mainbank.select(data & 1);
|
||||||
}
|
|
||||||
else // ROM at 00000000, RAM at 10000000
|
|
||||||
{
|
|
||||||
set_bank(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,8 +213,12 @@ void namcofl_state::c116_w(offs_t offset, uint8_t data)
|
|||||||
|
|
||||||
void namcofl_state::namcofl_mem(address_map &map)
|
void namcofl_state::namcofl_mem(address_map &map)
|
||||||
{
|
{
|
||||||
map(0x00000000, 0x000fffff).m(m_mainbank[0], FUNC(address_map_bank_device::amap32));
|
map(0x00000000, 0x1fffffff).view(m_mainbank);
|
||||||
map(0x10000000, 0x100fffff).m(m_mainbank[1], FUNC(address_map_bank_device::amap32));
|
m_mainbank[0](0x00000000, 0x000fffff).ram().share("workram");
|
||||||
|
m_mainbank[0](0x10000000, 0x100fffff).rom().region("maincpu", 0);
|
||||||
|
m_mainbank[1](0x00000000, 0x000fffff).rom().region("maincpu", 0);
|
||||||
|
m_mainbank[1](0x10000000, 0x100fffff).ram().share("workram");
|
||||||
|
|
||||||
map(0x20000000, 0x201fffff).rom().region("data", 0);
|
map(0x20000000, 0x201fffff).rom().region("data", 0);
|
||||||
map(0x30000000, 0x30001fff).ram().share("nvram"); /* nvram */
|
map(0x30000000, 0x30001fff).ram().share("nvram"); /* nvram */
|
||||||
map(0x30100000, 0x30100003).w(FUNC(namcofl_state::spritebank_w));
|
map(0x30100000, 0x30100003).w(FUNC(namcofl_state::spritebank_w));
|
||||||
@ -238,12 +236,6 @@ void namcofl_state::namcofl_mem(address_map &map)
|
|||||||
map(0xfffffffc, 0xffffffff).r(FUNC(namcofl_state::unk1_r));
|
map(0xfffffffc, 0xffffffff).r(FUNC(namcofl_state::unk1_r));
|
||||||
}
|
}
|
||||||
|
|
||||||
void namcofl_state::namcofl_bank_mem(address_map &map)
|
|
||||||
{
|
|
||||||
map(0x000000, 0x0fffff).rom().region("maincpu", 0);
|
|
||||||
map(0x100000, 0x1fffff).ram().share("workram");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void namcofl_state::mcu_shared_w(offs_t offset, uint16_t data, uint16_t mem_mask)
|
void namcofl_state::mcu_shared_w(offs_t offset, uint16_t data, uint16_t mem_mask)
|
||||||
{
|
{
|
||||||
@ -504,6 +496,8 @@ void namcofl_state::machine_start()
|
|||||||
m_raster_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcofl_state::raster_interrupt_callback),this));
|
m_raster_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcofl_state::raster_interrupt_callback),this));
|
||||||
m_network_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcofl_state::network_interrupt_callback),this));
|
m_network_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcofl_state::network_interrupt_callback),this));
|
||||||
m_vblank_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcofl_state::vblank_interrupt_callback),this));
|
m_vblank_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcofl_state::vblank_interrupt_callback),this));
|
||||||
|
|
||||||
|
m_mainbank.select(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -513,8 +507,7 @@ void namcofl_state::machine_reset()
|
|||||||
m_vblank_interrupt_timer->adjust(m_screen->time_until_pos(m_screen->visible_area().max_y + 1));
|
m_vblank_interrupt_timer->adjust(m_screen->time_until_pos(m_screen->visible_area().max_y + 1));
|
||||||
|
|
||||||
std::fill_n(&m_workram[0], m_workram.bytes() / 4, 0);
|
std::fill_n(&m_workram[0], m_workram.bytes() / 4, 0);
|
||||||
|
m_mainbank.select(1);
|
||||||
set_bank(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -523,13 +516,6 @@ void namcofl_state::namcofl(machine_config &config)
|
|||||||
I960(config, m_maincpu, 80_MHz_XTAL/4); // i80960KA-20 == 20 MHz part
|
I960(config, m_maincpu, 80_MHz_XTAL/4); // i80960KA-20 == 20 MHz part
|
||||||
m_maincpu->set_addrmap(AS_PROGRAM, &namcofl_state::namcofl_mem);
|
m_maincpu->set_addrmap(AS_PROGRAM, &namcofl_state::namcofl_mem);
|
||||||
|
|
||||||
for (int bank = 0; bank < 2; bank++)
|
|
||||||
{
|
|
||||||
ADDRESS_MAP_BANK(config, m_mainbank[bank]);
|
|
||||||
m_mainbank[bank]->set_map(&namcofl_state::namcofl_bank_mem);
|
|
||||||
m_mainbank[bank]->set_options(ENDIANNESS_LITTLE, 32, 21, 0x100000);
|
|
||||||
}
|
|
||||||
|
|
||||||
NAMCO_C75(config, m_mcu, 48.384_MHz_XTAL/3);
|
NAMCO_C75(config, m_mcu, 48.384_MHz_XTAL/3);
|
||||||
m_mcu->set_addrmap(AS_PROGRAM, &namcofl_state::namcoc75_am);
|
m_mcu->set_addrmap(AS_PROGRAM, &namcofl_state::namcoc75_am);
|
||||||
m_mcu->p6_in_cb().set(FUNC(namcofl_state::port6_r));
|
m_mcu->p6_in_cb().set(FUNC(namcofl_state::port6_r));
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
// license:BSD-3-Clause
|
// license:BSD-3-Clause
|
||||||
// copyright-holders:R. Belmont, ElSemi
|
// copyright-holders:R. Belmont, ElSemi
|
||||||
|
|
||||||
#include "machine/bankdev.h"
|
#include "cpu/i960/i960.h"
|
||||||
#include "machine/namcomcu.h"
|
#include "machine/namcomcu.h"
|
||||||
#include "machine/timer.h"
|
#include "machine/timer.h"
|
||||||
#include "screen.h"
|
|
||||||
#include "video/namco_c123tmap.h"
|
#include "video/namco_c123tmap.h"
|
||||||
#include "video/namco_c116.h"
|
#include "video/namco_c116.h"
|
||||||
#include "video/namco_c169roz.h"
|
#include "video/namco_c169roz.h"
|
||||||
#include "video/namco_c355spr.h"
|
#include "video/namco_c355spr.h"
|
||||||
|
|
||||||
#include "emupal.h"
|
#include "emupal.h"
|
||||||
|
#include "screen.h"
|
||||||
|
|
||||||
class namcofl_state : public driver_device
|
class namcofl_state : public driver_device
|
||||||
{
|
{
|
||||||
@ -17,22 +18,23 @@ public:
|
|||||||
namcofl_state(const machine_config &mconfig, device_type type, const char *tag) :
|
namcofl_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||||
driver_device(mconfig, type, tag),
|
driver_device(mconfig, type, tag),
|
||||||
m_maincpu(*this, "maincpu"),
|
m_maincpu(*this, "maincpu"),
|
||||||
m_mainbank(*this, "mainbank_%u", 1U),
|
|
||||||
m_c116(*this, "c116"),
|
m_c116(*this, "c116"),
|
||||||
m_screen(*this, "screen"),
|
m_screen(*this, "screen"),
|
||||||
m_c123tmap(*this, "c123tmap"),
|
m_c123tmap(*this, "c123tmap"),
|
||||||
m_c169roz(*this, "c169roz"),
|
m_c169roz(*this, "c169roz"),
|
||||||
m_c355spr(*this, "c355spr"),
|
m_c355spr(*this, "c355spr"),
|
||||||
m_mcu(*this, "mcu"),
|
m_mcu(*this, "mcu"),
|
||||||
|
m_workram(*this, "workram"),
|
||||||
|
m_shareram(*this, "shareram"),
|
||||||
|
m_mainbank(*this, "mainbank"),
|
||||||
m_in0(*this, "IN0"),
|
m_in0(*this, "IN0"),
|
||||||
m_in1(*this, "IN1"),
|
m_in1(*this, "IN1"),
|
||||||
m_in2(*this, "IN2"),
|
m_in2(*this, "IN2"),
|
||||||
m_misc(*this, "MISC"),
|
m_misc(*this, "MISC"),
|
||||||
m_accel(*this, "ACCEL"),
|
m_accel(*this, "ACCEL"),
|
||||||
m_brake(*this, "BRAKE"),
|
m_brake(*this, "BRAKE"),
|
||||||
m_wheel(*this, "WHEEL"),
|
m_wheel(*this, "WHEEL")
|
||||||
m_workram(*this, "workram"),
|
{ }
|
||||||
m_shareram(*this, "shareram") { }
|
|
||||||
|
|
||||||
void namcofl(machine_config &config);
|
void namcofl(machine_config &config);
|
||||||
|
|
||||||
@ -43,14 +45,16 @@ protected:
|
|||||||
virtual void machine_reset() override;
|
virtual void machine_reset() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
required_device<cpu_device> m_maincpu;
|
required_device<i960_cpu_device> m_maincpu;
|
||||||
required_device_array<address_map_bank_device, 2> m_mainbank;
|
|
||||||
required_device<namco_c116_device> m_c116;
|
required_device<namco_c116_device> m_c116;
|
||||||
required_device<screen_device> m_screen;
|
required_device<screen_device> m_screen;
|
||||||
required_device<namco_c123tmap_device> m_c123tmap;
|
required_device<namco_c123tmap_device> m_c123tmap;
|
||||||
required_device<namco_c169roz_device> m_c169roz;
|
required_device<namco_c169roz_device> m_c169roz;
|
||||||
required_device<namco_c355spr_device> m_c355spr;
|
required_device<namco_c355spr_device> m_c355spr;
|
||||||
required_device<m37710_cpu_device> m_mcu;
|
required_device<m37710_cpu_device> m_mcu;
|
||||||
|
required_shared_ptr<uint32_t> m_workram;
|
||||||
|
required_shared_ptr<uint32_t> m_shareram;
|
||||||
|
memory_view m_mainbank;
|
||||||
required_ioport m_in0;
|
required_ioport m_in0;
|
||||||
required_ioport m_in1;
|
required_ioport m_in1;
|
||||||
required_ioport m_in2;
|
required_ioport m_in2;
|
||||||
@ -58,21 +62,13 @@ private:
|
|||||||
optional_ioport m_accel;
|
optional_ioport m_accel;
|
||||||
optional_ioport m_brake;
|
optional_ioport m_brake;
|
||||||
optional_ioport m_wheel;
|
optional_ioport m_wheel;
|
||||||
|
|
||||||
emu_timer *m_raster_interrupt_timer;
|
emu_timer *m_raster_interrupt_timer;
|
||||||
emu_timer *m_vblank_interrupt_timer;
|
emu_timer *m_vblank_interrupt_timer;
|
||||||
emu_timer *m_network_interrupt_timer;
|
emu_timer *m_network_interrupt_timer;
|
||||||
required_shared_ptr<uint32_t> m_workram;
|
|
||||||
required_shared_ptr<uint32_t> m_shareram;
|
|
||||||
uint8_t m_mcu_port6;
|
uint8_t m_mcu_port6;
|
||||||
uint32_t m_sprbank;
|
uint32_t m_sprbank;
|
||||||
|
|
||||||
inline void set_bank(unsigned bank)
|
|
||||||
{
|
|
||||||
bank &= 1;
|
|
||||||
m_mainbank[0]->set_bank(bank); // ROM, RAM
|
|
||||||
m_mainbank[1]->set_bank(bank ^ 1); // RAM, ROM
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t unk1_r();
|
uint32_t unk1_r();
|
||||||
uint8_t network_r(offs_t offset);
|
uint8_t network_r(offs_t offset);
|
||||||
uint32_t sysreg_r();
|
uint32_t sysreg_r();
|
||||||
@ -103,5 +99,4 @@ private:
|
|||||||
void RozCB(uint16_t code, int *tile, int *mask, int which);
|
void RozCB(uint16_t code, int *tile, int *mask, int which);
|
||||||
void namcoc75_am(address_map &map);
|
void namcoc75_am(address_map &map);
|
||||||
void namcofl_mem(address_map &map);
|
void namcofl_mem(address_map &map);
|
||||||
void namcofl_bank_mem(address_map &map);
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user