misc chess drivers: use memory_share_creator instead of bankdev for 8bit nvram

This commit is contained in:
hap 2021-04-25 21:15:17 +02:00
parent 1933c8582c
commit 920100dbd2
7 changed files with 39 additions and 58 deletions

View file

@ -44,7 +44,6 @@ LCD module
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "machine/6821pia.h"
#include "machine/bankdev.h"
#include "machine/nvram.h"
#include "machine/sensorboard.h"
#include "sound/dac.h"
@ -64,6 +63,7 @@ public:
sphinx40_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_nvram(*this, "nvram", 0x800, ENDIANNESS_BIG),
m_pia(*this, "pia"),
m_lcd(*this, "lcd"),
m_display(*this, "display"),
@ -82,6 +82,7 @@ protected:
private:
// devices/pointers
required_device<cpu_device> m_maincpu;
memory_share_creator<u8> m_nvram;
required_device<pia6821_device> m_pia;
required_device<hd61603_device> m_lcd;
required_device<pwm_display_device> m_display;
@ -92,7 +93,6 @@ private:
// address maps
void main_map(address_map &map);
void nvram_map(address_map &map);
// I/O handlers
void lcd_seg_w(u64 data);
@ -106,6 +106,9 @@ private:
void input_w(u8 data);
void lcd_w(u8 data);
u8 nvram_r(offs_t offset) { return m_nvram[offset]; }
void nvram_w(offs_t offset, u8 data) { m_nvram[offset] = data; }
u8 m_cb_mux = 0;
u8 m_led_data = 0;
u8 m_inp_mux = 0;
@ -215,7 +218,7 @@ void sphinx40_state::main_map(address_map &map)
{
map(0x000000, 0x00ffff).rom();
map(0x100000, 0x11ffff).ram();
map(0x400000, 0x400fff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask16(0x00ff);
map(0x400000, 0x400fff).rw(FUNC(sphinx40_state::nvram_r), FUNC(sphinx40_state::nvram_w)).umask16(0x00ff);
map(0x70fcf1, 0x70fcf1).r(FUNC(sphinx40_state::cb_r));
map(0x70fd71, 0x70fd71).r(FUNC(sphinx40_state::input_r));
map(0x70fdb1, 0x70fdb1).w(FUNC(sphinx40_state::input_w));
@ -223,12 +226,6 @@ void sphinx40_state::main_map(address_map &map)
map(0x70fff0, 0x70fff7).rw(m_pia, FUNC(pia6821_device::read), FUNC(pia6821_device::write)).umask16(0xff00);
}
void sphinx40_state::nvram_map(address_map &map)
{
// nvram is 8-bit (2KB)
map(0x000, 0x7ff).ram().share("nvram");
}
/******************************************************************************
@ -286,7 +283,6 @@ void sphinx40_state::sphinx40(machine_config &config)
m_pia->cb2_handler().set("dac", FUNC(dac_bit_interface::write));
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
ADDRESS_MAP_BANK(config, "nvram_map").set_map(&sphinx40_state::nvram_map).set_options(ENDIANNESS_BIG, 8, 11);
SENSORBOARD(config, m_board).set_type(sensorboard_device::MAGNETS);
m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess));

View file

@ -17,7 +17,6 @@ TODO:
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "machine/bankdev.h"
#include "machine/nvram.h"
#include "machine/mmboard.h"
#include "video/mmdisplay2.h"
@ -32,6 +31,7 @@ public:
berlin_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_nvram(*this, "nvram", 0x2000, ENDIANNESS_BIG)
, m_board(*this, "board")
, m_display(*this, "display")
, m_keys(*this, "KEY")
@ -42,13 +42,16 @@ public:
private:
required_device<cpu_device> m_maincpu;
memory_share_creator<u8> m_nvram;
required_device<mephisto_board_device> m_board;
required_device<mephisto_display2_device> m_display;
required_ioport m_keys;
void berlin_mem(address_map &map);
void berlinp_mem(address_map &map);
void nvram_map(address_map &map);
u8 nvram_r(offs_t offset) { return m_nvram[offset]; }
void nvram_w(offs_t offset, u8 data) { m_nvram[offset] = data; }
u8 input_r();
};
@ -72,22 +75,17 @@ u8 berlin_state::input_r()
Address Maps
******************************************************************************/
void berlin_state::nvram_map(address_map &map)
{
// nvram is 8-bit (8KB)
map(0x0000, 0x1fff).ram().share("nvram");
}
void berlin_state::berlin_mem(address_map &map)
{
map(0x000000, 0x01ffff).rom();
map(0x800000, 0x87ffff).ram();
map(0x900000, 0x903fff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask16(0xff00);
map(0x900000, 0x903fff).rw(FUNC(berlin_state::nvram_r), FUNC(berlin_state::nvram_w)).umask16(0xff00);
map(0xa00000, 0xa00000).r(FUNC(berlin_state::input_r));
map(0xb00000, 0xb00000).w(m_board, FUNC(mephisto_board_device::mux_w));
map(0xc00000, 0xc00000).w(m_display, FUNC(mephisto_display2_device::latch_w));
map(0xd00008, 0xd00008).w(m_display, FUNC(mephisto_display2_device::io_w));
map(0xe00000, 0xe00000).w(m_board, FUNC(mephisto_board_device::led_w));
map(0xe00000, 0xe00001).nopr(); // clr.b
}
void berlin_state::berlinp_mem(address_map &map)
@ -99,7 +97,7 @@ void berlin_state::berlinp_mem(address_map &map)
map(0xa00000, 0xa00000).w(m_board, FUNC(mephisto_board_device::led_w));
map(0xb00000, 0xb00000).w(m_display, FUNC(mephisto_display2_device::io_w));
map(0xc00000, 0xc00000).w(m_display, FUNC(mephisto_display2_device::latch_w));
map(0xd00000, 0xd07fff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask32(0xff000000);
map(0xd00000, 0xd07fff).rw(FUNC(berlin_state::nvram_r), FUNC(berlin_state::nvram_w)).umask32(0xff000000);
}
@ -136,7 +134,6 @@ void berlin_state::berlin(machine_config &config)
m_maincpu->set_periodic_int(FUNC(berlin_state::irq2_line_hold), irq_period);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
ADDRESS_MAP_BANK(config, "nvram_map").set_map(&berlin_state::nvram_map).set_options(ENDIANNESS_BIG, 8, 13);
MEPHISTO_BUTTONS_BOARD(config, m_board); // internal
subdevice<sensorboard_device>("board:board")->set_nvram_enable(true);

View file

@ -84,7 +84,6 @@ Reminder: unsupported on Almeria and Portorose 1.01, this is not a bug.
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "machine/bankdev.h"
#include "machine/nvram.h"
#include "machine/timer.h"
#include "machine/mmboard.h"
@ -104,6 +103,7 @@ public:
mmodular_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_nvram(*this, "nvram", 0x2000, ENDIANNESS_BIG),
m_board(*this, "board"),
m_bav_busy(*this, "bav_busy"),
m_fake(*this, "FAKE")
@ -127,6 +127,7 @@ protected:
private:
// devices/pointers
required_device<cpu_device> m_maincpu;
memory_share_creator<u8> m_nvram;
required_device<mephisto_board_device> m_board;
required_device<timer_device> m_bav_busy;
optional_ioport m_fake;
@ -139,13 +140,15 @@ private:
void van16_mem(address_map &map);
void van32_mem(address_map &map);
void gen32_mem(address_map &map);
void nvram_map(address_map &map);
// I/O handlers
void bavaria_w(u8 data);
u8 bavaria1_r();
u8 bavaria2_r();
u8 nvram_r(offs_t offset) { return m_nvram[offset]; }
void nvram_w(offs_t offset, u8 data) { m_nvram[offset] = data; }
u8 spawn_cb(offs_t offset);
void set_sbtype(ioport_value newval);
@ -234,17 +237,11 @@ u8 mmodular_state::bavaria2_r()
Address Maps
******************************************************************************/
void mmodular_state::nvram_map(address_map &map)
{
// nvram is 8-bit (8KB)
map(0x0000, 0x1fff).ram().share("nvram");
}
void mmodular_state::alm16_mem(address_map &map)
{
map(0x000000, 0x01ffff).rom();
map(0x400000, 0x47ffff).ram();
map(0x800000, 0x803fff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask16(0xff00);
map(0x800000, 0x803fff).rw(FUNC(mmodular_state::nvram_r), FUNC(mmodular_state::nvram_w)).umask16(0xff00);
map(0xc00000, 0xc00000).r("board", FUNC(mephisto_board_device::input_r)); // 0xff on Bavaria
map(0xc80000, 0xc80000).w("board", FUNC(mephisto_board_device::mux_w));
map(0xd00000, 0xd00000).w("board", FUNC(mephisto_board_device::led_w));
@ -285,7 +282,7 @@ void mmodular_state::alm32_mem(address_map &map)
map(0x90000000, 0x90000007).w("board", FUNC(mephisto_board_device::led_w)).umask32(0xff000000);
map(0xa0000000, 0xa0000000).w("display", FUNC(mephisto_display2_device::latch_w));
map(0xa0000010, 0xa0000010).w("display", FUNC(mephisto_display2_device::io_w));
map(0xa8000000, 0xa8007fff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask32(0xff000000);
map(0xa8000000, 0xa8007fff).rw(FUNC(mmodular_state::nvram_r), FUNC(mmodular_state::nvram_w)).umask32(0xff000000);
}
void mmodular_state::port32_mem(address_map &map)
@ -320,7 +317,7 @@ void mmodular_state::gen32_mem(address_map &map)
map(0xd800000c, 0xd800000c).r(FUNC(mmodular_state::bavaria2_r));
map(0xe0000000, 0xe0000000).w("display", FUNC(mephisto_display2_device::latch_w));
map(0xe0000010, 0xe0000010).w("display", FUNC(mephisto_display2_device::io_w));
map(0xe8000000, 0xe8007fff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask32(0xff000000);
map(0xe8000000, 0xe8007fff).rw(FUNC(mmodular_state::nvram_r), FUNC(mmodular_state::nvram_w)).umask32(0xff000000);
map(0xf0000004, 0xf0000007).portr("KEY1");
map(0xf0000008, 0xf000000b).portr("KEY2");
map(0xf0000010, 0xf0000013).portr("KEY3");
@ -407,7 +404,6 @@ void mmodular_state::alm16(machine_config &config)
m_maincpu->set_periodic_int(FUNC(mmodular_state::irq2_line_hold), attotime::from_hz(600));
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
ADDRESS_MAP_BANK(config, "nvram_map").set_map(&mmodular_state::nvram_map).set_options(ENDIANNESS_BIG, 8, 13);
MEPHISTO_SENSORS_BOARD(config, m_board);
subdevice<sensorboard_device>("board:board")->set_spawnpoints(12+2); // 2 jokers

View file

@ -43,7 +43,6 @@ After boot, it copies ROM to RAM, probably to circumvent waitstates on slow ROM.
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "machine/bankdev.h"
#include "machine/nvram.h"
#include "machine/timer.h"
#include "machine/mmboard.h"
@ -63,6 +62,7 @@ public:
m_maincpu(*this, "maincpu"),
m_rom(*this, "maincpu"),
m_mainram(*this, "mainram"),
m_nvram(*this, "nvram", 0x2000, ENDIANNESS_BIG),
m_disable_bootrom(*this, "disable_bootrom"),
m_fake(*this, "FAKE")
{ }
@ -83,13 +83,16 @@ private:
required_device<cpu_device> m_maincpu;
required_region_ptr<u32> m_rom;
required_shared_ptr<u32> m_mainram;
memory_share_creator<u8> m_nvram;
required_device<timer_device> m_disable_bootrom;
optional_ioport m_fake;
// address maps
void mmtm_2m_map(address_map &map);
void mmtm_8m_map(address_map &map);
void nvram_map(address_map &map);
u8 nvram_r(offs_t offset) { return m_nvram[offset]; }
void nvram_w(offs_t offset, u8 data) { m_nvram[offset] = data; }
void install_bootrom(bool enable);
TIMER_DEVICE_CALLBACK_MEMBER(disable_bootrom) { install_bootrom(false); }
@ -145,18 +148,12 @@ void mmtm_state::set_cpu_freq()
Address Maps
******************************************************************************/
void mmtm_state::nvram_map(address_map &map)
{
// nvram is 8-bit (8KB) - this makes sure that endianness is correct
map(0x0000, 0x1fff).ram().share("nvram");
}
void mmtm_state::mmtm_2m_map(address_map &map)
{
map(0x00000000, 0x0003ffff).ram().share("mainram");
map(0x80000000, 0x801fffff).ram();
map(0xf0000000, 0xf003ffff).rom().region("maincpu", 0);
map(0xfc000000, 0xfc001fff).m("nvram_map", FUNC(address_map_bank_device::amap8));
map(0xfc000000, 0xfc001fff).rw(FUNC(mmtm_state::nvram_r), FUNC(mmtm_state::nvram_w)).umask32(0xffffffff);
map(0xfc020004, 0xfc020007).portr("KEY1");
map(0xfc020008, 0xfc02000b).portr("KEY2");
map(0xfc020010, 0xfc020013).portr("KEY3");
@ -223,7 +220,6 @@ void mmtm_state::mmtm_v(machine_config &config)
TIMER(config, "disable_bootrom").configure_generic(FUNC(mmtm_state::disable_bootrom));
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
ADDRESS_MAP_BANK(config, "nvram_map").set_map(&mmtm_state::nvram_map).set_options(ENDIANNESS_BIG, 8, 13);
MEPHISTO_SENSORS_BOARD(config, "board");
subdevice<sensorboard_device>("board:board")->set_nvram_enable(true);

View file

@ -895,22 +895,22 @@ void ufo_state::ufo800(machine_config &config)
ROM_START( newufo )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "epr-13896.bin", 0x000000, 0x010000, CRC(ca94be57) SHA1(acb6a22940c5e9ce639c7c30eb3948324b223090) )
ROM_LOAD( "epr-13896.ic21", 0x000000, 0x010000, CRC(ca94be57) SHA1(acb6a22940c5e9ce639c7c30eb3948324b223090) )
ROM_END
ROM_START( newufo_sonic )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "epr-14124.bin", 0x000000, 0x010000, CRC(2bdbad89) SHA1(10de4b266471a68083ec4bc439b301b6587ccfd6) )
ROM_LOAD( "epr-14124.ic21", 0x000000, 0x010000, CRC(2bdbad89) SHA1(10de4b266471a68083ec4bc439b301b6587ccfd6) )
ROM_END
ROM_START( newufo_nfl )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "epr-15261.bin", 0x000000, 0x010000, CRC(338c00d3) SHA1(03152956c6f1e4d5a1a11ee49f94a8c5eb550815) )
ROM_LOAD( "epr-15261.ic21", 0x000000, 0x010000, CRC(338c00d3) SHA1(03152956c6f1e4d5a1a11ee49f94a8c5eb550815) )
ROM_END
ROM_START( newufo_xmas )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "epr-15340.bin", 0x000000, 0x010000, CRC(6287c9ac) SHA1(bc6bc84bb432424e1d25e01113e8e331fa64f96f) )
ROM_LOAD( "epr-15340.ic21", 0x000000, 0x010000, CRC(6287c9ac) SHA1(bc6bc84bb432424e1d25e01113e8e331fa64f96f) )
ROM_END

View file

@ -59,7 +59,6 @@ TODO:
#include "emu.h"
#include "cpu/arm/arm.h"
#include "machine/bankdev.h"
#include "machine/nvram.h"
#include "machine/ram.h"
#include "machine/smartboard.h"
@ -83,6 +82,7 @@ public:
m_maincpu(*this, "maincpu"),
m_rom(*this, "maincpu"),
m_ram(*this, "ram"),
m_nvram(*this, "nvram", 0x20000, ENDIANNESS_LITTLE),
m_lcd(*this, "lcd"),
m_smartboard(*this, "smartboard"),
m_speaker(*this, "speaker"),
@ -105,6 +105,7 @@ private:
required_device<arm_cpu_device> m_maincpu;
required_region_ptr<u32> m_rom;
required_device<ram_device> m_ram;
memory_share_creator<u8> m_nvram;
required_device<lm24014h_device> m_lcd;
required_device<tasc_sb30_device> m_smartboard;
required_device<speaker_sound_device> m_speaker;
@ -113,13 +114,15 @@ private:
output_finder<2> m_out_leds;
void main_map(address_map &map);
void nvram_map(address_map &map);
// I/O handlers
u32 input_r();
u32 rom_r(offs_t offset);
void control_w(offs_t offset, u32 data, u32 mem_mask = ~0);
u8 nvram_r(offs_t offset) { return m_nvram[offset]; }
void nvram_w(offs_t offset, u8 data) { m_nvram[offset] = data; }
void set_cpu_freq();
void install_bootrom(bool enable);
TIMER_DEVICE_CALLBACK_MEMBER(disable_bootrom) { install_bootrom(false); }
@ -261,13 +264,7 @@ void tasc_state::main_map(address_map &map)
{
map(0x01000000, 0x01000003).rw(FUNC(tasc_state::input_r), FUNC(tasc_state::control_w));
map(0x02000000, 0x0203ffff).r(FUNC(tasc_state::rom_r));
map(0x03000000, 0x0307ffff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask32(0x000000ff);
}
void tasc_state::nvram_map(address_map &map)
{
// nvram is 8-bit (128KB)
map(0x00000, 0x1ffff).ram().share("nvram");
map(0x03000000, 0x0307ffff).rw(FUNC(tasc_state::nvram_r), FUNC(tasc_state::nvram_w)).umask32(0x000000ff);
}
@ -326,7 +323,6 @@ void tasc_state::tasc(machine_config &config)
m_ram->set_default_value(0);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
ADDRESS_MAP_BANK(config, "nvram_map").set_map(&tasc_state::nvram_map).set_options(ENDIANNESS_LITTLE, 8, 17);
TASC_SB30(config, m_smartboard);
subdevice<sensorboard_device>("smartboard:board")->set_nvram_enable(true);

View file

@ -22,7 +22,7 @@ license:CC0
<element name="hlb" defstate="0">
<rect state="0">
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
<color red="0.0" green="0.0" blue="0.0" />
<color red="0.1" green="0.1" blue="0.1" />
</rect>
<rect state="1">
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />