mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00

Object model optimisation. Merge remote-tracking branch 'origin/master' into netlist_dev Fix a merge issue. #if ==> #elif. Ouch. Default PHAS_PMF_INTERNAL=0 for 32bit windows mingw. Change UINT8 to uint_[fast|least|8_t. Move state_var so it can be used by base devices as well. Remove last traces of ATTR_ALIGN. Refactored netlist_time into a template. Removed implicit double assignment to netlist. Doomed to produce bugs. Instead, use netlist_time::from_double. Switch to using proper (i.e. bool type) param_logic_t. Formally differentiate between logic inputs (e.g. switches) and int inputs (e.g. resistor ladders or selection switches). Added parameter USE_DEACTIVATE to truthtable devices. Added more constexpr to netlist_time. Fixed some ifdef code paths. - More c++. - Simplify main processing loop. As a nice side-effect that squeezed out some cycles. - More cycle squeezing. - Removed pvector_t. - Use std::sort. - Refactored netlist state manager. - Introduction of state_var object template to be used on device state members. - Changed remaining save occurrences to state_var. - Rewrote nltool's listdevices command. This allowed removal of one member from devices which served solely for listdevices. - Remove hashmap_t. Fix kidniki regression.
82 lines
1.2 KiB
C++
82 lines
1.2 KiB
C++
// license:GPL-2.0+
|
|
// copyright-holders:Couriersud
|
|
/*
|
|
* nld_legacy.c
|
|
*
|
|
*/
|
|
|
|
#include "nld_switches.h"
|
|
#include "nl_setup.h"
|
|
|
|
#define R_OFF (1.0 / netlist().gmin())
|
|
#define R_ON 0.01
|
|
|
|
namespace netlist
|
|
{
|
|
namespace devices
|
|
{
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
// SWITCH
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
NETLIB_RESET(switch1)
|
|
{
|
|
m_R.set_R(R_OFF);
|
|
}
|
|
|
|
NETLIB_UPDATE(switch1)
|
|
{
|
|
if (!m_POS.Value())
|
|
{
|
|
m_R.set_R(R_OFF);
|
|
}
|
|
else
|
|
{
|
|
m_R.set_R(R_ON);
|
|
}
|
|
|
|
m_R.update_dev();
|
|
}
|
|
|
|
NETLIB_UPDATE_PARAM(switch1)
|
|
{
|
|
update();
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
// SWITCH2
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
|
|
NETLIB_RESET(switch2)
|
|
{
|
|
m_R1.set_R(R_ON);
|
|
m_R2.set_R(R_OFF);
|
|
}
|
|
|
|
NETLIB_UPDATE(switch2)
|
|
{
|
|
if (!m_POS.Value())
|
|
{
|
|
m_R1.set_R(R_ON);
|
|
m_R2.set_R(R_OFF);
|
|
}
|
|
else
|
|
{
|
|
m_R1.set_R(R_OFF);
|
|
m_R2.set_R(R_ON);
|
|
}
|
|
|
|
m_R1.update_dev();
|
|
m_R2.update_dev();
|
|
}
|
|
|
|
NETLIB_UPDATE_PARAM(switch2)
|
|
{
|
|
update();
|
|
}
|
|
|
|
} //namespace devices
|
|
} // namespace netlist
|