Clean-up and consistency fixes after memory system changes.

This commit is contained in:
Vas Crabb 2020-11-03 02:59:49 +11:00
parent 0683248955
commit 349265533d
21 changed files with 111 additions and 83 deletions

View File

@ -57,7 +57,7 @@ Memory banks are zones that indirect memory access, giving the
possibility to dynamically and efficiently change where a zone possibility to dynamically and efficiently change where a zone
actually points to. actually points to.
Memory regions are read-only memory zones in which roms are loaded. Memory regions are read-only memory zones in which ROMs are loaded.
All of these have names allowing to access them. All of these have names allowing to access them.
@ -100,8 +100,8 @@ object.
A memory share can be created if it doesn't exist in a memory map A memory share can be created if it doesn't exist in a memory map
through that creator class. If it already exists it is just through that creator class. If it already exists it is just
retrieved. That class behaves like a pointer but also has the share() retrieved. That class behaves like a pointer but also has the target()
method to get th memory_share object and the bytes(), endianness(), method to get the memory_share object and the bytes(), endianness(),
bitwidth() and bytewidth() methods for share information. bitwidth() and bytewidth() methods for share information.
| memory_share \*memshare(string tag) const; | memory_share \*memshare(string tag) const;
@ -304,11 +304,11 @@ both for the current entry.
4.3.3 Lambda function 4.3.3 Lambda function
''''''''''''''''''''' '''''''''''''''''''''
| (...).lr{8,16,32,64}(FUNC([...](address_space &space, offs_t offset, uNN mem_mask) -> uNN { ... })) | (...).lr{8,16,32,64}(NAME([...](address_space &space, offs_t offset, uNN mem_mask) -> uNN { ... }))
| (...).lr{8,16,32,64}([...](address_space &space, offs_t offset, uNN mem_mask) -> uNN { ... }, "name") | (...).lr{8,16,32,64}([...](address_space &space, offs_t offset, uNN mem_mask) -> uNN { ... }, "name")
| (...).lw{8,16,32,64}(FUNC([...](address_space &space, offs_t offset, uNN data, uNN mem_mask) -> void { ... })) | (...).lw{8,16,32,64}(NAME([...](address_space &space, offs_t offset, uNN data, uNN mem_mask) -> void { ... }))
| (...).lw{8,16,32,64}([...](address_space &space, offs_t offset, uNN data, uNN mem_mask) -> void { ... }, "name") | (...).lw{8,16,32,64}([...](address_space &space, offs_t offset, uNN data, uNN mem_mask) -> void { ... }, "name")
| (...).lrw{8,16,32,64}(FUNC(read), FUNC(write)) | (...).lrw{8,16,32,64}(NAME(read), NAME(write))
| (...).lrw{8,16,32,64}(read, "name_r", write, "name_w") | (...).lrw{8,16,32,64}(read, "name_r", write, "name_w")
Sets a lambda called on read, write or both. The lambda prototype can Sets a lambda called on read, write or both. The lambda prototype can
@ -324,22 +324,22 @@ number is the data width of the access, e.g. the NN.
| (...).writeonly() | (...).writeonly()
| (...).ram() | (...).ram()
Selects the range to access a memory zone as readonly, writeonly or Selects the range to access a memory zone as read-only, write-only or
readwrite respectively. Specific handle qualifiers allow to tell read/write respectively. Specific handle qualifiers allow to tell
where this memory zone should be. There are two cases when no where this memory zone should be. There are two cases when no
qualifier is acceptable: qualifier is acceptable:
* ram() gives an anonymous ram zone not accessibles outside of the * ram() gives an anonymous ram zone not accessible outside of the
address space. address space.
* rom() when the memory map is used in an AS_PROGRAM * rom() when the memory map is used in an AS_PROGRAM
space of a (cpu) device which names is also the name of a region. space of a (CPU) device which names is also the name of a region.
Then the memory zone points to that region at the offset Then the memory zone points to that region at the offset
corresponding to the start of the zone. corresponding to the start of the zone.
| (...).rom().region("name", offset) | (...).rom().region("name", offset)
The region qualifier allows to make a readonly zone point to the The region qualifier allows to make a read-only zone point to the
contents of a given region at a given offset. contents of a given region at a given offset.
| (...).rom().share("name") | (...).rom().share("name")
@ -485,7 +485,7 @@ The parameter is that trigger width (would be 16 in the 68000 case).
A series of methods allow to change the bus decoding of an address A series of methods allow to change the bus decoding of an address
space on the fly. They're powerful but have some issues: space on the fly. They're powerful but have some issues:
* changing the mappings repeateadly can be slow * changing the mappings repeatedly can be slow
* the address space state is not saved in the saved states, so it has to be rebuilt after state load * the address space state is not saved in the saved states, so it has to be rebuilt after state load
* they can be hidden anywhere rather that be grouped in an address map, which can be less readable * they can be hidden anywhere rather that be grouped in an address map, which can be less readable
@ -538,8 +538,8 @@ Note that as all delegates they can also wrap lambdas.
| space.install_readwrite_handler(addrstart, addrend, addrmask, addrmirror, addrselect, read_delegate, write_delegate, *unitmask*, *cswidth*) | space.install_readwrite_handler(addrstart, addrend, addrmask, addrmirror, addrselect, read_delegate, write_delegate, *unitmask*, *cswidth*)
These six methods allow to install delegate-wrapped handlers in a live These six methods allow to install delegate-wrapped handlers in a live
address space. either plain of with mask, mirror and select. In the address space. Either plain or with mask, mirror and select. In the
readwrite case both delegates must be of the same flavor (smo stuff) read/write case both delegates must be of the same flavor (smo stuff)
to avoid a combinatorial explosion of method types. to avoid a combinatorial explosion of method types.
5.3 Direct memory range mapping 5.3 Direct memory range mapping
@ -553,7 +553,7 @@ to avoid a combinatorial explosion of method types.
| space.install_ram(addrstart, addrend, addrmirror, void \*pointer) | space.install_ram(addrstart, addrend, addrmirror, void \*pointer)
Installs a memory block in an address space, with or without mirror. Installs a memory block in an address space, with or without mirror.
rom is readonly, ram is read/write, writeonly is write only. The rom is read-only, ram is read/write, writeonly is write-only. The
pointer must be non-null, this method will not allocate the memory. pointer must be non-null, this method will not allocate the memory.
5.4 Bank mapping 5.4 Bank mapping

View File

@ -41,8 +41,8 @@ protected:
// device_nvram_interface overrides // device_nvram_interface overrides
virtual void nvram_default() override { } virtual void nvram_default() override { }
virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.share()->bytes()); } } virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } }
virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.share()->bytes()); } } virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } }
// device_abcbus_interface overrides // device_abcbus_interface overrides
virtual void abcbus_cs(uint8_t data) override { m_bus->write_cs(data); } virtual void abcbus_cs(uint8_t data) override { m_bus->write_cs(data); }

View File

@ -98,9 +98,9 @@ c64_final_chesscard_device::c64_final_chesscard_device(const machine_config &mco
void c64_final_chesscard_device::device_start() void c64_final_chesscard_device::device_start()
{ {
m_nvram = std::make_unique<uint8_t[]>(0x2000); m_nvram = std::make_unique<uint8_t[]>(0x2000);
save_pointer(NAME(m_nvram), 0x2000);
// state saving // state saving
save_pointer(NAME(m_nvram), 0x2000);
save_item(NAME(m_bank)); save_item(NAME(m_bank));
save_item(NAME(m_hidden)); save_item(NAME(m_hidden));
} }

View File

@ -71,9 +71,7 @@ image_init_result portfolio_memory_card_slot_device::call_load()
if (m_card) if (m_card)
{ {
if (!loaded_through_softlist()) if (!loaded_through_softlist())
{
fread(m_card->m_rom, length()); fread(m_card->m_rom, length());
}
else else
load_software_region("rom", m_card->m_rom); load_software_region("rom", m_card->m_rom);
} }

View File

@ -36,8 +36,8 @@ protected:
// device_nvram_interface overrides // device_nvram_interface overrides
virtual void nvram_default() override { } virtual void nvram_default() override { }
virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.share()->bytes()); } } virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } }
virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.share()->bytes()); } } virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } }
// device_portfolio_memory_card_slot_interface overrides // device_portfolio_memory_card_slot_interface overrides
virtual bool cdet() override { return 0; } virtual bool cdet() override { return 0; }

View File

