Pong: Pure analog video mixing. Only in pongf currently. Once code stabilizes, the netlist parser will be updated as well.

NETDEV_R(RV1, RES_K(1))
    NETDEV_R(RV2, RES_K(1.2))
    NETDEV_R(RV3, RES_K(22))
    
    NET_C(video, RV1.1)
    NET_C(score, RV2.1)
    NET_C(ic_e4f.Q, RV3.1)
    NET_C(RV1.2, RV2.2)
    NET_C(RV2.2, RV3.2)

    NET_ALIAS(videomix, RV3.2)
This commit is contained in:
Couriersud 2013-11-29 20:57:01 +00:00
parent 6e51c3bc66
commit 1b7fb7a508
4 changed files with 59 additions and 22 deletions

View File

@ -82,13 +82,18 @@ NETLIB_UPDATE(clock)
NETLIB_START(solver)
{
register_output("Q", m_Q);
register_output("Q_sync", m_Q_sync);
register_output("Q_step", m_Q_step);
//register_input("FB", m_feedback);
register_param("SYNC_DELAY", m_sync_delay, NLTIME_FROM_NS(10).as_double());
m_nt_sync_delay = m_sync_delay.Value();
register_param("FREQ", m_freq, 50000.0);
m_inc = netlist_time::from_hz(m_freq.Value());
register_link_internal(m_feedback, m_Q, netlist_input_t::STATE_INP_ACTIVE);
register_link_internal(m_fb_sync, m_Q_sync, netlist_input_t::STATE_INP_ACTIVE);
register_link_internal(m_fb_step, m_Q_step, netlist_input_t::STATE_INP_ACTIVE);
m_last_step = netlist_time::zero;
}
@ -190,13 +195,26 @@ NETLIB_UPDATE(solver)
else
{
/* update all inputs connected */
#if 0
for (net_list_t::entry_t *pn = m_nets.first(); pn != NULL; pn = m_nets.next(pn))
{
if (pn->object()->m_cur.Analog != pn->object()->m_last.Analog)
{
for (netlist_terminal_t *p = pn->object()->m_head; p != NULL; p = p->m_update_list_next)
{
if (p->isType(netlist_terminal_t::INPUT))
p->netdev().update_dev();
}
}
pn->object()->m_last.Analog = pn->object()->m_cur.Analog;
}
#else
for (terminal_list_t::entry_t *p = m_inps.first(); p != NULL; p = m_inps.next(p))
p->object()->netdev().update_dev();
#endif
/* step circuit */
if (!m_Q.net().is_queued())
{
m_Q.net().push_to_queue(m_inc);
}
if (!m_Q_step.net().is_queued())
m_Q_step.net().push_to_queue(m_inc);
}
/* only inputs and terminals connected

View File

@ -102,13 +102,18 @@ NETLIB_DEVICE_WITH_PARAMS(solver,
typedef netlist_list_t<netlist_terminal_t *> terminal_list_t;
typedef netlist_list_t<netlist_net_t *> net_list_t;
netlist_ttl_input_t m_feedback;
netlist_ttl_output_t m_Q;
netlist_ttl_input_t m_fb_sync;
netlist_ttl_output_t m_Q_sync;
netlist_ttl_input_t m_fb_step;
netlist_ttl_output_t m_Q_step;
netlist_param_double_t m_freq;
netlist_param_double_t m_sync_delay;
netlist_time m_inc;
netlist_time m_last_step;
netlist_time m_nt_sync_delay;
terminal_list_t m_terms;
terminal_list_t m_inps;
@ -127,9 +132,8 @@ public:
inline void NETLIB_NAME(solver)::schedule()
{
// FIXME: time should be parameter;
if (!m_Q.net().is_queued()) {
m_Q.net().push_to_queue(NLTIME_FROM_NS(10));
}
if (!m_Q_sync.net().is_queued())
m_Q_sync.net().push_to_queue(m_nt_sync_delay);
}
// ----------------------------------------------------------------------------------------

View File

@ -42,6 +42,9 @@ public:
ATTR_HOT friend inline bool operator<=(const netlist_time &left, const netlist_time &right);
ATTR_HOT inline const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; }
ATTR_HOT inline const netlist_time &operator=(const double &right) { m_time = (INTERNALTYPE) ( right * (double) RESOLUTION); return *this; }
ATTR_HOT inline operator double() const { return as_double(); }
ATTR_HOT inline const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; }
ATTR_HOT inline const INTERNALTYPE as_raw() const { return m_time; }
@ -51,6 +54,7 @@ public:
ATTR_HOT static inline const netlist_time from_usec(const int us) { return netlist_time((UINT64) us * (RESOLUTION / U64(1000000))); }
ATTR_HOT static inline const netlist_time from_msec(const int ms) { return netlist_time((UINT64) ms * (RESOLUTION / U64(1000))); }
ATTR_HOT static inline const netlist_time from_hz(const UINT64 hz) { return netlist_time(RESOLUTION / hz); }
ATTR_HOT static inline const netlist_time from_double(const double t) { return netlist_time((INTERNALTYPE) ( t * (double) RESOLUTION)); }
ATTR_HOT static inline const netlist_time from_raw(const INTERNALTYPE raw) { return netlist_time(raw); }
static const netlist_time zero;

View File

@ -63,7 +63,7 @@ fixedfreq_interface fixedfreq_mode_pong = {
H_TOTAL-67,H_TOTAL-40,H_TOTAL-8,H_TOTAL,
V_TOTAL-22,V_TOTAL-19,V_TOTAL-16,V_TOTAL,
1, /* interlaced */
0.3
0.32
};
fixedfreq_interface fixedfreq_mode_pongX2 = {
@ -71,7 +71,7 @@ fixedfreq_interface fixedfreq_mode_pongX2 = {
(H_TOTAL-67) * 2, (H_TOTAL-40) * 2, (H_TOTAL-8) * 2, (H_TOTAL) * 2,
V_TOTAL-22,V_TOTAL-19,V_TOTAL-16,V_TOTAL,
1, /* interlaced */
0.3
0.32
};
enum input_changed_enum
@ -460,12 +460,29 @@ static NETLIST_START(pong_schematics)
TTL_7486_XOR(ic_a4d, hsyncQ, vsyncQ)
TTL_7404_INVERT(ic_e4f, ic_a4d.Q)
#if 0
NETDEV_MIXER3(videomix, video, score, ic_e4f.Q)
NETDEV_PARAM(videomix.R1, RES_K(1))
NETDEV_PARAM(videomix.R2, RES_K(1.2))
NETDEV_PARAM(videomix.R3, RES_K(22))
#else
NETDEV_R(RV1, RES_K(1))
NETDEV_R(RV2, RES_K(1.2))
NETDEV_R(RV3, RES_K(22))
NET_C(video, RV1.1)
NET_C(score, RV2.1)
NET_C(ic_e4f.Q, RV3.1)
NET_C(RV1.2, RV2.2)
NET_C(RV2.2, RV3.2)
NET_ALIAS(videomix, RV3.2)
NETDEV_SOLVER(Solver)
NETDEV_ANALOG_CONST(V5, 5)
NETDEV_ANALOG_CONST(V1, 1)
NETDEV_ANALOG_CONST(V0, 0)
#endif
#if 0
NETDEV_R(R1, 10)
NETDEV_R(R2, 10)
@ -503,12 +520,8 @@ static NETLIST_START(pong_schematics)
tt(28)
tt(29)
*/
#if 1
NETDEV_SOLVER(Solver)
NETDEV_ANALOG_CONST(V5, 5)
NETDEV_ANALOG_CONST(V1, 1)
NETDEV_ANALOG_CONST(V0, 0)
#if 0
NETDEV_R(R5, 1000)
NETDEV_1N914(D1)
NET_C(V5, R5.1)
@ -518,10 +531,7 @@ static NETLIST_START(pong_schematics)
#endif
#if 0
NETDEV_SOLVER(Solver)
NETDEV_ANALOG_CONST(V5, 5)
NETDEV_ANALOG_CONST(V1, 1)
NETDEV_ANALOG_CONST(V0, 0)
// astable NAND Multivibrator
NETDEV_R(R1, 1000)
NETDEV_C(C1, 1e-6)
@ -607,6 +617,7 @@ public:
void video_cb(double newval)
{
m_video->update_vid(newval, m_maincpu->local_time());
//printf("%20.15f\n", newval);
}
protected: