summaryrefslogtreecommitdiffstats
path: root/src/mame/drivers/blit.cpp
diff options
context:
space:
mode:
author Vas Crabb <cuavas@users.noreply.github.com>2022-02-12 04:10:39 +1100
committer GitHub <noreply@github.com>2022-02-12 04:10:39 +1100
commita18509185569b8e637c7e129caab5eb75e4adff9 (patch)
tree4e312575e03db0cb0fec4d90a8bb91d831629130 /src/mame/drivers/blit.cpp
parentf0fc52d32c4933b76bfc7ba91838b1b29b962595 (diff)
Addressed some Lua scripting pitfalls. (#9294)
Addressed pure virtual function call crash on end of emulation session if you haven't explicitly removed all address space taps, memory corruption on end of emulation session if you haven't explicitly removed all address space change notifiers, and symbol being garbage-collected out from under you while you have parsed expressions or other symbol tables that depend on them. Removed the copy constructor for parsed expressions as the underlying C++ copy constructor appears to be broken, and simplified symbol table constructors. Also made symbol table add methods return the new entry to avoid the need for an extra lookup. Fixed breakpoint/watchpoint objects being inappropriately copied into the tables returned by bplist() and wplist(), allowing the enabled property to be modifiable for breakpoint and watchpoint objects in Lua. Fixed drivers and devices causing a new memory pass-through handler to be allocated on each soft reset, and fixed multiple instances of taps being installed in the event the machine is reset before the tap is removed. Added classes for managing broadcast subscriptions, and adapted address spaces to use this for change notifications.
Diffstat (limited to 'src/mame/drivers/blit.cpp')
-rw-r--r--src/mame/drivers/blit.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/mame/drivers/blit.cpp b/src/mame/drivers/blit.cpp
index 4878a60865a..d75273aa559 100644
--- a/src/mame/drivers/blit.cpp
+++ b/src/mame/drivers/blit.cpp
@@ -56,6 +56,8 @@
#define LOGDBG(...) LOGMASKED(LOG_DEBUG, __VA_ARGS__)
+namespace {
+
class blit_state : public driver_device
{
public:
@@ -95,7 +97,7 @@ private:
required_shared_ptr<uint16_t> m_p_ram;
required_region_ptr<uint16_t> m_sysrom;
- memory_passthrough_handler *m_rom_shadow_tap;
+ memory_passthrough_handler m_rom_shadow_tap;
int m_videostart = 0;
};
@@ -211,20 +213,22 @@ void blit_state::machine_reset()
{
address_space &program = m_maincpu->space(AS_PROGRAM);
program.install_rom(0x000000, 0x000007, m_sysrom); // do it here for F3
- m_rom_shadow_tap = program.install_read_tap(0x040000, 0x045fff, "rom_shadow_r",[this](offs_t offset, u16 &data, u16 mem_mask)
- {
- if (!machine().side_effects_disabled())
- {
- // delete this tap
- m_rom_shadow_tap->remove();
-
- // reinstall ram over the rom shadow
- m_maincpu->space(AS_PROGRAM).install_ram(0x000000, 0x000007, m_p_ram);
- }
+ m_rom_shadow_tap.remove();
+ m_rom_shadow_tap = program.install_read_tap(
+ 0x040000, 0x045fff,
+ "rom_shadow_r",
+ [this] (offs_t offset, u16 &data, u16 mem_mask)
+ {
+ if (!machine().side_effects_disabled())
+ {
+ // delete this tap
+ m_rom_shadow_tap.remove();
- // return the original data
- return data;
- });
+ // reinstall ram over the rom shadow
+ m_maincpu->space(AS_PROGRAM).install_ram(0x000000, 0x000007, m_p_ram);
+ }
+ },
+ &m_rom_shadow_tap);
*m_misccr = 0;
}
@@ -284,6 +288,8 @@ ROM_START( blit )
ROMX_LOAD("rom5.bin", 0x4000, 0x08bf, CRC(d87f121f) SHA1(6e776ac29554b8a8bb332168c155bcc502c927b5), ROM_BIOS(0)|ROM_SKIP(1))
ROM_END
+} // anonymous namespace
+
/* Driver */
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
COMP( 1981, blit, 0, 0, blit, blit, blit_state, empty_init, "AT&T", "Blit", MACHINE_IS_SKELETON )