@ -73,13 +73,13 @@ void *finder_base::find_memregion(u8 width, size_t &length, bool required) const
if (region->bytewidth() != width) if (region->bytewidth() != width)
{ {
if (required) if (required)
osd_printf_warning("Region '%s' found but is width %d, not %d as requested\n", m_tag, region->bitwidth(), width*8); osd_printf_warning("Region '%s' found but is width %d, not %d as requested\n", m_tag, region->bitwidth(), width * 8);
length = 0; length = 0;
return nullptr; return nullptr;
} }
// return results // return results
length = region->bytes()/width; length = region->bytes() / width;
return region->base(); return region->base();
} }
@ -316,6 +316,7 @@ bool ioport_finder<Required>::findit(validity_checker *valid)
} }
//************************************************************************** //**************************************************************************
// ADDRESS SPACE FINDER // ADDRESS SPACE FINDER
//************************************************************************** //**************************************************************************
@ -342,6 +343,7 @@ bool address_space_finder<Required>::findit(validity_checker *valid)
} }
//************************************************************************** //**************************************************************************
// MEMORY BANK CREATOR // MEMORY BANK CREATOR
//************************************************************************** //**************************************************************************
@ -353,46 +355,48 @@ bool memory_bank_creator::findit(validity_checker *valid)
device_t &dev = m_base.get(); device_t &dev = m_base.get();
memory_manager &manager = dev.machine().memory(); memory_manager &manager = dev.machine().memory();
std::string tag = dev.subtag(m_tag); std::string const tag = dev.subtag(m_tag);
memory_bank *bank = manager.bank_find(tag); memory_bank *const bank = manager.bank_find(tag);
if (bank) m_target = bank ? bank : manager.bank_alloc(dev, tag);
m_target = bank;
else
m_target = manager.bank_alloc(dev, tag);
return true; return true;
} }
void memory_bank_creator::end_configuration() void memory_bank_creator::end_configuration()
{ {
m_target = nullptr; m_target = nullptr;
} }
//************************************************************************** //**************************************************************************
// MEMORY SHARE CREATOR // MEMORY SHARE CREATOR
//************************************************************************** //**************************************************************************
template<typename uX> memory_share_creator<uX>::memory_share_creator(device_t &base, char const *tag, size_t bytes, endianness_t endianness) template <typename PointerType>
memory_share_creator<PointerType>::memory_share_creator(device_t &base, char const *tag, size_t bytes, endianness_t endianness)
: finder_base(base, tag) : finder_base(base, tag)
, m_width(sizeof(uX)*8) , m_width(sizeof(PointerType) * 8)
, m_bytes(bytes) , m_bytes(bytes)
, m_endianness(endianness) , m_endianness(endianness)
{ {
} }
template<typename uX> bool memory_share_creator<uX>::findit(validity_checker *valid)
template <typename PointerType>
bool memory_share_creator<PointerType>::findit(validity_checker *valid)
{ {
if (valid) if (valid)
return true; return true;
device_t &dev = m_base.get(); device_t &dev = m_base.get();
memory_manager &manager = dev.machine().memory(); memory_manager &manager = dev.machine().memory();
std::string tag = dev.subtag(m_tag); std::string const tag = dev.subtag(m_tag);
memory_share *share = manager.share_find(tag); memory_share *const share = manager.share_find(tag);
if (share) if (share)
{ {
m_target = share; m_target = share;
std::string result = share->compare(m_width, m_bytes, m_endianness); std::string const result = share->compare(m_width, m_bytes, m_endianness);
if (!result.empty()) if (!result.empty())
{ {
osd_printf_error("%s\n", result); osd_printf_error("%s\n", result);
@ -400,11 +404,15 @@ template<typename uX> bool memory_share_creator<uX>::findit(validity_checker *va
} }
} }
else else
{
m_target = manager.share_alloc(dev, tag, m_width, m_bytes, m_endianness); m_target = manager.share_alloc(dev, tag, m_width, m_bytes, m_endianness);
}
return true; return true;
} }
template<typename uX> void memory_share_creator<uX>::end_configuration()
template <typename PointerType>
void memory_share_creator<PointerType>::end_configuration()
{ {
m_target = nullptr; m_target = nullptr;
} }
@ -489,7 +497,13 @@ template class shared_ptr_finder<s32, false>;
template class shared_ptr_finder<s32, true>; template class shared_ptr_finder<s32, true>;
template class shared_ptr_finder<s64, false>; template class shared_ptr_finder<s64, false>;
template class shared_ptr_finder<s64, true>; template class shared_ptr_finder<s64, true>;
template class memory_share_creator<u8>; template class memory_share_creator<u8>;
template class memory_share_creator<u16>; template class memory_share_creator<u16>;
template class memory_share_creator<u32>; template class memory_share_creator<u32>;
template class memory_share_creator<u64>; template class memory_share_creator<u64>;
template class memory_share_creator<s8>;
template class memory_share_creator<s16>;
template class memory_share_creator<s32>;
template class memory_share_creator<s64>;

View File

@ -753,9 +753,10 @@ template <unsigned Count, bool Required> using memory_bank_array_finder = object
template <unsigned Count> using optional_memory_bank_array = memory_bank_array_finder<Count, false>; template <unsigned Count> using optional_memory_bank_array = memory_bank_array_finder<Count, false>;
template <unsigned Count> using required_memory_bank_array = memory_bank_array_finder<Count, true>; template <unsigned Count> using required_memory_bank_array = memory_bank_array_finder<Count, true>;
/// \brief Memory bank creator /// \brief Memory bank creator
/// ///
/// Creates a memory bank or picks up an existing one. /// Creates a memory bank or finds an existing one.
class memory_bank_creator : finder_base class memory_bank_creator : finder_base
{ {
public: public:
@ -792,10 +793,11 @@ protected:
template <unsigned Count> using memory_bank_array_creator = object_array_finder<memory_bank_creator, Count>; template <unsigned Count> using memory_bank_array_creator = object_array_finder<memory_bank_creator, Count>;
/// \brief Memory share creator
/// \brief Memory share creator template
/// ///
/// Creates a memory share or picks up an existing one. /// Creates a memory share or finds an existing one.
template<typename uX> class memory_share_creator : finder_base template <typename PointerType> class memory_share_creator : finder_base
{ {
public: public:
memory_share_creator(device_t &base, char const *tag, size_t bytes, endianness_t endianness); memory_share_creator(device_t &base, char const *tag, size_t bytes, endianness_t endianness);
@ -803,17 +805,17 @@ public:
/// \brief Get pointer to the share object /// \brief Get pointer to the share object
/// \return Pointer to share object. /// \return Pointer to share object.
memory_share *share() const { return m_target; } memory_share *target() const { return m_target; }
/// \brief Get pointer to the share object backing ram /// \brief Get pointer to the share object backing RAM
/// \return Pointer to the ram. /// \return Pointer to the RAM.
uX *ptr() const { return reinterpret_cast<uX *>(m_target->ptr()); } PointerType *ptr() const { return reinterpret_cast<PointerType *>(m_target->ptr()); }
/// \brief Cast-to-pointer operator /// \brief Cast-to-pointer operator
/// ///
/// Allows implicit casting to a pointer to the target bank object. /// Allows implicit casting to a pointer to the target backing RAM.
/// \return Pointer to target bank object /// \return Pointer to target bank object
operator uX *() const { return reinterpret_cast<uX *>(m_target->ptr()); } operator PointerType *() const { return reinterpret_cast<PointerType *>(m_target->ptr()); }
/// \brief Pointer member access operator /// \brief Pointer member access operator
/// ///
@ -842,6 +844,7 @@ protected:
const endianness_t m_endianness; // endianness of the memory const endianness_t m_endianness; // endianness of the memory
}; };
/// \brief I/O port finder template /// \brief I/O port finder template
/// ///
/// Template argument is whether the I/O port is required. It is a /// Template argument is whether the I/O port is required. It is a
@ -1239,5 +1242,15 @@ extern template class shared_ptr_finder<s32, true>;
extern template class shared_ptr_finder<s64, false>; extern template class shared_ptr_finder<s64, false>;
extern template class shared_ptr_finder<s64, true>; extern template class shared_ptr_finder<s64, true>;
extern template class memory_share_creator<u8>;
extern template class memory_share_creator<u16>;
extern template class memory_share_creator<u32>;
extern template class memory_share_creator<u64>;
extern template class memory_share_creator<s8>;
extern template class memory_share_creator<s16>;
extern template class memory_share_creator<s32>;
extern template class memory_share_creator<s64>;
#endif // MAME_EMU_DEVFIND_H #endif // MAME_EMU_DEVFIND_H
/// \} /// \}

View File

@ -906,8 +906,6 @@ memory_manager::memory_manager(running_machine &machine)
memory_manager::~memory_manager() memory_manager::~memory_manager()
{ {
for(void *ptr : m_datablocks)
free(ptr);
} }
//------------------------------------------------- //-------------------------------------------------
@ -1036,10 +1034,9 @@ void memory_manager::initialize()
void *memory_manager::allocate_memory(device_t &dev, int spacenum, std::string name, u8 width, size_t bytes) void *memory_manager::allocate_memory(device_t &dev, int spacenum, std::string name, u8 width, size_t bytes)
{ {
void *ptr = malloc(bytes); void *const ptr = m_datablocks.emplace(m_datablocks.end(), malloc(bytes))->get();
memset(ptr, 0, bytes); memset(ptr, 0, bytes);
m_datablocks.push_back(ptr); machine().save().save_memory(&dev, "memory", dev.tag(), spacenum, name.c_str(), ptr, width/8, u32(bytes) / (width/8));
machine().save().save_memory(&dev, "memory", dev.tag(), spacenum, name.c_str(), ptr, width/8, (u32)bytes / (width/8));
return ptr; return ptr;
} }
@ -1709,8 +1706,8 @@ void address_space::populate_map_entry(const address_map_entry &entry, read_or_w
install_bank_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, install_bank_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror,
(readorwrite == read_or_write::READ) ? bank : nullptr, (readorwrite == read_or_write::READ) ? bank : nullptr,
(readorwrite == read_or_write::WRITE) ? bank : nullptr); (readorwrite == read_or_write::WRITE) ? bank : nullptr);
break;
} }
break;
case AMH_DEVICE_SUBMAP: case AMH_DEVICE_SUBMAP:
throw emu_fatalerror("Internal mapping error: leftover mapping of '%s'.\n", data.m_tag); throw emu_fatalerror("Internal mapping error: leftover mapping of '%s'.\n", data.m_tag);

View File

@ -1787,10 +1787,12 @@ public:
void region_free(std::string name); void region_free(std::string name);
private: private:
struct stdlib_deleter { void operator()(void *p) const { free(p); } };
// internal state // internal state
running_machine & m_machine; // reference to the machine running_machine & m_machine; // reference to the machine
std::vector<void *> m_datablocks; // list of memory blocks to free on exit std::vector<std::unique_ptr<void, stdlib_deleter>> m_datablocks; // list of memory blocks to free on exit
std::unordered_map<std::string, std::unique_ptr<memory_bank>> m_banklist; // data gathered for each bank std::unordered_map<std::string, std::unique_ptr<memory_bank>> m_banklist; // data gathered for each bank
std::unordered_map<std::string, std::unique_ptr<memory_share>> m_sharelist; // map for share lookups std::unordered_map<std::string, std::unique_ptr<memory_share>> m_sharelist; // map for share lookups
std::unordered_map<std::string, std::unique_ptr<memory_region>> m_regionlist; // list of memory regions std::unordered_map<std::string, std::unique_ptr<memory_region>> m_regionlist; // list of memory regions

View File

@ -1278,7 +1278,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list
machine().memory().region_free(memregion->name()); machine().memory().region_free(memregion->name());
} }
/* remember the base and length */ // remember the base and length
m_region = machine().memory().region_alloc(regiontag, regionlength, width, endianness); m_region = machine().memory().region_alloc(regiontag, regionlength, width, endianness);
LOG("Allocated %X bytes @ %p\n", m_region->bytes(), m_region->base()); LOG("Allocated %X bytes @ %p\n", m_region->bytes(), m_region->base());

View File

@ -67,7 +67,6 @@ public:
: amiga_state(mconfig, type, tag) : amiga_state(mconfig, type, tag)
, m_bios_region(*this, "user2") , m_bios_region(*this, "user2")
, m_rom_board(*this, "user3") , m_rom_board(*this, "user3")
{ {
} }
@ -90,9 +89,13 @@ public:
void init_dlta(); void init_dlta();
void init_argh(); void init_argh();
void arcadia_multibios_change_game(uint16_t data);
template <int Coin> DECLARE_CUSTOM_INPUT_MEMBER(coin_counter_r); template <int Coin> DECLARE_CUSTOM_INPUT_MEMBER(coin_counter_r);
DECLARE_INPUT_CHANGED_MEMBER(coin_changed_callback); DECLARE_INPUT_CHANGED_MEMBER(coin_changed_callback);
protected:
virtual void machine_reset() override;
void arcadia_multibios_change_game(uint16_t data);
void arcadia_cia_0_portb_w(uint8_t data); void arcadia_cia_0_portb_w(uint8_t data);
private: private:
@ -103,8 +106,6 @@ private:
void argh_map(address_map &map); void argh_map(address_map &map);
void overlay_512kb_map(address_map &map); void overlay_512kb_map(address_map &map);
virtual void machine_reset() override;
optional_memory_region m_bios_region, m_rom_board; optional_memory_region m_bios_region, m_rom_board;
uint8_t m_coin_counter[2]; uint8_t m_coin_counter[2];

View File

@ -713,7 +713,10 @@ void hp3478a_state::hp3478a(machine_config &config)
******************************************************************************/ ******************************************************************************/
ROM_START( hp3478a ) ROM_START( hp3478a )
ROM_REGION( 0x2000, "maincpu", 0 ) ROM_REGION( 0x2000, "maincpu", 0 )
ROM_LOAD("rom_dc118.bin", 0, 0x2000, CRC(10097ced) SHA1(bd665cf7e07e63f825b2353c8322ed8a4376b3bd)) //main CPU ROM, can match other datecodes too ROM_LOAD("rom_dc118.bin", 0, 0x2000, CRC(10097ced) SHA1(bd665cf7e07e63f825b2353c8322ed8a4376b3bd)) // main CPU ROM, can match other datecodes too
ROM_REGION( 0x100, "nvram", 0 ) // default data for battery-backed Calibration RAM
ROM_LOAD( "calram.bin", 0, 0x100, NO_DUMP)
ROM_END ROM_END
/****************************************************************************** /******************************************************************************

View File

@ -92,7 +92,6 @@ private:
class jtces40_state : public jtc_state class jtces40_state : public jtc_state
{ {
public: public:
using jtc_state::jtc_state;
jtces40_state(const machine_config &mconfig, device_type type, const char *tag) jtces40_state(const machine_config &mconfig, device_type type, const char *tag)
: jtc_state(mconfig, type, tag) : jtc_state(mconfig, type, tag)
, m_video_ram_40(*this, "videoram40", JTC_ES40_VIDEORAM_SIZE, ENDIANNESS_BIG) , m_video_ram_40(*this, "videoram40", JTC_ES40_VIDEORAM_SIZE, ENDIANNESS_BIG)

View File

@ -89,7 +89,7 @@ void klax_bootleg_state::machine_start()
m_audio_sample[0] = m_audio_sample[1] = 0x00; m_audio_sample[0] = m_audio_sample[1] = 0x00;
m_audio_nibble = 0; m_audio_nibble = 0;
save_pointer(NAME(m_audio_sample), 2); save_item(NAME(m_audio_sample));
save_item(NAME(m_audio_nibble)); save_item(NAME(m_audio_nibble));
} }

View File

@ -111,7 +111,7 @@ private:
void mk3b_soc_state::map(address_map &map) void mk3b_soc_state::map(address_map &map)
{ {
// 64MB external NOR flash // 64MB external NOR flash
map(0x08000000, 0x0BFFFFFF).rom().share("norflash");; map(0x08000000, 0x0BFFFFFF).rom().share("norflash");
// unknown amount and configuration of internal RAM // unknown amount and configuration of internal RAM
map(0x00000000, 0x0000FFFF).ram().share("iram0"); map(0x00000000, 0x0000FFFF).ram().share("iram0");
// This section of RAM seems to contain the stack // This section of RAM seems to contain the stack

View File

@ -112,6 +112,7 @@ void tigeroad_state::main_map(address_map &map)
map(0xfe8000, 0xfe8003).w(FUNC(tigeroad_state::scroll_w)); map(0xfe8000, 0xfe8003).w(FUNC(tigeroad_state::scroll_w));
map(0xfe800e, 0xfe800f).nopw(); // fe800e = watchdog or IRQ acknowledge map(0xfe800e, 0xfe800f).nopw(); // fe800e = watchdog or IRQ acknowledge
map(0xfec000, 0xfec7ff).ram().w(FUNC(tigeroad_state::videoram_w)).share("videoram"); map(0xfec000, 0xfec7ff).ram().w(FUNC(tigeroad_state::videoram_w)).share("videoram");
map(0xff8000, 0xff87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0xff8000, 0xff87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0xffc000, 0xffffff).ram().share("ram16"); map(0xffc000, 0xffffff).ram().share("ram16");
} }

View File

@ -983,7 +983,7 @@ void v1050_state::machine_start()
program.install_readwrite_bank(0x2000, 0x3fff, membank("bank2")); program.install_readwrite_bank(0x2000, 0x3fff, membank("bank2"));
membank("bank2")->configure_entries(0, 2, ram + 0x2000, 0x10000); membank("bank2")->configure_entries(0, 2, ram + 0x2000, 0x10000);
membank("bank2")->configure_entry(2, ram + 0x1e000); membank("bank2")->configure_entry(2, ram + 0x1e000);
program.install_readwrite_bank(0x4000, 0x7fff, membank("bank3")); program.install_readwrite_bank(0x4000, 0x7fff, membank("bank3"));
membank("bank3")->configure_entries(0, 2, ram + 0x4000, 0x10000); membank("bank3")->configure_entries(0, 2, ram + 0x4000, 0x10000);

View File

@ -263,7 +263,7 @@ void voyager_state::voyager_map(address_map &map)
map(0x000a0000, 0x000bffff).rw("vga", FUNC(trident_vga_device::mem_r), FUNC(trident_vga_device::mem_w)); // VGA VRAM map(0x000a0000, 0x000bffff).rw("vga", FUNC(trident_vga_device::mem_r), FUNC(trident_vga_device::mem_w)); // VGA VRAM
map(0x000c0000, 0x000c7fff).rom().region("video_bios", 0); map(0x000c0000, 0x000c7fff).rom().region("video_bios", 0);
map(0x000c8000, 0x000cffff).noprw(); map(0x000c8000, 0x000cffff).noprw();
//map(0x000d0000, 0x000d0003).ram(); // XYLINX - Synchronus serial communication //map(0x000d0000, 0x000d0003).ram(); // XYLINX - Synchronous serial communication
map(0x000d0008, 0x000d000b).nopw(); // ??? map(0x000d0008, 0x000d000b).nopw(); // ???
map(0x000d0800, 0x000d0fff).rw(FUNC(voyager_state::nvram_r), FUNC(voyager_state::nvram_w)); // GAME_CMOS map(0x000d0800, 0x000d0fff).rw(FUNC(voyager_state::nvram_r), FUNC(voyager_state::nvram_w)); // GAME_CMOS

View File

@ -18,6 +18,16 @@
class ojankohs_state : public driver_device class ojankohs_state : public driver_device
{ {
public: public:
ojankohs_state(const machine_config &mconfig, device_type type, const char *tag) :
ojankohs_state(mconfig, type, tag, 0x1000, 0x800)
{ }
void ojankohs(machine_config &config);
void ccasino(machine_config &config);
void ojankoc(machine_config &config);
void ojankoy(machine_config &config);
protected:
ojankohs_state(const machine_config &mconfig, device_type type, const char *tag, uint32_t vramsize, uint32_t pramsize) : ojankohs_state(const machine_config &mconfig, device_type type, const char *tag, uint32_t vramsize, uint32_t pramsize) :
driver_device(mconfig, type, tag), driver_device(mconfig, type, tag),
m_videoram(*this, "videoram", vramsize, ENDIANNESS_LITTLE), m_videoram(*this, "videoram", vramsize, ENDIANNESS_LITTLE),
@ -37,16 +47,6 @@ public:
m_dsw3(*this, "dsw3"), m_dsw4(*this, "dsw4") m_dsw3(*this, "dsw3"), m_dsw4(*this, "dsw4")
{ } { }
ojankohs_state(const machine_config &mconfig, device_type type, const char *tag) :
ojankohs_state(mconfig, type, tag, 0x1000, 0x800)
{ }
void ojankohs(machine_config &config);
void ccasino(machine_config &config);
void ojankoc(machine_config &config);
void ojankoy(machine_config &config);
protected:
virtual void machine_reset() override; virtual void machine_reset() override;
private: private:

View File

@ -564,7 +564,7 @@ void *sega_315_5195_mapper_device::decrypt_bank::set(offs_t start, offs_t end, o
m_start = start; m_start = start;
m_end = end; m_end = end;
m_rgnoffs = rgnoffs; m_rgnoffs = rgnoffs;
m_srcptr = static_cast<u8 *>(src); m_srcptr = reinterpret_cast<u8 *>(src);
// configure the fd1094 cache // configure the fd1094 cache
if (m_fd1094_cache != nullptr) if (m_fd1094_cache != nullptr)

View File

@ -233,8 +233,8 @@ void toaplan1_rallybik_state::video_start()
create_tilemaps(); create_tilemaps();
vram_alloc(); vram_alloc();
m_buffered_spriteram = make_unique_clear<u16[]>(m_spriteram.share()->bytes() / 2); m_buffered_spriteram = make_unique_clear<u16[]>(m_spriteram.bytes() / 2);
save_pointer(NAME(m_buffered_spriteram), m_spriteram.share()->bytes() / 2); save_pointer(NAME(m_buffered_spriteram), m_spriteram.bytes() / 2);
m_tilemap[0]->set_scrolldx(-0x00d - 6, -0x80 + 6); m_tilemap[0]->set_scrolldx(-0x00d - 6, -0x80 + 6);
m_tilemap[1]->set_scrolldx(-0x00d - 4, -0x80 + 4); m_tilemap[1]->set_scrolldx(-0x00d - 4, -0x80 + 4);
@ -771,7 +771,7 @@ void toaplan1_state::draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, c
u16 *size = (u16 *)m_buffered_spritesizeram.get(); u16 *size = (u16 *)m_buffered_spritesizeram.get();
int fcu_flipscreen = m_fcu_flipscreen; int fcu_flipscreen = m_fcu_flipscreen;
for (int offs = m_spriteram.share()->bytes() / 2 - 4; offs >= 0; offs -= 4) for (int offs = m_spriteram.bytes() / 2 - 4; offs >= 0; offs -= 4)
{ {
if (!(source[offs] & 0x8000)) if (!(source[offs] & 0x8000))
{ {
@ -839,7 +839,7 @@ u32 toaplan1_rallybik_state::screen_update(screen_device &screen, bitmap_rgb32 &
{ {
log_vram(); log_vram();
m_spritegen->draw_sprites_to_tempbitmap(cliprect, m_buffered_spriteram.get(), m_spriteram.share()->bytes()); m_spritegen->draw_sprites_to_tempbitmap(cliprect, m_buffered_spriteram.get(), m_spriteram.bytes());
// first draw everything, including "disabled" tiles and priority 0 // first draw everything, including "disabled" tiles and priority 0
m_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); m_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
@ -895,7 +895,7 @@ WRITE_LINE_MEMBER(toaplan1_rallybik_state::screen_vblank)
// rising edge // rising edge
if (state) if (state)
{ {
memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.share()->bytes()); memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.bytes());
interrupt(); interrupt();
} }
} }
@ -905,7 +905,7 @@ WRITE_LINE_MEMBER(toaplan1_state::screen_vblank)
// rising edge // rising edge
if (state) if (state)
{ {
memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.share()->bytes()); memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.bytes());
memcpy(m_buffered_spritesizeram.get(), m_spritesizeram.get(), TOAPLAN1_SPRITESIZERAM_SIZE); memcpy(m_buffered_spritesizeram.get(), m_spritesizeram.get(), TOAPLAN1_SPRITESIZERAM_SIZE);
interrupt(); interrupt();
} }
@ -916,7 +916,7 @@ WRITE_LINE_MEMBER(toaplan1_samesame_state::screen_vblank)
// rising edge // rising edge
if (state) if (state)
{ {
memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.share()->bytes()); memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.bytes());
memcpy(m_buffered_spritesizeram.get(), m_spritesizeram.get(), TOAPLAN1_SPRITESIZERAM_SIZE); memcpy(m_buffered_spritesizeram.get(), m_spritesizeram.get(), TOAPLAN1_SPRITESIZERAM_SIZE);
interrupt(); interrupt();
m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); /* Frame done */ m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); /* Frame done */