sg1000.cpp, sms.cpp & associated buses: Simplify handler signatures (nw)

This commit is contained in:
AJR 2020-05-31 13:50:26 -04:00
parent b2991c51fe
commit b68afeeac4
20 changed files with 307 additions and 309 deletions

View File

@ -33,15 +33,15 @@ sega8_cardcatch_device::sega8_cardcatch_device(const machine_config &mconfig, co
mapper specific handlers mapper specific handlers
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_cardcatch_device::read_cart) uint8_t sega8_cardcatch_device::read_cart(offs_t offset)
{ {
if (offset < 0x8000) if (offset < 0x8000)
return m_card->read_cart(space, offset); return m_card->read_cart(offset);
return 0xff; return 0xff;
} }
WRITE8_MEMBER(sega8_cardcatch_device::write_cart) void sega8_cardcatch_device::write_cart(offs_t offset, uint8_t data)
{ {
// this should never happen, because there is no RAM on cards // this should never happen, because there is no RAM on cards
if (offset < 0x8000) if (offset < 0x8000)

View File

@ -17,9 +17,9 @@ public:
sega8_cardcatch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_cardcatch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override {} virtual void write_mapper(offs_t offset, uint8_t data) override {}
protected: protected:
virtual void device_add_mconfig(machine_config &config) override; virtual void device_add_mconfig(machine_config &config) override;

View File

@ -18,9 +18,9 @@ public:
sega8_mgear_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_mgear_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override { return m_subslot->read_cart(space, offset); } virtual uint8_t read_cart(offs_t offset) override { return m_subslot->read_cart(offset); }
virtual DECLARE_WRITE8_MEMBER(write_cart) override { m_subslot->write_cart(space, offset, data); } virtual void write_cart(offs_t offset, uint8_t data) override { m_subslot->write_cart(offset, data); }
virtual DECLARE_WRITE8_MEMBER(write_mapper) override { m_subslot->write_mapper(space, offset, data); } virtual void write_mapper(offs_t offset, uint8_t data) override { m_subslot->write_mapper(offset, data); }
virtual int get_lphaser_xoffs() override { return m_subslot->get_lphaser_xoffs(); } virtual int get_lphaser_xoffs() override { return m_subslot->get_lphaser_xoffs(); }
protected: protected:

View File

@ -383,7 +383,7 @@ void sega8_korean_device::late_bank_setup()
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_rom_device::read_cart) uint8_t sega8_rom_device::read_cart(offs_t offset)
{ {
int bank = offset / 0x4000; int bank = offset / 0x4000;
@ -396,7 +396,7 @@ READ8_MEMBER(sega8_rom_device::read_cart)
return m_rom[m_rom_bank_base[bank] * 0x4000 + (offset & 0x3fff)]; return m_rom[m_rom_bank_base[bank] * 0x4000 + (offset & 0x3fff)];
} }
WRITE8_MEMBER(sega8_rom_device::write_cart) void sega8_rom_device::write_cart(offs_t offset, uint8_t data)
{ {
int bank = offset / 0x4000; int bank = offset / 0x4000;
@ -404,7 +404,7 @@ WRITE8_MEMBER(sega8_rom_device::write_cart)
m_ram[(m_ram_base * 0x4000 + (offset & 0x3fff)) % m_ram.size()] = data; m_ram[(m_ram_base * 0x4000 + (offset & 0x3fff)) % m_ram.size()] = data;
} }
WRITE8_MEMBER(sega8_rom_device::write_mapper) void sega8_rom_device::write_mapper(offs_t offset, uint8_t data)
{ {
switch (offset) switch (offset)
{ {
@ -439,7 +439,7 @@ WRITE8_MEMBER(sega8_rom_device::write_mapper)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_othello_device::read_cart) uint8_t sega8_othello_device::read_cart(offs_t offset)
{ {
// 8K of RAM sits in 0x8000-0x9fff // 8K of RAM sits in 0x8000-0x9fff
if (offset >= 0x8000 && offset < 0xa000) if (offset >= 0x8000 && offset < 0xa000)
@ -448,7 +448,7 @@ READ8_MEMBER(sega8_othello_device::read_cart)
return m_rom[offset % m_rom_size]; return m_rom[offset % m_rom_size];
} }
WRITE8_MEMBER(sega8_othello_device::write_cart) void sega8_othello_device::write_cart(offs_t offset, uint8_t data)
{ {
// 2K of RAM sits in 0x8000-0x9fff // 2K of RAM sits in 0x8000-0x9fff
if (offset >= 0x8000 && offset < 0xa000) if (offset >= 0x8000 && offset < 0xa000)
@ -463,7 +463,7 @@ WRITE8_MEMBER(sega8_othello_device::write_cart)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_castle_device::read_cart) uint8_t sega8_castle_device::read_cart(offs_t offset)
{ {
// 8K of RAM sits in 0x8000-0x9fff // 8K of RAM sits in 0x8000-0x9fff
if (offset >= 0x8000 && offset < 0xa000) if (offset >= 0x8000 && offset < 0xa000)
@ -472,7 +472,7 @@ READ8_MEMBER(sega8_castle_device::read_cart)
return m_rom[offset % m_rom_size]; return m_rom[offset % m_rom_size];
} }
WRITE8_MEMBER(sega8_castle_device::write_cart) void sega8_castle_device::write_cart(offs_t offset, uint8_t data)
{ {
// 8K of RAM sits in 0x8000-0x9fff // 8K of RAM sits in 0x8000-0x9fff
if (offset >= 0x8000 && offset < 0xa000) if (offset >= 0x8000 && offset < 0xa000)
@ -487,7 +487,7 @@ WRITE8_MEMBER(sega8_castle_device::write_cart)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_basic_l3_device::read_cart) uint8_t sega8_basic_l3_device::read_cart(offs_t offset)
{ {
// 8K of RAM sits in 0x8000-0x9fff // 8K of RAM sits in 0x8000-0x9fff
if (offset >= 0x8000) if (offset >= 0x8000)
@ -496,19 +496,19 @@ READ8_MEMBER(sega8_basic_l3_device::read_cart)
return m_rom[offset % m_rom_size]; return m_rom[offset % m_rom_size];
} }
WRITE8_MEMBER(sega8_basic_l3_device::write_cart) void sega8_basic_l3_device::write_cart(offs_t offset, uint8_t data)
{ {
// 8K of RAM sits in 0x8000-0x9fff // 8K of RAM sits in 0x8000-0x9fff
if (offset >= 0x8000) if (offset >= 0x8000)
m_ram[offset & 0x3fff] = data; m_ram[offset & 0x3fff] = data;
} }
READ8_MEMBER(sega8_basic_l3_device::read_ram) uint8_t sega8_basic_l3_device::read_ram(offs_t offset)
{ {
return m_ram[0x4000 + (offset & 0x3fff)]; return m_ram[0x4000 + (offset & 0x3fff)];
} }
WRITE8_MEMBER(sega8_basic_l3_device::write_ram) void sega8_basic_l3_device::write_ram(offs_t offset, uint8_t data)
{ {
m_ram[0x4000 + (offset & 0x3fff)] = data; m_ram[0x4000 + (offset & 0x3fff)] = data;
} }
@ -521,7 +521,7 @@ WRITE8_MEMBER(sega8_basic_l3_device::write_ram)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_music_editor_device::read_cart) uint8_t sega8_music_editor_device::read_cart(offs_t offset)
{ {
// 8K of RAM sits in 0x8000-0x9fff // 8K of RAM sits in 0x8000-0x9fff
if (offset >= 0x8000 && offset < 0xa000) if (offset >= 0x8000 && offset < 0xa000)
@ -530,21 +530,21 @@ READ8_MEMBER(sega8_music_editor_device::read_cart)
return m_rom[offset % m_rom_size]; return m_rom[offset % m_rom_size];
} }
WRITE8_MEMBER(sega8_music_editor_device::write_cart) void sega8_music_editor_device::write_cart(offs_t offset, uint8_t data)
{ {
// 8K of RAM sits in 0x8000-0x9fff // 8K of RAM sits in 0x8000-0x9fff
if (offset >= 0x8000 && offset < 0xa000) if (offset >= 0x8000 && offset < 0xa000)
m_ram[offset & 0x1fff] = data; m_ram[offset & 0x1fff] = data;
} }
READ8_MEMBER(sega8_music_editor_device::read_ram) uint8_t sega8_music_editor_device::read_ram(offs_t offset)
{ {
// 2K more of RAM sits in 0xc000-0xc3ff (and mirrored up to 0xffff) // 2K more of RAM sits in 0xc000-0xc3ff (and mirrored up to 0xffff)
// or should it simply go to the 2K of SC3000 RAM??? // or should it simply go to the 2K of SC3000 RAM???
return m_ram[0x2000 + (offset & 0x7ff)]; return m_ram[0x2000 + (offset & 0x7ff)];
} }
WRITE8_MEMBER(sega8_music_editor_device::write_ram) void sega8_music_editor_device::write_ram(offs_t offset, uint8_t data)
{ {
// 2K more of RAM sits in 0xc000-0xc3ff (and mirrored up to 0xffff) // 2K more of RAM sits in 0xc000-0xc3ff (and mirrored up to 0xffff)
// or should it simply go to the 2K of SC3000 RAM??? // or should it simply go to the 2K of SC3000 RAM???
@ -576,7 +576,7 @@ WRITE8_MEMBER(sega8_music_editor_device::write_ram)
*/ */
READ8_MEMBER(sega8_terebi_device::read_cart) uint8_t sega8_terebi_device::read_cart(offs_t offset)
{ {
int bank = offset / 0x4000; int bank = offset / 0x4000;
@ -588,7 +588,7 @@ READ8_MEMBER(sega8_terebi_device::read_cart)
return m_rom[m_rom_bank_base[bank] * 0x4000 + (offset & 0x3fff)]; return m_rom[m_rom_bank_base[bank] * 0x4000 + (offset & 0x3fff)];
} }
WRITE8_MEMBER(sega8_terebi_device::write_cart) void sega8_terebi_device::write_cart(offs_t offset, uint8_t data)
{ {
switch (offset) switch (offset)
{ {
@ -640,7 +640,7 @@ ioport_constructor sega8_terebi_device::device_input_ports() const
-------------------------------------------------*/ -------------------------------------------------*/
// TYPE A // TYPE A
READ8_MEMBER(sega8_dahjee_typea_device::read_cart) uint8_t sega8_dahjee_typea_device::read_cart(offs_t offset)
{ {
// 8K of RAM sits in 0x2000-0x3fff // 8K of RAM sits in 0x2000-0x3fff
if (offset >= 0x2000 && offset < 0x4000) if (offset >= 0x2000 && offset < 0x4000)
@ -649,21 +649,21 @@ READ8_MEMBER(sega8_dahjee_typea_device::read_cart)
return m_rom[offset % m_rom_size]; return m_rom[offset % m_rom_size];
} }
WRITE8_MEMBER(sega8_dahjee_typea_device::write_cart) void sega8_dahjee_typea_device::write_cart(offs_t offset, uint8_t data)
{ {
// 8K of RAM sits in 0x2000-0x3fff // 8K of RAM sits in 0x2000-0x3fff
if (offset >= 0x2000 && offset < 0x4000) if (offset >= 0x2000 && offset < 0x4000)
m_ram[offset & 0x1fff] = data; m_ram[offset & 0x1fff] = data;
} }
READ8_MEMBER(sega8_dahjee_typea_device::read_ram) uint8_t sega8_dahjee_typea_device::read_ram(offs_t offset)
{ {
// 1K more of RAM sits in 0xc000-0xc3ff (and mirrored up to 0xffff // 1K more of RAM sits in 0xc000-0xc3ff (and mirrored up to 0xffff
// or should it simply go to the 1K of SG1000 RAM??? // or should it simply go to the 1K of SG1000 RAM???
return m_ram[0x2000 + (offset & 0x3ff)]; return m_ram[0x2000 + (offset & 0x3ff)];
} }
WRITE8_MEMBER(sega8_dahjee_typea_device::write_ram) void sega8_dahjee_typea_device::write_ram(offs_t offset, uint8_t data)
{ {
// 1K more of RAM sits in 0xc000-0xc3ff (and mirrored up to 0xffff // 1K more of RAM sits in 0xc000-0xc3ff (and mirrored up to 0xffff
// or should it simply go to the 1K of SG1000 RAM??? // or should it simply go to the 1K of SG1000 RAM???
@ -672,18 +672,18 @@ WRITE8_MEMBER(sega8_dahjee_typea_device::write_ram)
// TYPE B // TYPE B
READ8_MEMBER(sega8_dahjee_typeb_device::read_cart) uint8_t sega8_dahjee_typeb_device::read_cart(offs_t offset)
{ {
return m_rom[offset % m_rom_size]; return m_rom[offset % m_rom_size];
} }
READ8_MEMBER(sega8_dahjee_typeb_device::read_ram) uint8_t sega8_dahjee_typeb_device::read_ram(offs_t offset)
{ {
// 8K more of RAM sits in 0xc000-0xffff // 8K more of RAM sits in 0xc000-0xffff
return m_ram[offset & 0x1fff]; return m_ram[offset & 0x1fff];
} }
WRITE8_MEMBER(sega8_dahjee_typeb_device::write_ram) void sega8_dahjee_typeb_device::write_ram(offs_t offset, uint8_t data)
{ {
// 8K more of RAM sits in 0xc000-0xffff // 8K more of RAM sits in 0xc000-0xffff
m_ram[offset & 0x1fff] = data; m_ram[offset & 0x1fff] = data;
@ -700,7 +700,7 @@ WRITE8_MEMBER(sega8_dahjee_typeb_device::write_ram)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_eeprom_device::read_cart) uint8_t sega8_eeprom_device::read_cart(offs_t offset)
{ {
int bank = offset / 0x4000; int bank = offset / 0x4000;
@ -717,7 +717,7 @@ READ8_MEMBER(sega8_eeprom_device::read_cart)
return m_rom[m_rom_bank_base[bank] * 0x4000 + (offset & 0x3fff)]; return m_rom[m_rom_bank_base[bank] * 0x4000 + (offset & 0x3fff)];
} }
WRITE8_MEMBER(sega8_eeprom_device::write_cart) void sega8_eeprom_device::write_cart(offs_t offset, uint8_t data)
{ {
if (offset == 0x8000 && m_93c46_enabled) if (offset == 0x8000 && m_93c46_enabled)
{ {
@ -728,7 +728,7 @@ WRITE8_MEMBER(sega8_eeprom_device::write_cart)
} }
} }
WRITE8_MEMBER(sega8_eeprom_device::write_mapper) void sega8_eeprom_device::write_mapper(offs_t offset, uint8_t data)
{ {
switch (offset) switch (offset)
{ {
@ -764,7 +764,7 @@ void sega8_eeprom_device::device_add_mconfig(machine_config &config)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_codemasters_device::read_cart) uint8_t sega8_codemasters_device::read_cart(offs_t offset)
{ {
int bank = offset / 0x2000; int bank = offset / 0x2000;
@ -774,7 +774,7 @@ READ8_MEMBER(sega8_codemasters_device::read_cart)
return m_rom[m_rom_bank_base[bank/2] * 0x4000 + (offset & 0x3fff)]; return m_rom[m_rom_bank_base[bank/2] * 0x4000 + (offset & 0x3fff)];
} }
WRITE8_MEMBER(sega8_codemasters_device::write_cart) void sega8_codemasters_device::write_cart(offs_t offset, uint8_t data)
{ {
int bank = offset / 0x2000; int bank = offset / 0x2000;
@ -811,7 +811,7 @@ WRITE8_MEMBER(sega8_codemasters_device::write_cart)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_4pak_device::read_cart) uint8_t sega8_4pak_device::read_cart(offs_t offset)
{ {
int bank = offset / 0x4000; int bank = offset / 0x4000;
@ -819,7 +819,7 @@ READ8_MEMBER(sega8_4pak_device::read_cart)
} }
WRITE8_MEMBER(sega8_4pak_device::write_cart) void sega8_4pak_device::write_cart(offs_t offset, uint8_t data)
{ {
switch (offset) switch (offset)
{ {
@ -846,7 +846,7 @@ WRITE8_MEMBER(sega8_4pak_device::write_cart)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_zemina_device::read_cart) uint8_t sega8_zemina_device::read_cart(offs_t offset)
{ {
int bank = offset / 0x2000; int bank = offset / 0x2000;
@ -856,7 +856,7 @@ READ8_MEMBER(sega8_zemina_device::read_cart)
return m_rom[m_rom_bank_base[bank] * 0x2000 + (offset & 0x1fff)]; return m_rom[m_rom_bank_base[bank] * 0x2000 + (offset & 0x1fff)];
} }
WRITE8_MEMBER(sega8_zemina_device::write_cart) void sega8_zemina_device::write_cart(offs_t offset, uint8_t data)
{ {
int bank = offset / 0x2000; int bank = offset / 0x2000;
@ -902,7 +902,7 @@ WRITE8_MEMBER(sega8_zemina_device::write_cart)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_janggun_device::read_cart) uint8_t sega8_janggun_device::read_cart(offs_t offset)
{ {
int bank = offset / 0x2000; int bank = offset / 0x2000;
@ -913,7 +913,7 @@ READ8_MEMBER(sega8_janggun_device::read_cart)
} }
WRITE8_MEMBER(sega8_janggun_device::write_cart) void sega8_janggun_device::write_cart(offs_t offset, uint8_t data)
{ {
switch (offset) switch (offset)
{ {
@ -932,7 +932,7 @@ WRITE8_MEMBER(sega8_janggun_device::write_cart)
} }
} }
WRITE8_MEMBER(sega8_janggun_device::write_mapper) void sega8_janggun_device::write_mapper(offs_t offset, uint8_t data)
{ {
switch (offset) switch (offset)
{ {
@ -956,7 +956,7 @@ WRITE8_MEMBER(sega8_janggun_device::write_mapper)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_hicom_device::read_cart) uint8_t sega8_hicom_device::read_cart(offs_t offset)
{ {
if (offset >= 0x8000) if (offset >= 0x8000)
return m_rom[offset & 0x3fff]; return m_rom[offset & 0x3fff];
@ -964,7 +964,7 @@ READ8_MEMBER(sega8_hicom_device::read_cart)
return m_rom[(m_rom_bank_base * 0x8000) + offset]; return m_rom[(m_rom_bank_base * 0x8000) + offset];
} }
WRITE8_MEMBER(sega8_hicom_device::write_mapper) void sega8_hicom_device::write_mapper(offs_t offset, uint8_t data)
{ {
if (offset == 0x03) if (offset == 0x03)
m_rom_bank_base = data % (m_rom_page_count << 1); m_rom_bank_base = data % (m_rom_page_count << 1);
@ -977,7 +977,7 @@ WRITE8_MEMBER(sega8_hicom_device::write_mapper)
-------------------------------------------------*/ -------------------------------------------------*/
WRITE8_MEMBER(sega8_korean_device::write_cart) void sega8_korean_device::write_cart(offs_t offset, uint8_t data)
{ {
int bank = offset / 0x4000; int bank = offset / 0x4000;
@ -1012,7 +1012,7 @@ void sega8_seojin_device::device_reset()
} }
READ8_MEMBER(sega8_seojin_device::read_cart) uint8_t sega8_seojin_device::read_cart(offs_t offset)
{ {
int bank = offset / 0x4000; int bank = offset / 0x4000;
@ -1024,11 +1024,11 @@ READ8_MEMBER(sega8_seojin_device::read_cart)
return m_rom[bank_to_use * 0x4000 + (offset & 0x3fff)]^m_readxor; return m_rom[bank_to_use * 0x4000 + (offset & 0x3fff)]^m_readxor;
} }
WRITE8_MEMBER(sega8_seojin_device::write_cart) void sega8_seojin_device::write_cart(offs_t offset, uint8_t data)
{ {
} }
WRITE8_MEMBER(sega8_seojin_device::write_mapper) void sega8_seojin_device::write_mapper(offs_t offset, uint8_t data)
{ {
switch (offset) switch (offset)
{ {
@ -1045,7 +1045,7 @@ WRITE8_MEMBER(sega8_seojin_device::write_mapper)
// it might not have RAM inside, but the only way to get 0xfff0 to fall through to the cart with the current hook-up // it might not have RAM inside, but the only way to get 0xfff0 to fall through to the cart with the current hook-up
// is by saying there is. // is by saying there is.
WRITE8_MEMBER(sega8_seojin_device::write_ram) void sega8_seojin_device::write_ram(offs_t offset, uint8_t data)
{ {
m_ram[offset & 0x3fff] = data; m_ram[offset & 0x3fff] = data;
@ -1055,7 +1055,7 @@ WRITE8_MEMBER(sega8_seojin_device::write_ram)
} }
} }
READ8_MEMBER(sega8_seojin_device::read_ram) uint8_t sega8_seojin_device::read_ram(offs_t offset)
{ {
return m_ram[offset & 0x3fff]; return m_ram[offset & 0x3fff];
} }
@ -1066,7 +1066,7 @@ READ8_MEMBER(sega8_seojin_device::read_ram)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_multicart_device::read_cart) uint8_t sega8_multicart_device::read_cart(offs_t offset)
{ {
// 16K of RAM sits in 0x8000-0xbfff // 16K of RAM sits in 0x8000-0xbfff
if (offset >= 0x8000) if (offset >= 0x8000)
@ -1075,24 +1075,24 @@ READ8_MEMBER(sega8_multicart_device::read_cart)
return m_rom[(offset & 0x7fff) | (m_block << 15) % m_rom_size]; return m_rom[(offset & 0x7fff) | (m_block << 15) % m_rom_size];
} }
WRITE8_MEMBER(sega8_multicart_device::write_cart) void sega8_multicart_device::write_cart(offs_t offset, uint8_t data)
{ {
// 16K of RAM sits in 0x8000-0xbfff // 16K of RAM sits in 0x8000-0xbfff
if (offset >= 0x8000) if (offset >= 0x8000)
m_ram[offset & 0x3fff] = data; m_ram[offset & 0x3fff] = data;
} }
READ8_MEMBER(sega8_multicart_device::read_ram) uint8_t sega8_multicart_device::read_ram(offs_t offset)
{ {
return m_ram[0x4000 + (offset & 0x3fff)]; return m_ram[0x4000 + (offset & 0x3fff)];
} }
WRITE8_MEMBER(sega8_multicart_device::write_ram) void sega8_multicart_device::write_ram(offs_t offset, uint8_t data)
{ {
m_ram[0x4000 + (offset & 0x3fff)] = data; m_ram[0x4000 + (offset & 0x3fff)] = data;
} }
WRITE8_MEMBER(sega8_multicart_device::write_io) void sega8_multicart_device::write_io(offs_t offset, uint8_t data)
{ {
if ((offset & 0xe0) == 0xe0) if ((offset & 0xe0) == 0xe0)
m_block = (data & 0x80) ? ((data & 0x1f) | ((data & 0x40) ? 0x20 : 0x00)) : 0x3f; m_block = (data & 0x80) ? ((data & 0x1f) | ((data & 0x40) ? 0x20 : 0x00)) : 0x3f;
@ -1104,7 +1104,7 @@ WRITE8_MEMBER(sega8_multicart_device::write_io)
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_megacart_device::read_cart) uint8_t sega8_megacart_device::read_cart(offs_t offset)
{ {
// 16K of RAM sits in 0x8000-0xbfff // 16K of RAM sits in 0x8000-0xbfff
if (offset >= 0x8000) if (offset >= 0x8000)
@ -1113,24 +1113,24 @@ READ8_MEMBER(sega8_megacart_device::read_cart)
return m_rom[(offset & 0x7fff) | (m_block << 15) % m_rom_size]; return m_rom[(offset & 0x7fff) | (m_block << 15) % m_rom_size];
} }
WRITE8_MEMBER(sega8_megacart_device::write_cart) void sega8_megacart_device::write_cart(offs_t offset, uint8_t data)
{ {
// 16K of RAM sits in 0x8000-0xbfff // 16K of RAM sits in 0x8000-0xbfff
if (offset >= 0x8000) if (offset >= 0x8000)
m_ram[offset & 0x3fff] = data; m_ram[offset & 0x3fff] = data;
} }
READ8_MEMBER(sega8_megacart_device::read_ram) uint8_t sega8_megacart_device::read_ram(offs_t offset)
{ {
return m_ram[0x4000 + (offset & 0x3fff)]; return m_ram[0x4000 + (offset & 0x3fff)];
} }
WRITE8_MEMBER(sega8_megacart_device::write_ram) void sega8_megacart_device::write_ram(offs_t offset, uint8_t data)
{ {
m_ram[0x4000 + (offset & 0x3fff)] = data; m_ram[0x4000 + (offset & 0x3fff)] = data;
} }
WRITE8_MEMBER(sega8_megacart_device::write_io) void sega8_megacart_device::write_io(offs_t offset, uint8_t data)
{ {
if ((offset & 0xe0) == 0xe0) if ((offset & 0xe0) == 0xe0)
m_block = (data & 0x1f) | (data & 0xc0) >> 1; m_block = (data & 0x1f) | (data & 0xc0) >> 1;

View File

@ -20,9 +20,9 @@ public:
virtual void late_bank_setup() override; virtual void late_bank_setup() override;
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override; virtual void write_mapper(offs_t offset, uint8_t data) override;
protected: protected:
sega8_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); sega8_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@ -48,9 +48,9 @@ public:
sega8_othello_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_othello_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override { } virtual void write_mapper(offs_t offset, uint8_t data) override { }
}; };
@ -63,9 +63,9 @@ public:
sega8_castle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_castle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override { } virtual void write_mapper(offs_t offset, uint8_t data) override { }
}; };
@ -78,13 +78,13 @@ public:
sega8_basic_l3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_basic_l3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override { } virtual void write_mapper(offs_t offset, uint8_t data) override { }
// has internal RAM which overwrites the system one! // has internal RAM which overwrites the system one!
virtual DECLARE_READ8_MEMBER(read_ram) override; virtual uint8_t read_ram(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_ram) override; virtual void write_ram(offs_t offset, uint8_t data) override;
}; };
@ -97,13 +97,13 @@ public:
sega8_music_editor_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_music_editor_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override { } virtual void write_mapper(offs_t offset, uint8_t data) override { }
// has internal RAM which overwrites the system one! // has internal RAM which overwrites the system one!
virtual DECLARE_READ8_MEMBER(read_ram) override; virtual uint8_t read_ram(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_ram) override; virtual void write_ram(offs_t offset, uint8_t data) override;
}; };
@ -123,9 +123,9 @@ public:
required_ioport m_tvdraw_pen; required_ioport m_tvdraw_pen;
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override { } virtual void write_mapper(offs_t offset, uint8_t data) override { }
protected: protected:
virtual void device_start() override; virtual void device_start() override;
@ -144,13 +144,13 @@ public:
sega8_dahjee_typea_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_dahjee_typea_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override { } virtual void write_mapper(offs_t offset, uint8_t data) override { }
// has internal RAM which overwrites the system one! // has internal RAM which overwrites the system one!
virtual DECLARE_READ8_MEMBER(read_ram) override; virtual uint8_t read_ram(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_ram) override; virtual void write_ram(offs_t offset, uint8_t data) override;
}; };
@ -163,13 +163,13 @@ public:
sega8_dahjee_typeb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_dahjee_typeb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override { } virtual void write_cart(offs_t offset, uint8_t data) override { }
virtual DECLARE_WRITE8_MEMBER(write_mapper) override { } virtual void write_mapper(offs_t offset, uint8_t data) override { }
// has internal RAM which overwrites the system one! // has internal RAM which overwrites the system one!
virtual DECLARE_READ8_MEMBER(read_ram) override; virtual uint8_t read_ram(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_ram) override; virtual void write_ram(offs_t offset, uint8_t data) override;
}; };
@ -187,9 +187,9 @@ public:
virtual void late_bank_setup() override; virtual void late_bank_setup() override;
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override; virtual void write_mapper(offs_t offset, uint8_t data) override;
protected: protected:
virtual void device_start() override; virtual void device_start() override;
@ -218,8 +218,8 @@ public:
virtual void late_bank_setup() override; virtual void late_bank_setup() override;
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
// no mapper write for this! // no mapper write for this!
protected: protected:
@ -242,8 +242,8 @@ public:
sega8_4pak_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_4pak_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
protected: protected:
// device-level overrides // device-level overrides
@ -267,8 +267,8 @@ public:
virtual void late_bank_setup() override; virtual void late_bank_setup() override;
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
// no mapper write for this! // no mapper write for this!
protected: protected:
@ -308,9 +308,9 @@ public:
virtual void late_bank_setup() override; virtual void late_bank_setup() override;
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override; virtual void write_mapper(offs_t offset, uint8_t data) override;
protected: protected:
// device-level overrides // device-level overrides
@ -331,9 +331,9 @@ public:
virtual void late_bank_setup() override; virtual void late_bank_setup() override;
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override {} virtual void write_cart(offs_t offset, uint8_t data) override {}
virtual DECLARE_WRITE8_MEMBER(write_mapper) override; virtual void write_mapper(offs_t offset, uint8_t data) override;
protected: protected:
// device-level overrides // device-level overrides
@ -354,8 +354,8 @@ public:
virtual void late_bank_setup() override; virtual void late_bank_setup() override;
// reading and writing // reading and writing
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override {} virtual void write_mapper(offs_t offset, uint8_t data) override {}
}; };
@ -368,7 +368,7 @@ public:
sega8_korean_nb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_korean_nb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_WRITE8_MEMBER(write_mapper) override {} virtual void write_mapper(offs_t offset, uint8_t data) override {}
}; };
@ -381,11 +381,11 @@ public:
sega8_seojin_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_seojin_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override; virtual void write_mapper(offs_t offset, uint8_t data) override;
virtual DECLARE_READ8_MEMBER(read_ram) override; virtual uint8_t read_ram(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_ram) override; virtual void write_ram(offs_t offset, uint8_t data) override;
protected: protected:
// device-level overrides // device-level overrides
@ -406,13 +406,13 @@ public:
sega8_multicart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_multicart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_io) override; virtual void write_io(offs_t offset, uint8_t data) override;
// has internal RAM which overwrites the system one! // has internal RAM which overwrites the system one!
virtual DECLARE_READ8_MEMBER(read_ram) override; virtual uint8_t read_ram(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_ram) override; virtual void write_ram(offs_t offset, uint8_t data) override;
protected: protected:
// device-level overrides // device-level overrides
@ -433,13 +433,13 @@ public:
sega8_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sega8_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) override; virtual uint8_t read_cart(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_cart) override; virtual void write_cart(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_io) override; virtual void write_io(offs_t offset, uint8_t data) override;
// has internal RAM which overwrites the system one! // has internal RAM which overwrites the system one!
virtual DECLARE_READ8_MEMBER(read_ram) override; virtual uint8_t read_ram(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_ram) override; virtual void write_ram(offs_t offset, uint8_t data) override;
protected: protected:
// device-level overrides // device-level overrides

View File

@ -685,26 +685,26 @@ std::string sega8_cart_slot_device::get_default_card_software(get_default_card_s
read read
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER(sega8_cart_slot_device::read_cart) uint8_t sega8_cart_slot_device::read_cart(offs_t offset)
{ {
if (m_cart) if (m_cart)
return m_cart->read_cart(space, offset); return m_cart->read_cart(offset);
else else
return 0xff; return 0xff;
} }
READ8_MEMBER(sega8_cart_slot_device::read_ram) uint8_t sega8_cart_slot_device::read_ram(offs_t offset)
{ {
if (m_cart) if (m_cart)
return m_cart->read_ram(space, offset); return m_cart->read_ram(offset);
else else
return 0xff; return 0xff;
} }
READ8_MEMBER(sega8_cart_slot_device::read_io) uint8_t sega8_cart_slot_device::read_io(offs_t offset)
{ {
if (m_cart) if (m_cart)
return m_cart->read_io(space, offset); return m_cart->read_io(offset);
else else
return 0xff; return 0xff;
} }
@ -714,28 +714,28 @@ READ8_MEMBER(sega8_cart_slot_device::read_io)
write write
-------------------------------------------------*/ -------------------------------------------------*/
WRITE8_MEMBER(sega8_cart_slot_device::write_mapper) void sega8_cart_slot_device::write_mapper(offs_t offset, uint8_t data)
{ {
if (m_cart) if (m_cart)
m_cart->write_mapper(space, offset, data); m_cart->write_mapper(offset, data);
} }
WRITE8_MEMBER(sega8_cart_slot_device::write_cart) void sega8_cart_slot_device::write_cart(offs_t offset, uint8_t data)
{ {
if (m_cart) if (m_cart)
m_cart->write_cart(space, offset, data); m_cart->write_cart(offset, data);
} }
WRITE8_MEMBER(sega8_cart_slot_device::write_ram) void sega8_cart_slot_device::write_ram(offs_t offset, uint8_t data)
{ {
if (m_cart) if (m_cart)
m_cart->write_ram(space, offset, data); m_cart->write_ram(offset, data);
} }
WRITE8_MEMBER(sega8_cart_slot_device::write_io) void sega8_cart_slot_device::write_io(offs_t offset, uint8_t data)
{ {
if (m_cart) if (m_cart)
m_cart->write_io(space, offset, data); m_cart->write_io(offset, data);
} }

View File

@ -51,16 +51,16 @@ public:
virtual ~device_sega8_cart_interface(); virtual ~device_sega8_cart_interface();
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart) { return 0xff; } virtual uint8_t read_cart(offs_t offset) { return 0xff; }
virtual DECLARE_WRITE8_MEMBER(write_cart) { } virtual void write_cart(offs_t offset, uint8_t data) { }
virtual DECLARE_WRITE8_MEMBER(write_mapper) { } virtual void write_mapper(offs_t offset, uint8_t data) { }
virtual int get_lphaser_xoffs() { return m_lphaser_xoffs; } virtual int get_lphaser_xoffs() { return m_lphaser_xoffs; }
// a few carts (for SG1000) acts as a RAM expansion, taking control of the system RAM in 0xc000-0xffff // a few carts (for SG1000) acts as a RAM expansion, taking control of the system RAM in 0xc000-0xffff
virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; } virtual uint8_t read_ram(offs_t offset) { return 0xff; }
virtual DECLARE_WRITE8_MEMBER(write_ram) { } virtual void write_ram(offs_t offset, uint8_t data) { }
// the SC3000 has I/OR, I/OW lines connected // the SC3000 has I/OR, I/OW lines connected
virtual DECLARE_READ8_MEMBER(read_io) { return 0xff; } virtual uint8_t read_io(offs_t offset) { return 0xff; }
virtual DECLARE_WRITE8_MEMBER(write_io) { } virtual void write_io(offs_t offset, uint8_t data) { }
void rom_alloc(uint32_t size, const char *tag); void rom_alloc(uint32_t size, const char *tag);
void ram_alloc(uint32_t size); void ram_alloc(uint32_t size);
@ -143,13 +143,13 @@ public:
void save_ram() { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); } void save_ram() { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); }
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read_cart); uint8_t read_cart(offs_t offset);
virtual DECLARE_WRITE8_MEMBER(write_cart); void write_cart(offs_t offset, uint8_t data);
virtual DECLARE_WRITE8_MEMBER(write_mapper); void write_mapper(offs_t offset, uint8_t data);
virtual DECLARE_READ8_MEMBER(read_ram); uint8_t read_ram(offs_t offset);
virtual DECLARE_WRITE8_MEMBER(write_ram); void write_ram(offs_t offset, uint8_t data);
virtual DECLARE_READ8_MEMBER(read_io); uint8_t read_io(offs_t offset);
virtual DECLARE_WRITE8_MEMBER(write_io); void write_io(offs_t offset, uint8_t data);
int get_lphaser_xoffs() { return m_cart ? m_cart->get_lphaser_xoffs() : -1; } int get_lphaser_xoffs() { return m_cart ? m_cart->get_lphaser_xoffs() : -1; }
int get_sms_mode() { return m_cart->get_sms_mode(); } int get_sms_mode() { return m_cart->get_sms_mode(); }

View File

@ -102,7 +102,7 @@ void sega_fm_unit_device::device_reset()
// peripheral_r - fm unit read // peripheral_r - fm unit read
//------------------------------------------------- //-------------------------------------------------
READ8_MEMBER(sega_fm_unit_device::peripheral_r) uint8_t sega_fm_unit_device::peripheral_r(offs_t offset)
{ {
// the value previously written to the control port is returned on all // the value previously written to the control port is returned on all
// active read offsets. // active read offsets.
@ -118,7 +118,7 @@ READ8_MEMBER(sega_fm_unit_device::peripheral_r)
// peripheral_w - fm unit write // peripheral_w - fm unit write
//------------------------------------------------- //-------------------------------------------------
WRITE8_MEMBER(sega_fm_unit_device::peripheral_w) void sega_fm_unit_device::peripheral_w(offs_t offset, uint8_t data)
{ {
switch (offset) switch (offset)
{ {

View File

@ -38,8 +38,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override; virtual void device_add_mconfig(machine_config &config) override;
// device_sg1000_expansion_slot_interface overrides // device_sg1000_expansion_slot_interface overrides
virtual DECLARE_READ8_MEMBER(peripheral_r) override; virtual uint8_t peripheral_r(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(peripheral_w) override; virtual void peripheral_w(offs_t offset, uint8_t data) override;
virtual bool is_readable(uint8_t offset) override; virtual bool is_readable(uint8_t offset) override;
virtual bool is_writeable(uint8_t offset) override; virtual bool is_writeable(uint8_t offset) override;
void set_audio_control(uint8_t data); void set_audio_control(uint8_t data);

View File

@ -86,18 +86,18 @@ void sg1000_expansion_slot_device::device_start()
// has only 3 address lines (A0, A1, A2). // has only 3 address lines (A0, A1, A2).
READ8_MEMBER(sg1000_expansion_slot_device::read) uint8_t sg1000_expansion_slot_device::read(offs_t offset)
{ {
uint8_t data = 0xff; uint8_t data = 0xff;
if (m_device) if (m_device)
data = m_device->peripheral_r(space, offset & 0x07); data = m_device->peripheral_r(offset & 0x07);
return data; return data;
} }
WRITE8_MEMBER(sg1000_expansion_slot_device::write) void sg1000_expansion_slot_device::write(offs_t offset, uint8_t data)
{ {
if (m_device) if (m_device)
m_device->peripheral_w(space, offset & 0x07, data); m_device->peripheral_w(offset & 0x07, data);
} }

View File

@ -40,8 +40,8 @@ public:
sg1000_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); sg1000_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
virtual ~sg1000_expansion_slot_device(); virtual ~sg1000_expansion_slot_device();
DECLARE_READ8_MEMBER(read); uint8_t read(offs_t offset);
DECLARE_WRITE8_MEMBER(write); void write(offs_t offset, uint8_t data);
bool is_readable(uint8_t offset); bool is_readable(uint8_t offset);
bool is_writeable(uint8_t offset); bool is_writeable(uint8_t offset);
@ -63,8 +63,8 @@ public:
// construction/destruction // construction/destruction
virtual ~device_sg1000_expansion_slot_interface(); virtual ~device_sg1000_expansion_slot_interface();
virtual DECLARE_READ8_MEMBER(peripheral_r) { return 0xff; } virtual uint8_t peripheral_r(offs_t offset) { return 0xff; }
virtual DECLARE_WRITE8_MEMBER(peripheral_w) { } virtual void peripheral_w(offs_t offset, uint8_t data) { }
virtual bool is_readable(uint8_t offset) { return true; } virtual bool is_readable(uint8_t offset) { return true; }
virtual bool is_writeable(uint8_t offset) { return true; } virtual bool is_writeable(uint8_t offset) { return true; }

View File

@ -187,8 +187,8 @@ sega_sk1100_device::sega_sk1100_device(const machine_config &mconfig, const char
m_cassette(*this, "cassette"), m_cassette(*this, "cassette"),
m_ppi(*this, UPD9255_0_TAG), m_ppi(*this, UPD9255_0_TAG),
m_printer_port(*this, "printer"), m_printer_port(*this, "printer"),
m_pa(*this, {"PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7"}), m_pa(*this, "PA%u", 0U),
m_pb(*this, {"PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7"}), m_pb(*this, "PB%u", 0U),
m_keylatch(0) m_keylatch(0)
{ {
} }
@ -209,7 +209,7 @@ void sega_sk1100_device::device_start()
// peripheral_r - keyboard read // peripheral_r - keyboard read
//------------------------------------------------- //-------------------------------------------------
READ8_MEMBER(sega_sk1100_device::peripheral_r) uint8_t sega_sk1100_device::peripheral_r(offs_t offset)
{ {
return m_ppi->read(offset & 0x03); return m_ppi->read(offset & 0x03);
} }
@ -219,7 +219,7 @@ READ8_MEMBER(sega_sk1100_device::peripheral_r)
// peripheral_w - keyboard write // peripheral_w - keyboard write
//------------------------------------------------- //-------------------------------------------------
WRITE8_MEMBER(sega_sk1100_device::peripheral_w) void sega_sk1100_device::peripheral_w(offs_t offset, uint8_t data)
{ {
m_ppi->write(offset & 0x03, data); m_ppi->write(offset & 0x03, data);
} }

View File

@ -44,8 +44,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override; virtual void device_add_mconfig(machine_config &config) override;
// device_sg1000_expansion_slot_interface overrides // device_sg1000_expansion_slot_interface overrides
virtual DECLARE_READ8_MEMBER(peripheral_r) override; virtual uint8_t peripheral_r(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(peripheral_w) override; virtual void peripheral_w(offs_t offset, uint8_t data) override;
virtual bool is_readable(uint8_t offset) override; virtual bool is_readable(uint8_t offset) override;
private: private:

View File

@ -56,14 +56,14 @@ void sms_gender_adapter_device::device_start()
// read // read
//------------------------------------------------- //-------------------------------------------------
READ8_MEMBER(sms_gender_adapter_device::read) uint8_t sms_gender_adapter_device::read(offs_t offset)
{ {
return m_subslot->read_cart(space, offset); return m_subslot->read_cart(offset);
} }
READ8_MEMBER(sms_gender_adapter_device::read_ram) uint8_t sms_gender_adapter_device::read_ram(offs_t offset)
{ {
return m_subslot->read_ram(space, offset); return m_subslot->read_ram(offset);
} }
int sms_gender_adapter_device::get_lphaser_xoffs() int sms_gender_adapter_device::get_lphaser_xoffs()
@ -76,19 +76,19 @@ int sms_gender_adapter_device::get_lphaser_xoffs()
// write // write
//------------------------------------------------- //-------------------------------------------------
WRITE8_MEMBER(sms_gender_adapter_device::write_mapper) void sms_gender_adapter_device::write_mapper(offs_t offset, uint8_t data)
{ {
m_subslot->write_mapper(space, offset, data); m_subslot->write_mapper(offset, data);
} }
WRITE8_MEMBER(sms_gender_adapter_device::write) void sms_gender_adapter_device::write(offs_t offset, uint8_t data)
{ {
m_subslot->write_cart(space, offset, data); m_subslot->write_cart(offset, data);
} }
WRITE8_MEMBER(sms_gender_adapter_device::write_ram) void sms_gender_adapter_device::write_ram(offs_t offset, uint8_t data)
{ {
m_subslot->write_ram(space, offset, data); m_subslot->write_ram(offset, data);
} }
//------------------------------------------------- //-------------------------------------------------

View File

@ -31,11 +31,11 @@ public:
sms_gender_adapter_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sms_gender_adapter_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device_sms_expansion_slot_interface overrides // device_sms_expansion_slot_interface overrides
virtual DECLARE_READ8_MEMBER(read) override; virtual uint8_t read(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write) override; virtual void write(offs_t offset, uint8_t data) override;
virtual DECLARE_WRITE8_MEMBER(write_mapper) override; virtual void write_mapper(offs_t offset, uint8_t data) override;
virtual DECLARE_READ8_MEMBER(read_ram) override; virtual uint8_t read_ram(offs_t offset) override;
virtual DECLARE_WRITE8_MEMBER(write_ram) override; virtual void write_ram(offs_t offset, uint8_t data) override;
virtual int get_lphaser_xoffs() override; virtual int get_lphaser_xoffs() override;

View File

@ -29,11 +29,11 @@ public:
virtual ~device_sms_expansion_slot_interface(); virtual ~device_sms_expansion_slot_interface();
// reading and writing // reading and writing
virtual DECLARE_READ8_MEMBER(read) { return 0xff; } virtual uint8_t read(offs_t offset) { return 0xff; }
virtual DECLARE_WRITE8_MEMBER(write) { } virtual void write(offs_t offset, uint8_t data) { }
virtual DECLARE_WRITE8_MEMBER(write_mapper) { } virtual void write_mapper(offs_t offset, uint8_t data) { }
virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; } virtual uint8_t read_ram(offs_t offset) { return 0xff; }
virtual DECLARE_WRITE8_MEMBER(write_ram) { } virtual void write_ram(offs_t offset, uint8_t data) { }
virtual int get_lphaser_xoffs() { return 0; } virtual int get_lphaser_xoffs() { return 0; }
@ -61,11 +61,11 @@ public:
virtual ~sms_expansion_slot_device(); virtual ~sms_expansion_slot_device();
// reading and writing // reading and writing
DECLARE_READ8_MEMBER(read) { return m_device ? m_device->read(space, offset, mem_mask) : 0xff; } uint8_t read(offs_t offset) { return m_device ? m_device->read(offset) : 0xff; }
DECLARE_WRITE8_MEMBER(write) { if (m_device) m_device->write(space, offset, data, mem_mask); } void write(offs_t offset, uint8_t data) { if (m_device) m_device->write(offset, data); }
DECLARE_WRITE8_MEMBER(write_mapper) { if (m_device) m_device->write_mapper(space, offset, data, mem_mask); } void write_mapper(offs_t offset, uint8_t data) { if (m_device) m_device->write_mapper(offset, data); }
DECLARE_READ8_MEMBER(read_ram) { return m_device ? m_device->read_ram(space, offset, mem_mask) : 0xff; } uint8_t read_ram(offs_t offset) { return m_device ? m_device->read_ram(offset) : 0xff; }
DECLARE_WRITE8_MEMBER(write_ram) { if (m_device) m_device->write_ram(space, offset, data, mem_mask); } void write_ram(offs_t offset, uint8_t data) { if (m_device) m_device->write_ram(offset, data); }
int get_lphaser_xoffs() { return m_device ? m_device->get_lphaser_xoffs() : 0; } int get_lphaser_xoffs() { return m_device ? m_device->get_lphaser_xoffs() : 0; }

View File

@ -78,27 +78,27 @@ Notes:
// TODO: not sure if the OMV bios actually detects the presence of a cart, // TODO: not sure if the OMV bios actually detects the presence of a cart,
// or if the cart data simply overwrites the internal bios... // or if the cart data simply overwrites the internal bios...
// for the moment let assume the latter! // for the moment let assume the latter!
READ8_MEMBER( sg1000_state::omv_r ) uint8_t sg1000_state::omv_r(offs_t offset)
{ {
if (m_cart && m_cart->exists()) if (m_cart && m_cart->exists())
return m_cart->read_cart(space, offset); return m_cart->read_cart(offset);
else else
return m_rom->base()[offset]; return m_rom->base()[offset];
} }
WRITE8_MEMBER( sg1000_state::omv_w ) void sg1000_state::omv_w(offs_t offset, uint8_t data)
{ {
if (m_cart && m_cart->exists()) if (m_cart && m_cart->exists())
m_cart->write_cart(space, offset, data); m_cart->write_cart(offset, data);
} }
READ8_MEMBER( sg1000_state::peripheral_r ) uint8_t sg1000_state::peripheral_r(offs_t offset)
{ {
bool joy_ports_disabled = m_sgexpslot->is_readable(offset); bool joy_ports_disabled = m_sgexpslot->is_readable(offset);
if (joy_ports_disabled) if (joy_ports_disabled)
{ {
return m_sgexpslot->read(space, offset); return m_sgexpslot->read(offset);
} }
else else
{ {
@ -109,13 +109,13 @@ READ8_MEMBER( sg1000_state::peripheral_r )
} }
} }
WRITE8_MEMBER( sg1000_state::peripheral_w ) void sg1000_state::peripheral_w(offs_t offset, uint8_t data)
{ {
bool joy_ports_disabled = m_sgexpslot->is_writeable(offset); bool joy_ports_disabled = m_sgexpslot->is_writeable(offset);
if (joy_ports_disabled) if (joy_ports_disabled)
{ {
m_sgexpslot->write(space, offset, data); m_sgexpslot->write(offset, data);
} }
} }
@ -463,8 +463,8 @@ void sg1000_state::machine_start()
{ {
if (m_cart->get_type() == SEGA8_DAHJEE_TYPEA || m_cart->get_type() == SEGA8_DAHJEE_TYPEB) if (m_cart->get_type() == SEGA8_DAHJEE_TYPEA || m_cart->get_type() == SEGA8_DAHJEE_TYPEB)
{ {
m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, read8_delegate(*m_cart, FUNC(sega8_cart_slot_device::read_ram))); m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, read8sm_delegate(*m_cart, FUNC(sega8_cart_slot_device::read_ram)));
m_maincpu->space(AS_PROGRAM).install_write_handler(0xc000, 0xffff, write8_delegate(*m_cart, FUNC(sega8_cart_slot_device::write_ram))); m_maincpu->space(AS_PROGRAM).install_write_handler(0xc000, 0xffff, write8sm_delegate(*m_cart, FUNC(sega8_cart_slot_device::write_ram)));
} }
if (m_cart) if (m_cart)
@ -484,8 +484,8 @@ void sc3000_state::machine_start()
|| m_cart->get_type() == SEGA8_DAHJEE_TYPEA || m_cart->get_type() == SEGA8_DAHJEE_TYPEB || m_cart->get_type() == SEGA8_DAHJEE_TYPEA || m_cart->get_type() == SEGA8_DAHJEE_TYPEB
|| m_cart->get_type() == SEGA8_MULTICART || m_cart->get_type() == SEGA8_MEGACART)) || m_cart->get_type() == SEGA8_MULTICART || m_cart->get_type() == SEGA8_MEGACART))
{ {
m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, read8_delegate(*m_cart, FUNC(sega8_cart_slot_device::read_ram))); m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, read8sm_delegate(*m_cart, FUNC(sega8_cart_slot_device::read_ram)));
m_maincpu->space(AS_PROGRAM).install_write_handler(0xc000, 0xffff, write8_delegate(*m_cart, FUNC(sega8_cart_slot_device::write_ram))); m_maincpu->space(AS_PROGRAM).install_write_handler(0xc000, 0xffff, write8sm_delegate(*m_cart, FUNC(sega8_cart_slot_device::write_ram)));
} }
if (m_cart) if (m_cart)

View File

@ -69,11 +69,11 @@ protected:
virtual void machine_start() override; virtual void machine_start() override;
DECLARE_READ8_MEMBER( peripheral_r ); uint8_t peripheral_r(offs_t offset);
DECLARE_WRITE8_MEMBER( peripheral_w ); void peripheral_w(offs_t offset, uint8_t data);
DECLARE_READ8_MEMBER( omv_r ); uint8_t omv_r(offs_t offset);
DECLARE_WRITE8_MEMBER( omv_w ); void omv_w(offs_t offset, uint8_t data);
void omv_io_map(address_map &map); void omv_io_map(address_map &map);
void omv_map(address_map &map); void omv_map(address_map &map);

View File

@ -86,26 +86,26 @@ protected:
template <typename X> static void screen_sms_pal_raw_params(screen_device &screen, X &&pixelclock); template <typename X> static void screen_sms_pal_raw_params(screen_device &screen, X &&pixelclock);
template <typename X> static void screen_sms_ntsc_raw_params(screen_device &screen, X &&pixelclock); template <typename X> static void screen_sms_ntsc_raw_params(screen_device &screen, X &&pixelclock);
DECLARE_READ8_MEMBER(read_0000); uint8_t read_0000(offs_t offset);
DECLARE_READ8_MEMBER(read_4000); uint8_t read_4000(offs_t offset);
DECLARE_READ8_MEMBER(read_8000); uint8_t read_8000(offs_t offset);
DECLARE_READ8_MEMBER(read_ram); uint8_t read_ram(offs_t offset);
DECLARE_WRITE8_MEMBER(write_ram); void write_ram(offs_t offset, uint8_t data);
DECLARE_WRITE8_MEMBER(write_cart); void write_cart(offs_t offset, uint8_t data);
DECLARE_READ8_MEMBER(sms_mapper_r); uint8_t sms_mapper_r(offs_t offset);
DECLARE_WRITE8_MEMBER(sms_mapper_w); void sms_mapper_w(offs_t offset, uint8_t data);
DECLARE_WRITE8_MEMBER(sms_mem_control_w); void sms_mem_control_w(uint8_t data);
DECLARE_WRITE8_MEMBER(sms_io_control_w); void sms_io_control_w(uint8_t data);
DECLARE_READ8_MEMBER(sms_count_r); uint8_t sms_count_r(offs_t offset);
DECLARE_READ8_MEMBER(sms_input_port_dc_r); uint8_t sms_input_port_dc_r();
DECLARE_READ8_MEMBER(sms_input_port_dd_r); uint8_t sms_input_port_dd_r();
DECLARE_READ8_MEMBER(sg1000m3_peripheral_r); uint8_t sg1000m3_peripheral_r(offs_t offset);
DECLARE_WRITE8_MEMBER(sg1000m3_peripheral_w); void sg1000m3_peripheral_w(offs_t offset, uint8_t data);
DECLARE_READ8_MEMBER(smsj_audio_control_r); uint8_t smsj_audio_control_r();
DECLARE_WRITE8_MEMBER(smsj_audio_control_w); void smsj_audio_control_w(uint8_t data);
DECLARE_WRITE8_MEMBER(smsj_ym2413_register_port_w); void smsj_ym2413_register_port_w(uint8_t data);
DECLARE_WRITE8_MEMBER(smsj_ym2413_data_port_w); void smsj_ym2413_data_port_w(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(rapid_n_csync_callback); DECLARE_WRITE_LINE_MEMBER(rapid_n_csync_callback);
DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input); DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input);
@ -119,7 +119,7 @@ protected:
virtual void machine_start() override; virtual void machine_start() override;
virtual void machine_reset() override; virtual void machine_reset() override;
uint8_t read_bus(address_space &space, unsigned int bank, uint16_t base_addr, uint16_t offset); uint8_t read_bus(unsigned int bank, uint16_t base_addr, uint16_t offset);
void setup_bios(); void setup_bios();
void setup_media_slots(); void setup_media_slots();
void setup_enabled_slots(); void setup_enabled_slots();
@ -146,7 +146,6 @@ protected:
output_finder<> m_led_pwr; output_finder<> m_led_pwr;
required_memory_region m_region_maincpu; required_memory_region m_region_maincpu;
address_space *m_space;
std::unique_ptr<uint8_t[]> m_mainram; std::unique_ptr<uint8_t[]> m_mainram;
uint8_t *m_BIOS; uint8_t *m_BIOS;
@ -226,8 +225,8 @@ protected:
virtual void video_reset() override; virtual void video_reset() override;
private: private:
DECLARE_READ8_MEMBER(sscope_r); uint8_t sscope_r(offs_t offset);
DECLARE_WRITE8_MEMBER(sscope_w); void sscope_w(offs_t offset, uint8_t data);
DECLARE_WRITE_LINE_MEMBER(sscope_vblank); DECLARE_WRITE_LINE_MEMBER(sscope_vblank);
uint32_t screen_update_left(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_left(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@ -267,12 +266,12 @@ protected:
virtual void device_post_load() override; virtual void device_post_load() override;
private: private:
DECLARE_READ8_MEMBER(sms_store_cart_select_r); uint8_t sms_store_cart_select_r();
DECLARE_WRITE8_MEMBER(sms_store_cart_select_w); void sms_store_cart_select_w(uint8_t data);
void store_select_cart(uint8_t data); void store_select_cart(uint8_t data);
DECLARE_WRITE8_MEMBER(sms_store_control_w); void sms_store_control_w(uint8_t data);
DECLARE_READ8_MEMBER(store_cart_peek); uint8_t store_cart_peek(offs_t offset);
DECLARE_WRITE_LINE_MEMBER(sms_store_int_callback); DECLARE_WRITE_LINE_MEMBER(sms_store_int_callback);
void sms_store_mem(address_map &map); void sms_store_mem(address_map &map);
@ -304,10 +303,10 @@ protected:
private: private:
template <typename X> static void screen_gg_raw_params(screen_device &screen, X &&pixelclock); template <typename X> static void screen_gg_raw_params(screen_device &screen, X &&pixelclock);
DECLARE_READ8_MEMBER(gg_input_port_00_r); uint8_t gg_input_port_00_r();
DECLARE_READ8_MEMBER(gg_sio_r); uint8_t gg_sio_r(offs_t offset);
DECLARE_WRITE8_MEMBER(gg_sio_w); void gg_sio_w(offs_t offset, uint8_t data);
DECLARE_WRITE8_MEMBER(gg_psg_stereo_w); void gg_psg_stereo_w(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(gg_pause_callback); DECLARE_WRITE_LINE_MEMBER(gg_pause_callback);
DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input); DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input);

View File

@ -128,7 +128,7 @@ void sms_state::sms_get_inputs()
} }
WRITE8_MEMBER(sms_state::sms_io_control_w) void sms_state::sms_io_control_w(uint8_t data)
{ {
bool latch_hcount = false; bool latch_hcount = false;
uint8_t ctrl1_port_data = 0xff; uint8_t ctrl1_port_data = 0xff;
@ -206,7 +206,7 @@ WRITE8_MEMBER(sms_state::sms_io_control_w)
} }
READ8_MEMBER(sms_state::sms_count_r) uint8_t sms_state::sms_count_r(offs_t offset)
{ {
if (offset & 0x01) if (offset & 0x01)
return m_vdp->hcount_read(); return m_vdp->hcount_read();
@ -312,7 +312,7 @@ WRITE_LINE_MEMBER(sms_state::rapid_n_csync_callback)
} }
READ8_MEMBER(sms_state::sms_input_port_dc_r) uint8_t sms_state::sms_input_port_dc_r()
{ {
if (m_is_mark_iii) if (m_is_mark_iii)
{ {
@ -359,7 +359,7 @@ READ8_MEMBER(sms_state::sms_input_port_dc_r)
} }
READ8_MEMBER(sms_state::sms_input_port_dd_r) uint8_t sms_state::sms_input_port_dd_r()
{ {
if (m_is_mark_iii) if (m_is_mark_iii)
{ {
@ -480,13 +480,13 @@ void sms_state::smsj_set_audio_control(uint8_t data)
} }
WRITE8_MEMBER(sms_state::smsj_audio_control_w) void sms_state::smsj_audio_control_w(uint8_t data)
{ {
smsj_set_audio_control(data); smsj_set_audio_control(data);
} }
READ8_MEMBER(sms_state::smsj_audio_control_r) uint8_t sms_state::smsj_audio_control_r()
{ {
uint8_t data; uint8_t data;
@ -515,20 +515,20 @@ READ8_MEMBER(sms_state::smsj_audio_control_r)
} }
WRITE8_MEMBER(sms_state::smsj_ym2413_register_port_w) void sms_state::smsj_ym2413_register_port_w(uint8_t data)
{ {
m_ym->write(0, data & 0x3f); m_ym->write(0, data & 0x3f);
} }
WRITE8_MEMBER(sms_state::smsj_ym2413_data_port_w) void sms_state::smsj_ym2413_data_port_w(uint8_t data)
{ {
//logerror("data_port_w %x %x\n", offset, data); //logerror("data_port_w %x %x\n", offset, data);
m_ym->write(1, data); m_ym->write(1, data);
} }
WRITE8_MEMBER(gamegear_state::gg_psg_stereo_w) void gamegear_state::gg_psg_stereo_w(uint8_t data)
{ {
if (m_cartslot->exists() && m_cartslot->get_sms_mode()) if (m_cartslot->exists() && m_cartslot->get_sms_mode())
return; return;
@ -537,7 +537,7 @@ WRITE8_MEMBER(gamegear_state::gg_psg_stereo_w)
} }
READ8_MEMBER(gamegear_state::gg_input_port_00_r) uint8_t gamegear_state::gg_input_port_00_r()
{ {
if (m_cartslot->exists() && m_cartslot->get_sms_mode()) if (m_cartslot->exists() && m_cartslot->get_sms_mode())
return 0xff; return 0xff;
@ -557,7 +557,7 @@ READ8_MEMBER(gamegear_state::gg_input_port_00_r)
} }
READ8_MEMBER(sms1_state::sscope_r) uint8_t sms1_state::sscope_r(offs_t offset)
{ {
int sscope = m_port_scope->read(); int sscope = m_port_scope->read();
@ -570,13 +570,13 @@ READ8_MEMBER(sms1_state::sscope_r)
return m_sscope_state; return m_sscope_state;
} }
return read_ram(space, 0x3ff8 + offset); return read_ram(0x3ff8 + offset);
} }
WRITE8_MEMBER(sms1_state::sscope_w) void sms1_state::sscope_w(offs_t offset, uint8_t data)
{ {
write_ram(space, 0x3ff8 + offset, data); write_ram(0x3ff8 + offset, data);
int sscope = m_port_scope->read(); int sscope = m_port_scope->read();
@ -599,18 +599,18 @@ WRITE8_MEMBER(sms1_state::sscope_w)
} }
READ8_MEMBER(sms_state::read_ram) uint8_t sms_state::read_ram(offs_t offset)
{ {
if (m_mem_device_enabled & ENABLE_EXT_RAM) if (m_mem_device_enabled & ENABLE_EXT_RAM)
{ {
uint8_t data = 0xff; uint8_t data = 0xff;
if (m_mem_device_enabled & ENABLE_CART) if (m_mem_device_enabled & ENABLE_CART)
data &= m_cartslot->read_ram(space, offset); data &= m_cartslot->read_ram(offset);
if (m_mem_device_enabled & ENABLE_CARD) if (m_mem_device_enabled & ENABLE_CARD)
data &= m_cardslot->read_ram(space, offset); data &= m_cardslot->read_ram(offset);
if (m_mem_device_enabled & ENABLE_EXPANSION) if (m_mem_device_enabled & ENABLE_EXPANSION)
data &= m_smsexpslot->read_ram(space, offset); data &= m_smsexpslot->read_ram(offset);
return data; return data;
} }
@ -621,16 +621,16 @@ READ8_MEMBER(sms_state::read_ram)
} }
WRITE8_MEMBER(sms_state::write_ram) void sms_state::write_ram(offs_t offset, uint8_t data)
{ {
if (m_mem_device_enabled & ENABLE_EXT_RAM) if (m_mem_device_enabled & ENABLE_EXT_RAM)
{ {
if (m_mem_device_enabled & ENABLE_CART) if (m_mem_device_enabled & ENABLE_CART)
m_cartslot->write_ram(space, offset, data); m_cartslot->write_ram(offset, data);
if (m_mem_device_enabled & ENABLE_CARD) if (m_mem_device_enabled & ENABLE_CARD)
m_cardslot->write_ram(space, offset, data); m_cardslot->write_ram(offset, data);
if (m_mem_device_enabled & ENABLE_EXPANSION) if (m_mem_device_enabled & ENABLE_EXPANSION)
m_smsexpslot->write_ram(space, offset, data); m_smsexpslot->write_ram(offset, data);
} }
else else
{ {
@ -639,16 +639,16 @@ WRITE8_MEMBER(sms_state::write_ram)
} }
READ8_MEMBER(sms_state::sms_mapper_r) uint8_t sms_state::sms_mapper_r(offs_t offset)
{ {
return read_ram(space, 0x3ffc + offset); return read_ram(0x3ffc + offset);
} }
WRITE8_MEMBER(sms_state::sms_mapper_w) void sms_state::sms_mapper_w(offs_t offset, uint8_t data)
{ {
m_mapper[offset] = data; m_mapper[offset] = data;
write_ram(space, 0x3ffc + offset, data); write_ram(0x3ffc + offset, data);
switch (offset) switch (offset)
{ {
@ -662,15 +662,15 @@ WRITE8_MEMBER(sms_state::sms_mapper_w)
} }
if (m_mem_device_enabled & ENABLE_CART) // CART ROM/RAM if (m_mem_device_enabled & ENABLE_CART) // CART ROM/RAM
{ {
m_cartslot->write_mapper(space, offset, data); m_cartslot->write_mapper(offset, data);
} }
if (m_mem_device_enabled & ENABLE_CARD) // CARD ROM/RAM if (m_mem_device_enabled & ENABLE_CARD) // CARD ROM/RAM
{ {
m_cardslot->write_mapper(space, offset, data); m_cardslot->write_mapper(offset, data);
} }
if (m_mem_device_enabled & ENABLE_EXPANSION) // expansion slot if (m_mem_device_enabled & ENABLE_EXPANSION) // expansion slot
{ {
m_smsexpslot->write_mapper(space, offset, data); m_smsexpslot->write_mapper(offset, data);
} }
break; break;
@ -686,22 +686,22 @@ WRITE8_MEMBER(sms_state::sms_mapper_w)
} }
if (m_mem_device_enabled & ENABLE_CART) if (m_mem_device_enabled & ENABLE_CART)
{ {
m_cartslot->write_mapper(space, offset, data); m_cartslot->write_mapper(offset, data);
} }
if (m_mem_device_enabled & ENABLE_CARD) if (m_mem_device_enabled & ENABLE_CARD)
{ {
m_cardslot->write_mapper(space, offset, data); m_cardslot->write_mapper(offset, data);
} }
if (m_mem_device_enabled & ENABLE_EXPANSION) if (m_mem_device_enabled & ENABLE_EXPANSION)
{ {
m_smsexpslot->write_mapper(space, offset, data); m_smsexpslot->write_mapper(offset, data);
} }
break; break;
} }
} }
uint8_t sms_state::read_bus(address_space &space, unsigned int page, uint16_t base_addr, uint16_t offset) uint8_t sms_state::read_bus(unsigned int page, uint16_t base_addr, uint16_t offset)
{ {
if (m_is_gamegear) if (m_is_gamegear)
{ {
@ -715,7 +715,7 @@ uint8_t sms_state::read_bus(address_space &space, unsigned int page, uint16_t ba
if ((m_mem_device_enabled & ENABLE_BIOS) && page == 3) if ((m_mem_device_enabled & ENABLE_BIOS) && page == 3)
return m_BIOS[(m_bios_page[page] * 0x4000) + (offset & 0x3fff)]; return m_BIOS[(m_bios_page[page] * 0x4000) + (offset & 0x3fff)];
if (m_mem_device_enabled & ENABLE_CART) if (m_mem_device_enabled & ENABLE_CART)
return m_cartslot->read_cart(space, base_addr + offset); return m_cartslot->read_cart(base_addr + offset);
} }
else if (m_mem_device_enabled != ENABLE_NONE) else if (m_mem_device_enabled != ENABLE_NONE)
{ {
@ -728,11 +728,11 @@ uint8_t sms_state::read_bus(address_space &space, unsigned int page, uint16_t ba
if (m_mem_device_enabled & ENABLE_BIOS) if (m_mem_device_enabled & ENABLE_BIOS)
data &= m_BIOS[(m_bios_page[page] * 0x4000) + (offset & 0x3fff)]; data &= m_BIOS[(m_bios_page[page] * 0x4000) + (offset & 0x3fff)];
if (m_mem_device_enabled & ENABLE_CART) if (m_mem_device_enabled & ENABLE_CART)
data &= m_cartslot->read_cart(space, base_addr + offset); data &= m_cartslot->read_cart(base_addr + offset);
if (m_mem_device_enabled & ENABLE_CARD) if (m_mem_device_enabled & ENABLE_CARD)
data &= m_cardslot->read_cart(space, base_addr + offset); data &= m_cardslot->read_cart(base_addr + offset);
if (m_mem_device_enabled & ENABLE_EXPANSION) if (m_mem_device_enabled & ENABLE_EXPANSION)
data &= m_smsexpslot->read(space, base_addr + offset); data &= m_smsexpslot->read(base_addr + offset);
return data; return data;
} }
@ -740,47 +740,47 @@ uint8_t sms_state::read_bus(address_space &space, unsigned int page, uint16_t ba
} }
READ8_MEMBER(sms_state::read_0000) uint8_t sms_state::read_0000(offs_t offset)
{ {
if (offset < 0x400) if (offset < 0x400)
{ {
return read_bus(space, 3, 0x0000, offset); return read_bus(3, 0x0000, offset);
} }
else else
{ {
return read_bus(space, 0, 0x0000, offset); return read_bus(0, 0x0000, offset);
} }
} }
READ8_MEMBER(sms_state::read_4000) uint8_t sms_state::read_4000(offs_t offset)
{ {
return read_bus(space, 1, 0x4000, offset); return read_bus(1, 0x4000, offset);
} }
READ8_MEMBER(sms_state::read_8000) uint8_t sms_state::read_8000(offs_t offset)
{ {
return read_bus(space, 2, 0x8000, offset); return read_bus(2, 0x8000, offset);
} }
WRITE8_MEMBER(sms_state::write_cart) void sms_state::write_cart(offs_t offset, uint8_t data)
{ {
if (m_mem_device_enabled & ENABLE_CART) if (m_mem_device_enabled & ENABLE_CART)
m_cartslot->write_cart(space, offset, data); m_cartslot->write_cart(offset, data);
if (m_mem_device_enabled & ENABLE_CARD) if (m_mem_device_enabled & ENABLE_CARD)
m_cardslot->write_cart(space, offset, data); m_cardslot->write_cart(offset, data);
if (m_mem_device_enabled & ENABLE_EXPANSION) if (m_mem_device_enabled & ENABLE_EXPANSION)
m_smsexpslot->write(space, offset, data); m_smsexpslot->write(offset, data);
} }
READ8_MEMBER(smssdisp_state::store_cart_peek) uint8_t smssdisp_state::store_cart_peek(offs_t offset)
{ {
if (m_mem_device_enabled != ENABLE_NONE) if (m_mem_device_enabled != ENABLE_NONE)
{ {
uint8_t data = 0xff; uint8_t data = 0xff;
if (m_mem_device_enabled & ENABLE_CART) if (m_mem_device_enabled & ENABLE_CART)
data &= m_cartslot->read_cart(space, 0x6000 + (offset & 0x1fff)); data &= m_cartslot->read_cart(0x6000 + (offset & 0x1fff));
return data; return data;
} }
@ -790,7 +790,7 @@ READ8_MEMBER(smssdisp_state::store_cart_peek)
} }
} }
WRITE8_MEMBER(sms_state::sms_mem_control_w) void sms_state::sms_mem_control_w(uint8_t data)
{ {
m_mem_ctrl_reg = data; m_mem_ctrl_reg = data;
@ -800,36 +800,36 @@ WRITE8_MEMBER(sms_state::sms_mem_control_w)
} }
READ8_MEMBER(sms_state::sg1000m3_peripheral_r) uint8_t sms_state::sg1000m3_peripheral_r(offs_t offset)
{ {
bool joy_ports_disabled = m_sgexpslot->is_readable(offset); bool joy_ports_disabled = m_sgexpslot->is_readable(offset);
if (joy_ports_disabled) if (joy_ports_disabled)
{ {
return m_sgexpslot->read(space, offset); return m_sgexpslot->read(offset);
} }
else else
{ {
if (offset & 0x01) if (offset & 0x01)
return sms_input_port_dd_r(space, offset); return sms_input_port_dd_r();
else else
return sms_input_port_dc_r(space, offset); return sms_input_port_dc_r();
} }
} }
WRITE8_MEMBER(sms_state::sg1000m3_peripheral_w) void sms_state::sg1000m3_peripheral_w(offs_t offset, uint8_t data)
{ {
bool joy_ports_disabled = m_sgexpslot->is_writeable(offset); bool joy_ports_disabled = m_sgexpslot->is_writeable(offset);
if (joy_ports_disabled) if (joy_ports_disabled)
{ {
m_sgexpslot->write(space, offset, data); m_sgexpslot->write(offset, data);
} }
} }
WRITE8_MEMBER(gamegear_state::gg_sio_w) void gamegear_state::gg_sio_w(offs_t offset, uint8_t data)
{ {
if (m_cartslot->exists() && m_cartslot->get_sms_mode()) if (m_cartslot->exists() && m_cartslot->get_sms_mode())
return; return;
@ -857,7 +857,7 @@ WRITE8_MEMBER(gamegear_state::gg_sio_w)
} }
READ8_MEMBER(gamegear_state::gg_sio_r) uint8_t gamegear_state::gg_sio_r(offs_t offset)
{ {
if (m_cartslot->exists() && m_cartslot->get_sms_mode()) if (m_cartslot->exists() && m_cartslot->get_sms_mode())
return 0xff; return 0xff;
@ -1024,7 +1024,6 @@ void sms_state::machine_start()
} }
m_cartslot = m_slot.target(); m_cartslot = m_slot.target();
m_space = &m_maincpu->space(AS_PROGRAM);
if (m_mainram == nullptr) if (m_mainram == nullptr)
{ {
@ -1164,13 +1163,13 @@ void gamegear_state::machine_reset()
sms_state::machine_reset(); sms_state::machine_reset();
} }
READ8_MEMBER(smssdisp_state::sms_store_cart_select_r) uint8_t smssdisp_state::sms_store_cart_select_r()
{ {
return m_store_cart_selection_data; return m_store_cart_selection_data;
} }
WRITE8_MEMBER(smssdisp_state::sms_store_cart_select_w) void smssdisp_state::sms_store_cart_select_w(uint8_t data)
{ {
store_select_cart(data); store_select_cart(data);
m_store_cart_selection_data = data; m_store_cart_selection_data = data;
@ -1208,7 +1207,7 @@ void smssdisp_state::store_select_cart(uint8_t data)
logerror("switching in part of %s slot #%d\n", slottype ? "card" : "cartridge", slot); logerror("switching in part of %s slot #%d\n", slottype ? "card" : "cartridge", slot);
} }
WRITE8_MEMBER(smssdisp_state::sms_store_control_w) void smssdisp_state::sms_store_control_w(uint8_t data)
{ {
int led_number = data >> 4; int led_number = data >> 4;
int led_column = led_number / 4; int led_column = led_number / 4;