Previous 199869 Revisions Next

r26445 Friday 29th November, 2013 at 20:57:01 UTC by Couriersud
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)
   
   
[src/emu/netlist]nl_time.h
[src/emu/netlist/devices]nld_system.c nld_system.h
[src/mame/drivers]pong.c

trunk/src/mame/drivers/pong.c
r26444r26445
6363   H_TOTAL-67,H_TOTAL-40,H_TOTAL-8,H_TOTAL,
6464   V_TOTAL-22,V_TOTAL-19,V_TOTAL-16,V_TOTAL,
6565   1,  /* interlaced */
66   0.3
66   0.32
6767};
6868
6969fixedfreq_interface fixedfreq_mode_pongX2 = {
r26444r26445
7171   (H_TOTAL-67) * 2, (H_TOTAL-40) * 2, (H_TOTAL-8) * 2, (H_TOTAL) * 2,
7272   V_TOTAL-22,V_TOTAL-19,V_TOTAL-16,V_TOTAL,
7373   1,  /* interlaced */
74   0.3
74   0.32
7575};
7676
7777enum input_changed_enum
r26444r26445
460460   TTL_7486_XOR(ic_a4d, hsyncQ, vsyncQ)
461461   TTL_7404_INVERT(ic_e4f, ic_a4d.Q)
462462
463#if 0
463464   NETDEV_MIXER3(videomix, video, score, ic_e4f.Q)
464465   NETDEV_PARAM(videomix.R1, RES_K(1))
465466   NETDEV_PARAM(videomix.R2, RES_K(1.2))
466467   NETDEV_PARAM(videomix.R3, RES_K(22))
468#else
469   NETDEV_R(RV1, RES_K(1))
470    NETDEV_R(RV2, RES_K(1.2))
471    NETDEV_R(RV3, RES_K(22))
472    NET_C(video, RV1.1)
473    NET_C(score, RV2.1)
474    NET_C(ic_e4f.Q, RV3.1)
475    NET_C(RV1.2, RV2.2)
476    NET_C(RV2.2, RV3.2)
467477
478    NET_ALIAS(videomix, RV3.2)
468479
480    NETDEV_SOLVER(Solver)
481    NETDEV_ANALOG_CONST(V5, 5)
482    NETDEV_ANALOG_CONST(V1, 1)
483    NETDEV_ANALOG_CONST(V0, 0)
484
485#endif
469486#if 0
470487    NETDEV_R(R1, 10)
471488    NETDEV_R(R2, 10)
r26444r26445
503520    tt(28)
504521    tt(29)
505522*/
506#if 1
507    NETDEV_SOLVER(Solver)
508    NETDEV_ANALOG_CONST(V5, 5)
509    NETDEV_ANALOG_CONST(V1, 1)
510    NETDEV_ANALOG_CONST(V0, 0)
511523
524#if 0
512525    NETDEV_R(R5, 1000)
513526    NETDEV_1N914(D1)
514527    NET_C(V5, R5.1)
r26444r26445
518531#endif
519532
520533#if 0
521    NETDEV_SOLVER(Solver)
522    NETDEV_ANALOG_CONST(V5, 5)
523    NETDEV_ANALOG_CONST(V1, 1)
524    NETDEV_ANALOG_CONST(V0, 0)
534
525535    // astable NAND Multivibrator
526536    NETDEV_R(R1, 1000)
527537    NETDEV_C(C1, 1e-6)
r26444r26445
607617   void video_cb(double newval)
608618   {
609619      m_video->update_vid(newval, m_maincpu->local_time());
620      //printf("%20.15f\n", newval);
610621   }
611622
612623protected:
trunk/src/emu/netlist/nl_time.h
r26444r26445
4242    ATTR_HOT friend inline bool operator<=(const netlist_time &left, const netlist_time &right);
4343
4444    ATTR_HOT inline const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; }
45    ATTR_HOT inline const netlist_time &operator=(const double &right) { m_time = (INTERNALTYPE) ( right * (double) RESOLUTION); return *this; }
46    ATTR_HOT inline operator double() const { return as_double(); }
47
4548    ATTR_HOT inline const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; }
4649
4750    ATTR_HOT inline const INTERNALTYPE as_raw() const { return m_time; }
r26444r26445
5154    ATTR_HOT static inline const netlist_time from_usec(const int us) { return netlist_time((UINT64) us * (RESOLUTION / U64(1000000))); }
5255    ATTR_HOT static inline const netlist_time from_msec(const int ms) { return netlist_time((UINT64) ms * (RESOLUTION / U64(1000))); }
5356    ATTR_HOT static inline const netlist_time from_hz(const UINT64 hz) { return netlist_time(RESOLUTION / hz); }
57    ATTR_HOT static inline const netlist_time from_double(const double t) { return netlist_time((INTERNALTYPE) ( t * (double) RESOLUTION)); }
5458    ATTR_HOT static inline const netlist_time from_raw(const INTERNALTYPE raw) { return netlist_time(raw); }
5559
5660    static const netlist_time zero;
trunk/src/emu/netlist/devices/nld_system.c
r26444r26445
8282
8383NETLIB_START(solver)
8484{
85    register_output("Q", m_Q);
85    register_output("Q_sync", m_Q_sync);
86    register_output("Q_step", m_Q_step);
8687    //register_input("FB", m_feedback);
8788
89    register_param("SYNC_DELAY", m_sync_delay, NLTIME_FROM_NS(10).as_double());
90    m_nt_sync_delay = m_sync_delay.Value();
91
8892    register_param("FREQ", m_freq, 50000.0);
8993    m_inc = netlist_time::from_hz(m_freq.Value());
9094
91    register_link_internal(m_feedback, m_Q, netlist_input_t::STATE_INP_ACTIVE);
95    register_link_internal(m_fb_sync, m_Q_sync, netlist_input_t::STATE_INP_ACTIVE);
96    register_link_internal(m_fb_step, m_Q_step, netlist_input_t::STATE_INP_ACTIVE);
9297    m_last_step = netlist_time::zero;
9398
9499}
r26444r26445
190195    else
191196    {
192197        /* update all inputs connected */
198#if 0
199        for (net_list_t::entry_t *pn = m_nets.first(); pn != NULL; pn = m_nets.next(pn))
200        {
201            if (pn->object()->m_cur.Analog != pn->object()->m_last.Analog)
202            {
203                for (netlist_terminal_t *p = pn->object()->m_head; p != NULL; p = p->m_update_list_next)
204                {
205                    if (p->isType(netlist_terminal_t::INPUT))
206                        p->netdev().update_dev();
207                }
208            }
209            pn->object()->m_last.Analog = pn->object()->m_cur.Analog;
210        }
211#else
193212        for (terminal_list_t::entry_t *p = m_inps.first(); p != NULL; p = m_inps.next(p))
194213            p->object()->netdev().update_dev();
214#endif
195215        /* step circuit */
196        if (!m_Q.net().is_queued())
197        {
198            m_Q.net().push_to_queue(m_inc);
199        }
216        if (!m_Q_step.net().is_queued())
217            m_Q_step.net().push_to_queue(m_inc);
200218    }
201219
202220        /* only inputs and terminals connected
trunk/src/emu/netlist/devices/nld_system.h
r26444r26445
102102        typedef netlist_list_t<netlist_terminal_t *> terminal_list_t;
103103        typedef netlist_list_t<netlist_net_t *>      net_list_t;
104104
105        netlist_ttl_input_t m_feedback;
106        netlist_ttl_output_t m_Q;
105        netlist_ttl_input_t m_fb_sync;
106        netlist_ttl_output_t m_Q_sync;
107107
108        netlist_ttl_input_t m_fb_step;
109        netlist_ttl_output_t m_Q_step;
110
108111        netlist_param_double_t m_freq;
112        netlist_param_double_t m_sync_delay;
109113
110114        netlist_time m_inc;
111115        netlist_time m_last_step;
116        netlist_time m_nt_sync_delay;
112117
113118        terminal_list_t m_terms;
114119        terminal_list_t m_inps;
r26444r26445
127132inline void NETLIB_NAME(solver)::schedule()
128133{
129134    // FIXME: time should be parameter;
130    if (!m_Q.net().is_queued()) {
131        m_Q.net().push_to_queue(NLTIME_FROM_NS(10));
132    }
135    if (!m_Q_sync.net().is_queued())
136        m_Q_sync.net().push_to_queue(m_nt_sync_delay);
133137}
134138
135139// ----------------------------------------------------------------------------------------

Previous 199869 Revisions Next


© 1997-2024 The MAME Team