Exemple #1
0
        /*
         *   CD4001BC: Quad 2-Input NOR Buffered B Series Gate
         *
         *       +--------------+
         *    A1 |1     ++    14| VDD
         *    B1 |2           13| A6
         *    A2 |3           12| Y6
         *    Y2 |4    4001   11| A5
         *    A3 |5           10| Y5
         *    Y3 |6            9| A4
         *   VSS |7            8| Y4
         *       +--------------+
         *
         */

        //static NETLIST_START(CD4001_DIP)
        public static void netlist_CD4001_DIP(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            CD4001_GATE(setup, "A");
            CD4001_GATE(setup, "B");
            CD4001_GATE(setup, "C");
            CD4001_GATE(setup, "D");
#endif

            h.NET_C("A.VDD", "B.VDD", "C.VDD", "D.VDD");
            h.NET_C("A.VSS", "B.VSS", "C.VSS", "D.VSS");

            h.DIPPINS(   /*     +--------------+     */
                "A.A", /*  A1 |1     ++    14| VDD */ "A.VDD",
                "A.B", /*  B1 |2           13| B4  */ "D.B",
                "A.Q", /*  Y1 |3           12| A4  */ "D.A",
                "B.Q", /*  Y2 |4    4001   11| Y4  */ "D.Q",
                "B.A", /*  A2 |5           10| Y3  */ "C.Q",
                "B.B", /*  B2 |6            9| B3  */ "C.B",
                "A.VSS", /* VSS |7            8| A3  */ "C.A"
                /*     +--------------+     */
                );

            h.NETLIST_END();
        }
Exemple #2
0
        //- Identifier: CD4066_DIP
        //- Title: CD4066BM/CD4066BC Quad Bilateral Switch
        //- Pinalias: INOUTA,OUTINA,OUTINB,INOUTB,CONTROLB,CONTROLC,VSS,INOUTC,OUTINC,OUTIND,INOUTD,CONTROLD,CONTROLA,VDD
        //- Package: DIP
        //- NamingConvention: Naming conventions follow National Semiconductor datasheet
        //- FunctionTable:
        //-    http://pdf.datasheetcatalog.com/datasheet/nationalsemiconductor/DS005665.PDF
        //-
        //static NETLIST_START(CD4066_DIP)
        public static void netlist_CD4066_DIP(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            CD4066_GATE(setup, "A");
            CD4066_GATE(setup, "B");
            CD4066_GATE(setup, "C");
            CD4066_GATE(setup, "D");
#endif

            h.NET_C("A.VDD", "B.VDD", "C.VDD", "D.VDD");
            h.NET_C("A.VSS", "B.VSS", "C.VSS", "D.VSS");

            h.PARAM("A.BASER", 270.0);
            h.PARAM("B.BASER", 270.0);
            h.PARAM("C.BASER", 270.0);
            h.PARAM("D.BASER", 270.0);

            h.DIPPINS(   /*          +--------------+          */
                "A.R.1", /*   INOUTA |1     ++    14| VDD      */ "A.VDD",
                "A.R.2", /*   OUTINA |2           13| CONTROLA */ "A.CTL",
                "B.R.1", /*   OUTINB |3           12| CONTROLD */ "D.CTL",
                "B.R.2", /*   INOUTB |4    4066   11| INOUTD   */ "D.R.1",
                "B.CTL", /* CONTROLB |5           10| OUTIND   */ "D.R.2",
                "C.CTL", /* CONTROLC |6            9| OUTINC   */ "C.R.1",
                "A.VSS", /*      VSS |7            8| INOUTC   */ "C.R.2"
                /*          +--------------+          */
                );

            h.NETLIST_END();
        }
Exemple #3
0
        //static NETLIST_START(filter)
        void netlist_filter(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            h.CD4066_GATE("G1");
            h.PARAM("G1.BASER", 270.0);
            h.CD4066_GATE("G2");
            h.PARAM("G2.BASER", 270.0);
            h.RES("RI", RES_K(1));
            h.RES("RO", RES_K(5));
            h.CAP("C1", CAP_U(0.22));
            h.CAP("C2", CAP_U(0.047));
            h.NET_C("RI.2", "RO.1", "G1.R.1", "G2.R.1");
            h.NET_C("G1.R.2", "C1.1");
            h.NET_C("G2.R.2", "C2.1");

            h.NET_C("C1.2", "C2.2", "G1.VSS", "G2.VSS");
            h.NET_C("G1.VDD", "G2.VDD");

            h.ALIAS("I", "RI.1");
            h.ALIAS("O", "RO.2");

            h.ALIAS("CTL1", "G1.CTL");
            h.ALIAS("CTL2", "G2.CTL");

            h.ALIAS("VDD", "G1.VDD");
            h.ALIAS("VSS", "G1.VSS");

            h.NETLIST_END();
        }
Exemple #4
0
        //- Identifier: CD4069_DIP
        //- Title: CD4069UBM/CD4069UBC Inverter Circuits
        //- Pinalias: A1,Y1,A2,Y2,A3,Y3,VSS,Y4,A4,Y5,A5,Y6,A6,VDD
        //- Package: DIP
        //- NamingConvention: Naming conventions follow National Semiconductor datasheet
        //- FunctionTable:
        //-    http://pdf.datasheetcatalog.com/datasheets/150/206783_DS.pdf
        //-
        //static NETLIST_START(CD4069_DIP)
        public static void netlist_CD4069_DIP(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            CD4069_GATE(setup, "A");
            CD4069_GATE(setup, "B");
            CD4069_GATE(setup, "C");
            CD4069_GATE(setup, "D");
            CD4069_GATE(setup, "E");
            CD4069_GATE(setup, "F");
#endif

            h.NET_C("A.VDD", "B.VDD", "C.VDD", "D.VDD", "E.VDD", "F.VDD");
            h.NET_C("A.VSS", "B.VSS", "C.VSS", "D.VSS", "E.VSS", "F.VSS");

            h.DIPPINS(   /*     +--------------+     */
                "A.A", /*  A1 |1     ++    14| VDD */ "A.VDD",
                "A.Q", /*  Y1 |2           13| A6  */ "F.A",
                "B.A", /*  A2 |3           12| Y6  */ "F.Q",
                "B.Q", /*  Y2 |4    4069   11| A5  */ "E.A",
                "C.A", /*  A3 |5           10| Y5  */ "E.Q",
                "C.Q", /*  Y3 |6            9| A4  */ "D.A",
                "A.VSS", /* VSS |7            8| Y4  */ "D.Q"
                /*     +--------------+     */
                );

            h.NETLIST_END();
        }
Exemple #5
0
        //- Identifier: CD4070_DIP
        //- Title: CD4070BM/CD4070BC Quad 2-Input EXCLUSIVE-OR Gate
        //- Pinalias: A,B,J,K,C,D,VSS,E,F,L,M,G,H,VDD
        //- Package: DIP
        //- NamingConvention: Naming conventions follow National Semiconductor datasheet
        //- FunctionTable:
        //-    http://pdf.datasheetcatalog.com/datasheets/150/206783_DS.pdf
        //-
        //static NETLIST_START(CD4070_DIP)
        public static void netlist_CD4070_DIP(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            CD4070_GATE(setup, "A");
            CD4070_GATE(setup, "B");
            CD4070_GATE(setup, "C");
            CD4070_GATE(setup, "D");
#endif

            h.NET_C("A.VDD", "B.VDD", "C.VDD", "D.VDD");
            h.NET_C("A.VSS", "B.VSS", "C.VSS", "D.VSS");

            h.DIPPINS(   /*     +--------------+     */
                "A.A", /*   A |1     ++    14| VDD */ "A.VDD",
                "A.B", /*   B |2           13| H   */ "D.B",
                "A.Q", /*   J |3           12| G   */ "D.A",
                "B.Q", /*   K |4    4070   11| M   */ "D.Q",
                "B.A", /*   C |5           10| L   */ "C.Q",
                "B.B", /*   D |6            9| F   */ "C.B",
                "A.VSS", /* VSS |7            8| E   */ "C.A"
                /*     +--------------+     */
                );

            h.NETLIST_END();
        }
Exemple #6
0
        //- Identifier:  CD4538_DIP
        //- Title: CD4538BC Dual Precision Monostable
        //- Pinalias: C1,RC1,CLRQ1,B1,A1,Q1,QQ1,GND,QQ2,Q2,A2,B2,CLRQ2,RC2,C2,VCC
        //- Package: DIP
        //- NamingConvention: Naming conventions follow Fairchild Semiconductor datasheet
        //- Limitations:
        //-    Timing inaccuracies may occur for capacitances < 1nF. Please consult datasheet
        //-
        //- Example: 74123.cpp,74123_example
        //-
        //- FunctionTable:
        //-    https://pdf1.alldatasheet.com/datasheet-pdf/view/50871/FAIRCHILD/CD4538.html
        //-
        //static NETLIST_START(CD4538_DIP)
        public static void netlist_CD4538_DIP(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            CD4538(setup, "A");
            CD4538(setup, "B");
#endif

            h.NET_C("A.VDD", "B.VDD");
            h.NET_C("A.VSS", "B.VSS");

            h.DIPPINS(    /*     +--------------+     */
                "A.C", /*  1Z |1     ++    16| VCC */ "A.VDD",
                "A.RC", /*  1Y |2           15| 1S  */ "B.C",
                "A.CLRQ", /*  2Y |3           14| 4S  */ "B.RC",
                "A.A", /*  2Z |4    4316   13| 4Z  */ "B.CLRQ",
                "A.B", /*  2S |5           12| 4Y  */ "B.A",
                "A.Q", /*  3S |6           11| 3Y  */ "B.B",
                "A.QQ", /*  EQ |7           10| 3Z  */ "B.Q",
                "A.VSS", /* GND |8            9| VEE */ "B.QQ"
                /*     +--------------+     */
                );

            h.NETLIST_END();
        }
Exemple #7
0
        //- Identifier: CD4013_DIP
        //- Title: CD4013BM/CD4013BC Dual D Flip-Flop
        //- Pinalias: Q1,QQ1,CLOCK1,RESET1,DATA1,SET1,VSS,SET2,DATA2,RESET2,CLOCK2,QQ2,Q2,VDD
        //- Package: DIP
        //- NamingConvention: Naming conventions follow National Semiconductor datasheet
        //- FunctionTable:
        //-    http://pdf.datasheetcatalog.com/datasheets/150/108670_DS.pdf
        //-
        //-     +-----+---+---+---++---+----+
        //-     | CLK | D | R | S || Q | QQ |
        //-     +=====+===+===+===++===+====+
        //-     | 0-1 | 0 | 0 | 0 || 0 |  1 |
        //-     | 0-1 | 1 | 0 | 0 || 1 |  0 |
        //-     | 1-0 | X | 0 | 0 || Q | QQ |
        //-     |  X  | X | 1 | 0 || 0 |  1 |
        //-     |  X  | X | 0 | 1 || 1 |  0 |
        //-     |  X  | X | 1 | 1 || 1 |  1 |
        //-     +-----+---+---+---++---+----+
        //-
        //static NETLIST_START(CD4013_DIP)
        public static void netlist_CD4013_DIP(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            CD4013(setup, "A");
            CD4013(setup, "B");
#endif

            h.NET_C("A.VDD", "B.VDD");
            h.NET_C("A.VSS", "B.VSS");

            h.DIPPINS(     /*         +--------------+        */
                "A.Q", /*      Q1 |1     ++    14| VDD    */ "A.VDD",
                "A.QQ", /*     Q1Q |2           13| Q2     */ "B.Q",
                "A.CLOCK", /*  CLOCK1 |3           12| Q2Q    */ "B.QQ",
                "A.RESET", /*  RESET1 |4    4013   11| CLOCK2 */ "B.CLOCK",
                "A.DATA", /*   DATA1 |5           10| RESET2 */ "B.RESET",
                "A.SET", /*    SET1 |6            9| DATA2  */ "B.DATA",
                "A.VSS", /*     VSS |7            8| SET2   */ "B.SET"
                /*         +--------------+        */
                );

            h.NETLIST_END();
        }
Exemple #8
0
        //NETLIST_START(konami1x)
        void netlist_konami1x(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            h.SOLVER("Solver", 48000);

            h.ANALOG_INPUT("VP5", 5);
            h.ANALOG_INPUT("VM5", -5);

            h.LOCAL_SOURCE("filter", netlist_filter);
            h.LOCAL_SOURCE("amp", netlist_amp);
            h.LOCAL_SOURCE("AY1", netlist_AY1);
            h.LOCAL_SOURCE("AY2", netlist_AY2);

            h.INCLUDE("AY1");

            h.NET_C("FCHA1.O", "FCHB1.O", "FCHC1.O");

            h.SUBMODEL("amp", "AMP");

            h.NET_C("VP5", "AMP.VP");
            h.NET_C("GND", "AMP.GND");
            h.NET_C("VM5", "AMP.VM");
            h.NET_C("FCHA1.O", "AMP.OPAMP");

            h.ALIAS("OUT", "AMP.OUT");

            h.NETLIST_END();
        }
Exemple #9
0
        //NETLIST_START(gunfight)
        public static void netlist_gunfight(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            h.SOLVER("Solver", 48000);
            h.PARAM("Solver.SORT_TYPE", "ASCENDING");
            // For this netlist, ASCENDING turns out to be slightly faster than
            // the default sort type of PREFER_IDENTITY_TOP_LEFT, but the
            // difference when using static solvers is very small.

            h.LOCAL_SOURCE("gunfight_schematics", netlist_gunfight_schematics);

            h.INCLUDE("gunfight_schematics");

            // The amplifying transistors all get 16-volt power. The raw AC power
            // input from the main power supply to the game logic board is 16.5
            // volts, but this is rectified and regulated to about 16 volts via
            // TIP-31 power transistor Q301 and BZX61-C16 16-volt Zener diode
            // D304.
            h.ANALOG_INPUT("I_V16", 16); // 16-volt power for sound amplifiers
            h.ANALOG_INPUT("I_V5", 5);   // 5-volt power for logic input devices

            h.LOGIC_INPUT("I_LEFT_SHOT", 0, "74XX");
            h.LOGIC_INPUT("I_RIGHT_SHOT", 0, "74XX");
            h.LOGIC_INPUT("I_LEFT_HIT", 0, "74XX");
            h.LOGIC_INPUT("I_RIGHT_HIT", 0, "74XX");

            // Power and ground connections for logic input devices:
            h.NET_C("I_V5.Q",
                    "I_LEFT_SHOT.VCC", "I_RIGHT_SHOT.VCC",
                    "I_LEFT_HIT.VCC", "I_RIGHT_HIT.VCC");
            h.NET_C("GND",
                    "I_LEFT_SHOT.GND", "I_RIGHT_SHOT.GND",
                    "I_LEFT_HIT.GND", "I_RIGHT_HIT.GND");

            h.ALIAS("IN_LS", "I_LEFT_SHOT.Q");
            h.ALIAS("IN_RS", "I_RIGHT_SHOT.Q");
            h.ALIAS("IN_LH", "I_LEFT_HIT.Q");
            h.ALIAS("IN_RH", "I_RIGHT_HIT.Q");

#if USE_FRONTIERS
            // These frontiers keep the mostly independant halves of the circuit
            // (left channel and right channel) from affecting each other and the
            // noise generator, which speeds up processing substantially while
            // making no audible change in the output. These seem to be the only
            // frontiers which improve performance; I haven't been able to find
            // any additional beneficial ones from examining the circuit and
            // experimenting.
            h.OPTIMIZE_FRONTIER("C303.1", RES_M(1), 50);
            h.OPTIMIZE_FRONTIER("C306.1", RES_M(1), 50);
            h.OPTIMIZE_FRONTIER("C304.1", RES_M(1), 50);
            h.OPTIMIZE_FRONTIER("C305.1", RES_M(1), 50);
#endif

            h.NETLIST_END();
        }
Exemple #10
0
        //- Identifier: AN6551_SIL
        //- Title: AN6551 Dual Operational Amplifier
        //- Pinalias: VCC,A.OUT,A-,A+,GND,B+,B-,B.OUT,VCC
        //- Package: SIL
        //- NamingConvention: Naming conventions follow Panasonic datasheet
        //- FunctionTable:
        //-   https://datasheetspdf.com/pdf-file/182163/PanasonicSemiconductor/AN6551/1
        //-
        //static NETLIST_START(AN6551_SIL)
        public static void netlist_AN6551_SIL(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            OPAMP(setup, "A", "AN6551");
            OPAMP(setup, "B", "AN6551");
#endif

            h.NET_C("A.GND", "B.GND");

            h.ALIAS("1", "A.VCC");
            h.ALIAS("2", "A.OUT");
            h.ALIAS("3", "A.MINUS");
            h.ALIAS("4", "A.PLUS");
            h.ALIAS("5", "A.GND");
            h.ALIAS("6", "B.PLUS");
            h.ALIAS("7", "B.MINUS");
            h.ALIAS("8", "B.OUT");
            h.ALIAS("9", "B.VCC");

            h.NETLIST_END();
        }
Exemple #11
0
        /*
         *   Generic layout with 2 opamps, VCC on pin 8 and GND on pin 4
         */

        //static NETLIST_START(opamp_layout_2_8_4)
        public static void netlist_opamp_layout_2_8_4(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            h.DIPPINS(        /*   +--------------+   */
                "A.OUT", /*   |1     ++     8|   */ "A.VCC",
                "A.MINUS", /*   |2            7|   */ "B.OUT",
                "A.PLUS", /*   |3            6|   */ "B.MINUS",
                "A.GND", /*   |4            5|   */ "B.PLUS"
                /*   +--------------+   */
                );
            h.NET_C("A.GND", "B.GND");
            h.NET_C("A.VCC", "B.VCC");

            h.NETLIST_END();
        }
Exemple #12
0
        /*
         *   Generic layout with 4 opamps, VCC on pin 4 and GND on pin 11
         */

        //static NETLIST_START(opamp_layout_4_4_11)
        public static void netlist_opamp_layout_4_4_11(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            h.DIPPINS(        /*   +--------------+   */
                "A.OUT", /*   |1     ++    14|   */ "D.OUT",
                "A.MINUS", /*   |2           13|   */ "D.MINUS",
                "A.PLUS", /*   |3           12|   */ "D.PLUS",
                "A.VCC", /*   |4           11|   */ "A.GND",
                "B.PLUS", /*   |5           10|   */ "C.PLUS",
                "B.MINUS", /*   |6            9|   */ "C.MINUS",
                "B.OUT", /*   |7            8|   */ "C.OUT"
                /*   +--------------+   */
                );
            h.NET_C("A.GND", "B.GND", "C.GND", "D.GND");
            h.NET_C("A.VCC", "B.VCC", "C.VCC", "D.VCC");

            h.NETLIST_END();
        }
Exemple #13
0
        //static NETLIST_START(amp)
        void netlist_amp(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            h.UA741_DIP8("X3A");
            h.RES("R1", RES_K(2.2));
            h.RES("R2", RES_K(4.7));
            h.RES("VR", 200);         // Actually a potentiometer
            h.CAP("C1", CAP_U(0.15));
            h.RES("RI", RES_K(100));

            h.NET_C("X3A.2", "R1.1");
            h.NET_C("X3A.6", "R1.2", "R2.1");
            h.NET_C("R2.2", "VR.1");
            h.NET_C("VR.1", "C1.1");    // 100% pot position
            h.NET_C("C1.2", "RI.1");

            h.NET_C("GND", "VR.2", "RI.2");

            // Amplifier M51516L, assume input RI 100k

            h.ALIAS("OPAMP", "X3A.2");
            h.ALIAS("OUT", "RI.1");
            h.ALIAS("VP", "X3A.7");
            h.ALIAS("VM", "X3A.4");
            h.ALIAS("GND", "X3A.3");

            h.NETLIST_END();
        }
Exemple #14
0
        /*
         *   Generic layout with 1 opamp, VCC+ on pin 8, VCC- on pin 5 and compensation
         */

        //static NETLIST_START(opamp_layout_1_8_5)
        public static void netlist_opamp_layout_1_8_5(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            h.DIPPINS(        /*   +--------------+   */
                "NC.1", /*   |1           10|   */ "NC.3",
                "OFFSET.N1", /*   |2            9|   */ "NC.2",
                "MINUS", /*   |3            8|   */ "VCC.PLUS",
                "PLUS", /*   |4            7|   */ "OUT",
                "VCC.MINUS", /*   |5            6|   */ "OFFSET.N2"
                /*   +--------------+   */
                );
            h.NET_C("A.GND", "VCC.MINUS");
            h.NET_C("A.VCC", "VCC.PLUS");
            h.NET_C("A.MINUS", "MINUS");
            h.NET_C("A.PLUS", "PLUS");
            h.NET_C("A.OUT", "OUT");

            h.NETLIST_END();
        }
Exemple #15
0
        //- Identifier: CD4316_DIP
        //- Title: 74HC/HCT4316 Quad bilateral switches
        //- Pinalias: 1Z,1Y,2Y,2Z,2S,3S,EQ,GND,VEE,3Z,3Y,4Y,4Z,4S,1S,VCC
        //- Package: DIP
        //- NamingConvention: Naming conventions follow Philips datasheet
        //- FunctionTable:
        //-    http://pdf.datasheetcatalog.com/datasheet/philips/74HCT4316.pdf
        //-
        //static NETLIST_START(CD4316_DIP)
        public static void netlist_CD4316_DIP(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            CD4316_GATE(setup, "A");
            CD4316_GATE(setup, "B");
            CD4316_GATE(setup, "C");
            CD4316_GATE(setup, "D");
#endif

            h.NET_C("A.E", "B.E", "C.E", "D.E");
            h.NET_C("A.VDD", "B.VDD", "C.VDD", "D.VDD");
            h.NET_C("A.VSS", "B.VSS", "C.VSS", "D.VSS");

            h.PARAM("A.BASER", 45.0);
            h.PARAM("B.BASER", 45.0);
            h.PARAM("C.BASER", 45.0);
            h.PARAM("D.BASER", 45.0);

            h.DIPPINS(   /*     +--------------+     */
                "A.R.2", /*  1Z |1     ++    16| VCC */ "A.VDD",
                "A.R.1", /*  1Y |2           15| 1S  */ "A.S",
                "B.R.1", /*  2Y |3           14| 4S  */ "D.S",
                "B.R.2", /*  2Z |4    4316   13| 4Z  */ "D.R.2",
                "B.S", /*  2S |5           12| 4Y  */ "D.R.1",
                "C.S", /*  3S |6           11| 3Y  */ "C.R.1",
                "A.E", /*  EQ |7           10| 3Z  */ "C.R.2",
                "A.VSS", /* GND |8            9| VEE */ "VEE"
                /*     +--------------+     */
                );

            h.NETLIST_END();
        }
Exemple #16
0
        //- Identifier: CD4053_DIP
        //- Title: CD4053BM/CD4053BC Triple 2-Channel AnalogMultiplexer/Demultiplexer
        //- Pinalias: INOUTBY,INOUTBX,INOUTCY,OUTINC,INOUTCX,INH,VEE,VSS,C,B,A,INOUTAX,INOUTAY,OUTINA,OUTINB,VDD
        //- Package: DIP
        //- NamingConvention: Naming conventions follow National Semiconductor datasheet
        //- FunctionTable:
        //-    http://pdf.datasheetcatalog.com/datasheet/nationalsemiconductor/DS005662.PDF
        //-
        //static NETLIST_START(CD4053_DIP)
        public static void netlist_CD4053_DIP(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            CD4053_GATE(A);
            CD4053_GATE(B);
            CD4053_GATE(C);
#endif

            h.NET_C("A.VEE", "B.VEE", "C.VEE");
            h.NET_C("A.VDD", "B.VDD", "C.VDD");
            h.NET_C("A.VSS", "B.VSS", "C.VSS");
            h.NET_C("A.INH", "B.INH", "C.INH");

            h.PARAM("A.BASER", 270.0);
            h.PARAM("B.BASER", 270.0);
            h.PARAM("C.BASER", 270.0);

            h.DIPPINS(   /*         +--------------+         */
                "B.Y", /* INOUTBY |1     ++    16| VDD     */ "A.VDD",
                "B.X", /* INOUTBX |2           15| OUTINB  */ "B.XY",
                "C.Y", /* INOUTCY |3           14| OUTINA  */ "A.XY",
                "C.XY", /*  OUTINC |4    4053   13| INOUTAY */ "A.Y",
                "C.X", /* INOUTCX |5           12| INOUTAX */ "A.X",
                "A.INH", /*     INH |6           11| A       */ "A.S",
                "A.VEE", /*     VEE |7           10| B       */ "B.S",
                "A.VSS", /*     VSS |8            9| C       */ "C.S"
                /*         +--------------+         */
                );

            h.NETLIST_END();
        }
Exemple #17
0
        /*
         *   Generic layout with 1 opamp, VCC+ on pin 11, VCC- on pin 6 and compensation
         */

        //static NETLIST_START(opamp_layout_1_11_6)
        public static void netlist_opamp_layout_1_11_6(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            h.DIPPINS(        /*   +--------------+   */
                "NC.1", /*   |1     ++    14|   */ "NC.7",
                "NC.2", /*   |2           13|   */ "NC.6",
                "OFFSET.N1", /*   |3           12|   */ "NC.5",
                "MINUS", /*   |4           11|   */ "VCC.PLUS",
                "PLUS", /*   |5           10|   */ "OUT",
                "VCC.MINUS", /*   |6            9|   */ "OFFSET.N2",
                "NC.3", /*   |7            8|   */ "NC.4"
                /*   +--------------+   */
                );
            h.NET_C("A.GND", "VCC.MINUS");
            h.NET_C("A.VCC", "VCC.PLUS");
            h.NET_C("A.MINUS", "MINUS");
            h.NET_C("A.PLUS", "PLUS");
            h.NET_C("A.OUT", "OUT");

            h.NETLIST_END();
        }
Exemple #18
0
        //static NETLIST_START(LM747A_DIP)
        public static void netlist_LM747A_DIP(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            OPAMP(setup, "A", "LM747A");
            OPAMP(setup, "B", "LM747A");
#endif

            h.INCLUDE("opamp_layout_2_13_9_4");
            h.NET_C("A.VCC", "B.VCC");

            h.NETLIST_END();
        }
Exemple #19
0
        //static NETLIST_START(1942)
        void netlist_1942(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            /* Standard stuff */

            h.SOLVER("Solver", 48000);
            h.ANALOG_INPUT("V5", 5);

            /* AY 8910 internal resistors */

            h.RES("R_AY1_1", 1000);
            h.RES("R_AY1_2", 1000);
            h.RES("R_AY1_3", 1000);
            h.RES("R_AY2_1", 1000);
            h.RES("R_AY2_2", 1000);
            h.RES("R_AY2_3", 1000);

            h.RES("R2", 220000);
            h.RES("R3", 220000);
            h.RES("R4", 220000);
            h.RES("R5", 220000);
            h.RES("R6", 220000);
            h.RES("R7", 220000);

            h.RES("R11", 10000);
            h.RES("R12", 10000);
            h.RES("R13", 10000);
            h.RES("R14", 10000);
            h.RES("R15", 10000);
            h.RES("R16", 10000);

            h.CAP("CC7", 10e-6);
            h.CAP("CC8", 10e-6);
            h.CAP("CC9", 10e-6);
            h.CAP("CC10", 10e-6);
            h.CAP("CC11", 10e-6);
            h.CAP("CC12", 10e-6);

            h.NET_C("V5", "R_AY2_3.1", "R_AY2_2.1", "R_AY2_1.1", "R_AY1_3.1", "R_AY1_2.1", "R_AY1_1.1");
            h.NET_C("GND", "R13.2", "R15.2", "R11.2", "R12.2", "R14.2", "R16.2");
            //NLFILT(R_AY2_3, R13, CC7, R2)
            h.NET_C("R_AY2_3.2", "R13.1");
            h.NET_C("R13.1", "CC7.1");
            h.NET_C("CC7.2", "R2.1");
            //NLFILT(R_AY2_2, R15, CC8, R3)
            h.NET_C("R_AY2_2.2", "R15.1");
            h.NET_C("R15.1", "CC8.1");
            h.NET_C("CC8.2", "R3.1");
            //NLFILT(R_AY2_1, R11, CC9, R4)
            h.NET_C("R_AY2_1.2", "R11.1");
            h.NET_C("R11.1", "CC9.1");
            h.NET_C("CC9.2", "R4.1");

            //NLFILT(R_AY1_3, R12, CC10, R5)
            h.NET_C("R_AY1_3.2", "R12.1");
            h.NET_C("R12.1", "CC10.1");
            h.NET_C("CC10.2", "R5.1");
            //NLFILT(R_AY1_2, R14, CC11, R6)
            h.NET_C("R_AY1_2.2", "R14.1");
            h.NET_C("R14.1", "CC11.1");
            h.NET_C("CC11.2", "R6.1");
            //NLFILT(R_AY1_1, R16, CC12, R7)
            h.NET_C("R_AY1_1.2", "R16.1");
            h.NET_C("R16.1", "CC12.1");
            h.NET_C("CC12.2", "R7.1");

            h.POT("VR", 2000);
            h.NET_C("VR.3", "GND");

            h.NET_C("R2.2", "VR.1");
            h.NET_C("R3.2", "VR.1");
            h.NET_C("R4.2", "VR.1");
            h.NET_C("R5.2", "VR.1");
            h.NET_C("R6.2", "VR.1");
            h.NET_C("R7.2", "VR.1");

            h.CAP("CC6", 10e-6);
            h.RES("R1", 100000);

            h.NET_C("CC6.1", "VR.2");
            h.NET_C("CC6.2", "R1.1");
            h.CAP("CC3", 220e-6);
            h.NET_C("R1.2", "CC3.1");
            h.NET_C("CC3.2", "GND");

            h.NETLIST_END();
        }
Exemple #20
0
        //static NETLIST_START(MC3340_DIP)
        public static void netlist_MC3340_DIP(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            // A netlist description of the Motorola MC3340 Electronic Attenuator
            // IC, a voltage-controlled amplifier/attenuator. It amplifies or
            // attenuates an input signal according to the voltage of a second,
            // control signal, with a maximum gain of about 12-13 dB (about a
            // factor of 4 in voltage), and higher control voltages giving greater
            // attenuation, which scales logarithmically.

            // The netlist here is based on the circuit schematic given in
            // Motorola's own data books, especially the most recent ones
            // published in the 1990s (e.g. _Motorola Analog/Interface ICs Device
            // Data, Vol. II_ (1996), p. 9-67), which are the only schematics that
            // include resistor values. However, the 1990s schematics are missing
            // one crossover connection which is present in older schematics
            // published in the 1970s (e.g. _Motorola Linear Integrated Circuits_
            // (1979), p. 5-130). This missing connection is clearly an error
            // which has been fixed in this netlist; without it, the circuit won't
            // amplify properly, generating only a very weak output signal.

            // The 1990s schematics also omit a couple of diodes which are present
            // in the 1970s schematics. Both of these diodes have been included
            // here. One raises the minimum control voltage at which signal
            // attenuation starts, so it makes the netlist's profile of
            // attenuation vs. control voltage better match Motorola's charts for
            // the device. The other affects the level of the input "midpoint",
            // and including it makes the engine sound closer to that on real
            // 280-ZZZAP machines.

            // The Motorola schematics do not label components, so I've created my
            // own labeling scheme based on numbering components on the schematics
            // from top to bottom, left to right, with resistors also getting
            // their value (expressed European-style to avoid decimal points) as
            // part of the name. The netlist is also listed following the
            // schematics in roughly top-to-bottom, left-to-right order.

            // A very simple model is used for the transistors here, based on the
            // generic NPN default but with a larger scale current. Again, this
            // was chosen to better match the netlist's attenuation vs. control
            // voltage profile to that given in Motorola's charts for the device.

            // The MC3340 has the same circuit internally as an older Motorola
            // device, the MFC6040, which was replaced by the MC3340 in the
            // mid-1970s. The two chips differ only in packaging. Older arcade
            // games which use the MFC6040 may also benefit from this netlist
            // implementation.

            throw new emu_unimplemented();
#if false
            RES(setup, "R1_5K1", rescap_global.RES_K(5.1));

            DIODE(setup, "D1", "D(IS=1e-15 N=1)");

            RES(setup, "R2_4K7", rescap_global.RES_K(4.7));

            QBJT_EB(setup, "Q1", "NPN(IS=1E-13 BF=100)");

            RES(setup, "R3_750", rescap_global.RES_R(750));
            RES(setup, "R4_10K", rescap_global.RES_K(10));

            QBJT_EB(setup, "Q2", "NPN(IS=1E-13 BF=100)");

            RES(setup, "R5_750", rescap_global.RES_R(750));
            RES(setup, "R6_3K9", rescap_global.RES_K(3.9));

            RES(setup, "R7_5K1", rescap_global.RES_K(5.1));
            RES(setup, "R8_20K", rescap_global.RES_K(20));

            DIODE(setup, "D2", "D(IS=1e-15 N=1)");

            RES(setup, "R9_510", rescap_global.RES_R(510));

            QBJT_EB(setup, "Q3", "NPN(IS=1E-13 BF=100)");

            QBJT_EB(setup, "Q4", "NPN(IS=1E-13 BF=100)");

            QBJT_EB(setup, "Q5", "NPN(IS=1E-13 BF=100)");

            RES(setup, "R10_1K3", rescap_global.RES_K(1.3));

            QBJT_EB(setup, "Q6", "NPN(IS=1E-13 BF=100)");

            RES(setup, "R11_5K1", rescap_global.RES_K(5.1));

            QBJT_EB(setup, "Q7", "NPN(IS=1E-13 BF=100)");

            QBJT_EB(setup, "Q8", "NPN(IS=1E-13 BF=100)");

            RES(setup, "R12_1K5", rescap_global.RES_K(1.5));

            RES(setup, "R13_6K2", rescap_global.RES_K(6.2));

            QBJT_EB(setup, "Q9", "NPN(IS=1E-13 BF=100)");

            RES(setup, "R14_5K1", rescap_global.RES_K(5.1));

            QBJT_EB(setup, "Q10", "NPN(IS=1E-13 BF=100)");

            RES(setup, "R15_5K1", rescap_global.RES_K(5.1));

            RES(setup, "R16_200", rescap_global.RES_R(200));

            RES(setup, "R17_5K1", rescap_global.RES_K(5.1));

            DIODE(setup, "D3", "D(IS=1e-15 N=1)");

            RES(setup, "R18_510", rescap_global.RES_R(510));
#endif

            h.ALIAS("VCC", "R1_5K1.1");
            h.NET_C("R1_5K1.1", "Q1.C", "Q2.C", "R7_5K1.1", "Q3.C", "Q4.C", "Q7.C",
                    "R13_6K2.1", "Q10.C", "R17_5K1.1");
            // Location of first diode present on 1970s schematics but omitted on
            // 1990s ones. Including it raises the control voltage threshold for
            // attenuation significantly.
            h.NET_C("R1_5K1.2", "D1.A", "Q1.B");
            h.NET_C("D1.K", "R2_4K7.1");
            h.NET_C("R2_4K7.2", "GND");

            h.NET_C("Q1.E", "R3_750.1", "R5_750.1");
            h.NET_C("R3_750.2", "R4_10K.1", "Q2.B");
            h.NET_C("R4_10K.2", "GND");

            h.NET_C("R5_750.2", "R6_3K9.1", "Q3.B");
            h.ALIAS("CONTROL", "R6_3K9.2");

            h.ALIAS("INPUT", "Q5.B");

            h.NET_C("INPUT", "R8_20K.1");
            // Location of second diode present on 1970s schematics but omitted on
            // 1990s ones. Including it is critical to making the tone of the
            // output engine sound match that of real 280-ZZZAP machines.
            h.NET_C("R7_5K1.2", "R8_20K.2", "D2.A");
            h.NET_C("D2.K", "R9_510.1");
            h.NET_C("R9_510.2", "GND");

            h.NET_C("Q4.E", "Q6.E", "Q5.C");
            h.NET_C("Q5.E", "R10_1K3.1");
            h.NET_C("R10_1K3.2", "GND");

            h.NET_C("Q6.B", "Q7.B", "Q2.E", "R11_5K1.1");
            h.NET_C("R11_5K1.2", "GND");

            h.NET_C("Q7.E", "Q9.E", "Q8.C");
            h.NET_C("Q8.E", "R12_1K5.1");
            h.NET_C("R12_1K5.2", "GND");

            h.NET_C("Q4.B", "Q9.B", "Q3.E", "R14_5K1.1");
            h.NET_C("R14_5K1.2", "GND");

            // This is where the cross-connection is erroneously omitted from
            // 1990s schematics.
            h.NET_C("Q6.C", "R13_6K2.2", "Q9.C", "Q10.B");

            // Connection for external frequency compensation capacitor; unused
            // here.
            h.ALIAS("ROLLOFF", "Q10.B");

            h.NET_C("Q10.E", "R16_200.1", "R15_5K1.1");
            h.NET_C("R15_5K1.2", "GND");
            h.ALIAS("OUTPUT", "R16_200.2");

            h.NET_C("R17_5K1.2", "D3.A", "Q8.B");
            h.NET_C("D3.K", "R18_510.1");
            h.ALIAS("GND", "R18_510.2");

            h.ALIAS("1", "INPUT");
            h.ALIAS("2", "CONTROL");
            h.ALIAS("3", "GND");
            h.ALIAS("6", "ROLLOFF");
            h.ALIAS("7", "OUTPUT");
            h.ALIAS("8", "VCC");

            h.NETLIST_END();
        }
