static void gpss4_init(struct sndbrdData *brdData) { capTimer = timer_alloc(capTimer_timer); timer_adjust(capTimer, TIME_NEVER, 0, TIME_NEVER); /* MIXER (pins 27,25,26) = 010 */ SN76477_mixer_w(0, 2); /* ENVELOPE is constant: pin1 = hi, pin 28 = lo */ SN76477_envelope_w(0, 1); /* ENVELOPE is constant: pin1 = hi, pin 28 = lo */ SN76477_envelope_w(1, 1); SN76477_vco_w(1, 1); /* MIXER = 0 */ SN76477_mixer_w(2, 0); /* ENVELOPE is constant: pin1 = lo, pin 28 = lo */ SN76477_envelope_w(2, 0); /* MIXER = 0 */ SN76477_mixer_w(3, 0); /* ENVELOPE is constant: pin1 = lo, pin 28 = hi */ SN76477_envelope_w(3, 2); SN76477_vco_w(3, 1); }
static void gpss2_init(struct sndbrdData *brdData) { /* MIXER B = 1 */ SN76477_mixer_w(0, 2); /* ENVELOPE is constant: pin1 = hi, pin 28 = lo */ SN76477_envelope_w(0, 1); /* MIXER = 0 */ SN76477_mixer_w(2, 0); /* ENVELOPE is constant: pin1 = lo, pin 28 = lo */ SN76477_envelope_w(2, 0); }
static WRITE_HANDLER(riot_portb_w) { double vco = 5.5 - (core_getDip(0) >> 4) / 6.0; vco -= ((data & 8) ? vco / 2.0 : 0) + ((data & 4) ? vco / 4.0 : 0)+ ((data & 2) ? vco / 8.0 : 0)+ ((data & 1) ? vco / 16.0 : 0); logerror("RIOT B WRITE %02x, vco: %0f\n", data, vco); SN76477_set_vco_voltage(0, 5.5 - vco); SN76477_enable_w(0, data & 0x10 ? 0 : 1); // strobe: toggles enable SN76477_envelope_w(0, data & 0x20 ? 0 : 1); //decay: toggles envelope SN76477_vco_w(0, data & 0x40 ? 1 : 0); // "phaser" sound: VCO toggled SN76477_mixer_w(0, data & 0x80 ? 2 : 0); // "pulse" sound: pins 25 & 27 changed }
static MACHINE_INIT( crbaloon ) { /* MIXER A = 0, MIXER C = 1 */ SN76477_mixer_a_w(0, 0); SN76477_mixer_c_w(0, 1); /* ENVELOPE is constant: pin1 = hi, pin 28 = lo */ SN76477_envelope_w(0, 1); /* fake: pulse the enable line to get rid of the constant noise */ SN76477_enable_w(0, 1); SN76477_enable_w(0, 0); }
static WRITE_HANDLER(gpss2_data_w) { // tone frequencies D' C' B A H G F E D static double voltage[16] = {5.7, 5.4, 4.8, 4.5, 5.1, 4.0, 3.6, 0, 0, 3.3, 3.0}; static int howl_or_whoop = 0; int sb = core_gameData->hw.soundBoard & 0x01; // 1 if SSU3 data &= 0x0f; switch (data) { case 0x07: // gunshot SN76477_enable_w(1, 1); SN76477_mixer_w(1, 2); SN76477_envelope_w(1, 1); SN76477_vco_w(1, 1); SN76477_set_noise_res(1, RES_K(50)); /* 4 */ SN76477_set_filter_res(1, RES_K(120)); /* 5 */ SN76477_set_decay_res(1, RES_M(2.2)); /* 7 */ SN76477_set_attack_decay_cap(1, CAP_U(0.1)); /* 8 */ SN76477_set_vco_cap(1, CAP_U(0.1)); /* 17 */ SN76477_set_vco_res(1, RES_K(56)); /* 18 */ SN76477_set_slf_res(1, RES_M(2.2)); /* 20 */ SN76477_set_slf_cap(1, CAP_U(1)); /* 21 */ SN76477_set_oneshot_cap(1, CAP_U(1)); /* 23 */ SN76477_set_oneshot_res(1, RES_K(110)); /* 24 */ SN76477_enable_w(1, 0); break; case 0x08: // rattlesnake / warble SN76477_enable_w(1, 1); SN76477_mixer_w(1, sb ? 0 : 4); SN76477_envelope_w(1, sb ? 1/*0*/: 1); // schematics suggest 0 for SSU-3, which won't work! SN76477_vco_w(1, 1); SN76477_set_noise_res(1, RES_K(100)); /* 4 */ SN76477_set_filter_res(1, RES_K(120)); /* 5 */ SN76477_set_decay_res(1, RES_M(2.2)); /* 7 */ SN76477_set_attack_decay_cap(1, CAP_U(0.1)); /* 8 */ SN76477_set_vco_cap(1, CAP_U(0.1)); /* 17 */ SN76477_set_vco_res(1, RES_K(56)); /* 18 */ SN76477_set_slf_res(1, sb ? RES_K(221) : RES_K(47)); /* 20 */ SN76477_set_slf_cap(1, CAP_U(1)); /* 21 */ SN76477_set_oneshot_cap(1, CAP_U(1)); /* 23 */ SN76477_set_oneshot_res(1, RES_K(330)); /* 24 */ SN76477_enable_w(1, 0); break; case 0x0b: // horse / pony SN76477_enable_w(1, 1); SN76477_mixer_w(1, 3); SN76477_envelope_w(1, 1); SN76477_vco_w(1, 0); SN76477_set_noise_res(1, RES_K(100)); /* 4 */ SN76477_set_filter_res(1, RES_K(470)); /* 5 */ SN76477_set_decay_res(1, RES_K(4.7)); /* 7 */ SN76477_set_attack_decay_cap(1, CAP_U(0.1)); /* 8 */ SN76477_set_vco_cap(1, CAP_U(1.1)); /* 17 */ SN76477_set_vco_res(1, RES_K(56)); /* 18 */ SN76477_set_slf_res(1, RES_M(2.2)); /* 20 */ SN76477_set_slf_cap(1, CAP_U(1)); /* 21 */ SN76477_set_oneshot_cap(1, CAP_U(1)); /* 23 */ SN76477_set_oneshot_res(1, RES_K(330)); /* 24 */ SN76477_enable_w(1, 0); break; case 0x0c: // howl or whoop SN76477_enable_w(1, 1); SN76477_mixer_w(1, 0); SN76477_envelope_w(1, 1); SN76477_vco_w(1, 1); SN76477_set_noise_res(1, RES_K(100)); /* 4 */ SN76477_set_filter_res(1, RES_K(470)); /* 5 */ SN76477_set_decay_res(1, RES_K(47)); /* 7 */ SN76477_set_attack_decay_cap(1, CAP_U(10.1)); /* 8 */ SN76477_set_vco_cap(1, CAP_U(0.1)); /* 17 */ SN76477_set_vco_res(1, RES_K(40)); /* 18 */ SN76477_set_slf_res(1, RES_M(2.2)); /* 20 */ SN76477_set_slf_cap(1, howl_or_whoop ? CAP_U(1.1) : CAP_U(23)); /* 21 */ SN76477_set_oneshot_cap(1, howl_or_whoop ? CAP_U(11) : CAP_U(23)); /* 23 */ SN76477_set_oneshot_res(1, RES_K(330)); /* 24 */ SN76477_enable_w(1, 0); if (sb) howl_or_whoop = !howl_or_whoop; // alternate sound on SSU-3 break; case 0x0d: // ricochet SN76477_enable_w(1, 1); SN76477_mixer_w(1, 0); SN76477_envelope_w(1, 1); SN76477_vco_w(1, 1); SN76477_set_noise_res(1, RES_K(100)); /* 4 */ SN76477_set_filter_res(1, RES_K(470)); /* 5 */ SN76477_set_decay_res(1, RES_M(2.2)); /* 7 */ SN76477_set_attack_decay_cap(1, CAP_U(0.2)); /* 8 */ SN76477_set_vco_cap(1, CAP_U(0.1)); /* 17 */ SN76477_set_vco_res(1, RES_K(28)); /* 18 */ SN76477_set_slf_res(1, RES_M(1.1)); /* 20 */ SN76477_set_slf_cap(1, CAP_U(1)); /* 21 */ SN76477_set_oneshot_cap(1, CAP_U(2)); /* 23 */ SN76477_set_oneshot_res(1, RES_K(110)); /* 24 */ SN76477_enable_w(1, 0); break; case 0x0e: // explosion SN76477_enable_w(0, 1); SN76477_enable_w(0, 0); break; } if (voltage[data]) { SN76477_set_vco_voltage(2, voltage[data]); SN76477_enable_w(2, 0); } else { SN76477_set_vco_voltage(2, 0.8); SN76477_enable_w(2, 1); } }