Previous 199869 Revisions Next

r44358 Saturday 23rd January, 2016 at 16:30:14 UTC by Ryan Holtz
Remove this==NULL comps, nw
[src/devices/sound]sn76477.cpp sn76477.h
[src/emu]device.cpp device.h memory.h screen.h

trunk/src/devices/sound/sn76477.cpp
r252869r252870
7676
7777#define LOG(n,x) do { if (VERBOSE >= (n)) logerror x; } while (0)
7878
79#define CHECK_CHIP_NUM                  assert(this != NULL)
80#define CHECK_CHIP_NUM_AND_BOOLEAN      CHECK_CHIP_NUM; assert((state & 0x01) == state)
81#define CHECK_CHIP_NUM_AND_POSITIVE     CHECK_CHIP_NUM; assert(data >= 0.0)
82#define CHECK_CHIP_NUM_AND_VOLTAGE      CHECK_CHIP_NUM; assert((data >= 0.0) && (data <= 5.0))
83#define CHECK_CHIP_NUM_AND_CAP_VOLTAGE  CHECK_CHIP_NUM; assert(((data >= 0.0) && (data <= 5.0)) || (data == SN76477_EXTERNAL_VOLTAGE_DISCONNECT))
79#define CHECK_BOOLEAN      assert((state & 0x01) == state)
80#define CHECK_POSITIVE     assert(data >= 0.0)
81#define CHECK_VOLTAGE      assert((data >= 0.0) && (data <= 5.0))
82#define CHECK_CAP_VOLTAGE  assert(((data >= 0.0) && (data <= 5.0)) || (data == SN76477_EXTERNAL_VOLTAGE_DISCONNECT))
8483
85
86
8784/*****************************************************************************
8885 *
89 *  Test Mode
90 *
91 *  in test mode, calls by the driver to
92 *  the input setter functions are ignored.
93 *  Interface values can be set in device_start
94 *  to any desired test value.
95 *  Use the space bar to enable/disable the chip.
96 *
97 *****************************************************************************/
98
99#define TEST_MODE   0
100
101/*****************************************************************************
102 *
10386 *  Constants
10487 *
10588 *****************************************************************************/
r252869r252870
233216   intialize_noise();
234217
235218   // set up mixer and envelope modes, based on interface values
236   _SN76477_mixer_a_w(m_mixer_a);
237   _SN76477_mixer_b_w(m_mixer_b);
238   _SN76477_mixer_c_w(m_mixer_c);
239   _SN76477_envelope_1_w(m_envelope_1);
240   _SN76477_envelope_2_w(m_envelope_2);
219   mixer_a_w(m_mixer_a);
220   mixer_b_w(m_mixer_b);
221   mixer_c_w(m_mixer_c);
222   envelope_1_w(m_envelope_1);
223   envelope_2_w(m_envelope_2);
241224
242225   m_one_shot_cap_voltage = ONE_SHOT_CAP_VOLTAGE_MIN;
243226   m_slf_cap_voltage = SLF_CAP_VOLTAGE_MIN;
r252869r252870
966949 *
967950 *****************************************************************************/
968951
969void sn76477_device::_SN76477_enable_w(UINT32 data)
952WRITE_LINE_MEMBER(sn76477_device::enable_w)
970953{
971   m_enable = data;
954   CHECK_BOOLEAN;
972955
973      /* if falling edge */
974   if (!m_enable)
956   if (state != m_enable)
975957   {
976      /* start the attack phase */
977      m_attack_decay_cap_voltage = AD_CAP_VOLTAGE_MIN;
958      m_channel->update();
978959
979      /* one-shot runs regardless of envelope mode */
980      m_one_shot_running_ff = 1;
981   }
982}
960       m_enable = state;
983961
962          /* if falling edge */
963       if (!m_enable)
964       {
965          /* start the attack phase */
966          m_attack_decay_cap_voltage = AD_CAP_VOLTAGE_MIN;
984967
985void sn76477_device::SN76477_test_enable_w(UINT32 data)
986{
987   if (data != m_enable)
988   {
989      m_channel->update();
968          /* one-shot runs regardless of envelope mode */
969          m_one_shot_running_ff = 1;
970       }
990971
991      _SN76477_enable_w(data);
992
993972      log_enable_line();
994973   }
995974}
996975
997976
998WRITE_LINE_MEMBER( sn76477_device::enable_w )
999{
1000#if TEST_MODE == 0
1001   CHECK_CHIP_NUM_AND_BOOLEAN;
1002977
1003   SN76477_test_enable_w(state);
1004#endif
1005}
1006
1007
1008
1009978/*****************************************************************************
1010979 *
1011980 *  Set mixer select inputs
1012981 *
1013982 *****************************************************************************/
1014983
1015void sn76477_device::_SN76477_mixer_a_w(UINT32 data)
1016{
1017   m_mixer_mode = (m_mixer_mode & ~0x01) | (data << 0);
1018}
1019
1020
1021984WRITE_LINE_MEMBER( sn76477_device::mixer_a_w )
1022985{
1023#if TEST_MODE == 0
1024   CHECK_CHIP_NUM_AND_BOOLEAN;
986   CHECK_BOOLEAN;
1025987
1026988   if (state != ((m_mixer_mode >> 0) & 0x01))
1027989   {
1028990      m_channel->update();
1029991
1030      _SN76477_mixer_a_w(state);
992      m_mixer_mode = (m_mixer_mode & ~0x01) | state;
1031993
1032994      log_mixer_mode();
1033995   }
1034#endif
1035996}
1036997
1037
1038void sn76477_device::_SN76477_mixer_b_w(UINT32 data)
1039{
1040   m_mixer_mode = (m_mixer_mode & ~0x02) | (data << 1);
1041}
1042
1043
1044998WRITE_LINE_MEMBER( sn76477_device::mixer_b_w )
1045999{
1046#if TEST_MODE == 0
1047   CHECK_CHIP_NUM_AND_BOOLEAN;
1000   CHECK_BOOLEAN;
10481001
10491002   if (state != ((m_mixer_mode >> 1) & 0x01))
10501003   {
10511004      m_channel->update();
10521005
1053      _SN76477_mixer_b_w(state);
1006      m_mixer_mode = (m_mixer_mode & ~0x02) | (state << 1);
10541007
10551008      log_mixer_mode();
10561009   }
1057#endif
10581010}
10591011
1060
1061void sn76477_device::_SN76477_mixer_c_w(UINT32 data)
1062{
1063   m_mixer_mode = (m_mixer_mode & ~0x04) | (data << 2);
1064}
1065
1066
10671012WRITE_LINE_MEMBER( sn76477_device::mixer_c_w )
10681013{
1069#if TEST_MODE == 0
1070   CHECK_CHIP_NUM_AND_BOOLEAN;
1014   CHECK_BOOLEAN;
10711015
10721016   if (state != ((m_mixer_mode >> 2) & 0x01))
10731017   {
10741018      m_channel->update();
10751019
1076      _SN76477_mixer_c_w(state);
1020      m_mixer_mode = (m_mixer_mode & ~0x04) | (state << 2);
10771021
10781022      log_mixer_mode();
10791023   }
1080#endif
10811024}
10821025
1083
1084
10851026/*****************************************************************************
10861027 *
10871028 *  Set envelope select inputs
10881029 *
10891030 *****************************************************************************/
10901031
1091void sn76477_device::_SN76477_envelope_1_w(UINT32 data)
1092{
1093   m_envelope_mode = (m_envelope_mode & ~0x01) | (data << 0);
1094}
1095
1096
10971032WRITE_LINE_MEMBER( sn76477_device::envelope_1_w )
10981033{
1099#if TEST_MODE == 0
1100   CHECK_CHIP_NUM_AND_BOOLEAN;
1034   CHECK_BOOLEAN;
11011035
11021036   if (state != ((m_envelope_mode >> 0) & 0x01))
11031037   {
11041038      m_channel->update();
11051039
1106      _SN76477_envelope_1_w(state);
1040      m_envelope_mode = (m_envelope_mode & ~0x01) | state;
11071041
11081042      log_envelope_mode();
11091043   }
1110#endif
11111044}
11121045
1113
1114void sn76477_device::_SN76477_envelope_2_w(UINT32 data)
1115{
1116   m_envelope_mode = (m_envelope_mode & ~0x02) | (data << 1);
1117}
1118
1119
11201046WRITE_LINE_MEMBER( sn76477_device::envelope_2_w )
11211047{
1122#if TEST_MODE == 0
1123   CHECK_CHIP_NUM_AND_BOOLEAN;
1048   CHECK_BOOLEAN;
11241049
11251050   if (state != ((m_envelope_mode >> 1) & 0x01))
11261051   {
11271052      m_channel->update();
11281053
1129      _SN76477_envelope_2_w(state);
1054      m_envelope_mode = (m_envelope_mode & ~0x02) | (state << 1);
11301055
11311056      log_envelope_mode();
11321057   }
1133#endif
11341058}
11351059
1136
1137
11381060/*****************************************************************************
11391061 *
11401062 *  Set VCO select input
11411063 *
11421064 *****************************************************************************/
11431065
1144void sn76477_device::_SN76477_vco_w(UINT32 data)
1145{
1146   m_vco_mode = data;
1147}
1148
1149
11501066WRITE_LINE_MEMBER( sn76477_device::vco_w )
11511067{
1152#if TEST_MODE == 0
1153   CHECK_CHIP_NUM_AND_BOOLEAN;
1068   CHECK_BOOLEAN;
11541069
11551070   if (state != m_vco_mode)
11561071   {
11571072      m_channel->update();
11581073
1159      _SN76477_vco_w(state);
1074      m_vco_mode = state;
11601075
11611076      log_vco_mode();
11621077   }
1163#endif
11641078}
11651079
1166
1167
11681080/*****************************************************************************
11691081 *
11701082 *  Set one-shot resistor
11711083 *
11721084 *****************************************************************************/
11731085
1174void sn76477_device::_SN76477_one_shot_res_w(double data)
1175{
1176   m_one_shot_res = data;
1177}
1178
1179
11801086void sn76477_device::one_shot_res_w(double data)
11811087{
1182#if TEST_MODE == 0
1183   CHECK_CHIP_NUM_AND_POSITIVE;
1088   CHECK_POSITIVE;
11841089
11851090   if (data != m_one_shot_res)
11861091   {
11871092      m_channel->update();
11881093
1189      _SN76477_one_shot_res_w(data);
1094      m_one_shot_res = data;
11901095
11911096      log_one_shot_time();
11921097   }
1193#endif
11941098}
11951099
1196
1197
11981100/*****************************************************************************
11991101 *
12001102 *  Set one-shot capacitor
12011103 *
12021104 *****************************************************************************/
12031105
1204void sn76477_device::_SN76477_one_shot_cap_w(double data)
1205{
1206   m_one_shot_cap = data;
1207}
1208
1209
12101106void sn76477_device::one_shot_cap_w(double data)
12111107{
1212#if TEST_MODE == 0
1213   CHECK_CHIP_NUM_AND_POSITIVE;
1108   CHECK_POSITIVE;
12141109
12151110   if (data != m_one_shot_cap)
12161111   {
12171112      m_channel->update();
12181113
1219      _SN76477_one_shot_cap_w(data);
1114      m_one_shot_cap = data;
12201115
12211116      log_one_shot_time();
12221117   }
1223#endif
12241118}
12251119
1226
1227
12281120/*****************************************************************************
12291121 *
12301122 *  Set the voltage on the one-shot capacitor
r252869r252870
12331125
12341126void sn76477_device::one_shot_cap_voltage_w(double data)
12351127{
1236#if TEST_MODE == 0
1237   CHECK_CHIP_NUM_AND_CAP_VOLTAGE;
1128   CHECK_CAP_VOLTAGE;
12381129
12391130   if (data == SN76477_EXTERNAL_VOLTAGE_DISCONNECT)
12401131   {
r252869r252870
12611152         log_one_shot_time();
12621153      }
12631154   }
1264#endif
12651155}
12661156
1267
1268
12691157/*****************************************************************************
12701158 *
12711159 *  Set SLF resistor
12721160 *
12731161 *****************************************************************************/
12741162
1275void sn76477_device::_SN76477_slf_res_w(double data)
1276{
1277   m_slf_res = data;
1278}
1279
1280
12811163void sn76477_device::slf_res_w(double data)
12821164{
1283#if TEST_MODE == 0
1284   CHECK_CHIP_NUM_AND_POSITIVE;
1165   CHECK_POSITIVE;
12851166
12861167   if (data != m_slf_res)
12871168   {
12881169      m_channel->update();
12891170
1290      _SN76477_slf_res_w(data);
1171      m_slf_res = data;
12911172
12921173      log_slf_freq();
12931174   }
1294#endif
12951175}
12961176
1297
1298
12991177/*****************************************************************************
13001178 *
13011179 *  Set SLF capacitor
13021180 *
13031181 *****************************************************************************/
13041182
1305void sn76477_device::_SN76477_slf_cap_w(double data)
1306{
1307   m_slf_cap = data;
1308}
1309
1310
13111183void sn76477_device::slf_cap_w(double data)
13121184{
1313#if TEST_MODE == 0
1314   CHECK_CHIP_NUM_AND_POSITIVE;
1185   CHECK_POSITIVE;
13151186
13161187   if (data != m_slf_cap)
13171188   {
13181189      m_channel->update();
13191190
1320      _SN76477_slf_cap_w(data);
1191      m_slf_cap = data;
13211192
13221193      log_slf_freq();
13231194   }
1324#endif
13251195}
13261196
1327
1328
13291197/*****************************************************************************
13301198 *
13311199 *  Set the voltage on the SLF capacitor
r252869r252870
13361204
13371205void sn76477_device::slf_cap_voltage_w(double data)
13381206{
1339#if TEST_MODE == 0
1340   CHECK_CHIP_NUM_AND_CAP_VOLTAGE;
1207   CHECK_CAP_VOLTAGE;
13411208
13421209   if (data == SN76477_EXTERNAL_VOLTAGE_DISCONNECT)
13431210   {
r252869r252870
13641231         log_slf_freq();
13651232      }
13661233   }
1367#endif
13681234}
13691235
1370
1371
13721236/*****************************************************************************
13731237 *
13741238 *  Set VCO resistor
13751239 *
13761240 *****************************************************************************/
13771241
1378void sn76477_device::_SN76477_vco_res_w(double data)
1379{
1380   m_vco_res = data;
1381}
1382
1383
13841242void sn76477_device::vco_res_w(double data)
13851243{
1386#if TEST_MODE == 0
1387   CHECK_CHIP_NUM_AND_POSITIVE;
1244   CHECK_POSITIVE;
13881245
13891246   if (data != m_vco_res)
13901247   {
13911248      m_channel->update();
13921249
1393      _SN76477_vco_res_w(data);
1250      m_vco_res = data;
13941251
13951252      log_vco_freq();
13961253   }
1397#endif
13981254}
13991255
1400
1401
14021256/*****************************************************************************
14031257 *
14041258 *  Set VCO capacitor
14051259 *
14061260 *****************************************************************************/
14071261
1408void sn76477_device::_SN76477_vco_cap_w(double data)
1409{
1410   m_vco_cap = data;
1411}
1412
1413
14141262void sn76477_device::vco_cap_w(double data)
14151263{
1416#if TEST_MODE == 0
1417   CHECK_CHIP_NUM_AND_POSITIVE;
1264   CHECK_POSITIVE;
14181265
14191266   if (data != m_vco_cap)
14201267   {
14211268      m_channel->update();
14221269
1423      _SN76477_vco_cap_w(data);
1270      m_vco_cap = data;
14241271
14251272      log_vco_freq();
14261273   }
1427#endif
14281274}
14291275
1430
1431
14321276/*****************************************************************************
14331277 *
14341278 *  Set the voltage on the VCO capacitor
r252869r252870
14371281
14381282void sn76477_device::vco_cap_voltage_w(double data)
14391283{
1440#if TEST_MODE == 0
1441   CHECK_CHIP_NUM_AND_CAP_VOLTAGE;
1284   CHECK_CAP_VOLTAGE;
14421285
14431286   if (data == SN76477_EXTERNAL_VOLTAGE_DISCONNECT)
14441287   {
r252869r252870
14651308         log_vco_freq();
14661309      }
14671310   }
1468#endif
14691311}
14701312
1471
1472
14731313/*****************************************************************************
14741314 *
14751315 *  Set VCO voltage
14761316 *
14771317 *****************************************************************************/
14781318
1479void sn76477_device::_SN76477_vco_voltage_w(double data)
1480{
1481   m_vco_voltage = data;
1482}
1483
1484
14851319void sn76477_device::vco_voltage_w(double data)
14861320{
1487#if TEST_MODE == 0
1488   CHECK_CHIP_NUM_AND_VOLTAGE;
1321   CHECK_VOLTAGE;
14891322
14901323   if (data != m_vco_voltage)
14911324   {
14921325      m_channel->update();
14931326
1494      _SN76477_vco_voltage_w(data);
1327      m_vco_voltage = data;
14951328
14961329      log_vco_ext_voltage();
14971330      log_vco_duty_cycle();
14981331   }
1499#endif
15001332}
15011333
1502
1503
15041334/*****************************************************************************
15051335 *
15061336 *  Set pitch voltage
15071337 *
15081338 *****************************************************************************/
15091339
1510void sn76477_device::_SN76477_pitch_voltage_w(double data)
1511{
1512   m_pitch_voltage = data;
1513}
1514
1515
15161340void sn76477_device::pitch_voltage_w(double data)
15171341{
1518#if TEST_MODE == 0
1519   CHECK_CHIP_NUM_AND_VOLTAGE;
1342   CHECK_VOLTAGE;
15201343
15211344   if (data != m_pitch_voltage)
15221345   {
15231346      m_channel->update();
15241347
1525      _SN76477_pitch_voltage_w(data);
1348      m_pitch_voltage = data;
15261349
15271350      log_vco_pitch_voltage();
15281351      log_vco_duty_cycle();
15291352   }
1530#endif
15311353}
15321354
1533
1534
15351355/*****************************************************************************
15361356 *
15371357 *  Set noise external clock
r252869r252870
15401360
15411361WRITE_LINE_MEMBER( sn76477_device::noise_clock_w )
15421362{
1543#if TEST_MODE == 0
1544   CHECK_CHIP_NUM_AND_BOOLEAN;
1363   CHECK_BOOLEAN;
15451364
15461365   if (state != m_noise_clock)
15471366   {
r252869r252870
15561375         m_real_noise_bit_ff = generate_next_real_noise_bit();
15571376      }
15581377   }
1559#endif
15601378}
15611379
1562
1563
15641380/*****************************************************************************
15651381 *
15661382 *  Set noise clock resistor
15671383 *
15681384 *****************************************************************************/
15691385
1570void sn76477_device::_SN76477_noise_clock_res_w(double data)
1571{
1572   if (data == 0)
1573   {
1574      m_noise_clock_ext = 1;
1575   }
1576   else
1577   {
1578      m_noise_clock_ext = 0;
1579
1580      m_noise_clock_res = data;
1581   }
1582}
1583
1584
15851386void sn76477_device::noise_clock_res_w(double data)
15861387{
1587#if TEST_MODE == 0
1588   CHECK_CHIP_NUM_AND_POSITIVE;
1388   CHECK_POSITIVE;
15891389
15901390   if (((data == 0) && !m_noise_clock_ext) ||
15911391      ((data != 0) && (data != m_noise_clock_res)))
15921392   {
15931393      m_channel->update();
15941394
1595      _SN76477_noise_clock_res_w(data);
1395       if (data == 0)
1396       {
1397          m_noise_clock_ext = 1;
1398       }
1399       else
1400       {
1401          m_noise_clock_ext = 0;
15961402
1403          m_noise_clock_res = data;
1404       }
1405
15971406      log_noise_gen_freq();
15981407   }
1599#endif
16001408}
16011409
1602
1603
16041410/*****************************************************************************
16051411 *
16061412 *  Set noise filter resistor
16071413 *
16081414 *****************************************************************************/
16091415
1610void sn76477_device::_SN76477_noise_filter_res_w(double data)
1611{
1612   m_noise_filter_res = data;
1613}
1614
1615
16161416void sn76477_device::noise_filter_res_w(double data)
16171417{
1618#if TEST_MODE == 0
1619   CHECK_CHIP_NUM_AND_POSITIVE;
1418   CHECK_POSITIVE;
16201419
16211420   if (data != m_noise_filter_res)
16221421   {
16231422      m_channel->update();
16241423
1625      _SN76477_noise_filter_res_w(data);
1424      m_noise_filter_res = data;
16261425
16271426      log_noise_filter_freq();
16281427   }
1629#endif
16301428}
16311429
1632
1633
16341430/*****************************************************************************
16351431 *
16361432 *  Set noise filter capacitor
16371433 *
16381434 *****************************************************************************/
16391435
1640void sn76477_device::_SN76477_noise_filter_cap_w(double data)
1641{
1642   m_noise_filter_cap = data;
1643}
1644
1645
16461436void sn76477_device::noise_filter_cap_w(double data)
16471437{
1648#if TEST_MODE == 0
1649   CHECK_CHIP_NUM_AND_POSITIVE;
1438   CHECK_POSITIVE;
16501439
16511440   if (data != m_noise_filter_cap)
16521441   {
16531442      m_channel->update();
16541443
1655      _SN76477_noise_filter_cap_w(data);
1444      m_noise_filter_cap = data;
16561445
16571446      log_noise_filter_freq();
16581447   }
1659#endif
16601448}
16611449
1662
1663
16641450/*****************************************************************************
16651451 *
16661452 *  Set the voltage on the noise filter capacitor
r252869r252870
16691455
16701456void sn76477_device::noise_filter_cap_voltage_w(double data)
16711457{
1672#if TEST_MODE == 0
1673   CHECK_CHIP_NUM_AND_CAP_VOLTAGE;
1458   CHECK_CAP_VOLTAGE;
16741459
16751460   if (data == SN76477_EXTERNAL_VOLTAGE_DISCONNECT)
16761461   {
r252869r252870
16971482         log_noise_filter_freq();
16981483      }
16991484   }
1700#endif
17011485}
17021486
1703
1704
17051487/*****************************************************************************
17061488 *
17071489 *  Set attack resistor
17081490 *
17091491 *****************************************************************************/
17101492
1711void sn76477_device::_SN76477_attack_res_w(double data)
1712{
1713   m_attack_res = data;
1714}
1715
1716
17171493void sn76477_device::attack_res_w(double data)
17181494{
1719#if TEST_MODE == 0
1720   CHECK_CHIP_NUM_AND_POSITIVE;
1495   CHECK_POSITIVE;
17211496
17221497   if (data != m_attack_res)
17231498   {
17241499      m_channel->update();
17251500
1726      _SN76477_attack_res_w(data);
1501      m_attack_res = data;
17271502
17281503      log_attack_time();
17291504   }
1730#endif
17311505}
17321506
1733
1734
17351507/*****************************************************************************
17361508 *
17371509 *  Set decay resistor
17381510 *
17391511 *****************************************************************************/
17401512
1741void sn76477_device::_SN76477_decay_res_w(double data)
1742{
1743   m_decay_res = data;
1744}
1745
1746
17471513void sn76477_device::decay_res_w(double data)
17481514{
1749#if TEST_MODE == 0
1750   CHECK_CHIP_NUM_AND_POSITIVE;
1515   CHECK_POSITIVE;
17511516
17521517   if (data != m_decay_res)
17531518   {
17541519      m_channel->update();
17551520
1756      _SN76477_decay_res_w(data);
1521      m_decay_res = data;
17571522
17581523      log_decay_time();
17591524   }
1760#endif
17611525}
17621526
1763
1764
17651527/*****************************************************************************
17661528 *
17671529 *  Set attack/decay capacitor
17681530 *
17691531 *****************************************************************************/
17701532
1771void sn76477_device::_SN76477_attack_decay_cap_w(double data)
1772{
1773   m_attack_decay_cap = data;
1774}
1775
1776
17771533void sn76477_device::attack_decay_cap_w(double data)
17781534{
1779#if TEST_MODE == 0
1780   CHECK_CHIP_NUM_AND_POSITIVE;
1535   CHECK_POSITIVE;
17811536
17821537   if (data != m_attack_decay_cap)
17831538   {
17841539      m_channel->update();
17851540
1786      _SN76477_attack_decay_cap_w(data);
1541      m_attack_decay_cap = data;
17871542
17881543      log_attack_time();
17891544      log_decay_time();
17901545   }
1791#endif
17921546}
17931547
1794
1795
17961548/*****************************************************************************
17971549 *
17981550 *  Set the voltage on the attack/decay capacitor
r252869r252870
18011553
18021554void sn76477_device::attack_decay_cap_voltage_w(double data)
18031555{
1804#if TEST_MODE == 0
1805   CHECK_CHIP_NUM_AND_CAP_VOLTAGE;
1556   CHECK_CAP_VOLTAGE;
18061557
18071558   if (data == SN76477_EXTERNAL_VOLTAGE_DISCONNECT)
18081559   {
r252869r252870
18311582         log_decay_time();
18321583      }
18331584   }
1834#endif
18351585}
18361586
1837
1838
18391587/*****************************************************************************
18401588 *
18411589 *  Set amplitude resistor
18421590 *
18431591 *****************************************************************************/
18441592
1845void sn76477_device::_SN76477_amplitude_res_w(double data)
1846{
1847   m_amplitude_res = data;
1848}
1849
1850
18511593void sn76477_device::amplitude_res_w(double data)
18521594{
1853#if TEST_MODE == 0
1854   CHECK_CHIP_NUM_AND_POSITIVE;
1595   CHECK_POSITIVE;
18551596
18561597   if (data != m_amplitude_res)
18571598   {
18581599      m_channel->update();
18591600
1860      _SN76477_amplitude_res_w(data);
1601      m_amplitude_res = data;
18611602
18621603      log_voltage_out();
18631604   }
1864#endif
18651605}
18661606
1867
1868
18691607/*****************************************************************************
18701608 *
18711609 *  Set feedback resistor
18721610 *
18731611 *****************************************************************************/
18741612
1875void sn76477_device::_SN76477_feedback_res_w(double data)
1876{
1877   m_feedback_res = data;
1878}
1879
1880
18811613void sn76477_device::feedback_res_w(double data)
18821614{
1883#if TEST_MODE == 0
1884   CHECK_CHIP_NUM_AND_POSITIVE;
1615   CHECK_POSITIVE;
18851616
18861617   if (data != m_feedback_res)
18871618   {
18881619      m_channel->update();
18891620
1890      _SN76477_feedback_res_w(data);
1621      m_feedback_res = data;
18911622
18921623      log_voltage_out();
18931624   }
1894#endif
18951625}
18961626
1897
18981627/*****************************************************************************
18991628 *
19001629 *  State saving
r252869r252870
19821711
19831712   stream_sample_t *buffer = outputs[0];
19841713
1985
1986#if TEST_MODE
1987   static int recursing = 0;   /* we need to prevent recursion since enable_w calls machine().input().code_pressed_once(KEYCODE_SPACE->update */
1988
1989   if () && !recursing)
1990   {
1991      recursing = 1;
1992
1993      machine().sound().system_enable();
1994      SN76477_test_enable_w(!m_enable);
1995   }
1996
1997   recursing = 0;
1998#endif
1999
2000   /* compute charging values, doing it here ensures that we always use the latest values */
1714    /* compute charging values, doing it here ensures that we always use the latest values */
20011715   one_shot_cap_charging_step = compute_one_shot_cap_charging_rate() / m_our_sample_rate;
20021716   one_shot_cap_discharging_step = compute_one_shot_cap_discharging_rate() / m_our_sample_rate;
20031717
trunk/src/devices/sound/sn76477.h
r252869r252870
304304   inline UINT32 generate_next_real_noise_bit();
305305
306306   void state_save_register();
307
308   void _SN76477_enable_w(UINT32 data);
309   void _SN76477_vco_w(UINT32 data);
310   void _SN76477_mixer_a_w(UINT32 data);
311   void _SN76477_mixer_b_w(UINT32 data);
312   void _SN76477_mixer_c_w(UINT32 data);
313   void _SN76477_envelope_1_w(UINT32 data);
314   void _SN76477_envelope_2_w(UINT32 data);
315   void _SN76477_one_shot_res_w(double data);
316   void _SN76477_one_shot_cap_w(double data);
317   void _SN76477_slf_res_w(double data);
318   void _SN76477_slf_cap_w(double data);
319   void _SN76477_vco_res_w(double data);
320   void _SN76477_vco_cap_w(double data);
321   void _SN76477_vco_voltage_w(double data);
322   void _SN76477_noise_clock_res_w(double data);
323   void _SN76477_noise_filter_res_w(double data);
324   void _SN76477_noise_filter_cap_w(double data);
325   void _SN76477_decay_res_w(double data);
326   void _SN76477_attack_res_w(double data);
327   void _SN76477_attack_decay_cap_w(double data);
328   void _SN76477_amplitude_res_w(double data);
329   void _SN76477_feedback_res_w(double data);
330   void _SN76477_pitch_voltage_w(double data);
331   void SN76477_test_enable_w(UINT32 data);
332307};
333308
334309extern const device_type SN76477;
trunk/src/emu/device.cpp
r252869r252870
8484
8585memory_region *device_t::memregion(const char *_tag) const
8686{
87   // safety first
88   if (this == nullptr)
89      return nullptr;
90
9187   // build a fully-qualified name and look it up
9288   return machine().memory().region(subtag(_tag).c_str());
9389}
r252869r252870
10096
10197memory_share *device_t::memshare(const char *_tag) const
10298{
103   // safety first
104   if (this == nullptr)
105      return nullptr;
106
10799   // build a fully-qualified name and look it up
108100   return machine().memory().shared(subtag(_tag).c_str());
109101}
r252869r252870
132124
133125ioport_port *device_t::ioport(const char *tag) const
134126{
135   // safety first
136   if (this == nullptr)
137      return nullptr;
138
139127   // build a fully-qualified name and look it up
140128   return machine().ioport().port(subtag(tag).c_str());
141129}
r252869r252870
148136
149137std::string device_t::parameter(const char *tag) const
150138{
151   // safety first
152   if (this == nullptr)
153      return nullptr;
154
155139   // build a fully-qualified name and look it up
156140   return machine().parameters().lookup(subtag(tag));
157141}
trunk/src/emu/device.h
r252869r252870
151151   // owned object helpers
152152   device_t *first_subdevice() const { return m_subdevice_list.first(); }
153153   std::string subtag(const char *tag) const;
154   std::string siblingtag(const char *tag) const { return (this != nullptr && m_owner != nullptr) ? m_owner->subtag(tag) : std::string(tag); }
154   std::string siblingtag(const char *tag) const { return (m_owner != nullptr) ? m_owner->subtag(tag) : std::string(tag); }
155155   memory_region *memregion(const char *tag) const;
156156   memory_share *memshare(const char *tag) const;
157157   memory_bank *membank(const char *tag) const;
r252869r252870
589589
590590inline device_t *device_t::subdevice(const char *tag) const
591591{
592   // safety first
593   if (this == nullptr)
594      return nullptr;
595
596592   // empty string or NULL means this device
597593   if (tag == nullptr || *tag == 0)
598594      return const_cast<device_t *>(this);
r252869r252870
610606
611607inline device_t *device_t::siblingdevice(const char *tag) const
612608{
613   // safety first
614   if (this == nullptr)
615      return nullptr;
616
617609   // empty string or NULL means this device
618610   if (tag == nullptr || *tag == 0)
619611      return const_cast<device_t *>(this);
trunk/src/emu/memory.h
r252869r252870
641641
642642   // getters
643643   memory_share *next() const { return m_next; }
644   // NOTE: this being NULL in a C++ member function can lead to undefined behavior.
645   // However, it is relied on throughout MAME, so will remain for now.
646   void *ptr() const { if (this == nullptr) return nullptr; return m_ptr; }
644   void *ptr() const { return m_ptr; }
647645   size_t bytes() const { return m_bytes; }
648646   endianness_t endianness() const { return m_endianness; }
649647   UINT8 bitwidth() const { return m_bitwidth; }
r252869r252870
682680   // getters
683681   running_machine &machine() const { return m_machine; }
684682   memory_region *next() const { return m_next; }
685   UINT8 *base() { return (this != nullptr) ? &m_buffer[0] : nullptr; }
686   UINT8 *end() { return (this != nullptr) ? base() + m_buffer.size() : nullptr; }
687   UINT32 bytes() const { return (this != nullptr) ? m_buffer.size() : 0; }
683   UINT8 *base() { return &m_buffer[0]; }
684   UINT8 *end() { return base() + m_buffer.size(); }
685   UINT32 bytes() const { return m_buffer.size(); }
688686   const char *name() const { return m_name.c_str(); }
689687
690688   // flag expansion
trunk/src/emu/screen.h
r252869r252870
218218   attotime time_until_vblank_end() const;
219219   attotime time_until_update() const { return (m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK) ? time_until_vblank_end() : time_until_vblank_start(); }
220220   attotime scan_period() const { return attotime(0, m_scantime); }
221   attotime frame_period() const { return (this == nullptr) ? DEFAULT_FRAME_PERIOD : attotime(0, m_frame_period); };
221   attotime frame_period() const { return attotime(0, m_frame_period); }
222222   UINT64 frame_number() const { return m_frame_number; }
223223
224224   // updating


Previous 199869 Revisions Next


© 1997-2024 The MAME Team