35
35
WRITE8_HANDLER( astrof_audio_1_w )
37
astrof_state *state = space->machine->driver_data<astrof_state>();
38
UINT8 rising_bits = data & ~state->port_1_last;
40
if (state->astrof_death_playing)
41
state->astrof_death_playing = sample_playing(state->samples, CHANNEL_EXPLOSION);
43
if (state->astrof_bosskill_playing)
44
state->astrof_bosskill_playing = sample_playing(state->samples, CHANNEL_EXPLOSION);
37
astrof_state *state = space->machine().driver_data<astrof_state>();
38
UINT8 rising_bits = data & ~state->m_port_1_last;
40
if (state->m_astrof_death_playing)
41
state->m_astrof_death_playing = sample_playing(state->m_samples, CHANNEL_EXPLOSION);
43
if (state->m_astrof_bosskill_playing)
44
state->m_astrof_bosskill_playing = sample_playing(state->m_samples, CHANNEL_EXPLOSION);
46
46
/* D2 - explosion */
47
47
if (rising_bits & 0x04)
49
49
/* I *know* that the effect select port will be written shortly
50
50
after this one, so this works */
51
state->astrof_start_explosion = 1;
51
state->m_astrof_start_explosion = 1;
54
54
/* D0,D1,D3 - background noise */
55
if ((data & 0x08) && (~state->port_1_last & 0x08))
55
if ((data & 0x08) && (~state->m_port_1_last & 0x08))
57
57
int sample = SAMPLE_WAVE + (data & 3);
58
sample_start(state->samples, CHANNEL_WAVE, sample, 1);
58
sample_start(state->m_samples, CHANNEL_WAVE, sample, 1);
61
if ((~data & 0x08) && (state->port_1_last & 0x08))
62
sample_stop(state->samples, CHANNEL_WAVE);
61
if ((~data & 0x08) && (state->m_port_1_last & 0x08))
62
sample_stop(state->m_samples, CHANNEL_WAVE);
64
64
/* D4 - boss laser */
65
if ((rising_bits & 0x10) && !state->astrof_bosskill_playing)
66
sample_start(state->samples, CHANNEL_BOSSFIRE, SAMPLE_BOSSFIRE, 0);
65
if ((rising_bits & 0x10) && !state->m_astrof_bosskill_playing)
66
sample_start(state->m_samples, CHANNEL_BOSSFIRE, SAMPLE_BOSSFIRE, 0);
69
if ((rising_bits & 0x20) && !state->astrof_bosskill_playing)
70
sample_start(state->samples, CHANNEL_FIRE, SAMPLE_FIRE, 0);
69
if ((rising_bits & 0x20) && !state->m_astrof_bosskill_playing)
70
sample_start(state->m_samples, CHANNEL_FIRE, SAMPLE_FIRE, 0);
72
72
/* D6 - don't know. Probably something to do with the explosion sounds */
74
74
/* D7 - sound enable bit */
75
sound_global_enable(space->machine, data & 0x80);
75
space->machine().sound().system_enable(data & 0x80);
77
state->port_1_last = data;
77
state->m_port_1_last = data;
81
81
WRITE8_HANDLER( astrof_audio_2_w )
83
astrof_state *state = space->machine->driver_data<astrof_state>();
84
UINT8 rising_bits = data & ~state->port_2_last;
83
astrof_state *state = space->machine().driver_data<astrof_state>();
84
UINT8 rising_bits = data & ~state->m_port_2_last;
86
86
/* D0-D2 - explosion select (triggered by D2 of the other port */
87
if (state->astrof_start_explosion)
87
if (state->m_astrof_start_explosion)
89
89
/* this is really a compound effect, made up of I believe 3 sound
90
90
effects, but since our sample contains them all, disable playing
93
93
logerror("Explosion: %x\n", data);
96
if (!state->astrof_bosskill_playing)
96
if (!state->m_astrof_bosskill_playing)
98
sample_start(state->samples, CHANNEL_EXPLOSION, SAMPLE_BOSSKILL, 0);
99
state->astrof_bosskill_playing = 1;
98
sample_start(state->m_samples, CHANNEL_EXPLOSION, SAMPLE_BOSSKILL, 0);
99
state->m_astrof_bosskill_playing = 1;
102
102
else if (data & 0x02)
103
sample_start(state->samples, CHANNEL_EXPLOSION, SAMPLE_BOSSHIT, 0);
103
sample_start(state->m_samples, CHANNEL_EXPLOSION, SAMPLE_BOSSHIT, 0);
104
104
else if (data & 0x01)
105
sample_start(state->samples, CHANNEL_EXPLOSION, SAMPLE_EKILLED, 0);
105
sample_start(state->m_samples, CHANNEL_EXPLOSION, SAMPLE_EKILLED, 0);
108
if (!state->astrof_death_playing)
108
if (!state->m_astrof_death_playing)
110
sample_start(state->samples, CHANNEL_EXPLOSION, SAMPLE_DEATH, 0);
111
state->astrof_death_playing = 1;
110
sample_start(state->m_samples, CHANNEL_EXPLOSION, SAMPLE_DEATH, 0);
111
state->m_astrof_death_playing = 1;
115
state->astrof_start_explosion = 0;
115
state->m_astrof_start_explosion = 0;
118
118
/* D3 - low fuel warning */
119
119
if (rising_bits & 0x08)
120
sample_start(state->samples, CHANNEL_FUEL, SAMPLE_FUEL, 0);
120
sample_start(state->m_samples, CHANNEL_FUEL, SAMPLE_FUEL, 0);
122
state->port_2_last = data;
122
state->m_port_2_last = data;