Exemple #21
0
        // This is a netlist description for the sound circuits of Midway's Gun Fight,
        // based on Midway's schematic "Gun Fight Sound Generator Detail P.C.
        // 597-907E".
        //
        // (This sound circuitry seems to have evolved from that for an older Midway
        // game, an electromechanical rifle game from 1974 called Twin Pirate Gun. The
        // schematics for Twin Pirate Gun's sound circuitry (P.C. 569-907-88),
        // although not completely identical to Gun Fight's, are similar both in
        // general structure and in many details.)
        //
        // Gun Fight's sound effects are simple "bang" sounds, both for the shooting
        // of bullets and for bullets hitting targets. The effects are directed to the
        // left or right speaker, depending on whether the left or right player is
        // shooting or being hit. (Hits to obstacles get the same sound as hits to the
        // right player and thus play from the right speaker.) Each sound effect gets
        // a different pitch, with shots being higher pitched than hits. Shot sounds
        // also decay faster than hit sounds and have slightly separated initial and
        // secondary attacks, resulting in a "ka-pow" effect.
        //
        // The sounds are generated in stages by different sections of the circuitry.
        // A noise generator, based on a zener diode, continuously produces white
        // noise that forms the basis for all the sounds, and this noise is fed to
        // four separate sound generators. Each generator filters the noise to produce
        // the distinct pitch of its sound. Each generator's sound is triggered by a
        // switch, activated digitally by the CPU. When this switch is turned on
        // momentarily, a storage capacitor is charged up, and that sends power to the
        // sound generator's transistor amplifier. This amplifies the filtered noise
        // with a sharp attack as the switch is turned on and gradual decay as the
        // capacitor drains. The generated sound is filtered further and then
        // attenuated by a potentiometer which controls that sound's relative volume.
        // Each side's two sound effect signals, after being generated and then
        // attenuated by their respective volume pots, are mixed together and then
        // further amplified by a second-stage transistor amplifier for that side.
        // This mixed and amplified signal is itself filtered and then attenuated by
        // the side's master volume potentiometer. Finally it gets sent to the power
        // amplifier IC for that side's speaker. (This emulation does not handle the
        // final power amplification.)
        //
        // The different sound effect generators have a common structure which is
        // repeated four times. The mixers and second-stage amplifiers likewise have a
        // common structure which is repeated twice, and their amplifiers are also
        // rather similar to the effect amplifiers.
        //
        // To make the netlist easier to follow and verify, I've grouped its
        // components and connections by function, with the groups ordered roughly
        // according to the flow of signals:
        //
        // * the activating switches,
        // * the shared noise generator,
        // * the sound-effect noise filters,
        // * the sound-effect initial amplifiers, output coupling capacitors and
        //   filters, and effect-volume potentiometers,
        // * the mixing circuits,
        // * the second-stage amplifiers, output coupling capacitors and filters, and
        //   master-volume potentiometers.
        //
        // Within each group, I've placed the sets of four similar components or
        // connections together and listed them in the order: left-shot, right-shot,
        // left-hit, right-hit. (For mixing and second-stage amplification components,
        // the order is simply left, right.) Individual components are labeled the
        // same as on the schematic.


        // There are some uncertainties in this emulation about sound levels. The
        // average level of the initially generated noise is uncertain, which poses a
        // problem because all of the sound effects are based on amplifying that
        // noise. The noise is generated by passing a small amount of current through
        // a zener diode on the verge of its breakdown voltage, which results in very
        // noisy current flow. Even though both the type of zener and the average
        // current are known, the average strength of the noise is still uncertain,
        // both because zener manufacturers do not specify performance under these
        // conditions (they recommended zeners for voltage control under more stable,
        // relatively noise-free operating conditions) and because the amount of noise
        // may vary greatly from one zener to the next, even within the same
        // production batch--let alone from one manufacturer to another. This is an
        // inherent problem with zener diodes when used for noise generation.
        //
        // I have chosen a round figure of 2 mV RMS for the zener's average (RMS)
        // noise level. Although this is only a guess, it seems to be in the ballpark
        // for similar zeners operated with similar amounts of average current. It
        // also keeps the noise component of the sound effects strong enough so as not
        // to be overwhelmed by the pulse of the sound effects' initial attacks; this
        // pulse is created by switching on their generating amplifiers and is
        // independent of noise level. Meanwhile, this noise level is still low enough
        // that, with all the volume potentiometers set to their midpoints, the noise
        // won't be clipped by any subsequent amplification stage in the netlist, up
        // to the power amp inputs. (Some such clipping may occur if a sound effect's
        // volume is turned up well beyond its midpoint. That may also be true on real
        // hardware.)
        //
        // The other big uncertainty is the audible effect of the power amp ICs. These
        // amplifiers add both power and voltage gain, which may be enough to distort
        // or clip the output. They may also have an audible filtering effect. In the
        // Gun Fight schematic, and apparently in real machines, they are configured
        // for a voltage gain of 15. Furthermore, any input voltages beyond a few
        // hundred mV (positive or negative) should produce at least some clipping
        // distortion, with the distortion getting worse for stronger signals. With
        // all potentiometers set to the midpoint, the power amp signal inputs should
        // see extreme pulses of +/- 3 V from the initial attack for sound effects,
        // and even past those initial attack pulses, the sound effect noise should
        // kick in at levels above +/- 1 V on the power amp inputs. If these levels
        // are correct and the power amp ICs work as described, the noise of the sound
        // effects should initially be heavily distorted, but since the original
        // signal is already random noise, it's not clear whether that distortion
        // would be apparent. Anyhow, the power amp ICs are completely unemulated
        // here, and any distortion effects they might produce would be quite
        // different from the hard clipping produced when limiting output levels
        // digitally.
        //
        // I have compromized by setting the volume multipliers for the netlist stream
        // outputs so that output levels of +/- 3 volts will produce the maximum
        // allowed stream output magnitudes of +/- 32767. Voltages beyond that will be
        // clipped. This at least produces some distortion if the volume
        // potentiometers are adjusted above their midpoints.
        //
        // Further improving accuracy would require testing signal levels on actual
        // hardware, with allowances made for variations in components, as well as a
        // better understanding of the electrical and sonic behavior of the power
        // amplifiers, speakers, and cabinet. It's questionable whether doing so is
        // worth the effort.


        // As I've said, this netlist does not include the final stage of sound
        // generation, the twin audio power amplifier ICs. Although it is the norm for
        // MAME analog sound emulation to omit this stage, some discussion of the
        // power amplifiers is worthwhile in this case. Each is an SGS-ATES
        // TAA-621-A11 single-channel amplifier, driving one 8-ohm speaker of about 4
        // or 5 inches.
        //
        // (On the Gun Fight schematic, the TAA-621-A11 is also labeled "LM354". The
        // TAA-621-A11 was introduced in 1970 by the Italian firm SGS. The very
        // similar LM354 was introduced in 1972 by European Electronic Products.
        // However, this company seems to have been a mere U.S. importer and
        // distributor of European components, making the LM354 just a rebadged
        // TAA-621-A11. The LM354 occasionally comes up in discussions of Gun Fight
        // audio but seems to have been otherwise short-lived. One problem with its
        // name is that it can easily be mistaken for a National Semiconductor LMxxx
        // linear IC, even though it's unrelated to that company. To further confuse
        // matters, National Semiconductor had already introduced an LM354 of their
        // own in 1970 which wasn't an audio amplifier at all, but a second-source
        // version of Texas Instruments' SN7525 sense amplifier for minicomputer
        // magnetic-core memory systems.)
        //
        // As is normal for TAA-621-A11 amps, those in Gun Fight are configured with
        // some negative feedback to control their voltage gain. The gain is
        // determined by the ratio of the chip's internal 15-kohm feedback resistor to
        // the external resistor connected to the feedback terminal, pin 10. In Gun
        // Fight this external resistor is 1 kohm, so the ratio, and thus the voltage
        // gain, is 15.
        //
        // The TAA-621-A11 is rated at 4 watts at 10% total harmonic distortion (THD)
        // when supplied with 24-volt power and driving a 16-ohm load. (Although not
        // explicitly stated, this appears to be an RMS rating rather than a peak
        // rating.) In Gun Fight's case, the speaker load is only 8 ohms, and the
        // power supply voltage is a bit lower, about 22 volts (it comes from
        // rectified 16.5-volt-RMS AC, buffered by a large smoothing capacitor). Both
        // of these factors lower the power rating somewhat. Also, a power rating at
        // 10% THD implies clipping is already heavy. The unclipped, clean power
        // rating in Gun Fight would be lower, probably no more than 2 watts RMS,
        // giving output around 4 volts RMS or about 5.5 volts in extreme amplitude.
        // With a power amp voltage gain of 15, this would mean that any input signals
        // with extreme amplitudes greater than about a third of a volt would be
        // subject to power amp clipping.
        //
        // The power amps also have a few other connections, including ripple bypass
        // capacitors to suppress ripple from the unregulated power supply, frequency
        // compensation capacitors to prevent inducing unstable amplifier oscillations
        // at high frequencies, and some filtering on the output to the speakers.


        // All of the amplifying transistors in this circuit are NPN transistors of a
        // particular type, marked as "A-138" on the Gun Fight schematics. This seems
        // to be the Amperex A-138, a low-power silicon NPN transistor made by Amperex
        // Electronic Corporation, which was a U.S. division of Philips. This
        // transistor, being a vendor-specific type long out of production, seems to
        // have fallen into obscurity. The only source I could find with any data on
        // it (given in greatly abbreviated form) is _Transistor Discontinued Devices
        // D.A.T.A.Book, Edition 16_ (1980), by Derivation and Tabulation Associates,
        // which lists the A-138 on p. 76, line 86.
        //
        // This source shows the A-138 to be an ordinary amplifier transistor of
        // fairly high gain, with a maximum small-signal forward current transfer
        // ratio (h_fe, AC current gain) of 650. The minimum h_fe is not given, but it
        // can be estimated using the fact that such transistors are often graded and
        // designated by gain. The A-137, another Amperex transistor listed on line 85
        // of the same D.A.T.A.Book page, has the same limits on power, collector
        // current, and junction voltages, and thus appears to be in the same series,
        // but it has a maximum h_fe of 415. If the A-137 was the next lower grade of
        // gain from the A-138, the latter should have a minimum h_fe around 400.
        // Values for h_FE, the DC forward current transfer ratio (DC current gain),
        // aren't given for the A-138, but the range would be about the same or a bit
        // lower, perhaps 350-600, with an average around 450-500.
        //
        // The high gain of Gun Fight's A-138 transistors causes a "ka-pow" effect in
        // its shot sounds; I explain how later. (Andy Wellburn, in a Discord chat on
        // 2020-06-05, confirmed this effect can be heard in some actual machines. He
        // measured an h_FE of 238 for one A-138 from a Gun Fight sound board, but he
        // warned that for old transistors like this, h_FE measurements can vary a
        // lot, and I'm not surprised that the transistors' gain might be reduced more
        // than 40 years later. But even a gain of 238 turns out to be high enough to
        // give the "ka-pow" shot effect.)
        //
        // Considering the A-138's high gain and other limits, a decent match for it
        // here seems to be the BC548C, which is modeled in the netlist library. The
        // BC548C is the high-gain version of the BC548, a widely used Pro Electron
        // standard type of general-purpose small-signal transistor in a through-hole
        // TO-92 package. All A-138 transistors in this netlist are modeled as
        // BC548Cs.


        //static NETLIST_START(gunfight_schematics)
        public static void netlist_gunfight_schematics(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            // **** Sound effect activation switches.

            // These switches are triggered by digital logic signals activated by
            // the CPU. A high TTL logic level turns the switch on, allowing
            // 16-volt power to flow through the switch into the sound effect
            // generator's amplifier and storage capacitor, and a low logic level
            // turns the switch off, cutting off the power flow. In practice, each
            // sound effect is triggered by turning its switch on for about 50 ms
            // and then switching it off again.
            //
            // Each switch is built from two transistors: a "low-side" NPN
            // transistor which is switched on when a high TTL output level drives
            // the NPN's base high, and a "high-side" PNP transistor which is
            // switched on when the now conducting NPN pulls the PNP's base low.
            // It is the high-side PNP transistor that actually switches the
            // 16-volt power, hence the term "high-side".

#if FAST_SWITCHES
            // Use abstracted activation switches instead of a detailed circuit
            // model of the dual-transistor switches. This gives faster emulation
            // while not making any audible difference in the sound produced.

            h.SYS_DSW("SW_LEFT_SHOT", "IN_LS", "I_V16.Q", "R130.1");
            h.SYS_DSW("SW_RIGHT_SHOT", "IN_RS", "I_V16.Q", "R230.1");
            h.SYS_DSW("SW_LEFT_HIT", "IN_LH", "I_V16.Q", "R117.1");
            h.SYS_DSW("SW_RIGHT_HIT", "IN_RH", "I_V16.Q", "R217.1");

            // Lower the on-resistance to a more accurate value. The charging
            // resistor which follows is only 15 ohms, so the default
            // on-resistance of 1 ohm might noticeably affect the result.
            h.PARAM("SW_LEFT_SHOT.RON", 0.1);
            h.PARAM("SW_RIGHT_SHOT.RON", 0.1);
            h.PARAM("SW_LEFT_HIT.RON", 0.1);
            h.PARAM("SW_RIGHT_HIT.RON", 0.1);
#else
            // Detailed circuit model of the dual-transistor switches.

            // "Low-side" NPN transistor switches, driven by TTL logic inputs.

            RES(R134, RES_R(470))
            RES(R234, RES_R(470))
            RES(R121, RES_R(470))
            RES(R221, RES_R(470))

            NET_C(IN_LS, R134 .1)
            NET_C(IN_RS, R234 .1)
            NET_C(IN_LH, R121 .1)
            NET_C(IN_RH, R221 .1)

            RES(R133, RES_K(5.1))
            RES(R233, RES_K(5.1))
            RES(R120, RES_K(5.1))
            RES(R220, RES_K(5.1))

            QBJT_SW(Q108, "BC548C")
            QBJT_SW(Q208, "BC548C")
            QBJT_SW(Q105, "BC548C")
            QBJT_SW(Q205, "BC548C")

            // These all go to TTL ground at pin 7 of 7404 IC H6, rather than the
            // ground used for the other sound circuits.
            NET_C(GND,
                  R133 .2, R233 .2, R120 .2, R220 .2,
                  Q108.E, Q208.E, Q105.E, Q205.E)

            NET_C(R134 .2, R133 .1, Q108.B)
            NET_C(R234 .2, R233 .1, Q208.B)
            NET_C(R121 .2, R120 .1, Q105.B)
            NET_C(R221 .2, R220 .1, Q205.B)

            RES(R131, RES_K(1))
            RES(R231, RES_K(1))
            RES(R118, RES_K(1))
            RES(R218, RES_K(1))

            NET_C(Q108.C, R131 .1)
            NET_C(Q208.C, R231 .1)
            NET_C(Q105.C, R118 .1)
            NET_C(Q205.C, R218 .1)

            // "High-side" PNP transistor switches, driven by "low-side" NPN
            // switch outputs. The PNP switch outputs charge the storage
            // capacitors that supply power to the sound-effect amplifiers; in
            // addition, while they are on they power the amplifiers directly.

            RES(R132, RES_K(5.1))
            RES(R232, RES_K(5.1))
            RES(R119, RES_K(5.1))
            RES(R219, RES_K(5.1))

            // The actual transistors used here are 2N4125s:
            QBJT_SW(Q107, "PNP")
            QBJT_SW(Q207, "PNP")
            QBJT_SW(Q104, "PNP")
            QBJT_SW(Q204, "PNP")

            // All connected to 16-volt power.
            NET_C(I_V16.Q,
                  R132 .1, R232 .1, R119 .1, R219 .1,
                  Q107.E, Q207.E, Q104.E, Q204.E)

            NET_C(R131 .2, R132 .2, Q107.B)
            NET_C(R231 .2, R232 .2, Q207.B)
            NET_C(R118 .2, R119 .2, Q104.B)
            NET_C(R218 .2, R219 .2, Q204.B)

            NET_C(Q107.C, R130 .1)
            NET_C(Q207.C, R230 .1)
            NET_C(Q104.C, R117 .1)
            NET_C(Q204.C, R217 .1)

            // End of switch description.
#endif


            // **** Current supply and storage capacitors for sound-effect
            // **** amplifiers.

            h.RES("R130", RES_R(15));
            h.RES("R230", RES_R(15));
            h.RES("R117", RES_R(15));
            h.RES("R217", RES_R(15));

            h.CAP("C122", CAP_U(10));
            h.CAP("C222", CAP_U(10));
            h.CAP("C116", CAP_U(20));
            h.CAP("C216", CAP_U(20));
            h.NET_C("GND", "C122.2", "C222.2", "C116.2", "C216.2");

            h.NET_C("R130.2", "C122.1", "R126.1", "R124.1");
            h.NET_C("R230.2", "C222.1", "R226.1", "R224.1");
            h.NET_C("R117.2", "C116.1", "R113.1", "R111.1");
            h.NET_C("R217.2", "C216.1", "R213.1", "R211.1");


            // **** Shared white-noise generator circuit. This is the basic noise
            // **** source which is filtered and amplified by the sound-effect
            // **** circuits.

            // Gun Fight's noise generator circuit is based on a reverse-biased
            // 9.1-volt zener diode (D304, a 1N5239) whose noise current is then
            // amplified by an A-138 NPN transistor, producing white noise at
            // audio frequencies.
            //
            // (Strictly speaking, this is not a *pure* white noise generator,
            // because the generator's bypass capacitor and biasing resistor, in
            // combination with negative feedback from the amplified signal, act
            // as a high-pass RC filter, filtering out the lowest noise
            // frequencies.)
            //
            // Figuring out how strong the noise signal should be for this circuit
            // is difficult. The noise generator's biasing resistors and
            // transistor gain limit the average current through its zener to
            // around 2 microamps, but the 1N5239 is normally expected to be used
            // with much larger currents, in the range of 250 microamps to 50
            // milliamps.
            //
            // Zeners are most often used for smoothly controlling and limiting
            // voltage with minimal fluctuation, like in a power regulator. But a
            // zener can only do this smoothly if it passes a large enough
            // current. This is especially true for "zeners" of voltages of 9.1
            // volts or more, which properly speaking are "avalanche diodes" that
            // don't user the actual Zener effect but rather a different effect,
            // avalanche breakdown, which is capable of generating far more noise.
            // Standard zener specifications include "knee" figures which in
            // effect give the minimum expected current, along with the maximum
            // "dynamic impedance" at that current: how much the voltage may vary
            // if the current changes, or vice versa. For the 1N5239, the knee is
            // at 250 microamps, and the maximum dynamic impedance at the knee is
            // 600 ohms, so a 1 microamp increase in current at that point would
            // raise the voltage drop by up to 0.6 millivolts. Noise values for
            // zeners are often not given at all, or if they are (as with
            // Motorola's zeners), they are given at the knee current. In short,
            // the manufacturer expects the current to be kept above the knee
            // value, and if your current is lower, you're on your own.
            //
            // At very low currents, still within the breakdown region but well
            // below the knee current, the zener's dynamic impedance is much
            // greater, and more importantly, so is its noise. The conduction of
            // current is no longer smooth and regular, but pulsing and episodic,
            // as small conducting "microplasmas" within the diode's junction are
            // repeatedly triggered and extinguished, like microscopic versions of
            // lightning bolts in a thunderstorm.
            //
            // The netlist library includes a Zener diode model, but this model
            // does not simulate the Zener's noise behavior. Instead I generate
            // the noise from a noise voltage source in series with the Zener.

            // Simple model of a 1N5239 9.1-volt Zener diode. The 1N5239 is
            // specified to conduct 20 mA of current at its nominal breakdown
            // voltage of 9.1 V. The model produces an exponential I-V curve,
            // passing through this point, which has the same general shape as
            // that of a normal forward-biased diode. NBV is an exponent scale
            // factor; its value here of 1 gives the curve a steep rise and a
            // relatively sharp knee. Actual breakdown I-V curves have an even
            // steeper rise and sharper knee, too steep and sharp to be
            // represented by an exponential, but this model is good enough for
            // this emulation, since the diode operates very close to a single
            // point on the curve.
            h.ZDIODE("D304", "D(BV=9.1 IBV=0.020 NBV=1)");

            // 24 kHz noise clock for the noise source, chosen to retain noise
            // frequencies as high as possible for 48 kHz sample rate.
            h.CLOCK("NCLK", 24000);
            h.NET_C("I_V5.Q", "NCLK.VCC");
            h.NET_C("GND", "NCLK.GND");

            // Normally-distributed noise of 2 millivolts RMS voltage.
            // This level was chosen to have a strong amplified noise signal that
            // won't be clipped by any subsequent stages of amplification before
            // the power amps, if the volume potentiometers are not raised beyond
            // their approximate midpoints.
            h.SYS_NOISE_MT_N("NOISE", 0.002);

            h.NET_C("NCLK.Q", "NOISE.I");

            h.RES("R302", RES_K(6.8));
            h.RES("R303", RES_K(6.8));
            h.CAP("C307", CAP_U(10));
            h.NET_C("C307.2", "GND");
            h.QBJT_EB("Q302", "BC548C");
            h.NET_C("Q302.E", "GND");

            h.NET_C("I_V16.Q", "R302.1");
            h.NET_C("Q302.B", "NOISE.1");
            h.NET_C("D304.A", "NOISE.2");
            h.NET_C("R303.2", "C307.1", "D304.K");

            // Coupling capacitors from noise generator to sound effect frequency
            // filters. (These coupling capacitors, together with the resistances
            // beyond them, act as high-pass filters with very low cutoff
            // frequencies.)

            h.CAP("C303", CAP_U(0.1));
            h.CAP("C306", CAP_U(0.1));
            h.CAP("C304", CAP_U(0.1));
            h.CAP("C305", CAP_U(0.1));

            h.NET_C("R302.2", "Q302.C", "R303.1", "C303.1", "C306.1", "C304.1", "C305.1");


            // **** Sound effect frequency filters.

            // Each sound effect has a pair of passive low-pass RC filters with
            // cutoff frequencies determined by their component values. The
            // different capacitor values produce each sound effect's distinct
            // pitch.

            h.RES("R129", RES_K(20));
            h.RES("R229", RES_K(20));
            h.RES("R116", RES_K(20));
            h.RES("R216", RES_K(20));

            h.NET_C("C303.2", "R129.1");
            h.NET_C("C306.2", "R229.1");
            h.NET_C("C304.2", "R116.1");
            h.NET_C("C305.2", "R216.1");

            h.CAP("C121", CAP_U(0.015));
            h.CAP("C221", CAP_U(0.015));
            h.CAP("C115", CAP_U(0.033));
            h.CAP("C215", CAP_U(0.033));
            h.NET_C("C121.2", "C221.2", "C115.2", "C215.2", "GND");

            h.RES("R128", RES_K(30));
            h.RES("R228", RES_K(30));
            h.RES("R115", RES_K(30));
            h.RES("R215", RES_K(30));

            h.NET_C("R129.2", "C121.1", "R128.1");
            h.NET_C("R229.2", "C221.1", "R228.1");
            h.NET_C("R116.2", "C115.1", "R115.1");
            h.NET_C("R216.2", "C215.1", "R215.1");

            h.CAP("C120", CAP_U(0.01));
            h.CAP("C220", CAP_U(0.015));
            h.CAP("C114", CAP_U(0.1));
            h.CAP("C214", CAP_U(0.047));
            h.NET_C("C120.2", "C220.2", "C114.2", "C214.2", "GND");


            // **** Sound effect amplifier circuits.

            // Each sound-effect amplifier is a single NPN transistor wired as a
            // common-emitter amplifier. The amplifiers for "hit" sounds also have
            // a bypass capacitor at the emitter, while those for "shot" sounds
            // have no bypass capacitor and a much lower emitter resistance. The
            // attack and decay of the sound effects is handled by controlling the
            // current supply to each amplifier, which is done by the switching
            // circuits and supply capacitors described above.

            // More explanation is needed for the "shot" sounds. Apart from their
            // higher frequency and faster decay, the "ka-pow" effect in their
            // initial attack further distinguishes them from the "hit" sounds.
            // This effect comes from the high current gain (around 450-500) of
            // the amplifier's A-138 transistor together with the low emitter
            // resistance. When the current supply for the sound is switched on,
            // the collector voltage at first spikes upward as the supply
            // capacitor is charged. But the transistor's base voltage and base
            // current also rise, which "turns on" the transistor, and as its
            // collector current increases through its biasing resistor, the
            // collector voltage plummets. For the "shot" sound transistors,
            // because of their high current gain and low emitter resistance, the
            // collector current grows so much that the collector voltage is
            // pulled below the base voltage, pushing the transistor into
            // saturation. This persists for as long as the current supply switch
            // remains on; the collector voltage stays low with little variation.
            // In this state the amplifier's input noise signal is being clipped
            // rather than amplified.

            // The result is that the sound effect's initial voltage spike is
            // followed by a relatively prolonged low with almost no noise. As
            // this signal passes through the output coupling capacitor, the
            // intervening filter and potentiometer, and then the second
            // amplification stage, it becomes a series of strong oscillations,
            // followed by a momentary silence which lasts as long as the sound's
            // switch is held on: around 50 milliseconds.

            // Finally the sound switch is turned off, and the amplifier's supply
            // voltage and current begin to drop as the supply capacitor
            // discharges. The base current and collector current drop also, and
            // the collector voltage begins to rise, eventually rising above the
            // base voltage again. The transistor leaves saturation and returns to
            // forward active mode. Now the noise signal is not being clipped but
            // gets properly amplified on the collector output. So the momentary
            // silence is followed by a sudden burst of noise, which then dies
            // away as the supply capacitor is drained.

            // The result is the shot's distinct "ka-pow" sound: an initial
            // punctuating crack, a very brief silence, and a sudden noise burst
            // that quickly fades.

            // The "hit" sounds don't have this effect, despite using the same
            // high-gain transistors, because their transistor amplifiers have a
            // bypass capacitor and a much larger emitter resistance, 1 Kohm
            // versus 100 ohms. That higher resistance keeps the collector current
            // low enough that the collector voltage never drops below the base
            // voltage, so the transistor never saturates, while the bypass
            // capacitor allows the amplifier's AC gain to remain very high.

            h.RES("R126", RES_K(330));
            h.RES("R226", RES_K(330));
            h.RES("R113", RES_K(330));
            h.RES("R213", RES_K(330));

            h.RES("R127", RES_K(30));
            h.RES("R227", RES_K(30));
            h.RES("R114", RES_K(30));
            h.RES("R214", RES_K(30));
            h.NET_C("R127.2", "R227.2", "R114.2", "R214.2", "GND");

            h.RES("R124", RES_K(5.1));
            h.RES("R224", RES_K(5.1));
            h.RES("R111", RES_K(5.1));
            h.RES("R211", RES_K(5.1));

            h.RES("R125", RES_R(100));
            h.RES("R225", RES_R(100));
            h.RES("R112", RES_K(1));
            h.RES("R212", RES_K(1));
            h.NET_C("R125.2", "R225.2", "R112.2", "R212.2", "GND");

            h.CAP("C113", CAP_U(50));
            h.CAP("C213", CAP_U(50));
            h.NET_C("C113.2", "C213.2", "GND");

            h.QBJT_EB("Q106", "BC548C");
            h.QBJT_EB("Q206", "BC548C");
            h.QBJT_EB("Q103", "BC548C");
            h.QBJT_EB("Q203", "BC548C");

            h.NET_C("R128.2", "C120.1", "R126.2", "R127.1", "Q106.B");
            h.NET_C("R228.2", "C220.1", "R226.2", "R227.1", "Q206.B");
            h.NET_C("R115.2", "C114.1", "R113.2", "R114.1", "Q103.B");
            h.NET_C("R215.2", "C214.1", "R213.2", "R214.1", "Q203.B");

            h.NET_C("R125.1", "Q106.E");
            h.NET_C("R225.1", "Q206.E");
            h.NET_C("R112.1", "C113.1", "Q103.E");
            h.NET_C("R212.1", "C213.1", "Q203.E");


            // **** Coupling capacitors, high-pass (pulse-differentiator) filters,
            // **** and volume potentiometers for sound effect amplifier outputs.

            // These circuits act as high-pass filters on the sound effect
            // generator outputs, with very low cutoff frequencies. Because the
            // cutoff frequency is so low, one of the main effects of the filter
            // is to remove any flat areas from the initial turn-on pulse of the
            // sound effect generator amplifier. The filter effectively
            // differentiates the pulse, producing output voltage proportional to
            // the steepness of its slope. This replaces the single wide pulse of
            // the initial attack with a sequence of sharp spike pulses.

            h.CAP("C119", CAP_U(0.047));
            h.CAP("C219", CAP_U(0.047));
            h.CAP("C112", CAP_U(0.1));
            h.CAP("C212", CAP_U(0.1));

            h.NET_C("R124.2", "Q106.C", "C119.1");
            h.NET_C("R224.2", "Q206.C", "C219.1");
            h.NET_C("R111.2", "Q103.C", "C112.1");
            h.NET_C("R211.2", "Q203.C", "C212.1");

            h.CAP("C118", CAP_U(0.022));
            h.CAP("C218", CAP_U(0.022));
            h.CAP("C111", CAP_U(0.033));
            h.CAP("C211", CAP_U(0.033));
            h.NET_C("C118.2", "C218.2", "C111.2", "C211.2", "GND");

            // There are four sound-effect volume pots, for shot and hit sounds on
            // left and right.

            h.POT("R123", RES_K(50));
            h.POT("R223", RES_K(50));
            h.POT("R110", RES_K(50));
            h.POT("R210", RES_K(50));
            h.NET_C("R123.3", "R223.3", "R110.3", "R210.3", "GND");

            // Reverse the sense of pot adjustments so that larger values result
            // in greater volume.
            h.PARAM("R123.REVERSE", 1);
            h.PARAM("R223.REVERSE", 1);
            h.PARAM("R110.REVERSE", 1);
            h.PARAM("R210.REVERSE", 1);

            h.NET_C("C119.2", "C118.1", "R123.1");
            h.NET_C("C219.2", "C218.1", "R223.1");
            h.NET_C("C112.2", "C111.1", "R110.1");
            h.NET_C("C212.2", "C211.1", "R210.1");


            // **** Mixing of shot and hit sounds for each side.

            h.RES("R122", RES_K(30));
            h.RES("R222", RES_K(30));
            h.RES("R109", RES_K(30));
            h.RES("R209", RES_K(30));

            h.NET_C("R123.2", "R122.2");
            h.NET_C("R223.2", "R222.2");
            h.NET_C("R110.2", "R109.2");
            h.NET_C("R210.2", "R209.2");

            h.CAP("C117", CAP_U(0.047));
            h.CAP("C217", CAP_U(0.047));
            h.CAP("C110", CAP_U(0.1));
            h.CAP("C210", CAP_U(0.1));

            h.NET_C("R122.1", "C117.2");
            h.NET_C("R222.1", "C217.2");
            h.NET_C("R109.1", "C110.2");
            h.NET_C("R209.1", "C210.2");


            // **** Second-stage amplifier circuits, which amplify each side's
            // **** mixed shot and hit sounds.

            // These amplifiers are similar to those for the "hit" sound effects,
            // each being a single A-138 NPN transistor wired in common-emitter
            // configuration, with a 1-Kohm resistance and a bypass capacitor at
            // the emitter. They have no need for an attack-decay envelope,
            // however, and so get their current directly from the 16-volt power
            // supply.

            h.RES("R107", RES_K(150));
            h.RES("R207", RES_K(150));

            h.RES("R105", RES_K(30));
            h.RES("R205", RES_K(30));
            h.NET_C("R105.2", "R205.2", "GND");

            h.RES("R108", RES_K(5.1));
            h.RES("R208", RES_K(5.1));

            h.RES("R106", RES_K(1));
            h.RES("R206", RES_K(1));
            h.NET_C("R106.2", "R206.2", "GND");

            h.CAP("C109", CAP_U(50));
            h.CAP("C209", CAP_U(50));
            h.NET_C("C109.2", "C209.2", "GND");

            h.NET_C("R107.1", "R207.1", "R108.1", "R208.1", "I_V16.Q");

            h.QBJT_EB("Q102", "BC548C");
            h.QBJT_EB("Q202", "BC548C");

            h.NET_C("C110.1", "C117.1", "R107.2", "R105.1", "Q102.B");
            h.NET_C("C210.1", "C217.1", "R207.2", "R205.1", "Q202.B");

            h.NET_C("R106.1", "C109.1", "Q102.E");
            h.NET_C("R206.1", "C209.1", "Q202.E");


            // **** Coupling capacitors, bandpass filters, and volume
            // **** potentiometers for second-stage amplifier outputs.

            h.CAP("C108", CAP_U(0.047));
            h.CAP("C208", CAP_U(0.047));

            h.NET_C("R108.2", "Q102.C", "C108.1");
            h.NET_C("R208.2", "Q202.C", "C208.1");

            h.RES("R104", RES_K(30));
            h.RES("R204", RES_K(30));

            h.NET_C("C108.2", "R104.1");
            h.NET_C("C208.2", "R204.1");

            h.CAP("C107", CAP_U(0.001));
            h.CAP("C207", CAP_U(0.001));
            h.NET_C("C107.2", "C207.2", "GND");

            // There are two master volume pots, for left and right.

            h.POT("R103", RES_K(47));
            h.POT("R203", RES_K(47));
            h.NET_C("R103.3", "R203.3", "GND");

            // Reverse the sense of pot adjustments so that larger values result
            // in greater volume.
            h.PARAM("R103.REVERSE", 1);
            h.PARAM("R203.REVERSE", 1);

            h.NET_C("R104.2", "C107.1", "R103.1");
            h.NET_C("R204.2", "C207.1", "R203.1");

            // The potentiometer outputs are used here as the left and right audio
            // outputs. In the real circuit they drive the signal inputs of the
            // audio power amplifier ICs for the left and right speakers.

            h.ALIAS("OUT_L", "R103.2");
            h.ALIAS("OUT_R", "R203.2");

            // The real outputs are somewhat constrained in that they drive the
            // bases of the input transistors within the power amplifiers. If they
            // go too low in voltage, there seems to be a peculiar effect on the
            // speaker output waveforms, although I'm not sure whether this is a
            // real effect or an artifact of the LTspice simulation I constructed.
            // Nor am I sure whether it matters in practice. In any case, it's not
            // modeled here.

            h.NETLIST_END();
        }
Exemple #22
0
        //static NETLIST_START(AY2)
        void netlist_AY2(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            throw new emu_unimplemented();
#if false
            TTL_INPUT("CTL6", 0);
            TTL_INPUT("CTL7", 0);
            TTL_INPUT("CTL8", 0);
            TTL_INPUT("CTL9", 0);
            TTL_INPUT("CTL10", 0);
            TTL_INPUT("CTL11", 0);
            /* AY 8910 internal resistors */
            RES("R_AY3C_A", 1000);
            RES("R_AY3C_B", 1000);
            RES("R_AY3C_C", 1000);
            NET_C("VP5", "R_AY3C_A.1", "R_AY3C_B.1", "R_AY3C_C.1");
#endif

            h.SUBMODEL("filter", "FCHA2");
            h.NET_C("FCHA2.I", "R_AY3C_A.2");
            h.SUBMODEL("filter", "FCHB2");
            h.NET_C("FCHB2.I", "R_AY3C_B.2");
            h.SUBMODEL("filter", "FCHC2");
            h.NET_C("FCHC2.I", "R_AY3C_C.2");

            h.NET_C("FCHA2.CTL1", "CTL6");
            h.NET_C("FCHA2.CTL2", "CTL7");
            h.NET_C("FCHB2.CTL1", "CTL8");
            h.NET_C("FCHB2.CTL2", "CTL9");
            h.NET_C("FCHC2.CTL1", "CTL10");
            h.NET_C("FCHC2.CTL2", "CTL11");

            h.NET_C("VP5", "FCHA2.VDD", "FCHB2.VDD", "FCHC2.VDD");
            h.NET_C("GND", "FCHA2.VSS", "FCHB2.VSS", "FCHC2.VSS");

            h.NET_C("VP5", "CTL6.VCC", "CTL7.VCC", "CTL8.VCC", "CTL9.VCC", "CTL10.VCC", "CTL11.VCC");
            h.NET_C("GND", "CTL6.GND", "CTL7.GND", "CTL8.GND", "CTL9.GND", "CTL10.GND", "CTL11.GND");

            h.NETLIST_END();
        }
