mirror of
https://github.com/holub/mame
synced 2025-05-28 16:43:04 +03:00
Added driver_data struct and save states to n8080.c
This commit is contained in:
parent
09cb5b9ffc
commit
b5af35345a
@ -10,25 +10,9 @@
|
|||||||
#include "sound/dac.h"
|
#include "sound/dac.h"
|
||||||
#include "includes/n8080.h"
|
#include "includes/n8080.h"
|
||||||
|
|
||||||
static int n8080_hardware;
|
|
||||||
|
|
||||||
static emu_timer* sound_timer[3];
|
|
||||||
|
|
||||||
static int helifire_dac_phase;
|
|
||||||
|
|
||||||
static const double ATTACK_RATE = 10e-6 * 500;
|
static const double ATTACK_RATE = 10e-6 * 500;
|
||||||
static const double DECAY_RATE = 10e-6 * 16000;
|
static const double DECAY_RATE = 10e-6 * 16000;
|
||||||
|
|
||||||
static double helifire_dac_volume;
|
|
||||||
static double helifire_dac_timing;
|
|
||||||
|
|
||||||
static UINT16 prev_sound_pins;
|
|
||||||
static UINT16 curr_sound_pins;
|
|
||||||
|
|
||||||
static int mono_flop[3];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const sn76477_interface sheriff_sn76477_interface =
|
static const sn76477_interface sheriff_sn76477_interface =
|
||||||
{
|
{
|
||||||
RES_K(36) , /* 04 */
|
RES_K(36) , /* 04 */
|
||||||
@ -87,14 +71,15 @@ static const sn76477_interface spacefev_sn76477_interface =
|
|||||||
|
|
||||||
static void spacefev_update_SN76477_status( const device_config *sn )
|
static void spacefev_update_SN76477_status( const device_config *sn )
|
||||||
{
|
{
|
||||||
|
n8080_state *state = (n8080_state *)sn->machine->driver_data;
|
||||||
double dblR0 = RES_M(1.0);
|
double dblR0 = RES_M(1.0);
|
||||||
double dblR1 = RES_M(1.5);
|
double dblR1 = RES_M(1.5);
|
||||||
|
|
||||||
if (!mono_flop[0])
|
if (!state->mono_flop[0])
|
||||||
{
|
{
|
||||||
dblR0 = 1 / (1 / RES_K(150) + 1 / dblR0); /* ? */
|
dblR0 = 1 / (1 / RES_K(150) + 1 / dblR0); /* ? */
|
||||||
}
|
}
|
||||||
if (!mono_flop[1])
|
if (!state->mono_flop[1])
|
||||||
{
|
{
|
||||||
dblR1 = 1 / (1 / RES_K(620) + 1 / dblR1); /* ? */
|
dblR1 = 1 / (1 / RES_K(620) + 1 / dblR1); /* ? */
|
||||||
}
|
}
|
||||||
@ -104,19 +89,20 @@ static void spacefev_update_SN76477_status(const device_config *sn)
|
|||||||
sn76477_vco_res_w(sn, dblR1);
|
sn76477_vco_res_w(sn, dblR1);
|
||||||
|
|
||||||
sn76477_enable_w(sn,
|
sn76477_enable_w(sn,
|
||||||
!mono_flop[0] &&
|
!state->mono_flop[0] &&
|
||||||
!mono_flop[1] &&
|
!state->mono_flop[1] &&
|
||||||
!mono_flop[2]);
|
!state->mono_flop[2]);
|
||||||
|
|
||||||
sn76477_vco_w(sn, mono_flop[1]);
|
sn76477_vco_w(sn, state->mono_flop[1]);
|
||||||
|
|
||||||
sn76477_mixer_b_w(sn, mono_flop[0]);
|
sn76477_mixer_b_w(sn, state->mono_flop[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void sheriff_update_SN76477_status( const device_config *sn )
|
static void sheriff_update_SN76477_status( const device_config *sn )
|
||||||
{
|
{
|
||||||
if (mono_flop[1])
|
n8080_state *state = (n8080_state *)sn->machine->driver_data;
|
||||||
|
if (state->mono_flop[1])
|
||||||
{
|
{
|
||||||
sn76477_vco_voltage_w(sn, 5);
|
sn76477_vco_voltage_w(sn, 5);
|
||||||
}
|
}
|
||||||
@ -126,22 +112,23 @@ static void sheriff_update_SN76477_status(const device_config *sn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sn76477_enable_w(sn,
|
sn76477_enable_w(sn,
|
||||||
!mono_flop[0] &&
|
!state->mono_flop[0] &&
|
||||||
!mono_flop[1]);
|
!state->mono_flop[1]);
|
||||||
|
|
||||||
sn76477_vco_w(sn, mono_flop[0]);
|
sn76477_vco_w(sn, state->mono_flop[0]);
|
||||||
|
|
||||||
sn76477_mixer_b_w(sn, !mono_flop[0]);
|
sn76477_mixer_b_w(sn, !state->mono_flop[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void update_SN76477_status( const device_config *device )
|
static void update_SN76477_status( const device_config *device )
|
||||||
{
|
{
|
||||||
if (n8080_hardware == 1)
|
n8080_state *state = (n8080_state *)device->machine->driver_data;
|
||||||
|
if (state->n8080_hardware == 1)
|
||||||
{
|
{
|
||||||
spacefev_update_SN76477_status(device);
|
spacefev_update_SN76477_status(device);
|
||||||
}
|
}
|
||||||
if (n8080_hardware == 2)
|
if (state->n8080_hardware == 2)
|
||||||
{
|
{
|
||||||
sheriff_update_SN76477_status(device);
|
sheriff_update_SN76477_status(device);
|
||||||
}
|
}
|
||||||
@ -150,21 +137,23 @@ static void update_SN76477_status(const device_config *device)
|
|||||||
|
|
||||||
static void start_mono_flop( const device_config *sn, int n, attotime expire )
|
static void start_mono_flop( const device_config *sn, int n, attotime expire )
|
||||||
{
|
{
|
||||||
mono_flop[n] = 1;
|
n8080_state *state = (n8080_state *)sn->machine->driver_data;
|
||||||
|
state->mono_flop[n] = 1;
|
||||||
|
|
||||||
update_SN76477_status(sn);
|
update_SN76477_status(sn);
|
||||||
|
|
||||||
timer_adjust_oneshot(sound_timer[n], expire, n);
|
timer_adjust_oneshot(state->sound_timer[n], expire, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void stop_mono_flop( const device_config *sn, int n )
|
static void stop_mono_flop( const device_config *sn, int n )
|
||||||
{
|
{
|
||||||
mono_flop[n] = 0;
|
n8080_state *state = (n8080_state *)sn->machine->driver_data;
|
||||||
|
state->mono_flop[n] = 0;
|
||||||
|
|
||||||
update_SN76477_status(sn);
|
update_SN76477_status(sn);
|
||||||
|
|
||||||
timer_adjust_oneshot(sound_timer[n], attotime_never, n);
|
timer_adjust_oneshot(state->sound_timer[n], attotime_never, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +166,8 @@ static TIMER_CALLBACK( stop_mono_flop_callback )
|
|||||||
static void spacefev_sound_pins_changed( running_machine *machine )
|
static void spacefev_sound_pins_changed( running_machine *machine )
|
||||||
{
|
{
|
||||||
const device_config *sn = devtag_get_device(machine, "snsnd");
|
const device_config *sn = devtag_get_device(machine, "snsnd");
|
||||||
UINT16 changes = ~curr_sound_pins & prev_sound_pins;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
UINT16 changes = ~state->curr_sound_pins & state->prev_sound_pins;
|
||||||
|
|
||||||
if (changes & (1 << 0x3))
|
if (changes & (1 << 0x3))
|
||||||
{
|
{
|
||||||
@ -209,7 +199,8 @@ static void spacefev_sound_pins_changed(running_machine *machine)
|
|||||||
static void sheriff_sound_pins_changed( running_machine *machine )
|
static void sheriff_sound_pins_changed( running_machine *machine )
|
||||||
{
|
{
|
||||||
const device_config *sn = devtag_get_device(machine, "snsnd");
|
const device_config *sn = devtag_get_device(machine, "snsnd");
|
||||||
UINT16 changes = ~curr_sound_pins & prev_sound_pins;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
UINT16 changes = ~state->curr_sound_pins & state->prev_sound_pins;
|
||||||
|
|
||||||
if (changes & (1 << 0x6))
|
if (changes & (1 << 0x6))
|
||||||
{
|
{
|
||||||
@ -232,11 +223,12 @@ static void sheriff_sound_pins_changed(running_machine *machine)
|
|||||||
|
|
||||||
static void helifire_sound_pins_changed( running_machine *machine )
|
static void helifire_sound_pins_changed( running_machine *machine )
|
||||||
{
|
{
|
||||||
UINT16 changes = ~curr_sound_pins & prev_sound_pins;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
UINT16 changes = ~state->curr_sound_pins & state->prev_sound_pins;
|
||||||
|
|
||||||
/* ((curr_sound_pins >> 0xA) & 1) not emulated */
|
/* ((state->curr_sound_pins >> 0xa) & 1) not emulated */
|
||||||
/* ((curr_sound_pins >> 0xB) & 1) not emulated */
|
/* ((state->curr_sound_pins >> 0xb) & 1) not emulated */
|
||||||
/* ((curr_sound_pins >> 0xC) & 1) not emulated */
|
/* ((state->curr_sound_pins >> 0xc) & 1) not emulated */
|
||||||
|
|
||||||
if (changes & (1 << 6))
|
if (changes & (1 << 6))
|
||||||
{
|
{
|
||||||
@ -247,28 +239,24 @@ static void helifire_sound_pins_changed(running_machine *machine)
|
|||||||
|
|
||||||
static void sound_pins_changed( running_machine *machine )
|
static void sound_pins_changed( running_machine *machine )
|
||||||
{
|
{
|
||||||
if (n8080_hardware == 1)
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
{
|
|
||||||
spacefev_sound_pins_changed(machine);
|
|
||||||
}
|
|
||||||
if (n8080_hardware == 2)
|
|
||||||
{
|
|
||||||
sheriff_sound_pins_changed(machine);
|
|
||||||
}
|
|
||||||
if (n8080_hardware == 3)
|
|
||||||
{
|
|
||||||
helifire_sound_pins_changed(machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
prev_sound_pins = curr_sound_pins;
|
if (state->n8080_hardware == 1)
|
||||||
|
spacefev_sound_pins_changed(machine);
|
||||||
|
if (state->n8080_hardware == 2)
|
||||||
|
sheriff_sound_pins_changed(machine);
|
||||||
|
if (state->n8080_hardware == 3)
|
||||||
|
helifire_sound_pins_changed(machine);
|
||||||
|
|
||||||
|
state->prev_sound_pins = state->curr_sound_pins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void delayed_sound_1( running_machine *machine, int data )
|
static void delayed_sound_1( running_machine *machine, int data )
|
||||||
{
|
{
|
||||||
static UINT8 prev_data = 0;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
curr_sound_pins &= ~(
|
state->curr_sound_pins &= ~(
|
||||||
(1 << 0x7) |
|
(1 << 0x7) |
|
||||||
(1 << 0x5) |
|
(1 << 0x5) |
|
||||||
(1 << 0x6) |
|
(1 << 0x6) |
|
||||||
@ -276,26 +264,26 @@ static void delayed_sound_1(running_machine *machine, int data)
|
|||||||
(1 << 0x4) |
|
(1 << 0x4) |
|
||||||
(1 << 0x1));
|
(1 << 0x1));
|
||||||
|
|
||||||
if (~data & 0x01) curr_sound_pins |= 1 << 0x7;
|
if (~data & 0x01) state->curr_sound_pins |= 1 << 0x7;
|
||||||
if (~data & 0x02) curr_sound_pins |= 1 << 0x5; /* pulse */
|
if (~data & 0x02) state->curr_sound_pins |= 1 << 0x5; /* pulse */
|
||||||
if (~data & 0x04) curr_sound_pins |= 1 << 0x6; /* pulse */
|
if (~data & 0x04) state->curr_sound_pins |= 1 << 0x6; /* pulse */
|
||||||
if (~data & 0x08) curr_sound_pins |= 1 << 0x3; /* pulse (except in Helifire) */
|
if (~data & 0x08) state->curr_sound_pins |= 1 << 0x3; /* pulse (except in Helifire) */
|
||||||
if (~data & 0x10) curr_sound_pins |= 1 << 0x4; /* pulse (except in Helifire) */
|
if (~data & 0x10) state->curr_sound_pins |= 1 << 0x4; /* pulse (except in Helifire) */
|
||||||
if (~data & 0x20) curr_sound_pins |= 1 << 0x1;
|
if (~data & 0x20) state->curr_sound_pins |= 1 << 0x1;
|
||||||
|
|
||||||
if (n8080_hardware == 1)
|
if (state->n8080_hardware == 1)
|
||||||
{
|
{
|
||||||
if (data & ~prev_data & 0x10)
|
if (data & ~state->prev_snd_data & 0x10)
|
||||||
{
|
{
|
||||||
spacefev_start_red_cannon(machine);
|
spacefev_start_red_cannon(machine);
|
||||||
}
|
}
|
||||||
|
|
||||||
spacefev_red_screen = data & 0x08;
|
state->spacefev_red_screen = data & 0x08;
|
||||||
}
|
}
|
||||||
|
|
||||||
sound_pins_changed(machine);
|
sound_pins_changed(machine);
|
||||||
|
|
||||||
prev_data = data;
|
state->prev_snd_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -307,29 +295,27 @@ static TIMER_CALLBACK( delayed_sound_1_callback )
|
|||||||
|
|
||||||
static void delayed_sound_2( running_machine *machine, int data )
|
static void delayed_sound_2( running_machine *machine, int data )
|
||||||
{
|
{
|
||||||
curr_sound_pins &= ~(
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
|
state->curr_sound_pins &= ~(
|
||||||
(1 << 0x8) |
|
(1 << 0x8) |
|
||||||
(1 << 0x9) |
|
(1 << 0x9) |
|
||||||
(1 << 0xA) |
|
(1 << 0xa) |
|
||||||
(1 << 0xB) |
|
(1 << 0xb) |
|
||||||
(1 << 0x2) |
|
(1 << 0x2) |
|
||||||
(1 << 0xC));
|
(1 << 0xc));
|
||||||
|
|
||||||
if (~data & 0x01) curr_sound_pins |= 1 << 0x8;
|
if (~data & 0x01) state->curr_sound_pins |= 1 << 0x8;
|
||||||
if (~data & 0x02) curr_sound_pins |= 1 << 0x9;
|
if (~data & 0x02) state->curr_sound_pins |= 1 << 0x9;
|
||||||
if (~data & 0x04) curr_sound_pins |= 1 << 0xA;
|
if (~data & 0x04) state->curr_sound_pins |= 1 << 0xa;
|
||||||
if (~data & 0x08) curr_sound_pins |= 1 << 0xB;
|
if (~data & 0x08) state->curr_sound_pins |= 1 << 0xb;
|
||||||
if (~data & 0x10) curr_sound_pins |= 1 << 0x2; /* pulse */
|
if (~data & 0x10) state->curr_sound_pins |= 1 << 0x2; /* pulse */
|
||||||
if (~data & 0x20) curr_sound_pins |= 1 << 0xC;
|
if (~data & 0x20) state->curr_sound_pins |= 1 << 0xc;
|
||||||
|
|
||||||
if (n8080_hardware == 1)
|
if (state->n8080_hardware == 1)
|
||||||
{
|
|
||||||
flip_screen_set_no_update(machine, data & 0x20);
|
flip_screen_set_no_update(machine, data & 0x20);
|
||||||
}
|
if (state->n8080_hardware == 3)
|
||||||
if (n8080_hardware == 3)
|
state->helifire_flash = data & 0x20;
|
||||||
{
|
|
||||||
helifire_flash = data & 0x20;
|
|
||||||
}
|
|
||||||
|
|
||||||
sound_pins_changed(machine);
|
sound_pins_changed(machine);
|
||||||
}
|
}
|
||||||
@ -354,16 +340,17 @@ WRITE8_HANDLER( n8080_sound_2_w )
|
|||||||
|
|
||||||
static READ8_HANDLER( n8080_8035_p1_r )
|
static READ8_HANDLER( n8080_8035_p1_r )
|
||||||
{
|
{
|
||||||
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
UINT8 val = 0;
|
UINT8 val = 0;
|
||||||
|
|
||||||
if ((curr_sound_pins >> 0xB) & 1) val |= 0x01;
|
if ((state->curr_sound_pins >> 0xb) & 1) val |= 0x01;
|
||||||
if ((curr_sound_pins >> 0xA) & 1) val |= 0x02;
|
if ((state->curr_sound_pins >> 0xa) & 1) val |= 0x02;
|
||||||
if ((curr_sound_pins >> 0x9) & 1) val |= 0x04;
|
if ((state->curr_sound_pins >> 0x9) & 1) val |= 0x04;
|
||||||
if ((curr_sound_pins >> 0x8) & 1) val |= 0x08;
|
if ((state->curr_sound_pins >> 0x8) & 1) val |= 0x08;
|
||||||
if ((curr_sound_pins >> 0x5) & 1) val |= 0x10;
|
if ((state->curr_sound_pins >> 0x5) & 1) val |= 0x10;
|
||||||
if ((curr_sound_pins >> 0x3) & 1) val |= 0x20;
|
if ((state->curr_sound_pins >> 0x3) & 1) val |= 0x20;
|
||||||
if ((curr_sound_pins >> 0x2) & 1) val |= 0x40;
|
if ((state->curr_sound_pins >> 0x2) & 1) val |= 0x40;
|
||||||
if ((curr_sound_pins >> 0x1) & 1) val |= 0x80;
|
if ((state->curr_sound_pins >> 0x1) & 1) val |= 0x80;
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -371,32 +358,37 @@ static READ8_HANDLER( n8080_8035_p1_r )
|
|||||||
|
|
||||||
static READ8_HANDLER( n8080_8035_t0_r )
|
static READ8_HANDLER( n8080_8035_t0_r )
|
||||||
{
|
{
|
||||||
return (curr_sound_pins >> 0x7) & 1;
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
|
return (state->curr_sound_pins >> 0x7) & 1;
|
||||||
}
|
}
|
||||||
static READ8_HANDLER( n8080_8035_t1_r )
|
static READ8_HANDLER( n8080_8035_t1_r )
|
||||||
{
|
{
|
||||||
return (curr_sound_pins >> 0xC) & 1;
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
|
return (state->curr_sound_pins >> 0xc) & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static READ8_HANDLER( helifire_8035_t0_r )
|
static READ8_HANDLER( helifire_8035_t0_r )
|
||||||
{
|
{
|
||||||
return (curr_sound_pins >> 0x3) & 1;
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
|
return (state->curr_sound_pins >> 0x3) & 1;
|
||||||
}
|
}
|
||||||
static READ8_HANDLER( helifire_8035_t1_r )
|
static READ8_HANDLER( helifire_8035_t1_r )
|
||||||
{
|
{
|
||||||
return (curr_sound_pins >> 0x4) & 1;
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
|
return (state->curr_sound_pins >> 0x4) & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static READ8_HANDLER( helifire_8035_external_ram_r )
|
static READ8_HANDLER( helifire_8035_external_ram_r )
|
||||||
{
|
{
|
||||||
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
UINT8 val = 0;
|
UINT8 val = 0;
|
||||||
|
|
||||||
if ((curr_sound_pins >> 0x7) & 1) val |= 0x01;
|
if ((state->curr_sound_pins >> 0x7) & 1) val |= 0x01;
|
||||||
if ((curr_sound_pins >> 0x8) & 1) val |= 0x02;
|
if ((state->curr_sound_pins >> 0x8) & 1) val |= 0x02;
|
||||||
if ((curr_sound_pins >> 0x9) & 1) val |= 0x04;
|
if ((state->curr_sound_pins >> 0x9) & 1) val |= 0x04;
|
||||||
if ((curr_sound_pins >> 0x1) & 1) val |= 0x08;
|
if ((state->curr_sound_pins >> 0x1) & 1) val |= 0x08;
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -404,7 +396,8 @@ static READ8_HANDLER( helifire_8035_external_ram_r )
|
|||||||
|
|
||||||
static READ8_HANDLER( helifire_8035_p2_r )
|
static READ8_HANDLER( helifire_8035_p2_r )
|
||||||
{
|
{
|
||||||
return ((curr_sound_pins >> 0xC) & 1) ? 0x10 : 0x00; /* not used */
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
|
return ((state->curr_sound_pins >> 0xc) & 1) ? 0x10 : 0x00; /* not used */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -416,38 +409,41 @@ static WRITE8_HANDLER( n8080_dac_w )
|
|||||||
|
|
||||||
static WRITE8_HANDLER( helifire_dac_w )
|
static WRITE8_HANDLER( helifire_dac_w )
|
||||||
{
|
{
|
||||||
dac_data_w(devtag_get_device(space->machine, "dac"), data * helifire_dac_volume);
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
|
dac_data_w(devtag_get_device(space->machine, "dac"), data * state->helifire_dac_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static WRITE8_HANDLER( helifire_sound_ctrl_w )
|
static WRITE8_HANDLER( helifire_sound_ctrl_w )
|
||||||
{
|
{
|
||||||
helifire_dac_phase = data & 0x80;
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
|
state->helifire_dac_phase = data & 0x80;
|
||||||
|
|
||||||
/* data & 0x40 not emulated */
|
/* data & 0x40 not emulated */
|
||||||
/* data & 0x20 not emulated */
|
/* data & 0x20 not emulated */
|
||||||
|
|
||||||
if (helifire_dac_phase)
|
if (state->helifire_dac_phase)
|
||||||
{
|
{
|
||||||
helifire_dac_timing = ATTACK_RATE * log(1 - helifire_dac_volume);
|
state->helifire_dac_timing = ATTACK_RATE * log(1 - state->helifire_dac_volume);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
helifire_dac_timing = DECAY_RATE * log(helifire_dac_volume);
|
state->helifire_dac_timing = DECAY_RATE * log(state->helifire_dac_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
helifire_dac_timing += attotime_to_double(timer_get_time(space->machine));
|
state->helifire_dac_timing += attotime_to_double(timer_get_time(space->machine));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TIMER_CALLBACK( spacefev_vco_voltage_timer )
|
static TIMER_CALLBACK( spacefev_vco_voltage_timer )
|
||||||
{
|
{
|
||||||
const device_config *sn = devtag_get_device(machine, "snsnd");
|
const device_config *sn = devtag_get_device(machine, "snsnd");
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
double voltage = 0;
|
double voltage = 0;
|
||||||
|
|
||||||
if (mono_flop[2])
|
if (state->mono_flop[2])
|
||||||
{
|
{
|
||||||
voltage = 5 * (1 - exp(- attotime_to_double(timer_timeelapsed(sound_timer[2])) / 0.22));
|
voltage = 5 * (1 - exp(- attotime_to_double(timer_timeelapsed(state->sound_timer[2])) / 0.22));
|
||||||
}
|
}
|
||||||
|
|
||||||
sn76477_vco_voltage_w(sn, voltage);
|
sn76477_vco_voltage_w(sn, voltage);
|
||||||
@ -456,66 +452,113 @@ static TIMER_CALLBACK( spacefev_vco_voltage_timer )
|
|||||||
|
|
||||||
static TIMER_CALLBACK( helifire_dac_volume_timer )
|
static TIMER_CALLBACK( helifire_dac_volume_timer )
|
||||||
{
|
{
|
||||||
double t = helifire_dac_timing - attotime_to_double(timer_get_time(machine));
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
double t = state->helifire_dac_timing - attotime_to_double(timer_get_time(machine));
|
||||||
|
|
||||||
if (helifire_dac_phase)
|
if (state->helifire_dac_phase)
|
||||||
{
|
{
|
||||||
helifire_dac_volume = 1 - exp(t / ATTACK_RATE);
|
state->helifire_dac_volume = 1 - exp(t / ATTACK_RATE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
helifire_dac_volume = exp(t / DECAY_RATE);
|
state->helifire_dac_volume = exp(t / DECAY_RATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_RESET( spacefev_sound )
|
MACHINE_START( spacefev_sound )
|
||||||
{
|
{
|
||||||
n8080_hardware = 1;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
|
state->sound_timer[0] = timer_alloc(machine, stop_mono_flop_callback, NULL);
|
||||||
|
state->sound_timer[1] = timer_alloc(machine, stop_mono_flop_callback, NULL);
|
||||||
|
state->sound_timer[2] = timer_alloc(machine, stop_mono_flop_callback, NULL);
|
||||||
|
|
||||||
|
state_save_register_global(machine, state->prev_snd_data);
|
||||||
|
state_save_register_global(machine, state->prev_sound_pins);
|
||||||
|
state_save_register_global(machine, state->curr_sound_pins);
|
||||||
|
state_save_register_global(machine, state->n8080_hardware);
|
||||||
|
state_save_register_global_array(machine, state->mono_flop);
|
||||||
|
}
|
||||||
|
|
||||||
|
MACHINE_RESET( spacefev_sound )
|
||||||
|
{
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
state->n8080_hardware = 1;
|
||||||
|
|
||||||
timer_pulse(machine, ATTOTIME_IN_HZ(1000), NULL, 0, spacefev_vco_voltage_timer);
|
timer_pulse(machine, ATTOTIME_IN_HZ(1000), NULL, 0, spacefev_vco_voltage_timer);
|
||||||
|
|
||||||
sound_timer[0] = timer_alloc(machine, stop_mono_flop_callback, NULL);
|
state->mono_flop[0] = 0;
|
||||||
sound_timer[1] = timer_alloc(machine, stop_mono_flop_callback, NULL);
|
state->mono_flop[1] = 0;
|
||||||
sound_timer[2] = timer_alloc(machine, stop_mono_flop_callback, NULL);
|
state->mono_flop[2] = 0;
|
||||||
|
state->prev_snd_data = 0;
|
||||||
mono_flop[0] = 0;
|
state->prev_sound_pins = 0;
|
||||||
mono_flop[1] = 0;
|
state->curr_sound_pins = 0;
|
||||||
mono_flop[2] = 0;
|
|
||||||
|
|
||||||
delayed_sound_1(machine, 0);
|
delayed_sound_1(machine, 0);
|
||||||
delayed_sound_2(machine, 0);
|
delayed_sound_2(machine, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_RESET( sheriff_sound )
|
MACHINE_START( sheriff_sound )
|
||||||
{
|
{
|
||||||
n8080_hardware = 2;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
sound_timer[0] = timer_alloc(machine, stop_mono_flop_callback, NULL);
|
state->sound_timer[0] = timer_alloc(machine, stop_mono_flop_callback, NULL);
|
||||||
sound_timer[1] = timer_alloc(machine, stop_mono_flop_callback, NULL);
|
state->sound_timer[1] = timer_alloc(machine, stop_mono_flop_callback, NULL);
|
||||||
|
|
||||||
mono_flop[0] = 0;
|
state_save_register_global(machine, state->prev_snd_data);
|
||||||
mono_flop[1] = 0;
|
state_save_register_global(machine, state->prev_sound_pins);
|
||||||
|
state_save_register_global(machine, state->curr_sound_pins);
|
||||||
|
state_save_register_global(machine, state->n8080_hardware);
|
||||||
|
state_save_register_global_array(machine, state->mono_flop);
|
||||||
|
}
|
||||||
|
|
||||||
|
MACHINE_RESET( sheriff_sound )
|
||||||
|
{
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
state->n8080_hardware = 2;
|
||||||
|
|
||||||
|
state->mono_flop[0] = 0;
|
||||||
|
state->mono_flop[1] = 0;
|
||||||
|
state->prev_snd_data = 0;
|
||||||
|
state->prev_sound_pins = 0;
|
||||||
|
state->curr_sound_pins = 0;
|
||||||
|
|
||||||
delayed_sound_1(machine, 0);
|
delayed_sound_1(machine, 0);
|
||||||
delayed_sound_2(machine, 0);
|
delayed_sound_2(machine, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_RESET( helifire_sound )
|
MACHINE_START( helifire_sound )
|
||||||
{
|
{
|
||||||
n8080_hardware = 3;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
|
state_save_register_global(machine, state->prev_snd_data);
|
||||||
|
state_save_register_global(machine, state->prev_sound_pins);
|
||||||
|
state_save_register_global(machine, state->curr_sound_pins);
|
||||||
|
state_save_register_global(machine, state->n8080_hardware);
|
||||||
|
state_save_register_global(machine, state->helifire_dac_volume);
|
||||||
|
state_save_register_global(machine, state->helifire_dac_timing);
|
||||||
|
state_save_register_global(machine, state->helifire_dac_phase);
|
||||||
|
}
|
||||||
|
|
||||||
|
MACHINE_RESET( helifire_sound )
|
||||||
|
{
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
state->n8080_hardware = 3;
|
||||||
|
|
||||||
timer_pulse(machine, ATTOTIME_IN_HZ(1000), NULL, 0, helifire_dac_volume_timer);
|
timer_pulse(machine, ATTOTIME_IN_HZ(1000), NULL, 0, helifire_dac_volume_timer);
|
||||||
|
|
||||||
helifire_dac_volume = 1;
|
state->helifire_dac_volume = 1;
|
||||||
helifire_dac_timing = 0;
|
state->helifire_dac_timing = 0;
|
||||||
|
state->helifire_dac_phase = 0;
|
||||||
|
state->prev_snd_data = 0;
|
||||||
|
state->prev_sound_pins = 0;
|
||||||
|
state->curr_sound_pins = 0;
|
||||||
|
|
||||||
delayed_sound_1(machine, 0);
|
delayed_sound_1(machine, 0);
|
||||||
delayed_sound_2(machine, 0);
|
delayed_sound_2(machine, 0);
|
||||||
|
|
||||||
helifire_dac_phase = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -553,8 +596,6 @@ MACHINE_DRIVER_START( spacefev_sound )
|
|||||||
MDRV_CPU_PROGRAM_MAP(n8080_sound_cpu_map)
|
MDRV_CPU_PROGRAM_MAP(n8080_sound_cpu_map)
|
||||||
MDRV_CPU_IO_MAP(n8080_sound_io_map)
|
MDRV_CPU_IO_MAP(n8080_sound_io_map)
|
||||||
|
|
||||||
MDRV_MACHINE_RESET(spacefev_sound)
|
|
||||||
|
|
||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||||
|
|
||||||
@ -574,8 +615,6 @@ MACHINE_DRIVER_START( sheriff_sound )
|
|||||||
MDRV_CPU_PROGRAM_MAP(n8080_sound_cpu_map)
|
MDRV_CPU_PROGRAM_MAP(n8080_sound_cpu_map)
|
||||||
MDRV_CPU_IO_MAP(n8080_sound_io_map)
|
MDRV_CPU_IO_MAP(n8080_sound_io_map)
|
||||||
|
|
||||||
MDRV_MACHINE_RESET(sheriff_sound)
|
|
||||||
|
|
||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||||
|
|
||||||
@ -595,8 +634,6 @@ MACHINE_DRIVER_START( helifire_sound )
|
|||||||
MDRV_CPU_PROGRAM_MAP(n8080_sound_cpu_map)
|
MDRV_CPU_PROGRAM_MAP(n8080_sound_cpu_map)
|
||||||
MDRV_CPU_IO_MAP(helifire_sound_io_map)
|
MDRV_CPU_IO_MAP(helifire_sound_io_map)
|
||||||
|
|
||||||
MDRV_MACHINE_RESET(helifire_sound)
|
|
||||||
|
|
||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||||
|
|
||||||
|
@ -16,36 +16,36 @@
|
|||||||
|
|
||||||
#define MASTER_CLOCK XTAL_20_16MHz
|
#define MASTER_CLOCK XTAL_20_16MHz
|
||||||
|
|
||||||
static unsigned shift_data;
|
|
||||||
static unsigned shift_bits;
|
|
||||||
static int inte;
|
|
||||||
|
|
||||||
static WRITE8_HANDLER( n8080_shift_bits_w )
|
static WRITE8_HANDLER( n8080_shift_bits_w )
|
||||||
{
|
{
|
||||||
shift_bits = data & 7;
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
|
state->shift_bits = data & 7;
|
||||||
}
|
}
|
||||||
static WRITE8_HANDLER( n8080_shift_data_w )
|
static WRITE8_HANDLER( n8080_shift_data_w )
|
||||||
{
|
{
|
||||||
shift_data = (shift_data >> 8) | (data << 8);
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
|
state->shift_data = (state->shift_data >> 8) | (data << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static READ8_HANDLER( n8080_shift_r )
|
static READ8_HANDLER( n8080_shift_r )
|
||||||
{
|
{
|
||||||
return shift_data >> (8 - shift_bits);
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
|
return state->shift_data >> (8 - state->shift_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ADDRESS_MAP_START( main_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
static ADDRESS_MAP_START( main_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||||
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
|
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
|
||||||
AM_RANGE(0x0000, 0x3fff) AM_ROM
|
AM_RANGE(0x0000, 0x3fff) AM_ROM
|
||||||
AM_RANGE(0x4000, 0x7fff) AM_RAM AM_BASE(&videoram)
|
AM_RANGE(0x4000, 0x7fff) AM_RAM AM_BASE_MEMBER(n8080_state, videoram)
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
|
|
||||||
static ADDRESS_MAP_START( helifire_main_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
static ADDRESS_MAP_START( helifire_main_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||||
AM_RANGE(0x0000, 0x3fff) AM_ROM
|
AM_RANGE(0x0000, 0x3fff) AM_ROM
|
||||||
AM_RANGE(0x4000, 0x7fff) AM_RAM AM_BASE(&videoram)
|
AM_RANGE(0x4000, 0x7fff) AM_RAM AM_BASE_MEMBER(n8080_state, videoram)
|
||||||
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE(&colorram)
|
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_MEMBER(n8080_state, colorram)
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
static ADDRESS_MAP_START( main_io_map, ADDRESS_SPACE_IO, 8 )
|
static ADDRESS_MAP_START( main_io_map, ADDRESS_SPACE_IO, 8 )
|
||||||
@ -63,130 +63,8 @@ static ADDRESS_MAP_START( main_io_map, ADDRESS_SPACE_IO, 8 )
|
|||||||
AM_RANGE(0x06, 0x06) AM_WRITE(n8080_video_control_w)
|
AM_RANGE(0x06, 0x06) AM_WRITE(n8080_video_control_w)
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
/* Interrupts */
|
|
||||||
|
|
||||||
static TIMER_DEVICE_CALLBACK( rst1_tick )
|
|
||||||
{
|
|
||||||
int state = inte ? ASSERT_LINE : CLEAR_LINE;
|
|
||||||
|
|
||||||
/* V7 = 1, V6 = 0 */
|
|
||||||
cputag_set_input_line_and_vector(timer->machine, "maincpu", INPUT_LINE_IRQ0, state, 0xcf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static TIMER_DEVICE_CALLBACK( rst2_tick )
|
|
||||||
{
|
|
||||||
int state = inte ? ASSERT_LINE : CLEAR_LINE;
|
|
||||||
|
|
||||||
/* vblank */
|
|
||||||
cputag_set_input_line_and_vector(timer->machine, "maincpu", INPUT_LINE_IRQ0, state, 0xd7);
|
|
||||||
}
|
|
||||||
|
|
||||||
static WRITE_LINE_DEVICE_HANDLER( n8080_inte_callback )
|
|
||||||
{
|
|
||||||
inte = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
static WRITE8_DEVICE_HANDLER( n8080_status_callback )
|
|
||||||
{
|
|
||||||
if (data & I8085_STATUS_INTA)
|
|
||||||
{
|
|
||||||
/* interrupt acknowledge */
|
|
||||||
cpu_set_input_line(device, INPUT_LINE_IRQ0, CLEAR_LINE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static I8085_CONFIG( n8080_cpu_config )
|
|
||||||
{
|
|
||||||
DEVCB_HANDLER(n8080_status_callback), /* STATUS changed callback */
|
|
||||||
DEVCB_LINE(n8080_inte_callback), /* INTE changed callback */
|
|
||||||
DEVCB_NULL, /* SID changed callback (8085A only) */
|
|
||||||
DEVCB_NULL /* SOD changed callback (8085A only) */
|
|
||||||
};
|
|
||||||
|
|
||||||
static MACHINE_DRIVER_START( spacefev )
|
|
||||||
|
|
||||||
/* basic machine hardware */
|
|
||||||
MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK / 10)
|
|
||||||
MDRV_CPU_CONFIG(n8080_cpu_config)
|
|
||||||
MDRV_CPU_PROGRAM_MAP(main_cpu_map)
|
|
||||||
MDRV_CPU_IO_MAP(main_io_map)
|
|
||||||
|
|
||||||
/* video hardware */
|
|
||||||
MDRV_SCREEN_ADD("screen", RASTER)
|
|
||||||
MDRV_SCREEN_REFRESH_RATE(60)
|
|
||||||
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
|
||||||
MDRV_SCREEN_SIZE(256, 256)
|
|
||||||
MDRV_SCREEN_VISIBLE_AREA(0, 255, 16, 239)
|
|
||||||
|
|
||||||
MDRV_PALETTE_LENGTH(8)
|
|
||||||
MDRV_PALETTE_INIT(n8080)
|
|
||||||
MDRV_VIDEO_START(spacefev)
|
|
||||||
MDRV_VIDEO_UPDATE(spacefev)
|
|
||||||
|
|
||||||
MDRV_TIMER_ADD_SCANLINE("rst1", rst1_tick, "screen", 128, 256)
|
|
||||||
MDRV_TIMER_ADD_SCANLINE("rst2", rst2_tick, "screen", 240, 256)
|
|
||||||
|
|
||||||
/* sound hardware */
|
|
||||||
MDRV_IMPORT_FROM( spacefev_sound )
|
|
||||||
MACHINE_DRIVER_END
|
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_DRIVER_START( sheriff )
|
|
||||||
|
|
||||||
/* basic machine hardware */
|
|
||||||
MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK / 10)
|
|
||||||
MDRV_CPU_CONFIG(n8080_cpu_config)
|
|
||||||
MDRV_CPU_PROGRAM_MAP(main_cpu_map)
|
|
||||||
MDRV_CPU_IO_MAP(main_io_map)
|
|
||||||
|
|
||||||
/* video hardware */
|
|
||||||
MDRV_SCREEN_ADD("screen", RASTER)
|
|
||||||
MDRV_SCREEN_REFRESH_RATE(60)
|
|
||||||
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
|
||||||
MDRV_SCREEN_SIZE(256, 256)
|
|
||||||
MDRV_SCREEN_VISIBLE_AREA(0, 255, 16, 239)
|
|
||||||
|
|
||||||
MDRV_PALETTE_LENGTH(8)
|
|
||||||
MDRV_PALETTE_INIT(n8080)
|
|
||||||
MDRV_VIDEO_START(sheriff)
|
|
||||||
MDRV_VIDEO_UPDATE(sheriff)
|
|
||||||
|
|
||||||
MDRV_TIMER_ADD_SCANLINE("rst1", rst1_tick, "screen", 128, 256)
|
|
||||||
MDRV_TIMER_ADD_SCANLINE("rst2", rst2_tick, "screen", 240, 256)
|
|
||||||
|
|
||||||
/* sound hardware */
|
|
||||||
MDRV_IMPORT_FROM( sheriff_sound )
|
|
||||||
MACHINE_DRIVER_END
|
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_DRIVER_START( helifire )
|
|
||||||
|
|
||||||
/* basic machine hardware */
|
|
||||||
MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK / 10)
|
|
||||||
MDRV_CPU_CONFIG(n8080_cpu_config)
|
|
||||||
MDRV_CPU_PROGRAM_MAP(helifire_main_cpu_map)
|
|
||||||
MDRV_CPU_IO_MAP(main_io_map)
|
|
||||||
|
|
||||||
/* video hardware */
|
|
||||||
MDRV_SCREEN_ADD("screen", RASTER)
|
|
||||||
MDRV_SCREEN_REFRESH_RATE(60)
|
|
||||||
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
|
||||||
MDRV_SCREEN_SIZE(256, 256)
|
|
||||||
MDRV_SCREEN_VISIBLE_AREA(0, 255, 16, 239)
|
|
||||||
|
|
||||||
MDRV_PALETTE_LENGTH(8 + 0x400)
|
|
||||||
MDRV_PALETTE_INIT(helifire)
|
|
||||||
MDRV_VIDEO_START(helifire)
|
|
||||||
MDRV_VIDEO_UPDATE(helifire)
|
|
||||||
MDRV_VIDEO_EOF(helifire)
|
|
||||||
|
|
||||||
MDRV_TIMER_ADD_SCANLINE("rst1", rst1_tick, "screen", 128, 256)
|
|
||||||
MDRV_TIMER_ADD_SCANLINE("rst2", rst2_tick, "screen", 240, 256)
|
|
||||||
|
|
||||||
/* sound hardware */
|
|
||||||
MDRV_IMPORT_FROM( helifire_sound )
|
|
||||||
MACHINE_DRIVER_END
|
|
||||||
|
|
||||||
|
/* Input ports */
|
||||||
|
|
||||||
static INPUT_PORTS_START( spacefev )
|
static INPUT_PORTS_START( spacefev )
|
||||||
PORT_START("IN0")
|
PORT_START("IN0")
|
||||||
@ -487,8 +365,7 @@ static INPUT_PORTS_START( helifire )
|
|||||||
PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ))
|
PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ))
|
||||||
|
|
||||||
/* potentiometers */
|
/* potentiometers */
|
||||||
|
PORT_START("POT0")
|
||||||
PORT_START("POT0") /* 04 */
|
|
||||||
PORT_DIPNAME( 0xff, 0x50, "VR1 sun brightness" )
|
PORT_DIPNAME( 0xff, 0x50, "VR1 sun brightness" )
|
||||||
PORT_DIPSETTING( 0x00, "00" )
|
PORT_DIPSETTING( 0x00, "00" )
|
||||||
PORT_DIPSETTING( 0x10, "10" )
|
PORT_DIPSETTING( 0x10, "10" )
|
||||||
@ -499,7 +376,7 @@ static INPUT_PORTS_START( helifire )
|
|||||||
PORT_DIPSETTING( 0x60, "60" )
|
PORT_DIPSETTING( 0x60, "60" )
|
||||||
PORT_DIPSETTING( 0x70, "70" )
|
PORT_DIPSETTING( 0x70, "70" )
|
||||||
|
|
||||||
PORT_START("POT1") /* 05 */
|
PORT_START("POT1")
|
||||||
PORT_DIPNAME( 0xff, 0x00, "VR2 sea brightness" )
|
PORT_DIPNAME( 0xff, 0x00, "VR2 sea brightness" )
|
||||||
PORT_DIPSETTING( 0x00, "00" )
|
PORT_DIPSETTING( 0x00, "00" )
|
||||||
PORT_DIPSETTING( 0x10, "10" )
|
PORT_DIPSETTING( 0x10, "10" )
|
||||||
@ -509,10 +386,227 @@ static INPUT_PORTS_START( helifire )
|
|||||||
PORT_DIPSETTING( 0x50, "50" )
|
PORT_DIPSETTING( 0x50, "50" )
|
||||||
PORT_DIPSETTING( 0x60, "60" )
|
PORT_DIPSETTING( 0x60, "60" )
|
||||||
PORT_DIPSETTING( 0x70, "70" )
|
PORT_DIPSETTING( 0x70, "70" )
|
||||||
|
|
||||||
INPUT_PORTS_END
|
INPUT_PORTS_END
|
||||||
|
|
||||||
|
|
||||||
|
/* Interrupts */
|
||||||
|
|
||||||
|
static TIMER_DEVICE_CALLBACK( rst1_tick )
|
||||||
|
{
|
||||||
|
n8080_state *n8080 = (n8080_state *)timer->machine->driver_data;
|
||||||
|
int state = n8080->inte ? ASSERT_LINE : CLEAR_LINE;
|
||||||
|
|
||||||
|
/* V7 = 1, V6 = 0 */
|
||||||
|
cputag_set_input_line_and_vector(timer->machine, "maincpu", INPUT_LINE_IRQ0, state, 0xcf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static TIMER_DEVICE_CALLBACK( rst2_tick )
|
||||||
|
{
|
||||||
|
n8080_state *n8080 = (n8080_state *)timer->machine->driver_data;
|
||||||
|
int state = n8080->inte ? ASSERT_LINE : CLEAR_LINE;
|
||||||
|
|
||||||
|
/* vblank */
|
||||||
|
cputag_set_input_line_and_vector(timer->machine, "maincpu", INPUT_LINE_IRQ0, state, 0xd7);
|
||||||
|
}
|
||||||
|
|
||||||
|
static WRITE_LINE_DEVICE_HANDLER( n8080_inte_callback )
|
||||||
|
{
|
||||||
|
n8080_state *n8080 = (n8080_state *)device->machine->driver_data;
|
||||||
|
n8080->inte = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
static WRITE8_DEVICE_HANDLER( n8080_status_callback )
|
||||||
|
{
|
||||||
|
if (data & I8085_STATUS_INTA)
|
||||||
|
{
|
||||||
|
/* interrupt acknowledge */
|
||||||
|
cpu_set_input_line(device, INPUT_LINE_IRQ0, CLEAR_LINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static I8085_CONFIG( n8080_cpu_config )
|
||||||
|
{
|
||||||
|
DEVCB_HANDLER(n8080_status_callback), /* STATUS changed callback */
|
||||||
|
DEVCB_LINE(n8080_inte_callback), /* INTE changed callback */
|
||||||
|
DEVCB_NULL, /* SID changed callback (8085A only) */
|
||||||
|
DEVCB_NULL /* SOD changed callback (8085A only) */
|
||||||
|
};
|
||||||
|
|
||||||
|
static MACHINE_START( n8080 )
|
||||||
|
{
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
|
state_save_register_global(machine, state->shift_data);
|
||||||
|
state_save_register_global(machine, state->shift_bits);
|
||||||
|
state_save_register_global(machine, state->inte);
|
||||||
|
}
|
||||||
|
|
||||||
|
static MACHINE_START( spacefev )
|
||||||
|
{
|
||||||
|
MACHINE_START_CALL(n8080);
|
||||||
|
MACHINE_START_CALL(spacefev_sound);
|
||||||
|
}
|
||||||
|
|
||||||
|
static MACHINE_START( sheriff )
|
||||||
|
{
|
||||||
|
MACHINE_START_CALL(n8080);
|
||||||
|
MACHINE_START_CALL(sheriff_sound);
|
||||||
|
}
|
||||||
|
|
||||||
|
static MACHINE_START( helifire )
|
||||||
|
{
|
||||||
|
MACHINE_START_CALL(n8080);
|
||||||
|
MACHINE_START_CALL(helifire_sound);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static MACHINE_RESET( n8080 )
|
||||||
|
{
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
|
state->shift_data = 0;
|
||||||
|
state->shift_bits = 0;
|
||||||
|
state->inte = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MACHINE_RESET( spacefev )
|
||||||
|
{
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
|
MACHINE_RESET_CALL(n8080);
|
||||||
|
MACHINE_RESET_CALL(spacefev_sound);
|
||||||
|
|
||||||
|
state->spacefev_red_screen = 0;
|
||||||
|
state->spacefev_red_cannon = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MACHINE_RESET( sheriff )
|
||||||
|
{
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
|
MACHINE_RESET_CALL(n8080);
|
||||||
|
MACHINE_RESET_CALL(sheriff_sound);
|
||||||
|
|
||||||
|
state->sheriff_color_mode = 0;
|
||||||
|
state->sheriff_color_data = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MACHINE_RESET( helifire )
|
||||||
|
{
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
|
MACHINE_RESET_CALL(n8080);
|
||||||
|
MACHINE_RESET_CALL(helifire_sound);
|
||||||
|
|
||||||
|
state->helifire_mv = 0;
|
||||||
|
state->helifire_sc = 0;
|
||||||
|
state->helifire_flash = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static MACHINE_DRIVER_START( spacefev )
|
||||||
|
|
||||||
|
/* driver data */
|
||||||
|
MDRV_DRIVER_DATA(n8080_state)
|
||||||
|
|
||||||
|
/* basic machine hardware */
|
||||||
|
MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK / 10)
|
||||||
|
MDRV_CPU_CONFIG(n8080_cpu_config)
|
||||||
|
MDRV_CPU_PROGRAM_MAP(main_cpu_map)
|
||||||
|
MDRV_CPU_IO_MAP(main_io_map)
|
||||||
|
|
||||||
|
MDRV_MACHINE_START(spacefev)
|
||||||
|
MDRV_MACHINE_RESET(spacefev)
|
||||||
|
|
||||||
|
/* video hardware */
|
||||||
|
MDRV_SCREEN_ADD("screen", RASTER)
|
||||||
|
MDRV_SCREEN_REFRESH_RATE(60)
|
||||||
|
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
||||||
|
MDRV_SCREEN_SIZE(256, 256)
|
||||||
|
MDRV_SCREEN_VISIBLE_AREA(0, 255, 16, 239)
|
||||||
|
|
||||||
|
MDRV_PALETTE_LENGTH(8)
|
||||||
|
MDRV_PALETTE_INIT(n8080)
|
||||||
|
MDRV_VIDEO_START(spacefev)
|
||||||
|
MDRV_VIDEO_UPDATE(spacefev)
|
||||||
|
|
||||||
|
MDRV_TIMER_ADD_SCANLINE("rst1", rst1_tick, "screen", 128, 256)
|
||||||
|
MDRV_TIMER_ADD_SCANLINE("rst2", rst2_tick, "screen", 240, 256)
|
||||||
|
|
||||||
|
/* sound hardware */
|
||||||
|
MDRV_IMPORT_FROM( spacefev_sound )
|
||||||
|
MACHINE_DRIVER_END
|
||||||
|
|
||||||
|
|
||||||
|
static MACHINE_DRIVER_START( sheriff )
|
||||||
|
|
||||||
|
/* driver data */
|
||||||
|
MDRV_DRIVER_DATA(n8080_state)
|
||||||
|
|
||||||
|
/* basic machine hardware */
|
||||||
|
MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK / 10)
|
||||||
|
MDRV_CPU_CONFIG(n8080_cpu_config)
|
||||||
|
MDRV_CPU_PROGRAM_MAP(main_cpu_map)
|
||||||
|
MDRV_CPU_IO_MAP(main_io_map)
|
||||||
|
|
||||||
|
MDRV_MACHINE_START(sheriff)
|
||||||
|
MDRV_MACHINE_RESET(sheriff)
|
||||||
|
|
||||||
|
/* video hardware */
|
||||||
|
MDRV_SCREEN_ADD("screen", RASTER)
|
||||||
|
MDRV_SCREEN_REFRESH_RATE(60)
|
||||||
|
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
||||||
|
MDRV_SCREEN_SIZE(256, 256)
|
||||||
|
MDRV_SCREEN_VISIBLE_AREA(0, 255, 16, 239)
|
||||||
|
|
||||||
|
MDRV_PALETTE_LENGTH(8)
|
||||||
|
MDRV_PALETTE_INIT(n8080)
|
||||||
|
MDRV_VIDEO_START(sheriff)
|
||||||
|
MDRV_VIDEO_UPDATE(sheriff)
|
||||||
|
|
||||||
|
MDRV_TIMER_ADD_SCANLINE("rst1", rst1_tick, "screen", 128, 256)
|
||||||
|
MDRV_TIMER_ADD_SCANLINE("rst2", rst2_tick, "screen", 240, 256)
|
||||||
|
|
||||||
|
/* sound hardware */
|
||||||
|
MDRV_IMPORT_FROM( sheriff_sound )
|
||||||
|
MACHINE_DRIVER_END
|
||||||
|
|
||||||
|
|
||||||
|
static MACHINE_DRIVER_START( helifire )
|
||||||
|
|
||||||
|
/* driver data */
|
||||||
|
MDRV_DRIVER_DATA(n8080_state)
|
||||||
|
|
||||||
|
/* basic machine hardware */
|
||||||
|
MDRV_CPU_ADD("maincpu", 8080, MASTER_CLOCK / 10)
|
||||||
|
MDRV_CPU_CONFIG(n8080_cpu_config)
|
||||||
|
MDRV_CPU_PROGRAM_MAP(helifire_main_cpu_map)
|
||||||
|
MDRV_CPU_IO_MAP(main_io_map)
|
||||||
|
|
||||||
|
MDRV_MACHINE_START(helifire)
|
||||||
|
MDRV_MACHINE_RESET(helifire)
|
||||||
|
|
||||||
|
/* video hardware */
|
||||||
|
MDRV_SCREEN_ADD("screen", RASTER)
|
||||||
|
MDRV_SCREEN_REFRESH_RATE(60)
|
||||||
|
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
||||||
|
MDRV_SCREEN_SIZE(256, 256)
|
||||||
|
MDRV_SCREEN_VISIBLE_AREA(0, 255, 16, 239)
|
||||||
|
|
||||||
|
MDRV_PALETTE_LENGTH(8 + 0x400)
|
||||||
|
MDRV_PALETTE_INIT(helifire)
|
||||||
|
MDRV_VIDEO_START(helifire)
|
||||||
|
MDRV_VIDEO_UPDATE(helifire)
|
||||||
|
MDRV_VIDEO_EOF(helifire)
|
||||||
|
|
||||||
|
MDRV_TIMER_ADD_SCANLINE("rst1", rst1_tick, "screen", 128, 256)
|
||||||
|
MDRV_TIMER_ADD_SCANLINE("rst2", rst2_tick, "screen", 240, 256)
|
||||||
|
|
||||||
|
/* sound hardware */
|
||||||
|
MDRV_IMPORT_FROM( helifire_sound )
|
||||||
|
MACHINE_DRIVER_END
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Space Fever (3 sets, Space Fever?, High Splitter?, Space Launcher?)
|
Space Fever (3 sets, Space Fever?, High Splitter?, Space Launcher?)
|
||||||
Nintendo, 1979
|
Nintendo, 1979
|
||||||
@ -824,14 +918,14 @@ ROM_START( helifirea )
|
|||||||
ROM_END
|
ROM_END
|
||||||
|
|
||||||
|
|
||||||
GAME( 1979, spacefev, 0, spacefev, spacefev, 0, ROT270, "Nintendo", "Space Fever (New Ver.)", 0 )
|
GAME( 1979, spacefev, 0, spacefev, spacefev, 0, ROT270, "Nintendo", "Space Fever (New Ver.)", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1979, spacefevo, spacefev, spacefev, spacefev, 0, ROT270, "Nintendo", "Space Fever (Old Ver.)", 0 )
|
GAME( 1979, spacefevo, spacefev, spacefev, spacefev, 0, ROT270, "Nintendo", "Space Fever (Old Ver.)", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1979, spacefevo2, spacefev, spacefev, spacefev, 0, ROT270, "Nintendo", "Space Fever (Older Ver.)", 0 )
|
GAME( 1979, spacefevo2, spacefev, spacefev, spacefev, 0, ROT270, "Nintendo", "Space Fever (Older Ver.)", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1979, highsplt, 0, spacefev, highsplt, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 1)", 0 )
|
GAME( 1979, highsplt, 0, spacefev, highsplt, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 1)", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1979, highsplta, highsplt, spacefev, highsplt, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 2)", 0 )
|
GAME( 1979, highsplta, highsplt, spacefev, highsplt, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 2)", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1979, highspltb, highsplt, spacefev, highsplt, 0, ROT270, "Nintendo", "Space Fever High Splitter (alt Sound)", 0 )
|
GAME( 1979, highspltb, highsplt, spacefev, highsplt, 0, ROT270, "Nintendo", "Space Fever High Splitter (alt Sound)", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1979, spacelnc, 0, spacefev, spacelnc, 0, ROT270, "Nintendo", "Space Launcher", GAME_NOT_WORKING )
|
GAME( 1979, spacelnc, 0, spacefev, spacelnc, 0, ROT270, "Nintendo", "Space Launcher", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1979, sheriff, 0, sheriff, sheriff, 0, ROT270, "Nintendo", "Sheriff", 0 )
|
GAME( 1979, sheriff, 0, sheriff, sheriff, 0, ROT270, "Nintendo", "Sheriff", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1980, bandido, sheriff, sheriff, bandido, 0, ROT270, "Exidy", "Bandido", 0 )
|
GAME( 1980, bandido, sheriff, sheriff, bandido, 0, ROT270, "Exidy", "Bandido", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1980, helifire, 0, helifire, helifire, 0, ROT270, "Nintendo", "HeliFire (set 1)", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
|
GAME( 1980, helifire, 0, helifire, helifire, 0, ROT270, "Nintendo", "HeliFire (set 1)", GAME_NOT_WORKING | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1980, helifirea, helifire, helifire, helifire, 0, ROT270, "Nintendo", "HeliFire (set 2)", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
|
GAME( 1980, helifirea, helifire, helifire, helifire, 0, ROT270, "Nintendo", "HeliFire (set 2)", GAME_NOT_WORKING | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||||
|
@ -1,10 +1,43 @@
|
|||||||
|
|
||||||
|
typedef struct _n8080_state n8080_state;
|
||||||
|
struct _n8080_state
|
||||||
|
{
|
||||||
|
/* memory pointers */
|
||||||
|
UINT8 * videoram;
|
||||||
|
UINT8 * colorram; // for helifire
|
||||||
|
|
||||||
|
/* video-related */
|
||||||
|
emu_timer* cannon_timer;
|
||||||
|
int spacefev_red_screen;
|
||||||
|
int spacefev_red_cannon;
|
||||||
|
int sheriff_color_mode;
|
||||||
|
int sheriff_color_data;
|
||||||
|
int helifire_flash;
|
||||||
|
UINT8 helifire_LSFR[63];
|
||||||
|
unsigned helifire_mv;
|
||||||
|
unsigned helifire_sc; /* IC56 */
|
||||||
|
|
||||||
|
/* sound-related */
|
||||||
|
int n8080_hardware;
|
||||||
|
emu_timer* sound_timer[3];
|
||||||
|
int helifire_dac_phase;
|
||||||
|
double helifire_dac_volume;
|
||||||
|
double helifire_dac_timing;
|
||||||
|
UINT16 prev_sound_pins;
|
||||||
|
UINT16 curr_sound_pins;
|
||||||
|
int mono_flop[3];
|
||||||
|
UINT8 prev_snd_data;
|
||||||
|
|
||||||
|
/* other */
|
||||||
|
unsigned shift_data;
|
||||||
|
unsigned shift_bits;
|
||||||
|
int inte;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*----------- defined in video/n8080.c -----------*/
|
/*----------- defined in video/n8080.c -----------*/
|
||||||
|
|
||||||
extern int helifire_flash;
|
|
||||||
|
|
||||||
extern int spacefev_red_screen;
|
|
||||||
extern int spacefev_red_cannon;
|
|
||||||
|
|
||||||
WRITE8_HANDLER( n8080_video_control_w );
|
WRITE8_HANDLER( n8080_video_control_w );
|
||||||
|
|
||||||
PALETTE_INIT( n8080 );
|
PALETTE_INIT( n8080 );
|
||||||
@ -26,6 +59,12 @@ MACHINE_DRIVER_EXTERN( spacefev_sound );
|
|||||||
MACHINE_DRIVER_EXTERN( sheriff_sound );
|
MACHINE_DRIVER_EXTERN( sheriff_sound );
|
||||||
MACHINE_DRIVER_EXTERN( helifire_sound );
|
MACHINE_DRIVER_EXTERN( helifire_sound );
|
||||||
|
|
||||||
|
MACHINE_START( spacefev_sound );
|
||||||
|
MACHINE_START( sheriff_sound );
|
||||||
|
MACHINE_START( helifire_sound );
|
||||||
|
MACHINE_RESET( spacefev_sound );
|
||||||
|
MACHINE_RESET( sheriff_sound );
|
||||||
|
MACHINE_RESET( helifire_sound );
|
||||||
|
|
||||||
WRITE8_HANDLER( n8080_sound_1_w );
|
WRITE8_HANDLER( n8080_sound_1_w );
|
||||||
WRITE8_HANDLER( n8080_sound_2_w );
|
WRITE8_HANDLER( n8080_sound_2_w );
|
||||||
|
|
||||||
|
@ -7,27 +7,13 @@
|
|||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "includes/n8080.h"
|
#include "includes/n8080.h"
|
||||||
|
|
||||||
int spacefev_red_screen;
|
|
||||||
int spacefev_red_cannon;
|
|
||||||
|
|
||||||
int helifire_flash;
|
|
||||||
|
|
||||||
static emu_timer* cannon_timer;
|
|
||||||
|
|
||||||
static int sheriff_color_mode;
|
|
||||||
static int sheriff_color_data;
|
|
||||||
|
|
||||||
static UINT8 helifire_LSFR[63];
|
|
||||||
|
|
||||||
static unsigned helifire_mv;
|
|
||||||
static unsigned helifire_sc; /* IC56 */
|
|
||||||
|
|
||||||
|
|
||||||
WRITE8_HANDLER( n8080_video_control_w )
|
WRITE8_HANDLER( n8080_video_control_w )
|
||||||
{
|
{
|
||||||
sheriff_color_mode = (data >> 3) & 3;
|
n8080_state *state = (n8080_state *)space->machine->driver_data;
|
||||||
sheriff_color_data = (data >> 0) & 7;
|
|
||||||
|
|
||||||
|
state->sheriff_color_mode = (data >> 3) & 3;
|
||||||
|
state->sheriff_color_data = (data >> 0) & 7;
|
||||||
flip_screen_set_no_update(space->machine, data & 0x20);
|
flip_screen_set_no_update(space->machine, data & 0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,75 +48,81 @@ PALETTE_INIT( helifire )
|
|||||||
|
|
||||||
void spacefev_start_red_cannon( running_machine *machine )
|
void spacefev_start_red_cannon( running_machine *machine )
|
||||||
{
|
{
|
||||||
spacefev_red_cannon = 1;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
timer_adjust_oneshot(cannon_timer, ATTOTIME_IN_USEC(550 * 68 * 10), 0);
|
state->spacefev_red_cannon = 1;
|
||||||
|
timer_adjust_oneshot(state->cannon_timer, ATTOTIME_IN_USEC(550 * 68 * 10), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TIMER_CALLBACK( spacefev_stop_red_cannon )
|
static TIMER_CALLBACK( spacefev_stop_red_cannon )
|
||||||
{
|
{
|
||||||
spacefev_red_cannon = 0;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
timer_adjust_oneshot(cannon_timer, attotime_never, 0);
|
state->spacefev_red_cannon = 0;
|
||||||
|
timer_adjust_oneshot(state->cannon_timer, attotime_never, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void helifire_next_line( running_machine *machine )
|
static void helifire_next_line( running_machine *machine )
|
||||||
{
|
{
|
||||||
helifire_mv++;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
if (helifire_sc % 4 == 2)
|
state->helifire_mv++;
|
||||||
|
|
||||||
|
if (state->helifire_sc % 4 == 2)
|
||||||
{
|
{
|
||||||
helifire_mv %= 256;
|
state->helifire_mv %= 256;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (flip_screen_get(machine))
|
if (flip_screen_get(machine))
|
||||||
{
|
state->helifire_mv %= 255;
|
||||||
helifire_mv %= 255;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
state->helifire_mv %= 257;
|
||||||
helifire_mv %= 257;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (helifire_mv == 128)
|
if (state->helifire_mv == 128)
|
||||||
{
|
{
|
||||||
helifire_sc++;
|
state->helifire_sc++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VIDEO_START( spacefev )
|
VIDEO_START( spacefev )
|
||||||
{
|
{
|
||||||
cannon_timer = timer_alloc(machine, spacefev_stop_red_cannon, NULL);
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
|
state->cannon_timer = timer_alloc(machine, spacefev_stop_red_cannon, NULL);
|
||||||
|
|
||||||
flip_screen_set_no_update(machine, 0);
|
flip_screen_set_no_update(machine, 0);
|
||||||
|
|
||||||
spacefev_red_screen = 0;
|
state_save_register_global(machine, state->spacefev_red_screen);
|
||||||
spacefev_red_cannon = 0;
|
state_save_register_global(machine, state->spacefev_red_cannon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VIDEO_START( sheriff )
|
VIDEO_START( sheriff )
|
||||||
{
|
{
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
|
||||||
flip_screen_set_no_update(machine, 0);
|
flip_screen_set_no_update(machine, 0);
|
||||||
|
|
||||||
sheriff_color_mode = 0;
|
state_save_register_global(machine, state->sheriff_color_mode);
|
||||||
sheriff_color_data = 0;
|
state_save_register_global(machine, state->sheriff_color_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VIDEO_START( helifire )
|
VIDEO_START( helifire )
|
||||||
{
|
{
|
||||||
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
UINT8 data = 0;
|
UINT8 data = 0;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
helifire_mv = 0;
|
state_save_register_global(machine, state->helifire_mv);
|
||||||
helifire_sc = 0;
|
state_save_register_global(machine, state->helifire_sc);
|
||||||
|
state_save_register_global(machine, state->helifire_flash);
|
||||||
|
state_save_register_global_array(machine, state->helifire_LSFR);
|
||||||
|
|
||||||
for (i = 0; i < 63; i++)
|
for (i = 0; i < 63; i++)
|
||||||
{
|
{
|
||||||
@ -140,23 +132,22 @@ VIDEO_START( helifire )
|
|||||||
|
|
||||||
data = (data << 1) | (bit & 1);
|
data = (data << 1) | (bit & 1);
|
||||||
|
|
||||||
helifire_LSFR[i] = data;
|
state->helifire_LSFR[i] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
flip_screen_set_no_update(machine, 0);
|
flip_screen_set_no_update(machine, 0);
|
||||||
|
|
||||||
helifire_flash = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VIDEO_UPDATE( spacefev )
|
VIDEO_UPDATE( spacefev )
|
||||||
{
|
{
|
||||||
|
n8080_state *state = (n8080_state *)screen->machine->driver_data;
|
||||||
UINT8 mask = flip_screen_get(screen->machine) ? 0xff : 0x00;
|
UINT8 mask = flip_screen_get(screen->machine) ? 0xff : 0x00;
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
const UINT8* pRAM = videoram;
|
const UINT8* pRAM = state->videoram;
|
||||||
const UINT8* pPROM = memory_region(screen->machine, "proms");
|
const UINT8* pPROM = memory_region(screen->machine, "proms");
|
||||||
|
|
||||||
for (y = 0; y < 256; y++)
|
for (y = 0; y < 256; y++)
|
||||||
@ -169,17 +160,15 @@ VIDEO_UPDATE( spacefev )
|
|||||||
|
|
||||||
UINT8 color = 0;
|
UINT8 color = 0;
|
||||||
|
|
||||||
if (spacefev_red_screen)
|
if (state->spacefev_red_screen)
|
||||||
{
|
|
||||||
color = 1;
|
color = 1;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT8 val = pPROM[x >> 3];
|
UINT8 val = pPROM[x >> 3];
|
||||||
|
|
||||||
if ((x >> 3) == 0x06)
|
if ((x >> 3) == 0x06)
|
||||||
{
|
{
|
||||||
color = spacefev_red_cannon ? 1 : 7;
|
color = state->spacefev_red_cannon ? 1 : 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((x >> 3) == 0x1b)
|
if ((x >> 3) == 0x1b)
|
||||||
@ -222,6 +211,7 @@ VIDEO_UPDATE( spacefev )
|
|||||||
|
|
||||||
VIDEO_UPDATE( sheriff )
|
VIDEO_UPDATE( sheriff )
|
||||||
{
|
{
|
||||||
|
n8080_state *state = (n8080_state *)screen->machine->driver_data;
|
||||||
UINT8 mask = flip_screen_get(screen->machine) ? 0xff : 0x00;
|
UINT8 mask = flip_screen_get(screen->machine) ? 0xff : 0x00;
|
||||||
|
|
||||||
const UINT8* pPROM = memory_region(screen->machine, "proms");
|
const UINT8* pPROM = memory_region(screen->machine, "proms");
|
||||||
@ -229,7 +219,7 @@ VIDEO_UPDATE( sheriff )
|
|||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
const UINT8* pRAM = videoram;
|
const UINT8* pRAM = state->videoram;
|
||||||
|
|
||||||
for (y = 0; y < 256; y++)
|
for (y = 0; y < 256; y++)
|
||||||
{
|
{
|
||||||
@ -241,20 +231,14 @@ VIDEO_UPDATE( sheriff )
|
|||||||
|
|
||||||
UINT8 color = pPROM[32 * (y >> 3) + (x >> 3)];
|
UINT8 color = pPROM[32 * (y >> 3) + (x >> 3)];
|
||||||
|
|
||||||
if (sheriff_color_mode == 1 && !(color & 8))
|
if (state->sheriff_color_mode == 1 && !(color & 8))
|
||||||
{
|
color = state->sheriff_color_data ^ 7;
|
||||||
color = sheriff_color_data ^ 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sheriff_color_mode == 2)
|
if (state->sheriff_color_mode == 2)
|
||||||
{
|
color = state->sheriff_color_data ^ 7;
|
||||||
color = sheriff_color_data ^ 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sheriff_color_mode == 3)
|
if (state->sheriff_color_mode == 3)
|
||||||
{
|
|
||||||
color = 7;
|
color = 7;
|
||||||
}
|
|
||||||
|
|
||||||
for (n = 0; n < 8; n++)
|
for (n = 0; n < 8; n++)
|
||||||
{
|
{
|
||||||
@ -270,13 +254,14 @@ VIDEO_UPDATE( sheriff )
|
|||||||
|
|
||||||
VIDEO_UPDATE( helifire )
|
VIDEO_UPDATE( helifire )
|
||||||
{
|
{
|
||||||
|
n8080_state *state = (n8080_state *)screen->machine->driver_data;
|
||||||
int SUN_BRIGHTNESS = input_port_read(screen->machine, "POT0");
|
int SUN_BRIGHTNESS = input_port_read(screen->machine, "POT0");
|
||||||
int SEA_BRIGHTNESS = input_port_read(screen->machine, "POT1");
|
int SEA_BRIGHTNESS = input_port_read(screen->machine, "POT1");
|
||||||
|
|
||||||
static const int wave[8] = { 0, 1, 2, 2, 2, 1, 0, 0 };
|
static const int wave[8] = { 0, 1, 2, 2, 2, 1, 0, 0 };
|
||||||
|
|
||||||
unsigned saved_mv = helifire_mv;
|
unsigned saved_mv = state->helifire_mv;
|
||||||
unsigned saved_sc = helifire_sc;
|
unsigned saved_sc = state->helifire_sc;
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
@ -285,7 +270,7 @@ VIDEO_UPDATE( helifire )
|
|||||||
{
|
{
|
||||||
UINT16* pLine = BITMAP_ADDR16(bitmap, y, 0);
|
UINT16* pLine = BITMAP_ADDR16(bitmap, y, 0);
|
||||||
|
|
||||||
int level = 120 + wave[helifire_mv & 7];
|
int level = 120 + wave[state->helifire_mv & 7];
|
||||||
|
|
||||||
/* draw sky */
|
/* draw sky */
|
||||||
|
|
||||||
@ -296,28 +281,28 @@ VIDEO_UPDATE( helifire )
|
|||||||
|
|
||||||
/* draw stars */
|
/* draw stars */
|
||||||
|
|
||||||
if (helifire_mv % 8 == 4) /* upper half */
|
if (state->helifire_mv % 8 == 4) /* upper half */
|
||||||
{
|
{
|
||||||
int step = (320 * (helifire_mv - 0)) % sizeof helifire_LSFR;
|
int step = (320 * (state->helifire_mv - 0)) % sizeof state->helifire_LSFR;
|
||||||
|
|
||||||
int data =
|
int data =
|
||||||
((helifire_LSFR[step] & 1) << 6) |
|
((state->helifire_LSFR[step] & 1) << 6) |
|
||||||
((helifire_LSFR[step] & 2) << 4) |
|
((state->helifire_LSFR[step] & 2) << 4) |
|
||||||
((helifire_LSFR[step] & 4) << 2) |
|
((state->helifire_LSFR[step] & 4) << 2) |
|
||||||
((helifire_LSFR[step] & 8) << 0);
|
((state->helifire_LSFR[step] & 8) << 0);
|
||||||
|
|
||||||
pLine[0x80 + data] |= 0x100;
|
pLine[0x80 + data] |= 0x100;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (helifire_mv % 8 == 5) /* lower half */
|
if (state->helifire_mv % 8 == 5) /* lower half */
|
||||||
{
|
{
|
||||||
int step = (320 * (helifire_mv - 1)) % sizeof helifire_LSFR;
|
int step = (320 * (state->helifire_mv - 1)) % sizeof state->helifire_LSFR;
|
||||||
|
|
||||||
int data =
|
int data =
|
||||||
((helifire_LSFR[step] & 1) << 6) |
|
((state->helifire_LSFR[step] & 1) << 6) |
|
||||||
((helifire_LSFR[step] & 2) << 4) |
|
((state->helifire_LSFR[step] & 2) << 4) |
|
||||||
((helifire_LSFR[step] & 4) << 2) |
|
((state->helifire_LSFR[step] & 4) << 2) |
|
||||||
((helifire_LSFR[step] & 8) << 0);
|
((state->helifire_LSFR[step] & 8) << 0);
|
||||||
|
|
||||||
pLine[0x00 + data] |= 0x100;
|
pLine[0x00 + data] |= 0x100;
|
||||||
}
|
}
|
||||||
@ -341,16 +326,16 @@ VIDEO_UPDATE( helifire )
|
|||||||
{
|
{
|
||||||
if (flip_screen_get(screen->machine))
|
if (flip_screen_get(screen->machine))
|
||||||
{
|
{
|
||||||
if ((videoram[offset ^ 0x1fff] << n) & 0x80)
|
if ((state->videoram[offset ^ 0x1fff] << n) & 0x80)
|
||||||
{
|
{
|
||||||
pLine[x + n] = colorram[offset ^ 0x1fff] & 7;
|
pLine[x + n] = state->colorram[offset ^ 0x1fff] & 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((videoram[offset] >> n) & 1)
|
if ((state->videoram[offset] >> n) & 1)
|
||||||
{
|
{
|
||||||
pLine[x + n] = colorram[offset] & 7;
|
pLine[x + n] = state->colorram[offset] & 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,15 +346,16 @@ VIDEO_UPDATE( helifire )
|
|||||||
helifire_next_line(screen->machine);
|
helifire_next_line(screen->machine);
|
||||||
}
|
}
|
||||||
|
|
||||||
helifire_mv = saved_mv;
|
state->helifire_mv = saved_mv;
|
||||||
helifire_sc = saved_sc;
|
state->helifire_sc = saved_sc;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VIDEO_EOF( helifire )
|
VIDEO_EOF( helifire )
|
||||||
{
|
{
|
||||||
int n = (video_screen_get_frame_number(machine->primary_screen) >> 1) % sizeof helifire_LSFR;
|
n8080_state *state = (n8080_state *)machine->driver_data;
|
||||||
|
int n = (video_screen_get_frame_number(machine->primary_screen) >> 1) % sizeof state->helifire_LSFR;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -379,9 +365,9 @@ VIDEO_EOF( helifire )
|
|||||||
int G = (i & 2);
|
int G = (i & 2);
|
||||||
int B = (i & 4);
|
int B = (i & 4);
|
||||||
|
|
||||||
if (helifire_flash)
|
if (state->helifire_flash)
|
||||||
{
|
{
|
||||||
if (helifire_LSFR[n] & 0x20)
|
if (state->helifire_LSFR[n] & 0x20)
|
||||||
{
|
{
|
||||||
G |= B;
|
G |= B;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user