Exemple #23
0
        //static NETLIST_START(AY1)
        void netlist_AY1(netlist.nlparse_t setup)
        {
            netlist.helper h = new netlist.helper();

            h.NETLIST_START(setup);

            h.TTL_INPUT("CTL0", 0);
            h.TTL_INPUT("CTL1", 0);
            h.TTL_INPUT("CTL2", 0);
            h.TTL_INPUT("CTL3", 0);
            h.TTL_INPUT("CTL4", 0);
            h.TTL_INPUT("CTL5", 0);
            /* AY 8910 internal resistors */
            h.RES("R_AY3D_A", 1000);
            h.RES("R_AY3D_B", 1000);
            h.RES("R_AY3D_C", 1000);
            h.NET_C("VP5", "R_AY3D_A.1", "R_AY3D_B.1", "R_AY3D_C.1");

            h.SUBMODEL("filter", "FCHA1");
            h.NET_C("FCHA1.I", "R_AY3D_A.2");
            h.SUBMODEL("filter", "FCHB1");
            h.NET_C("FCHB1.I", "R_AY3D_B.2");
            h.SUBMODEL("filter", "FCHC1");
            h.NET_C("FCHC1.I", "R_AY3D_C.2");

            h.NET_C("FCHA1.CTL1", "CTL0");
            h.NET_C("FCHA1.CTL2", "CTL1");
            h.NET_C("FCHB1.CTL1", "CTL2");
            h.NET_C("FCHB1.CTL2", "CTL3");
            h.NET_C("FCHC1.CTL1", "CTL4");
            h.NET_C("FCHC1.CTL2", "CTL5");

            h.NET_C("VP5", "FCHA1.VDD", "FCHB1.VDD", "FCHC1.VDD");
            h.NET_C("GND", "FCHA1.VSS", "FCHB1.VSS", "FCHC1.VSS");

            h.NET_C("VP5", "CTL0.VCC", "CTL1.VCC", "CTL2.VCC", "CTL3.VCC", "CTL4.VCC", "CTL5.VCC");
            h.NET_C("GND", "CTL0.GND", "CTL1.GND", "CTL2.GND", "CTL3.GND", "CTL4.GND", "CTL5.GND");

            h.NETLIST_END();
        }